verata-veritatis / pybit

Python3 API connector for Bybit's HTTP and Websockets APIs.
MIT License
117 stars 193 forks source link

session.get_wallet_balance #44

Closed MrPDR1 closed 3 years ago

MrPDR1 commented 3 years ago

Hi! Thank you for alle the work in this project.

I am not quite sure how to use the endpoints right, i assume that any endpoint, such as get_wallet_balance() requires the "session." as a prefix? If so, I do not understand how the use the parameters "self" and "kwargs". For instance, session.get_wallet_balance() returns the same bunch of data as session.get_wallet_balance (symbol='BTCUSD', kwargs='equity'). Is it possible to restrict the output to relevant information and how is the "self" and "kwargs" parameter meant to be used. Do you have an example?

Kind regards

Paul

verata-veritatis commented 3 years ago

Hi Paul,

The kwargs argument is used to pass multiple parameters that are request by Bybit. I recommend you read more about the usage of * in Python, like in *kwargs. kwargs will be a dictionary that is decomposed. You wouldn't define kwargs yourself, you would just pass all the params instead. For example:

wallet_response = session.get_wallet_balance(coin='BTC') 
ticker_response = session.query_kline(symbol='BTCUSD', interval=5, limit=100)

With that said, you aren't able to filter for a specific part of the response if Bybit doesn't allow for it. You need to receive the response and grab the data you need yourself.