-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkripto.py
45 lines (30 loc) · 1.03 KB
/
kripto.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
symbols = [["bitcoin","BTC"],
["ethereum","ETH"],
["tether","USDT"],
["cardano","ADA"],
["ripple","XRP"],
["solana","SOL"],
["polkadot","DOT"],
["dogecoin","DOGE"],
["dai","DAI"],
["monero","XMR"],
["litecoin","LTC"],
["algorand","ALGO"],
["tezos","XTZ"],
["iota","MIOTA"],
["eos","EOS"],
["zcash","ZEC"],
["nano","XNO"],
]
import requests
def get_current_data(from_sym='BTC', to_sym='USD', exchange=''):
url = 'https://min-api.cryptocompare.com/data/price'
parameters = {'fsym': from_sym,
'tsyms': to_sym }
if exchange:
print('exchange: ', exchange)
parameters['e'] = exchange
# response comes as json
response = requests.get(url, params=parameters)
data = response.json()
return data