# AI use cases for Kronos (shiyu-coder/Kronos)

Repo: [shiyu-coder/Kronos](https://github.com/shiyu-coder/Kronos) | Use cases: 3 | Page: https://dedupedai.com/use-cases/shiyu-coder-kronos/

Kronos is an open-source Python foundation model that forecasts financial K-line (candlestick) sequences built from OHLCV data.

This file holds every use case of this repo. Each one starts with a "## " heading and ends with its URL.

- Forecast future candlesticks from one price history: https://dedupedai.com/use-cases/shiyu-coder-kronos/forecast-candlesticks-with-kronos-predictor/
- Forecast many assets in one batch run: https://dedupedai.com/use-cases/shiyu-coder-kronos/batch-forecast-many-price-series/
- Fine-tune Kronos on your own market dataset: https://dedupedai.com/use-cases/shiyu-coder-kronos/fine-tune-kronos-on-own-market-data/

## How to forecast future candlesticks from one price history with Kronos

Repo: [shiyu-coder/Kronos](https://github.com/shiyu-coder/Kronos) | Difficulty: Intermediate | Time: 45 minutes | Basis: From the README

Load a pre-trained Kronos model and get a forecast of future OHLCV candles from your own historical data.

**Who it is for:** A quant analyst or developer with a CSV of 5-minute or daily candles who needs a quick model-based forecast for one instrument.

**The problem:** Turning raw candlestick history into a usable forecast normally means writing your own preprocessing, normalization, and inverse scaling around a model.

**The outcome:** A pandas DataFrame of forecasted open, high, low, close, volume and amount values, indexed by the future timestamps you supplied.

### Steps

1. Run `pip install -r requirements.txt` in the cloned Kronos folder, using Python 3.10 or newer.
2. Load the tokenizer and model with `KronosTokenizer.from_pretrained("NeoQuasar/Kronos-Tokenizer-base")` and `Kronos.from_pretrained("NeoQuasar/Kronos-small")`.
3. Create the predictor with `KronosPredictor(model, tokenizer, max_context=512)`.
4. Split your data into a lookback window of 400 rows as `x_df`, `x_timestamp`, and a 120-step `y_timestamp` range, keeping the lookback at or below 512.
5. Call `predict` with `pred_len=120`, `T=1.0`, `top_p=0.9`, and `sample_count=1`, then print `pred_df.head()`.

### Prompt to paste into your agent

```text
Using the Kronos repo, load NeoQuasar/Kronos-small with its tokenizer, forecast the next 120 candles for <CSV path with open, high, low, close columns and timestamps>, and return the pred_df table. Verify that the forecast index matches the y_timestamp values you passed in and that the lookback is no more than 512 rows.
```

### Caveat

The README gives a demo forecast for BTC/USDT and a live demo page, but it does not report accuracy or backtest results for the default models.

Risk, reverse engineering: Forecasts from a sampled model are probabilistic and should be checked against your own out-of-sample data before anyone relies on them for trading decisions.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/shiyu-coder-kronos/forecast-candlesticks-with-kronos-predictor/

## How to forecast many assets in one batch run with Kronos

Repo: [shiyu-coder/Kronos](https://github.com/shiyu-coder/Kronos) | Difficulty: Intermediate | Time: 45 minutes | Basis: From the README

Use predict_batch to forecast several equal-length price series at once and keep results in input order.

**Who it is for:** A developer or analyst monitoring a watchlist of instruments who needs forecasts for all of them with the same lookback and horizon.

**The problem:** Running single forecasts one by one is slow and makes it harder to compare many assets in the same window.

**The outcome:** A list of forecast DataFrames, one per input series, returned in the same order as the inputs.

### Steps

1. Run `pip install -r requirements.txt` in the Kronos folder.
2. Build a Python list of DataFrames `df_list`, plus matching `x_timestamp_list` and `y_timestamp_list`, making sure every series has the same lookback length and the same pred_len.
3. Create the predictor with `KronosPredictor(model, tokenizer, max_context=512)` after loading the model and tokenizer from the Hugging Face Hub.
4. Call `predictor.predict_batch` with `df_list`, `x_timestamp_list`, `y_timestamp_list`, `pred_len`, `T=1.0`, `top_p=0.9`, `sample_count=1`, and `verbose=True`.
5. Loop over the returned `pred_df_list` in order and print `pred_df.head()` for each series.

### Prompt to paste into your agent

```text
In the Kronos repo, prepare equal-length candlestick DataFrames for <list of instrument CSV paths>, call predict_batch with pred_len=<number of steps>, and write one forecast CSV per instrument. Verify that the number of returned DataFrames equals the number of input series and that each series has the same lookback length.
```

### Caveat

The README says predict_batch leverages GPU parallelism, so a CPU-only machine may run it much more slowly.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/shiyu-coder-kronos/batch-forecast-many-price-series/

## How to fine-tune Kronos on your own market dataset with Kronos

Repo: [shiyu-coder/Kronos](https://github.com/shiyu-coder/Kronos) | Difficulty: Advanced | Time: 4 hours | Basis: From the README

Adapt the Kronos tokenizer and predictor to your own candlestick data using the Qlib-based finetuning pipeline.

**Who it is for:** A quant researcher with local Qlib market data and multiple GPUs who wants Kronos tuned to a specific market or universe.

**The problem:** A general pre-trained model may not match the distribution of a specific market, so you need a repeatable way to adapt it.

**The outcome:** Train, validation and test pickle files plus fine-tuned tokenizer and predictor checkpoints saved to the paths in your config.

### Steps

1. Run `pip install pyqlib` and set up your Qlib daily data by following the official Qlib guide.
2. Edit `finetune/config.py` to set `qlib_data_path`, `dataset_path`, `save_path`, `backtest_result_path`, `pretrained_tokenizer_path`, and `pretrained_predictor_path`, and set `use_comet = False` if you do not use Comet.ml.
3. Run `python finetune/qlib_data_preprocess.py` to create train_data.pkl, val_data.pkl and test_data.pkl.
4. Run `torchrun --standalone --nproc_per_node=NUM_GPUS finetune/train_tokenizer.py`, replacing NUM_GPUS with your GPU count.
5. Run `torchrun --standalone --nproc_per_node=NUM_GPUS finetune/train_predictor.py`, then evaluate the saved checkpoint with the backtesting step.

### Prompt to paste into your agent

```text
In the Kronos repo, edit finetune/config.py for my local Qlib data at <qlib data path>, run the preprocessing script, then run both torchrun training scripts with <number of GPUs> GPUs. Verify that train_data.pkl, val_data.pkl and test_data.pkl exist in dataset_path before starting training.
```

### Caveat

The README describes this pipeline as a simplified demonstration, not a production-ready quantitative trading system, and says a robust strategy needs more techniques such as portfolio optimization and risk factor neutralization.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/shiyu-coder-kronos/fine-tune-kronos-on-own-market-data/
