Created
December 4, 2017 06:48
-
-
Save changyeon/adff8f907dc6f4fde94260c44e4c5538 to your computer and use it in GitHub Desktop.
Get tickers from Bithumb exchange
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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