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

StockTrading_Demo.ipynb does not run #8

Open
bayareacoder opened this issue Jun 1, 2021 · 0 comments
Open

StockTrading_Demo.ipynb does not run #8

bayareacoder opened this issue Jun 1, 2021 · 0 comments

Comments

@bayareacoder
Copy link

bayareacoder commented Jun 1, 2021

Issues:

  1. The file being written is StockTradingEnv-v2_0 so the code to load the file for backtesting should be: args.cwd = './AgentPPO/StockTradingEnv-v2_0' instead of v1_0
  2. Even when making above change, the following error occurs in backtesting:
KeyError                                  Traceback (most recent call last)
~/opt/anaconda3/lib/python3.8/site-packages/pandas/core/indexes/base.py in get_loc(self, key, method, tolerance)
   3079             try:
-> 3080                 return self._engine.get_loc(casted_key)
   3081             except KeyError as err:

pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

KeyError: 'single-stock-baseline'

UPDATE:
I believe the fix is to change in file env.py, method get_daily_return:

return pd.Series(df["single-stock-baseline"], index=df.index)

to

return pd.Series(df["daily_return"], index=df.index)
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

1 participant