Advertisement
Guest User

Litecoin Ticker (GBP)

a guest
Jul 19th, 2018
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.36 KB | None | 0 0
  1. #!/usr/bin/env python3
  2.  
  3. import requests
  4. import time
  5. import json
  6.  
  7. def getLitecoinPrice():
  8.     apiUrl = 'https://api.coinmarketcap.com/v1/ticker/litecoin/?convert=GBP'
  9.  
  10.     jsonData = requests.get(apiUrl).json()
  11.  
  12.     ltcPriceRaw = float(jsonData[0]['price_gbp'])
  13.  
  14.     ltcPrice = round(ltcPriceRaw, 2)
  15.  
  16.     return ltcPrice
  17.  
  18. print(str(getLitecoinPrice()))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement