Production-grade quantitative portfolio toolkit โ multi-broker aggregation, institutional risk analytics, options lifecycle management, and 20+ automated finance workflows
Project description
Clawdfolio ๐ฆ๐
English | ไธญๆ
Production-grade quantitative portfolio toolkit โ multi-broker aggregation, institutional risk analytics, options lifecycle management, and 20+ automated finance workflows.
Also available as a native Claude Code / Clawdbot skill.
Why Clawdfolio?
| Traditional Tools | Clawdfolio |
|---|---|
| Manual data entry | Auto-sync from Longport, Moomoo/Futu |
| Basic P&L tracking | VaR, Sharpe, Beta, Max Drawdown, HHI |
| Single broker view | Multi-broker aggregation |
| Spreadsheet alerts | Smart RSI / price / P&L alerts |
| No extensibility | Python API + CLI + Claude Code skill |
Features
- Multi-Broker Support โ Longport (Longbridge), Moomoo/Futu, or demo mode
- Risk Analytics โ Volatility, Beta, Sharpe Ratio, Value at Risk, Max Drawdown
- Technical Analysis โ RSI, SMA, EMA, Bollinger Bands
- Concentration Analysis โ HHI index, sector exposure, correlation warnings
- Smart Alerts โ Price movements, RSI extremes, P&L thresholds
- Earnings Calendar โ Track upcoming earnings for holdings
- DCA Analysis โ Dollar-cost averaging signals
- Options Toolkit โ Option quote/Greeks, option chain snapshot, buyback trigger monitor
- Options Strategy Playbook (v2.1) โ Covered Call and Sell Put lifecycle management with delta/gamma/margin guardrails
- Finance Workflow Suite โ 20 production workflows for reports, alerts, market intel, and broker snapshots
Quick Start
Installation
pip install clawdfolio # Core
pip install clawdfolio[longport] # + Longport broker
pip install clawdfolio[futu] # + Moomoo/Futu broker
pip install clawdfolio[all] # All brokers
CLI Usage
clawdfolio summary # Portfolio overview
clawdfolio risk # Risk metrics (VaR, Sharpe, Beta, etc.)
clawdfolio quotes AAPL TSLA NVDA # Real-time quotes
clawdfolio alerts # Check alerts
clawdfolio earnings # Upcoming earnings calendar
clawdfolio dca AAPL # DCA analysis
Example Output: clawdfolio summary
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Portfolio Summary โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ Net Assets: $41,863.57 Day Change: +$327.42 โ
โ Total P&L: +$6,847.23 Return: +19.55% โ
โ Positions: 15 Brokers: 2 โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ Top Holdings โ
โ TQQQ $11,058.00 26.4% +32.1% โ
โ NVDA $5,280.00 12.6% +45.2% โ
โ AAPL $4,125.00 9.9% +12.8% โ
โ MSFT $3,840.00 9.2% +15.6% โ
โ QQQ $3,520.00 8.4% +22.3% โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Options Commands
clawdfolio options expiries TQQQ
clawdfolio options quote TQQQ --expiry 2026-06-18 --strike 60 --type C
clawdfolio options chain TQQQ --expiry 2026-06-18 --side both --limit 10
clawdfolio options buyback # Trigger check from config
Python API
from clawdfolio.brokers import get_broker
from clawdfolio.analysis import analyze_risk
broker = get_broker("demo") # or "longport", "futu"
broker.connect()
portfolio = broker.get_portfolio()
metrics = analyze_risk(portfolio)
print(f"Net Assets: ${portfolio.net_assets:,.2f}")
print(f"Sharpe Ratio: {metrics.sharpe_ratio:.2f}")
print(f"VaR 95%: ${metrics.var_95:,.2f}")
Risk Metrics
| Metric | Description |
|---|---|
| Volatility | 20-day and 60-day annualized |
| Beta | Correlation with SPY/QQQ |
| Sharpe Ratio | Risk-adjusted returns |
| VaR | Value at Risk (95%/99%) |
| Max Drawdown | Largest peak-to-trough decline |
| HHI | Portfolio concentration index |
Options Toolkit
The built-in options module provides real-time Greeks inspection, chain analysis, and stateful buyback monitoring:
| Command | Description |
|---|---|
options expiries |
List available expiry dates for a symbol |
options quote |
Single option quote with Greeks (delta, gamma, theta, vega, IV) |
options chain |
Full option chain snapshot with filtering |
options buyback |
Stateful trigger monitor for short option buyback |
Strategy methodology is documented in the Options Strategy Playbook โ covering Covered Call and Sell Put lifecycle management with delta-based strike selection, roll/assignment rules, and margin guardrails.
Configuration
Environment Variables
# Longport
export LONGPORT_APP_KEY=your_app_key
export LONGPORT_APP_SECRET=your_app_secret
export LONGPORT_ACCESS_TOKEN=your_access_token
# Moomoo: Run OpenD locally on port 11111
Config File (optional)
Create config.yaml:
brokers:
longport:
enabled: true
futu:
enabled: true
extra:
host: "127.0.0.1"
port: 11111
alerts:
pnl_trigger: 500.0
rsi_high: 80
rsi_low: 20
option_buyback:
enabled: true
symbol: "TQQQ"
targets:
- name: "cc-june"
strike: 60
expiry: "2026-06-18"
type: "C"
trigger_price: 1.60
qty: 2
reset_pct: 0.20
Supported Brokers
| Broker | Region | Status |
|---|---|---|
| Demo | Global | Built-in |
| Longport | US/HK/SG | Optional |
| Moomoo/Futu | US/HK/SG | Optional |
Claude Code & Clawdbot Integration
Clawdfolio works as a native skill in Claude Code and Clawdbot environments:
/clawdfolio summary
/clawdfolio risk
/clawdfolio quotes AAPL MSFT NVDA
/clawdfolio alerts
/clawdfolio options chain TQQQ --expiry 2026-06-18
The skill is registered via SKILL.md and supports all CLI commands through natural language interaction.
Finance Workflows
20 production workflows migrated from live trading infrastructure, organized by category:
| Category | Examples |
|---|---|
| Portfolio Reports | Account report, portfolio analysis, risk breakdown |
| Briefing Cards | Daily brief (console + Telegram), multi-format |
| Alerts & Monitors | Price/RSI alerts, option buyback trigger |
| Market Intelligence | Real-time quotes, earnings calendar, market news |
| Broker Snapshots | Longport / Moomoo asset summaries |
| Strategy | DCA proposals |
clawdfolio finance list # Browse all workflows by category
clawdfolio finance init # Bootstrap ~/.clawdfolio/finance workspace
clawdfolio finance run <workflow_id> # Execute a workflow
Ecosystem
Clawdfolio is the data hub of a quantitative finance toolkit. Other projects consume its output or share its analytical methodology.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ML Research Layer โ
โ crypto-prediction โ
โ ESG-prediction โ
โโโโโโโโโโโโโโฌโโโโโโโโโโโโโโ
โ research informs alert thresholds
โโโโโโโโโโโโโโผโโโโโโโโโโโโโโ
โ clawdfolio (this repo) โ
โ brokers ยท risk ยท alerts โ
โ clawdfolio summary -o json
โโโโโโโโโโโโโโฌโโโโโโโโโโโโโโ
โ JSON data feed
โโโโโโโโโโโโโโผโโโโโโโโโโโโโโ
โ Visualization Layer โ
โ investment-dashboard โ
โ QQQ-200D-Dashboard โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโ
| Project | Layer | Relationship |
|---|---|---|
| clawdfolio (this repo) | Core Engine | Risk analytics, broker integration, signal generation, options strategy |
| investment-dashboard | Visualization | Web frontend โ consumes clawdfolio summary -o json for portfolio data |
| QQQ-200D-Deviation-Dashboard | Visualization | Implements clawdfolio's SMA deviation methodology as a standalone React dashboard |
| crypto-return-prediction | ML Research | Short-term momentum prediction โ shares RSI/Bollinger feature engineering |
| ESG-Driven-Stock-Value-Prediction | ML Research | Long-term value factor research โ ESG signals complementing technical indicators |
Changelog
v2.2.0 (2025-02-14)
- Thread-safe market data caching (
threading.Lock) - Batch quote fetching via
yf.downloadwith per-ticker fallback - Shared
suppress_stdioutility (DRY refactor) - Dynamic CLI version from
__version__ - PEP 561 compliance (
py.typedmarker) - Structured logging across core modules
- Centralized ticker normalization (
_yf_symbol()) - Config path migration to
clawdfolionamespace (backward-compatible)
v2.1.0 (2025-01-28)
- Options Strategy Playbook v2.1 (
docs/OPTIONS_STRATEGY_PLAYBOOK_v2.1.md) - Research-to-execution framework for CC and Sell Put lifecycle
- Explicit gamma-risk, margin, leverage, and assignment decision rules
v2.0.0 (2025-01-15)
- Full finance migration: 20 production workflows from live trading infrastructure
clawdfolio financecommand group (list, init, run)- Mutable workspace bootstrap (
~/.clawdfolio/finance) - Options quote/chain/buyback monitor
- Wilder RSI smoothing, Longport symbol fix, yfinance hardening
See CHANGELOG.md for full details.
Contributing
Contributions welcome! Please submit a Pull Request.
License
MIT License โ see LICENSE
Links
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file clawdfolio-2.3.0.tar.gz.
File metadata
- Download URL: clawdfolio-2.3.0.tar.gz
- Upload date:
- Size: 144.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8e098159990667016d43014b04f6524033d2a78d33fc7837a6e4b03511d61147
|
|
| MD5 |
f7b799e8a59cd916c578ce6b67b7f728
|
|
| BLAKE2b-256 |
9ad908b2573ee12cc30d1f9461b1d200410aa6e02f3bd1182b5bc2560f388cae
|
File details
Details for the file clawdfolio-2.3.0-py3-none-any.whl.
File metadata
- Download URL: clawdfolio-2.3.0-py3-none-any.whl
- Upload date:
- Size: 151.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e9e07c58a4b9944b0ed5820ecd7a325d6e9b79296d005ffbd3eac8d0e20e4e2c
|
|
| MD5 |
b9c1c4efa6f1f4d9e99faa636e9686bb
|
|
| BLAKE2b-256 |
b8ee15e8067726d900c246dcd7cb6a7e15d5c1b3e82a324196d189c6b60e09cb
|