Skip to content

Create order#

POST https://api.pro.anboto.xyz/api/v2/trading/order/create

Process a new order request and return order response ApiKeyAuth required.

Body params#

client_order_id string
A custom string to identify the order
Example: ABC-12345^12-10-23
exchange enum required
The exchanges available for order placement via the API — BINANCE, HUOBI, GATEIO, KUCOIN, OKX, BYBIT, BITGET, WOO, … (15 values)
subaccount string
The sub-account under which to trade the order
symbol string required
The symbol using Anboto symbology, e.g. BTC/USDT
asset_category enum required
The Asset category of the order. — SPOT, FUTURE
Example: SPOT
side enum required
The side of the book to trade. — BUY, SELL
quantity string required
The quantity to trade as a exchange trade-able decimal value, e.g. 0.015
strategy enum required
The execution strategy for the order. — TWAP, VWAP, ICEBERG, POV, MARKET, LIMIT, IS, SCALE
limit_price string
The exchange valid limit price for the order
Example: 2205.10
start_time string
The start time in UTC
Example: 2024-01-22T22:05:00Z
end_time string
The end time in UTC
Example: 2024-04-22T22:05:00Z
clip_size_type enum
The clip size for the child orders. The default is AUTOMATIC — ABSOLUTE, PERCENTAGE, AUTOMATIC, ORDER_COUNT
Example: AUTOMATIC · Default: AUTOMATIC
clip_size_val string
The clip size value, required if the type is ABSOLUTE or PERCENTAGE
Example: 0.01
The advanced order parameters to modify the execution behavior.

Headers#

Header
X-API-KEY string required
X-TIMESTAMP int64 ms required
X-SIGN string required
X-RECV-WINDOW int, default 5000

Responses#

201 Order created successfully
401 Unauthorized, Invalid Signature
429 Rate limit exceeded, retry later

Response fields — OrderSummary#

order_id integer
The Anboto assigned order identifier
client_order_id string
A custom string to identify the order
Example: ABC-12345^12-10-23
status enum
The order status — PENDING_NEW, ACCEPTED, REJECTED, PARTIALLY_FILLED, FILLED, PENDING_CANCEL, CANCELLED, PENDING_PAUSE, … (12 values)
created_at date-time required
The time in UTC when the order was created
Example: 2024-01-22T22:05:00Z
message string
Any additional information, usually if the order was rejected
error_code enum
The error code used to describe why an order was rejected. — OTHER, QUANTITY_EXCEED, AUTHENTICATION_ERROR, INSUFFICIENT_FUNDS, RATE_LIMIT_EXCEEDED, DDOS_PROTECTION, EXCHANGE_NOT_AVAILABLE, NETWORK_ERROR, … (34 values)
Example: INVALID_ORDER
body='{
  "client_order_id": "ABC-12345^12-10-23",
  "exchange": "BINANCE",
  "subaccount": "string",
  "symbol": "string",
  "asset_category": "SPOT",
  "side": "BUY",
  "quantity": "string",
  "strategy": "TWAP",
  "limit_price": "2205.10",
  "start_time": "2024-01-22T22:05:00Z",
  "end_time": "2024-04-22T22:05:00Z",
  "clip_size_type": "ABSOLUTE",
  "clip_size_val": "0.01",
  "params": {
    "duration_seconds": "120",
    "trading_style": "PASSIVE",
    "urgency": "LOW",
    "randomize_amount": true,
    "would": {
      "would_price": "string",
      "would_pct": "string",
      "would_style": "PASSIVE",
      "would_is_arrival": true
    },
    "trigger": {
      "trigger_price": "string",
      "trigger_condition": "ABOVE"
    },
    "placement_infos": {
      "placement_mode": "DEFAULT",
      "placement": "string",
      "cancel": "string"
    },
    "reduce_only": true,
    "start_ladder_price": "string",
    "end_ladder_price": "string",
    "ladder_direction": "string",
    "ladder_profile": "string",
    "size_skew": 0.0,
    "ob_imbalance_cancel": true,
    "ob_imbalance_threshold": "0.75",
    "price_lock_bps": "5",
    "post_only": true
  }
}'

curl -X POST "$BASE/api/v2/trading/order/create" \
  -H "X-API-KEY: $API_KEY" -H "X-TIMESTAMP: $ts" \
  -H "X-SIGN: $sign" \
  -H "Content-Type: application/json" -d "$body"
payload = {
  "client_order_id": "ABC-12345^12-10-23",
  "exchange": "BINANCE",
  "subaccount": "string",
  "symbol": "string",
  "asset_category": "SPOT",
  "side": "BUY",
  "quantity": "string",
  "strategy": "TWAP",
  "limit_price": "2205.10",
  "start_time": "2024-01-22T22:05:00Z",
  "end_time": "2024-04-22T22:05:00Z",
  "clip_size_type": "ABSOLUTE",
  "clip_size_val": "0.01",
  "params": {
    "duration_seconds": "120",
    "trading_style": "PASSIVE",
    "urgency": "LOW",
    "randomize_amount": true,
    "would": {
      "would_price": "string",
      "would_pct": "string",
      "would_style": "PASSIVE",
      "would_is_arrival": true
    },
    "trigger": {
      "trigger_price": "string",
      "trigger_condition": "ABOVE"
    },
    "placement_infos": {
      "placement_mode": "DEFAULT",
      "placement": "string",
      "cancel": "string"
    },
    "reduce_only": true,
    "start_ladder_price": "string",
    "end_ladder_price": "string",
    "ladder_direction": "string",
    "ladder_profile": "string",
    "size_skew": 0.0,
    "ob_imbalance_cancel": true,
    "ob_imbalance_threshold": "0.75",
    "price_lock_bps": "5",
    "post_only": true
  }
}

r = requests.post(f"{BASE}/api/v2/trading/order/create",
    data=json.dumps(payload)
    headers=signed_headers(payload))
print(r.json())
let payload = serde_json::json!({
  "client_order_id": "ABC-12345^12-10-23",
  "exchange": "BINANCE",
  "subaccount": "string",
  "symbol": "string",
  "asset_category": "SPOT",
  "side": "BUY",
  "quantity": "string",
  "strategy": "TWAP",
  "limit_price": "2205.10",
  "start_time": "2024-01-22T22:05:00Z",
  "end_time": "2024-04-22T22:05:00Z",
  "clip_size_type": "ABSOLUTE",
  "clip_size_val": "0.01",
  "params": {
    "duration_seconds": "120",
    "trading_style": "PASSIVE",
    "urgency": "LOW",
    "randomize_amount": true,
    "would": {
      "would_price": "string",
      "would_pct": "string",
      "would_style": "PASSIVE",
      "would_is_arrival": true
    },
    "trigger": {
      "trigger_price": "string",
      "trigger_condition": "ABOVE"
    },
    "placement_infos": {
      "placement_mode": "DEFAULT",
      "placement": "string",
      "cancel": "string"
    },
    "reduce_only": true,
    "start_ladder_price": "string",
    "end_ladder_price": "string",
    "ladder_direction": "string",
    "ladder_profile": "string",
    "size_skew": 0.0,
    "ob_imbalance_cancel": true,
    "ob_imbalance_threshold": "0.75",
    "price_lock_bps": "5",
    "post_only": true
  }
});

let resp = client
    .post(format!("{BASE}/api/v2/trading/order/create"))
    .headers(signed_headers(&payload))
    .json(&payload)
    .send()?;
println!("{}", resp.text()?);
payload := map[string]any{
    "client_order_id": "ABC-12345^12-10-23",
    "exchange": "BINANCE",
    "subaccount": "string",
    "symbol": "string",
    "asset_category": "SPOT",
    "side": "BUY",
    "quantity": "string",
    "strategy": "TWAP",
    "limit_price": "2205.10",
    "start_time": "2024-01-22T22:05:00Z",
    "end_time": "2024-04-22T22:05:00Z",
    "clip_size_type": "ABSOLUTE",
    "clip_size_val": "0.01",
    "params": map[string]any{
        "duration_seconds": "120",
        "trading_style": "PASSIVE",
        "urgency": "LOW",
        "randomize_amount": true,
        "would": map[string]any{
            "would_price": "string",
            "would_pct": "string",
            "would_style": "PASSIVE",
            "would_is_arrival": true,
        },
        "trigger": map[string]any{
            "trigger_price": "string",
            "trigger_condition": "ABOVE",
        },
        "placement_infos": map[string]any{
            "placement_mode": "DEFAULT",
            "placement": "string",
            "cancel": "string",
        },
        "reduce_only": true,
        "start_ladder_price": "string",
        "end_ladder_price": "string",
        "ladder_direction": "string",
        "ladder_profile": "string",
        "size_skew": 0.0,
        "ob_imbalance_cancel": true,
        "ob_imbalance_threshold": "0.75",
        "price_lock_bps": "5",
        "post_only": true,
    },
}
body, _ := json.Marshal(payload)

req, _ := http.NewRequest("POST", BASE+"/api/v2/trading/order/create", bytes.NewReader(body))
for k, v := range signedHeaders(string(body)) {
    req.Header.Set(k, v)
}
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
    log.Fatal(err)
}
defer resp.Body.Close()
io.Copy(os.Stdout, resp.Body)
String jsonBody = mapper.writeValueAsString(payload);
HttpResponse<String> resp = client.send(
    signedPost("/api/v2/trading/order/create", jsonBody),
    HttpResponse.BodyHandlers.ofString());
const payload: CreateParentOrderRequest = {
  "client_order_id": "ABC-12345^12-10-23",
  "exchange": "BINANCE",
  "subaccount": "string",
  "symbol": "string",
  "asset_category": "SPOT",
  "side": "BUY",
  "quantity": "string",
  "strategy": "TWAP",
  "limit_price": "2205.10",
  "start_time": "2024-01-22T22:05:00Z",
  "end_time": "2024-04-22T22:05:00Z",
  "clip_size_type": "ABSOLUTE",
  "clip_size_val": "0.01",
  "params": {
    "duration_seconds": "120",
    "trading_style": "PASSIVE",
    "urgency": "LOW",
    "randomize_amount": true,
    "would": {
      "would_price": "string",
      "would_pct": "string",
      "would_style": "PASSIVE",
      "would_is_arrival": true
    },
    "trigger": {
      "trigger_price": "string",
      "trigger_condition": "ABOVE"
    },
    "placement_infos": {
      "placement_mode": "DEFAULT",
      "placement": "string",
      "cancel": "string"
    },
    "reduce_only": true,
    "start_ladder_price": "string",
    "end_ladder_price": "string",
    "ladder_direction": "string",
    "ladder_profile": "string",
    "size_skew": 0.0,
    "ob_imbalance_cancel": true,
    "ob_imbalance_threshold": "0.75",
    "price_lock_bps": "5",
    "post_only": true
  }
};

const res = await fetch(`${BASE}/api/v2/trading/order/create`, {
  method: "POST",
  headers: signedHeaders(payload),
  body: JSON.stringify(payload),
});
const data: OrderSummary = await res.json();
val jsonBody = mapper.writeValueAsString(payload)
val request = signedPost("/api/v2/trading/order/create", jsonBody)
val response = client.send(request, HttpResponse.BodyHandlers.ofString())
println(response.body())
std::string body = R"({
  "client_order_id": "ABC-12345^12-10-23",
  "exchange": "BINANCE",
  "subaccount": "string",
  "symbol": "string",
  "asset_category": "SPOT",
  "side": "BUY",
  "quantity": "string",
  "strategy": "TWAP",
  "limit_price": "2205.10",
  "start_time": "2024-01-22T22:05:00Z",
  "end_time": "2024-04-22T22:05:00Z",
  "clip_size_type": "ABSOLUTE",
  "clip_size_val": "0.01",
  "params": {
    "duration_seconds": "120",
    "trading_style": "PASSIVE",
    "urgency": "LOW",
    "randomize_amount": true,
    "would": {
      "would_price": "string",
      "would_pct": "string",
      "would_style": "PASSIVE",
      "would_is_arrival": true
    },
    "trigger": {
      "trigger_price": "string",
      "trigger_condition": "ABOVE"
    },
    "placement_infos": {
      "placement_mode": "DEFAULT",
      "placement": "string",
      "cancel": "string"
    },
    "reduce_only": true,
    "start_ladder_price": "string",
    "end_ladder_price": "string",
    "ladder_direction": "string",
    "ladder_profile": "string",
    "size_skew": 0.0,
    "ob_imbalance_cancel": true,
    "ob_imbalance_threshold": "0.75",
    "price_lock_bps": "5",
    "post_only": true
  }
})";

cpr::Response r = cpr::Post(
    cpr::Url{BASE + "/api/v2/trading/order/create"},
    signedHeaders(body),
    cpr::Header{{"Content-Type", "application/json"}},
    cpr::Body{body});
std::cout << r.text << std::endl;
const payload = {
  "client_order_id": "ABC-12345^12-10-23",
  "exchange": "BINANCE",
  "subaccount": "string",
  "symbol": "string",
  "asset_category": "SPOT",
  "side": "BUY",
  "quantity": "string",
  "strategy": "TWAP",
  "limit_price": "2205.10",
  "start_time": "2024-01-22T22:05:00Z",
  "end_time": "2024-04-22T22:05:00Z",
  "clip_size_type": "ABSOLUTE",
  "clip_size_val": "0.01",
  "params": {
    "duration_seconds": "120",
    "trading_style": "PASSIVE",
    "urgency": "LOW",
    "randomize_amount": true,
    "would": {
      "would_price": "string",
      "would_pct": "string",
      "would_style": "PASSIVE",
      "would_is_arrival": true
    },
    "trigger": {
      "trigger_price": "string",
      "trigger_condition": "ABOVE"
    },
    "placement_infos": {
      "placement_mode": "DEFAULT",
      "placement": "string",
      "cancel": "string"
    },
    "reduce_only": true,
    "start_ladder_price": "string",
    "end_ladder_price": "string",
    "ladder_direction": "string",
    "ladder_profile": "string",
    "size_skew": 0.0,
    "ob_imbalance_cancel": true,
    "ob_imbalance_threshold": "0.75",
    "price_lock_bps": "5",
    "post_only": true
  }
};

const res = await fetch(`${BASE}/api/v2/trading/order/create`, {
  method: "POST",
  headers: signedHeaders(payload),
  body: JSON.stringify(payload),
});
console.log(await res.json());

Response 201

{
  "order_id": 0,
  "client_order_id": "ABC-12345^12-10-23",
  "status": "PENDING_NEW",
  "created_at": "2024-01-22T22:05:00Z",
  "message": "string",
  "error_code": "OTHER"
}