系统环境:
centos7
python3.8.3
错误码官方地址:okex.com/docs/zh/#error-Error_Code
一、请求时间戳过期
Timestamp request expired
30008
okex {“error_message”:“Request timestamp expired”,“code”:30008,“error_code”:“30008”,“message”:“Request timestamp expired”}
(一)Windows系统处理
如果在windows系统下出现,是因为系统时间与北京时间差距过大,同步一下系统时间即可
(二)Linux系统处理
详见:Linux服务器时区设置
二、“error_code”:“30001”
编译环境提示:
Value for header {OK-ACCESS-PASSPHRASE: nan} must be of type str or bytes, not <class ‘numpy.float64’>
浏览器访问返回:
{“error_message”:“OK-ACCESS-KEY header is required”,“code”:30001,“error_code”:“30001”,“message”:“OK-ACCESS-KEY header is required”}
请求头示例:
Content-Type: application/json
OK-ACCESS-KEY: 37c541a1-****-****-****-10fe7a038418
OK-ACCESS-SIGN: leaVRETrtaoEQ3yI9qEtI1CZ82ikZ4xSG5Kj8gnl3uw=
OK-ACCESS-PASSPHRASE: 1****6
OK-ACCESS-TIMESTAMP: 2020-03-28T12:21:41.274Z
x-simulated-trading: 1
OK-ACCESS-PASSPHRASE: nan说明密码为空,把api密码补上即可
三、“error_code”:“30012”
错误提示:
okex {“error_message”:“Invalid Authority”,“code”:30012,“error_code”:“30012”,“message”:“Invalid Authority”}
授权不可用,看看api是否有错
key/secret是否字段填错,api权限选择(比如交易权限没选无法进行交易)
四、“error_code”:“30006”
错误提示:
okex {“error_message”:“Invalid OK-ACCESS-KEY”,“code”:30006,“error_code”:“30006”,“message”:“Invalid OK-ACCESS-KEY”}
无效API和密码,打印查看是否正常
五、“error_code”:“32008”
错误提示:okex {“error_message”:“You may open extra 0 contracts on the same side”,“code”:32008,“error_code”:“32008”,“message”:“You may open extra 0 contracts on the same side”}
You may open extra 0 contracts on the same side
可以在同一方向打开额外的0个合同
情况1:保证金不足,不够开1张合约
本文详细解析了OKEx API中常见的错误码,包括请求时间戳过期、编译环境提示、无效API密钥等问题,并提供了针对Windows和Linux系统的解决方案。通过本文,读者可以了解如何正确处理这些错误,确保API调用的顺利进行。
3630

被折叠的 条评论
为什么被折叠?



