Project Overview
An advanced quantitative BTCUSD trading research and backtesting suite featuring machine learning volatility forecasting and FinBERT-powered financial news sentiment analysis.
An advanced quantitative BTCUSD trading research and backtesting suite featuring machine learning volatility forecasting and FinBERT-powered financial news sentiment analysis.
An advanced quantitative BTCUSD trading research and backtesting suite featuring machine learning volatility forecasting and FinBERT-powered financial news sentiment analysis.
- Quantitative trading strategy development typically happens in fragmented Jupyter Notebooks, making it difficult to simulate realistic market conditions like latency, execution slippage, and trading fees. - Standard sentiment analysis tools rely on generic NLP text models that fail to correctly capture domain-specific context in financial and cryptocurrency news headlines. - Transitioning historical trading models from backward-looking backtest engines to asynchronous live-paper trading simulations usually requires completely rewriting the codebase.
Built a unified, asynchronous platform using FastAPI and PostgreSQL to bridge the gap between financial research and production engineering. Implemented an event-driven backtesting loop that replays historical candle data using vectorized Pandas operations while enforcing realistic fill logic, tracking portfolio balance states dynamically via SQLAlchemy ORM. Integrated an automated NLP ingestion pipeline utilizing a Hugging Face FinBERT model running as decoupled background tasks to score crypto news sentiment streams without blocking the main dashboard. Additionally, incorporated tree-based machine learning models (XGBoost Classifier/Regressor) to extract predictive regime-shifting and volatility insights from technical market indicators.
The platform utilizes a multi-layered hybrid architecture managed entirely via FastAPI and an ASGI Uvicorn server runtime. A PostgreSQL database layer holds decoupled states for wallets, trade books, and ingested sentiment markers using structured SQLAlchemy schemas. The analytical layer features a walk-forward validated XGBoost model matrix paired with a background RSS news processing worker. The presentation view layer delivers real-time portfolio updates and performance charting directly to a lightweight browser UI utilizing fast CDN-hosted Chart.js and lightweight-charts configurations connected via web sockets.
- Challenge: Running heavy Transformer deep-learning inference models inside web request paths froze the single-threaded event loop. - Solution: Decoupled the FinBERT processing pipeline by wrapping news fetch routines into an isolated async background scheduler that commits pre-computed results directly to the Postgres layer. - Challenge: Handling messy time-series data streams risked producing data leakage or look-ahead bias during training indicator generation phases. - Solution: Enforced absolute temporal boundaries using specialized logical limits within Pandas indexing blocks alongside rolling window methods, strictly validating that feature state 't' only pulls historical arrays spanning 0 to t-1.
- Successfully decoupled computational NLP modeling (FinBERT) from the API thread pool, lowering dashboard endpoint latency to under 50ms. - Built a highly modular base strategy class pattern allowing rapid plug-and-play simulation for new mathematical trading rules. - Engineered 25+ technical and market-sentiment features processed via optimized, vectorized NumPy array code blocks to completely avoid look-ahead bias during time-series processing splits.
Let's discuss how we can leverage these technologies and methods to build scalable systems for your engineering needs.