Class HiddenLiquidityDetector
The sound per-print signature: a single execution larger than the
size displayed at that moment. Displayed liquidity cannot fill more
than it shows, so the excess in that one print necessarily executed
against hidden size at the level. (A cumulative executed-vs-displayed
comparison is NOT sound at L2: a busy level legitimately trades many
times its instantaneous display through ordinary adds — that
formulation false-flags normal flow.) Per level, the detector keeps an
EWMA of the print/displayed ratio at those hidden events;
hiddenMultiplier(int) ≈ 1 means "what you see is what's there," 3
means "≈3× the tip is likely lurking."
Complements execution.VenueScorecard, which learns dark-venue
liquidity by probing; this one infers lit-venue hidden size
without sending an order, so an execution algo can size a child against
the true depth rather than the tip. Cross-asset: the
trades-more-than-displayed-and-keeps-quoting tell is the same on an
equity exchange level and an FX ECN level (icebergs are standard on
both); sizes are longs, levels are dense tick indices, same convention
as the books. Zero allocation, single writer.
-
Constructor Summary
ConstructorsConstructorDescriptionHiddenLiquidityDetector(int levels) HiddenLiquidityDetector(int levels, double alpha) -
Method Summary
Modifier and TypeMethodDescriptiondoubleestimatedTrueDepth(int level) Estimated total resting size at a level = displayed × hidden multiplier — the depth an execution algo should size against, not the visible tip.doublehiddenMultiplier(int level) Estimated ratio of true resting size to displayed size at a level: 1 = no hidden liquidity detected,>1= likely iceberg.booleanisIceberg(int level) True once a level has shown iceberg behavior at least once.intlevels()voidonDisplayed(int level, long size) The displayed size now standing atlevel.voidonExecution(int level, long qty) One trade print ofqtyatlevel, compared against the size displayed at that moment.voidonLevelCleared(int level) The level fully cleared (best moved away / all pulled).longrefillObservations(int level)
-
Constructor Details
-
HiddenLiquidityDetector
public HiddenLiquidityDetector(int levels, double alpha) - Parameters:
levels- number of price levels tracked (dense tick indices)alpha- EWMA weight on each refill observation, e.g. 0.2
-
HiddenLiquidityDetector
public HiddenLiquidityDetector(int levels)
-
-
Method Details
-
onDisplayed
public void onDisplayed(int level, long size) The displayed size now standing atlevel. -
onExecution
public void onExecution(int level, long qty) One trade print ofqtyatlevel, compared against the size displayed at that moment. A print exceeding the display is the hidden-liquidity event: the overflow could only have filled against unseen size. The EWMA seeds from the first observation — a ratio's meaningful floor is 1.0, so ramping up from 0 would under-register a genuine single event. -
onLevelCleared
public void onLevelCleared(int level) The level fully cleared (best moved away / all pulled). -
estimatedTrueDepth
public double estimatedTrueDepth(int level) Estimated total resting size at a level = displayed × hidden multiplier — the depth an execution algo should size against, not the visible tip. -
isIceberg
public boolean isIceberg(int level) True once a level has shown iceberg behavior at least once. -
refillObservations
public long refillObservations(int level) -
levels
public int levels()
-