Coinlocally Docs
API Document
API Document
  • Introduction
    • API Basic Information
    • HTTP Error Codes
    • General Information
    • Limits
    • Endpoint Security Type
    • Signature Authentication
    • Timing Security
    • SIGNED Endpoint Example
  • Changelog
  • Spot
    • Public
    • Market
    • Trade
    • Account
  • Futures
    • Public
    • Market
    • Trade
    • Account
  • Margin
  • Withdraw
  • WebSocket
    • Spot
    • Futures
  • Official SDK
  • Enums
  • Error
  • FAQ
Powered by GitBook
On this page
  1. Spot

Trade

PreviousMarketNextAccount

Last updated 17 days ago

Query Order

get

Retrieve the details of a specific order.

Weight: 1 (IP/UID)

Query parameters
orderIdstringRequired

System-generated Order ID

newClientorderIdstringOptional

Client-generated Order ID (optional)

symbolstringRequired

Trading pair symbol, e.g., BTCUSDT

Header parameters
X-CH-APIKEYstringRequired

Your API key

X-CH-TSstringRequired

Timestamp of the request

X-CH-SIGNstringRequired

Request signature

Responses
200
Successfully retrieved order information.
application/json
get
GET /sapi/v2/order HTTP/1.1
Host: openapi.coinlocally.com
X-CH-APIKEY: text
X-CH-TS: text
X-CH-SIGN: text
Accept: */*
200

Successfully retrieved order information.

{
  "orderId": "499890200602846976",
  "clientOrderId": "157432755564968",
  "symbol": "BHTUSDT",
  "price": "0.01",
  "origQty": "50",
  "executedQty": "0",
  "avgPrice": "0",
  "status": "NEW",
  "type": "LIMIT",
  "side": "BUY",
  "transactTime": "1574327555669"
}

Current Open Orders

get

Retrieve all currently open orders for a symbol. If symbol is not provided, orders for all symbols will be returned.

Weight: 1 (IP/UID)Symbol not provided: Weight = 80

Query parameters
symbolstringOptional

Symbol name, e.g., BTCUSDT.

Weight (IP/UID):

  • If symbol is provided: 1
  • If symbol is not provided: 80
limitinteger · max: 1000Optional

Number of orders to return (max 1000)

Default: 100
Header parameters
X-CH-APIKEYstringRequired

Your API key

X-CH-TSstringRequired

Timestamp of the request

X-CH-SIGNstringRequired

Request signature

Responses
200
Successfully retrieved list of open orders.
application/json
get
GET /sapi/v2/openOrders HTTP/1.1
Host: openapi.coinlocally.com
X-CH-APIKEY: text
X-CH-TS: text
X-CH-SIGN: text
Accept: */*
200

Successfully retrieved list of open orders.

[
  {
    "orderId": 499902955766523650,
    "orderIdString": "499902955766523648",
    "symbol": "BHTUSDT",
    "price": "0.01",
    "origQty": "50",
    "executedQty": "0",
    "avgPrice": "0",
    "status": "NEW",
    "type": "LIMIT",
    "side": "BUY",
    "time": "1574329076202",
    "stopPrice": 123321,
    "isWorking": true
  }
]

History Orders

get

Retrieve historical orders for an account.

Query parameters
symbolstringOptional

Symbol name, e.g., BTCUSDT.

Weight (IP/UID): 20

  • If symbol is not provided: weight = 80
limitinteger · max: 100Optional

Max number of results (default: 50, max: 100)

Default: 50
startTimeintegerOptional

Start time in milliseconds

endTimeintegerOptional

End time in milliseconds

Header parameters
X-CH-APIKEYstringRequired

Your API key

X-CH-TSstringRequired

Timestamp of the request

X-CH-SIGNstringRequired

Request signature

Responses
200
Successfully retrieved historical orders.
application/json
get
GET /sapi/v3/historyOrders HTTP/1.1
Host: openapi.coinlocally.com
X-CH-APIKEY: text
X-CH-TS: text
X-CH-SIGN: text
Accept: */*
200

Successfully retrieved historical orders.

[
  {
    "orderId": 499902955766523650,
    "orderIdString": "499902955766523648",
    "symbol": "BHTUSDT",
    "price": "0.01",
    "origQty": "50",
    "executedQty": "0",
    "avgPrice": "0",
    "status": "NEW",
    "type": "LIMIT",
    "side": "BUY",
    "time": "1574329076202",
    "stopPrice": 123321,
    "isWorking": true
  }
]

Account Trade List

get

Get historical trade data.

Weight: 20 (IP/UID)Symbol not provided: Weight = 80

Supports up to 6 months of data. Time range between startTime and endTime must not exceed 7 days.

Query parameters
symbolstringOptional

Symbol name, e.g., BTCUSDT.

Rate Limit Weight (IP/UID):

  • Single symbol query: weight = 20
  • Symbol not provided: weight = 80
limitinteger · max: 100Optional

Max number of results (default: 50, max: 100)

Default: 50
startTimeintegerOptional

Start time in milliseconds

endTimeintegerOptional

End time in milliseconds

Header parameters
X-CH-APIKEYstringRequired

Your API key

X-CH-TSstringRequired

Timestamp of the request

X-CH-SIGNstringRequired

Request signature

Responses
200
Successfully retrieved trade history.
application/json
get
GET /sapi/v3/myTrades HTTP/1.1
Host: openapi.coinlocally.com
X-CH-APIKEY: text
X-CH-TS: text
X-CH-SIGN: text
Accept: */*
200

Successfully retrieved trade history.

[
  {
    "symbol": "ETH/BTC",
    "id": 100211,
    "bidId": 150695552109032480,
    "askId": 150695552109032480,
    "price": "4.00000100",
    "qty": "12.00000000",
    "time": 1499865549590,
    "isBuyer": true,
    "isMaker": false,
    "feeCoin": "ETH",
    "fee": "0.001",
    "bidUserId": 23334,
    "askUserId": 44112,
    "isSelf": true
  }
]
  • POSTNew Order
  • POSTTest New Order
  • POSTBatch Orders
  • GETQuery Order
  • POSTCancel Order
  • POSTBatch Cancel Orders
  • GETCurrent Open Orders
  • GETHistory Orders
  • GETAccount Trade List

New Order

post

Place a new order.

Rate Limit: 100 requests per 2 seconds

Weight: 5 (IP/UID)

Header parameters
X-CH-APIKEYstringRequired

Your API-key

X-CH-TSintegerRequired

Timestamp in milliseconds

X-CH-SIGNstringRequired

Signature of the request

Body
symbolstringRequiredExample: BTCUSDT
volumenumberRequiredExample: 1.5
sidestring · enumRequiredPossible values:
typestring · enumRequiredPossible values:
pricenumberRequiredExample: 9500.5
newClientOrderIdstringOptionalExample: myCustomOrderId123
recvwindowintegerOptionalExample: 5000
triggerPricenumberOptionalExample: 9600
Responses
200
Order successfully placed.
application/json
post
POST /sapi/v2/order HTTP/1.1
Host: openapi.coinlocally.com
X-CH-APIKEY: text
X-CH-TS: 1
X-CH-SIGN: text
Content-Type: application/json
Accept: */*
Content-Length: 154

{
  "symbol": "BTCUSDT",
  "volume": 1.5,
  "side": "BUY",
  "type": "LIMIT",
  "price": 9500.5,
  "newClientOrderId": "myCustomOrderId123",
  "recvwindow": 5000,
  "triggerPrice": 9600
}
200

Order successfully placed.

{
  "symbol": "LXTUSDT",
  "orderId": 150695552109032480,
  "orderIdString": "150695552109032492",
  "clientOrderId": "157371322565051",
  "transactTime": "1573713225668",
  "price": "0.005452",
  "origQty": "110",
  "executedQty": "0",
  "status": "0",
  "type": "LIMIT",
  "side": "SELL"
}

Test New Order

post

Test new order creation and signature/recvWindow length. Creates and validates a new order but does not send the order into the matching engine.

Header parameters
X-CH-APIKEYstringRequired

Your API key

X-CH-TSstringRequired

Timestamp of the request

X-CH-SIGNstringRequired

Request signature

Body
typestringRequired

Type of the order

Example: LIMIT
pricenumberRequired

Order price, REQUIRED for LIMIT orders

Example: 1000.01
volumenumberRequired

Order volume. For MARKET BUY orders, vol=amount

Example: 1.5
sidestringRequired

Side of the order, BUY or SELL

Example: BUY
symbolstringRequired

Symbol name, e.g., BTC/USDT

Example: BTCUSDT
recvwindowintegerOptional

Time window for the request to be valid

Example: 5000
newClientorderIdstringOptional

Unique order ID generated by users

Example: my_custom_id_001
Responses
200
Successfully tested order
post
POST /sapi/v2/order/test HTTP/1.1
Host: openapi.coinlocally.com
X-CH-APIKEY: text
X-CH-TS: text
X-CH-SIGN: text
Content-Type: application/json
Accept: */*
Content-Length: 133

{
  "type": "LIMIT",
  "price": 1000.01,
  "volume": 1.5,
  "side": "BUY",
  "symbol": "BTCUSDT",
  "recvwindow": 5000,
  "newClientorderId": "my_custom_id_001"
}
200

Successfully tested order

No content

Batch Orders

post

Place a batch of up to 10 orders in a single request.

Weight: 10 (IP/UID)

Header parameters
X-CH-APIKEYstringRequired

Your API key

X-CH-TSstringRequired

Timestamp of the request

X-CH-SIGNstringRequired

Request signature

Body
symbolstringRequired

Trading pair symbol

Example: BTCUSDT
Responses
200
Successfully placed batch orders.
application/json
post
POST /sapi/v2/batchOrders HTTP/1.1
Host: openapi.coinlocally.com
X-CH-APIKEY: text
X-CH-TS: text
X-CH-SIGN: text
Content-Type: application/json
Accept: */*
Content-Length: 93

{
  "symbol": "BTCUSDT",
  "orders": [
    {
      "price": 1000,
      "volume": 20.1,
      "side": "BUY",
      "batchType": "LIMIT"
    }
  ]
}
200

Successfully placed batch orders.

{
  "idsString": [
    "165964665990709251",
    "165964665990709252",
    "165964665990709253"
  ],
  "ids": [
    165964665990709250,
    165964665990709250,
    165964665990709250
  ]
}

Cancel Order

post

Cancel an existing order by providing the order ID or clientOrderId.

Weight: 5 (IP/UID)

Header parameters
X-CH-APIKEYstringRequired

Your API key

X-CH-TSstringRequired

Timestamp of the request

X-CH-SIGNstringRequired

Request signature

Body
newClientOrderIdstringOptional

Client-generated Order ID (optional)

Example: 354444heihieddada
orderIdstringRequired

Order ID to cancel

Example: 499890200602846976
symbolstringRequired

Trading pair symbol

Example: BHTUSDT
Responses
200
Successfully canceled the order.
application/json
post
POST /sapi/v2/cancel HTTP/1.1
Host: openapi.coinlocally.com
X-CH-APIKEY: text
X-CH-TS: text
X-CH-SIGN: text
Content-Type: application/json
Accept: */*
Content-Length: 90

{
  "newClientOrderId": "354444heihieddada",
  "orderId": "499890200602846976",
  "symbol": "BHTUSDT"
}
200

Successfully canceled the order.

{
  "symbol": "BHTUSDT",
  "clientOrderId": "0",
  "orderId": "499890200602846976",
  "status": "CANCELED"
}

Batch Cancel Orders

post

Cancel multiple orders in a single request. The batch can contain up to 10 order IDs.

Weight: 10 (IP/UID)

Header parameters
X-CH-APIKEYstringRequired

Your API key

X-CH-TSstringRequired

Timestamp of the request

X-CH-SIGNstringRequired

Request signature

Body
orderIdsinteger[] · max: 10Required

List of order IDs to cancel

symbolstringRequired

Trading pair symbol

Example: BTCUSDT
Responses
200
Result of batch cancel operation
application/json
post
POST /sapi/v2/batchCancel HTTP/1.1
Host: openapi.coinlocally.com
X-CH-APIKEY: text
X-CH-TS: text
X-CH-SIGN: text
Content-Type: application/json
Accept: */*
Content-Length: 35

{
  "orderIds": [
    1
  ],
  "symbol": "BTCUSDT"
}
200

Result of batch cancel operation

{
  "success": [
    165964665990709250,
    165964665990709250,
    165964665990709250
  ],
  "failed": [
    165964665990709250
  ]
}