AI4Finance-Foundation / FinRL

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

Seems "future leakage" exit, need confirm #938

Open charliedream1 opened 1 year ago

charliedream1 commented 1 year ago

Describe the bug

In demo NeurIPS2018, close/low/high value are used as states, it seems future leakage exist?

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context Add any other context about the problem here.

YangletLiu commented 1 year ago

Describe the bug

In demo NeurIPS2018, close/low/high value are used as states, it seems future leakage exist?

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context Add any other context about the problem here.

Let me understand you. Do you mean that "knowing open-high-low-close" is leaking future information?

charliedream1 commented 1 year ago

yes,because the model sees the close price at the end of the day,however,u won't know this during actual trading. The model knows the future. In machine learning trading strategies, they usually shift the close price to avoid of knowing the close value of the day. In NeurIPS2018,close value of the day used and no special process made,it seems model sees the future during the training?It might be a bug?

---Original--- From: "Xiao-Yang @.> Date: Mon, Mar 27, 2023 02:03 AM To: @.>; Cc: "Optimus @.**@.>; Subject: Re: [AI4Finance-Foundation/FinRL] Seems "future leakage" exit, needconfirm (Issue #938)

Describe the bug

In demo NeurIPS2018, close/low/high value are used as states, it seems future leakage exist?

To Reproduce Steps to reproduce the behavior:

Go to '...'

Click on '....'

Scroll down to '....'

See error

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

OS: [e.g. iOS]

Browser [e.g. chrome, safari]

Version [e.g. 22]

Smartphone (please complete the following information):

Device: [e.g. iPhone6]

OS: [e.g. iOS8.1]

Browser [e.g. stock browser, safari]

Version [e.g. 22]

Additional context Add any other context about the problem here.

Let me understand you. Do you mean that "knowing open-high-low-close" is leaking future information?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

YangletLiu commented 1 year ago

yes,because the model sees the close price at the end of the day,however,u won't know this during actual trading. The model knows the future. In machine learning trading strategies, they usually shift the close price to avoid of knowing the close value of the day. In NeurIPS2018,close value of the day used and no special process made,it seems model sees the future during the training?It might be a bug?

You can use the price of the last minute as the close price. This example is simplied, so "assuming knowing the close price is almost equal to trading at the end of a day."

charliedream1 commented 1 year ago

thanks,I see now. 

Will u make a more accurate gym environment about this issue in the future? 

And current training is for days,but the trading process is within a day with value changing,what time to trade in the day? How to minimize the gap?

---Original--- From: "Xiao-Yang @.> Date: Mon, Mar 27, 2023 08:36 AM To: @.>; Cc: "Optimus @.**@.>; Subject: Re: [AI4Finance-Foundation/FinRL] Seems "future leakage" exit, needconfirm (Issue #938)

yes,because the model sees the close price at the end of the day,however,u won't know this during actual trading. The model knows the future. In machine learning trading strategies, they usually shift the close price to avoid of knowing the close value of the day. In NeurIPS2018,close value of the day used and no special process made,it seems model sees the future during the training?It might be a bug? …

You can use the price of the last minute as the close price. This example is simplied, so "assuming knowing the close price is almost equal to trading at the end of a day."

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

YangletLiu commented 1 year ago

thanks,I see now.  Will u make a more accurate gym environment about this issue in the future?  And current training is for days,but the trading process is within a day with value changing,what time to trade in the day? How to minimize the gap?

You may want to check env examples at this repo: https://github.com/AI4Finance-Foundation/FinRL-Meta/tree/master/meta

charliedream1 commented 1 year ago

thanks,I will check on it

---Original--- From: "Xiao-Yang @.> Date: Mon, Mar 27, 2023 08:56 AM To: @.>; Cc: "Optimus @.**@.>; Subject: Re: [AI4Finance-Foundation/FinRL] Seems "future leakage" exit, needconfirm (Issue #938)

thanks,I see now.  Will u make a more accurate gym environment about this issue in the future?  And current training is for days,but the trading process is within a day with value changing,what time to trade in the day? How to minimize the gap? …

You may want to check env examples at this repo: https://github.com/AI4Finance-Foundation/FinRL-Meta/tree/master/meta

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>