Class HftQuoter
- All Implemented Interfaces:
TickListener
HftRiskGate and HftOrderGateway, with zero allocation
per tick.
Quote construction per tick (all primitive arithmetic):
skew = −position × skewPerUnit (long inventory shades DOWN) bid = mid − halfSpread + skew → rounded DOWN to the grid ask = mid + halfSpread + skew → rounded UP to the grid
Inventory comes straight from the risk gate's position (updated by
fills via HftRiskGate.onFill(int, com.quantfinlib.orderbook.Side, long)), so the skew loop closes without
any extra state. Both sides still pass the gate's own checks — a quoter
cannot out-trade its risk limits.
Conflation. Venues throttle quote updates and stale requotes
waste the wire: a re-quote is suppressed unless the mid moved at least
minMove or minRequoteIntervalNanos elapsed.
Suppression is counted, never silent.
Register as a TickListener on the bus (runs on the consumer
thread), exactly like a strategy. Single-threaded by construction; the
per-symbol state arrays are indexed by dense symbol id.
Mixed books: half-spreads, skews, conflation thresholds and tick
grids are per-instrument quantities (a EURUSD half-spread is ~100× too
tight for USDJPY), so the constructor's config is only the default —
override per symbol with configureSymbol(int, com.quantfinlib.trading.HftQuoter.Config) and one quoter serves
the whole book.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionHftQuoter(HftOrderGateway gateway, int maxSymbols, HftQuoter.Config defaults) -
Method Summary
Modifier and TypeMethodDescriptionconfigureSymbol(int symbolId, HftQuoter.Config config) Per-symbol quoting parameters (cold path — call at setup or on config updates from the same thread that quotes, or beforestart).voidonTick(int symbolId, double price, double size, long timestampNanos) The hot path: one tick → (possibly) one two-sided quote.longQuote updates actually sent (each is up to two orders).longIndividual sides refused by the risk gate or a full ring.longUpdates suppressed by conflation.
-
Constructor Details
-
HftQuoter
-
-
Method Details
-
configureSymbol
Per-symbol quoting parameters (cold path — call at setup or on config updates from the same thread that quotes, or beforestart). -
onTick
public void onTick(int symbolId, double price, double size, long timestampNanos) The hot path: one tick → (possibly) one two-sided quote. Runs on the bus consumer thread; no allocation, no locks, no boxing.- Specified by:
onTickin interfaceTickListener
-
quoteUpdates
public long quoteUpdates()Quote updates actually sent (each is up to two orders). -
suppressedUpdates
public long suppressedUpdates()Updates suppressed by conflation. -
rejectedSides
public long rejectedSides()Individual sides refused by the risk gate or a full ring.
-