AI4Finance-Foundation / AI4Finance-Foundation/FinRL

AttributeError: 'StockTradingEnv' object has no attribute 'seed'

未关闭
#1,323 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Jupyter Notebook
星标
16.3k
派生
3.5k
PR 合并指标
30 天内没有已合并 PR

描述

**Describe the bug**
I tried to run examples\Stock_NeurIPS2018_2_Train.ipynb, and when I executed the following code
`e_train_gym = StockTradingEnv(df = train, **env_kwargs)`

I got error
```
AttributeError Traceback (most recent call last)
Cell In[34], [line 18](vscode-notebook-cell:?execution_count=34&line=18)
[2](vscode-notebook-cell:?execution_count=34&line=2) num_stock_shares = [0] * stock_dimension
[4](vscode-notebook-cell:?execution_count=34&line=4) env_kwargs = {
[5](vscode-notebook-cell:?execution_count=34&line=5) "hmax": 100,
[6](vscode-notebook-cell:?execution_count=34&line=6) "initial_amount": 1000000,
(...)
[14](vscode-notebook-cell:?execution_count=34&line=14) "reward_scaling": 1e-4
[15](vscode-notebook-cell:?execution_count=34&line=15) }
---> [18](vscode-notebook-cell:?execution_count=34&line=18) e_train_gym = StockTradingEnv(df = train, **env_kwargs)

File c:\Users\peter\.conda\envs\finrl\lib\site-packages\finrl\meta\env_stock_trading\env_stocktrading.py:101, in StockTradingEnv.__init__(self, df, stock_dim, hmax, initial_amount, num_stock_shares, buy_cost_pct, sell_cost_pct, reward_scaling, state_space, action_space, tech_indicator_list, turbulence_threshold, risk_indicator_col, make_plots, print_verbosity, day, initial, previous_state, model_name, mode, iteration)
[97](file:///C:/Users/peter/.conda/envs/finrl/lib/site-packages/finrl/meta/env_stock_trading/env_stocktrading.py:97) self.date_memory = [self._get_date()]
[98](file:///C:/Users/peter/.conda/envs/finrl/lib/site-packages/finrl/meta/env_stock_trading/env_stocktrading.py:98) # self.logger = Logger('results',[CSVOutputFormat])
[99](file:///C:/Users/peter/.conda/envs/finrl/lib/site-packages/finrl/meta/env_stock_trading/env_stocktrading.py:99) # self.reset()
[100](file:///C:/Users/peter/.conda/envs/finrl/lib/site-packages/finrl/meta/env_stock_trading/env_stocktrading.py:100) # self._seed()
--> [101](file:///C:/Users/peter/.conda/envs/finrl/lib/site-packages/finrl/meta/env_stock_trading/env_stocktrading.py:101) self.seed()

AttributeError: 'StockTradingEnv' object has no attribute 'seed'
```
**To Reproduce**
Steps to reproduce the behavior:
1. Go to 'examples\Stock_NeurIPS2018_2_Train.ipynb:34'
2. Click on 'Execute Cell'
3. See error

**Expected behavior**
code will execute successfully

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: Win11 x64
- IDE: VSCode v1.98.0
- FinRL Version: commit 8cf3cacc6f570d26b430e403ea522c8fe9e6876a (HEAD -> master, origin/master, origin/HEAD)

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。