我现在正在研究从币安获取当前加密货币的价格。

我引用此API-DOCS(https://github.com/binance-exchange/binance-official-api-docs/blob/master/rest-api.md),“符号订单簿报价器”

但是,我的代码显示了一些错误响应,如下所示

'HTTP/1.1 404 Not Found'

<html><body><h2>404 Not found</h2></body></html>


我的代码如下所示

public static void bid_ask () throws ClientProtocolException, IOException {
    String queryArgs = "https://api.binance.com/api/v3/ticker/bookTicker";
    CloseableHttpClient httpClient = HttpClients.createDefault();
    HttpPost post = new HttpPost(queryArgs);

    CloseableHttpResponse response = httpClient.execute(post);
    HttpEntity responseEntity = response.getEntity();
    System.out.println(response.getStatusLine());
    System.out.println(EntityUtils.toString(responseEntity));

}

最佳答案

根据您链接的API文档,该URL仅支持GET请求,但您正在发出POST请求。

关于java - (JAVA)将http请求发布到Binance交换错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/53696808/

10-12 00:23
查看更多