--- license: mit language: - en pipeline_tag: time-series-forecasting --- # MultiAsset Market Making Model: Transformer based Interval Forecasting ## Model Summary & Evaluation ### Overview This project implements a transformer based time-series forecasting model for 5-minute OHLCV data on Binance BTC Perp and OKX BTC Spot. The model uses cross-channel attention and a custom interval score loss to predict high/low ranges for both assets. Model achieves 47.35% (BTC Perp) and 74.43% (BTC Spot) interval coverage accuracy with lambda_width=5. ## Prediction vs True Value (Visualization) ![Prediction vs True Value](./prediction_vs_true.png) ### Technical Foundation - **Python (pandas, matplotlib, mplfinance):** Data download, cleaning, plotting - **PyTorch:** Model architecture, training, evaluation - **MultiheadAttention (5 heads):** Cross-channel attention for multi asset modeling - **Interval Score Loss (lambda_width=5):** Penalizes missed intervals and wide ranges, differentiable for training - **Data alignment:** Merging Binance and OKX OHLCV by timestamp ### Codebase Status - **main.py:** Trains model on combined Binance/OKX data, interval score loss, outputs 4 values: BTC Perp high/low and BTC Spot high/low - **test_only.py:** Plots true/pred candlesticks for both exchanges, computes relaxed (OR) interval accuracy ### Problem Resolution - **Issues:** Data ordering, deduplication, plotting errors, shape mismatches, loss function encouraging wide intervals - **Solutions:** Batch reversal, sorting, deduplication, robust CSV reading, interval score loss with width penalty, OR logic for interval accuracy - **Lessons Learned:** Interval score loss must balance coverage and precision; width penalty is critical to avoid trivial solutions ### Progress Tracking - **Completed:** Data download/cleaning, plotting, model implementation, training, evaluation, documentation - **Recent Context:** Summary and evaluation based on latest training/test results and loss function - **Pending:** Further model tuning (lambda_width, architecture), additional evaluation metrics or visualizations, publishing code/model/dataset --- ## Disclaimer **Note:** This repository is a work in progress. The model weights, code, and dataset will be published in a later stage. Current release includes only documentation, summary, and evaluation logs. Stay tuned for updates! ---