Binance API错误:{“代码”:-1021,“ msg”:“此请求的时间戳不在recvWindow之外。”}

问题描述 投票:0回答:1

使用Binance Offical API,我尝试进行一个简单的查询,但失败。

显示错误:

{“代码”:-1021,“ msg”:“此请求的时间戳不在recvWindow之外。”}

到目前为止,我的努力是:

  1. 在我的Ubuntu 18.04.3 LTS中安装ntp。>>
  2. 确保ntpq -p正常运行
  3. 尝试强制ntpd运行:ntpd -gq
  4. 但是以上所有步骤仍然失败。

注意:

1)我正在使用默认的ubuntu ntp池:

pool 0.ubuntu.pool.ntp.org iburst
pool 1.ubuntu.pool.ntp.org iburst
pool 2.ubuntu.pool.ntp.org iburst
pool 3.ubuntu.pool.ntp.org iburst  

2)下面是ntpq -p的屏幕截图(似乎有64-128s的延迟):

enter image description here

3)我的脚本是使用PHP编写的,如有必要,我将在此处发布...

任何想法?

使用Binance官方API,我尝试进行简单查询,但失败了。它显示错误:{“ code”:-1021,“ msg”:“此请求的时间戳不在recvWindow之外。”}到目前为止,我的努力是:...

php linux api ntp binance
1个回答
0
投票

检查运行代码的服务器上的时间与Binance时间的可能差异最小。您可以使用https://binance-docs.github.io/apidocs/spot/en/#test-connectivity检查服务器时间端点:

© www.soinside.com 2019 - 2024. All rights reserved.