Exchange Precision
Get the price and quantity precision for a symbol on a given exchange. Use the returned values to format price and quantity correctly when placing orders.
HTTP
| Method | POST |
| Endpoint | /trade/api/v2/exchangePrecision |
Request Parameters
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
exchange | string | Yes | See Exchange Identifiers. |
symbol | string | No | BASE/QUOTE, e.g. BTC/INR, BTC/USDT. If omitted, returns precision for all symbols on the exchange. |
Example
- Python
- Java
- Go
- Node.js
import requests
body = {"exchange": "coinswitchx", "symbol": "BTC/INR"}
headers, path = sign_request("POST", "/trade/api/v2/exchangePrecision")
response = requests.post(BASE_URL + path, headers=headers, json=body)
print(response.json())
HttpResponse<String> resp = client.send(
"POST", "/trade/api/v2/exchangePrecision", null,
Map.of("exchange", "coinswitchx", "symbol", "BTC/INR"));
System.out.println(resp.body());
body := map[string]any{
"exchange": "coinswitchx",
"symbol": "BTC/INR",
}
bodyJSON, _ := json.Marshal(body)
headers, p, err := SignRequest("POST", "/trade/api/v2/exchangePrecision", nil)
if err != nil { panic(err) }
req, _ := http.NewRequest("POST", BaseURL+p, bytes.NewReader(bodyJSON))
for k, v := range headers { req.Header.Set(k, v) }
resp, err := http.DefaultClient.Do(req)
if err != nil { panic(err) }
defer resp.Body.Close()
out, _ := io.ReadAll(resp.Body)
fmt.Println(string(out))
const {signRequest, BASE_URL} = require('./reference-client');
const body = {"exchange": "coinswitchx", "symbol": "BTC/INR"};
const {headers, path} = signRequest('POST', '/trade/api/v2/exchangePrecision');
const r = await fetch(BASE_URL + path, {
method: 'POST',
headers,
body: JSON.stringify(body),
});
console.log(await r.json());
Response
{
"data": {
"coinswitchx": {
"BTC/INR": {
"base": 5,
"quote": 2,
"limit": 0
}
}
}
}
Response Parameters
data is keyed by exchange, then by symbol. Each symbol object:
| Field | Type | Description |
|---|---|---|
base | integer | Decimal places allowed for quantity (the base asset). |
quote | integer | Decimal places allowed for price (the quote asset). |
limit | integer | Limit-order specific precision adjustment (typically 0). |