-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Portfolio strategy: TopkDropoutStrategy #809
Comments
@TowardSun When we first design this strategy, we assume users know which stock is tradable (this is possible in most cases). Then we try to implement another version that strictly prevents the leakage of future data (the tradable info on Your point about the risk degree is right, too. Would you like to become a Qlib contributor and make the strategy better? |
Backtest ProblemThanks for your invitation. Currently, I overwrite the The detailed implementation of the function
I have checked that by printing the position information from the backtest results.
Tradable CheckAt present, the default dataset provided by qlib does not have the
after line 210. I am not sure about the data leakage in the backtest strategy, since we have shifted the prediction score to match the trading days.
If the deal price is close, the tradable check of price limit and instruments ranking list is consistent on the same day. |
@TowardSun
Qlib's default dataset provides the change field, it is stored in paths like |
Hi @TowardSun I have a question to existing implementation. It seems the sell and buy can happen in a same day. Actually, cash would be back before market close. i.e. there's no cash to buy new stocks. Do you think if it is a problem? |
The bug in this strategy seems to be this specific conditional check for holding threshold.
In real life, you would execute sell purely based on scores and not worry about the holding threshold. This would also prune the bottom scores regularly and keep a strict boundary on topK. |
Hello, thanks for the great effort for the qlib project.
My issue
I found some wried behaviors when using TopkDropoutStrategy strategy.
I expected that the number of portfolio instruments in each day be equal to the top k number.
However, due to the tradable check in the current implementation, the portfolio number changed each day.
The reasons may cause that.
get_first_n, get_last_n
function and the dealing process. Even we set the only_tradable as False, we also check the instruments can be tradable or not.The text was updated successfully, but these errors were encountered: