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 api-nonce will not be supported after 12 March 2019.

See original GitHub issue
  • OS: Any
  • Programming Language version: Python version Any
  • CCXT version: latest
  • Exchange: BitMEX
  • Method: All of auth methods

Hi, BitMEX has announced that api-nonce will not be supported after 12 March 2019, in their blog.(Now in Korean and Japanese and Russian, not yet in English and Chinese.) https://blog.bitmex.com/?lang=ja

And in official doc, they wrote This scheme(nonce), while still supported, has significant problems with multithreaded clients and should not be used. Do not use it for new applications.

https://www.bitmex.com/app/apiKeysUsage#Authenticating-with-an-API-Key

So, I think that this Lib should support api-expires as default, and milliseconds() is preferred than seconds() to make expires. Please take care of the code below.

https://github.com/ccxt/ccxt/blob/master/python/ccxt/bitmex.py#L722-L735

            expires = self.safe_integer(self.options, 'api-expires')
            nonce = str(self.nonce())
            headers = {
                'Content-Type': 'application/json',
                'api-key': self.apiKey,
            }
            if expires is not None:
                expires = self.sum(self.seconds(), expires)
                expires = str(expires)
                auth += expires
                headers['api-expires'] = expires
            else:
                auth += nonce
                headers['api-nonce'] = nonce

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
kroitorcommented, Mar 5, 2019

In case someone needs to override it, this is how it’s done:

// JavaScript
const exchange = new ccxt.bitmex ({
    'options': {
        'api-expires': 10, // in seconds
    }
})
# Python
exchange = ccxt.bitmex({
    'options': {
        'api-expires': 10,  # in seconds
    }
})
// PHP
$id = 'bitmex';
$exchange = '\\ccxt\\' . $id;
$exchange = new $exchange (array (
    'options' => array (
        'api-expires' => 10, // in seconds
    )
));
1reaction
mazmex7commented, Mar 5, 2019

Hi, Thanks for your reply 🙂

seconds() is also OK, I suppose. BitMEX’s official implementation is here. 🙂 (+ 5 is important.) https://github.com/BitMEX/api-connectors/blob/master/official-http/python-swaggerpy/BitMEXAPIKeyAuthenticator.py#L30

I just care in case that same api-expires has sent by multi-threaded clients. (But still no problems, I think.)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Deprecation of api-nonce Header - BitMEX Blog
... the api-nonce header will no longer be supported starting on Tuesday 12th March 2019. BitMEX will not check for increasing nonces as ......
Read more >
BitMEX API Changelog
Dec 16, 2019. Order: Orders with a pegPriceType of LastPeg or MidPricePeg are no longer supported and will be rejected. Order ...
Read more >
Posts Archives | Page 43 of 116 | BitMEX Blog
BitMEX offers a variety of contract types. All contracts are bought and paid out in Bitcoin. BitMEX created the “Perpetual Contract”, a high...
Read more >
API Keys Usage - BitMEX
By default, API Keys can only read basic data, such as positions, margin, orders, and executions. They cannot submit orders or withdraw.
Read more >
Chinese (中文) Archives | Page 37 of 78 | BitMEX Blog
Full Catalogue ; 关于 2019 年第二季度季度期货上架. 12 Mar 2019 ; 关于不再支持 api-nonce 标头. 5 Mar 2019 ; 关于批量委托请求功能的更新. 15 Feb 2019 ; 有关...
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