Skip to main content
POST /api/v1/orders/create_market

Operation Type (for Signing)

Header FieldTypeContent
"type"string"create_market_order"

Request Body

FieldTypeNeedDescriptionExample
”account”stringrequiredUser’s wallet address42trU9A5…
“signature”stringrequiredCryptographic signature5j1Vy9Uq…
“timestamp”integerrequiredCurrent timestamp in milliseconds1716200000000
”symbol”stringrequiredTrading pair symbolBTC
”amount”stringrequiredOrder amount0.1
”side”stringrequiredOrder side (bid/ask)bid
”slippage_percent”stringrequiredMaximum slippage tolerance in percentage, e.g. “0.5” means 0.5% max slippage0.5
”reduce_only”booleanrequiredWhether the order is reduce-onlyfalse
”client_order_id”Full UUID stringoptionalClient-defined order IDf47ac10b-58cc-4372-a567-0e02b2c3d479
”take_profit”objectoptionalTake profit stop order configurationSee next five rows
”stop_price”stringrequiredStop trigger price55000
”limit_price”stringoptionalLimit price for the triggered order54950
”client_order_id”Full UUID stringoptionalClient-defined order ID for the stop ordere36ac10b-58cc-4372-a567-0e02b2c3d479
”trigger_price_type”stringoptionalPrice type used to trigger the stop order. Defaults to last_trade_price. Options: mark_price, last_trade_price, mid_pricemark_price
”amount”stringoptionalOrder amount for the triggered order. If omitted, the full position size is used0.1
”stop_loss”objectoptionalStop loss order configurationSee next five rows
”stop_price”stringrequiredStop trigger price48000
”limit_price”stringoptionalLimit price for the triggered order47950
”client_order_id”Full UUID stringoptionalClient-defined order ID for the stop orderd25ac10b-58cc-4372-a567-0e02b2c3d479
”trigger_price_type”stringoptionalPrice type used to trigger the stop order. Defaults to last_trade_price. Options: mark_price, last_trade_price, mid_pricemark_price
”amount”stringoptionalOrder amount for the triggered order. If omitted, the full position size is used0.1
”agent_wallet”stringoptionalAgent wallet address69trU9A5…
“expiry_window”integeroptionalSignature expiry in milliseconds30000
”builder_code”stringoptionalBuilder program code (3-16 alphanumeric characters)MYCODE
{
  "account": "42trU9A5...",
  "signature": "5j1Vy9Uq",
  "timestamp": 1716200000000,
  "symbol": "BTC",
  "amount": "0.1",
  "side": "bid",
  "slippage_percent": "0.5",
  "reduce_only": false,
  "client_order_id": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
  "take_profit": {
    "stop_price": "55000",
    "limit_price": "54950",
    "client_order_id": "e36ac10b-58cc-4372-a567-0e02b2c3d479",
    "trigger_price_type": "mark_price"
  },
  "stop_loss": {
    "stop_price": "48000",
    "limit_price": "47950",
    "client_order_id": "d25ac10b-58cc-4372-a567-0e02b2c3d479",
    "trigger_price_type": "mark_price"
  },
  "agent_wallet": "69trU9A5...",
  "expiry_window": 30000,
  "builder_code": "MYCODE"
}

Response

  • Status 200: Order created successfully
  {
    "order_id": 12345
  }
  • Status 400: Bad request
  {
    "error": "Invalid order parameters",
    "code": 400
  }
  • Status 500: Internal server error

Code Example (Python)

import requests

payload = {
    "account": "42trU9A5...",
    "signature": "5j1Vy9Uq...",
    "timestamp": 1716200000000,
    "symbol": "BTC",
    "amount": "0.1",
    "side": "bid",
    "slippage_percent": 1,
    "reduce_only": False,
    "client_order_id": "f47ac10b-58cc-4372-a567-0e02b2c3d479"
}

response = requests.post(
    "/api/v1/orders/create_market",
    json=payload,
    headers={"Content-Type": "application/json"}
)

data = response.json()
Note: In order to protect liquidity providers from adverse selection, all market orders are subject to a ~200ms delay.