J.A.R.V.I.S. (Joint Automated Regime Valuation & Integration System) is a high-performance quantitative trading platform designed to scan, analyze, and execute trades across diverse market regimes (Trending, Ranging, and Volatile). The architecture integrates machine learning signals with classical technical analysis and rigorous macro risk guards to achieve stable portfolio returns while strictly limiting drawdowns.
The system is designed as a decoupled, multi-layered service architecture:
+---------------------------------------+
| Binance/Bybit API |
+-------------------+-------------------+
|
| (1h & 4h Candle Data)
v
+-------------------+-------------------+
| Data Fetcher |
+-------------------+-------------------+
|
| (Clean Pandas DataFrames)
v
+-------------------------------------+-------------------------------------+
| Execution Engine |
| |
| +--------------------------+ +--------------------------+ |
| | Market Regime Detector | | ML Model Agent | |
| | (Slope & Volatility) | | (Walk-Forward Ensemble)| |
| +------------+-------------+ +------------+-------------+ |
| | | |
| +-------------------+--------------------+ |
| | (Regime + ML Probability) |
| v |
| +------------+-------------+ |
| | Signal Generator Scorer | |
| | (Indicator Confluence) | |
| +------------+-------------+ |
| | (Raw Signal Verdict) |
| v |
| +------------+-------------+ |
| | Macro Market Guards | |
| | (4H Trend & Daily 200SMA)| |
| +------------+-------------+ |
| | (Filtered Signal Verdict) |
| v |
| +------------+-------------+ |
| | Risk & Position Sizing | |
| | (Symbol-Specific ATR SL) | |
| +------------+-------------+ |
+------------------------------------|--------------------------------------+
|
| (Authorized Orders)
v
+-------------------+-------------------+
| Bybit Broker (Paper/Live) |
+-------------------+-------------------+
|
| (Active State & Diagnostics Logs)
v
+-------------------+-------------------+
| FastAPI REST API |
+-------------------+-------------------+
|
| (REST / Real-time Poll)
v
+-------------------+-------------------+
| Next.js React Frontend HUD |
+---------------------------------------+
run_bot.py(Orchestration Loop): The main execution pipeline that schedules periodic market scans, retrieves real-time pricing, calls the signal scoring modules, and interacts with the Broker interface.signals/signal_generator.py: Aggregates classical indicators (RSI, Bollinger Bands, Moving Averages) and combines them with walk-forward machine learning confidence levels to construct a weighted signal score.strategies/regime.py: Classifies market conditions into Trending, Ranging, or Volatile states using rolling linear regression slopes and normalized Average True Range (ATR) metrics.strategies/ml_strategy.py: Manages rolling training and predictions using scikit-learn models, dynamically identifying high-probability windows for directionality.risk/risk_manager.py: Enforces risk management, including daily drawdown caps, max consecutive loss cutoffs, and cooldown windows to prevent revenge trading.execution/: Implements precision order execution (using Bybit SDK), manages slippage, handles order quantity precision boundaries, and calculates dynamic settlement.api/main.py: A FastAPI service mapping real-time bot statistics, scanner diagnostics, log files, and active trade positions to clean REST endpoints.frontend/: A Next.js (TypeScript/Tailwind CSS) dashboard delivering a command-center interface with real-time diagnostics, explains reasons for scan blocks, and visualizes asset performance.
- Timeframe: 1-Hour candles for signal scanning; 4-Hour and Daily candles for macro trend filtering.
- Universal Macro Guards:
- Daily 200 SMA Guard: Blocks LONG entries when price is below the 200 SMA, and SHORT entries when price is above the 200 SMA.
- 4H MACD Trend Guard: Filters out trades opposing the macro 4H momentum.
- Symbol-Specific Tuning:
- BTC/USDT: Trades both sides (Long/Short) using standard, tight stop-losses (
2.0x ATR) to maximize expectancy. - High-Beta Altcoins (SOL/USDT, XRP/USDT): Trade both sides but apply wider stop-losses (
3.0x ATR) to absorb higher volatility and avoid noise stop-outs.
- BTC/USDT: Trades both sides (Long/Short) using standard, tight stop-losses (
The system-wide parameters are tuned and validated using historical data across diverse market regimes:
- Combined Return:
+45.74% - Max Portfolio Drawdown:
16.7%(Target: < 25%) - Sharpe Ratio:
1.91 - Profit Factor:
1.30 - Trade Frequency:
127 trades(~2.5 trades per week, optimizing transaction fees)
- Clone the repository and activate the virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate pip install -r requirements.txt
- Run the FastAPI REST server:
python -m uvicorn api.main:app --port 8000 --reload
- Start the execution bot (defaulting to Paper Trading mode):
python run_bot.py
- Navigate to the frontend directory:
cd frontend npm install - Start the hot-reloading Next.js dev server:
npm run dev
- Open
http://localhost:3000to access the J.A.R.V.I.S Dashboard.
Disclaimer: This project is a quantitative framework designed for simulation and paper-trading validation. Past performance does not guarantee future live returns.