Skip to content

Compare two scenarios

Goal: see how a paper or hyp scenario does next to production (LIVE): its P&L and positions, the prices in its market world, and where its strategy's decisions differ.

Prerequisites

  • An active context (Switch context).
  • Two scenarios (Scenarios), each with a P&L worker for the P&L section and a strategy placing orders for the Decisions section.

Steps

  1. Open Compare: Trading top tab, 8 (Compare) in the default layout.
  2. Pick the pair: the first selector holds LIVE and the second the first other scenario that is not archived. Choose others in the selectors if you like; s swaps them. The pane keeps the pair for the next start.

    The P&L section shows, per symbol and in total, each scenario's quantity, average cost, mark, unrealized and realized P&L, notional and fees, and the difference (second minus first): green when the second is higher, red when lower.

    P&L compared

  3. Compare the market: press tab. Per symbol and venue, each scenario's order-book mid and last trade in its own market world, with the spread and its basis points. Two scenarios on the same world show a spread of zero. Press a to add a symbol to compare, and d on an added one to remove it.

    Market compared

  4. Compare the decisions: press tab again. The orders both scenarios placed since you opened the pane, newest first, side by side when they match: same symbol and side, decided at most 5 seconds apart. Yellow rows are divergences: an order only one scenario placed, or a pair that ended differently (differs: filled vs rejected). The header counts each scenario's fills per symbol.

    Decisions compared

Result

Compare shows both scenarios side by side and follows them live. Nothing is written: leaving the pane changes nothing but the kept pair and section.

Adjust the match window

Two orders match when they were decided within compare_match_window_seconds of each other (~/.config/virtufin/tui/config.toml, 5 by default). A strategy that decides on one-minute candles may need a wider window:

compare_match_window_seconds = 30

Restart the TUI to use it.

Troubleshooting

  • "no P&L worker runs for PAPER": the scenario has no P&L book (sc.PAPER.pnl.book). Start its P&L worker; until then the section shows only the other scenario's figures, with no differences.
  • The Decisions section is empty: it shows orders placed while the pane is open, not earlier ones. A fill of an earlier order counts in the header's "of earlier orders".
  • A replay matches nothing: times are the orders' own, so a replay of a past day never lines up with LIVE today. That is the right answer: the decisions were not taken at the same market time.