This repository documents an experimental machine learning pipeline for predicting the direction of the next 5-minute BTC/USDT candle. The work was inspired by IBM Granite TinyTimeMixer (TTM) research and adapted into a custom binary-classification workflow for crypto intraday data.
The current codebase is best understood as a research and engineering portfolio project:
- It is inspired by IBM Granite Time Series TTM, not a direct reproduction of the upstream Hugging Face checkpoint workflow.
- It focuses on next-candle up/down classification rather than pure multi-step forecasting.
- Included metrics and checkpoints are experiment snapshots, not production trading guarantees.
Portfolio note: a short project narrative is available in docs/portfolio-summary.md.
- Bybit OHLCV data collection into SQLite
- Feature engineering for 50+ technical indicators
- A custom TTM-inspired PyTorch model for binary direction prediction
- Training, evaluation, and hyperparameter search utilities
- Saved experiment checkpoints for walkthroughs and demos
- A downstream trading monitor / analysis workflow
The project direction started from the IBM Granite Time Series TTM line of work:
- Hugging Face model card: https://huggingface.co/ibm-granite/granite-timeseries-ttm-r2
- Granite TSFM repository: https://github.com/ibm-granite/granite-tsfm
- Paper: https://arxiv.org/abs/2401.03955
In this repository, that inspiration is translated into a crypto-specific classification pipeline with handcrafted market features, local training utilities, and experimentation around short-horizon BTC/USDT behavior.
.
├── saved_models/ # Curated experiment checkpoints and notes
├── src/
│ ├── config.json # Default local project configuration
│ ├── data/ # Data collection, processing, and feature utilities
│ ├── models/ # Training, evaluation, optimization, model internals
│ └── utils/ # Config, DB, and logging helpers
├── trader/ # Monitoring, trading, and trade analysis scripts
├── requirements.txt
└── README.md
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtCreate a local .env file from .env.example and add your Bybit credentials if you plan to use data collection or trading utilities.
cp .env.example .envDefault paths are configured in src/config.json to keep all runtime artifacts inside the repository:
data/for SQLite databasesmodels/for newly trained checkpointsresults/for evaluation outputslogs/for application logs
python -m src.data.data_collector --symbol BTC/USDT --interval 5 --start-date 2024-01-01python -m src.data.data_processor --symbol BTCUSDT --interval 5python -m src.models.train_model \
--symbol BTCUSDT \
--interval 5 \
--mode test \
--samples 5000 \
--context_length 10 \
--epochs 15For a longer run:
python -m src.models.train_model --symbol BTCUSDT --interval 5 --mode full --epochs 150python -m src.models.evaluate_model --symbol BTCUSDT --interval 5 --limit 1000python trader/bt_trader.py --model saved_models/highest_accuracy/model.pth --duration 10The trading script is best treated as an experimental downstream consumer of the model, not as a production-ready execution system.
Sample checkpoints are documented in saved_models/README.md. They are included to show the progression of experiments and make the repository easier to review, but they should not be interpreted as robust live-trading benchmarks.
- The repository is centered on BTC/USDT 5-minute data and is not a general market-agnostic framework.
- Evaluation currently reflects internal experimental workflows more than strict production-grade validation.
- Live trading paths require additional safeguards, slippage modeling, and failure handling before real-money use.
- Some comments and auxiliary notes remain in Korean because the project was developed as a personal research build first.
MIT. See LICENSE.
- Runtime artifacts such as local databases, logs, generated models, and virtual environments are git-ignored.
- The committed checkpoints under
saved_models/are intentional reference artifacts.