Skip to main content

Module executor

Module executor 

Source
Expand description

Backtest executor — simulates fills and tracks P&L.

The BacktestExecutor receives Effects produced by the trade engine and translates them into simulated trade results (entries, exits, P&L). It maintains a map of open entries so that when a position closes it can compute realised profit/loss.

§Contract sizes

P&L is calculated as (exit - entry) * close_size * contract_size. The contract_size (also called “point value”) converts lot-denominated sizes into monetary units. For forex, 1 standard lot = 100,000 base currency units, so the contract size is 100,000. For gold (XAUUSD), 1 lot = 100 troy ounces, so the contract size is 100.

When no contract size is provided for a symbol the multiplier defaults to 1.0, preserving backward compatibility with existing tests.

Structs§

BacktestExecutor
Simulates trade execution and tracks account balance / P&L.