run_experiment

Defined in fynance.research

run_experiment(strategy, data, *, name, y=None, walk_forward=None, costs=None, period=252, seed=0, code=None, output_dir=None)[source]

Run a strategy experiment and return a populated Experiment.

Parameters:
strategyfynance.strategy.Strategy

The composed strategy (features -> model -> signal -> cost).

dataPriceSeries or array-like

Price series the strategy runs on (coerced to float64).

namestr

Experiment slug (also the output sub-directory).

yarray-like, optional

Supervised target for a model-based strategy run via walk_forward. Defaults to zeros (ignored by rule-based strategies).

walk_forwarddict, optional

Window params for Strategy.run_walk_forward (train/test/step/purge). None runs a single pass.

costsCostModel, optional

Overrides the strategy’s own cost model for this run when given.

periodint

Annualization factor for the metrics.

seedint

Master seed (numpy + torch).

codestr, optional

Generated strategy source, stored verbatim on the experiment.

output_dirstr or pathlib.Path, optional

When given, the experiment is saved under <output_dir>/<name>/.

Returns:
Experiment

Populated with spec, metrics and series.