I want to get the past day of minute bars.
symbol = self.symbol,
timeframe = alpaca_trade_api.TimeFrame.Minute,
start = (datetime.datetime.now(datetime.timezone.utc) - datetime.timedelta(minutes = 86400)).isoformat()
This code returns an
alpaca_trade_api.entity_v2.BarsV2 list that has a length of
148369, which is about 1.717 days, instead of 1 day.
Currently running Python 3.10.1 and API version v2.
And yes, I have the market data subscription.
@Slickky The format of the
get_crypto_bar result is a bit different from the format of the equity
get_bars. Specifically, the crypto bars are by exchange whereas the equity bars are consolidated across all exchanges. In other words, there can be multiple minute bars (one for each exchange where trades occurred) in crypto but there will only ever be one minute bar for equities. That is why you are getting more bars than you may have expected.
See below for how the crypto data is formatted. Notice two bars for one minute with different exchanges.