Class CrbRouter

java.lang.Object
com.quantfinlib.crb.CrbRouter

public final class CrbRouter extends Object
The central risk book's order router — internal cross first, dark pools second, lit last, each leg priced honestly:
  • Internal — crossing against the book's own offsetting inventory costs ZERO bps and leaks nothing: the CRB itself is the firm's first and best dark pool. Capped at the crossable inventory the caller reports;
  • Dark pools — midpoint fills pay no spread, but a venue whose fills systematically fade is not free: each venue carries an ADVERSE-SELECTION charge in bps (a post-fill markout estimate — VenueScorecard produces exactly this), and expected liquidity is discounted by fill probability. A dark venue is only used while its charge undercuts the lit cost;
  • Lit — pays the half spread plus expected impact, but fills. Whatever the dark legs are not EXPECTED to fill routes lit as well — hedges that might fill are not hedges.

Allocation is greedy by expected cost, deterministic, allocation only at decision time (arrays sized to the venue count). Research/ warm lane; the caller owns venue statistics and their honesty.

  • Method Details

    • route

      public static CrbRouter.Allocation route(double notional, double crossableInternal, CrbRouter.DarkVenue[] venues, double halfSpreadBps, double impactBps)
      Routes notional (positive, in book-currency units).
      Parameters:
      notional - amount to execute, > 0
      crossableInternal - offsetting book inventory available to cross against, ≥ 0
      venues - dark venues with honest statistics
      halfSpreadBps - lit half spread, > 0
      impactBps - expected lit impact for this size, ≥ 0 (a KylesLambda estimate slots in)