sitemapArchitecture

Tycho Orderbook SDK works as follows.

SDK flow
  1. The Trader opens a stream

    1. It receives all updates (each block) on the state of the liquidity pools and the state for simulating the swap on

  2. The Trader requests a specific orderbook, e.g. ETH-USDC (base-quote)

    1. By default, the SDK uses a simplistic single-hop solver to simulate optimal routing between pools, but any solver can be used.

    2. 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

  3. Aggregate the output in bids and asks.

  4. Loop to constantly monitor status updates.

For example, a Binance-formatted version of an orderbook would contain the following data on pair BTC-USDC.

Binance-like onchain liquidity orderbook

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?