check_lookahead

forge.testingfunctionSince Forge API 1
Signaturepython
forge.testing.check_lookahead(strategy: str | os.PathLike[str] | type[Strategy],bars: SampleBars | pd.DataFrame | None = None,params: Mapping[str, Any] | None = None,*,symbol: str | None = None,timeframe: str | None = None,facts: Mapping[str, Any] | None = None,limit_prices: bool = False,min_trades: int | None = None,seed: int = 0) -> dict[str, Any]

Audit a strategy for look-ahead and return the report as plain JSON.

Parameters

NameTypeDefault
strategystr | os.PathLike[str] | type[Strategy]
barsSampleBars | pd.DataFrame | NoneNone
paramsMapping[str, Any] | NoneNone
symbolstr | NoneNone
timeframestr | NoneNone
factsMapping[str, Any] | NoneNone
limit_pricesboolFalse
min_tradesint | NoneNone
seedint0

The strategy runs over bars (the kit's sample for its symbol when left out) and over shortened copies of them under a fixed profile that removes position limits, sizing and prop rules. limit_prices=True keeps the strategy's own order types. min_trades is the fewest trades the audit needs to judge (10 when left out). The arguments are those of run.