Building NeuroTradeX — Architecting an AI-Driven Trading System
NeuroTradeX is an advanced, modular trading platform designed for real-time, explainable AI in financial and crypto markets. It was built with a focus on transparency, security, extensibility, and performance — combining technologies like LSTM, Transformers, SHAP, WebSocket streaming, Dockerized services, and real exchange integrations.
⚙️ System Overview
At its core, NeuroTradeX is composed of 5 decoupled services:
data-core: feature pipelines, OHLCV ingestion, sentiment processing via LLMsmodel-engine: deep learning prediction using LSTM, Transformer, and SHAP explanationsexec-core: real or simulated execution (Binance, paper trading), with risk controlsdashboard-ui: live Next.js UI to monitor model confidence, signal history, logsalert-system: async, multi-channel alerts via Telegram, Discord, and Webhooks
The entire system is open-source and hosted at:
🔗 gitlab.com/neurotradex
🧱 Modular Architecture
Each module runs independently, communicates through structured JSON files or WebSocket streams, and is deployable via Docker Compose or Kubernetes.
📊 Data Pipeline Highlights
The data-core module is responsible for ingesting:
-
OHLCV data from Binance/Bybit
-
Sentiment/news data from CoinDesk, Yahoo, Twitter
-
Feature engineering with
ta-lib, including:- RSI, MACD, Bollinger Bands, OBV, ATR, and custom signals
-
Embedding of textual data using
sentence-transformersandLLMs
def compute_macd(df):
macd = df['close'].ewm(span=12).mean() - df['close'].ewm(span=26).mean()
signal = macd.ewm(span=9).mean()
return macd, signal🧠 AI Modeling: model-engine
This module provides both supervised learning and interpretable AI via:
- LSTM and Autoformer for time series prediction
- SHAP values and LIME for feature attribution
- Support for both:
- static offline training
- or online/streaming signal classification
explainer = shap.Explainer(model, sample_data)
shap_values = explainer(data_point)
shap.plots.waterfall(shap_values[0])All models export signal objects in a common schema for consumption by the exec-core.
🛡️ Execution Engine: exec-core
Built with security and precision in mind, this module handles:
- Signal validation
- Risk checking (drawdown cap, dynamic sizing)
- Execution via real APIs (Binance) or paper simulation
- CLI and Telegram fallback approvals
if risk_manager.validate(signal):
executor.place_order(signal.asset, signal.side, size)
else:
fallback.notify(signal, reason="risk_threshold_breached")Trade logs and decisions are timestamped and persisted locally.
📺 UI: dashboard-ui
Written in Next.js + Tailwind, the dashboard:
- Streams signal flow and execution feedback
- Shows confidence metrics and model explanations
- Uses
TradingViewfor OHLCV chart overlays - Offers real-time logs and theming (dark/light)
<LightweightChart
data={ohlcv}
signals={executedSignals}
overlays={shapAttributions}
/>🔔 Real-Time Notifications: alert-system
This service asynchronously pushes alerts to:
- Telegram channels
- Discord webhooks
- Any custom webhook endpoint
It uses jinja2 templating, retries, exponential backoff, and tokenized configs via .env.
def send(signal: TradeSignal):
message = render_template("signal_message.md", signal)
bot.send_message(chat_id=chat, text=message, parse_mode="Markdown")Logs are grouped by date in /logs/alerts/YYYY-MM-DD.log.
🧪 Testing & CI/CD
Each module is:
- Fully unit-tested via
pytestorjest - Integrated into
.gitlab-ci.ymlfor linting, security checks, and test execution - Built for containerized environments with Docker and optional support for Kubernetes Helm charts
🌍 Final Thoughts
Developing NeuroTradeX was an exercise in bringing together:
- Machine learning
- Financial engineering
- Distributed systems
- Explainability
- Human-in-the-loop design
Its open-source nature allows contributors, researchers, and traders to explore, extend, and build upon a transparent architecture built for reliability and real-world applicability.
Whether you're working in DeFi, TradFi, or AI-driven quantitative systems, NeuroTradeX provides a foundation ready to grow.
Repository: gitlab.com/neurotradex