Chilkat Online Tools

Perl / Binance spot API / Compressed/Aggregate Trades List

Back to Collection Items

use chilkat();

# This example assumes the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.

$http = chilkat::CkHttp->new();

$queryParams = chilkat::CkJsonObject->new();
$queryParams->UpdateString("symbol","BNBUSDT");

$http->SetRequestHeader("Content-Type","application/json");

# resp is a HttpResponse
$resp = $http->QuickRequestParams("GET","https://domain.com/api/v3/aggTrades",$queryParams);
if ($http->get_LastMethodSuccess() == 0) {
    print $http->lastErrorText() . "\r\n";
    exit;
}

print $resp->get_StatusCode() . "\r\n";
print $resp->bodyStr() . "\r\n";

Curl Command

curl -G -d "symbol=BNBUSDT"
	-H "Content-Type: application/json"
https://domain.com/api/v3/aggTrades

Postman Collection Item JSON

{
  "name": "Compressed/Aggregate Trades List",
  "request": {
    "method": "GET",
    "header": [
      {
        "key": "Content-Type",
        "type": "text",
        "value": "application/json"
      }
    ],
    "url": {
      "raw": "{{url}}/api/v3/aggTrades?symbol=BNBUSDT",
      "host": [
        "{{url}}"
      ],
      "path": [
        "api",
        "v3",
        "aggTrades"
      ],
      "query": [
        {
          "key": "symbol",
          "value": "BNBUSDT",
          "description": "Trading symbol, e.g. BNBUSDT"
        },
        {
          "key": "fromId",
          "value": "",
          "description": "Trade id to fetch from. Default gets most recent trades.",
          "disabled": true
        },
        {
          "key": "startTime",
          "value": "",
          "description": "UTC timestamp in ms",
          "disabled": true
        },
        {
          "key": "endTime",
          "value": "",
          "description": "UTC timestamp in ms",
          "disabled": true
        },
        {
          "key": "limit",
          "value": "500",
          "description": "Default 500; max 1000.",
          "disabled": true
        }
      ]
    },
    "description": "Get compressed, aggregate trades. Trades that fill at the time, from the same order, with the same price will have the quantity aggregated.\n- If `startTime` and `endTime` are sent, time between startTime and endTime must be less than 1 hour.\n- If `fromId`, `startTime`, and `endTime` are not sent, the most recent aggregate trades will be returned.\n\nWeight(IP): 1"
  },
  "response": [
  ]
}