assert_same_trades

forge.testingfunctionSince Forge API 1
Signaturepython
forge.testing.assert_same_trades(run_a: TestRun | RunResult,run_b: TestRun | RunResult,*,price_rel: float = 0.0,size_rel: float = 0.0,fields: Sequence[str] = ('symbol', 'side', 'entry_time', 'exit_time', 'entry_price', 'exit_price', 'size_lots')) -> None

The two runs made the same trades, compared one by one in entry-time order.

Parameters

NameTypeDefault
run_aTestRun | RunResult
run_bTestRun | RunResult
price_relfloat0.0
size_relfloat0.0
fieldsSequence[str]('symbol', 'side', 'entry_time', 'exit_time', 'entry_price', 'exit_price', 'size_lots')

Prices are equal within price_rel and sizes within size_rel, both relative, and NaN equals NaN. The failure is a readable diff: trades are numbered from 1 in entry-time order, and at most 20 lines are shown. fields are columns of the trade table.