> For the complete documentation index, see [llms.txt](https://docs.drake.exchange/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.drake.exchange/trading/hybrid-clob-+-amm/trading-venues-split.md).

# 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


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.drake.exchange/trading/hybrid-clob-+-amm/trading-venues-split.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
