deependersingla / deep_trader

This project uses reinforcement learning on stock market and agent tries to learn trading. The goal is to check if the agent can learn to read tape. The project is dedicated to hero in life great Jesse Livermore.
1.46k stars 504 forks source link

Data KeyError when run dqn_model.py #14

Open zhengwsh opened 7 years ago

zhengwsh commented 7 years ago

I followed the tutorial and download the data into the correct folder, however when i run the model it occurs that data_dict has keyerror. I sincerely hope you teach me how to deal with this problem.

Traceback (most recent call last): File "/home/vinson/Desktop/deep_trader-master/tensor-reinforcement/dqn_model.py", line 11, in from train_stock import * File "/home/vinson/Desktop/deep_trader-master/tensor-reinforcement/train_stock.py", line 23, in supervised_y_data = episodic_data.make_supervised_data(data, data_dict) File "/home/vinson/Desktop/deep_trader-master/tensor-reinforcement/episodic_data.py", line 99, in make_supervised_data supervised_data.append(episode_supervised_data(episode, data_dict)) File "/home/vinson/Desktop/deep_trader-master/tensor-reinforcement/episodic_data.py", line 86, in episode_supervised_data prices.append(data_average_price(data_dict, iteration)) File "/home/vinson/Desktop/deep_trader-master/tensor-reinforcement/episodic_data.py", line 91, in data_average_price data = data_dict[list_md5_string_value(data)] KeyError: '297956b2300474fda50a2a6b1d41a714'

joaosalvado10 commented 7 years ago

Hello, I've got the same error. Any solution at the moment?

lamuguo commented 7 years ago

@deependersingla After some investigation, I think what we need is 'tensor-reinforcement/NIFTY50.csv'. Based on this, by using prepare_data(), we can generate data.pkl and data_dict.pkl on our side. Current data.pkl / data_dict.pkl doesn't match each other, I guess it has version issue.

Please take a look. Thanks!

lamuguo commented 7 years ago

I did some investigation, looks we may need to use "cPickle" directly instead of "six.moves.cPickle". Corresponding PR is https://github.com/deependersingla/deep_trader/pull/15