-
Notifications
You must be signed in to change notification settings - Fork 430
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
BT seems unable to composite three or more layers strategy, ZeroDivisionError #433
Comments
If I recall, usually this occurs when you don't take any positions over the whole backtest. |
it happens at the first day, the strategy just begin, no matter what strategy, if the layer is three or more, it will give the sample error, you can just backtest and run from the second layer, it works well, so its not the problem of positions!If you have a three layers strategy, and it works well, could you provide me with the code, I'd appreciate it |
In the file core.py:
but we see when a children strategy update itself, the paper update iteself too。
and at the line 827:
that make me confused, if the self._paper_trade, it seems the paper just overwritten the original update。And I don't think the paper trading is required! |
determine if needs paper trading
|
When I only composite two layers strategy,it woks well, but when I add more layer strategy,such as there is a grandson strategy, threre is something wrong!
"ZeroDivisionError: Could not update third on 2017-01-02 00:00:00. Last value was 0 and net flows were 0. Currentvalue is 1000000.0. Therefore, we are dividing by zero to obtain the return for the period."
``
File "bt/core.py", line 777, in bt.core.StrategyBase.update
ZeroDivisionError: Could not update third on 2017-01-02 00:00:00. Last value was 0 and net flows were 0. Currentvalue is 1000000.0. Therefore, we are dividing by zero to obtain the return for the period.
`
I find the problem may be caused by
when I comment out the lines “if self._paper_trade:” and below, it works well.
But I'm not sure if this modification will cause other issues.
The text was updated successfully, but these errors were encountered: