ZhengyaoJiang / PGPortfolio

PGPortfolio: Policy Gradient Portfolio, the source code of "A Deep Reinforcement Learning Framework for the Financial Portfolio Management Problem"(https://arxiv.org/pdf/1706.10059.pdf).
GNU General Public License v3.0
1.74k stars 750 forks source link

global_period of candles and the use of decide_by_history function #94

Open ALevitskyy opened 6 years ago

ALevitskyy commented 6 years ago

Hi, thanks for the great paper and for sharing the code. So, I checked the code, the paper and investigated Data.db and realized that while the paper used 30M candles the data is of higher frequency using 5M candles. After investigating the marketdata folder, it seems to me that global_period parameter governs what kind of candles are fed as an input to the model, with 1800 denoting 30M, 300 denoting 5M and so on. Did I get this right?

At the same time, the decide_by_history function takes 2 arguments: past portfolio weights and a 3D numpy array. So do I get it right, that if I trained the model with "global_period":1800, I need to reshape my live data to 30M bars and feed 30M bars as an input to decide_by_history rather than 5M bars?

Sorry in advance if the question appears to be stupid, I am quite a newbie.

dexhunter commented 6 years ago

Did I get this right?

yes, you can change the timeframe of data feed by changing global_period.

https://github.com/ZhengyaoJiang/PGPortfolio/blob/a2daa72d5ed62acad0a947f0bc79970c6356514b/pgportfolio/net_config.json#L22

So do I get it right, that if I trained the model with "global_period":1800, I need to reshape my live data to 30M bars and feed 30M bars as an input to decide_by_history rather than 5M bars?

I think you can try to train a model with 5M bars data of yours to see the result. But reshaping your data to 30M bars is fine as well.