alpaca-trade-api-python
alpaca-trade-api-python copied to clipboard
get_crypto_bars method not returning correct number of bars
return self.api.get_crypto_bars( symbol=self.symbol, timeframe=alpaca_trade_api.TimeFrame.Minute, start=(datetime.datetime.now(tz=datetime.timezone.utc) - datetime.timedelta(minutes=60)).isoformat(), )
The length is 141, but should be 60.
Hey @Slickky210, This can be a common occurrence for crypto when you get back multiple bars for the same minute, but from multiple exchanges. If you check the x
field on the bars you should see that they're different for where the minutes are the same.
If you need to limit it to only one exchange there is an exchanges
param on get_crypto_bars
.
Does the issue still present if you specify only one exchange?
Also in the future please use the issue templates we have