This commit is contained in:
parent
6bc851b03c
commit
3ce0685889
|
|
@ -1976,12 +1976,25 @@ class ScreenerPage(QWidget):
|
|||
self._status_lbl.setText(" Stopped.")
|
||||
|
||||
def _worker(self, settings, run_id, signals):
|
||||
import os as _os, traceback as _tb
|
||||
_log_path = _os.path.join(_os.environ.get("TEMP", _os.path.expanduser("~")), "screener_run.log")
|
||||
def _log(msg):
|
||||
try:
|
||||
with open(_log_path, "a", encoding="utf-8") as _f:
|
||||
from datetime import datetime as _dt
|
||||
_f.write(f"[{_dt.now().strftime('%H:%M:%S')}] {msg}\n")
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
_log("=== Run started ===")
|
||||
redirector = _StdoutRedirector(signals)
|
||||
old_stdout = sys.stdout
|
||||
sys.stdout = redirector
|
||||
try:
|
||||
signals.status.emit("Fetching ticker lists…")
|
||||
_log("collect_tickers start")
|
||||
tickers = collect_tickers(index=settings["index"])
|
||||
_log(f"collect_tickers done: {len(tickers)} tickers")
|
||||
if not tickers:
|
||||
signals.error.emit("Could not retrieve any ticker lists.")
|
||||
return
|
||||
|
|
@ -1990,7 +2003,9 @@ class ScreenerPage(QWidget):
|
|||
|
||||
sf = settings.get("screen_filters", {})
|
||||
signals.status.emit(f"Screening {len(tickers)} stocks…")
|
||||
_log("fetch_all start")
|
||||
df_raw = fetch_all(tickers, max_workers=settings["workers"], screen_filters=sf)
|
||||
_log(f"fetch_all done: {len(df_raw)} rows, empty={df_raw.empty}")
|
||||
|
||||
if self._stop_event.is_set():
|
||||
signals.stopped.emit(); return
|
||||
|
|
@ -2000,13 +2015,18 @@ class ScreenerPage(QWidget):
|
|||
|
||||
signals.status.emit("Loading sector stats…")
|
||||
sector_stats = _load_sector_stats()
|
||||
_log(f"sector_stats: {len(sector_stats)} sectors")
|
||||
signals.status.emit(f"Computing scores for {len(df_raw)} stocks…")
|
||||
df_scored = score_stocks(df_raw, weights=settings.get("weights"), sector_stats=sector_stats)
|
||||
_log(f"score_stocks done: {len(df_scored)} rows")
|
||||
signals.done.emit(df_raw, df_scored, sector_stats, len(df_scored))
|
||||
_log("done signal emitted")
|
||||
except Exception as exc:
|
||||
_log(f"EXCEPTION: {_tb.format_exc()}")
|
||||
signals.error.emit(str(exc))
|
||||
finally:
|
||||
sys.stdout = old_stdout
|
||||
_log("=== Run finished ===")
|
||||
|
||||
@Slot(int, int, int, int, float)
|
||||
def _on_progress(self, done, total, ok, skip, eta):
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ import requests
|
|||
# ---------------------------------------------------------------------------
|
||||
# Current app version — kept in sync by push_update.py before each build.
|
||||
# ---------------------------------------------------------------------------
|
||||
APP_VERSION = "1.4.4"
|
||||
APP_VERSION = "1.4.5"
|
||||
|
||||
|
||||
def _exe_dir() -> str:
|
||||
|
|
|
|||
Loading…
Reference in New Issue