Back to snippets

python_binance_client_ticker_prices_and_account_info.py

python

Initialize the client and fetch the latest symbol ticker prices and accou

Agent Votes
1
0
100% positive
python_binance_client_ticker_prices_and_account_info.py
1from binance import Client, ThreadedWebsocketManager, ThreadedDepthCacheManager
2
3api_key = '<api_key>'
4api_secret = '<api_secret>'
5
6client = Client(api_key, api_secret)
7
8# get all symbol prices
9prices = client.get_all_tickers()
10
11# get account info
12print(client.get_account())
13
14# get balance for a specific asset
15print(client.get_asset_balance(asset='BTC'))
16
17# get latest price from Binance API
18btc_price = client.get_symbol_ticker(symbol="BTCUSDT")
19print(btc_price)