AlcorDocs

Order book (book.alcor)

The Alcor spot order book contract: networks, internal balances, units, fees, limits and markets.

book.alcor is Alcor's spot order book contract: price-time priority, limit orders with post-only, IOC and FOK, market buys by amount, order expiry, stop and take-profit triggers with OCO, and swaps straight from a wallet with one transfer. The swap router reads it together with the AMM pools, so a swap on Alcor fills against the order book whenever its price is better.

Networks

NetworkContractFee accountIndexer API
Telosbook.alcorfees.alcorhttps://telos.alcor.exchange/api/v2/orderbook
WAXbook.alcorfees.alcorhttps://wax.alcor.exchange/api/v2/orderbook
XPR Networkbook.alcorfees.alcorhttps://proton.alcor.exchange/api/v2/orderbook

The contract code is the same on every network. See the order book API.

Internal balances

Trading runs on balances held by the contract:

  1. Deposit — transfer a token to book.alcor with any memo. The amount is credited to the sender.
  2. Trade — orders lock what they need from the available balance and trade without token transfers.
  3. Withdraw — withdraw sends tokens from the available balance to any account that has a row of that token.

A swap skips the ledger: one transfer in, the output and any change come back in the same action, and nothing stays on the exchange.

Each balance has available and locked. A sell locks its base; a buy locks qty * price plus the taker fee and gets back whatever the fill did not need.

Units

Every market has two fixed numbers:

FieldMeaning
lot_sizeminimal base units in one lot
priceminimal quote units one lot costs

An order of qty lots at price moves qty * lot_size base against qty * price quote. All math is in integers; only fees are rounded (down, per fill). tick_size is the price step, min_notional the smallest quote value of any order or trigger that rests in the book.

Example: WAX/USDT on WAX. WAX has 8 decimals, USDT 6. lot_size = 10000000000 is 100 WAX. At 0.00456 USDT per WAX a lot costs 0.456 USDT, so price = 456000. tick_size = 10 makes the price step 0.00001 USDT per lot, or 0.0000001 USDT per WAX. min_notional = 1000000 is 1 USDT.

lot_size never changes after listing. tick_size and min_notional can.

Fees

Maker and taker fees are set per market in basis points (maker_bps, taker_bps). The fee is taken in quote and rounded down on each fill. The rate is fixed in the order when it is placed, so a later fee change never makes a resting order more expensive. The maker rate is never above the taker rate. All markets listed so far trade with 0 / 0.

Limits

  • Work budget. One action does at most 1000 units of work: a fill, or the removal of one of your own orders or an expired order in the way. If the budget runs out while the book still crosses, the rest comes back to you (truncated = true) and never rests in the book.
  • Minimum size. A taker remainder below min_notional comes back instead of resting. A maker remainder that a partial fill leaves below min_notional is cancelled and refunded.
  • Self-trade prevention. Your own order in the way of your taker order is cancelled, not traded.
  • Expiry. An order can carry expires_at (block time, seconds). After it the order no longer trades: a taker that reaches it removes it and refunds its owner, and anyone may cancel it.

Markets

Markets listed at launch. The live list is the markets table or GET /markets.

NetworkIDMarketLotPrice stepMin. order
Telos1USDC@wrap.alcor / USDT@wrap.alcor0.01 USDC0.0001 USDT1 USDT
Telos2BNB@wrap.alcor / USDC@wrap.alcor0.001 BNB0.1 USDC5 USDC
WAX1WAX@eosio.token / USDT@wrap.alcor100 WAX0.0000001 USDT1 USDT
WAX2TLM@alien.worlds / USDT@wrap.alcor100 TLM0.0000001 USDT1 USDT
WAX3WAX@eosio.token / USDC@wrap.alcor100 WAX0.0000001 USDC1 USDC
XPR1XPR@eosio.token / XUSDC@xtokens100 XPR0.00000001 XUSDC1 XUSDC
XPR2XPR@eosio.token / USDC@wrap.alcor100 XPR0.00000001 USDC1 USDC
XPR3XPR@eosio.token / USDT@wrap.alcor100 XPR0.00000001 USDT1 USDT

Price steps are per one base token; a lot's price moves by tick_size minimal quote units.

Pages

On this page