v1

latestOpenAPI 3.0.02026-07-2471143147.5 KB
Orders

Place TP/SL order

Create a Take Profit or Stop Loss order. Orders are stored off-chain and executed on-chain when the stop price condition is met.

Order Types:

  • TAKE_PROFIT: Triggers when price moves favorably (long: price >= stop_price, short: price <= stop_price)
  • STOP_LOSS: Triggers when price moves unfavorably (long: price <= stop_price, short: price >= stop_price)

Stop Price Options:

  • MARK_PRICE: Use oracle mark price for trigger
  • LAST_TRADED_PRICE: Use last traded price for trigger

Signature (required): Sign EIP-712 typed data (same domain as regular orders) with primaryType PlaceTpslOrder: fields: account(address), marketId(uint64), side(uint8), size(string), stopType(uint8), stopPrice(string), limitPrice(string), orderType(uint8), stopPriceOption(uint8), tif(uint8), deadline(uint32), sizePercentBps(uint32). Use exact same string values in signature and request body.

post/v1/orders/tpsl

Request body

accountstring

Account address in hex format (0x...)

market_idstring uint64

Market ID for the TPSL order

side'BUY' | 'SELL'
sizestring

Order size in base asset (decimal string, e.g. "1.5" for 1.5 units)

stop_type'TAKE_PROFIT' | 'STOP_LOSS' | 'STOP_TYPE_NONE'
order_type'MARKET' | 'LIMIT'
stop_pricestring

Stop price that triggers the order (decimal string, e.g. "70000" for $70k)

limit_pricestring

Limit price for execution (decimal string), required for LIMIT orders

stop_price_option'LAST_TRADED_PRICE' | 'MARK_PRICE' | 'PRICE_OPTION_NONE'
tif'GTC' | 'GTT' | 'FOK' | 'IOC'
signerstring

Signer address (session key) that signed this request

signaturestring byte

65-byte ECDSA signature (r+s+v) from signer over EIP-712 PlaceTpslOrder typed data

deadlineinteger

Unix timestamp after which the signature expires

size_percent_bpsinteger

Proportional size in basis points of the position (0..10000; 10000 = full position). 0 (default) = fixed size

Example request

{
  "account": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
  "market_id": "1",
  "size": "1.5",
  "stop_price": "70000",
  "limit_price": "69500",
  "signer": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e"
}

Response

A successful response.

order_idstring

Unique order ID (UUID format)

status'TPSL_ORDER_STATUS_ACCEPTED' | 'TPSL_ORDER_STATUS_TRIGGERED' | 'TPSL_ORDER_STATUS_SUCCESS' | 'TPSL_ORDER_STATUS_CANCELLED'
  • TPSL_ORDER_STATUS_ACCEPTED: Order accepted, waiting for trigger
  • TPSL_ORDER_STATUS_TRIGGERED: Trigger condition met, executing
  • TPSL_ORDER_STATUS_SUCCESS: Order executed successfully
  • TPSL_ORDER_STATUS_CANCELLED: Order cancelled by user or system

Example response

{
  "order_id": "550e8400-e29b-41d4-a716-446655440000"
}