Python对接CoinEx API V2时遭遇「Access ID does not exist」错误的排查求助
Python对接CoinEx API V2时遭遇「Access ID does not exist」错误的排查求助
我之前找了不少CoinEx API对接的相关资料,但发现它们全都是基于v1版本的API实现的,而我想对接的是v2版本的API。于是我参照CoinEx的v2 API授权文档,写了下面这段Python 3代码,用来获取账户的基础信息:
import time import requests import hmac import hashlib baseUrl = 'https://api.coinex.com' requestPath = '/v2/account/info' timestamp = int(time.time()*1000) preparedString = "GET"+requestPath+str(timestamp) accessId = '???' secretKey = '???' signed_str = hmac.new(bytes(secretKey, 'latin-1'), bytes(preparedString, 'latin-1'), hashlib.sha256).hexdigest().lower() params = {'X-COINEX-KEY':accessId, 'X-COINEX-SIGN':signed_str, 'X-COINEX-TIMESTAMP':timestamp} response = requests.get(baseUrl+requestPath, params=params ) response.json()
但运行这段代码后,我得到了这样的错误返回:
{'code': 11003, 'data': {}, 'message': 'Access ID does not exist'}
更困惑的是,这个11003错误码在CoinEx官方的v2 API错误处理文档里根本找不到对应的说明。
我可以百分百确定我的access_id和secret_key是正确的——因为用同样的凭证,我能正常调用公开接口(比如/futures/ticker?market=BTCUSDT)获取市场数据,完全没有问题。
有没有大佬能帮我分析下,为什么调用私有接口时会抛出「Access ID does not exist」这个错误呢?
备注:内容来源于stack exchange,提问作者Sadabadi
相关产品推荐
相关产品推荐

