Class LiquiditySeekingAlgo
BenchmarkExecutor's schedule-driven family. A schedule algo
asks "am I behind the curve?"; a liquidity seeker asks "is the
market cheap RIGHT NOW?" and trades in bursts when it is: spread
tighter than its time-of-day forecast, calm volatility regime, low
estimated impact. Between opportunities it sits still — which is why
it needs the one discipline every seek-style algo ships with: a
completion floor that ramps in over the final stretch of the
horizon, so patience can never become a missed parent.
Inputs reuse the BenchmarkExecutor.MarketState units contract (normalized vol
regime, impact in bps, take-now depth) plus the spread FORECAST from
microstructure.SpreadForecaster — cheapness is always relative
to what the spread usually is at this hour, not to an absolute number
(2 pips is cheap at the London open and expensive at midnight):
long due = seek.dueQuantity(f, marketState, spreadForecaster.forecast(bucket, now));
Decision per interval: score the moment — spread at-or-under
forecast, vol regime below the calm threshold, impact below the cap —
and if ALL hold, take an aggressive clip (maxDepthFraction ×
displayedDepth). If not, send only the completion floor: 0 until
forceCompleteFrom, then the remaining quantity spread linearly
over what is left of the horizon (at f = 1 the floor IS the
remainder). NaN inputs degrade honestly: an unknown forecast means the
moment cannot be judged cheap (no opportunistic burst), but the floor
still guarantees completion. Zero allocation per decision, single
parent, single writer.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionLiquiditySeekingAlgo(long parentQty) LiquiditySeekingAlgo(long parentQty, LiquiditySeekingAlgo.Config config) -
Method Summary
Modifier and TypeMethodDescriptionbooleandone()longdueQuantity(double scheduleFraction, BenchmarkExecutor.MarketState m, double forecastSpread) Shares to send now.longexecuted()voidonFill(long qty) Our own child fill.long
-
Constructor Details
-
LiquiditySeekingAlgo
-
LiquiditySeekingAlgo
public LiquiditySeekingAlgo(long parentQty)
-
-
Method Details
-
dueQuantity
public long dueQuantity(double scheduleFraction, BenchmarkExecutor.MarketState m, double forecastSpread) Shares to send now. An opportunistic burst when the moment is cheap (see class doc); otherwise the completion floor. Always capped at the remainder.- Parameters:
scheduleFraction- elapsed fraction of the horizon in [0, 1]m- the live market snapshot (BenchmarkExecutor.MarketStateunits contract)forecastSpread- the expected spread for this time of day (SpreadForecaster.forecast); NaN = cheapness unknowable, floor only
-
onFill
public void onFill(long qty) Our own child fill. -
executed
public long executed() -
remaining
public long remaining() -
done
public boolean done()
-