Chilkat Online Tools

Swift3 / Binance spot API / Rolling window price change statistics

Back to Collection Items

func chilkatTest() {
    // This example assumes the Chilkat API to have been previously unlocked.
    // See Global Unlock Sample for sample code.

    let http = CkoHttp()!
    var success: Bool

    http.setRequestHeader("Content-Type", value: "application/json")

    let sbResponseBody = CkoStringBuilder()!
    success = http.quickGetSb("https://domain.com/api/v3/ticker", sbContent: sbResponseBody)
    if success == false {
        print("\(http.lastErrorText!)")
        return
    }

    print("Response status code = \(http.lastStatus.intValue)")
    print("\(sbResponseBody.getAsString()!)")

}

Curl Command

curl -X GET
	-H "Content-Type: application/json"
https://domain.com/api/v3/ticker

Postman Collection Item JSON

{
  "name": "Rolling window price change statistics",
  "request": {
    "method": "GET",
    "header": [
      {
        "key": "Content-Type",
        "type": "text",
        "value": "application/json"
      }
    ],
    "url": {
      "raw": "{{url}}/api/v3/ticker",
      "host": [
        "{{url}}"
      ],
      "path": [
        "api",
        "v3",
        "ticker"
      ],
      "query": [
        {
          "key": "symbol",
          "value": "BNBUSDT",
          "description": "Trading symbol, e.g. BNBUSDT",
          "disabled": true
        },
        {
          "key": "symbols",
          "value": "",
          "description": "Either symbol or symbols must be provided\nExamples of accepted format for the symbols parameter: [\"BTCUSDT\",\"BNBUSDT\"] or %5B%22BTCUSDT%22,%22BNBUSDT%22%5D.\n\nThe maximum number of symbols allowed in a request is 100.",
          "disabled": true
        },
        {
          "key": "windowSize",
          "value": "",
          "description": "Defaults to 1d if no parameter provided.\nSupported windowSize values:\n1m,2m....59m for minutes\n1h, 2h....23h - for hours\n1d...7d - for days.\n\nUnits cannot be combined (e.g. 1d2h is not allowed)",
          "disabled": true
        },
        {
          "key": "type",
          "value": "",
          "description": "Supported values: FULL or MINI.\nIf none provided, the default is FULL",
          "disabled": true
        }
      ]
    },
    "description": "The window used to compute statistics is typically slightly wider than requested windowSize.\n\nopenTime for /api/v3/ticker always starts on a minute, while the closeTime is the current time of the request. As such, the effective window might be up to 1 minute wider than requested.\n\nE.g. If the closeTime is 1641287867099 (January 04, 2022 09:17:47:099 UTC) , and the windowSize is 1d. the openTime will be: 1641201420000 (January 3, 2022, 09:17:00 UTC)\n\nWeight(IP): 2 for each requested symbol regardless of windowSize.\n\nThe weight for this request will cap at 100 once the number of symbols in the request is more than 50."
  },
  "response": [
  ]
}