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 stringA custom string to identify the order
The exchanges available for order placement via the API —
BINANCE, HUOBI, GATEIO, KUCOIN, OKX, BYBIT, BITGET, WOO, … (15 values)subaccount stringThe sub-account under which to trade the order
symbol string requiredThe symbol using Anboto symbology, e.g. BTC/USDT
The Asset category of the order. —
SPOT, FUTUREThe side of the book to trade. —
BUY, SELLquantity string requiredThe quantity to trade as a exchange trade-able decimal value, e.g. 0.015
The execution strategy for the order. —
TWAP, VWAP, ICEBERG, POV, MARKET, LIMIT, IS, SCALElimit_price stringThe exchange valid limit price for the order
start_time stringThe start time in UTC
end_time stringThe end time in UTC
clip_size_type enumThe clip size for the child orders. The default is AUTOMATIC —
ABSOLUTE, PERCENTAGE, AUTOMATIC, ORDER_COUNTclip_size_val stringThe clip size value, required if the type is ABSOLUTE or PERCENTAGE
params OrderParamsThe 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 integerThe Anboto assigned order identifier
client_order_id stringA custom string to identify the order
status enumThe order status —
PENDING_NEW, ACCEPTED, REJECTED, PARTIALLY_FILLED, FILLED, PENDING_CANCEL, CANCELLED, PENDING_PAUSE, … (12 values)created_at date-time requiredThe time in UTC when the order was created
message stringAny additional information, usually if the order was rejected
error_code enumThe 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)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"
}