drl-portfolio-management icon indicating copy to clipboard operation
drl-portfolio-management copied to clipboard

Trading carry on weekend.

Open sino30535 opened this issue 6 years ago • 1 comments

Hello, thanks for sharing your work. When I try the ddpg_experiments.ipynb, I find that the model didn't recognize weekend and still buy at the open price and sell at close price, hence it keep accumulate rewards at weekend using the open/close price ratio at Friday. You can find the error by checking env.infos

env = PortfolioEnv(target_history, target_stocks, window_length=3, steps=1000, sample_start_date='2012-08-17') test_model(env, ddpg_model) for i in range(500): print(env.infos[i]['date'], env.infos[i]['portfolio_value'], env.infos[i]['return'])

the partial results shows: 2012-09-02 1.058014239550557 0.0013116319398563077 2012-09-03 1.059402875785309 0.0013116323757466268 2012-09-04 1.0607933903235898 0.0013116849102682993 2012-09-05 1.0675025217029879 0.006304718720860286 2012-09-06 1.0637071820637054 -0.003561680119160464 2012-09-07 1.090686865405708 0.025047501078305816 2012-09-08 1.0773419908170259 -0.012310761424490245 2012-09-09 1.0641603946671545 -0.012310761448217923 2012-09-10 1.0511400792449224 -0.012310761426362674 2012-09-11 1.0297269828798703 -0.020581662744926732 2012-09-12 1.0308227588613141 0.0010635764348758947 2012-09-13 1.016849685771081 -0.013647973711283193 2012-09-14 1.0218781309497884 0.004932934435793886 2012-09-15 0.9946166375396496 -0.027040143728223203 2012-09-16 0.9986255719667779 0.004022531505118037 2012-09-17 1.0026506649364386 0.004022531505279921

The almost identical rewards we got at 9/2, 9/3, 9/4 and every weekend messed up our portfolio value. Any ideas?

sino30535 avatar Nov 06 '18 21:11 sino30535

Yes. This is just a course project and there are a lot of practical issues regarding the environment. I suggest you look at other environment like this one https://github.com/wassname/rl-portfolio-management.

vermouth1992 avatar Nov 06 '18 21:11 vermouth1992