Architecture
Tycho Orderbook SDK works as follows.

The Trader opens a stream
It connects to Tycho Indexer
It receives all updates (each block) on the state of the liquidity pools and the state for simulating the swap on
The Trader requests a specific orderbook, e.g. ETH-USDC (base-quote)
By default, the SDK uses a simplistic single-hop solver to simulate optimal routing between pools, but any solver can be used.
Multiple trades are quoted ⇒ 1, 10 or 100 ETH for bids, then 2K, 20K, 200K USDC for asks. Thousands of simulations can be performed in just a few seconds
Aggregate the output in bids and asks.
Loop to constantly monitor status updates.
For example, a Binance-formatted version of an orderbook would contain the following data on pair BTC-USDC.

Expressed literally, this means that you can sell, for example, 82 BTC at a price of 76021 USDC, or you can buy 37 BTC at a price of 83098 USDC. The current price is between 81984 USDC and 82063 USDC, with a spread of 79 USDC, which is mainly due to cost of gas (on Ethereum mainnet).
On the basis of this familiar format, a trader can connect a TradFi orderbook algorithm and execute and operate onchain with ease.
Last updated
Was this helpful?