Skip to content

Quoting Swap

Swap volume clears through RFQ. Textile asks your bot to price an exact size, you return a firm quote, and the trader executes it. Stitch handles the loop. This page is the knobs you control.

What your quotes are

Each answer Stitch sends is a signed exclusive order, a commitment to trade a specific amount at a specific price, valid until it expires. Your funds move only when a trader executes the quote, and each signature can fill exactly once.

The taker pays the protocol fee on top of your price, set per chain by the on-chain SellFirstFeeController, 1 bps on BSC and Celo and 5 bps on Ethereum. The price you quote is the price you get.

What Stitch does

Stitch polls your price feed and keeps a two-sided quote ready:

  • a buy side that spends USDT to buy the non-USD asset (cNGN, wARS, wBRL, WETH) below the feed price,
  • a sell side that sells the non-USD asset for USDT above it.

When Textile solicits your size, Stitch signs a firm quote from that inventory and sends it back inside the reply window. It re-checks your wallet constantly and never quotes more than your current balance and approvals can cover.

The knobs you control

All of this lives in stitch.toml, per corridor:

SettingWhat it does
Buy / sell offset (bps)Your spread, how far from the feed price each side quotes. This is your margin per fill.
Total liquidity per sideHow much you will commit. "max" quotes your full wallet balance. A fixed amount sets a hard cap below it.

RFQ quote lifetime is Textile's quoteTtlMs, not a Stitch setting. ttl_secs and refresh_threshold_bps only apply if you still rest a public ladder for Limit or leftover book. Shortening them does not expire or refresh RFQ signatures.

Start wide and small: a larger offset and a low fixed liquidity cap. Tighten the spread and raise the cap once you have watched the bot trade for a while.

Filling traders' limit orders

Traders can name their own price and wait. Those orders are fills you can take instead of waiting for an RFQ.

With limit_taker_enabled = true in the pool's config, Stitch checks open limit orders every tick and fills any priced at or beyond your own quote: a trader selling cNGN at or below your bid, or buying it at or above your ask. Your spreads are the margin. There is no separate pricing to configure.

Two differences from answering RFQ. Taking costs gas, one on-chain transaction per batch of fills. And the protocol's taker fee is on you rather than the trader, so Stitch reads the fee from the chain and only fills when the order clears your spread after fee, with an optional per-order minimum profit as a dust guard. It is off by default. See the Stitch configuration reference for the knobs.

Operating notes

Approvals matter. Run stitch approve before going live, and again for any new token. A live start refuses to run without approvals. Approving the maximum once is the standard choice. A capped approval (--exact) is consumed as quotes fill and must be re-run every time you raise liquidity.

Inventory drifts. Every buy-side fill spends USDT and delivers the counter-asset to your wallet. Rebalance or off-ramp on your own schedule. Stitch quotes whatever is actually there.

Fixed sides do not auto-grow. A side sized with a fixed amount caps depth even after a wallet top-up. Raise the cap or switch the side to "max".

RFQ "max" duplicates the wallet. Each corridor's RFQ side quotes the full min(balance, Permit2 allowance) for that token. Reservations are per corridor slug, so two "max" corridors can both sign the whole wallet, and the second fill can revert. Use a fixed cap per corridor if you do not want that overlap. The even split across "max" sides is a leftover-ladder rule only.

Watch the logs. Stitch logs every quote, fill, and skip with the reason. --dry-run skips the RFQ responder, so it never sends a firm quote and does not print a sized RFQ. Use it to check config, approvals, and any leftover ladder, not to preview RFQ prices.

Config changes need a restart. Stitch reads stitch.toml at startup.

Next