Trades
Get recent public trades for a symbol on a given exchange.
HTTP
| Method | GET |
| Endpoint | /trade/api/v2/trades |
Request Parameters
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
exchange | string | Yes | See Exchange Identifiers. |
symbol | string | Yes | BASE/QUOTE, e.g. BTC/INR, BTC/USDT. |
Example
- Python
- Java
- Go
- Node.js
import requests
headers, path = sign_request("GET", "/trade/api/v2/trades",
params={"exchange": "coinswitchx", "symbol": "btc/inr"})
response = requests.get(BASE_URL + path, headers=headers)
print(response.json())
HttpResponse<String> resp = client.send(
"GET", "/trade/api/v2/trades",
Map.of("exchange", "coinswitchx", "symbol", "btc/inr"), null);
System.out.println(resp.body());
headers, p, err := SignRequest("GET", "/trade/api/v2/trades", map[string]string{"exchange": "coinswitchx", "symbol": "btc/inr"})
if err != nil { panic(err) }
req, _ := http.NewRequest("GET", BaseURL+p, nil)
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 {headers, path} = signRequest('GET', '/trade/api/v2/trades', {"exchange": "coinswitchx", "symbol": "btc/inr"});
const r = await fetch(BASE_URL + path, {
method: 'GET',
headers,
});
console.log(await r.json());
Response
{
"data": [
{
"E": 1686512630072,
"m": false,
"p": "5.8599",
"q": "42",
"s": "DOGE/INR",
"t": "f60742d8-2494-4d87-96e5-310ded278c15",
"e": "coinswitchx"
}
]
}
Response Parameters
data is an array of trades. Each entry uses single-letter keys:
| Field | Type | Description |
|---|---|---|
E | integer | Event time (Unix milliseconds). |
m | boolean | true if the buyer was the maker, false otherwise. |
p | string | Trade price. |
q | string | Trade quantity (base asset). |
s | string | Symbol, e.g. "DOGE/INR". |
t | string | Trade ID (UUID). |
e | string | Exchange identifier, e.g. "coinswitchx". |