question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bitmex, Nonce is not increasing

See original GitHub issue

Been trying to use the python api. Some works nicely, but bitmex authenticated api seems to have an issue with the nonce generation.

bitmex = ccxt.bitmex({
        "apiKey": BITMEX_API_KEY,
        "secret": BITMEX_API_SECRET
    })
balance = bitmex.privateGetUserWalletHistory()

This is the error:

ExchangeNotAvailable: bitmex GET https://www.bitmex.com/api/v1/user/walletHistory 400 Bad Request (possible reasons: invalid API keys, bad or old nonce, exchange is down or offline, on maintenance, DDoS protection, rate-limiting, {“error”:{“message”:“Nonce is not increasing. This nonce: 1503497932, last nonce: 1502567277932”,“name”:“HTTPError”}})

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
devcon14commented, Aug 23, 2017

Missed the doc on overriding, thanks!

1reaction
kroitorcommented, Aug 23, 2017
    # Python
    import ccxt
    import time
    bitmex = ccxt.bitmex({
        "apiKey": BITMEX_API_KEY,
        "secret": BITMEX_API_SECRET,
        "nonce": lambda: time.time() * 1000, #  ← milliseconds nonce
    })
    balance = bitmex.privateGetUserWalletHistory()
    // JavaScript
    let bitmex = new ccxt.bitmex({
        "apiKey": BITMEX_API_KEY,
        "secret": BITMEX_API_SECRET,
        "nonce": Date.now, // ← milliseconds nonce
    })
    balance = bitmex.privateGetUserWalletHistory()
Read more comments on GitHub >

github_iconTop Results From Across the Web

Deprecation of api-nonce Header - BitMEX Blog
BitMEX will not check for increasing nonces as part of validation. The nonce scheme will still be valid for generating signatures used to ......
Read more >
API Keys Usage - BitMEX
... this document described an api-nonce value, which is a value that should increase between the bounds of 0 and 2 53. This...
Read more >
BitMEX Provides Snapshot Update to Bitcoin Proof of ...
In the summer of 2021, BitMEX provided a demonstration of a working Bitcoin Proof of Reserves and Proof of Liabilities system.
Read more >
The Mystery Of The Bitcoin Nonce Pattern - BitMEX Blog
Abstract: We note that the distribution of nonce values in the Bitcoin block header does not appear to be random, with unexplained gaps ......
Read more >
BitMEX API Explorer
All table data is available via the Websocket. We highly recommend using the socket if you want to have the quickest possible data...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found