WARNING: some dates are missed in the portfolio_history
-
Hi, I am starting with Examples: Q18 : Supervised learning (Ridge Classifier).
I encountered the error : some dates are missed in the portfolio_history when run the precheck.ipynb file, whereas running the strategy.ipynb file is fine.
The resulting outcome is Sharpe in precheck is 0.25 << Sharpe in strategy.ipynb.
I think there is no forward looking, because: weights = qnbt.backtest_ml.
- Can you give me the possible reasons ?
- Can you please give me temporary way to resolve it ? (Assign some weights to missed dates)
-
@multi_byte-wildebeest Hi, the qnbt.backtest_ml is designed to avoid forward-looking as it processes the algorithm day-by-day (we call that multi-pass). That is safer than a full-time processing at once (single-pass) where all the time series is available to the user.
Let us see a concrete example: a user can define in the algorithm a global mean (in other words, the mean over all the time series). A single-pass processing will be forward-looking by construction, as at any point in time the global result of the mean will be available. That is bad.
A multi-pass processing mitigates the issue, as at point in time "t" only the mean on previous points in time is available. No forward-looking takes place.
qnbt.backtest_ml avoids this kind of forward looking.
However forward-looking is still possible, if for example the user uses a target in the future (the tomorrow price) to train the algorithm. This will be visible after the notebook processing. But precheck.ipynb will take care of this, and match the result after submission.
Is it possible that your algorithm uses unintentionally data points from the future? Normally is is very dangerous to use the shift function with negative arguments.
-
@support thank you so much for your very clear explaination !
-
This post is deleted! -
@support Hi, but how about some dates are missed in the portfolio history when run the precheck ?
-
@multi_byte-wildebeest I also encountered the situation that some dates are missed in the portfolio_history when running precheck and sharpe which are very small compared to when working on strategy. Looking forward to your help. thank you very much
-
@multi_byte-wildebeest Hi. Without an example, it's unclear what the problem might be.
If you use a state and a function that returns the prediction for one day, you will not get correct results with precheck.
This was discussed here: https://quantiacs.com/community/topic/555/access-previous-weights/18