Skip to content

Instantly share code, notes, and snippets.

@changyeon
Created December 4, 2017 06:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save changyeon/adff8f907dc6f4fde94260c44e4c5538 to your computer and use it in GitHub Desktop.
Save changyeon/adff8f907dc6f4fde94260c44e4c5538 to your computer and use it in GitHub Desktop.
Get tickers from Bithumb exchange
#!/usr/bin/env python3
import sys
import time
import requests
def get_ticker_all(interval=60):
URL = 'https://api.bithumb.com/public/ticker/ALL'
while True:
price = requests.get(URL).json()['data']
price.pop('date')
for currency in ['BTC', 'BCH', 'XRP', 'ETH', 'ETC', 'QTUM', 'LTC', 'XMR', 'ZEC', 'DASH', 'BTG']:
coin_price = float(price[currency]['closing_price'])
print('%6s: %12.0f' % (currency, coin_price))
print()
time.sleep(interval)
if __name__ == "__main__":
if len(sys.argv) > 1:
interval = int(sys.argv[1])
else:
interval = 60
get_ticker_all(interval)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment