# Trade

## New Order

> Place a new order.\
> \
> \*\*Rate Limit:\*\* 100 requests per 2 seconds\
> \
> \*\*Weight:\*\* 5 (IP/UID)

```json
{"openapi":"3.0.0","info":{"title":"Coinlocally Spot API - New Order","version":"1.0.0"},"servers":[{"url":"https://openapi.coinlocally.com"}],"paths":{"/sapi/v2/order":{"post":{"summary":"New Order","description":"Place a new order.\n\n**Rate Limit:** 100 requests per 2 seconds\n\n**Weight:** 5 (IP/UID)","parameters":[{"name":"X-CH-APIKEY","in":"header","required":true,"schema":{"type":"string"},"description":"Your API-key"},{"name":"X-CH-TS","in":"header","required":true,"schema":{"type":"integer"},"description":"Timestamp in milliseconds"},{"name":"X-CH-SIGN","in":"header","required":true,"schema":{"type":"string"},"description":"Signature of the request"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"symbol":{"type":"string"},"volume":{"type":"number"},"side":{"type":"string","enum":["BUY","SELL"]},"type":{"type":"string","enum":["LIMIT","MARKET","FOK","POST_ONLY","IOC","STOP"]},"price":{"type":"number"},"newClientOrderId":{"type":"string"},"recvwindow":{"type":"integer"},"triggerPrice":{"type":"number"}},"required":["symbol","volume","side","type","price"]}}}},"responses":{"200":{"description":"Order successfully placed.","content":{"application/json":{"schema":{"type":"object","properties":{"symbol":{"type":"string","description":"Trading pair symbol"},"orderId":{"type":"integer","description":"Unique system-generated order ID"},"orderIdString":{"type":"string","description":"Order ID as string (recommended for tracking)"},"clientOrderId":{"type":"string","description":"Client-generated custom order ID"},"transactTime":{"type":"string","description":"Timestamp when the order was placed (in ms)"},"price":{"type":"string","description":"Order price"},"origQty":{"type":"string","description":"Original order quantity"},"executedQty":{"type":"string","description":"Quantity of the order that has been executed"},"status":{"type":"string","description":"Order status code"},"type":{"type":"string","description":"Order type"},"side":{"type":"string","description":"Order side (BUY or SELL)"}}}}}}}}}}}
```

## Test New Order

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

```json
{"openapi":"3.0.0","info":{"title":"Coinlocally Spot API - New Order","version":"1.0.0"},"servers":[{"url":"https://openapi.coinlocally.com"}],"paths":{"/sapi/v2/order/test":{"post":{"summary":"Test New Order","description":"Test new order creation and signature/recvWindow length. Creates and validates a new order but does not send the order into the matching engine.","tags":["Trade"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["type","price","volume","side","symbol"],"properties":{"type":{"type":"string","description":"Type of the order"},"price":{"type":"number","description":"Order price, REQUIRED for LIMIT orders"},"volume":{"type":"number","description":"Order volume. For MARKET BUY orders, vol=amount"},"side":{"type":"string","description":"Side of the order, BUY or SELL"},"symbol":{"type":"string","description":"Symbol name, e.g., BTC/USDT"},"recvwindow":{"type":"integer","description":"Time window for the request to be valid"},"newClientorderId":{"type":"string","description":"Unique order ID generated by users"}}}}}},"parameters":[{"name":"X-CH-APIKEY","in":"header","required":true,"schema":{"type":"string"},"description":"Your API key"},{"name":"X-CH-TS","in":"header","required":true,"schema":{"type":"string"},"description":"Timestamp of the request"},{"name":"X-CH-SIGN","in":"header","required":true,"schema":{"type":"string"},"description":"Request signature"}],"responses":{"200":{"description":"Successfully tested order"}}}}}}
```

## Batch Orders

> Place a batch of up to 10 orders in a single request.\
> \
> \*\*Weight:\*\* 10 (IP/UID)

```json
{"openapi":"3.0.0","info":{"title":"Coinlocally Spot API - New Order","version":"1.0.0"},"servers":[{"url":"https://openapi.coinlocally.com"}],"paths":{"/sapi/v2/batchOrders":{"post":{"summary":"Batch Orders","description":"Place a batch of up to 10 orders in a single request.\n\n**Weight:** 10 (IP/UID)","tags":["Trade"],"parameters":[{"name":"X-CH-APIKEY","in":"header","required":true,"schema":{"type":"string"},"description":"Your API key"},{"name":"X-CH-TS","in":"header","required":true,"schema":{"type":"string"},"description":"Timestamp of the request"},{"name":"X-CH-SIGN","in":"header","required":true,"schema":{"type":"string"},"description":"Request signature"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["orders","symbol"],"properties":{"symbol":{"type":"string","description":"Trading pair symbol"},"orders":{"type":"array","maxItems":10,"description":"The batch order information can contain a maximum of 10 records.","items":{"type":"object","required":["price","volume","side","batchType"],"properties":{"price":{"type":"number","description":"Order price"},"volume":{"type":"number","description":"Order volume"},"side":{"type":"string","enum":["BUY","SELL"],"description":"Order direction"},"batchType":{"type":"string","enum":["LIMIT","MARKET"],"description":"Order type"}}}}}}}}},"responses":{"200":{"description":"Successfully placed batch orders.","content":{"application/json":{"schema":{"type":"object","properties":{"idsString":{"type":"array","items":{"type":"string"},"description":"A collection of order IDs in string format (e.g., [\"3213213\"])."},"ids":{"type":"array","items":{"type":"integer"},"description":"A collection of order IDs in integer format (e.g., [2100])."}}}}}}}}}}}
```

## Query Order

> Retrieve the details of a specific order.\
> \
> \*\*Weight:\*\* 1 (IP/UID)

```json
{"openapi":"3.0.0","info":{"title":"Coinlocally Spot API - New Order","version":"1.0.0"},"servers":[{"url":"https://openapi.coinlocally.com"}],"paths":{"/sapi/v2/order":{"get":{"summary":"Query Order","description":"Retrieve the details of a specific order.\n\n**Weight:** 1 (IP/UID)","tags":["Trade"],"parameters":[{"name":"orderId","in":"query","required":true,"schema":{"type":"string"},"description":"System-generated Order ID"},{"name":"newClientorderId","in":"query","required":false,"schema":{"type":"string"},"description":"Client-generated Order ID (optional)"},{"name":"symbol","in":"query","required":true,"schema":{"type":"string"},"description":"Trading pair symbol, e.g., BTC/USDT"},{"name":"X-CH-APIKEY","in":"header","required":true,"schema":{"type":"string"},"description":"Your API key"},{"name":"X-CH-TS","in":"header","required":true,"schema":{"type":"string"},"description":"Timestamp of the request"},{"name":"X-CH-SIGN","in":"header","required":true,"schema":{"type":"string"},"description":"Request signature"}],"responses":{"200":{"description":"Successfully retrieved order information.","content":{"application/json":{"schema":{"type":"object","properties":{"orderId":{"type":"string","description":"Unique order identifier generated by the system."},"clientOrderId":{"type":"string","description":"Custom client-defined order ID."},"symbol":{"type":"string","description":"Trading pair (e.g., BTC/USDT)."},"price":{"type":"string","description":"Order price."},"origQty":{"type":"string","description":"Original quantity ordered."},"executedQty":{"type":"string","description":"Quantity that has been filled."},"avgPrice":{"type":"string","description":"Average price of the filled portion."},"status":{"type":"string","description":"Current status of the order — NEW, PARTIALLY_FILLED, FILLED, CANCELED, or REJECTED."},"type":{"type":"string","description":"Type of the order (e.g., LIMIT, MARKET)."},"side":{"type":"string","description":"Direction of the order — BUY or SELL."},"transactTime":{"type":"string","description":"Timestamp (ms) of order creation."}}}}}}}}}}}
```

## Cancel Order

> Cancel an existing order by providing the order ID or clientOrderId.\
> \
> \*\*Weight:\*\* 5 (IP/UID)

```json
{"openapi":"3.0.0","info":{"title":"Coinlocally Spot API - New Order","version":"1.0.0"},"servers":[{"url":"https://openapi.coinlocally.com"}],"paths":{"/sapi/v2/cancel":{"post":{"summary":"Cancel Order","description":"Cancel an existing order by providing the order ID or clientOrderId.\n\n**Weight:** 5 (IP/UID)","tags":["Trade"],"parameters":[{"name":"X-CH-APIKEY","in":"header","required":true,"schema":{"type":"string"},"description":"Your API key"},{"name":"X-CH-TS","in":"header","required":true,"schema":{"type":"string"},"description":"Timestamp of the request"},{"name":"X-CH-SIGN","in":"header","required":true,"schema":{"type":"string"},"description":"Request signature"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["orderId","symbol"],"properties":{"newClientOrderId":{"type":"string","description":"Client-generated Order ID (optional)"},"orderId":{"type":"string","description":"Order ID to cancel"},"symbol":{"type":"string","description":"Trading pair symbol"}}}}}},"responses":{"200":{"description":"Successfully canceled the order.","content":{"application/json":{"schema":{"type":"object","properties":{"symbol":{"type":"string","description":"Trading pair the order was placed on (e.g., BTC/USDT)."},"clientOrderId":{"type":"string","description":"Client-provided identifier for the order."},"orderId":{"type":"string","description":"Unique ID of the canceled order (system-generated)."},"status":{"type":"string","description":"Final state of the order — typically `CANCELED`. Other possible states include `NEW`, `PARTIALLY_FILLED`, `FILLED`, and `REJECTED`."}}}}}}}}}}}
```

## Batch Cancel Orders

> Cancel multiple orders in a single request. The batch can contain up to 10 order IDs.\
> \
> \*\*Weight:\*\* 10 (IP/UID)

```json
{"openapi":"3.0.0","info":{"title":"Coinlocally Spot API - New Order","version":"1.0.0"},"servers":[{"url":"https://openapi.coinlocally.com"}],"paths":{"/sapi/v2/batchCancel":{"post":{"summary":"Batch Cancel Orders","description":"Cancel multiple orders in a single request. The batch can contain up to 10 order IDs.\n\n**Weight:** 10 (IP/UID)","tags":["Trade"],"parameters":[{"name":"X-CH-APIKEY","in":"header","required":true,"schema":{"type":"string"},"description":"Your API key"},{"name":"X-CH-TS","in":"header","required":true,"schema":{"type":"string"},"description":"Timestamp of the request"},{"name":"X-CH-SIGN","in":"header","required":true,"schema":{"type":"string"},"description":"Request signature"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["orderIds","symbol"],"properties":{"orderIds":{"type":"array","maxItems":10,"items":{"type":"string"},"description":"List of order IDs to cancel"},"symbol":{"type":"string","description":"Trading pair symbol"}}}}}},"responses":{"200":{"description":"Result of batch cancel operation","content":{"application/json":{}}}}}}}}
```

## Current Open Orders

> 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

```json
{"openapi":"3.0.0","info":{"title":"Coinlocally Spot API - New Order","version":"1.0.0"},"servers":[{"url":"https://openapi.coinlocally.com"}],"paths":{"/sapi/v2/openOrders":{"get":{"summary":"Current Open Orders","description":"Retrieve all currently open orders for a symbol. If `symbol` is not provided, orders for all symbols will be returned.\n\n**Weight:** 1 (IP/UID)\n**Symbol not provided:** Weight = 80","tags":["Trade"],"parameters":[{"name":"symbol","in":"query","required":false,"schema":{"type":"string"},"description":"Symbol name, e.g., BTC/USDT.\n\n**Weight (IP/UID):**\n- If `symbol` is provided: 1\n- If `symbol` is not provided: 80"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":100,"maximum":1000},"description":"Number of orders to return (max 1000)"},{"name":"X-CH-APIKEY","in":"header","required":true,"schema":{"type":"string"},"description":"Your API key"},{"name":"X-CH-TS","in":"header","required":true,"schema":{"type":"string"},"description":"Timestamp of the request"},{"name":"X-CH-SIGN","in":"header","required":true,"schema":{"type":"string"},"description":"Request signature"}],"responses":{"200":{"description":"Successfully retrieved list of open orders.","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"orderId":{"type":"integer"},"orderIdString":{"type":"string"},"symbol":{"type":"string"},"price":{"type":"string"},"origQty":{"type":"string"},"executedQty":{"type":"string"},"avgPrice":{"type":"string"},"status":{"type":"string"},"type":{"type":"string"},"side":{"type":"string"},"time":{"type":"string"},"stopPrice":{"type":"number"},"isWorking":{"type":"boolean"}}}}}}}}}}}}
```

## History Orders

> Retrieve historical orders for an account.

```json
{"openapi":"3.0.0","info":{"title":"Coinlocally Spot API - New Order","version":"1.0.0"},"servers":[{"url":"https://openapi.coinlocally.com"}],"paths":{"/sapi/v3/historyOrders":{"get":{"summary":"History Orders","description":"Retrieve historical orders for an account.","tags":["Trade"],"parameters":[{"name":"symbol","in":"query","required":false,"schema":{"type":"string"},"description":"Symbol name, e.g., BTC/USDT.\n\n**Weight (IP/UID):** 20\n- If `symbol` is not provided: weight = 80"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":50,"maximum":100},"description":"Max number of results (default: 50, max: 100)"},{"name":"startTime","in":"query","required":false,"schema":{"type":"integer"},"description":"Start time in milliseconds"},{"name":"endTime","in":"query","required":false,"schema":{"type":"integer"},"description":"End time in milliseconds"},{"name":"X-CH-APIKEY","in":"header","required":true,"schema":{"type":"string"},"description":"Your API key"},{"name":"X-CH-TS","in":"header","required":true,"schema":{"type":"string"},"description":"Timestamp of the request"},{"name":"X-CH-SIGN","in":"header","required":true,"schema":{"type":"string"},"description":"Request signature"}],"responses":{"200":{"description":"Successfully retrieved historical orders.","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"orderId":{"type":"integer"},"orderIdString":{"type":"string"},"symbol":{"type":"string"},"price":{"type":"string"},"origQty":{"type":"string"},"executedQty":{"type":"string"},"avgPrice":{"type":"string"},"status":{"type":"string"},"type":{"type":"string"},"side":{"type":"string"},"time":{"type":"string"},"stopPrice":{"type":"number"},"isWorking":{"type":"boolean"}}}}}}}}}}}}
```

## Account Trade List

> 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.

```json
{"openapi":"3.0.0","info":{"title":"Coinlocally Spot API - New Order","version":"1.0.0"},"servers":[{"url":"https://openapi.coinlocally.com"}],"paths":{"/sapi/v3/myTrades":{"get":{"summary":"Account Trade List","description":"Get historical trade data.\n\n**Weight:** 20 (IP/UID)\n**Symbol not provided:** Weight = 80\n\nSupports up to 6 months of data. Time range between `startTime` and `endTime` must not exceed 7 days.","tags":["Trade"],"parameters":[{"name":"symbol","in":"query","required":false,"schema":{"type":"string"},"description":"Symbol name, e.g., BTC/USDT.\n\n**Rate Limit Weight (IP/UID):**\n- Single symbol query: weight = 20\n- Symbol not provided: weight = 80"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":50,"maximum":100},"description":"Max number of results (default: 50, max: 100)"},{"name":"startTime","in":"query","required":false,"schema":{"type":"integer"},"description":"Start time in milliseconds"},{"name":"endTime","in":"query","required":false,"schema":{"type":"integer"},"description":"End time in milliseconds"},{"name":"X-CH-APIKEY","in":"header","required":true,"schema":{"type":"string"},"description":"Your API key"},{"name":"X-CH-TS","in":"header","required":true,"schema":{"type":"string"},"description":"Timestamp of the request"},{"name":"X-CH-SIGN","in":"header","required":true,"schema":{"type":"string"},"description":"Request signature"}],"responses":{"200":{"description":"Successfully retrieved trade history.","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"symbol":{"type":"string"},"id":{"type":"integer"},"bidId":{"type":"integer"},"askId":{"type":"integer"},"price":{"type":"string"},"qty":{"type":"string"},"time":{"type":"integer"},"isBuyer":{"type":"boolean"},"isMaker":{"type":"boolean"},"feeCoin":{"type":"string"},"fee":{"type":"string"},"bidUserId":{"type":"integer"},"askUserId":{"type":"integer"},"isSelf":{"type":"boolean"}}}}}}}}}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.coinlocally.com/spot/trade.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
