repetir todos los días

This commit is contained in:
2025-03-22 10:25:34 +01:00
parent 826d53d08b
commit 90de00cc22
2 changed files with 3 additions and 4 deletions

View File

@ -23,8 +23,8 @@ Base.metadata.create_all(bind=engine)
scheduler = BackgroundScheduler()
# Agregar tareas fijas
scheduler.add_job(search_from_keywords_file, "cron", hour=11, minute=0) # Ejecutar a las 11:00 AM
scheduler.add_job(search_from_keywords_file, "cron", hour=18, minute=0) # Ejecutar a las 6:00 PM
scheduler.add_job(search_from_keywords_file, "cron", hour=11, minute=0, day="*") # Ejecutar a las 11:00 AM
scheduler.add_job(search_from_keywords_file, "cron", hour=18, minute=0, day="*") # Ejecutar a las 6:00 PM
def cargar_tareas_desde_csv(indices):
@ -55,7 +55,7 @@ def cargar_tareas_desde_csv(indices):
for hora in range(horaInicio.hour, horaFin.hour + 1):
scheduler.add_job(
search_indice,
trigger=CronTrigger(hour=hora, minute=0),
trigger=CronTrigger(hour=hora, minute=0, day="*"),
args=[obj]
)
logging.info(f"✅ Tarea agregada para {nombre} a las {hora}:00")

View File

@ -217,7 +217,6 @@ def search_indice(indice):
soup = BeautifulSoup(response.content, 'html.parser')
# Buscar los valores dentro del HTML
chart_inner_title = soup.find("span", {"data-test": "chart-inner-title"})
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"})