curl --request POST \
--url https://apimonaco.xyz/api/v1/orders \
--header 'Content-Type: application/json' \
--header 'X-Monaco-Signature: <api-key>' \
--data '
{
"tradingPairId": "afae0e16-2d05-4ee9-9ee8-afae0e162d05",
"orderType": "LIMIT",
"side": "BUY",
"quantity": "0.5",
"price": "35000.00",
"tradingMode": "SPOT",
"slippageToleranceBps": 50,
"useMasterBalance": false,
"expirationDate": "2026-06-01T00:00:00Z",
"timeInForce": "GTC",
"marginAccountId": "123e4567-e89b-12d3-a456-426614174000",
"riskBucketId": "123e4567-e89b-12d3-a456-426614174001",
"riskBucketCollateral": "1000",
"positionSide": "LONG",
"leverage": "5",
"reduceOnly": false,
"takeProfit": {
"triggerPrice": "65000",
"limitPrice": "64950",
"slippageToleranceBps": 1000,
"expiresAt": "2026-06-01T00:00:00Z",
"quantity": "0.5",
"closePosition": true
},
"stopLoss": {
"triggerPrice": "65000",
"limitPrice": "64950",
"slippageToleranceBps": 1000,
"expiresAt": "2026-06-01T00:00:00Z",
"quantity": "0.5",
"closePosition": true
},
"strategyKey": "hedge",
"marginMode": "CROSS",
"postOnly": false,
"clientOrderId": "quote-btc-1130-a",
"idempotencyKey": "<string>",
"selfTradePreventionMode": "CANCEL_TAKER",
"trailingStop": {
"trailBps": 150,
"activationPrice": "66000",
"quantity": "0.5",
"closePosition": true,
"slippageToleranceBps": 1000,
"expiresAt": "2026-06-01T00:00:00Z"
}
}
'import requests
url = "https://apimonaco.xyz/api/v1/orders"
payload = {
"tradingPairId": "afae0e16-2d05-4ee9-9ee8-afae0e162d05",
"orderType": "LIMIT",
"side": "BUY",
"quantity": "0.5",
"price": "35000.00",
"tradingMode": "SPOT",
"slippageToleranceBps": 50,
"useMasterBalance": False,
"expirationDate": "2026-06-01T00:00:00Z",
"timeInForce": "GTC",
"marginAccountId": "123e4567-e89b-12d3-a456-426614174000",
"riskBucketId": "123e4567-e89b-12d3-a456-426614174001",
"riskBucketCollateral": "1000",
"positionSide": "LONG",
"leverage": "5",
"reduceOnly": False,
"takeProfit": {
"triggerPrice": "65000",
"limitPrice": "64950",
"slippageToleranceBps": 1000,
"expiresAt": "2026-06-01T00:00:00Z",
"quantity": "0.5",
"closePosition": True
},
"stopLoss": {
"triggerPrice": "65000",
"limitPrice": "64950",
"slippageToleranceBps": 1000,
"expiresAt": "2026-06-01T00:00:00Z",
"quantity": "0.5",
"closePosition": True
},
"strategyKey": "hedge",
"marginMode": "CROSS",
"postOnly": False,
"clientOrderId": "quote-btc-1130-a",
"idempotencyKey": "<string>",
"selfTradePreventionMode": "CANCEL_TAKER",
"trailingStop": {
"trailBps": 150,
"activationPrice": "66000",
"quantity": "0.5",
"closePosition": True,
"slippageToleranceBps": 1000,
"expiresAt": "2026-06-01T00:00:00Z"
}
}
headers = {
"X-Monaco-Signature": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Monaco-Signature': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
tradingPairId: 'afae0e16-2d05-4ee9-9ee8-afae0e162d05',
orderType: 'LIMIT',
side: 'BUY',
quantity: '0.5',
price: '35000.00',
tradingMode: 'SPOT',
slippageToleranceBps: 50,
useMasterBalance: false,
expirationDate: '2026-06-01T00:00:00Z',
timeInForce: 'GTC',
marginAccountId: '123e4567-e89b-12d3-a456-426614174000',
riskBucketId: '123e4567-e89b-12d3-a456-426614174001',
riskBucketCollateral: '1000',
positionSide: 'LONG',
leverage: '5',
reduceOnly: false,
takeProfit: {
triggerPrice: '65000',
limitPrice: '64950',
slippageToleranceBps: 1000,
expiresAt: '2026-06-01T00:00:00Z',
quantity: '0.5',
closePosition: true
},
stopLoss: {
triggerPrice: '65000',
limitPrice: '64950',
slippageToleranceBps: 1000,
expiresAt: '2026-06-01T00:00:00Z',
quantity: '0.5',
closePosition: true
},
strategyKey: 'hedge',
marginMode: 'CROSS',
postOnly: false,
clientOrderId: 'quote-btc-1130-a',
idempotencyKey: '<string>',
selfTradePreventionMode: 'CANCEL_TAKER',
trailingStop: {
trailBps: 150,
activationPrice: '66000',
quantity: '0.5',
closePosition: true,
slippageToleranceBps: 1000,
expiresAt: '2026-06-01T00:00:00Z'
}
})
};
fetch('https://apimonaco.xyz/api/v1/orders', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://apimonaco.xyz/api/v1/orders",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'tradingPairId' => 'afae0e16-2d05-4ee9-9ee8-afae0e162d05',
'orderType' => 'LIMIT',
'side' => 'BUY',
'quantity' => '0.5',
'price' => '35000.00',
'tradingMode' => 'SPOT',
'slippageToleranceBps' => 50,
'useMasterBalance' => false,
'expirationDate' => '2026-06-01T00:00:00Z',
'timeInForce' => 'GTC',
'marginAccountId' => '123e4567-e89b-12d3-a456-426614174000',
'riskBucketId' => '123e4567-e89b-12d3-a456-426614174001',
'riskBucketCollateral' => '1000',
'positionSide' => 'LONG',
'leverage' => '5',
'reduceOnly' => false,
'takeProfit' => [
'triggerPrice' => '65000',
'limitPrice' => '64950',
'slippageToleranceBps' => 1000,
'expiresAt' => '2026-06-01T00:00:00Z',
'quantity' => '0.5',
'closePosition' => true
],
'stopLoss' => [
'triggerPrice' => '65000',
'limitPrice' => '64950',
'slippageToleranceBps' => 1000,
'expiresAt' => '2026-06-01T00:00:00Z',
'quantity' => '0.5',
'closePosition' => true
],
'strategyKey' => 'hedge',
'marginMode' => 'CROSS',
'postOnly' => false,
'clientOrderId' => 'quote-btc-1130-a',
'idempotencyKey' => '<string>',
'selfTradePreventionMode' => 'CANCEL_TAKER',
'trailingStop' => [
'trailBps' => 150,
'activationPrice' => '66000',
'quantity' => '0.5',
'closePosition' => true,
'slippageToleranceBps' => 1000,
'expiresAt' => '2026-06-01T00:00:00Z'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Monaco-Signature: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://apimonaco.xyz/api/v1/orders"
payload := strings.NewReader("{\n \"tradingPairId\": \"afae0e16-2d05-4ee9-9ee8-afae0e162d05\",\n \"orderType\": \"LIMIT\",\n \"side\": \"BUY\",\n \"quantity\": \"0.5\",\n \"price\": \"35000.00\",\n \"tradingMode\": \"SPOT\",\n \"slippageToleranceBps\": 50,\n \"useMasterBalance\": false,\n \"expirationDate\": \"2026-06-01T00:00:00Z\",\n \"timeInForce\": \"GTC\",\n \"marginAccountId\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"riskBucketId\": \"123e4567-e89b-12d3-a456-426614174001\",\n \"riskBucketCollateral\": \"1000\",\n \"positionSide\": \"LONG\",\n \"leverage\": \"5\",\n \"reduceOnly\": false,\n \"takeProfit\": {\n \"triggerPrice\": \"65000\",\n \"limitPrice\": \"64950\",\n \"slippageToleranceBps\": 1000,\n \"expiresAt\": \"2026-06-01T00:00:00Z\",\n \"quantity\": \"0.5\",\n \"closePosition\": true\n },\n \"stopLoss\": {\n \"triggerPrice\": \"65000\",\n \"limitPrice\": \"64950\",\n \"slippageToleranceBps\": 1000,\n \"expiresAt\": \"2026-06-01T00:00:00Z\",\n \"quantity\": \"0.5\",\n \"closePosition\": true\n },\n \"strategyKey\": \"hedge\",\n \"marginMode\": \"CROSS\",\n \"postOnly\": false,\n \"clientOrderId\": \"quote-btc-1130-a\",\n \"idempotencyKey\": \"<string>\",\n \"selfTradePreventionMode\": \"CANCEL_TAKER\",\n \"trailingStop\": {\n \"trailBps\": 150,\n \"activationPrice\": \"66000\",\n \"quantity\": \"0.5\",\n \"closePosition\": true,\n \"slippageToleranceBps\": 1000,\n \"expiresAt\": \"2026-06-01T00:00:00Z\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Monaco-Signature", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://apimonaco.xyz/api/v1/orders")
.header("X-Monaco-Signature", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"tradingPairId\": \"afae0e16-2d05-4ee9-9ee8-afae0e162d05\",\n \"orderType\": \"LIMIT\",\n \"side\": \"BUY\",\n \"quantity\": \"0.5\",\n \"price\": \"35000.00\",\n \"tradingMode\": \"SPOT\",\n \"slippageToleranceBps\": 50,\n \"useMasterBalance\": false,\n \"expirationDate\": \"2026-06-01T00:00:00Z\",\n \"timeInForce\": \"GTC\",\n \"marginAccountId\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"riskBucketId\": \"123e4567-e89b-12d3-a456-426614174001\",\n \"riskBucketCollateral\": \"1000\",\n \"positionSide\": \"LONG\",\n \"leverage\": \"5\",\n \"reduceOnly\": false,\n \"takeProfit\": {\n \"triggerPrice\": \"65000\",\n \"limitPrice\": \"64950\",\n \"slippageToleranceBps\": 1000,\n \"expiresAt\": \"2026-06-01T00:00:00Z\",\n \"quantity\": \"0.5\",\n \"closePosition\": true\n },\n \"stopLoss\": {\n \"triggerPrice\": \"65000\",\n \"limitPrice\": \"64950\",\n \"slippageToleranceBps\": 1000,\n \"expiresAt\": \"2026-06-01T00:00:00Z\",\n \"quantity\": \"0.5\",\n \"closePosition\": true\n },\n \"strategyKey\": \"hedge\",\n \"marginMode\": \"CROSS\",\n \"postOnly\": false,\n \"clientOrderId\": \"quote-btc-1130-a\",\n \"idempotencyKey\": \"<string>\",\n \"selfTradePreventionMode\": \"CANCEL_TAKER\",\n \"trailingStop\": {\n \"trailBps\": 150,\n \"activationPrice\": \"66000\",\n \"quantity\": \"0.5\",\n \"closePosition\": true,\n \"slippageToleranceBps\": 1000,\n \"expiresAt\": \"2026-06-01T00:00:00Z\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apimonaco.xyz/api/v1/orders")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Monaco-Signature"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"tradingPairId\": \"afae0e16-2d05-4ee9-9ee8-afae0e162d05\",\n \"orderType\": \"LIMIT\",\n \"side\": \"BUY\",\n \"quantity\": \"0.5\",\n \"price\": \"35000.00\",\n \"tradingMode\": \"SPOT\",\n \"slippageToleranceBps\": 50,\n \"useMasterBalance\": false,\n \"expirationDate\": \"2026-06-01T00:00:00Z\",\n \"timeInForce\": \"GTC\",\n \"marginAccountId\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"riskBucketId\": \"123e4567-e89b-12d3-a456-426614174001\",\n \"riskBucketCollateral\": \"1000\",\n \"positionSide\": \"LONG\",\n \"leverage\": \"5\",\n \"reduceOnly\": false,\n \"takeProfit\": {\n \"triggerPrice\": \"65000\",\n \"limitPrice\": \"64950\",\n \"slippageToleranceBps\": 1000,\n \"expiresAt\": \"2026-06-01T00:00:00Z\",\n \"quantity\": \"0.5\",\n \"closePosition\": true\n },\n \"stopLoss\": {\n \"triggerPrice\": \"65000\",\n \"limitPrice\": \"64950\",\n \"slippageToleranceBps\": 1000,\n \"expiresAt\": \"2026-06-01T00:00:00Z\",\n \"quantity\": \"0.5\",\n \"closePosition\": true\n },\n \"strategyKey\": \"hedge\",\n \"marginMode\": \"CROSS\",\n \"postOnly\": false,\n \"clientOrderId\": \"quote-btc-1130-a\",\n \"idempotencyKey\": \"<string>\",\n \"selfTradePreventionMode\": \"CANCEL_TAKER\",\n \"trailingStop\": {\n \"trailBps\": 150,\n \"activationPrice\": \"66000\",\n \"quantity\": \"0.5\",\n \"closePosition\": true,\n \"slippageToleranceBps\": 1000,\n \"expiresAt\": \"2026-06-01T00:00:00Z\"\n }\n}"
response = http.request(request)
puts response.read_body{
"orderId": "123e4567-e89b-12d3-a456-426614174000",
"status": "SUCCESS",
"message": "Order created successfully",
"matchResult": {
"tradesCount": 2,
"totalFilled": "0.2",
"remainingQuantity": "0.3",
"averageFillPrice": "35100.00",
"status": "PARTIALLY_FILLED",
"actualSlippageBps": 15,
"maxSlippageBps": 50,
"executionPriceRange": {
"bestPrice": "2045.00",
"worstPrice": "2052.00"
}
},
"takeProfitOrderId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"stopLossOrderId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"marginAccountId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"riskBucketId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"strategyKey": "<string>",
"delegationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"trailingStopOrderId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}Create new order
Create new order.
Create a new order and process it through the matching engine. The order will be matched against existing orders in the orderbook.
curl --request POST \
--url https://apimonaco.xyz/api/v1/orders \
--header 'Content-Type: application/json' \
--header 'X-Monaco-Signature: <api-key>' \
--data '
{
"tradingPairId": "afae0e16-2d05-4ee9-9ee8-afae0e162d05",
"orderType": "LIMIT",
"side": "BUY",
"quantity": "0.5",
"price": "35000.00",
"tradingMode": "SPOT",
"slippageToleranceBps": 50,
"useMasterBalance": false,
"expirationDate": "2026-06-01T00:00:00Z",
"timeInForce": "GTC",
"marginAccountId": "123e4567-e89b-12d3-a456-426614174000",
"riskBucketId": "123e4567-e89b-12d3-a456-426614174001",
"riskBucketCollateral": "1000",
"positionSide": "LONG",
"leverage": "5",
"reduceOnly": false,
"takeProfit": {
"triggerPrice": "65000",
"limitPrice": "64950",
"slippageToleranceBps": 1000,
"expiresAt": "2026-06-01T00:00:00Z",
"quantity": "0.5",
"closePosition": true
},
"stopLoss": {
"triggerPrice": "65000",
"limitPrice": "64950",
"slippageToleranceBps": 1000,
"expiresAt": "2026-06-01T00:00:00Z",
"quantity": "0.5",
"closePosition": true
},
"strategyKey": "hedge",
"marginMode": "CROSS",
"postOnly": false,
"clientOrderId": "quote-btc-1130-a",
"idempotencyKey": "<string>",
"selfTradePreventionMode": "CANCEL_TAKER",
"trailingStop": {
"trailBps": 150,
"activationPrice": "66000",
"quantity": "0.5",
"closePosition": true,
"slippageToleranceBps": 1000,
"expiresAt": "2026-06-01T00:00:00Z"
}
}
'import requests
url = "https://apimonaco.xyz/api/v1/orders"
payload = {
"tradingPairId": "afae0e16-2d05-4ee9-9ee8-afae0e162d05",
"orderType": "LIMIT",
"side": "BUY",
"quantity": "0.5",
"price": "35000.00",
"tradingMode": "SPOT",
"slippageToleranceBps": 50,
"useMasterBalance": False,
"expirationDate": "2026-06-01T00:00:00Z",
"timeInForce": "GTC",
"marginAccountId": "123e4567-e89b-12d3-a456-426614174000",
"riskBucketId": "123e4567-e89b-12d3-a456-426614174001",
"riskBucketCollateral": "1000",
"positionSide": "LONG",
"leverage": "5",
"reduceOnly": False,
"takeProfit": {
"triggerPrice": "65000",
"limitPrice": "64950",
"slippageToleranceBps": 1000,
"expiresAt": "2026-06-01T00:00:00Z",
"quantity": "0.5",
"closePosition": True
},
"stopLoss": {
"triggerPrice": "65000",
"limitPrice": "64950",
"slippageToleranceBps": 1000,
"expiresAt": "2026-06-01T00:00:00Z",
"quantity": "0.5",
"closePosition": True
},
"strategyKey": "hedge",
"marginMode": "CROSS",
"postOnly": False,
"clientOrderId": "quote-btc-1130-a",
"idempotencyKey": "<string>",
"selfTradePreventionMode": "CANCEL_TAKER",
"trailingStop": {
"trailBps": 150,
"activationPrice": "66000",
"quantity": "0.5",
"closePosition": True,
"slippageToleranceBps": 1000,
"expiresAt": "2026-06-01T00:00:00Z"
}
}
headers = {
"X-Monaco-Signature": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Monaco-Signature': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
tradingPairId: 'afae0e16-2d05-4ee9-9ee8-afae0e162d05',
orderType: 'LIMIT',
side: 'BUY',
quantity: '0.5',
price: '35000.00',
tradingMode: 'SPOT',
slippageToleranceBps: 50,
useMasterBalance: false,
expirationDate: '2026-06-01T00:00:00Z',
timeInForce: 'GTC',
marginAccountId: '123e4567-e89b-12d3-a456-426614174000',
riskBucketId: '123e4567-e89b-12d3-a456-426614174001',
riskBucketCollateral: '1000',
positionSide: 'LONG',
leverage: '5',
reduceOnly: false,
takeProfit: {
triggerPrice: '65000',
limitPrice: '64950',
slippageToleranceBps: 1000,
expiresAt: '2026-06-01T00:00:00Z',
quantity: '0.5',
closePosition: true
},
stopLoss: {
triggerPrice: '65000',
limitPrice: '64950',
slippageToleranceBps: 1000,
expiresAt: '2026-06-01T00:00:00Z',
quantity: '0.5',
closePosition: true
},
strategyKey: 'hedge',
marginMode: 'CROSS',
postOnly: false,
clientOrderId: 'quote-btc-1130-a',
idempotencyKey: '<string>',
selfTradePreventionMode: 'CANCEL_TAKER',
trailingStop: {
trailBps: 150,
activationPrice: '66000',
quantity: '0.5',
closePosition: true,
slippageToleranceBps: 1000,
expiresAt: '2026-06-01T00:00:00Z'
}
})
};
fetch('https://apimonaco.xyz/api/v1/orders', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://apimonaco.xyz/api/v1/orders",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'tradingPairId' => 'afae0e16-2d05-4ee9-9ee8-afae0e162d05',
'orderType' => 'LIMIT',
'side' => 'BUY',
'quantity' => '0.5',
'price' => '35000.00',
'tradingMode' => 'SPOT',
'slippageToleranceBps' => 50,
'useMasterBalance' => false,
'expirationDate' => '2026-06-01T00:00:00Z',
'timeInForce' => 'GTC',
'marginAccountId' => '123e4567-e89b-12d3-a456-426614174000',
'riskBucketId' => '123e4567-e89b-12d3-a456-426614174001',
'riskBucketCollateral' => '1000',
'positionSide' => 'LONG',
'leverage' => '5',
'reduceOnly' => false,
'takeProfit' => [
'triggerPrice' => '65000',
'limitPrice' => '64950',
'slippageToleranceBps' => 1000,
'expiresAt' => '2026-06-01T00:00:00Z',
'quantity' => '0.5',
'closePosition' => true
],
'stopLoss' => [
'triggerPrice' => '65000',
'limitPrice' => '64950',
'slippageToleranceBps' => 1000,
'expiresAt' => '2026-06-01T00:00:00Z',
'quantity' => '0.5',
'closePosition' => true
],
'strategyKey' => 'hedge',
'marginMode' => 'CROSS',
'postOnly' => false,
'clientOrderId' => 'quote-btc-1130-a',
'idempotencyKey' => '<string>',
'selfTradePreventionMode' => 'CANCEL_TAKER',
'trailingStop' => [
'trailBps' => 150,
'activationPrice' => '66000',
'quantity' => '0.5',
'closePosition' => true,
'slippageToleranceBps' => 1000,
'expiresAt' => '2026-06-01T00:00:00Z'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Monaco-Signature: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://apimonaco.xyz/api/v1/orders"
payload := strings.NewReader("{\n \"tradingPairId\": \"afae0e16-2d05-4ee9-9ee8-afae0e162d05\",\n \"orderType\": \"LIMIT\",\n \"side\": \"BUY\",\n \"quantity\": \"0.5\",\n \"price\": \"35000.00\",\n \"tradingMode\": \"SPOT\",\n \"slippageToleranceBps\": 50,\n \"useMasterBalance\": false,\n \"expirationDate\": \"2026-06-01T00:00:00Z\",\n \"timeInForce\": \"GTC\",\n \"marginAccountId\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"riskBucketId\": \"123e4567-e89b-12d3-a456-426614174001\",\n \"riskBucketCollateral\": \"1000\",\n \"positionSide\": \"LONG\",\n \"leverage\": \"5\",\n \"reduceOnly\": false,\n \"takeProfit\": {\n \"triggerPrice\": \"65000\",\n \"limitPrice\": \"64950\",\n \"slippageToleranceBps\": 1000,\n \"expiresAt\": \"2026-06-01T00:00:00Z\",\n \"quantity\": \"0.5\",\n \"closePosition\": true\n },\n \"stopLoss\": {\n \"triggerPrice\": \"65000\",\n \"limitPrice\": \"64950\",\n \"slippageToleranceBps\": 1000,\n \"expiresAt\": \"2026-06-01T00:00:00Z\",\n \"quantity\": \"0.5\",\n \"closePosition\": true\n },\n \"strategyKey\": \"hedge\",\n \"marginMode\": \"CROSS\",\n \"postOnly\": false,\n \"clientOrderId\": \"quote-btc-1130-a\",\n \"idempotencyKey\": \"<string>\",\n \"selfTradePreventionMode\": \"CANCEL_TAKER\",\n \"trailingStop\": {\n \"trailBps\": 150,\n \"activationPrice\": \"66000\",\n \"quantity\": \"0.5\",\n \"closePosition\": true,\n \"slippageToleranceBps\": 1000,\n \"expiresAt\": \"2026-06-01T00:00:00Z\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Monaco-Signature", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://apimonaco.xyz/api/v1/orders")
.header("X-Monaco-Signature", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"tradingPairId\": \"afae0e16-2d05-4ee9-9ee8-afae0e162d05\",\n \"orderType\": \"LIMIT\",\n \"side\": \"BUY\",\n \"quantity\": \"0.5\",\n \"price\": \"35000.00\",\n \"tradingMode\": \"SPOT\",\n \"slippageToleranceBps\": 50,\n \"useMasterBalance\": false,\n \"expirationDate\": \"2026-06-01T00:00:00Z\",\n \"timeInForce\": \"GTC\",\n \"marginAccountId\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"riskBucketId\": \"123e4567-e89b-12d3-a456-426614174001\",\n \"riskBucketCollateral\": \"1000\",\n \"positionSide\": \"LONG\",\n \"leverage\": \"5\",\n \"reduceOnly\": false,\n \"takeProfit\": {\n \"triggerPrice\": \"65000\",\n \"limitPrice\": \"64950\",\n \"slippageToleranceBps\": 1000,\n \"expiresAt\": \"2026-06-01T00:00:00Z\",\n \"quantity\": \"0.5\",\n \"closePosition\": true\n },\n \"stopLoss\": {\n \"triggerPrice\": \"65000\",\n \"limitPrice\": \"64950\",\n \"slippageToleranceBps\": 1000,\n \"expiresAt\": \"2026-06-01T00:00:00Z\",\n \"quantity\": \"0.5\",\n \"closePosition\": true\n },\n \"strategyKey\": \"hedge\",\n \"marginMode\": \"CROSS\",\n \"postOnly\": false,\n \"clientOrderId\": \"quote-btc-1130-a\",\n \"idempotencyKey\": \"<string>\",\n \"selfTradePreventionMode\": \"CANCEL_TAKER\",\n \"trailingStop\": {\n \"trailBps\": 150,\n \"activationPrice\": \"66000\",\n \"quantity\": \"0.5\",\n \"closePosition\": true,\n \"slippageToleranceBps\": 1000,\n \"expiresAt\": \"2026-06-01T00:00:00Z\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apimonaco.xyz/api/v1/orders")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Monaco-Signature"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"tradingPairId\": \"afae0e16-2d05-4ee9-9ee8-afae0e162d05\",\n \"orderType\": \"LIMIT\",\n \"side\": \"BUY\",\n \"quantity\": \"0.5\",\n \"price\": \"35000.00\",\n \"tradingMode\": \"SPOT\",\n \"slippageToleranceBps\": 50,\n \"useMasterBalance\": false,\n \"expirationDate\": \"2026-06-01T00:00:00Z\",\n \"timeInForce\": \"GTC\",\n \"marginAccountId\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"riskBucketId\": \"123e4567-e89b-12d3-a456-426614174001\",\n \"riskBucketCollateral\": \"1000\",\n \"positionSide\": \"LONG\",\n \"leverage\": \"5\",\n \"reduceOnly\": false,\n \"takeProfit\": {\n \"triggerPrice\": \"65000\",\n \"limitPrice\": \"64950\",\n \"slippageToleranceBps\": 1000,\n \"expiresAt\": \"2026-06-01T00:00:00Z\",\n \"quantity\": \"0.5\",\n \"closePosition\": true\n },\n \"stopLoss\": {\n \"triggerPrice\": \"65000\",\n \"limitPrice\": \"64950\",\n \"slippageToleranceBps\": 1000,\n \"expiresAt\": \"2026-06-01T00:00:00Z\",\n \"quantity\": \"0.5\",\n \"closePosition\": true\n },\n \"strategyKey\": \"hedge\",\n \"marginMode\": \"CROSS\",\n \"postOnly\": false,\n \"clientOrderId\": \"quote-btc-1130-a\",\n \"idempotencyKey\": \"<string>\",\n \"selfTradePreventionMode\": \"CANCEL_TAKER\",\n \"trailingStop\": {\n \"trailBps\": 150,\n \"activationPrice\": \"66000\",\n \"quantity\": \"0.5\",\n \"closePosition\": true,\n \"slippageToleranceBps\": 1000,\n \"expiresAt\": \"2026-06-01T00:00:00Z\"\n }\n}"
response = http.request(request)
puts response.read_body{
"orderId": "123e4567-e89b-12d3-a456-426614174000",
"status": "SUCCESS",
"message": "Order created successfully",
"matchResult": {
"tradesCount": 2,
"totalFilled": "0.2",
"remainingQuantity": "0.3",
"averageFillPrice": "35100.00",
"status": "PARTIALLY_FILLED",
"actualSlippageBps": 15,
"maxSlippageBps": 50,
"executionPriceRange": {
"bestPrice": "2045.00",
"worstPrice": "2052.00"
}
},
"takeProfitOrderId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"stopLossOrderId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"marginAccountId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"riskBucketId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"strategyKey": "<string>",
"delegationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"trailingStopOrderId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}Authorizations
Ed25519 session-key request signing. Every authenticated request carries three headers: X-Monaco-PublicKey (64-char lowercase-hex session public key), X-Monaco-Timestamp (Unix milliseconds, within 30s of server time), and X-Monaco-Signature (hex ed25519 signature). The signature is over METHOD\npath?query\ntimestamp_ms\nSHA256_hex(body), where the body hash is the SHA-256 of the empty byte string when there is no body. Obtain the session keypair from POST /api/v1/auth/challenge followed by POST /api/v1/auth/verify.
Body
Decimal collateral allocated as an order budget in a new isolated risk bucket. Fills commit their required margin and paid-fee funding to position backing; unfilled or unused order funds do not protect the position from liquidation. Use position margin adjustment to add liquidation protection. The API creates the bucket ID and the matching engine persists it through the durable log.
"1000"
Sub-account key of the margin account the order trades on, like marginAccountId (default is the default margin account). Refused when it is not a valid sub-account key or disagrees with marginAccountId; a key naming none of the caller's open sub-accounts is refused by the matching engine.
"hedge"
Risk bucket mode for margin orders. Defaults to ISOLATED. Values: ISOLATED, CROSS. On an isolated-only market (TradingPairData.isolated_only) a CROSS order that is not reduce-only is rejected with HTTP 400 / gRPC INVALID_ARGUMENT carrying the structured error code CROSS_MARGIN_NOT_ALLOWED. One margin mode per market and margin account: while the account holds the pair in its other risk bucket (an open position, or a resting order that is not reduce-only), an order that is not reduce-only is rejected with HTTP 400 / gRPC INVALID_ARGUMENT carrying the structured error code MARGIN_MODE_CONFLICT; reduce-only orders always pass, so a pair already held in both modes can be reduced on either side until one closes.
ISOLATED, CROSS "CROSS"
Post-only: reject instead of matching if this limit order would cross the book — rejected with HTTP 400 / gRPC INVALID_ARGUMENT carrying the structured error code POST_ONLY_WOULD_CROSS (REST error-envelope 'code' field; gRPC google.rpc.ErrorInfo reason; batch per-item error.code). Matching the 'post-only order would cross' message substring is a legacy fallback. LIMIT orders with GTC only; rejected on MARKET orders and IOC/FOK.
false
Client-assigned correlation handle, echoed back on order reads (detail and list) and on order WebSocket events. At most 64 characters from [A-Za-z0-9._:-]; surrounding whitespace is trimmed before storage, and a blank or whitespace-only value is treated as absent. Uniqueness is enforced only among your orders that are RESTING on the book: a create or replace reusing a value another of your resting orders still holds is rejected with HTTP 409 / gRPC ALREADY_EXISTS and the code CLIENT_ORDER_ID_CONFLICT. An order that never rests — MARKET, IOC/FOK, or a LIMIT that fills completely on arrival — does not take the handle, and the value is released the moment any order reaches a terminal state. It is therefore NOT an idempotency key: resubmitting after a lost response can execute a second time. Reconcile a lost response against the order WebSocket stream, which carries this value on the submit acknowledgement and on fills, including for orders that never rest; order history is replica-backed and can omit an order that did land. The stream is not replayable and has no sequence number to backfill from, and events are not persisted for redelivery, so one can be missed while your connection still looks healthy. A matching event is therefore positive proof the order was accepted, but silence is NEVER evidence it was not, and no client-observable condition makes it so. Absent positive evidence the outcome is unresolved: hold and escalate rather than resubmitting. Rejections split in two: one rejected before acceptance (malformed, post-only would cross, handle conflict, a plain MARKET submit with no liquidity, rejected during pricing) fails the request, emits no event and is never written to order history (an order rejected AFTER acceptance is persisted with status REJECTED, so only the pre-acceptance class is absent); an accepted LIMIT with IOC or FOK that cannot fill, or an accepted MARKET order whose apparent liquidity is invalidated by maker-risk revalidation, returns 2xx with matchResult.status REJECTED and emits OrderPlaced then OrderRejected, both carrying this value. A 2xx therefore does not mean the order executed. Where no surface is conclusive, do not resubmit.
"quote-btc-1130-a"
Optional submission identity, distinct from clientOrderId. Use 1-64 characters from [A-Za-z0-9._:-], without whitespace. Scoped to your authenticated user/subaccount and application, shared by create and batch-create items. Retrying the same key and normalized order payload within 15 minutes of the original acceptance returns the original committed submission result, even after a fill or cancellation, without executing again. A full response cache does not prevent new keyed submissions: durable responses may be evicted while exact key history remains retained. If response capacity is protected by pending durability or persistence, a new key is refused with ORDER_SUBMISSION_CAPACITY_EXCEEDED. A retry whose original response cannot currently be retrieved returns ORDER_SUBMISSION_UNAVAILABLE and never executes again. Both are HTTP 503 / gRPC UNAVAILABLE, or per-item errors in batches. Retry the same key and payload; for previously accepted keys, stay within 15 minutes of the original acceptance. A capacity refusal does not accept or reserve a new key. Different payload returns IDEMPOTENCY_KEY_CONFLICT (HTTP 409 / gRPC ALREADY_EXISTS; per-item error in batches). Validation failures before acceptance do not reserve the key. The window does not extend on retries; after it expires the key may execute a new order, so never retry an unresolved submission after 15 minutes. Generate a fresh key for each intended new order and retain it across transport retries. Without a key, a timeout or 5xx leaves the outcome unknown and must not be blindly retried.
1 - 64^[A-Za-z0-9._:-]+$Per-order self-trade-prevention override: how the engine resolves this order matching against one of your own resting orders (your whole wallet family, subaccounts included; the incoming order's mode governs the step and resting orders' modes are never consulted). CANCEL_MAKER cancels each of your resting orders encountered and keeps matching. CANCEL_TAKER fills third-party liquidity up to the first self-touch, then cancels the incoming order's remainder — a zero-fill CANCELLED outcome is possible. CANCEL_BOTH additionally cancels the encountered resting orders. SKIP trades around your resting orders; a remainder that would rest crossing one of your surviving orders is cancelled instead of resting. Omitted, your wallet's configured default applies, else the platform default CANCEL_MAKER. STP cancellations carry terminalReason SELF_TRADE_PREVENTION and stpCounterpartyOrderId on reads and WebSocket events. With time_in_force FOK: CANCEL_MAKER cancels your makers first and then fills or kills; CANCEL_TAKER and SKIP cancel the whole order when self is in the fill path; CANCEL_BOTH rejects the placement with SELF_TRADE_NOT_ALLOWED. The requested value is echoed back as selfTradePreventionMode on order reads, absent when omitted here.
CANCEL_MAKER, CANCEL_TAKER, CANCEL_BOTH, SKIP "CANCEL_TAKER"
Response
OK
Was this page helpful?

