plan_trade

$0.02 per call

Ordered, unsigned X Layer mainnet transactions that execute a buy or sell of an xStock. Your account signs and sends them; Roundlot never does.

Parameters#

Everything quote takes, plus:

NameTypeDescription
accountaddress, requiredThe account that will sign the transactions and receive the output
maxSlippageBpsnumber, default 50Worst acceptable fill against the quote, 1–1000; sets amountOutMinimum or amountInMaximum
tokenFormraw or wrapped, default rawraw: the account holds or wants the xStock itself, which adds wrap or unwrap steps. wrapped: the ERC-4626 wrapper token
deadlineSecondsnumber, default 600Seconds until the swap reverts, 60–3600

Request#

curl -i "https://api.roundlot.0xo.in/v1/plan-trade?symbol=NVDA&side=buy&size=250&account=0xYourAddress"

Response#

Buying $250 of NVDA delivered as the raw token, planned on 25 Sep 2026 at 03:54 UTC (calldata shortened):

JSON
{
  "chainId": 196, "network": "eip155:196",
  "account": "0x5075FF68A0Efb54dB13423AD924bd680327D305E",
  "symbol": "NVDA", "side": "buy", "tokenForm": "raw",
  "steps": [
    { "index": 1, "kind": "approve", "to": "0x4ae46a509f6b1d9056937ba4500cb143933d2dc8", "data": "0x095ea7b3…", "value": "0",
      "description": "Approve SwapRouter02 to spend USDG" },
    { "index": 2, "kind": "swap", "to": "0x4f0c28f5926afda16bf2506d5d9e57ea190f9bca", "data": "0x5ae401dc…", "value": "0",
      "description": "Swap 250 USDG for at least 1.10567674963162354 wNVDAx" },
    { "index": 3, "kind": "unwrap", "to": "0xa8ddb5cd96b5222afe198316e9a57caa642850d5", "data": "0xba087652…", "value": "0",
      "description": "Unwrap 1.10567674963162354 wNVDAx into 1.107557723381118755 NVDAx" }
  ],
  "expected": { "pay": "250 USDG", "receive": "1.107557723381118755 NVDAx (any fill above the slippage floor stays as wNVDAx)" },
  "limits": { "amountIn": "250", "amountOutMinimum": "1.10567674963162354", "maxSlippageBps": 50,
    "deadline": "2026-09-25T04:04:51.000Z" },
  "warnings": []
}

The steps#

Depending on side and token form, a plan is some of:

  1. approve: only when the account's allowance is too low; existing approvals are skipped.
  2. wrap: ERC-4626 deposit of the raw token, when selling the raw form.
  3. swap: SwapRouter02.multicall(deadline, [exactInputSingle | exactOutputSingle]), so the swap reverts after the deadline.
  4. unwrap: ERC-4626 redeem, when buying the raw form.

Each approve sits directly before the step that spends it. If the account holds too little of the first token spent, the plan still comes back, with a warning. How to run a plan is in Executing a plan safely.

Signing moves real funds.

The steps are mainnet transactions. Check each to, data and the limits before you sign, and sign them in order.

Errors#

CodeHTTPWhen
invalid_input400A parameter is missing or malformed, including account; no payment is asked for
unknown_symbol400The symbol isn't NVDA, SPY or TSLA
insufficient_liquidity422The pool can't fill this size
token_paused422The issuer has paused transfers
multiplier_change_pending422A multiplier change activates within the deadline plus 60 s
rate_limited429More than 60 requests a minute from your IP
payments_unavailable503The facilitator isn't reachable; the free catalog still works
upstream_error502X Layer RPC or OKX market data failed; try again

None of these are charged.

Last updated 25 Sep 2026

Roundlot

Pay-per-call market data and trade plans for tokenized equities on X Layer. Built for OKX Dev Day 2026.

Payments settle on X Layer testnet. Data and trade plans are X Layer mainnet. Not investment advice.