Trading Venues Split

Every market order routes through Drake's intelligent execution system that splits flow between two venues:

Onchain Order Book

The order book maintains limit orders using efficient Red-Black Tree data structures organized by price level:

  • Limit Buy Orders: Sorted from highest to lowest (best bid on top)

  • Limit Sell Orders: Sorted from lowest to highest (best ask on top)

  • Stop Orders: Separate trees for long and short stop-losses

  • Take-Profit Orders: Dedicated trees for profit-taking triggers

When a market order arrives, the matching engine:

  1. Finds the best available price (highest bid for sells, lowest ask for buys)

  2. Matches taker volume against resting maker orders

  3. Applies price-time priority (older orders at same price fill first)

  4. Continues matching through price levels until order is filled

  5. Charges maker rebates (negative fees) and taker fees

AMM Vault

The AMM vault provides continuous liquidity by quoting prices based on oracle feeds:

  • Pricing: Oracle mid-price ± configured spread

  • Execution: Instant fills at quoted price for allocated portion

  • Capacity: Fills absorb residual volume when order book lacks depth

  • Counterparty: Vault takes opposite side of trader positions

Last updated