KronosForecaster
Kronos zero-shot forecaster for financial K-line/OHLC data.
Quickstart
from sktime.forecasting.kronos import KronosForecaster
estimator = KronosForecaster(model_path='NeoQuasar/Kronos-small', tokenizer_path='NeoQuasar/Kronos-Tokenizer-base', device='cpu', columns=None, freq='5min', start='2000-01-01', clip=5.0, predict_kwargs=None, deterministic=False)Parameters(9)
- model_pathstr, default=”NeoQuasar/Kronos-small”
Hugging Face repository identifier or local path for the Kronos model. The default is the Kronos-small checkpoint [4]. Other released checkpoints include Kronos-mini [3] and Kronos-base [5].
- tokenizer_pathstr, default=”NeoQuasar/Kronos-Tokenizer-base”
Hugging Face repository identifier or local path for the Kronos tokenizer. The default is the Kronos-Tokenizer-base checkpoint [6]. The released 2k tokenizer is also available [7].
- devicestr, default=”cpu”
- Device used for model and tokenizer inference.
- columnslist of str or None, default=None
Optional positional mapping from columns in
yto Kronos internal columns. Positions map to"open","high","low","close","volume", and"amount". If provided, at least the first four OHLC columns are required; volume and amount are optional. IfNone, literal open/high/low/close names are used when present, otherwise the first four numeric columns are used as OHLC. Literal volume/amount columns are used when present.- freqstr or pandas offset, default=”5min”
Frequency used to synthesize timestamps for Kronos when the training index is not a
pd.PeriodIndexorpd.DatetimeIndex. The default is five minutes because Kronos is designed for financial K-line/OHLC data, where five-minute intraday bars are a common default granularity.- startstr or pd.Timestamp, default=”2000-01-01”
Start timestamp used with
freqto synthesize timestamps for Kronos when the training index is not datetime-like. The default date is arbitrary; it provides deterministic calendar fields for Kronos while keeping the synthetic timestamp path independent of the original index.- clipfloat, default=5.0
Input normalization clipping value passed to
KronosPredictor.- predict_kwargsdict or None, default=None
Additional keyword arguments passed directly to
KronosPredictor.predict. Examples areT,top_k,top_p,sample_count, andverbose.- deterministicbool, default=False
- Whether predictions should reset the PyTorch random seed before autoregressive sampling.
Examples
>>> import pandas as pd
>>> from sktime.forecasting.base import ForecastingHorizon
>>> from sktime.forecasting.kronos import KronosForecaster
>>> url = (
... "https://raw.githubusercontent.com/shiyu-coder/Kronos/"
... "refs/heads/master/tests/data/regression_input.csv"
... )
>>> df = pd. read_csv (
... url,
... parse_dates = ["timestamps" ],
... index_col = "timestamps",
... )
>>> lookback, pred_len = 400, 120
>>> y = df. iloc [: lookback ]
>>> fh = ForecastingHorizon (
... df. index [lookback: lookback + pred_len ],
... is_relative = False,
... )
>>> forecaster = KronosForecaster (
... model_path = "NeoQuasar/Kronos-small",
... tokenizer_path = "NeoQuasar/Kronos-Tokenizer-base",
... device = "cpu",
... deterministic = True,
... predict_kwargs = {
... "T": 1.0,
... "top_p": 0.9,
... "sample_count": 1,
... "verbose": True,
... },
... )
>>> y_pred = forecaster. fit (y). predict (fh = fh)References
- [1 ] Kronos GitHub repository: https://github.com/shiyu-coder/Kronos [2 ] Lin, Z., Xia, Y., Liu, Z., Zhang, S., Wang, J., Yang, C., Dong, Q., Liu, H., Jiang, H., Wang, S., Xiong, X., and Zhao, B. (2025). Kronos: A Foundation Model for the Language of Financial Markets. arXiv. https://arxiv.org/abs/2508.02739 [3 ] Kronos-mini model card: https://huggingface.co/NeoQuasar/Kronos-mini [4 ] Kronos-small model card: https://huggingface.co/NeoQuasar/Kronos-small [5 ] Kronos-base model card: https://huggingface.co/NeoQuasar/Kronos-base [6 ] Kronos-Tokenizer-base model card: https://huggingface.co/NeoQuasar/Kronos-Tokenizer-base [7 ] Kronos-Tokenizer-2k model card: https://huggingface.co/NeoQuasar/Kronos-Tokenizer-2k