Generating Trading Reports and Reconciling Portfolio PnL
Summary
The guide explains how a report provider turns cached orders, fills, positions, snapshots, and account states into pandas tables for backtest review and live monitoring. It outlines reports for all orders, filled orders, individual fill events, positions, and account balances, noting that the order and fill views have different row granularity. Reports can be requested through backtest engine methods or generated directly from supplied cache data; empty results are represented by empty tables.
For PnL analysis, the guide distinguishes realized from mark-to-market unrealized PnL, notes that commissions affect accounting according to currency, and explains that position snapshots preserve closed cycles when identifiers are reused. Multi-currency totals require conversion, and the guide points to cached exchange rates for that purpose. It also describes scheduled reporting and basic post-run performance summaries. These facilities improve consistency between live and simulated analysis, but the reports are in-memory views of cached data, depend on optional pandas support, and require correct snapshot and currency handling for dependable totals.
Key ideas
- The report provider creates tabular views of orders, executions, positions, snapshots, and account balances.
- Order fill summaries use one row per filled order, while the fills report records individual execution events.
- Position snapshots should be included when calculating total PnL across reopened or flipped position cycles.
- PnL may be denominated in different currencies, so portfolio aggregation requires conversion.
- Reports depend on cached in-memory data, and pandas is needed when generating them.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.