Favicon of Kronos

Kronos

Kronos is an open-source foundation model pre-trained on K-line data from 45+ exchanges for forecasting financial candlesticks.

Kronos website screenshot
Kronos GitHub repository preview

Kronos is a decoder-only foundation model built specifically for K-line (OHLCV candlestick) sequences rather than general time series. It's aimed at quant researchers, traders, and ML engineers who want to forecast price and volume behavior using a pre-trained model instead of building a forecasting pipeline from scratch. The model was pre-trained on data from over 45 global exchanges and is distributed as a family of checkpoints on Hugging Face, with code to run inference and finetune on your own data.

The core design uses a two-stage approach: a specialized tokenizer quantizes continuous, multi-dimensional OHLCV data into hierarchical discrete tokens, and an autoregressive Transformer is pre-trained on those tokens. This lets the same architecture serve as a general model for various quantitative finance tasks, rather than a narrow single-purpose predictor.

Key features

  • Domain-specific tokenizer: converts raw OHLCV candlestick data into hierarchical discrete tokens instead of treating price series as generic numeric sequences.
  • Model zoo with multiple sizes: Kronos-mini (4.1M params, 2048 context), Kronos-small (24.7M params), and Kronos-base (102.3M params) are open-sourced on Hugging Face; a larger Kronos-large (499.2M params) exists but isn't public.
  • Probabilistic forecasting: the predict method supports temperature (T), nucleus sampling (top_p), and multi-sample averaging (sample_count) for generating forecast distributions, not just point estimates.
  • Batch prediction: predict_batch runs forecasts for multiple series in parallel on GPU, useful when scoring many assets at once.
  • Finetuning pipeline: scripts to finetune both the tokenizer and predictor on your own data, with an example workflow using Qlib and A-share market data, including a backtest step.
  • Live demo: a hosted demo shows 24-hour BTC/USDT forecasts to preview model output before installing anything.

Ideal use cases

Kronos fits research and prototyping around price/volume forecasting: generating forecast signals for backtesting, exploring foundation-model approaches to K-line data, or finetuning on a specific market (equities, crypto, futures) using your own historical data. It's a reasonable starting point if you want a pre-trained baseline instead of training a time-series model from zero.

It is not a production trading system. The README explicitly flags the included finetuning/backtest pipeline as a simplified demonstration, not a robust quant strategy: it lacks portfolio optimization, risk-factor neutralization, transaction cost modeling, and slippage handling. If you need a deployable trading strategy, treat Kronos's output as a raw signal that still requires a proper strategy and risk layer on top. It's also not designed for general (non-financial) time-series forecasting, since the tokenizer and pre-training are specific to candlestick data.

Installation

Kronos requires Python 3.10+ and standard pip-based setup.

pip install -r requirements.txt

Load a pre-trained model and tokenizer directly from Hugging Face Hub:

from model import Kronos, KronosTokenizer, KronosPredictor

tokenizer = KronosTokenizer.from_pretrained("NeoQuasar/Kronos-Tokenizer-base")
model = Kronos.from_pretrained("NeoQuasar/Kronos-small")

predictor = KronosPredictor(model, tokenizer, max_context=512)

Prepare a pandas DataFrame with open, high, low, close columns (volume and amount are optional), plus timestamp series for the historical window and the future periods to predict, then call predictor.predict(...). A full runnable example, including plotting, is in examples/prediction_example.py.

For finetuning on your own data, install pyqlib, set up your Qlib data directory, edit paths and hyperparameters in finetune/config.py, then run the pipeline in order:

pip install pyqlib
python finetune/qlib_data_preprocess.py
torchrun --standalone --nproc_per_node=NUM_GPUS finetune/train_tokenizer.py
torchrun --standalone --nproc_per_node=NUM_GPUS finetune/train_predictor.py
python finetune/qlib_test.py --device cuda:0

This produces a finetuned tokenizer, a finetuned predictor, and a backtest report comparing a simple top-K strategy against a benchmark.

Frequently asked questions

Share:

Stars
33.8K
Forks
5.7K
Last commit
3 months ago
Repository age
1 year
License
MIT
Self-hosted
No
Activity score
81/100
View Repository
Built with:
Ad
Favicon

 

  
 

Similar to Kronos

Favicon

 

  
 
Favicon

 

  
 
Favicon