如何使用python-binance从Binance API打印响应

时间:2019-06-21 20:21:52

标签: python python-requests python-3.6 binance

有人知道如何从Binance的API打印JSON结果吗?我一直在get_all_tickers使用它来返回所有符号和价格。我希望能够选择某个交易品种和价格并将其实时显示在终端中,或者直到用户退出为止。我正在使用this library

我的代码:

url = 'https://api.binance.com/api/v3/ticker/price'
response = reqs.get(url)        # To execute get request 
print(response.status_code)     # To print http response code  
print(response.content)
print(response.json)            # To print formatted JSON response 

输出:

200 
{ 
  "userId": 1, 
  "id": 1, 
  "title": "market data", 
  "completed": False 
} 

0 个答案:

没有答案