Downloads · 30 days
0
Yousafza1/financial-price-forecasting
financial-price-forecasting is a machine learning model from Yousafza1. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
Forecasts next-step (configurable horizon) log returns for crypto, forex, stocks and indices from free public data (yfinance + Binance/ccxt). Model: channel-independent PatchTST with RevIN, ~150–300K params — the top-…
Downloads · 30 days
0
Access
Public
Updated Sep 14, 2026
Repo size
—
Likes
0
Public
Click a slice to open those files.
.py18.6 KB · 79%
From the Hugging Face model README
Forecasts next-step (configurable horizon) log returns for crypto, forex, stocks and indices from free public data (yfinance + Binance/ccxt). Model: channel-independent PatchTST with RevIN, ~150–300K params — the top-tier architecture in a 918-experiment controlled benchmark on crypto/forex/index data (arXiv 2603.16886), and cheap enough for a T4.
pred_len purge rows at boundaries, and
windows built strictly inside each split.python download_data.py --out-dir data/raw --start 2017-01-01
python build_dataset.py --raw-dir data/raw --out-dir data/features --pred-len 1
python train_patchtst.py --data-dir data/features \
--hub-model-id Yousafza1/patchtst-financial-daily
| File | Role |
|---|---|
download_data.py | Daily OHLCV: 8 Binance pairs (ccxt, paginated), 6 forex pairs, 10 stocks, 7 indices (yfinance, throttled + retried) |
build_dataset.py | Features: log_ret, hi_lo_range, vol_20, volume_z (trailing-only stats) + split metadata |
train_patchtst.py | PatchTST training, early stopping, test metrics, optional Hub push |
Defaults: seq_len=96, pred_len=1, d_model=128, e_layers=3,
n_heads=4, d_ff=256, patch_len=16, stride=8, Adam lr=1e-4,
batch 128. These follow the reference configs in yuqinie98/PatchTST
(pinned commit 204c21e, cloned automatically at train time).
volume_z is 0 there; range and returns carry it.From Jobs pricing:
| Stage | Hardware | Est. wall-clock | Est. cost |
|---|---|---|---|
| Data download + build (30 markets, daily) | cpu-basic ($0.01/h) | ~20–40 min | ~$0.01 |
| Smoke train (same script/shape, ~50 steps) | a10g-small ($1.00/h) | ~10 min | ~$0.02 |
| Full train (~30 epochs, ~250K windows) | a10g-small ($1.00/h) | ~2–3 h | ~$2–3 |
| Chronos-2 zero-shot baseline (CPU) | cpu-basic ($0.01/h) | ~30 min | ~$0.01 |
Each submission reserves its worst case (price × timeout) and settles to
minutes actually used. A $5 budget covers the full pipeline with headroom;
a $15 budget allows 3 seeds + a pred_len=5 variant.