This commit is contained in:
2025-03-16 22:29:23 +01:00
parent 13b68876aa
commit daed79d060
2 changed files with 5 additions and 5 deletions

View File

@ -220,14 +220,14 @@ def search_indice(indice):
price = soup.find("div", {"data-test": "instrument-price-last"})
price_change = soup.find("span", {"data-test": "instrument-price-change"})
price_change_percent = soup.find("span", {"data-test": "instrument-price-change-percent"})
porcentaje = price_change_percent.text.strip().replace("(", "").replace(")", "").replace("%", "")
if price and price_change and price_change_percent:
data = {
"indice": indice,
"valorActual": price.text.replace(",", "").strip(), # Convertir a número
"cambio": price_change.text.replace(",", "").strip(), # Convertir a número
"porcentaje": price_change_percent.text.strip().replace("(", "").replace(")", "") # Eliminar paréntesis
"porcentaje": porcentaje # Eliminar paréntesis
}
logging.info(data)
# Enviar los datos al bot de Telegram