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. That 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 safely: 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.
Sent-but-unfilled children count against the remainder: report them
with onChildSent(long) and their unfilled remainders with
onChildDone(long), so a burst that rests is not repeated while it
works.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordAlgorithm settings. -
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()voidonChildDone(long unfilledQty) A child ended withunfilledQtynever executed.voidonChildSent(long qty) A child ofqtywas sent and is working.voidonFill(long qty) Our own child fill; reduces the open quantity by the same amount.longSent child quantity not yet filled or reported done.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; reduces the open quantity by the same amount. -
onChildSent
public void onChildSent(long qty) A child ofqtywas sent and is working. -
onChildDone
public void onChildDone(long unfilledQty) A child ended withunfilledQtynever executed. -
openQuantity
public long openQuantity()Sent child quantity not yet filled or reported done. -
executed
public long executed() -
remaining
public long remaining() -
done
public boolean done()
-