Kronos is the first open-source foundation model for financial candlesticks (K-lines), trained on data from over 45 global exchanges. Built by Yu Shi and team, it treats financial market data as a language—using a specialized tokenizer to quantize OHLCV (Open, High, Low, Close, Volume) data into hierarchical discrete tokens, then training autoregressive Transformers for forecasting.
Accepted at AAAI 2026, Kronos has 23.3k GitHub stars and offers a family of models from 4.1M to 499.2M parameters, a live demo on Hugging Face, and a complete finetuning pipeline with Qlib integration for quantitative trading workflows.
Primary sources
- Repository: github.com/shiyu-coder/Kronos
- Paper: arXiv:2508.02739 — "Kronos: A Foundation Model for the Language of Financial Markets"
- Live demo: Hugging Face Spaces
- Models: Hugging Face - NeoQuasar
- License: MIT
TL;DR
| Topic | Details |
|---|---|
| What it is | First open-source foundation model for financial K-lines (candlesticks) |
| Training data | 45+ global exchanges (crypto, stocks, commodities) |
| Architecture | Decoder-only Transformer with specialized tokenizer for OHLCV data |
| Model family | Mini (4.1M), Small (24.7M), Base (102.3M), Large (499.2M params) |
| Context length | 2048 (mini), 512 (small/base/large) |
| Conference | Accepted at AAAI 2026 |
| Finetuning | Complete pipeline with Qlib integration for quantitative trading |
| Batch prediction | Parallel forecasting on multiple time series via predict_batch |
| GitHub stats | 23.3k stars, 4.1k forks, 18 contributors, MIT license |
Why Kronos matters: financial data as a language
Most time series foundation models (TSFMs) are built for general-purpose forecasting—weather, traffic, energy demand. They struggle with financial data because markets are uniquely noisy, non-stationary, and adversarial (other traders are also using models).
Kronos takes a different approach: it treats K-line sequences as a language.
Instead of feeding continuous OHLCV values directly into a model, Kronos:
- Quantizes multi-dimensional K-line data into hierarchical discrete tokens using a specialized tokenizer (Kronos-Tokenizer)
- Trains a large autoregressive Transformer on these tokens (like GPT, but for financial data)
- Generates forecasts by sampling from the token distribution, then de-quantizing back to OHLCV values
This design handles high-noise financial data better than continuous regression models.
Model zoo: four sizes from mini to large
Kronos offers a family of models with varying capacities. All models are accessible from Hugging Face Hub.
| Model | Tokenizer | Context length | Params | Open-source | Hugging Face |
|---|---|---|---|---|---|
| Kronos-mini | Kronos-Tokenizer-2k | 2048 | 4.1M | ✅ | NeoQuasar/Kronos-mini |
| Kronos-small | Kronos-Tokenizer-base | 512 | 24.7M | ✅ | NeoQuasar/Kronos-small |
| Kronos-base | Kronos-Tokenizer-base | 512 | 102.3M | ✅ | NeoQuasar/Kronos-base |
| Kronos-large | Kronos-Tokenizer-base | 512 | 499.2M | ❌ | Not yet released |
Context length notes:
- Kronos-mini supports 2048 tokens (longer lookback windows)
- Small/base/large use 512 tokens (recommended max input length)
KronosPredictorautomatically truncates longer contexts
Getting started: installation and first forecast
Installation
git clone https://github.com/shiyu-coder/Kronos.git
cd Kronos
pip install -r requirements.txt
Making your first forecast
Kronos uses the KronosPredictor class to handle:
- Data preprocessing
- Normalization
- Prediction
- Inverse normalization
Step 1: Load tokenizer and model
from model import Kronos, KronosTokenizer, KronosPredictor
# Load from Hugging Face Hub
tokenizer = KronosTokenizer.from_pretrained("NeoQuasar/Kronos-Tokenizer-base")
model = Kronos.from_pretrained("NeoQuasar/Kronos-small")
Step 2: Initialize predictor
# Initialize the predictor
predictor = KronosPredictor(model, tokenizer, max_context=512)
Step 3: Prepare input data
The predict method requires:
df- pandas DataFrame with columns['open', 'high', 'low', 'close'](required)volumeandamountare optional
x_timestamp- pandas Series of timestamps for historical datay_timestamp- pandas Series of timestamps for future periods to predict
import pandas as pd
# Load your data
df = pd.read_csv("./data/XSHG_5min_600977.csv")
df['timestamps'] = pd.to_datetime(df['timestamps'])
# Define context window and prediction length
lookback = 400
pred_len = 120
# Prepare inputs
x_df = df.loc[:lookback-1, ['open', 'high', 'low', 'close', 'volume', 'amount']]
x_timestamp = df.loc[:lookback-1, 'timestamps']
y_timestamp = df.loc[lookback:lookback+pred_len-1, 'timestamps']
Step 4: Generate forecasts
# Generate predictions
pred_df = predictor.predict(
df=x_df,
x_timestamp=x_timestamp,
y_timestamp=y_timestamp,
pred_len=pred_len,
T=1.0, # Temperature for sampling
top_p=0.9, # Nucleus sampling probability
sample_count=1 # Number of forecast paths to generate and average
)
print("Forecasted Data Head:")
print(pred_df.head())
The predict method returns a pandas DataFrame with forecasted values for open, high, low, close, volume, and amount, indexed by y_timestamp.
Full example: See examples/prediction_example.py for a complete script with visualization.
Prediction without volume/amount: See examples/prediction_wo_vol_example.py if your data lacks volume or amount columns.
Batch prediction: parallel forecasting for multiple assets
For efficient processing of multiple time series, Kronos provides a predict_batch method that enables parallel prediction on multiple datasets simultaneously.
Use case: Forecasting multiple stocks, crypto pairs, or commodities at once.
# Prepare multiple datasets
df_list = [df1, df2, df3]
x_timestamp_list = [x_ts1, x_ts2, x_ts3]
y_timestamp_list = [y_ts1, y_ts2, y_ts3]
# Generate batch predictions
pred_df_list = predictor.predict_batch(
df_list=df_list,
x_timestamp_list=x_timestamp_list,
y_timestamp_list=y_timestamp_list,
pred_len=pred_len,
T=1.0,
top_p=0.9,
sample_count=1,
verbose=True
)
# Results in same order as input
for i, pred_df in enumerate(pred_df_list):
print(f"Predictions for series {i}:")
print(pred_df.head())
Requirements for batch prediction:
- Same historical length (lookback window) for all series
- Same prediction length (
pred_len) for all series - Each DataFrame must contain
['open', 'high', 'low', 'close'] volumeandamountare optional (filled with zeros if missing)
Performance: The method leverages GPU parallelism for efficient processing and automatically handles normalization/denormalization for each series independently.
Live demo: BTC/USDT 24-hour forecast
Kronos has a live demo on Hugging Face Spaces that visualizes forecasting results for BTC/USDT over the next 24 hours.
Access the demo: Hugging Face Spaces - Kronos Live Demo
The demo showcases:
- Real-time data fetching
- Model inference
- Interactive candlestick chart visualization
- Forecast confidence intervals
Finetuning on your own data: A-share market example
Kronos provides a complete finetuning pipeline for adapting the model to your own datasets. The example uses Qlib (quantitative investment library) to prepare data from the Chinese A-share market and conduct a simple backtest.
Disclaimer: This pipeline is a demonstration, not a production-ready quantitative trading system. Robust strategies require portfolio optimization and risk factor neutralization to achieve stable alpha.
Finetuning workflow (4 steps)
Prerequisites:
- Install dependencies from
requirements.txt - Install Qlib:
pip install pyqlib - Download Qlib data following the official guide
Step 1: Configure your experiment
Edit finetune/config.py to set:
qlib_data_path- Path to your local Qlib datadataset_path- Where processed train/val/test pickle files will be savedsave_path- Base directory for model checkpointsbacktest_result_path- Directory for backtest resultspretrained_tokenizer_path,pretrained_predictor_path- Pre-trained models to start from- Other hyperparameters:
instrument,train_time_range,epochs,batch_size
Step 2: Prepare the dataset
python finetune/qlib_data_preprocess.py
This creates train_data.pkl, val_data.pkl, and test_data.pkl in dataset_path.
Step 3: Finetune the models
3.1 Finetune the tokenizer (adjusts to your data distribution):
# Replace NUM_GPUS with number of GPUs (e.g., 2)
torchrun --standalone --nproc_per_node=NUM_GPUS finetune/train_tokenizer.py
3.2 Finetune the predictor (main forecasting model):
torchrun --standalone --nproc_per_node=NUM_GPUS finetune/train_predictor.py
Best checkpoints saved to paths configured in config.py.
Step 4: Evaluate with backtesting
# Specify GPU for inference
python finetune/qlib_test.py --device cuda:0
This outputs:
- Performance analysis in console
- Cumulative return plot comparing strategy vs benchmark
From demo to production: important considerations
The finetuning example is intentionally simplified for demonstration. Production-level quantitative trading requires:
1. Raw signals vs. pure alpha
The model generates raw predictions. In real-world quant workflows, these signals are fed into a portfolio optimization model that:
- Applies constraints to neutralize common risk factors (market beta, size, value, momentum)
- Isolates "pure alpha" (skill-based returns uncorrelated with market)
- Improves robustness and Sharpe ratio
2. Data handling
The provided QlibDataset is an example. For different data sources (Bloomberg, Reuters, proprietary feeds), adapt:
- Data loading logic
- Feature engineering
- Normalization methods
3. Strategy complexity
The simple top-K strategy (buy top K predicted stocks) is a starting point. Production strategies incorporate:
- Dynamic position sizing based on signal strength and volatility
- Stop-loss / take-profit rules
- Rebalancing frequency optimization
- Transaction cost modeling (commissions, slippage, market impact)
4. Backtest fidelity
A high-fidelity backtest meticulously models:
- Transaction costs (flat commission + percentage)
- Slippage (difference between order price and execution price)
- Market impact (your trades move the price)
- Survivorship bias (only testing on stocks that still exist today)
- Look-ahead bias (accidentally using future information)
Without these, backtest results are overly optimistic.
Architecture: how Kronos works
Key innovation: Treating K-line sequences as a language.
1. Specialized tokenizer (Kronos-Tokenizer)
Instead of feeding continuous OHLCV values directly into the model:
- Quantizes multi-dimensional data into hierarchical discrete tokens
- Tokens represent price levels and volume ranges in a learned codebook
- This handles high-noise financial data better than continuous regression
Two tokenizer variants:
- Kronos-Tokenizer-2k - For Kronos-mini (2048 context)
- Kronos-Tokenizer-base - For small/base/large (512 context)
2. Autoregressive Transformer
A decoder-only Transformer (like GPT) is trained to:
- Predict the next token in a K-line sequence
- Learn patterns like support/resistance, trends, volatility regimes
- Generate multi-step forecasts by sampling from the token distribution
3. De-quantization
After token generation:
- Tokens are de-quantized back to continuous OHLCV values
- Inverse normalization applied to restore original scale
- Final forecast returned as pandas DataFrame
Performance and benchmarks
The arXiv paper (2508.02739) reports benchmarks on:
- Stock indices (S&P 500, Shanghai Composite)
- Individual stocks (Chinese A-shares)
- Cryptocurrencies (BTC, ETH)
- Commodities (gold, crude oil)
Key findings (from paper abstract):
- Outperforms general-purpose TSFMs on financial forecasting tasks
- Handles high-noise data better than continuous models
- Scales well with model size (larger models = better performance)
Caveat: The paper does not claim Kronos generates profitable trading signals out-of-the-box. Financial forecasting is necessary but not sufficient for profitable trading—you also need portfolio optimization, risk management, and transaction cost control.
GitHub stats and community
| Metric | Value |
|---|---|
| Stars | 23.3k |
| Forks | 4.1k |
| Watchers | 215 |
| Contributors | 18 |
| Language | Python (81.9%), HTML (17.7%), Shell (0.4%) |
| License | MIT |
Key contributors: Yu Shi, Zongliang Fu, Shuo Chen, Bohan Zhao, Wei Xu, Changshui Zhang, Jian Li
Accepted at: AAAI 2026 (announced November 10, 2025)
Related on ExplainX
- AI benchmarks complete guide — how to evaluate model performance
- LLM model parameters explained — understanding parameter counts
- What are LLM tokens — tokenization fundamentals
- Agent skills for quantitative trading — specialized playbooks for finance
- AI tools directory — discover utilities by task
Bottom line
Kronos is the first open-source foundation model specifically designed for financial candlesticks, treating market data as a language through specialized tokenization. With 23.3k GitHub stars, acceptance at AAAI 2026, and a family of models from 4.1M to 499.2M parameters, it represents a new approach to time series forecasting in finance.
Use it for:
- Stock price forecasting (A-shares, US equities, etc.)
- Crypto price prediction (BTC, ETH, altcoins)
- Commodities (gold, oil, agricultural products)
- Quantitative trading research (with Qlib integration)
- Multi-asset portfolio strategies (via batch prediction)
The real power: Unlike general-purpose TSFMs, Kronos is domain-specific—built from the ground up to handle the unique, high-noise characteristics of financial data. Combined with the complete finetuning pipeline and Qlib integration, it provides a production-ready starting point for quantitative trading research.
Get started:
git clone https://github.com/shiyu-coder/Kronos
cd Kronos
pip install -r requirements.txt
Try the live demo: Hugging Face Spaces - Kronos
Citation
If you use Kronos in your research:
@misc{shi2025kronos,
title={Kronos: A Foundation Model for the Language of Financial Markets},
author={Yu Shi and Zongliang Fu and Shuo Chen and Bohan Zhao and Wei Xu and Changshui Zhang and Jian Li},
year={2025},
eprint={2508.02739},
archivePrefix={arXiv},
primaryClass={q-fin.ST},
url={https://arxiv.org/abs/2508.02739}
}
This article is an independent summary for developers on explainx.ai and is not sponsored by the Kronos team. Features and specifications are based on the public GitHub repository and arXiv paper as of May 7, 2026; verify on the official repo before production use.
Disclaimer: This article is for informational purposes only and does not constitute financial advice. Trading financial instruments involves substantial risk of loss and is not suitable for every investor. Past performance does not guarantee future results. Always conduct your own research and consult with a qualified financial advisor before making investment decisions.