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
We can use custom implementations of the DefaultBrokerageMessageHandler in Python.
Actual Behavior
If the custom brokerage message handler inherits DefaultBrokerageMessageHandler, the base methods are used instead of the derived ones.
A workaround is implementing directly IBrokerageMessageHandler but this requires setting the __namespace__ attribute in order for Pythonnet to be able to pick it up.
Potential Solution
Add and overload for the SetBrokerageMessageHandler method in AlgorithmPythonWrapper that takes a PyObject and wraps it in BrokerageMessageHandlerPythonWrapper
Expected Behavior
We can use custom implementations of the
DefaultBrokerageMessageHandler
in Python.Actual Behavior
If the custom brokerage message handler inherits
DefaultBrokerageMessageHandler
, the base methods are used instead of the derived ones.A workaround is implementing directly
IBrokerageMessageHandler
but this requires setting the__namespace__
attribute in order for Pythonnet to be able to pick it up.Potential Solution
Add and overload for the
SetBrokerageMessageHandler
method inAlgorithmPythonWrapper
that takes aPyObject
and wraps it inBrokerageMessageHandlerPythonWrapper
Reproducing the Problem
See the algorithm in https://github.com/QuantConnect/Lean/blob/8bcd491fc3cb42882db2bd5000f1aefe331f713a/Algorithm.Python/CustomBrokerageSideOrderHandlingRegressionAlgorithm.py which can be ran with the
RunRegressionAlgorithm
unit test in https://github.com/QuantConnect/Lean/blob/8bcd491fc3cb42882db2bd5000f1aefe331f713a/Tests/Engine/CustomBrokerageMessageHandlerTests.csSystem Information
Windows 11
QC Cloud
Checklist
master
branchThe text was updated successfully, but these errors were encountered: