forked from spignelon/virtual-assistant
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcrypto.py
More file actions
38 lines (32 loc) · 950 Bytes
/
Copy pathcrypto.py
File metadata and controls
38 lines (32 loc) · 950 Bytes
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
# Import libraries
import json
import requests
# Defining Binance API URL
key = "https://api.binance.com/api/v3/ticker/price?symbol="
# Making list for multiple crypto's
currencies = ["BTCUSDT", "DOGEUSDT", "LTCUSDT"]
j = 0
# running loop to print all crypto prices
for i in currencies:
# completing API for request
url = key + currencies[j]
data = requests.get(url)
data = data.json()
j = j + 1
print(f"{data['symbol']} price is {data['price']}")
# Import libraries
import json
import requests
# Defining Binance API URL
key = "https://api.binance.com/api/v3/ticker/price?symbol="
# Making list for multiple crypto's
currencies = ["BTCUSDT", "DOGEUSDT", "LTCUSDT"]
j = 0
# running loop to print all crypto prices
for i in currencies:
# completing API for request
url = key + currencies[j]
data = requests.get(url)
data = data.json()
j = j + 1
print(f"{data['symbol']} price is {data['price']}")