Skip to content

Instantly share code, notes, and snippets.

@lvthillo
Last active January 13, 2021 19:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lvthillo/08aa0c870e368a09eec0c416ebb3686c to your computer and use it in GitHub Desktop.
Save lvthillo/08aa0c870e368a09eec0c416ebb3686c to your computer and use it in GitHub Desktop.
# stock_data contains historical data of ETH/BTC with a period of 1 hhour
# the volume is calculated by using historical data
# run this as close to each 1h interval (e.g. 7.59h or 9.59m)
last_items = stock_data.tail(24)
print(last_items)
day_volume_self_calculated = last_items['volume'].sum()
print(day_volume_self_calculated)
# better way to do it
ticker = exchange.fetch_ticker(coin_pair)
day_volume = ticker["baseVolume"]
print(day_volume)
# quote volume (expressed in BTC value)
day_volume_in_btc = ticker["quoteVolume"]
print(day_volume_in_btc)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment