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()
}

View File

@ -2,8 +2,8 @@ package es.imunnic.inversionitasBot;
public class IndiceRequest {
private String indice;
private double valorActual;
private double cambio; // Nuevo campo agregado
private String valorActual;
private String cambio; // Nuevo campo agregado
private String porcentaje;
// Getters y Setters
@ -15,19 +15,19 @@ public class IndiceRequest {
this.indice = indice;
}
public double getValorActual() {
public String getValorActual() {
return valorActual;
}
public void setValorActual(double valorActual) {
public void setValorActual(String valorActual) {
this.valorActual = valorActual;
}
public double getCambio() {
public String getCambio() {
return cambio;
}
public void setCambio(double cambio) {
public void setCambio(String cambio) {
this.cambio = cambio;
}