Last active
June 8, 2020 10:50
-
-
Save iamvee/a247508c3fd0c71894a1b16c50782440 to your computer and use it in GitHub Desktop.
BTC and ETH prices
This file contains hidden or 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
import urllib.request | |
import json | |
import pprint | |
currencies = ["USD","EUR","IRR"] | |
coins = ["BTC","ETH"] | |
coins_str = ",".join(coins) | |
currencies_str = ",".join(currencies) | |
query = f"fsyms={coins_str}&tsyms={currencies_str}" | |
url = f"https://min-api.cryptocompare.com/data/pricemulti?{query}" | |
with urllib.request.urlopen(url) as req: | |
body = req.read().decode('utf-8') | |
data = json.loads(body) | |
pprint.pprint(data) |
This file contains hidden or 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
function prices() { | |
COINS="BTC,ETH" | |
CURRENCIES="USD,EUR,IRR" | |
URL="https://min-api.cryptocompare.com/data/pricemulti?fsyms=${COINS}&tsyms=${CURRENCIES}" | |
curl $URL -s | jq | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment