Cant Access data for crypto

 api = tradeapi.REST(api_key, api_secret, base_url)

stock = api.get_barset('BTCUSD', 'minute', limit = 5)
print(stock.df)

obviously the api_key, api_secret, base_url (paper market), have all been specified.
however all that is returned is .
"Empty DataFrame
Columns: [(BTCUSD, open), (BTCUSD, high), (BTCUSD, low), (BTCUSD, close), (BTCUSD, volume)]
Index: []
"
the index is empty. If I ran this with “AAPL” as the stock it would return the correct datafield, can you not access crypto market data? currently running with the free tier.

3 Likes

I had the same problem and then I found get_crypto_bars in the rest.py file.

Try:

from alpaca_trade_api.rest import REST, TimeFrame
api = REST()

api.get_crypto_bars(“BTCUSD”, TimeFrame.Hour, “2022-04-01”, “2022-04-14”).df

Hi,

Thank you for contributing! We have a dedicated discord focused solely on Crypto related queries with an active community and more engagement. Feel free to join via the invite link below;

Best,