Sends an Http request, an asynchronous version of the HttpQuery
function.
The HttpQuery_Go()
function immediately returns a concurrent object that can be used to obtain the result of an Http request using the wait
method of the The JSON.parse()
function can be used to parse the JSON.parse()
function in the JavaScript
language’s strategy.
object
HttpQuery_Go(url) HttpQuery_Go(url, options)
Http request url. url true string Http request-related settings, for example, can be structured as follows:
{
method: "POST",
body: "a=10&b=20&c=30",
charset: "UTF-8",
cookie: "session_id=12345; lang=en",
// profile: "",
debug: false,
headers: {"TEST-HTTP-QUERY": "123"},
timeout: 1000
}
tls
fingerprints.true
, this HttpQuery_Go
function call returns the full reply message. When it’s set to false
, only the data in the Body
of the reply message is returned.profile
field can be left out.options false object
function main() {
// Create the first asynchronous thread
var r1 = HttpQuery_Go("https://www.okx.com/api/v5/market/tickers?instType=SPOT")
// Create the second asynchronous thread
var r2 = HttpQuery_Go("https://api.huobi.pro/market/tickers")
// Get the return value of the first asynchronous thread call
var tickers1 = r1.wait()
// Get the return value of the second asynchronous thread call
var tickers2 = r2.wait()
// Print results
Log("tickers1:", tickers1)
Log("tickers2:", tickers2)
}
# Not supported
// Not supported
Asynchronous access to the exchange’s public interface for aggregated ticker data.
The HttpQuery_Go()
function only supports JavaScript
, the Python
language can be used with the urllib
library to send Http requests directly. The HttpQuery_Go()
is mainly used to access interfaces that do not require a signature on the exchange, such as public interfaces like ticker information. The HttpQuery_Go
function is not supported in the backtesting system.
{@fun/Global/HttpQuery HttpQuery}
HttpQuery Encode