Skip to main content
This section covers Ondo-specific behavior that goes beyond the generic SDK documentation. For general concepts, see the Concepts section. Ondo Perps authenticates trading with a Sign-In-With-Ethereum (SIWE) session. After a one-time wallet sign-in the SDK holds a venue session credential and a venue API key, both kept client-side. Trading actions are unsigned venue requests the SDK HMAC-signs with that API key before the backend relays them to the venue (see Signing Model).
ondoWsProvider(options) accepts apiUrl and storage. The WebSocket provider reads the session token from the store under apiUrl, so apiUrl must match the apiUrl that the SIWE login used. It defaults to production. storage is the StorageAdapter that holds the session token. It defaults to the SDK’s encrypted localStorageAdapter, the same default as ondoProvider. SIWE login and addWithdrawalAddress need the user wallet. Pass userWallet at creation, or call setUserWallet() before them; without it they throw an SDKError. ondoProvider(options) accepts apiUrl (defaults to production) and storage (a StorageAdapter for the session token and API key; defaults to the SDK’s encrypted localStorageAdapter, not raw browser localStorage).

Topics

  • Signing Model — The SIWE session, the HMAC-signed trading relay, and the client-only session steps
  • Setup — SIWE login, deposit-address provisioning, terms acceptance, trading-key creation, and referral
  • Trading — All trading actions with parameters and Ondo’s order constraints
  • Withdrawals — The withdrawal address setup, the withdrawable balance, and withdrawal errors
  • WebSocket Protocol — The native WebSocket endpoint and how the SDK discovers it

Defaults & assumptions

  • Margin mode: cross only. Passing marginMode: ISOLATED on placeOrder / updateLeverage is rejected.
  • Order types: LIMIT and MARKET only. A limit order needs price: the venue rejects a limit order without one, and the backend does not pre-check it. price is validated on the market’s price grid when present; size is validated on the size grid.
  • Time-in-force: GTC, IOC, and POST_ONLY (post-only submits as GTC with the post-only flag set).
  • Order expiry: not supported — expiresAt must be omitted.
  • Trigger legs: take-profit / stop-loss execute at market. A leg needs type: MARKET. A LIMIT leg or a limitPrice on a trigger is rejected.
  • Quote asset: USDC. The provider advertises a single trading category (ondo).
  • Deposits: getDepositFlow() provisions a per-user Ethereum USDC margin-wallet address behind the SIWE session; route to the returned toAddress.
  • Withdrawals: withdraw() sends USDC from the perps margin wallet to the connected wallet address only.

Leverage

Ondo markets are cross-margin only. The maximum leverage of a market is the highest maxLeverage in the venue marginInfo brackets for that market. When the venue reports no bracket, the provider falls back to 10x, or 20x for US100, US500, XAU, XAG, WTI, and AAPL. The maintenance margin rate is half the initial rate at maximum leverage.

Candle intervals

The provider advertises these OHLCV intervals in supportedIntervals: 1m, 5m, 15m, 30m, 1h, 4h, 1d, 1w, 1M. Requesting any other interval raises a validation error.

Unsupported operations

The Ondo provider has no sendAsset, modifyOrder, or updatePositionMargin methods, and it has no choice step in setup — there is no account option to select. Funds move through getDepositFlow() for deposits and withdraw() for withdrawals. See Withdrawals.

Account reads

Every Ondo data read needs an active SIWE session: getPositions, getOrders, getOrder, getFills, getActivity, getPortfolioHistory, getWithdrawableBalances, getAvailableToTrade and getMarketSettings.
  • With no session, each data read throws SetupRequired, and the provider sends no request to Ondo. Run siweLogin first.
  • When Ondo rejects the stored session token, the provider removes the token and that read throws Unauthorized. The next read throws SetupRequired.
  • Ondo opens the account at the SIWE login, so an Ondo data read does not throw AccountNotFound.
  • getAccount, accountExists, getDepositFlow and getWithdrawFlow are status reads. They return the logged-out state as a value. See Account access.
Two reads have Ondo-specific results:
  • getOrders returns TWAP parents as orders.
  • getActivity returns only FUNDING, LIQUIDATION, DEPOSIT, and WITHDRAWAL items.

Account figures

PerpsClient.getAccountSummary() builds the AccountSummary totals for Ondo directly from the venue’s account balance: A logged-out account reads no venue balance and summarizes as zero. getWithdrawableBalances() reads the venue’s withdrawableMargin figure and exposes it as a row with categoryId: 'ondo' — the only category Ondo advertises.
  • Concepts — The action pattern, streaming, and multi-provider support
  • SDK / Streaming — Subscribe to live market data and user events via WebSocket
  • SDK / Account — Fetch account balances, positions, and fills
  • SDK / Trading — Place orders, cancel orders, and query order status
  • SDK / Actions — The create → authorize → execute pattern for all operations