Reports
We are currently working on this concept guide.
This guide explains the portfolio analysis and reporting capabilities provided by the ReportProvider
class, and how these reports are used for PnL accounting and backtest post-run analysis.
Overview
The ReportProvider
class in NautilusTrader generates structured analytical reports from
trading data, transforming raw orders, fills, positions, and account states into pandas DataFrames
for analysis and visualization. These reports are essential for understanding strategy performance,
analyzing execution quality, and ensuring accurate PnL accounting.
Reports can be generated using two approaches:
- Trader helper methods (recommended): Convenient methods like
trader.generate_orders_report()
. - ReportProvider directly: For more control over data selection and filtering.
Reports provide consistent analytics across both backtesting and live trading environments, enabling reliable performance evaluation and strategy comparison.
Available reports
The ReportProvider
class offers several static methods to generate reports from trading data.
Each report returns a pandas DataFrame with specific columns and indexing for easy analysis.
Orders report
Generates a comprehensive view of all orders:
# Using Trader helper method (recommended)
orders_report = trader.generate_orders_report()
# Or using ReportProvider directly
from nautilus_trader.analysis.reporter import ReportProvider
orders = cache.orders()
orders_report = ReportProvider.generate_orders_report(orders)
Returns pd.DataFrame
with:
Column | Description |
---|---|
client_order_id | Index - unique order identifier. |
instrument_id | Trading instrument. |
strategy_id | Strategy that created the order. |
side | BUY or SELL. |
type | MARKET, LIMIT, etc. |
status | Current order status. |
quantity | Original order quantity (string). |
filled_qty | Amount filled (string). |
price | Limit price (string if set). |
avg_px | Average fill price (float if set). |
ts_init | Order initialization timestamp (nanoseconds). |
ts_last | Last update timestamp (nanoseconds). |
Order fills report
Provides a summary of filled orders (one row per order):
# Using Trader helper method (recommended)
fills_report = trader.generate_order_fills_report()
# Or using ReportProvider directly
orders = cache.orders()
fills_report = ReportProvider.generate_order_fills_report(orders)
This report includes only orders with filled_qty > 0
and contains the same columns as the
orders report, but filtered to executed orders only. Note that ts_init
and ts_last
are
converted to datetime objects in this report for easier analysis.
Fills report
Details individual fill events (one row per fill):
# Using Trader helper method (recommended)
fills_report = trader.generate_fills_report()
# Or using ReportProvider directly
orders = cache.orders()
fills_report = ReportProvider.generate_fills_report(orders)
Returns pd.DataFrame
with:
Column | Description |
---|---|
client_order_id | Index - order identifier. |
trade_id | Unique trade/fill identifier. |
venue_order_id | Venue-assigned order ID. |
last_px | Fill execution price (string). |
last_qty | Fill execution quantity (string). |
liquidity_side | MAKER or TAKER. |
commission | Commission amount and currency. |
ts_event | Fill timestamp (datetime). |
ts_init | Initialization timestamp (datetime). |