Differences between History 1min and Subscribe_bars

Hi, dear all,

I am a fresher at Alpaca. Today I have tried with history download and subscribe_bars both functions. But some strange things on volume and trade_count I have noticed that they are totally different (means not just small noisy difference, but significant…)

I have tried to download the min data with

  1. StockHistoricalDataClient and client.get_stock_bars(…)… (6 hours later than 13:33 I downloaded)
    here is the result
    2024-07-19 13:33:00+00:00 224.6300 224.9500 224.4200 224.8150 200940.0 2746.0 224.639073 → Volumn is 200940.0 and trade count is 2746.0

  2. I have listened at real time data with StockDataStream and client.subscribe_bars which gives me data each min. (listened live on 13:33 2024-07-19)

data was symbol=‘AAPL’ timestamp=datetime.datetime(2024, 7, 19, 13, 33, tzinfo=datetime.timezone.utc) open=224.555 high=224.93 low=224.435 close=224.83 volume=5962.0 trade_count=56.0 vwap=224.62974

As you can see, the open, high, low, close of all of them are quite similar (noise comes maybe from later coming trade which cannot be caught by live listening.). But I just cannot understand why are volume and trade_count are totally different.

Could someone help me on this? Which channel should I trust? Or maybe there are some formular to help convert to each other?

Best regards,
yy824

@yy824 You must be connecting to the wss://stream.data.alpaca.markets/v2/iex endpoint (notice the /iex). That streams data from the IEX exchange only and does not represent full market data which is provided in the historical bars. The telltale sign is the volume of 56 vs 2746. The IEX exchange on average represent about 2% of all market volume (56 is about 2% of 2746).

Full market streamed bars are available by subscribing to a paid market data plan.

1 Like