I have the market data subscription. I am having this issue from this morning. Will appreciate if anyone could help.
data1 = api_data.get_bars(symbol, TimeFrame.Hour, start, end, adjustment=‘raw’).df
gives me error :
KeyError Traceback (most recent call last)
in
10 api_data = tradeapi.REST(API_KEY, API_SECRET, API_BASE_URL, ‘v2’)
11
—> 12 data1 = api_data.get_bars(symbol, TimeFrame.Hour, start, end, adjustment=‘raw’).df
13
14 print(data1.head())
c:\users\mushf\documents\alpaca-trading\env\lib\site-packages\alpaca_trade_api\entity_v2.py in df(self)
59 )
60
—> 61 df.columns = [self.mapping[c] for c in df.columns]
62 if not df.empty:
63 df.set_index(‘timestamp’, inplace=True)
c:\users\mushf\documents\alpaca-trading\env\lib\site-packages\alpaca_trade_api\entity_v2.py in (.0)
59 )
60
—> 61 df.columns = [self.mapping[c] for c in df.columns]
62 if not df.empty:
63 df.set_index(‘timestamp’, inplace=True)
KeyError: ‘n’