Reconciliation using trading periods
Reconcile a settlement period's activity against your ledger using its authoritative totals.
Goal. Reconcile a settlement period's investment activity against your ledger.
Endpoints. Get trading period list for the period and its authoritative totals, then Get transaction list filtered by trading_period_id for the line items behind them.
Flow.
- Call Get trading period list with
status=fully_settledand astart_time/end_timewindow covering your reconciliation run — only fully settled periods have final totals. Note the list defaults to the last 90 days whenstart_timeis omitted; pass an earlierstart_timeto reach older periods. - For each period, read
total_transaction_volumeandtotal_transaction_fees. These are the authoritative rollups; you don't need to compute them yourself. Get trading period detail addstotal_gl_volumeand a per-product breakdown if you reconcile per product line. - Pull the line items: call Get transaction list with
trading_period_id=<period id>andlast_record_number=0, then page through all results. - Match line items against your ledger on
transaction_id, accumulatingamountandfee(decimal math). Your accumulated totals should equal the period's rollups — if they don't, you have missing or duplicate ledger entries to investigate.
Edge cases.
- Don't reconcile open periods. A period with
status=openorpendingcan still change. Reconcile onlyfully_settledperiods; re-run later for ones that were still settling. - Unassigned transactions. A transaction's
trading_period_idis null until it's assigned to a period — recent activity may not appear under any period yet. It will be covered by a later period; don't force-match it. - Decimal integrity. Sum
amountandfeewith a decimal library throughout. Never introduce float arithmetic. - Category-level reconciliation. Each transaction carries a
type(order,dividend,ira) — group by it if your ledger books those categories to different accounts.

