Experiment
class backtide.backtest.experiment.Experiment(config=None, strategies=None, indicators=None)[source]
Configure and run one historical backtest experiment.
Performs the full pipeline end-to-end:
- Resolves and downloads the required market data (skipped if already present in the database).
- Computes indicators over the entire dataset.
- Runs every strategy in parallel. Each strategy has its own independent portfolio, order book and equity curve.
- Persists the results into the database.
Read more in the user guide.
| Parameters |
config : ExperimentConfig | None, default=None
Serializable data, portfolio, execution, engine, and metric settings.
Uses defaults when omitted.
strategies : str | object | dict[str, object] | list | None, default=None
Runtime strategies for this experiment. Accepts stored names, strategy
instances, explicit
indicators : str | object | dict[str, object] | list | None, default=Nonedict[name, instance] mappings, or a list mixing
those forms. When omitted, uses the stored names in config.
Runtime indicators to compute in addition to strategy-required
indicators. Accepts the same forms as
strategies. When omitted, uses
the stored names in config.
|
Example
>>> from backtide import DataExpConfig, Experiment, ExperimentConfig
>>> from backtide.strategies import BuyAndHold
>>> config = ExperimentConfig(
... data=DataExpConfig(
... symbols=["AAPL", "MSFT"],
... interval="1d",
... )
... )
>>> result = Experiment(config, strategies=[BuyAndHold()]).run()
>>> print(result)
ExperimentResult(id="bc4e9165fe114ceb", name="a413448d", status="success", n_strategies=1)
Methods
| run | Run the configured experiment and return its persisted result. |
method run(verbose=True, progress_callback=None)[source]
Run the configured experiment and return its persisted result.