Skip to content

Encoding objects of type nautilus_trader.model.objects.Price is unsupported #3515

@dennisnissle

Description

@dennisnissle

Bug Report

Seems like encoding doesn't work for the info attribute of the OrderFilled event. I've set up feather streaming in live context (IBKR adapter) and just got the following error:

Traceback (most recent call last):
  File "xxx/nautilus_trader/nautilus_trader/live/execution_engine.py", line 609, in _run_evt_queue
    self._handle_event_with_tracking(event)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^
  File "xxx/nautilus_trader/nautilus_trader/live/execution_engine.py", line 3519, in _handle_event_with_tracking
    self._handle_event(event)
    ~~~~~~~~~~~~~~~~~~^^^^^^^
  File "nautilus_trader/execution/engine.pyx", line 1158, in nautilus_trader.execution.engine.ExecutionEngine._handle_event
  File "nautilus_trader/execution/engine.pyx", line 1242, in nautilus_trader.execution.engine.ExecutionEngine._handle_event
  File "nautilus_trader/execution/engine.pyx", line 1548, in nautilus_trader.execution.engine.ExecutionEngine._handle_order_fill
  File "nautilus_trader/common/component.pyx", line 2777, in nautilus_trader.common.component.MessageBus.publish_c
  File "xxx/nautilus_trader/nautilus_trader/persistence/writer.py", line 239, in write
    serialized = ArrowSerializer.serialize_batch([obj], data_cls=cls)
  File "xxx/nautilus_trader/nautilus_trader/serialization/arrow/serializer.py", line 260, in serialize_batch
    batches = [ArrowSerializer.serialize(obj, data_cls) for obj in data]
               ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
  File "xxx/nautilus_trader/nautilus_trader/serialization/arrow/serializer.py", line 227, in serialize
    batch = delegate(data)
  File "xxx/nautilus_trader/nautilus_trader/serialization/arrow/implementations/order_events.py", line 32, in serialize
    data["info"] = msgspec.json.encode(data["info"])
                   ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
  • I’ve re-read the relevant sections of the documentation.
  • I’ve searched existing issues and discussions to avoid duplicates.
  • I’ve reviewed or skimmed the source code (or examples) to confirm the behavior is not by design.
  • I’ve tested this issue using a recent development wheel (dev develop or a nightly) and can still reproduce it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions