DALIOS Documentation
Complete guide to deploying and operating the DALIOS Autonomous Trading Framework.
DALIOS is a Ray Dalio-inspired autonomous trading system designed for ASX equities and global commodities. It combines the All Weather portfolio strategy with the Economic Machine framework for intelligent, risk-managed trading.
Key Capabilities
- Autonomous Signal Generation — AI-powered BUY/SELL/SHORT/LONG signals with confidence scoring
- Risk Parity Optimization — Riskfolio-Lib powered portfolio weight optimization
- FinBERT Sentiment Analysis — NLP-driven news and market sentiment scanning
- Economic Quadrant Classification — Growth/Inflation regime detection and allocation
- Walk-Forward Backtesting — 12-month train / 3-month test rolling validation
- Real-Time Dashboard — 7-tab military terminal UI with WebSocket live feeds
- Circuit Breaker System — Automated risk limits and position stop-losses
- Multi-Channel Alerts — Discord webhook and Telegram bot notifications
Installation
Prerequisites
Python 3.10+piporcondaGit- Internet connection for market data feeds
Desktop App (Recommended)
Download the standalone app for your platform — no Python or dependencies needed:
# Windows
Download DALIOS-Setup.exe from the Downloads page
Double-click to install. Launches from Start Menu.
# macOS
Download DALIOS.dmg from the Downloads page
Drag to Applications. Supports Intel & Apple Silicon.
# If blocked: xattr -cr dist/DALIOS.app
# Linux
Download DALIOS.AppImage from the Downloads page
chmod +x DALIOS.AppImage && ./DALIOS.AppImage
# Android
Download DALIOS.apk from GitHub Releases
Transfer to phone, enable "Install from unknown sources", tap to install.
# iOS
Download Xcode project from GitHub Releases
Open in Xcode, sign with your developer account, build & run.
From Source (Developer Install)
# Clone the repository
git clone https://github.com/defthrets/dalios.git
cd dalios
# Create virtual environment
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
Dependencies
| Package | Purpose | Version |
|---|---|---|
fastapi | REST API & WebSocket server | >=0.104 |
uvicorn | ASGI server | >=0.24 |
yfinance | Market data feeds | >=0.2 |
riskfolio-lib | Risk parity optimization | >=4.0 |
transformers | FinBERT NLP models | >=4.35 |
apscheduler | Task scheduling | >=3.10 |
pandas | Data manipulation | >=2.0 |
numpy | Numerical operations | >=1.24 |
Quick Start
1. Configure Environment
Copy the example environment file and set your API keys:
cp .env.example .env
2. Start the Server
# Option A: Windows launcher
run_ui.bat
# Option B: Manual start
python -m uvicorn api.server:app --port 8000 --reload
# Option C: Full autonomous mode with APScheduler
python main.py
3. Open the Dashboard
Navigate to http://localhost:8000 in your browser. The 7-tab command interface will load automatically.
Note: The first launch may take a few minutes as FinBERT models are downloaded (~400MB). Subsequent starts are instant.
Configuration
All configuration is managed through environment variables in your .env file or via the COMMS tab in the UI.
Core Settings
# Market Configuration
MARKET=ASX
SCAN_INTERVAL=30 # seconds between scans
MAX_POSITIONS=15 # maximum concurrent positions
# Risk Management
MAX_DRAWDOWN=0.15 # 15% maximum drawdown trigger
CIRCUIT_BREAKER=true # enable circuit breaker
POSITION_SIZE_PCT=0.05 # 5% max per position
# Notifications
DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/...
TELEGRAM_BOT_TOKEN=your-token-here
TELEGRAM_CHAT_ID=your-chat-id
# API Keys (optional — for live trading)
BROKER_API_KEY=your-broker-key
BROKER_SECRET=your-broker-secret
Security: Never commit your .env file. It is excluded in .gitignore by default. Rotate API keys regularly.
System Architecture
dalios/
├── api/
│ └── server.py # FastAPI backend + WebSocket
├── agents/
│ └── dalio_agent.py # AI orchestrator (Dalio principles)
├── engines/
│ ├── correlation_engine.py # Asset correlation analysis
│ ├── risk_parity_engine.py # Riskfolio-Lib optimization
│ ├── sentiment_engine.py # FinBERT NLP pipeline
│ └── quadrant_engine.py # Dalio quadrant classification
├── trading/
│ ├── signal_generator.py # BUY/SELL/SHORT signal logic
│ ├── execution.py # Order execution engine
│ └── circuit_breaker.py # Risk limit enforcement
├── backtesting/
│ └── walk_forward.py # Walk-forward optimizer
├── notifications/
│ ├── discord_hook.py # Discord webhook integration
│ └── telegram_bot.py # Telegram bot integration
├── ui/
│ ├── index.html # 7-tab terminal dashboard
│ └── static/
│ ├── style.css # Terminal theme
│ └── app.js # Chart.js + WebSocket client
├── config/
│ └── settings.py # Pydantic settings from .env
├── main.py # APScheduler entry point
└── run_ui.bat # Windows launcher
Data Flow
The system follows a continuous intelligence loop:
- Data Ingestion — yfinance fetches real-time prices. News scrapers feed FinBERT.
- Quadrant Classification — Growth and inflation indicators map to Dalio's 4 quadrants.
- Risk Parity Optimization — Riskfolio-Lib calculates optimal weights for 15+ uncorrelated assets.
- Signal Generation — The Dalio Agent synthesizes all inputs into actionable BUY/SELL/SHORT signals.
- Circuit Breaker Validation — Signals pass through risk limits before execution.
- Execution & Notification — Valid signals are executed. Alerts fire to Discord/Telegram.
Module Reference
Dalio Agent agents/dalio_agent.py
The central AI orchestrator. It applies Ray Dalio's principles to generate trading decisions, manages the economic cycle model, and coordinates all engine outputs.
Correlation Engine engines/correlation_engine.py
Computes rolling correlations across all portfolio assets. Powers the Holy Grail diversification meter and identifies correlation regime changes.
Risk Parity Engine engines/risk_parity_engine.py
Uses Riskfolio-Lib to compute optimal portfolio weights that equalize risk contribution across assets. Supports multiple risk measures including CVaR.
Sentiment Engine engines/sentiment_engine.py
FinBERT-based NLP pipeline that scores news articles and market commentary on a bearish-to-bullish scale. Feeds into the Intel Center and signal generation.
Quadrant Engine engines/quadrant_engine.py
Classifies current macro conditions into one of Dalio's four quadrants (Growth +/- and Inflation +/-) and adjusts asset allocation templates accordingly.
Dalio Economic Model
DALIOS implements two key frameworks from Ray Dalio:
All Weather Strategy
A risk-parity approach that aims to perform well in all economic environments by holding a diversified mix of assets with balanced risk contributions. Unlike traditional 60/40 portfolios, All Weather equalizes risk not capital allocation.
Economic Machine
Dalio's model describes the economy as driven by three forces: productivity growth, the short-term debt cycle, and the long-term debt cycle. DALIOS uses this framework to classify market regimes and adjust strategy accordingly.
| Quadrant | Growth | Inflation | Favored Assets |
|---|---|---|---|
| Quadrant I | Rising | Rising | Commodities, TIPS, EM Equities |
| Quadrant II | Rising | Falling | Equities, Corporate Bonds |
| Quadrant III | Falling | Rising | Gold, Commodities, ILBs |
| Quadrant IV | Falling | Falling | Nominal Bonds, Defensive Equities |
REST API Endpoints
The FastAPI server exposes the following endpoints at http://localhost:8000:
| Method | Endpoint | Description |
|---|---|---|
GET | /api/portfolio | Current portfolio state and metrics |
GET | /api/signals | Active trade signals with confidence |
GET | /api/sentiment | FinBERT sentiment scores and news |
GET | /api/correlations | Asset correlation matrix |
GET | /api/risk | Risk metrics (Sharpe, Sortino, drawdown) |
GET | /api/backtest | Walk-forward results |
GET | /api/quadrant | Current economic quadrant |
GET | /api/positions | Open positions table |
POST | /api/config | Update runtime configuration |
GET | /api/health | System health check |
Example Request
# Get active signals
curl http://localhost:8000/api/signals | python -m json.tool
# Response
{
"signals": [
{
"ticker": "BHP.AX",
"action": "BUY",
"confidence": 0.87,
"quadrant": "Growth+Inflation",
"justification": "Strong commodity exposure in rising inflation regime"
}
],
"timestamp": "2026-04-08T09:30:00Z"
}
WebSocket API
Real-time data streaming is available via WebSocket at ws://localhost:8000/ws.
const ws = new WebSocket('ws://localhost:8000/ws');
ws.onmessage = (event) => {
const data = JSON.parse(event.data);
// data.type: 'signal' | 'portfolio' | 'alert' | 'sentiment'
console.log(`[${data.type}]`, data.payload);
};
Message Types
signal— New trade signal generatedportfolio— Portfolio state update (every 30s)alert— System alerts (circuit breaker, risk warnings)sentiment— New sentiment score from FinBERT
Risk Management
Circuit Breaker
The circuit breaker automatically halts trading when risk thresholds are breached:
- Max Drawdown — Stops all new positions if portfolio drawdown exceeds the configured limit (default: 15%)
- Position Limits — No single position exceeds the configured percentage of total capital (default: 5%)
- Correlation Spike — Reduces exposure when cross-asset correlations spike above 0.8
- Volatility Regime — Automatically scales position sizes inversely with realized volatility
Important: The circuit breaker should never be disabled in live trading. It is your last line of defense against catastrophic losses.
Backtesting
DALIOS uses walk-forward optimization to validate strategies against out-of-sample data.
Walk-Forward Method
- Training Window: 12 months of historical data used to optimize parameters
- Test Window: 3 months of forward data to validate performance
- Rolling: Windows advance by the test period, creating multiple train/test cycles
- Aggregation: Out-of-sample results are combined for true performance assessment
from backtesting.walk_forward import WalkForwardOptimizer
optimizer = WalkForwardOptimizer(
train_months=12,
test_months=3,
strategy="all_weather"
)
results = optimizer.run(start_date="2020-01-01")
results.summary()
Notifications
Discord
Set your Discord webhook URL in the .env file or via the COMMS tab. Alerts include:
- New trade signals with confidence and quadrant
- Position opened/closed events
- Circuit breaker activations
- Daily portfolio summary
Telegram
Configure your Telegram bot token and chat ID. The bot supports interactive commands:
/status— Current portfolio status/signals— Active trade signals/risk— Risk metrics summary/pause— Temporarily pause trading