Created
January 3, 2018 02:11
-
-
Save joonahn/49f6d3864a837a63e82947dbf0714a12 to your computer and use it in GitHub Desktop.
Get price of ripple
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
from urllib.request import urlopen, Request | |
from urllib.parse import urlencode | |
import json | |
import datetime | |
currency = 'xrp' | |
data = urlopen('https://api.coinone.co.kr/ticker/?currency=' + currency).read() | |
jsondata = json.loads(data) | |
time = datetime.datetime.fromtimestamp(int(jsondata["timestamp"])).strftime("%H:%M:%S") | |
lastprice = int(jsondata["last"]) | |
print("{} price @ {} is {:,}".format(currency, time, lastprice)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment