Class InstantExecution

java.lang.Object
com.quantfinlib.backtest.InstantExecution
All Implemented Interfaces:
ExecutionModel

public final class InstantExecution extends Object implements ExecutionModel
Baseline execution model: the full quantity fills at the bar close with commission and slippage folded into the all-in price — equivalent to the classic Backtester fill assumption.
  • Constructor Details

    • InstantExecution

      public InstantExecution(double commissionRate, double slippageRate)
  • Method Details

    • from

      public static InstantExecution from(BacktestConfig config)
    • worstCaseCostFraction

      public double worstCaseCostFraction()
      Description copied from interface: ExecutionModel
      Upper bound on this model's all-in cost as a fraction of ExecutionModel.referencePrice(com.quantfinlib.core.BarSeries, int) (spread + fees + slippage). The engine uses it to size entries so that a fully-filled parent can never overdraw cash — a model whose fills can cost more than referencePrice * (1 + worstCaseCostFraction()) MUST override one or both methods, or the backtest silently trades on margin it doesn't have. Wrappers must DELEGATE both to the model that actually prices the fills. Default 1%.
      Specified by:
      worstCaseCostFraction in interface ExecutionModel
    • execute

      public List<Execution> execute(Side side, long requestedQty, BarSeries series, int index)
      Description copied from interface: ExecutionModel
      Executes up to requestedQty on this bar. Must never fill more than requested; may fill less (or nothing) — the remainder is retried on subsequent bars.
      Specified by:
      execute in interface ExecutionModel