Skip to main content

Serializer

Bases: ABC Abstract base class for serializing and deserializing objects to and from dictionaries. Concrete serializers implement serialize/deserialize as @staticmethod (they are stateless and called both as Cls.serialize(x) and Cls().serialize(x)), so the base declarations are static too to keep the override compatible. These are a documented contract rather than @abstractmethod-enforced: stacking @staticmethod over @abstractmethod is not importable once Cython-compiled (abc.abstractmethod tries to set __isabstractmethod__ on the staticmethod object, which is read-only), so the base methods raise NotImplementedError instead.

Serializer.serialize

staticmethod
Serialize the object to a dictionary.

Serializer.deserialize

staticmethod
Deserialize the object from a dictionary (or DataFrame for tabular serializers).

PulseIndexDictSerializer

Bases: Serializer Serializer for PulseIndex objects.

PulseIndexDictSerializer.serialize

staticmethod
Serialize a PulseIndex object to a dictionary.

PulseIndexDictSerializer.deserialize

staticmethod
Deserialize a dictionary to a PulseIndex object.

InstrumentDictSerializer

Bases: Serializer Serializer for Instrument objects.

InstrumentDictSerializer.serialize

staticmethod
Serialize an Instrument object to a dictionary.

InstrumentDictSerializer.deserialize

staticmethod
Deserialize a dictionary to the concrete Option/Future object.

TradeDictSerializer

Bases: Serializer Serializer for Trade objects.

TradeDictSerializer.serialize

staticmethod
Serialize a Trade object to a dictionary.

TradeDictSerializer.deserialize

staticmethod
Deserialize a dictionary to a Trade object.

TradeListPandasSerializer

Bases: Serializer Serializer for a list of Trade objects, as a DataFrame with one row per trade.

TradeListPandasSerializer.serialize

staticmethod
Serialize a list of Trade objects to a DataFrame, one row per trade. For a non-empty list the columns are the keys of TradeDictSerializer.serialize, so nested values (the instrument, the tag list, the per-pulse histories) stay as objects in their cell. An empty list gives an empty frame with no columns at all.

TradeListPandasSerializer.deserialize

staticmethod
Deserialize a DataFrame of trade rows back into Trade objects, in row order.

OrderDictSerializer

Bases: Serializer Serializer for Order objects.

OrderDictSerializer.serialize

staticmethod
Serialize an Order object to a dictionary.

OrderDictSerializer.deserialize

staticmethod
Deserialize a dictionary to an Order object.

SimulationBrokerBrokerDictSerializer

Bases: Serializer Serializer for Broker objects.

SimulationBrokerBrokerDictSerializer.serialize

staticmethod
Serialize a Broker object to a dictionary.

SimulationBrokerBrokerDictSerializer.deserialize

staticmethod
Deserialize a dictionary to a SimulationBroker object.

PortfolioDictSerializer

Bases: Serializer Serializer for Portfolio objects.

PortfolioDictSerializer.serialize

staticmethod
Serialize a Portfolio object to a dictionary.

PortfolioDictSerializer.deserialize

staticmethod
Deserialize a dictionary to a Portfolio object. Parameters

StatsDictSerializer

Bases: Serializer Serializer for Stats objects.

StatsDictSerializer.serialize

staticmethod
Serialize a Stats object to a dictionary, datetimes rendered as ISO strings. Scalar metrics routed through _finite have None, NaN and inf coerced to 0.0. The equity totals and the date strings pass through untouched; return_table and the legacy flat trade fields are still coerced, to {} and 0, by their own or fallbacks.

StatsDictSerializer.deserialize

staticmethod
Deserialize a dictionary to a Stats object.

StrategyDictSerializer

Bases: Serializer Serializer for Strategy objects.

StrategyDictSerializer.serialize

staticmethod
Serialize a Strategy object to a dictionary.

StrategyDictSerializer.deserialize

staticmethod
Deserialize a dictionary to a Strategy object.
Last modified on November 4, 2026