no transformacion texto

This commit is contained in:
2025-03-16 19:28:11 +01:00
parent 98e7780f71
commit 70d48cc84f
2 changed files with 9 additions and 8 deletions

View File

@ -220,12 +220,13 @@ 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"})
if price and price_change and price_change_percent:
data = {
"indice": indice,
"valorActual": float(price.text.replace(",", "").strip()), # Convertir a número
"cambio": float(price_change.text.replace(",", "").strip()), # Convertir a número
"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()
}