{"id":37073580,"url":"https://github.com/nittygritty-zzy/quantlab","last_synced_at":"2026-01-14T08:38:18.512Z","repository":{"id":319174344,"uuid":"1077371120","full_name":"nittygritty-zzy/quantlab","owner":"nittygritty-zzy","description":"🚀 Professional quantitative trading research platform with ML-powered backtesting, multi-source options analysis, portfolio management, and interactive Plotly visualizations. Built on qlib with CLI interface.","archived":false,"fork":false,"pushed_at":"2025-10-17T16:46:19.000Z","size":1214,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-18T00:34:35.836Z","etag":null,"topics":["algorithmic-trading","backtesting","cli","data-visualization","financial-analysis","machine-learning","options-trading","plotly","portfolio-management","python","qlib","quantitative-finance"],"latest_commit_sha":null,"homepage":"https://quantlabs.readthedocs.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nittygritty-zzy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-16T06:55:39.000Z","updated_at":"2025-10-17T16:46:23.000Z","dependencies_parsed_at":"2025-10-20T17:09:09.761Z","dependency_job_id":null,"html_url":"https://github.com/nittygritty-zzy/quantlab","commit_stats":null,"previous_names":["nittygritty-zzy/quantlab"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/nittygritty-zzy/quantlab","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nittygritty-zzy%2Fquantlab","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nittygritty-zzy%2Fquantlab/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nittygritty-zzy%2Fquantlab/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nittygritty-zzy%2Fquantlab/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nittygritty-zzy","download_url":"https://codeload.github.com/nittygritty-zzy/quantlab/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nittygritty-zzy%2Fquantlab/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28414668,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T08:31:27.429Z","status":"ssl_error","status_checked_at":"2026-01-14T08:31:19.098Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algorithmic-trading","backtesting","cli","data-visualization","financial-analysis","machine-learning","options-trading","plotly","portfolio-management","python","qlib","quantitative-finance"],"created_at":"2026-01-14T08:38:17.771Z","updated_at":"2026-01-14T08:38:18.503Z","avatar_url":"https://github.com/nittygritty-zzy.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# QuantLab - Quantitative Trading Research Platform\n\n[![PyPI version](https://img.shields.io/pypi/v/quantlabs.svg)](https://pypi.org/project/quantlabs/)\n[![Documentation Status](https://readthedocs.org/projects/quantlabs/badge/?version=latest)](https://quantlabs.readthedocs.io/en/latest/?badge=latest)\n[![Python Version](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)\n[![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)\n[![Release](https://img.shields.io/github/v/release/nittygritty-zzy/quantlab)](https://github.com/nittygritty-zzy/quantlab/releases)\n\nA quantitative trading research platform powered by Microsoft's Qlib, designed for systematic alpha generation and backtesting.\n\n📚 **[Full Documentation](https://quantlabs.readthedocs.io)** | 🚀 **[Quick Start Guide](https://quantlabs.readthedocs.io/en/latest/quickstart.html)** | 📖 **[API Reference](https://quantlabs.readthedocs.io/en/latest/api/core.html)**\n\n## 📁 Project Structure\n\n```\nquantlab/\n├── README.md                       # This file\n├── .gitignore                      # Git ignore rules\n├── .venv/                          # Python virtual environment (uv)\n│\n├── docs/                           # Documentation\n│   ├── BACKTEST_SUMMARY.md         # Backtest results analysis\n│   ├── ALPHA158_SUMMARY.md         # Alpha158 features documentation\n│   ├── ALPHA158_CORRECTED.md       # Alpha158 corrections\n│   ├── USE_QLIB_ALPHA158.md        # Guide for using Alpha158\n│   └── QUANTMINI_README.md         # QuantMini data setup\n│\n├── scripts/                        # Utility scripts\n│   ├── data/                       # Data processing\n│   │   ├── convert_to_qlib.py      # Convert data to qlib format\n│   │   ├── refresh_today_data.py   # Update latest data\n│   │   └── quantmini_setup.py      # QuantMini data setup\n│   ├── analysis/                   # Analysis tools\n│   │   └── visualize_results.py    # Backtest visualization\n│   └── tests/                      # Test scripts\n│       ├── test_qlib_alpha158.py   # Test Alpha158 features\n│       ├── test_stocks_minute_fix.py\n│       └── enable_alpha158.py\n│\n├── configs/                        # Qlib workflow configurations\n│   ├── lightgbm_external_data.yaml # Full universe (all stocks)\n│   ├── lightgbm_fixed_dates.yaml   # 2024 only (date filter)\n│   └── lightgbm_liquid_universe.yaml # Filtered liquid stocks\n│\n├── results/                        # Backtest outputs\n│   ├── visualizations/             # Charts and plots\n│   │   └── backtest_visualization.png\n│   └── mlruns/                     # MLflow experiment tracking\n│       └── 489214785307856385/     # Experiment runs\n│\n├── data/                           # Local data storage\n│   ├── parquet/                    # Raw parquet files\n│   └── metadata/                   # Metadata files\n│\n├── notebooks/                      # Jupyter notebooks\n│   └── workflow_by_code.ipynb      # Qlib workflow examples\n│\n├── system/                         # System-level configuration\n│   └── system_profile.yaml         # Qlib system settings\n│\n└── qlib_repo/                      # Qlib source (gitignored, 828MB)\n    └── (Microsoft qlib clone)\n```\n\n## 🚀 Quick Start\n\n### Installation from PyPI\n\n```bash\n# Install from PyPI\npip install quantlabs\n\n# Or using uv (recommended)\nuv pip install quantlabs\n\n# Verify installation\nquantlab --version\nquantlab --help\n```\n\n### Development Setup\n\n```bash\n# Clone the repository\ngit clone https://github.com/nittygritty-zzy/quantlab.git\ncd quantlab\n\n# Using uv (recommended)\nuv venv\nsource .venv/bin/activate\nuv sync\n\n# Or using pip\npython -m venv .venv\nsource .venv/bin/activate\npip install -e .\n```\n\n### 2. Prepare Data\n\n```bash\n# Option A: Use external data (QuantMini on /Volumes/sandisk)\n# Data is already at: /Volumes/sandisk/quantmini-data/data/qlib/stocks_daily\n\n# Option B: Download community data\nwget https://github.com/chenditc/investment_data/releases/latest/download/qlib_bin.tar.gz\nmkdir -p ~/.qlib/qlib_data/cn_data\ntar -zxvf qlib_bin.tar.gz -C ~/.qlib/qlib_data/cn_data --strip-components=1\n```\n\n### 3. Run a Backtest\n\n```bash\n# Navigate to qlib examples (if using qlib_repo)\ncd qlib_repo/examples\n\n# Run workflow with external data\nuv run qrun ../../configs/lightgbm_liquid_universe.yaml\n```\n\n### 4. Visualize Results\n\n```bash\n# Update the experiment ID in visualize_results.py, then:\nuv run python scripts/analysis/visualize_results.py\n```\n\nResults will be saved to `results/visualizations/backtest_visualization.png`\n\n## 💼 QuantLab CLI - Real-World Use Cases\n\nQuantLab includes a powerful CLI for portfolio management, market analysis, and data queries.\n\n### 🎬 Use Case 1: Building a Tech Portfolio\n\n**Scenario**: Create and manage a diversified tech portfolio with FAANG+ stocks.\n\n```bash\n# Initialize QuantLab\nquantlab init\n\n# Create a tech portfolio\nquantlab portfolio create tech_giants --name \"FAANG+ Portfolio\" \\\n    --description \"Large-cap tech companies\"\n\n# Add positions with target weights\nquantlab portfolio add tech_giants AAPL GOOGL MSFT --weight 0.20\nquantlab portfolio add tech_giants META AMZN --weight 0.15\nquantlab portfolio add tech_giants NVDA --weight 0.10\n\n# View your portfolio\nquantlab portfolio show tech_giants\n\n# Expected output:\n# 📊 Portfolio: FAANG+ Portfolio\n# 📈 Positions: 6\n# ├─ AAPL    │ Weight: 20.00% │ Shares: -   │ Cost Basis: -\n# ├─ GOOGL   │ Weight: 20.00% │ Shares: -   │ Cost Basis: -\n# ├─ MSFT    │ Weight: 20.00% │ Shares: -   │ Cost Basis: -\n# ├─ META    │ Weight: 15.00% │ Shares: -   │ Cost Basis: -\n# ├─ AMZN    │ Weight: 15.00% │ Shares: -   │ Cost Basis: -\n# └─ NVDA    │ Weight: 10.00% │ Shares: -   │ Cost Basis: -\n# Total Weight: 100.00%\n```\n\n### 📊 Use Case 2: Real Position Tracking\n\n**Scenario**: Track actual shares purchased at specific cost basis.\n\n```bash\n# Update positions with real trade data\nquantlab portfolio update tech_giants AAPL \\\n    --shares 50 \\\n    --cost-basis 178.25 \\\n    --notes \"Bought on Q4 dip\"\n\nquantlab portfolio update tech_giants GOOGL \\\n    --shares 30 \\\n    --cost-basis 142.50 \\\n    --notes \"Post-earnings entry\"\n\nquantlab portfolio update tech_giants NVDA \\\n    --shares 20 \\\n    --cost-basis 485.00 \\\n    --notes \"AI boom position\"\n\n# View updated portfolio\nquantlab portfolio show tech_giants\n\n# Expected output:\n# 📊 Portfolio: FAANG+ Portfolio\n# 📈 Positions: 6\n# ├─ AAPL    │ Weight: 20.00% │ Shares: 50  │ Cost: $178.25 │ \"Bought on Q4 dip\"\n# ├─ GOOGL   │ Weight: 20.00% │ Shares: 30  │ Cost: $142.50 │ \"Post-earnings entry\"\n# ├─ NVDA    │ Weight: 10.00% │ Shares: 20  │ Cost: $485.00 │ \"AI boom position\"\n# Total Investment: $22,812.50\n```\n\n### 🔍 Use Case 3: Analyzing a Stock Before Purchase\n\n**Scenario**: Deep-dive analysis on ORCL before adding to portfolio.\n\n```bash\n# Comprehensive analysis with all data sources\nquantlab analyze ticker ORCL \\\n    --include-fundamentals \\\n    --include-options \\\n    --include-sentiment \\\n    --include-technicals \\\n    --output results/orcl_analysis.json\n\n# Expected output:\n# 🔍 Analyzing ORCL (Oracle Corporation)\n#\n# 📈 Price Information:\n#    Current: $145.50\n#    Change: +2.3% ($3.25)\n#    Volume: 5,234,567\n#\n# 💰 Fundamentals:\n#    Market Cap: $401.2B\n#    P/E Ratio: 28.5\n#    Forward P/E: 21.2\n#    Revenue Growth: 7.2%\n#    Profit Margin: 21.5%\n#    Debt/Equity: 2.84\n#\n# 📊 Options Activity:\n#    Put/Call Ratio: 0.78 (Bullish)\n#    Implied Volatility: 22.5%\n#    Next Earnings: 2025-03-15 (30 days)\n#\n# 📰 Sentiment Analysis:\n#    Score: 0.72 (Positive)\n#    Articles: 45 (7 days)\n#    Buzz: High\n#\n# 🎯 Analyst Consensus:\n#    Rating: Buy (12) / Hold (8) / Sell (2)\n#    Target Price: $165.00 (+13.4%)\n#\n# ✅ Analysis complete → results/orcl_analysis.json\n\n# Visualize price action\nquantlab visualize price ORCL --period 90d --chart-type candlestick\nquantlab visualize price ORCL --period 1year --chart-type line\n\n# Quick decision check\nquantlab lookup get company ORCL\nquantlab lookup get ratings ORCL\n```\n\n### 📈 Use Case 4: Portfolio-Wide Analysis\n\n**Scenario**: Analyze all positions in your tech portfolio.\n\n```bash\n# Analyze entire portfolio\nquantlab analyze portfolio tech_giants \\\n    --include-options \\\n    --aggregate-metrics \\\n    --output results/tech_giants_analysis.json\n\n# Expected output:\n# 📊 Analyzing Portfolio: FAANG+ Portfolio (6 positions)\n#\n# Processing: [████████████████████] 6/6\n#\n# Individual Analyses:\n# ✓ AAPL  │ Score: 82/100 │ Sentiment: Positive │ Analysts: 85% Buy\n# ✓ GOOGL │ Score: 78/100 │ Sentiment: Positive │ Analysts: 80% Buy\n# ✓ MSFT  │ Score: 88/100 │ Sentiment: Very Positive │ Analysts: 90% Buy\n# ✓ META  │ Score: 75/100 │ Sentiment: Neutral │ Analysts: 75% Buy\n# ✓ AMZN  │ Score: 81/100 │ Sentiment: Positive │ Analysts: 82% Buy\n# ⚠ NVDA  │ Score: 68/100 │ Sentiment: Mixed │ Analysts: 70% Buy\n#\n# Portfolio Metrics:\n# Total Value: $52,450\n# Avg P/E: 32.5\n# Avg Sentiment: 0.68 (Positive)\n# Portfolio Beta: 1.15\n# Weighted Analyst Rating: 80% Buy\n#\n# ⚠️ Alerts:\n# - NVDA showing weakness (consider reducing position)\n# - MSFT strongest performer (98% of analysts bullish)\n\n# Visualize portfolio performance comparison\nquantlab visualize compare AAPL GOOGL MSFT META AMZN NVDA \\\n    --period 90d \\\n    --normalize \\\n    --output results/tech_giants_comparison.html\n```\n\n### 🔎 Use Case 5: Querying Historical Data\n\n**Scenario**: Research historical price patterns for backtesting.\n\n```bash\n# Query daily stock data\nquantlab data query AAPL GOOGL MSFT \\\n    --start 2024-01-01 \\\n    --end 2025-01-15 \\\n    --type stocks_daily \\\n    --limit 100\n\n# Expected output:\n# 📊 Querying data for 3 tickers...\n#\n# AAPL (Apple Inc.)\n# Date Range: 2024-01-01 to 2025-01-15 (252 trading days)\n#\n# Recent Data (last 5 days):\n# Date       │ Open    │ High    │ Low     │ Close   │ Volume\n# 2025-01-15 │ $180.25 │ $182.50 │ $179.80 │ $181.75 │ 52.3M\n# 2025-01-14 │ $179.50 │ $181.25 │ $178.90 │ $180.25 │ 48.7M\n# ...\n#\n# Performance: +15.3% YTD\n# Volatility: 18.5% (annualized)\n\n# Visualize historical price patterns\nquantlab visualize price AAPL --period 2year --chart-type candlestick\nquantlab visualize price AAPL --interval 5min --period 5d --chart-type line\n\n# Check available data coverage\nquantlab data check\n\n# Expected output:\n# 📁 Parquet Data Availability\n# ✓ stocks_daily    │ 13,187 tickers │ 2024-09-01 to 2025-10-15 (442 days)\n# ✓ stocks_minute   │ 8,523 tickers  │ Last 90 days\n# ✓ options_daily   │ 3,245 tickers  │ 2024-09-01 to 2025-10-15\n# ✗ options_minute  │ Not available\n```\n\n### 🏦 Use Case 6: Maintaining Reference Data\n\n**Scenario**: Keep company info and analyst ratings up-to-date.\n\n```bash\n# Initialize lookup tables\nquantlab lookup init\n\n# Refresh data for your portfolio\nquantlab lookup refresh portfolio tech_giants\n\n# Expected output:\n# 🔄 Refreshing data for 6 tickers in tech_giants...\n#\n# Company Info:\n# ✓ AAPL  - Apple Inc. (Technology - Consumer Electronics)\n# ✓ GOOGL - Alphabet Inc. (Technology - Internet Services)\n# ✓ MSFT  - Microsoft Corporation (Technology - Software)\n# ✓ META  - Meta Platforms Inc. (Technology - Social Media)\n# ✓ AMZN  - Amazon.com Inc. (Consumer Cyclical - Internet Retail)\n# ✓ NVDA  - NVIDIA Corporation (Technology - Semiconductors)\n#\n# Analyst Ratings:\n# ✓ AAPL  - 35 analysts (Buy: 28, Hold: 6, Sell: 1) Target: $210\n# ✓ GOOGL - 42 analysts (Buy: 35, Hold: 6, Sell: 1) Target: $165\n# ✓ MSFT  - 48 analysts (Buy: 43, Hold: 4, Sell: 1) Target: $450\n# ✓ META  - 38 analysts (Buy: 28, Hold: 8, Sell: 2) Target: $520\n# ✓ AMZN  - 45 analysts (Buy: 38, Hold: 6, Sell: 1) Target: $215\n# ✓ NVDA  - 40 analysts (Buy: 32, Hold: 7, Sell: 1) Target: $850\n#\n# ✅ Refresh complete (6/6 successful)\n\n# View stored data\nquantlab lookup stats\n\n# Expected output:\n# 📊 Lookup Tables Statistics\n#\n# Company Information: 6 companies\n# Analyst Ratings: 6 tickers (248 total analysts)\n# Treasury Rates: Current (updated: 2025-10-15)\n# Last Updated: 2025-10-15 14:32:15\n```\n\n### 🎯 Use Case 7: Multi-Portfolio Strategy\n\n**Scenario**: Manage multiple portfolios for different strategies.\n\n```bash\n# Create portfolios for different strategies\nquantlab portfolio create growth --name \"High Growth\" \\\n    --description \"Growth stocks with P/E \u003e 30\"\n\nquantlab portfolio create value --name \"Value Plays\" \\\n    --description \"Undervalued stocks with P/E \u003c 15\"\n\nquantlab portfolio create dividend --name \"Dividend Income\" \\\n    --description \"High dividend yield stocks\"\n\n# Add different stocks to each\nquantlab portfolio add growth NVDA TSLA SNOW --weight 0.33\nquantlab portfolio add value BAC JPM WFC --weight 0.33\nquantlab portfolio add dividend T VZ SO --weight 0.33\n\n# View all portfolios\nquantlab portfolio list\n\n# Expected output:\n# 📊 Your Portfolios\n#\n# Portfolio ID    │ Name              │ Positions │ Total Weight │ Last Updated\n# ────────────────┼───────────────────┼───────────┼──────────────┼─────────────\n# tech_giants     │ FAANG+ Portfolio  │ 6         │ 100.00%      │ 2025-10-15\n# growth          │ High Growth       │ 3         │ 99.00%       │ 2025-10-15\n# value           │ Value Plays       │ 3         │ 99.00%       │ 2025-10-15\n# dividend        │ Dividend Income   │ 3         │ 99.00%       │ 2025-10-15\n#\n# Total Portfolios: 4\n# Total Unique Positions: 15\n```\n\n### 🔬 Use Case 8: Options Strategy Research\n\n**Scenario**: Research options opportunities for covered calls.\n\n```bash\n# Analyze ticker specifically for options\nquantlab analyze ticker AAPL \\\n    --include-options \\\n    --no-fundamentals \\\n    --no-sentiment \\\n    --output results/aapl_options.json\n\n# Expected output:\n# 🔍 Options Analysis: AAPL\n#\n# Current Price: $181.75\n#\n# Near-Term Expiration (30 days):\n# Call Options (Covered Call Candidates):\n# Strike │ Premium │ IV    │ Delta │ Break-even │ Return\n# ───────┼─────────┼───────┼───────┼────────────┼────────\n# $185   │ $3.85   │ 21.2% │ 0.45  │ $185.00    │ 2.1%\n# $190   │ $2.15   │ 19.8% │ 0.28  │ $190.00    │ 4.6%\n# $195   │ $0.95   │ 18.5% │ 0.15  │ $195.00    │ 7.3%\n#\n# Put Options (Cash-Secured Put Candidates):\n# Strike │ Premium │ IV    │ Delta │ Net Cost   │ Yield\n# ───────┼─────────┼───────┼───────┼────────────┼────────\n# $175   │ $2.80   │ 22.5% │ -0.35 │ $172.20    │ 1.6%\n# $170   │ $1.45   │ 20.1% │ -0.20 │ $168.55    │ 0.9%\n#\n# Volatility Metrics:\n# Current IV: 21.2%\n# Historical Vol (30d): 18.5%\n# IV Percentile: 62% (Elevated)\n#\n# 💡 Suggestion: Good conditions for selling premium\n#    IV elevated vs historical - consider covered calls at $190 strike\n\n# Visualize options payoff diagrams\nquantlab visualize options long_call --current-price 181.75 --strike 190 --premium 2.15\nquantlab visualize options bull_call_spread \\\n    --current-price 181.75 --strike1 185 --strike2 195 --premium 1.70\n```\n\n### 📅 Use Case 9: Regular Portfolio Review\n\n**Scenario**: Monthly portfolio review workflow.\n\n```bash\n# Step 1: Refresh all market data\nquantlab lookup refresh portfolio tech_giants\n\n# Step 2: Get comprehensive analysis\nquantlab analyze portfolio tech_giants --aggregate-metrics\n\n# Step 3: Visualize portfolio performance\nquantlab visualize compare AAPL GOOGL MSFT META AMZN NVDA --period 30d --normalize\n\n# Step 4: Review individual positions\nquantlab visualize price AAPL --period 90d --chart-type candlestick\nquantlab visualize price NVDA --period 90d --chart-type candlestick\n\n# Step 5: Check for rebalancing needs\nquantlab portfolio show tech_giants\n\n# Step 6: Look for new opportunities\nquantlab data tickers --type stocks_daily | grep -E \"^[A-Z]{1,4}$\" | head -20\nquantlab analyze ticker CRM --include-fundamentals\nquantlab visualize price CRM --period 90d --chart-type candlestick\n\n# Step 7: Update positions based on analysis\nquantlab portfolio update tech_giants NVDA --weight 0.05 --notes \"Reduced - valuation concerns\"\nquantlab portfolio add tech_giants CRM --weight 0.05 --notes \"New position - cloud growth\"\n\n# Step 8: Export for records\nquantlab analyze portfolio tech_giants --output results/monthly_review_2025_10.json\n```\n\n### 🚨 Use Case 10: Risk Monitoring\n\n**Scenario**: Monitor portfolio risk daily.\n\n```bash\n# Create a monitoring script\ncat \u003e scripts/daily_monitor.sh \u003c\u003c 'EOF'\n#!/bin/bash\nDATE=$(date +%Y-%m-%d)\n\necho \"🔍 Daily Portfolio Monitor - $DATE\"\necho \"==================================\"\n\n# Analyze each portfolio\nfor portfolio in tech_giants growth value dividend; do\n    echo \"\"\n    echo \"📊 Portfolio: $portfolio\"\n    quantlab analyze portfolio $portfolio \\\n        --include-options \\\n        --output \"results/monitoring/${portfolio}_${DATE}.json\" 2\u003e\u00261 | \\\n        grep -E \"(Score:|Sentiment:|Analysts:|⚠|❌)\"\ndone\n\n# Check treasury rates for risk-free rate\necho \"\"\necho \"📈 Current Treasury Rates:\"\nquantlab lookup get treasury 10y\n\necho \"\"\necho \"✅ Monitoring complete\"\nEOF\n\nchmod +x scripts/daily_monitor.sh\n\n# Run daily monitoring\n./scripts/daily_monitor.sh\n\n# Expected output:\n# 🔍 Daily Portfolio Monitor - 2025-10-15\n# ==================================\n#\n# 📊 Portfolio: tech_giants\n# ✓ AAPL  │ Score: 82/100 │ Sentiment: Positive\n# ✓ GOOGL │ Score: 78/100 │ Sentiment: Positive\n# ⚠ NVDA  │ Score: 68/100 │ Sentiment: Mixed\n#\n# 📈 Current Treasury Rates:\n# 10-Year Treasury: 4.25% (as of 2025-10-15)\n#\n# ✅ Monitoring complete\n```\n\n## 📊 Available Configurations\n\n### 1. **Liquid Universe** (Recommended)\n- **File**: `configs/lightgbm_liquid_universe.yaml`\n- **Universe**: 13,187 stocks (filtered - no warrants, units)\n- **Period**: Sept 2024 - Sept 2025\n- **Best for**: Realistic backtesting with tradable stocks\n\n### 2. **Fixed Dates**\n- **File**: `configs/lightgbm_fixed_dates.yaml`\n- **Universe**: All stocks\n- **Period**: July 2024 - Dec 2024\n- **Best for**: Testing on stable period\n\n### 3. **Full Universe**\n- **File**: `configs/lightgbm_external_data.yaml`\n- **Universe**: All 14,310 instruments (includes warrants, penny stocks)\n- **Period**: Sept 2024 - Sept 2025\n- **Best for**: Maximum alpha discovery (but risky)\n\n## 🎯 Key Metrics from Latest Runs\n\n| Configuration | IC | Rank IC | Sharpe | Max DD | Universe Size |\n|--------------|-----|---------|--------|--------|---------------|\n| Liquid Universe | 0.066 | -0.006 | 3.94 | -39.2% | 13,187 |\n| Fixed Dates | 0.079 | -0.008 | 4.54 | -35.3% | 14,310 |\n| Full Universe | 0.080 | -0.004 | 2.98 | -41.7% | 14,310 |\n\n**IC (Information Coefficient)**: 0.06-0.08 is good - shows predictive power\n**Rank IC**: Near zero - model struggles with relative ranking\n**Sharpe Ratio**: 2.98-4.54 - excellent risk-adjusted returns\n\n## 📊 Visualization Capabilities\n\nQuantLab includes comprehensive interactive visualization tools powered by Plotly.\n\n### Price Charts\n\n```bash\n# Candlestick charts (daily data)\nquantlab visualize price AAPL --period 90d --chart-type candlestick\n\n# Line charts with volume\nquantlab visualize price AAPL --period 1year --chart-type line\n\n# Intraday charts (5min, 15min, 1hour intervals)\nquantlab visualize price AAPL --interval 5min --period 5d --chart-type candlestick\nquantlab visualize price NVDA --interval 1hour --period 30d --chart-type line\n```\n\n**Features:**\n- Multiple timeframes: 1d, 5d, 30d, 90d, 1year, 2year\n- Intraday intervals: 1min, 5min, 15min, 1hour\n- Categorical x-axis for gap-free intraday charts\n- Timezone-aware (US Eastern Time)\n- Regular market hours filtering (9:30 AM - 4:00 PM ET)\n\n**Example Charts:**\n- [Daily Candlestick (90d)](docs/images/price_candlestick_90d.html)\n- [Intraday 5-minute Line](docs/images/price_intraday_5min.html)\n\n### Multi-Ticker Comparison\n\n```bash\n# Compare normalized performance\nquantlab visualize compare AAPL GOOGL MSFT --period 90d --normalize\n\n# Absolute price comparison\nquantlab visualize compare AAPL GOOGL MSFT --period 1year\n```\n\n**Example Chart:**\n- [Normalized Comparison (90d)](docs/images/comparison_normalized.html)\n\n### Options Payoff Diagrams\n\n```bash\n# Single leg strategies\nquantlab visualize options long_call --current-price 180 --strike 190 --premium 2.15\nquantlab visualize options long_put --current-price 180 --strike 175 --premium 2.80\n\n# Spread strategies\nquantlab visualize options bull_call_spread \\\n    --current-price 180 --strike1 185 --strike2 195 --premium 1.70\n\nquantlab visualize options iron_condor \\\n    --current-price 180 --strike1 170 --strike2 175 --strike3 195 --strike4 200\n```\n\n**Available Strategies:**\n- Single: `long_call`, `long_put`, `short_call`, `short_put`\n- Spreads: `bull_call_spread`, `bear_put_spread`, `iron_condor`, `butterfly`\n- Volatility: `long_straddle`, `short_straddle`, `long_strangle`, `short_strangle`\n\n**Example Chart:**\n- [Bull Call Spread Payoff](docs/images/options_bull_call_spread.html)\n\n### Backtest Results\n\n```bash\n# Visualize backtest performance\nquantlab visualize backtest results/mlruns/[experiment_id]\n```\n\n**Metrics Displayed:**\n- Cumulative returns vs benchmark\n- Drawdown analysis\n- Rolling Sharpe ratio\n- Win/loss distribution\n- Monthly returns heatmap\n\n## 📚 Documentation\n\n- **[BACKTEST_SUMMARY.md](docs/BACKTEST_SUMMARY.md)** - Comprehensive analysis of backtest results, root cause analysis, and recommendations\n- **[ALPHA158_SUMMARY.md](docs/ALPHA158_SUMMARY.md)** - Overview of Alpha158 features used\n- **[USE_QLIB_ALPHA158.md](docs/USE_QLIB_ALPHA158.md)** - How to use Alpha158 in your strategies\n- **[CLI_VISUALIZATION_GUIDE.md](docs/CLI_VISUALIZATION_GUIDE.md)** - Complete guide to visualization features\n\n## 🔧 Data Setup\n\n### External Data Location\n```\n/Volumes/sandisk/quantmini-data/data/qlib/stocks_daily/\n├── calendars/day.txt           # Trading calendar (442 days)\n├── instruments/\n│   ├── all.txt                 # All 14,310 instruments\n│   └── liquid_stocks.txt       # Filtered 13,187 instruments\n└── features/                   # Stock price data (OHLCV)\n```\n\n### Creating Custom Universe Filters\n\n```python\n# See scripts/data/ for examples\n# Filter by:\n# - Market cap\n# - Average volume\n# - Exclude warrants/units\n# - Sector/industry\n```\n\n## 🧪 Testing\n\n```bash\n# Test Alpha158 features\npython scripts/tests/test_qlib_alpha158.py\n\n# Test data conversion\npython scripts/data/convert_to_qlib.py\n\n# Refresh latest data\npython scripts/data/refresh_today_data.py\n```\n\n## 🔍 Next Steps\n\n### Improve Model Performance\n1. **Fix Rank IC** - Try ensemble models (XGBoost, TabNet, LSTM)\n2. **Better features** - Add momentum, volatility, cross-sectional features\n3. **Risk controls** - Add position limits, volatility weighting\n\n### Data Quality\n1. Validate corporate actions (splits, dividends)\n2. Check for survivorship bias\n3. Add liquidity filters (min volume, market cap)\n\n### Alternative Strategies\n1. Market-neutral long-short\n2. Factor-based weighting\n3. Multi-timeframe approaches\n\n## 📝 Notes\n\n- **Data Source**: External data from QuantMini (US stocks, daily, 2024-2025)\n- **ML Framework**: Qlib by Microsoft Research\n- **Models Tested**: LightGBM with Alpha158 features\n- **Tracking**: MLflow for experiment management\n\n## ⚠️ Known Issues\n\n1. **Unrealistic backtest returns** - Investigating data quality and backtest engine\n2. **Rank IC near zero** - Model can predict returns but not rank stocks well\n3. **High volatility** - Some instruments show extreme price movements\n4. See [BACKTEST_SUMMARY.md](docs/BACKTEST_SUMMARY.md) for detailed analysis\n\n## 🤝 Contributing\n\nThis is a research project. Key areas for improvement:\n- Better universe filters\n- Alternative features\n- Improved ranking models\n- Risk management strategies\n\n## 📄 License\n\nResearch and educational purposes.\n\n## 🔗 Resources\n\n- [Qlib Documentation](https://qlib.readthedocs.io/)\n- [Qlib GitHub](https://github.com/microsoft/qlib)\n- [Alpha158 Paper](https://arxiv.org/abs/2107.08321)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnittygritty-zzy%2Fquantlab","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnittygritty-zzy%2Fquantlab","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnittygritty-zzy%2Fquantlab/lists"}