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

1.3k Views Asked by At

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?

1

There are 1 best solutions below

0
On

May be this official link https://bybit-exchange.github.io/docs/v5/account/wallet-balance can help you.

My working code is

from pybit.unified_trading import HTTP

session = HTTP(
testnet=False,
api_key="...",
api_secret="...",)

print(session.get_wallet_balance(
accountType="SPOT",
coin="USDT",))'

And check permissions of API-key :)