From 5908615ff9ca3f6e4852f9a1bf32748e4534b27e Mon Sep 17 00:00:00 2001 From: Chris Sellers Date: Sun, 10 Dec 2023 18:19:22 +1100 Subject: [PATCH] Fix Arrow Instrument decoding --- .../serialization/arrow/implementations/instruments.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/nautilus_trader/serialization/arrow/implementations/instruments.py b/nautilus_trader/serialization/arrow/implementations/instruments.py index 12fab8855ab0..7924b26c1f6d 100644 --- a/nautilus_trader/serialization/arrow/implementations/instruments.py +++ b/nautilus_trader/serialization/arrow/implementations/instruments.py @@ -216,8 +216,13 @@ def deserialize(batch: pa.RecordBatch) -> list[Instrument]: b"FuturesContract": FuturesContract, b"OptionsContract": OptionsContract, }[ins_type] + maps = batch.to_pylist() for m in maps: - if "info" in m: - m["info"] = msgspec.json.decode(m["info"]) + info = m.get("info") + if info is not None: + m["info"] = msgspec.json.decode(info) + else: + m["info"] = None + return [Cls.from_dict(data) for data in maps]