Trading.Backtest.Engine (trading v0.1.0)
Event-driven backtesting engine with realistic order book simulation.
Summary
Functions
Adds a strategy to the backtest.
Returns a specification to start this module under a supervisor.
Loads historical data for backtesting.
Runs a backtest with the given configuration.
Starts the backtesting engine.
Types
@type t() :: %Trading.Backtest.Engine{ config: map(), current_time: integer(), event_queue: :queue.queue(Trading.Backtest.Event.t()), historical_data: map(), matching_engine: Trading.MatchingEngine.t(), portfolio: Trading.Backtest.Portfolio.t(), results: map(), strategies: [Trading.Backtest.Strategy.t()] }
Functions
@spec add_strategy(GenServer.server(), module(), map()) :: :ok
Adds a strategy to the backtest.
Returns a specification to start this module under a supervisor.
See Supervisor
.
@spec load_historical_data(GenServer.server(), String.t(), [map()]) :: :ok
Loads historical data for backtesting.
@spec run_backtest(GenServer.server(), map()) :: {:ok, map()} | {:error, term()}
Runs a backtest with the given configuration.
@spec start_link(keyword()) :: GenServer.on_start()
Starts the backtesting engine.