Skip to content

Instantly share code, notes, and snippets.

@joonahn
Created January 3, 2018 02:11
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 joonahn/49f6d3864a837a63e82947dbf0714a12 to your computer and use it in GitHub Desktop.
Save joonahn/49f6d3864a837a63e82947dbf0714a12 to your computer and use it in GitHub Desktop.
Get price of ripple
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