GET /api/v1/trades

Get Recent Trades

Get recent trade history for a specific trading pair. This endpoint returns the most recent executed trades, including price, quantity, and timestamp. This is a public endpoint and does not require authentication.

Trade Data

Each trade record includes the execution price, quantity, timestamp, and whether it was a buy or sell order. This data is useful for analyzing market activity and price movements.

Request Parameters

Response Example

{
    "code": 200,
    "msg": "success",
    "data": {
        "symbol": "BTCUSDT",
        "trades": [
            {
                "id": 123456789,
                "price": "45000.50",
                "qty": "0.1234",
                "quote_qty": "5556.06",
                "time": 1701234567000,
                "is_buyer_maker": false
            },
            {
                "id": 123456788,
                "price": "45001.00",
                "qty": "0.5678",
                "quote_qty": "25546.57",
                "time": 1701234566000,
                "is_buyer_maker": true
            }
        ],
        "count": 2,
        "timestamp": 1701234567000
    }
}

Code Example

// cURL example
curl -X GET "https://ziario.com/api/v1/trades?symbol=BTCUSDT&exchange=binance&limit=100"

// PHP example
$response = file_get_contents("https://ziario.com/api/v1/trades?symbol=BTCUSDT&exchange=binance&limit=100");
$data = json_decode($response, true);
if ($data["code"] == 200) {
    foreach ($data["data"]["trades"] as $trade) {
        echo "Price: " . $trade["price"] . ", Qty: " . $trade["qty"] . "\n";
    }
}

// JavaScript example
fetch("https://ziario.com/api/v1/trades?symbol=BTCUSDT&exchange=binance&limit=100")
    .then(response => response.json())
    .then(data => {
        if (data.code === 200) {
            data.data.trades.forEach(trade => {
                console.log(`Price: ${trade.price}, Qty: ${trade.qty}`);
            });
        }
    })
    .catch(error => console.error("Error:", error));

// Python example
import requests

response = requests.get("https://ziario.com/api/v1/trades", params={
    "symbol": "BTCUSDT",
    "exchange": "binance",
    "limit": 100
})
data = response.json()
if data["code"] == 200:
    for trade in data["data"]["trades"]:
        print(f"Price: {trade["price"]}, Qty: {trade["qty"]}")

Related Documentation