Alpaca Market Data SDK¶
- class src.boatwright.External_Interfaces.Alpaca.Alpaca_Market_Data_API.Alpaca_Market_Data_API(api_key, api_secret, debug=False)¶
- get(path_url, params=None)¶
“generic post request structure
- get_crypto_bars(symbols, interval, timeframe, start=None, end=None, limit=None, page_token=None, loc='us')¶
The crypto bars API provides historical aggregates for a list of crypto symbols between the specified dates. https://docs.alpaca.markets/reference/v1beta3cryptobars
- Parameters:
symbols (str)
interval (int)
timeframe (str)
start (datetime)
end (datetime)
limit (int)
page_token (str)
loc (str)
- get_forex_rates(currency_pairs, timeframe='1Min', start=None, end=None, limit=1000, page_token=None)¶
Get historical forex rates for the given currency pairs in the given time interval, and at the given timeframe (snapshot frequency). https://docs.alpaca.markets/reference/rates
- Parameters:
currency_pairs (str)
timeframe (str)
start (datetime)
end (datetime)
limit (int)
page_token (str)
- get_stock_bars(symbols, interval, timeframe, start=None, end=None, limit=None, adjustment=None, asof=None, feed='iex', currency='USD', page_token=None)¶
The historical stock bars API provides aggregates for a list of stock symbols between the specified dates.
The returned results are sorted by symbol first then by bar timestamp. This means that you are likely to see only one symbol in your first response if there are enough bars for that symbol to hit the limit you requested on that request.
In these situations if you keep requesting again with the next_page_token you will eventually reach the next symbols if any bars were found for them.
https://docs.alpaca.markets/reference/stockbars
- Parameters:
symbols (str)
interval (int)
timeframe (str)
start (datetime)
end (datetime)
limit (int)
adjustment (str)
asof (date)
feed (str)
currency (str)
page_token (str)
- timeframe(interval, timeframe)¶
Ensure timeframe is consistent with Alpaca requirements
- Parameters:
interval (int)
timeframe (str)