Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the readme example throws an Exception #172

Open
jazzist91 opened this issue Jun 22, 2021 · 6 comments
Open

the readme example throws an Exception #172

jazzist91 opened this issue Jun 22, 2021 · 6 comments

Comments

@jazzist91
Copy link

jazzist91 commented Jun 22, 2021

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

@camelpac
Copy link
Contributor

Hi have you installed the version?

@jazzist91
Copy link
Author

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

@hyeokhyen
Copy link

I also see following error.
Not sure which version of pandas work with alpaca

raise TypeError("Index must be DatetimeIndex")

@jrhone
Copy link

jrhone commented Jun 28, 2021

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

@PanicAtTheDisco88
Copy link

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)

@claytantor
Copy link

{'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)
        

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants