Class InstantExecution
java.lang.Object
com.quantfinlib.backtest.InstantExecution
- All Implemented Interfaces:
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionExecutes up torequestedQtyon this bar.static InstantExecutionfrom(BacktestConfig config) doubleUpper bound on this model's all-in cost as a fraction ofExecutionModel.referencePrice(com.quantfinlib.core.BarSeries, int)(spread + fees + slippage).Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.quantfinlib.backtest.ExecutionModel
onParentOrder, referencePrice
-
Constructor Details
-
InstantExecution
public InstantExecution(double commissionRate, double slippageRate)
-
-
Method Details
-
from
-
worstCaseCostFraction
public double worstCaseCostFraction()Description copied from interface:ExecutionModelUpper bound on this model's all-in cost as a fraction ofExecutionModel.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 thanreferencePrice * (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:
worstCaseCostFractionin interfaceExecutionModel
-
execute
Description copied from interface:ExecutionModelExecutes up torequestedQtyon this bar. Must never fill more than requested; may fill less (or nothing) — the remainder is retried on subsequent bars.- Specified by:
executein interfaceExecutionModel
-