alpaca-backtrader-api
alpaca-backtrader-api copied to clipboard
the readme example throws an Exception
I copied the example from the README exactly, I did not change anything except for modifying the API key , secret key and having the following setting:
IS_BACKTEST = True IS_LIVE = False symbol = "AAPL" ...
I am getting the following Exception:
Starting Portfolio Value: 100000.0
***** DATA NOTIF: DELAYED
xception in thread Thread-1:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/threading.py", line 932, in _bootstrap_inner
self.run()
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/alpaca_backtrader_api/alpacastore.py", line 414, in _t_candles
cdl = cdl.loc[
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pandas/core/frame.py", line 5162, in dropna
raise KeyError(list(np.compress(check, subset)))
KeyError: ['high']
it seems that the data that is coming back from the Alpaca broker is not properly formatted please assist in resolving this
Hi have you installed the version?
I checked all versions and made sure that they match the alpaca-backtrader-api reqruiements as far as I can tell, I have the most up to date code
I also see following error. Not sure which version of pandas work with alpaca
raise TypeError("Index must be DatetimeIndex")
I'm seeing the same KeyError: ['high']
$ pip freeze
alpaca-backtrader-api==0.14.0
alpaca-trade-api==1.2.2
backtrader==1.9.76.123
pandas==1.1.5
I am also getting the same KeyError: ['high']
Name Version Build Channel
alpaca 1.0.0 pypi_0 pypi alpaca-backtrader-api 0.14.0 pypi_0 pypi alpaca-trade-api 1.2.2 pypi_0 pypi (dev)
{'code': 42210000, 'message': 'your subscription does not permit querying data from the past 15 minutes'}
update the data period to not include today:
data0 = DataFactory(dataname='AAPL', historical=True, fromdate=datetime(
2019, 1, 1), todate=datetime(
2021, 1, 1), timeframe=bt.TimeFrame.Days)