Engine#

class backtest_lib.engine.Engine(planner: PlanGenerator[TPlanOp], executor: PlanExecutor[TPlanOp], universe: Iterable[str])#

Coordinate plan generation and execution for a universe.

The engine wires a PlanGenerator and a PlanExecutor to execute strategy decisions against a consistent security universe.

execute_strategy(strategy: Strategy, portfolio: Portfolio, market: MarketView, ctx: StrategyContext, prices: UniverseMapping) ExecutionResult#

Run a strategy once and execute its resulting plan.

Parameters:
Returns:

ExecutionResult after applying the plan.

make_engine(planner, executor, universe)

Create an engine from a planner and an executor.