Cohort ended · self-paced
advanced 40 min

Understanding the native XRPL DEX

Learn to read an order book the way a trader does: what TakerGets and TakerPays mean, how price (quality) works, why "funded" size matters, and how order books and AMMs work together.

Prerequisites

Complete these before starting this module:

What you'll learn

  • Identify an order book by both asset definitions.
  • Interpret TakerGets and TakerPays without reversing the trade.
  • Use funded fields rather than nominal offer size.
  • Explain order-book priority and interaction with AMM liquidity.
Complete this module by a quiz. Jump to assessment

An order book, in plain terms

An order book is a list of standing offers to swap one asset for another, much like the buy/sell ladder on any exchange. Each book covers one pair of assets, and for issued tokens the issuer is part of that identity. Before you calculate anything, describe the trade in words.

Every offer has two fields, both named from the point of view of whoever takes it:

  • TakerGets — what you, the taker, receive.
  • TakerPays — what you, the taker, pay.

Take an offer of TakerGets: 8 TST and TakerPays: 4 XRP: accept it and you get 8 TST for 4 XRP, a price of 4 ÷ 8 = 0.5 XRP per TST. That price is the offer's quality.

XRPL central limit order book showing bid and ask depth

Better prices come first, and among offers at the same price the older one wins. Placing an offer with OfferCreate trades straight away against anything already on the book, and any remainder rests there as your own offer. OfferCancel removes an offer you placed; it can report success even when nothing was left to cancel.

Listed size versus tradable size

An offer advertises the size its owner wants, but the owner's balance is never locked in advance. What you can really trade is the funded amount. So from book_offers, read taker_gets_funded and taker_pays_funded ahead of the plain TakerGets/TakerPays. An offer might list 100 TST while its owner holds only 8 right now, leaving 8 TST of funded size. Add up the listed figures instead and you will advertise depth that cannot trade.

Offers can also carry behaviour flags. A passive offer rests on the book rather than immediately taking a matching offer. Immediate-or-Cancel fills whatever it can at once and drops the rest. Fill-or-Kill fills in full or does nothing. And a single payment or offer can draw on the order book, an AMM pool, or both together when that yields a better price.

Assignments

0 of 1 complete

Unlocks

Finishing this module opens up: