簡體   English   中英

我無法獲取數據。 幣安 API

[英]I can't get the data. Binance API

我寫了以下查詢:

import requests
import json

headers = {
    "Accept": "*/*",
    "Accept-Encoding": "gzip, deflate, br",
    "Accept-Language": "en-GB,en-US;q=0.9,en;q=0.8",
    "Cache-Control": "no-cache",
    "Connection": "keep-alive",
    "Content-Length": "123",
    "content-type": "application/json",
    "Host": "p2p.binance.com",
    "Origin": "https://p2p.binance.com",
    "Pragma": "no-cache",
    "TE": "Trailers",
}

data = {
  "asset": "USDT",
    "fiat": "RUB",
    "page": 1,
    "payTypes": ["Tinkoff"],
    "rows": 1,
    "tradeType": "SELL",
    "transAmount":  "30000"
}

request_data = requests.post('https://p2p.binance.com/bapi/c2c/v2/friendly/c2c/adv/search', headers=headers, json=data).json()

print(request_data['data'][0]['adv']['price'])

我收到這樣的錯誤:

回溯(最后一次調用):文件“C:\Users\artem\source\repos\PythonParser2\PythonParser2\PythonParser2.py”,第 30 行,在 print(request_data['data'][0]['adv'] ['price']) IndexError: 列表索引超出范圍

在某些支付系統上,請求是成功的,而在某些支付系統上則不是。 我認為這是“payTypes”字段的錯誤值。 如果是這種情況,我如何才能獲得 Binance 交易所支付系統的正確名稱?

這不是已發布的 API 端點,請僅使用官方文檔中的 API 端點。

https://binance-docs.github.io/apidocs/spot/en/#change-log

https://github.com/binance/binance-spot-api-docs

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM