Class IcebergExecution
java.lang.Object
com.quantfinlib.backtest.IcebergExecution
- All Implemented Interfaces:
ExecutionModel
Iceberg execution: wraps another
ExecutionModel and caps each bar's
execution at the IcebergOrder state machine's visible tranche
(optionally randomized), plus an optional participation cap versus the
bar's volume. A fresh iceberg is loaded for every parent order, so entries
and exits are both worked patiently across bars.-
Constructor Summary
ConstructorsConstructorDescriptionIcebergExecution(ExecutionModel inner, long displayQty) IcebergExecution(ExecutionModel inner, long displayQty, double randomizePct, double maxParticipation, long seed) -
Method Summary
Modifier and TypeMethodDescriptionExecutes up torequestedQtyon this bar.voidonParentOrder(Side side, long totalQuantity, int signalIndex) Notification that a new parent order has been created (entry or exit).doublereferencePrice(BarSeries series, int index) The price this model's fills are anchored to on the given bar — the engine budgets entry requests ascash / (referencePrice * (1 + worstCaseCostFraction())).doubleUpper bound on this model's all-in cost as a fraction ofExecutionModel.referencePrice(com.quantfinlib.core.BarSeries, int)(spread + fees + slippage).
-
Constructor Details
-
IcebergExecution
-
IcebergExecution
public IcebergExecution(ExecutionModel inner, long displayQty, double randomizePct, double maxParticipation, long seed) - Parameters:
randomizePct- display-size jitter, e.g. 0.2 = ±20%maxParticipation- cap per bar as a fraction of bar volume (0 = off)
-
-
Method Details
-
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
-
referencePrice
Description copied from interface:ExecutionModelThe price this model's fills are anchored to on the given bar — the engine budgets entry requests ascash / (referencePrice * (1 + worstCaseCostFraction())). Default: the bar close. A model that fills off a different price point (e.g.LastLookExecutionfills at the OPEN) must override this, or a gap between close and its actual anchor lets a fully-filled request overdraw cash.- Specified by:
referencePricein interfaceExecutionModel
-
onParentOrder
Description copied from interface:ExecutionModelNotification that a new parent order has been created (entry or exit). Stateful models (e.g.IcebergExecution) reset per-parent state here.- Specified by:
onParentOrderin 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
-