Skip to content

Commit 3ddd1fd

Browse files
committed
NaN serialization (kronos_client.py:100): Drop rows where OHLC is NaN before serializing to JSON. yfinance returns NaN for gaps/halts/thin tickers — float(nan) isn't valid JSON.
huggingface_hub missing (uv.lock): The package was in pyproject.toml but the lock file was never regenerated. Ran uv lock — it's now pinned at 1.10.1. Without this, the Space can't be paused after the job runs
1 parent 3e87e53 commit 3ddd1fd

2 files changed

Lines changed: 138 additions & 1 deletion

File tree

tradingbot/utils/kronos_client.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,12 @@ def predict(
9797
)
9898
return None
9999

100+
# Drop rows with NaN in OHLC columns (yfinance gaps, delisted periods, etc.)
101+
df = df.dropna(subset=["open", "high", "low", "close"])
102+
if len(df) < 50:
103+
logger.warning(f"KronosClient: too many NaN rows for {symbol}, only {len(df)} clean rows after drop")
104+
return None
105+
100106
# Serialise to JSON-friendly list of records
101107
ohlcv_rows = []
102108
for _, row in df.iterrows():

uv.lock

Lines changed: 132 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)