GLM / README.md
3VVM's picture
Upload 4 files
f39d4f5 verified
|
Raw
History Blame Contribute Delete
2.57 kB
---
title: Forex + Crypto Trading Prediction
emoji: πŸ“ˆ
colorFrom: blue
colorTo: green
sdk: gradio
sdk_version: 4.44.1
app_file: app.py
pinned: false
---
# Forex + Crypto Trading Prediction App
Single-file, self-contained prediction & backtesting app for Forex and Crypto
markets, built with **Gradio + CatBoost**. Prediction/backtesting only β€”
**no live trade execution**.
## Features
- **Data ingestion** β€” live via `yfinance` β†’ Twelve Data (optional API key) β†’
CSV upload/cache fallback, with flexible column mapping and canonicalization.
- **Timezone & calendar handling** β€” fixed operational timezone (Asia/Kolkata),
gap classification (weekend/holiday/outage), holiday calendar versioning.
- **Feature engineering** β€” core technical indicator set (EMA, MACD, RSI,
Stochastic, ADX, Bollinger Bands, ATR, VWAP, OBV, Donchian, etc.),
fractional differencing, leak-safe rolling windows.
- **Labeling** β€” triple-barrier labeling (with fixed-threshold fallback).
- **Model training** β€” CatBoost with HistGB fallback, walk-forward
cross-validation, hyperparameter search, fold-stability rejection rule,
deterministic seeding (SEED=42).
- **Calibration & confidence** β€” bootstrap-averaged isotonic / Platt
calibration plus a time-weighted split-conformal layer for confidence bands.
- **Drift & auto-retrain** β€” PSI/F1/confidence drift monitors, scheduled and
volume-triggered retraining with acceptance gating and rollback.
- **Backtesting & forward test** β€” out-of-sample backtest with commissions,
slippage, spread, and a strictly separate paper-trading forward test.
- **Observability** β€” sequential operational event log and an append-only
JSONL audit trail.
- **Developer self-test** β€” `--selftest` runs an end-to-end acceptance check
on synthetic Forex & Crypto fixtures (fast HPO).
## Run locally
```bash
pip install -r requirements.txt
python app.py
```
The Gradio UI launches on `http://localhost:7860`.
## Developer acceptance check
```bash
python app.py --selftest
```
## Deploy on Hugging Face Spaces
1. Create a new Space with SDK = **Gradio**.
2. Upload `app.py`, `requirements.txt`, and this `README.md`.
3. The Space will build and launch automatically (`app_file: app.py`).
## Notes
- All timestamps are shown in IST (UTC+5:30).
- Historical backtests are never evidence of future performance.
- A Twelve Data API key is optional and, if provided, is kept for the
session only β€” never logged or persisted to source.
- Target runtime: Python 3.10+, 2 CPU / 16 GB RAM (Docker-based Spaces).