Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bitmex fetch_balance Signature not valid #12651

Closed
jl2035 opened this issue Apr 6, 2022 · 2 comments
Closed

Bitmex fetch_balance Signature not valid #12651

jl2035 opened this issue Apr 6, 2022 · 2 comments
Assignees

Comments

@jl2035
Copy link

jl2035 commented Apr 6, 2022

Similar issue here: #4279
...so this might be a duplicate but the fix they did does not affect me.

Output of ccxt.version:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-5-91cb1fe60dcf> in <module>
----> 1 ccxt.version

AttributeError: module 'ccxt' has no attribute 'version'
  • OS: Ubuntu 20.04.4
  • Programming Language version: Python 3.7.3, ipython 7.28.0
  • CCXT version: 1.56.63 (taken from lib/python3.7/site-packages/ccxt/init.py)
exchange = exchange_class({
    'apiKey': self.api_key,
    'secret': self.api_secret,
    'timeout': 30000,
    'enableRateLimit': True,
    'urls': {
        'api': {
            'public': exhange_api_url,
            'private': exhange_api_url, 
        },
    },
    'options': {
        'fetchOHLCVOpenTimestamp': False,
    },
})


symbol='BTC/USD'
btc_price_symbol='.BXBT'
last_price_response = exchange.public_get_instrument({'symbol': btc_price_symbol,'columns':'lastPrice'})
last_price = float(last_price_response[0]['lastPrice'])
current_btc_price = last_price
time.sleep(1)
keys = exchange.privateGetApiKey()
time.sleep(1)
balance = exchange.fetch_balance()

The code crashes at fetch_balance(). This works on testnet, but not on real exchange. The output is:

bitmex {"error":{"message":"Signature not valid.","name":"HTTPError"}}

I've already asked the bitmex support but they were useless. No help whatsoever.

@carlosmiei carlosmiei self-assigned this Apr 6, 2022
@carlosmiei
Copy link
Collaborator

Hello @jl2035, I've checked and seems to be working fine on my end so I'd suggest double-checking your API keys, which is the most likely reason as it was in #4279.

Also I've noticed you're overriding the public and private API URL

    'urls': {
        'api': {
            'public': exhange_api_url,
            'private': exhange_api_url, 
        },
    },

that can be a reason too so I'd confirm that as well.

Thank you

@jl2035
Copy link
Author

jl2035 commented Apr 6, 2022

Interesting. If I don't override the urls it's all working fine. Thanks.

exchange = exchange_class({
    'apiKey': self.api_key,
    'secret': self.api_secret,
    'timeout': 30000,
    'enableRateLimit': True,
    #'urls': {
    #    'api': {
    #        'public': exhange_api_url,
    #        'private': exhange_api_url, 
    #    },
    #},
    'options': {
        'fetchOHLCVOpenTimestamp': False,
    },
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants