Skip to main content
A sync book lets a designated market maker quote a token it can source onchain. Only you can quote in your book. You act as the settler through your executor, the contract that performs the onchain exchange. When a taker matches your quote, the matched quantity leaves the book. Record the exchange as settled when your executor’s transaction produces a matching Settled event on the deposit contract. For the trading model, see Composability.

Get ready to quote

  1. Connect to the authenticated /account/events/{user_id} WebSocket. Give Tplus your maker user ID and token market ID and ask for a sync book. Public self-service creation is unavailable. You can have one book per market. A newly created book sends you SyncBookCreated. If the book already exists or you missed the notice, ask Tplus to confirm.
  2. Use a cross-margin trading account on each side. Choose a token market identified by address and chain. Check GET /registry/assets for a USD representation on that chain and confirm that the base token has no native asset. Find the chain’s deposit contract with GET /registry/vaults. Check your maker key in its getApprovedSettlers() list and confirm with Tplus that your executor contract is registered for that key.
  3. Start consuming the authenticated /sync/pending-fills WebSocket before you quote. The subscription starts after the welcome frame, so even connection setup can leave a gap. Use /orders to track your quotes. Public market depth excludes sync quotes. See WebSocket streams.

Sign and post a quote

Submit the signed order to POST /orders/create. A SyncQuote is post-only and takes no trigger. A bid or offer that would cross your opposite quote in the same book is rejected. Price and base quantity are integers scaled by the market’s respective book decimals. After applying both decimal scales, price × quantity must be worth at least 5 whole quote units. Any positive remainder after a replace or amend must still meet that minimum. Use cancel to withdraw the quote. The default time-in-force is GTC. For GTD, set time_in_force=SyncGTD(timestamp_ns=deadline_ns) using the SyncGTD model from tplus.model.sync_order and a Unix timestamp in nanoseconds. Both expire no later than 30 days after the signed creation time. Choose a fresh client order ID across your sync and ordinary orders in the market. See Orders for order management. This example offers 5 tokens at 100 USD. It assumes a market with two price decimals and four quantity decimals. Use an OMS client oms, your signer maker, token-market asset_id, fresh order_id and registered executor_address. Build the details explicitly because the Python quote helper has no executor-address argument.
The signature covers the complete order, including its time-in-force and lowercase hex executor address. The deposit contract checks the calling executor’s registration under your settler key. A create status of Received confirms book acceptance. An unregistered maker gets HTTP 403 WRONG_AUTHORIZATION. A missing book can produce HTTP 400 INVALID_BOOK_CONFIGURATION. If the request times out, check GET /orders/lookup?order_id=…&asset_id=… before submitting again. See Signing.

Follow the taker’s order

A SyncTaker is an untriggered immediate-or-cancel (IOC) spot order with a positive limit price and base quantity. The taker cannot select a maker. The venue selects the sync book that could fill the most within the limit, breaking quantity ties by best total price for the taker. It takes the best prices across that book and the orderbook, giving ordinary orders priority at equal prices. Suppose the only other liquidity is an ordinary offer of 10 tokens at 100 USD. On a separate client, the taker can submit this order for 20 tokens with a limit of 110 USD using the same market decimals.
The ordinary offer fills 10, your offer fills 5, and the remaining 5 cancel. Your executor owes 5 tokens for a 500 USD payout, converted to the chain’s USD token. Only the sync leg goes into your approval, even when it spans several of your quotes. Clearing locks the taker’s outgoing spot inventory and chooses a settlement nonce. A buyer needs spendable USD for the purchase and any reserved fee. A seller needs the market tokens it sells. The fill itself requests approval. Skip the separate settlement-init step used for a manually requested settlement. The sync leg emits no trade and charges no trading fee. A USD payout can reserve a rebalancing fee against the taker, shown in approval.reserved_fee. A market-token payout reserves none. The signed trading fee cap does not bound this settlement fee. Budget gas and the cost of sourcing the incoming token when pricing your quote.

Execute the approval

Only the maker receives the approval on /sync/pending-fills. In the default protocol, an approval carries approval and a failure carries reason. In tplus.ws.v1, read data on the sync-settlement-approved or sync-fill-failed channel. Python’s oms.stream_sync_fills(user=maker) yields typed events, but its approval model omits vault. Save the raw frame before submitting a transaction. It identifies the market, your crossed orders in maker_quotes (each with an order ID and optional trade ID), the taker’s tplus_user and sub_account_index, and the signed approval.
  1. Use approval.vault as the deposit contract on the approval’s chain. For EVM token and contract addresses, take the first 20 bytes of the right-padded 32-byte value. Keep the full taker and settler keys. Assemble the contract order in ABI order from asset_out, amount_out, asset_in, amount_in, spot mode (0), tplus_user, sub_account_index, inner.nonce and expiry. Use the signed amounts in native token units and expiry as validUntil. The lifetime is set per chain within a fixed 5–120 second range. The block timestamp may equal the signed expiry in Unix seconds.
  2. Have your registered executor call executeAtomicSettlement(order, settler, data, signature) with your maker key as settler and the approval’s inner.signature. Execute pending approvals in increasing nonce order for the same deposit contract, taker and sub-account. A higher executed nonce invalidates lower ones. Record the transaction hash with the approval as soon as you have it.
  3. In onAtomicSettlement, use the outgoing tokens to source the incoming token. Return at least the approved amount_in and grant the deposit contract allowance for the full amount you return. The deposit contract pulls exactly that amount, so returning more also pays more. See Settlement integration.

Reconcile before replenishing

After a gap, check the deposit contract’s logs through a block past the approval deadline before declaring it unused. If you missed the nonce, compare the taker, sub-account, settler and settlement terms against your saved records. Keep ambiguous matches unresolved. As the maker, fetch all pages of GET /orders/user/{user_id}/{asset_id}?open_only=true starting at page=0 before sizing replacement quotes. See Bot safe stop.