币安 api 上的“时间戳提前 1000 毫秒”错误?

问题描述

我在 mac 上开发时遇到了这个奇怪的错误

def binance_object_creation():
api_key = 'my api key'
secret = 'my secret no'

binance = ccxt.binance(config={
    'apiKey': api_key,'secret': secret,'enableRateLimit': True,'options': {
        'defaultType': 'future',# ←-------------- quotes and 'future'
        "adjustForTimeDifference": True
    }
})

binance.fapiPrivate_post_Leverage({
    "symbol": "BTCUSDT",# convert a unified CCXT symbol to an exchange-specific market id
    # "symbol": "BTCUSDT",# same thing,note there's no slash in the exchange-specific id
    "Leverage": 3,})

return(binance)

奇怪的是,如果我删除 fapiPrivate_post_Leverage 的东西,那么错误就不会发生。 adjustForTimeDifference: True,设置为防止时间戳错误但失败。 会有什么问题?

解决方法

您电脑的时间与币安的时钟不同步。我建议运行此命令来修复您的 mac 时间:

sudo sntp -sS time.apple.com

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...