Class HftSor
java.lang.Object
com.quantfinlib.execution.HftSor
Hot-lane smart order router: the zero-allocation sibling of
SmartOrderRouter, for when the routing decision sits on the
tick-to-order path. Venue state lives in parallel primitive arrays
(updated in place from your per-venue feeds — plug in
marketdata.Nbbo venue quotes directly); a route decision is a
greedy sweep by all-in price with no sorting, no lists, no boxing.
Fees are expressed in ticks (venue taker fee converted at the instrument's tick size, once, at configuration time), so the comparison stays in integer-friendly arithmetic. Negative fee ticks model rebates. With the handful of venues real equities routing faces, the O(V²) selection sweep is faster than any heap — and allocates nothing.
Single-writer; reuse one router per routing thread.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidfee(int venue, double takerFeeTicks) Per-venue taker fee in ticks (negative = rebate).longRoutes a marketable order across venues by best all-in price (quote ± fee), splitting at displayed size.longintvoidvenueDown(int venue) Removes a venue from routing (feed loss / venue halt) — the symmetric call toNbbo.onVenueDown, so a dead venue's stale quote can never keep receiving child orders.voidvenueQuote(int venue, int bid, long bidSz, int ask, long askSz) One venue's displayed top of book (zero size = side unavailable).
-
Constructor Details
-
HftSor
public HftSor(int venueCount)
-
-
Method Details
-
fee
public void fee(int venue, double takerFeeTicks) Per-venue taker fee in ticks (negative = rebate). Configure once. -
venueQuote
public void venueQuote(int venue, int bid, long bidSz, int ask, long askSz) One venue's displayed top of book (zero size = side unavailable). -
venueDown
public void venueDown(int venue) Removes a venue from routing (feed loss / venue halt) — the symmetric call toNbbo.onVenueDown, so a dead venue's stale quote can never keep receiving child orders. -
route
Routes a marketable order across venues by best all-in price (quote ± fee), splitting at displayed size. Child quantities are written intooutQty[venue]: the array must be at leastvenueCount()long and indices[0, venueCount)are fully overwritten (entries beyond that are untouched). The return value is the total routed quantity — anything short ofquantityfound no displayed liquidity. Zero allocation.- Parameters:
limitTick- worst acceptable raw price in ticks (before fees); passInteger.MAX_VALUE(buy) /Integer.MIN_VALUE(sell) for pure market
-
venueCount
public int venueCount() -
routeCount
public long routeCount()
-