Skip to content

Instantly share code, notes, and snippets.

@ozment
Last active February 6, 2021 20:59
Show Gist options
  • Save ozment/d3a9126c3512d2b8bbaa79e009b28b26 to your computer and use it in GitHub Desktop.
Save ozment/d3a9126c3512d2b8bbaa79e009b28b26 to your computer and use it in GitHub Desktop.
BTC PRICE NABBER via Bitstamp API
# python3
# @ozment
# uses Bitstamps API to retrieve current price per BTC
import json
from urllib.request import urlopen
def dagnabtc(btc):
fiat = float(json.loads(urlopen('https://www.bitstamp.net/api/ticker/').read())['last'])
if btc > 0:
# priceless = float(json.loads(urlopen('https://www.bitstamp.net/api/ticker/').read())['last'])
# print(priceless)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment