Skip to main content
A finished Strategy carries its portfolio, broker, pulse index, and stats. The serializers in pulse.serializers turn those objects into plain dicts (or a DataFrame) so you can persist a run to disk, transport it between processes, or reload it later without re-running the backtest.

Serialize a finished strategy

StrategyDictSerializer.serialize returns a JSON-friendly dict. Datetimes are kept as ISO strings, so json.dumps with default=str covers the rest:

Reload it

deserialize reconstructs the Strategy, including its portfolio, broker, pulse index, and stats:
Plain deserialize(data) returns a results objectIt is a base Strategy with no datafeed or resolver attached and no on_update. Use it to archive runs, hand results to another process, or load them into a notebook for analysis.

Resume a run after a data update

A stored run can be continued once new settlements are prepared. Restore it onto your own strategy class, extend its clock from a datafeed built after the update, and run with resume=True. Only the new pulses run, and their PnL matches a continuous run over the whole calendar:
What a resume does not carry
  • Your subclass’s constructor parameters and the attributes it sets on itself are not serialized. Build it with the original parameters, and derive state from the book (or restore it yourself).
  • A fee calculator is not serialized: pass it back with deserialize(..., fee_calculator=...).
  • Days already pulsed are final, and open trades keep the contract size they were opened with.
  • A datafeed opened before the update caches its file lists and finds no new dates. Without extend(), or with a stale feed, the resume runs zero pulses (logged at info).
  • An on_update that treats the calendar’s end as special (for example close_all() when not self.pulse_index.has_next()) diverges once the clock is extended.
  • With a fee calculator, a trade expiring at the save point has its exit fee charged on the first resumed pulse instead of the save pulse. Totals match unless on_update sizes off equity.

Trades as a DataFrame

For tabular analysis or columnar storage, TradeListPandasSerializer.serialize turns a list of trades into a pandas DataFrame (one row per trade, with the serialized fields as columns):
TradeListPandasSerializer.deserialize(df) reverses it, returning the list of Trade objects.
Analysis vs persistenceFor grouping, tagging, and per-leg summaries during analysis, prefer trades_to_dataframe (see Analyze trades after a run). Reach for TradeListPandasSerializer when you want a faithful, round-trippable dump of the trade objects.

The other serializers

Every serializer exposes the same static serialize / deserialize pair and works standalone if you only need one object: Related: API overview - Serialization · Analyze trades after a run · Reading results
Last modified on November 4, 2026