Skip to content
Permalink
Browse files
Bitcoing and Gold API
  • Loading branch information
veleva committed Nov 29, 2018
1 parent 310f3bc commit 453b588a7c84c5cc5d123231ba0d2e59224e2d01
Showing 1 changed file with 25 additions and 0 deletions.
@@ -0,0 +1,25 @@
import requests
ui_bitcoin = ["bitcoin", "bitcoin price"]
ui_gold = ["gold", "gold price"]
bye = ["bye", "goodbye", ""]


def ui(enter):
for word in ui_bitcoin:
if enter.lower().strip() == word.lower().strip():
bit = requests.get('https://api.coindesk.com/v1/bpi/currentprice.json')
print ('₤' + bit.json()['bpi']['GBP']['rate'] + " For 1 BTC")
return bit
for worn in ui_gold:
if enter.lower().strip() == word.lower().strip():
gold = requests.get('http://gold-feed.com/paid/d7d6s6d66k4j4658e6d6cds638940e/all_metals_json_usd.php')
print ('₤' + (gold.json()['gold_londonfix_pm']) + " Per 10 grams of 14K gold")
for word in bye:
if enter.lower().strip() == word.lower().strip():
gbye = ("Thank you for using our service!")
print(gbye)
exit()
return gbye

while True:
ui(input("Please enter Bitcoin or Gold: "))

0 comments on commit 453b588

Please sign in to comment.