Who it is forA quant researcher with local Qlib market data and multiple GPUs who wants Kronos tuned to a specific market or universe.
The problemA general pre-trained model may not match the distribution of a specific market, so you need a repeatable way to adapt it.
The outcomeTrain, validation and test pickle files plus fine-tuned tokenizer and predictor checkpoints saved to the paths in your config.
What you need first
- Python 3.10 or newer
- pip, and access to install requirements.txt
- Internet access to load models from the Hugging Face Hub
- Historical candlestick data in a pandas DataFrame with open, high, low, close columns
- For fine-tuning only: a local Qlib data directory, a GPU setup that works with torchrun, and optionally a Comet.ml account
Steps
- Run
pip install pyqliband set up your Qlib daily data by following the official Qlib guide. - Edit
finetune/config.pyto setqlib_data_path,dataset_path,save_path,backtest_result_path,pretrained_tokenizer_path, andpretrained_predictor_path, and setuse_comet = Falseif you do not use Comet.ml. - Run
python finetune/qlib_data_preprocess.pyto create train_data.pkl, val_data.pkl and test_data.pkl. - Run
torchrun --standalone --nproc_per_node=NUM_GPUS finetune/train_tokenizer.py, replacing NUM_GPUS with your GPU count. - Run
torchrun --standalone --nproc_per_node=NUM_GPUS finetune/train_predictor.py, then evaluate the saved checkpoint with the backtesting step.
Prompt for your agent
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.
Get 5 new use cases every morning. Free, one short email, unsubscribe anytime.
Get them freeShare: X LinkedIn Hacker News Email Copy link
Disclaimer
Deduped lists open-source repositories that belong to other people. We do not own, maintain, audit, or vouch for any of them, and a repo appearing here is not an endorsement or a safety check. The use cases, steps, and prompts are written by AI and may be incomplete, outdated, or just wrong. Where a use case is marked "Seen in the wild", we link to public posts where someone described something similar, but we have not verified those posts and the use case itself is still our AI's own write-up. Use all of this at your own risk. Only run code, commands, or agents on systems and accounts you are authorized to use, and read the code and every command before you run it, especially anything that touches credentials, files, or the network. Nothing here is professional, security, legal, or financial advice. All trademarks and project names belong to their respective owners, and their use here does not imply affiliation. Content is provided as is, without warranties of any kind. Found a mistake, a safety problem, or something you want removed? Email [email protected] and we will look at it promptly. Full disclaimer page