-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconsulta_dicci.py
More file actions
53 lines (52 loc) · 2.54 KB
/
consulta_dicci.py
File metadata and controls
53 lines (52 loc) · 2.54 KB
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
46
47
48
49
50
51
52
from datetime import datetime
import requests
# Bitcoin(BTC) Cardano(ADA) Ethereum(Ether) Bitcoin cash(BCH) Litecoin(LTC)
# Stellar(XLM) Chainlink(LINK) EOS(IO.EOS) Ripple(XRP) Dash(DASH)
print("******************************************************")
print(" ************BIENVENIDOS************")
print("******************************************************")
print(" Ejemplo en consulta")
print(" _____________________________")
print(" BTC, BCC, LTC, ETH, ETC , XRP")
print("******************************************************")
def esmoneda(cripto):
return cripto in monedas
monedas = ()
monedas_dict = {}
COINMARKET_API_KEY = "fea42815-ebda-4b39-9a22-3e057beda67d"
headers = {
'Accepts': 'application/json',
'X-CMC_PRO_API_KEY': COINMARKET_API_KEY
}
data = requests.get(
"https://pro-api.coinmarketcap.com/v1/cryptocurrency/listings/latest", headers=headers).json()
for cripto in data["data"]:
monedas_dict[cripto["symbol"]] = cripto["name"]
monedas = monedas_dict.keys()
hora = datetime.now()
i = 0
while i < 3:
i += 1
moneda = input("Ingrese el nombre de la moneda:->>").upper()
while not esmoneda(moneda):
print("ERROR: Monedas Equivocada")
moneda = input("Ingrese el nombre de la Moneda:->>").upper()
else:
print(
"*******************************************************************************************")
print(" ************INFORME DE CONSULTA************")
print(
"*******************************************************************************************")
print(" Dia y hora, en la que se realizo la consulta")
print(" ______________________________________")
print(hora.strftime(" B%A %d/%B/%Y %I:%M:%S:%p"))
print(" ______________________________________")
print(
"*******************************************************************************************")
print(
"*******************************************************************************************")
print("La Moneda con Symbol:", moneda,
"y nombre:", monedas_dict.get(moneda),
"es valida porque existe en coimnmarketcap.com")
print(
"*******************************************************************************************")