run
forge.testing.run(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,extras: Mapping[str, pd.DataFrame | SeriesColumns] | None = None,seed: int = 0) -> TestRunRun a strategy over sample bars and return what it did.
Parameters
| Name | Type | Default |
|---|---|---|
| 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 |
| extras | Mapping[str, pd.DataFrame | SeriesColumns] | None | None |
| seed | int | 0 |
strategy is the path of a file or a strategy class already defined, such as one in the
test module. With no bars the strategy runs on the kit's sample for its first declared
symbol
the kit has facts for, or EURUSD, on its declared bars or H1. bars can be a
SampleBars, which brings its own symbol, facts and clock changes, or a data frame, which
needs symbol and facts and is indexed like the frame forge.run takes. params are
setting values. Other series the strategy reads (d.tf("H4"), d["GBPUSD"]) are built from
the samples unless extras gives them.
A run that ends with an error raises AssertionError naming the strategy's file and line, so
a strategy that crashes fails its test. A clock change inside bars reaches the series the
strategy reads, while the engine's own clock keeps the facts' offset.