Chilkat Online Tools

PowerBuilder / Binance spot API / Rolling window price change statistics

Back to Collection Items

integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_SbResponseBody

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

loo_Http = create oleobject
// Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
li_rc = loo_Http.ConnectToNewObject("Chilkat.Http")
if li_rc < 0 then
    destroy loo_Http
    MessageBox("Error","Connecting to COM object failed")
    return
end if

loo_Http.SetRequestHeader("Content-Type","application/json")

loo_SbResponseBody = create oleobject
// Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0
li_rc = loo_SbResponseBody.ConnectToNewObject("Chilkat.StringBuilder")

li_Success = loo_Http.QuickGetSb("https://domain.com/api/v3/ticker",loo_SbResponseBody)
if li_Success = 0 then
    Write-Debug loo_Http.LastErrorText
    destroy loo_Http
    destroy loo_SbResponseBody
    return
end if

Write-Debug "Response status code = " + string(loo_Http.LastStatus)
Write-Debug loo_SbResponseBody.GetAsString()


destroy loo_Http
destroy loo_SbResponseBody

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": [
  ]
}