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

Low benefit if the end_date is after 2018/02/10 #63

Open istvanmo opened 6 years ago

istvanmo commented 6 years ago

I tried to train the network with default parameters which can be found in the netconfig.json file, except the end date. First, I changed it to 2018/02/10. With this setting, I wasn't able to train an agent which had a higher quantity of BTC than 1.3 at the end of the backtest (which is nice, but much less than the values in the paper). I experienced the same issue with every end_date after 2018/02/10.

ziofil commented 6 years ago

I have noticed a big difference as well. For example, can you confirm that you also observe a good performance in January (especially at the end?)

istvanmo commented 6 years ago

Yes, I can. For a one month long backtest period the quantity of the BTC was around 4. Besides, I tried to change some of the hyperparameters, but couldn't find any promising settings.

DoktorDaveJoos commented 6 years ago

I guess there is a correlation between the dropping BTC course and the "bad" results in the backtest. If you teach the Agent with a continuously rising course (until end of 2017) and test it then on a dropping course - the agent faces completely new experiences.

btcourse

ziofil commented 6 years ago

But isn't this strange? I mean, for the agent BTC always has a constant value.

DoktorDaveJoos commented 6 years ago

What do you mean with constant? The BTC (your cash) represents the value of your portfolio. And because the agent is trading the currencies against each other, the value of the Bitcoin does have an impact on your profit. Correct me if this is wrong.

fbrusch-ik commented 6 years ago

Its true that 1 cash will always be 1 cash, you cant just ignore all fundamental factors though.

  1. $BTC is an incredibly powerful market leader, its price action directly influences every single altcoin.
  2. The agent likes to use reversed_USDT due to high volume

Heres a little scenario using the Total Marketcap of Crypto, not just BTC:

You probably define your input as 2015/07/01 to 2018/03/01 with the default test_portion of 8%

This means the agent will train from 2015/07/01 to 2017/12/13 which looks like this

image

then you test on 2017/12/13 until now which looks like this:

image

Depending on which network you use in the EIIE this data will mess up your weights. Simply because there was no way for it to learn how to filter out BTC Movement since all it did was go up.

fbrusch-ik commented 6 years ago

@DoktorDaveJoos the agent doesnt care about $ it only cares about the logarithmic return in BTC

"Financial Profit" isnt relevant.

DoktorDaveJoos commented 6 years ago

@insaneKane sorry you are absolutely right. It's not about $/BTC Course but CryptoX/BTC. So i checked ETH/BTC Course and saw that BTC lost against other cryptocurrencies as well (correlation between $/BTC course?).

Course ETH/BTC around new years:

ethgetsstronger

istvanmo commented 6 years ago

@insaneKane "Depending on which network you use in the EIIE this data will mess up your weights." If I understand well, there is a possibility that with RNN network it could do better (in all of my train, I used the CNN network)? I doubt it, because of the change of the data.

ZhengyaoJiang commented 6 years ago

We have two guesses about this:

  1. the agent perform worse when there are big differences in the market. The agent bases its decision on the history of the market. So once there are fundamental changes in the market, making the price movement patterns varied, the performance of the agent will drop. This hypothesis can be checked by some experiments.

  2. As many people have deployed this model on the market, the profit space has been squeezed. This hypothesis is a bit difficult to be checked.

nian-liu commented 6 years ago

@ZhengyaoJiang So any suggestion to make the model work in bear market (e.g., now)?

nian-liu commented 6 years ago

@ZhengyaoJiang I tried the model on the recent market data, from 2016/03/21 or 2017/03/21 to 2018/03/21, and kept other net_config settings unchanged. I made 6 subfolders but all the models led to loss (total assets < 1BTC).

I also tried to change the "test_portion" to 0.04 to make the models be trained on the January and February market data (which are also in bear market) and tested on the recent 20-days data, but the model still failed to make profits.

Now I am trying to train on more recent market data (from Sep, 2017). I guess the model is also very sensitive to the hyperparameters, so I will tune them next. Do you have any other suggestion? Thx!

nian-liu commented 6 years ago

@DexHunter Any suggestion to make the model work in bear market (plz see above)? Thank you. BTW, the new results show that training on more recent market data (from Sep, 2017) doesn't help. The model is still losing.

dexhunter commented 6 years ago

There are some improvements, but that's related to our unpublished work. I think @ZhengyaoJiang 's hypotheses shed some lights to the problem. Maybe you can do some experiments as well @nian-liu

nian-liu commented 6 years ago

@DexHunter Thanks for your response. But if impossible, could you please disclose a few of your improvements? Using more input features (e.g., volume, order book, MACD)? Improving the network structure? Or just tuning the hyperparameters?

dexhunter commented 6 years ago

It's really not hard to try all the 3 modifications you mentioned. You probably can try do it yourself to see if it works. The repo is under GPL-3.0 license, so feel free to make changes.

nian-liu commented 6 years ago

@DexHunter Ok, thank you.

fedecaccia commented 6 years ago

Same issues, I tranied the agent from 2015/01/01 to 2018/01/30 and then perfomr a test from 2018/01/30 to 2018/05/01. The portfolio loses a lot of value. agent

gibo commented 6 years ago

why don't you train in similar market conditions to what we are in now? ie. dec 13 - jan 15

ziofil commented 6 years ago

The conditions in the period dec 13 - Jan 15 IMHO are very different than the current conditions. Also, it’s a very short period for training.

Le jeu. 14 juin 2018 à 11:26, rob gibson notifications@github.com a écrit :

why don't you train in similar market conditions to what we are in now? ie. dec 13 - jan 15

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/ZhengyaoJiang/PGPortfolio/issues/63#issuecomment-397231518, or mute the thread https://github.com/notifications/unsubscribe-auth/AIh9O-715WvUvsEzTsbXDm8LyTQAnABlks5t8ixbgaJpZM4SZ2-c .

-- — Prof Filippo Miatto Télécom ParisTech, LTCI, Université Paris Saclay

gibo commented 6 years ago

I see the conditions are remarkably similar, ie. the boom and bust cycle of crypto.

But nether the less, as you have pointed out, the training period is too short.

ziofil commented 6 years ago

That’s true, there is a similarity on the surface, but for some reason that I don’t understand up until Jan 15 the agent makes considerably less effort to learn, whereas later on it’s always struggling. I interpreted this as a difference in market conditions. This is a difference that we might not be able to perceive, but the agent clearly feels it.

Le jeu. 14 juin 2018 à 11:35, rob gibson notifications@github.com a écrit :

I see the conditions are remarkably similar, ie. the boom and bust cycle of crypto.

But nether the less, as you have pointed out, the training period is too short.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/ZhengyaoJiang/PGPortfolio/issues/63#issuecomment-397233972, or mute the thread https://github.com/notifications/unsubscribe-auth/AIh9OyJK0O1xRGu8Ecjp6xvpbbYi_tfoks5t8i5fgaJpZM4SZ2-c .

-- — Prof Filippo Miatto Télécom ParisTech, LTCI, Université Paris Saclay

0xdarkman commented 6 years ago

shouldn't it be the case for the agent to make profits with e.g. 0.5H trading window regardless of the market trend during the wider trading window e.g. 3M? So, the training dataset trend should not impact the performance?

lorrp1 commented 6 years ago

@DexHunter "There are some improvements, but that's related to our unpublished work." do you plan to publish it in the future?

dexhunter commented 6 years ago

@LorenzoPanico Thank you for your interest in our work. We are working on it.

lorrp1 commented 6 years ago

@DexHunter have you tried using some sort of indicator (support and resistance)?