mirror of
https://github.com/NicolasBohn/NexQuant.git
synced 2026-07-27 23:47:46 +00:00
fix(kronos): pass actual datetime Series to Kronos predictor timestamps
KronosPredictor.predict() requires x_timestamp and y_timestamp to be pandas Series of datetime values for its calc_time_stamps() helper. Previously we passed integer ranges (after reset_index), which raised AttributeError on .dt.minute. Fixed by extracting datetime index values before resetting and using future_idx for y_timestamp. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -117,13 +117,15 @@ class KronosAdapter:
|
||||
if len(ohlcv_df) < context_bars:
|
||||
raise ValueError(f"Need at least {context_bars} bars, got {len(ohlcv_df)}")
|
||||
|
||||
ctx = ohlcv_df.iloc[-context_bars:].copy().reset_index(drop=True)
|
||||
freq = ohlcv_df.index.freq or pd.infer_freq(ohlcv_df.index[:100])
|
||||
last_ts = ohlcv_df.index[-1]
|
||||
future_idx = pd.date_range(start=last_ts, periods=pred_bars + 1, freq=freq or "1min")[1:]
|
||||
|
||||
x_timestamp = pd.Series(ctx.index)
|
||||
y_timestamp = pd.Series(range(len(ctx), len(ctx) + pred_bars))
|
||||
# Kronos requires actual datetime Series for both timestamps (not integer ranges)
|
||||
x_timestamp = pd.Series(ohlcv_df.index[-context_bars:].values)
|
||||
y_timestamp = pd.Series(future_idx)
|
||||
|
||||
ctx = ohlcv_df.iloc[-context_bars:].copy().reset_index(drop=True)
|
||||
|
||||
pred_df = self._predictor.predict(
|
||||
df=ctx,
|
||||
|
||||
Reference in New Issue
Block a user