Skip to main content
POST
Python (SDK)

Authorizations

x-api-key
string
header
required

Your Compass API Key. Get your key here.

Body

application/json

Buy or sell a swap-traded tokenized asset inside the product account.

Applies to RWA yield assets (Midas mTokens). Equities trade via the order endpoints instead.

token_in
string
required

Token to spend. For a buy this must be a stablecoin the Midas issuance vault accepts (USDC on every supported network; mBASIS also accepts USDT/DAI on Ethereum). For a sell it is the Midas RWA asset to redeem (e.g. 'mTBILL').

Examples:

"USDC"

"mTBILL"

token_out
string
required

Token to receive. For a buy this is the Midas RWA asset to mint (e.g. 'mTBILL'); for a sell it is the payout stablecoin (USDC).

Examples:

"mTBILL"

"USDC"

amount_in
required

Human-readable amount of token_in to trade (token units, not wei).

Required range: x > 0
Example:

500

owner
string
required

The owner's wallet address.

chain
enum<string>
required

Network to trade on. Midas RWA assets exist on Ethereum and Base.

Available options:
base,
ethereum,
arbitrum,
hyperevm,
tempo,
bsc
slippage
default:0.5

Maximum slippage tolerance as a percentage (e.g., 0.5 = 0.5%).

Example:

0.5

gas_sponsorship
boolean
default:false

When true, returns an EIP-712 payload for gas-sponsored execution instead of an unsigned transaction.

fee
TokenizedAssetsFee · object | null

Optional partner fee charged when selling (exiting). It is taken from the payout-token (USDC) proceeds and sent to your fee recipient inside the same execution.

Response

Successful Response

Unsigned trade execution for the owner to sign.

Exactly one of transaction (gas_sponsorship=false) or eip_712 (gas_sponsorship=true) is set.

estimated_amount_out
string
required

Estimated amount of token_out received (human-readable units).

Pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
transaction
UnsignedTransaction · object | null

Unsigned transaction executing the trade in the product account.

Example:
eip_712
BatchedSafeOperationsResponse · object | null

EIP-712 payload for gas-sponsored execution.

Example:
fee_amount
string | null

Fee charged on the sell, in payout-token (USDC) units. Null when no fee was applied.

Pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
settlement
enum<string>
default:instant

How the trade settles. instant: the signed transaction completes the trade (Midas/Ondo swaps and IXS deposits). async: the transaction only requests an IXS redemption, which the vault operator settles off-chain later — poll poll_endpoint for status.

Available options:
instant,
async
poll_endpoint
string | null

For async settlements, the endpoint to poll for redemption status (GET /v2/tokenized_assets/redemptions). Null for instant trades.