作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我现在正在努力从币安获取加密货币的当前价格。
我引用这个 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)向Binance交易所发送http请求错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53696808/
我是一名优秀的程序员,十分优秀!