danpaquin / coinbasepro-python

The unofficial Python client for the Coinbase Pro API
MIT License
1.82k stars 740 forks source link

pro.coinbase.com/orders - request timestamp expired #453

Open Bandit253 opened 2 years ago

Bandit253 commented 2 years ago

The endpoint was working fine for weeks many thousands of successful trades done against it. then all of a sudden, on Monday, for no apparent reason I only get this response. POST (401) https://api-public.sandbox.pro.coinbase.com/orders - request timestamp expired

Another odd thing it has affected my non Sandbox API calls. image

teleprint-me commented 2 years ago

The CB-ACCESS-TIMESTAMP header MUST be number of seconds since Unix Epoch in UTC. Decimal values are allowed.

Your timestamp must be within 30 seconds of the api service time or your request will be considered expired and rejected. We recommend using the time endpoint to query for the API server time if you believe there many be time skew between your server and the API servers.

Source

The code is generating a timestamp in cbpro_auth on line 16 once a request is made.

The only thing I can think of is that your request timestamp is skewed. There's ways to mitigate it, but I've never had this issue.

The docs provide a suggestion by modififying the timestamp so that the skew doesn't interfere with the request.