Class SmartOrderRouter
java.lang.Object
com.quantfinlib.execution.SmartOrderRouter
Smart Order Router: splits a marketable order across venues to minimize
the all-in (fee-adjusted) execution price, respecting each venue's
displayed/estimated size. Dark venues price at their midpoint; with
preferDark they are swept first regardless of ranking (to minimize
information leakage), otherwise every venue competes purely on all-in price.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordOne child order of the routing plan.static final record -
Method Summary
Modifier and TypeMethodDescriptionstatic SmartOrderRouter.RoutingPlanroute(Side side, long quantity, List<VenueQuote> venues, boolean preferDark) static SmartOrderRouter.RoutingPlanroute(Side side, long quantity, List<VenueQuote> venues, boolean preferDark, double limitPrice) Asroute(Side, long, List, boolean), but skips any venue whose price would violatelimitPrice(through-the-limit on the relevant side) — the double-price analogue ofHftSor.route(Side, long, int, long[])'slimitTick.static SmartOrderRouter.RoutingPlanroute(Side side, long quantity, List<VenueQuote> venues, boolean preferDark, double limitPrice, long nowNanos, long maxQuoteAgeNanos) Asroute(Side, long, List, boolean, double), additionally excluding any venue whose quote is stale — the same treatment a NaN or zero-size venue already gets, mirroringHftSor.venueDown(int)as the way a dead/frozen feed is kept from receiving child orders.
-
Method Details
-
route
public static SmartOrderRouter.RoutingPlan route(Side side, long quantity, List<VenueQuote> venues, boolean preferDark) -
route
public static SmartOrderRouter.RoutingPlan route(Side side, long quantity, List<VenueQuote> venues, boolean preferDark, double limitPrice) Asroute(Side, long, List, boolean), but skips any venue whose price would violatelimitPrice(through-the-limit on the relevant side) — the double-price analogue ofHftSor.route(Side, long, int, long[])'slimitTick.- Parameters:
limitPrice- worst acceptable raw (pre-fee) price; passDouble.POSITIVE_INFINITY(buy) /Double.NEGATIVE_INFINITY(sell) for pure market
-
route
public static SmartOrderRouter.RoutingPlan route(Side side, long quantity, List<VenueQuote> venues, boolean preferDark, double limitPrice, long nowNanos, long maxQuoteAgeNanos) Asroute(Side, long, List, boolean, double), additionally excluding any venue whose quote is stale — the same treatment a NaN or zero-size venue already gets, mirroringHftSor.venueDown(int)as the way a dead/frozen feed is kept from receiving child orders.- Parameters:
nowNanos- current time, same clock asVenueQuote.lastUpdateNanosmaxQuoteAgeNanos- a venue is excluded whennowNanos - quote.lastUpdateNanos() > maxQuoteAgeNanos; passLong.MAX_VALUEto disable the staleness check
-