-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlista_v2.py
More file actions
62 lines (62 loc) · 2.73 KB
/
lista_v2.py
File metadata and controls
62 lines (62 loc) · 2.73 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
53
54
55
56
57
58
59
60
61
62
from datetime import datetime
import requests
_ENDPOINT = "https://api.binance.com"
# 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(" Moneda disponibles en consulta")
print(" _____________________________")
print(" BTC, BCC, LTC, ETH, ETC , XRP")
print("******************************************************")
def _url(api):
return _ENDPOINT+api
def get_price(cripto):
return requests.get(_url("/api/v3/ticker/price?symbol="+cripto))
def esmoneda(cripto):
criptos=["BTC","BCC","LTC","ETH","ETC","XRP"]
return cripto in criptos
def esnumero(numero):
return numero.replace('.','',1).isdigit()
monedas=[]
cantidades=[]
cotizaciones=[]
i=0
while i<3:
moneda=input("Ingrese el Nombre de Moneda:->>").upper()
while not esmoneda(moneda):
print("ERROR: Monedas permitidas BTC, BCC, LTC, ETH, ETC, XRP o LTC")
moneda=input("Ingrese el Nombre de Moneda:->>").upper()
else:
monedas.append(moneda)
data=get_price(moneda+"USDT").json()
cotizaciones.append(float(data["price"]))
cantidad=input("Indique la cantidad de ("+moneda+"):->>")
while not esnumero(cantidad):
cantidad = input("Indique la cantidad de ("+moneda+"):->>")
else:
cantidades.append(float(cantidad))
i+=1
hora = datetime.now()
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("******************************************************************************")
i=0
total=0
while i<3:
total+=cantidades[i]*cotizaciones[i]
print("MONEDA: ",monedas[i],
"CANTIDAD: ",cantidades[i],
"COTIZACIÓN: ",cotizaciones[i],
"Cantidad de USDT: ",cantidades[i]*cotizaciones[i])
i+=1
print("******************************************************************************")
print("El saldo total en dolares americanos es :->>USD$"+str(total))
print("******************************************************************************")
print("")