简体   繁体   中英

How to get volume value from binance.com with binance python api

I need to get volume value from binance.com with binance python api

I tried a get klines function of the api and it returns dict. There is volume key in the dict but its not looking like the value I want.

from binance.client import Client


api_key = 
api_secret = 

client = Client(api_key, api_secret)

tickers = client.get_ticker()

get_tickers function returns a list of dicts and in every dict there is volume key but I dont understand which one is the latest volume value like in the binance.com main page

The value I need is in this screenshot

This code will help you to get what you need

from binance.client import Client
api_key = 
api_secret = 
client = Client(api_key, api_secret)
tickers = client.get_ticker() #This will give you a list containing 24 hour price change statistics.
volume=float(tickers[0]['volume']) #this will give you the 24h volume of ETH/BTC

Source: Get 24hr Ticker

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM