-
Notifications
You must be signed in to change notification settings - Fork 1k
Streaming backtest does not stop immediately when margin exceeded #2546
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
Comments
Thanks for the report. In the provided output I see the following error (related to balance), which stops the backtest:
My understanding is you're concerned that when margin is exceeded on the last iteration of the engine, an exception may not be raised and so this condition would go undetected? I agree with you that this is not preferable -- the user should always be notified of this in all circumstances. If this is the expectation, are you able to provide a Python script which clearly reproduces that scenario. This would help us to target a change for the expected behavior efficiently. |
Hi @cjdsellers, As I wrote, this is only a possibility. This is a bug either way, but with different severity. I will try to provide an example, where it exceeds margin without a fail or confirm, it always failed in my tests, so we know more and the bug is handled appropriately with correct severity. |
Hi @cjdsellers, Here is a strategy and its output, in which an exception is not raised, but the margin is exceed. The data are still the same. |
Thanks for the report. The issue here was that the Now fixed from commit 442a95b, the backtest now stops immediately on the first occurrence of margin being exceeded. |
Uh oh!
There was an error while loading. Please reload this page.
Bug Report
In given files margin-exceeded-nontermination_bug.py and margin-exceeded-nontermination_bug.out are a strategy script and its output. The strategy exceeds its margin.
Expected Behavior
Strategy immediately terminates after margin exceed is detected.
Actual Behavior
Strategy continues to run for some time.
Comment on severity
If margin exceed happens on the end of the backtesting, there might be a possibility, that it is not terminated correctly with an exception. If not solved, it is needed in my opinion to be sure, that once margin exceeded, the backtest can't finish without an exception raised.
Steps to Reproduce the Problem
./margin-exceeded-nontermination_bug.py >./margin-exceeded-nontermination_bug.out 2>&1
less ./margin-exceeded-nontermination_bug.out
Specifications
Additional notes
The text was updated successfully, but these errors were encountered: