BitMEX / sample-market-maker

Sample BitMEX Market Making Bot
Apache License 2.0
1.7k stars 757 forks source link

Bad request for cancelling orders #21

Closed jerreyz closed 7 years ago

jerreyz commented 7 years ago

Hello there,

Last week I was still able to run the sample market maker but now I 'm getting the following error:

2017-10-31 14:07:40,680 - ERROR - bitmex - Error: 400 Client Error: Bad Request for url: https://testnet.bitmex.com/api/v1/order?filter=%7B%22ordStatus.isTerminated%22%3A+false%2C+%22symbol%22%3A+%22XBTUSD%22%7D: {"error":{"message":"This request has expired -expiresis in the past. Current time: 1509455267","name":"HTTPError"}}

Questions

  • shouldn't I be using "wss://testnet.bitmex.com/realtime" for the base_url or is this only to be used for the websocket?
  • The Bitmex websocket in sample market maker is different from the one in the api-connector. Which one should we take as the main source for further developing?

Kind regards

STRML commented 7 years ago

The error has to do with your clock being skewed from BitMEX's clock. Check your system's clock settings and resync with NTP servers (sometimes called "Internet Time).

As for your questions, wss:// is for realtime data (websocket), https:// is for requests.

Re: the endpoint in this module vs. api connectors, testnet.bitmex.com is a test exchange trading valueless Testnet Bitcoin, www.bitmex.com is the real deal. We highly suggest you develop and test on Testnet first, then move to the live site when you're very confident.

jerreyz commented 7 years ago

Great , thanks for the quick response !