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
Proposal: change _init to _post_init to solve the issue and let the dataclass initialize with all possible attributes.
Error example is here:
Python.Runtime.PythonException: Position.init() got an unexpected keyword argument 'orderId'
File "/QuantConnect/live/./cache/algorithm/project/Tools/PositionsStore.py", line 135, in reconstruct_position
position = Position(**filtered_data)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/QuantConnect/live/./cache/algorithm/project/Tools/PositionsStore.py", line 149, in
return {int(k): self.reconstruct_position(v) for k, v in data.items()}
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/QuantConnect/live/./cache/algorithm/project/Tools/PositionsStore.py", line 149, in decode
return {int(k): self.reconstruct_position(v) for k, v in data.items()}
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/QuantConnect/live/./cache/algorithm/project/Tools/PositionsStore.py", line 204, in load_positions
unpacked_positions = decoder.decode(json_data)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/QuantConnect/live/./cache/algorithm/project/main.py", line 80, in Initialize
self.positions_store.load_positions()
at Python.Runtime.PythonException.ThrowLastAsClrException() in C:\Users\jhona\QuantConnect\PythonnetEnterprise\src\runtime\PythonException.cs:line 52
at Python.Runtime.PyObject.Invoke(PyObject[] args) in C:\Users\jhona\QuantConnect\PythonnetEnterprise\src\runtime\PythonTypes\PyObject.cs:line 787
at QuantConnect.Python.PythonWrapper.InvokeMethodImpl(PyObject method, Object[] args) in /LeanCloud/CI.Builder/bin/Debug/src/QuantConnect/LeanEnterprise/Common/Python/PythonWrapper.cs:line 133
at QuantConnect.Python.PythonWrapper.Invoke(PyObject method, Object[] args) in /LeanCloud/CI.Builder/bin/Debug/src/QuantConnect/LeanEnterprise/Common/Python/PythonWrapper.cs:line 120
at QuantConnect.Python.BasePythonWrapper1.InvokeMethod(String methodName, Object[] args) in /LeanCloud/CI.Builder/bin/Debug/src/QuantConnect/LeanEnterprise/Common/Python/BasePythonWrapper.cs:line 166
at QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.Initialize() in /LeanCloud/CI.Builder/bin/Debug/src/QuantConnect/LeanEnterprise/AlgorithmFactory/Python/Wrappers/AlgorithmPythonWrapper.cs:line 711
at QuantConnect.Lean.Engine.Setup.BrokerageSetupHandler.<>c__DisplayClass28_0.b__1() in /LeanCloud/CI.Builder/bin/Debug/src/QuantConnect/LeanEnterprise/Engine/Setup/BrokerageSetupHandler.cs:line 273Position.init() got an unexpected keyword argument 'orderId'
at reconstruct_position
position = Position(**filtered_data)
^^^^^^^^^^^^^^^^^^^^^^^^^
in PositionsStore.py: line 134
at
return {int(k): self.reconstruct_position(v) for k, v in data.items()}
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
in PositionsStore.py: line 148
at decode
return {int(k): self.reconstruct_position(v) for k, v in data.items()}
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
in PositionsStore.py: line 148
at load_positions
unpacked_positions = decoder.decode(json_data)
^^^^^^^^^^^^^^^^^^^^^^^^^
in PositionsStore.py: line 203
at Initialize
self.positions_store.load_positions()
in main.py: line 79
Position.init() got an unexpected keyword argument 'orderId'
The text was updated successfully, but these errors were encountered:
Proposal: change _init to _post_init to solve the issue and let the dataclass initialize with all possible attributes.
Error example is here:
Python.Runtime.PythonException: Position.init() got an unexpected keyword argument 'orderId'
File "/QuantConnect/live/./cache/algorithm/project/Tools/PositionsStore.py", line 135, in reconstruct_position
position = Position(**filtered_data)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/QuantConnect/live/./cache/algorithm/project/Tools/PositionsStore.py", line 149, in
return {int(k): self.reconstruct_position(v) for k, v in data.items()}
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/QuantConnect/live/./cache/algorithm/project/Tools/PositionsStore.py", line 149, in decode
return {int(k): self.reconstruct_position(v) for k, v in data.items()}
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/QuantConnect/live/./cache/algorithm/project/Tools/PositionsStore.py", line 204, in load_positions
unpacked_positions = decoder.decode(json_data)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/QuantConnect/live/./cache/algorithm/project/main.py", line 80, in Initialize
self.positions_store.load_positions()
at Python.Runtime.PythonException.ThrowLastAsClrException() in C:\Users\jhona\QuantConnect\PythonnetEnterprise\src\runtime\PythonException.cs:line 52
at Python.Runtime.PyObject.Invoke(PyObject[] args) in C:\Users\jhona\QuantConnect\PythonnetEnterprise\src\runtime\PythonTypes\PyObject.cs:line 787
at QuantConnect.Python.PythonWrapper.InvokeMethodImpl(PyObject method, Object[] args) in /LeanCloud/CI.Builder/bin/Debug/src/QuantConnect/LeanEnterprise/Common/Python/PythonWrapper.cs:line 133
at QuantConnect.Python.PythonWrapper.Invoke(PyObject method, Object[] args) in /LeanCloud/CI.Builder/bin/Debug/src/QuantConnect/LeanEnterprise/Common/Python/PythonWrapper.cs:line 120
at QuantConnect.Python.BasePythonWrapper1.InvokeMethod(String methodName, Object[] args) in /LeanCloud/CI.Builder/bin/Debug/src/QuantConnect/LeanEnterprise/Common/Python/BasePythonWrapper.cs:line 166
at QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper.Initialize() in /LeanCloud/CI.Builder/bin/Debug/src/QuantConnect/LeanEnterprise/AlgorithmFactory/Python/Wrappers/AlgorithmPythonWrapper.cs:line 711
at QuantConnect.Lean.Engine.Setup.BrokerageSetupHandler.<>c__DisplayClass28_0.b__1() in /LeanCloud/CI.Builder/bin/Debug/src/QuantConnect/LeanEnterprise/Engine/Setup/BrokerageSetupHandler.cs:line 273Position.init() got an unexpected keyword argument 'orderId'
at reconstruct_position
position = Position(**filtered_data)
^^^^^^^^^^^^^^^^^^^^^^^^^
in PositionsStore.py: line 134
at
return {int(k): self.reconstruct_position(v) for k, v in data.items()}
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
in PositionsStore.py: line 148
at decode
return {int(k): self.reconstruct_position(v) for k, v in data.items()}
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
in PositionsStore.py: line 148
at load_positions
unpacked_positions = decoder.decode(json_data)
^^^^^^^^^^^^^^^^^^^^^^^^^
in PositionsStore.py: line 203
at Initialize
self.positions_store.load_positions()
in main.py: line 79
Position.init() got an unexpected keyword argument 'orderId'
The text was updated successfully, but these errors were encountered: