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 at its expected all-in cost:
  • 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, which VenueScorecard produces), 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 the venue statistics and their accuracy.

  • 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 their measured statistics
      halfSpreadBps - lit half spread, > 0
      impactBps - expected lit impact for this size, ≥ 0 (a KylesLambda estimate slots in)