Unexpected Order Event Handling
Expected Behavior
Settings.UnexpectedOrderEventsHandling
= UnexpectedOrder.Ignore # Drop without matching order id.
= UnexpectedOrder.Merge # Add asset; accept the fill.
= UnexpectedOrder.Shutdown # Default
void OnUnexpectedOrderEvent(UnexpectedOrderEvent event);
It could allow users to manually enter with intelligent risk control exits. Or reusing the same UUID in FIX networks.
Actual Behavior
Always shuts down strategy.
Potential Solution
In the fill handling add the additional options above and act based on the setting of the strategy.
Reproducing the Problem
Placing a trade in the OANDA cloud terminal while running a live Oanda algorithm
Checklist
- [x] I have filled out this template
- [x] I have confirmed that this issue exists on the current
masterbranch - [x] I have confirmed that this is not a duplicate issue by searching issues
The IBrokerageMessageHandler already allows this functionality, overriding the HandleOrder and setting a custom behavior, see for example https://github.com/QuantConnect/Lean/blob/master/Algorithm.Python/CustomBrokerageSideOrderHandlingRegressionPartialAlgorithm.py. By default orders are rejected
TODO here: Brokerages should now trigger the new OnNewBrokerageOrderNotification base method to trigger the functionality