[Results and strategy]

UI-side event normalization, trade pairing, metrics, equity curve, and ResultsPanel export pipeline.

Results and strategy

Results UI turns opaque engine payloads into operator-consumable tables, metrics, and files. It is a pure-ish viewer layer over lastRun + bars.

Abstract

ModuleRole
results/events.tsNormalize heterogeneous event shapes; markers; equity series
results/strategy.tsPair trades; stats; CSV helpers
ui/ResultsPanel.tsxTabs, export, jump-to-time
ui/StatusBar.tsxCompact trade summary

Conceptual model

Event normalization

Engines may emit Pro API parity fields (kind, bar_time, direction, ohlc) or legacy UI fields (type, time, dir, price). Normalizer:

  • Unifies time/price/dir/id
  • Optionally fills price from bars when OHLC present/empty
  • Can include order-like events for the Events tab

Trade pairing algorithm

Sketch (buildStrategyReport):

  1. Sort by time.
  2. On entry-like kind → open map by id.
  3. On exit/close-like → match id, else sole open trade.
  4. PnL = Δprice × long/short sign.
  5. Aggregate win rate, profit factor, max DD on cumulative PnL.

Not modeled: fees, funding, partial fills, portfolio multi-symbol—viewer honesty.

ResultsPanel tabs

TabData source
EventsnormalizedEvents
Strategyreport.trades + report.stats
Plotsseries / plots summary
Metricsmeta + context + stats subset
RawJSON.stringify(lastRun)

Interactions: copy, export, scrollToTime on trade rows.

Equity

buildEquityCurve feeds chart equity pane when runner/strategy path requests it—derived series, not engine-native unless also provided.

Export (ADR-013)

ArtifactFunction
axis-run-*.jsonFull payload
axis-trades-*.csvtradesToCsv
ClipboardCSV when permitted

Invariants

  1. Results recompute from lastRun reactively; they do not re-query engines.
  2. Changing bars without re-run can change normalization fills—re-run after Load.
  3. lastRun not rehydrated from localStorage (session artifact).
  4. Infinite profit factor when no losses but profits exist—display must tolerate non-finite.

Failure modes

SymptomAXIS explanation
Events > 0, trades = 0Unpaired or missing prices
CSV disabledNo closed trades
Jump no-opsManager unmounted / invalid time

Internals cross-links

Operator narrative: Strategy and results.
Architecture: ADR-013.

See also