Thanks @Dan_Whitnable_Alpaca . Another question about extra sticker in get_stock_bars.
I used the blow code to get bars data of a list of symbols but it returns extra ones. Below is the example. The BIOS is not in my required list but get_stock_bars returns its data.
Any idea to explain this?
required symbols: {'ATXS', 'BOTT', 'SLAB', 'BYFC', 'NRIX', 'UDMY', 'BLBD', 'GHIXU', 'ATHA', 'ADUS', 'MTEKW', 'LUNG', 'DXR', 'JTEK', 'MGNX', 'BOCNU', 'RVSN', 'FYC', 'INDB', 'CNXN', 'TVGN', 'IROHR', 'GSMGW', 'CARV', 'RICK', 'BNOX', 'SPRO', 'BYNOU', 'CAFG', 'IVDAW', 'ICLN', 'PITA', 'DHAIW', 'NVDU', 'BRNS', 'INDY', 'WRAP', 'UAL', 'DTST', 'IPXX', 'AIMDW', 'AGNCN', 'SDA', 'TETE', 'METU', 'KYTX', 'LLYVA', 'CYCCP', 'CRGOW', 'WRND', 'VACHU', 'AFRM', 'HPAI', 'FLEX', 'OCGN', 'PXLW', 'LNTH', 'INNV', 'CDTX', 'BNIX', 'VC', 'COLM', 'INO', 'IAC', 'PLUS', 'TTGT', 'OPCH', 'FTNT', 'ATMC', 'MSEX', 'RPRX', 'UTRE', 'INTC', 'AACIW', 'HQGO', 'ARTW', 'AIQ', 'BABX', 'VFLO', 'CROX', 'LFMDP', 'STRS', 'CCLDO', 'FSTR', 'SEEL', 'RGF', 'DPRO', 'FPXE', 'WTMA', 'WISA', 'FCEF', 'IMOM', 'PWOD', 'BULD', 'GOGO', 'SMMT', 'PTEC', 'MCSE', 'MGX', 'WGMI'}
returned symbols {'ATXS', 'BOTT', 'SLAB', 'BYFC', 'NRIX', 'UDMY', 'BLBD', 'GHIXU', 'ATHA', 'ADUS', 'MTEKW', 'BIOS', 'DXR', 'LUNG', 'JTEK', 'MGNX', 'BOCNU', 'RVSN', 'FYC', 'INDB', 'CNXN', 'TVGN', 'IROHR', 'GSMGW', 'CARV', 'RICK', 'BNOX', 'SPRO', 'BYNOU', 'CAFG', 'IVDAW', 'ICLN', 'PITA', 'DHAIW', 'NVDU', 'BRNS', 'INDY', 'WRAP', 'UAL', 'DTST', 'AIMDW', 'AGNCN', 'SDA', 'TETE', 'METU', 'KYTX', 'LLYVA', 'CYCCP', 'CRGOW', 'WRND', 'VACHU', 'AFRM', 'HPAI', 'FLEX', 'OCGN', 'PXLW', 'LNTH', 'INNV', 'CDTX', 'BNIX', 'VC', 'COLM', 'INO', 'IAC', 'PLUS', 'OPCH', 'TTGT', 'FTNT', 'ATMC', 'MSEX', 'RPRX', 'UTRE', 'INTC', 'AACIW', 'HQGO', 'WGMI', 'ARTW', 'AIQ', 'BABX', 'VFLO', 'CROX', 'LFMDP', 'STRS', 'CCLDO', 'FSTR', 'RGF', 'SEEL', 'DPRO', 'FPXE', 'WTMA', 'WISA', 'FCEF', 'IMOM', 'PWOD', 'BULD', 'GOGO', 'SMMT', 'PTEC', 'MCSE', 'MGX', 'IPXX'}
Warning: Extra symbols found in data: {'BIOS'}
Below is the code
request_params = StockBarsRequest(
symbol_or_symbols=tickers_batch,
timeframe=TimeFrame.Day,
start=start_time,
adjustment='all',
feed='sip'
)
# Fetch data and convert time zone
bars_df = data_client.get_stock_bars(request_params).df
if not bars_df.empty:
requested_symbols = set(tickers_batch)
returned_symbols = set(bars_df.index.get_level_values('symbol'))
extra_symbols = returned_symbols - requested_symbols
if extra_symbols:
print("required symbols: ", set(tickers_batch))
print("returned symbols", set(bars_df.index.get_level_values('symbol')))
print(f"Warning: Extra symbols found in data: {extra_symbols}")