AI4Finance-Foundation / FinRL

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

Facing problem when I try to echange DOW_30_TICKER to SSE_50_TICKER #11

Closed foolish318 closed 3 years ago

foolish318 commented 3 years ago

Hello: May I ask a question when I try to change the data environment from Dow 30 to SSE 50, I face the following question:

model = agent.train_SAC(modelname = "SAC{}".format(now), model_params = sac_params_tuning) Traceback (most recent call last):

File "", line 1, in model = agent.train_SAC(modelname = "SAC{}".format(now), model_params = sac_params_tuning)

File "/home/liuyimo/Downloads/FinRL-Library-master_a/finrl/model/models.py", line 136, in train_SAC model.learn(total_timesteps=model_params['timesteps'], tb_log_name = "SAC_run")

File "/home/liuyimo/anaconda3/lib/python3.7/site-packages/stable_baselines/sac/sac.py", line 378, in learn obs = self.env.reset()

File "/home/liuyimo/anaconda3/lib/python3.7/site-packages/stable_baselines/common/base_class.py", line 1104, in reset return self.unvec_obs(self.venv.reset())

File "/home/liuyimo/anaconda3/lib/python3.7/site-packages/stable_baselines/common/vec_env/dummy_vec_env.py", line 62, in reset self._save_obs(env_idx, obs)

File "/home/liuyimo/anaconda3/lib/python3.7/site-packages/stable_baselines/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 255 to array axis with dimension 355

When I run the Dow 30, everything goes fine. I tray to detect the reason behind this error, but I don't know where this '255' coming from? Is there any help for that? Thanks a lot

YangletLiu commented 3 years ago

This is a good issue. I guess maybe some code has set fix values, I did not find it yet. Would you like to join the slack channel for more discussions?

foolish318 commented 3 years ago

Sure, is there any link to join?

YangletLiu commented 3 years ago

Please check out the top section in the readme file. Thx.

gogolgrind commented 3 years ago

It seems I empirically found that the reason - stocks may have different length, check your data and or START_DATE

foolish318 commented 3 years ago

It seems I empirically found that the reason - stocks may have different length, check your data and or START_DATE

May I ask the future question: what if I change the stock collections to more than 30 stocks? Thanks a lot

YangletLiu commented 3 years ago

It seems I empirically found that the reason - stocks may have different length, check your data and or START_DATE

May I ask the future question: what if I change the stock collections to more than 30 stocks? Thanks a lot

Please pay attention to the size of variables; I think this issue is fixed (previously there was a hardcoded value of 61).

foolish318 commented 3 years ago

It seems I empirically found that the reason - stocks may have different length, check your data and or START_DATE

May I ask the future question: what if I change the stock collections to more than 30 stocks? Thanks a lot

Please pay attention to the size of variables; I think this issue is fixed (previously there was a hardcoded value of 61).

OK, Thanks a lot