bybit-exchange / pybit

Official Python3 API connector for Bybit's HTTP and WebSockets APIs.
Other
385 stars 129 forks source link

FailedRequestError pybit #140

Closed sssyrbu closed 3 months ago

sssyrbu commented 1 year ago

I have an issue with Python's Pybit module. I'm trying to get my wallet balance but I get the following error:

pybit.exceptions.FailedRequestError: Http status code is not 200. (ErrCode: 404) (ErrTime: 07:32:08)

My code:

from pybit.unified_trading import HTTP

# API credentials
api_key = 'xxx' 
secret_key = 'xxx'

session = HTTP(
    testnet=True,
    api_key=api_key,
    api_secret=secret_key,
)

print(session.get_wallet_balance(
    accountType="UNIFIED",
    coin="BTC",
))

What should I do? I’m using Python 3.11

andreas778 commented 1 year ago

same problem, I’m using Python 3.9.1

dextertd commented 1 year ago

This happens when you specify an accountType you don't have, so if you send UNIFIED that means you're account is not unified. Bybit is going to improve the error handling for this case.

IsaTTeN commented 1 year ago

same problem here, even if I'm not using accountType I get an error. Did you manage to get the balance?

leoxama commented 1 year ago

I've got the same issue. Has anyone found a solution?

dextertd commented 1 year ago

Please note that accounType is a required parameter and you must pass the correct value to it. Otherwise, you will face this error. Please provide the request you sent if you still face this error.

https://bybit-exchange.github.io/docs/v5/account/wallet-balance

jaekyung-you commented 10 months ago

I solved it! If you set up 'testnet=True', you have to use "Testnet" API Key and API Secret. https://testnet.bybit.com/en/ -> you should get api key and secret on this website