I’m using the following code the receive real time data stream using alpaca-py library.
But after and pre market data seems to be unavailable.
Is it the case that premium subscription will provide pre and after market data? or is this just a limitation of their real time datasource?
raw_data = True
async def bar_handler(bar):
print(bar)
mapped_bar = {
BAR_MAPPING[key]: val for key, val in bar.items() if key in BAR_MAPPING
}
print(mapped_bar)
stream = StockDataStream(api_key = API_KEY, secret_key = SECRET_KEY, raw_data=raw_data, feed=DataFeed.IEX)
# stream = CryptoDataStream(api_key = API_KEY, secret_key = SECRET_KEY)
stream.subscribe_bars(bar_handler, "BABA")