Class OrderPlacementPolicy
java.lang.Object
com.quantfinlib.execution.OrderPlacementPolicy
The post-or-cross decision — the smallest and most repeated choice in
execution, made explicit as expected-cost arithmetic instead of
habit. Relative to the current mid, for a buy:
cross now: pay the half spread → h
post at bid: filled (prob p): earn h, pay adverse selection a,
collect the rebate r → a − h − r
unfilled (1−p): cross later after the
market drifted d against you → h + d
expected post cost = p·(a − h − r) + (1−p)·(h + d)
POST iff that beats h
The inputs are measured, not assumed: fillProbability from
microstructure.FillProbabilityModel (or your own), the
adverse-selection cost a from post-fill markouts (a passive
fill happens exactly when the market comes through you — free money
it is not), and the drift d from your alpha (positive =
expected to move against a waiting buyer). All in the same per-unit
currency. Static, deterministic, research/warm lane; per-share or
per-notional units both work as long as they are consistent.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordThe decision plus the arithmetic that made it.static final recordThe fill-probability region where posting beats crossing. -
Method Summary
Modifier and TypeMethodDescriptiondecide(double halfSpread, double fillProbability, double adverseSelection, double adverseDrift, double rebate) Decides how to place the next child order.postRegion(double halfSpread, double adverseSelection, double adverseDrift, double rebate) The desk's rule for these market conditions: post iff the fill probability lands inside the returned region of [0, 1].
-
Method Details
-
decide
public static OrderPlacementPolicy.Placement decide(double halfSpread, double fillProbability, double adverseSelection, double adverseDrift, double rebate) Decides how to place the next child order.- Parameters:
halfSpread- half the touch spread, > 0fillProbability- P(passive order fills within the horizon), in [0, 1]adverseSelection- expected cost when passively filled (post-fill markout), ≥ 0adverseDrift- expected move against the order while waiting unfilled (signed: negative = the market is expected to come to you)rebate- maker rebate per unit, ≥ 0
-
postRegion
public static OrderPlacementPolicy.PostRegion postRegion(double halfSpread, double adverseSelection, double adverseDrift, double rebate) The desk's rule for these market conditions: post iff the fill probability lands inside the returned region of [0, 1].
-