You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Strategy doesn't end up in a infinite recursion loop due to order submission. Furthermore on_position_opened can be called only once per position opened.
Actual Behavior
Strategy ends up in a infinite recursion loop due to order submission. Furthermore on_position_opened is called multiple times on single position opened.
Steps to Reproduce the Problem
Setup catalog and pair in ./infinite-recursion-on-submit-order-in-position-opened_bug.py with "reasonable" trade tick data on volatile pair (if data for exact replication of the problem is wanted, please contact me directly)
This was an interesting regression caused by the changes made to improve the event sequencing consistency for #2513.
Now fixed from commit 62b02ed by ensuring we pop pending events to be published to avoid recursion when the subsequent arrival of these events may trigger further order/position events.
An initial black box MRE style test was also added to assert both the expected ordering of account, order and position events arriving at the strategy, and also no recursion per the MRE.
The MRE now runs to the end of the backtest without the recursion (when account balance is increased to 100,000 USDT - to avoid a premature stop due account balance exceeded).
Also worth mentioning is that the original MACD strategy had logic issues which were causing the risk engine to correctly deny the reduce_only orders (this will be outlined in more detail in a follow-up to #2534).
Bug Report
In given files infinite-recursion-on-submit-order-in-position-opened_bug.py and infinite-recursion-on-submit-order-in-position-opened_bug.out are a strategy script and its output. The strategy opens a position and then on_opened_position opens a order.
Expected Behavior
Strategy doesn't end up in a infinite recursion loop due to order submission. Furthermore on_position_opened can be called only once per position opened.
Actual Behavior
Strategy ends up in a infinite recursion loop due to order submission. Furthermore on_position_opened is called multiple times on single position opened.
Steps to Reproduce the Problem
./infinite-recursion-on-submit-order-in-position-opened_bug.py
with "reasonable" trade tick data on volatile pair (if data for exact replication of the problem is wanted, please contact me directly)./infinite-recursion-on-submit-order-in-position-opened_bug.py >./infinite-recursion-on-submit-order-in-position-opened_bug.out 2>&1
less ./infinite-recursion-on-submit-order-in-position-opened_bug.out
Specifications
Additional notes
The text was updated successfully, but these errors were encountered: