考虑以下几点:
以下是Binance API的示例代码,可以帮助您参考和调试:
from binance.client import Client
import time
# Enter your API key and secret key here
api_key = 'your_api_key'
api_secret = 'your_api_secret'
# Choose Binance API endpoint and HTTP method
# The following example uses /api/v3/account endpoint and GET method
path = '/api/v3/account'
method = 'GET'
# Define default request parameters
params = {}
headers = {'X-MBX-APIKEY': api_key}
ts = int(1000 * time.time())
params['timestamp'] = str(ts)
# Construct signature
query_string = '&'.join([f"{k}={v}" for k, v in params.items()])
signature = Client.sign(query_string, api_secret)
params['signature'] = signature.decode('utf-8')
# Send signed request to Binance API and print response
client = Client(api_key, api_secret)
response = client.request(method, path, params=params, headers=headers)
print(response.json())
希望这能够帮助您解决问题。