Kronos: The First Open-Source Foundation Model for Financial Candlesticks

Kronos is an MIT-licensed, decoder-only foundation model pre-trained on K-line (OHLCV) data from 45+ global exchanges, accepted at AAAI 2026, that turns candlestick forecasting into a language-modeling problem you can run, finetune, and backtest yourself.

  • โญ 35481
  • Python
  • MIT
  • Updated 2026-08-02

Vibe-Trading: HKU’s Open-Source Research Agent for Markets โ€ข TimesFM 2.5: Google’s Time Series Foundation Model

Kronos two-stage framework overview โ€” tokenizer plus decoder-only Transformer for K-line forecasting
Kronos architecture overview โ€” from github.com/shiyu-coder/Kronos

What Is Kronos? #

Kronos describes itself as the first open-source foundation model built specifically for financial candlesticks (K-lines), pre-trained on data from 45+ global exchanges. Instead of bolting a generic time-series model onto finance data, Kronos treats OHLCV sequences as a language: a specialized tokenizer quantizes continuous, multi-dimensional candlestick data into hierarchical discrete tokens, and a decoder-only Transformer is pre-trained on those tokens the same way an LLM is pre-trained on text.

๐Ÿ”— GitHub: https://github.com/shiyu-coder/Kronos ๐Ÿ“„ Paper: arXiv:2508.02739 โ€” accepted at AAAI 2026 ๐Ÿค— Models: huggingface.co/NeoQuasar

The project is MIT-licensed and has crossed 35,000+ GitHub stars and 5,900+ forks. Its most recent commit landed April 13, 2026 โ€” the codebase reads as a finished, paper-backed research release rather than a project mid rapid iteration, which matters if you’re deciding whether to build on it versus something still churning weekly.


Why “Language of Financial Markets”? The Two-Stage Framework #

Most time-series forecasting models predict raw numeric values directly. Kronos’s pitch is that financial K-line data is unusually high-noise and multi-dimensional (open/high/low/close/volume/amount all move together), so it borrows the LLM playbook instead:

  1. Tokenizer stage โ€” KronosTokenizer quantizes continuous OHLCV sequences into hierarchical discrete tokens, compressing the signal into a vocabulary a Transformer can model the way it models words.
  2. Autoregressive stage โ€” a decoder-only Transformer (Kronos) is pre-trained on those tokens across markets and exchanges, learning a general-purpose representation of “what tends to follow what” in candlestick sequences.

Because both stages are pre-trained once and shipped as weights, you don’t train a model from scratch per asset โ€” you load a pre-trained checkpoint and either forecast directly or finetune it on your own market.


Model Zoo: Choosing a Kronos Size #

ModelTokenizerContext LengthParamsOpen Weights
Kronos-miniKronos-Tokenizer-2k20484.1Mโœ… NeoQuasar/Kronos-mini
Kronos-smallKronos-Tokenizer-base51224.7Mโœ… NeoQuasar/Kronos-small
Kronos-baseKronos-Tokenizer-base512102.3Mโœ… NeoQuasar/Kronos-base
Kronos-largeKronos-Tokenizer-base512499.2MโŒ not released

Kronos-mini’s 2048-token context is the outlier โ€” it uses a different tokenizer (Kronos-Tokenizer-2k) specifically to support a longer lookback window on constrained hardware, while small/base share the 512-context tokenizer and trade parameter count for capacity.


Installation & Quickstart #

pip install -r requirements.txt

Requires Python 3.10+. There’s no separate CLI โ€” everything is driven through the KronosPredictor Python class.

Load a pre-trained model and tokenizer #

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")

Instantiate the predictor #

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

Important: max_context for Kronos-small/base is capped at 512 โ€” the maximum sequence length the model can process. Longer input windows get truncated automatically rather than erroring out.


Making Forecasts: A Step-by-Step Walkthrough #

Kronos expects a pandas DataFrame with open, high, low, close (volume/amount optional), plus timestamp Series for the historical window and the future window you want predicted.

import pandas as pd

df = pd.read_csv("./data/XSHG_5min_600977.csv")
df['timestamps'] = pd.to_datetime(df['timestamps'])

lookback = 400
pred_len = 120

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']

Then generate the forecast, with sampling controls for probabilistic output:

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(pred_df.head())

predict() returns a DataFrame of forecasted open/high/low/close/volume/amount, indexed by the y_timestamp you provided. Bumping sample_count averages multiple stochastic forecast paths, which is the built-in way to get a steadier estimate than a single greedy pass.

Kronos forecast vs. ground truth on a held-out window
Forecast example generated by examples/prediction_example.py โ€” from the Kronos repo


Batch Prediction for Multiple Assets #

For forecasting several instruments at once, predict_batch parallelizes across a list of DataFrames rather than looping predict() calls one at a time:

df_list = [df1, df2, df3]
x_timestamp_list = [x_ts1, x_ts2, x_ts3]
y_timestamp_list = [y_ts1, y_ts2, y_ts3]

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
)

for i, pred_df in enumerate(pred_df_list):
    print(f"Predictions for series {i}:")
    print(pred_df.head())

Every series in a batch must share the same lookback length and pred_len; volume/amount are still optional and get zero-filled per series if absent.


Live Demo #

Kronos ships a hosted demo forecasting the BTC/USDT pair over the next 24 hours, useful for sanity-checking the model’s behavior before installing anything locally:

๐Ÿ‘‰ shiyu-coder.github.io/Kronos-demo


Finetuning on Your Own Data (A-Share Market Example) #

Kronos includes a full finetuning pipeline demonstrated on the Chinese A-share market via Qlib, Microsoft’s quant research toolkit:

pip install pyqlib

1. Configure โ€” edit finetune/config.py for qlib_data_path, dataset_path, save_path, backtest_result_path, and the pretrained checkpoint paths to start from.

2. Prepare the dataset:

python finetune/qlib_data_preprocess.py

3. Finetune the tokenizer, then the predictor โ€” both are multi-GPU via torchrun:

torchrun --standalone --nproc_per_node=NUM_GPUS finetune/train_tokenizer.py
torchrun --standalone --nproc_per_node=NUM_GPUS finetune/train_predictor.py

4. Backtest the finetuned model with a simple top-K strategy:

python finetune/qlib_test.py --device cuda:0

Kronos backtest cumulative return curve vs. benchmark
Backtest output from finetune/qlib_test.py โ€” from the Kronos repo


From Demo to Production: What Kronos Is Honest About #

The README is unusually direct about the gap between “runs a backtest” and “is a trading system,” which is worth taking at face value rather than glossing over:

  • Raw signals โ‰  pure alpha โ€” the demo’s output is a raw forecast; a real workflow would feed it into a portfolio-optimization step that neutralizes exposure to market beta and style factors (size, value) before treating it as tradeable alpha.
  • The finetuning pipeline is explicitly a demonstration, not “a robust quantitative strategy,” per the maintainers’ own disclaimer.
  • The simple top-K backtest strategy is a starting point โ€” production backtests need transaction costs, slippage, and market impact modeled to be trustworthy.
  • Some code comments inside finetune/ were AI-generated (Gemini 2.5 Pro) for explanatory purposes and may contain inaccuracies โ€” the maintainers recommend trusting the code over the comments.

Kronos vs. TimesFM vs. a Traditional Trading Bot #

AspectKronosTimesFM (Google)Typical trading bot (e.g. Freqtrade)
DomainFinancial K-line data onlyGeneral-purpose (retail, weather, web traffic, finance, etc.)Financial markets, execution-focused
Core capabilityForecasting via a pre-trained tokenizer + TransformerForecasting via a pre-trained decoder-only TransformerRule-based or ML-signal strategy execution
Ships a live-trading engineNo โ€” forecasting/backtesting research toolNoYes โ€” order execution against exchanges
FinetunableYes, documented pipeline (tokenizer + predictor)Yes, via Google’s fine-tuning APIsStrategy-dependent, not model-finetuning
LicenseMITApache-2.0Varies (Freqtrade: GPL-3.0)
Best fitResearch-grade candlestick forecasting to feed into your own strategy layerCross-domain time-series forecasting where finance is one use case among manyExecuting an already-defined strategy against a live or paper exchange

Use Cases #

1. Forecasting Research Without Training From Scratch #

Load a pre-trained Kronos checkpoint and generate multi-asset forecasts in a few lines, instead of standing up your own tokenizer-plus-Transformer training run per market.

2. Signal Generation for an Existing Strategy Layer #

Use Kronos’s forecasts as one input into a portfolio-construction or risk-management system you already run โ€” the maintainers are explicit this is the intended split of responsibilities, not an end-to-end trading system.

3. Domain-Specific Finetuning #

Follow the A-share/Qlib pipeline as a template to finetune Kronos-small or Kronos-base on your own exchange’s historical data, then backtest with your own top-K or custom strategy logic.

4. Academic Benchmarking #

Because the paper (AAAI 2026) and pre-trained weights are both public, Kronos is a citable baseline for time-series-forecasting research that specifically targets financial data rather than general-purpose benchmarks.


RepositoryPurpose
QlibMicrosoft’s quant research toolkit โ€” used by Kronos’s own A-share finetuning example
TimesFMGoogle’s general-purpose time-series foundation model โ€” the closest non-finance-specific comparison


Conclusion #

Kronos is a narrow, well-scoped bet: rather than another general time-series model or another trading bot, it’s a pre-trained, MIT-licensed foundation model for exactly one thing โ€” candlestick sequences โ€” backed by a peer-reviewed paper (AAAI 2026) and 45+ exchanges of pre-training data. At 35,000+ stars and with pre-trained weights openly hosted on Hugging Face, it’s become a common reference point for anyone doing serious time-series-forecasting research on financial data, provided you respect its own disclaimer that a raw forecast is not the same thing as a production trading strategy.

Best for: Researchers and quant developers who want a pre-trained forecasting backbone for K-line data to finetune or benchmark against โ€” not traders looking for a plug-and-play bot.

GitHub: https://github.com/shiyu-coder/Kronos


Finetuning Kronos is multi-GPU (torchrun) work, so the practical bottleneck is GPU access rather than the model itself:

  • DigitalOcean โ€” $200 free credit for 60 days across 14+ regions, including GPU droplets, enough to run the Qlib data-prep and a tokenizer finetune while you evaluate whether Kronos fits your market.
  • HTStack โ€” Hong Kong VPS with low-latency access from mainland China, useful if your data pipeline (e.g. A-share/Qlib) is China-market-focused. Same IDC that hosts dibi8.com.

Affiliate links โ€” they don’t cost you extra and they help keep dibi8.com running.

Last updated: 2026-08-02

References & Sources #

๐Ÿ“ฆ Featured in collections

๐Ÿ’ฌ Discussion