AI4Finance-Foundation / FinRL

FinRL: Financial Reinforcement Learning. 🔥
https://ai4finance.org
MIT License
9.91k stars 2.39k forks source link

i found an error on FinRL_multiple_stock_trading.ipynb #47

Closed wac81 closed 3 years ago

wac81 commented 3 years ago

this problem is data processing, not alignment,but the state must have an alignment data for a day.

so original file can bring an error if you use ticker_list = config.CSI_300_TICKER

Stock Dimension: 298, State Space: 1789
Traceback (most recent call last):
  File "/home/wac/PycharmProjects/drl_crypto_coin/train/multi_train_drl.py", line 105, in <module>
    env_train, _ = e_train_gym.get_sb_env()
  File "/home/wac/.local/lib/python3.6/site-packages/finrl/env/env_stocktrading.py", line 286, in get_sb_env
    obs = e.reset()
  File "/home/wac/.local/lib/python3.6/site-packages/stable_baselines3/common/vec_env/dummy_vec_env.py", line 62, in reset
    self._save_obs(env_idx, obs)
  File "/home/wac/.local/lib/python3.6/site-packages/stable_baselines3/common/vec_env/dummy_vec_env.py", line 92, in _save_obs
    self.buf_obs[key][env_idx] = obs
ValueError: cannot copy sequence with size 1734 to array axis with dimension 1789

this request fix this error, please merged

pull request: https://github.com/AI4Finance-LLC/FinRL-Library/pull/46

BruceYanghy commented 3 years ago

this problem is data processing, not alignment,but the state must have an alignment data for a day.

so original file can bring an error if you use ticker_list = config.CSI_300_TICKER

Stock Dimension: 298, State Space: 1789
Traceback (most recent call last):
  File "/home/wac/PycharmProjects/drl_crypto_coin/train/multi_train_drl.py", line 105, in <module>
    env_train, _ = e_train_gym.get_sb_env()
  File "/home/wac/.local/lib/python3.6/site-packages/finrl/env/env_stocktrading.py", line 286, in get_sb_env
    obs = e.reset()
  File "/home/wac/.local/lib/python3.6/site-packages/stable_baselines3/common/vec_env/dummy_vec_env.py", line 62, in reset
    self._save_obs(env_idx, obs)
  File "/home/wac/.local/lib/python3.6/site-packages/stable_baselines3/common/vec_env/dummy_vec_env.py", line 92, in _save_obs
    self.buf_obs[key][env_idx] = obs
ValueError: cannot copy sequence with size 1734 to array axis with dimension 1789

this request fix this error, please merged

pull request:

46

Great, you did the Time Series Reshaping. Does it have to be after the feature engineer stage? I switched it before the feature engineer stage, found that feature engineer got some errors.

wac81 commented 3 years ago

add the intersection method to preprocess data, The purpose is to increase training stability