$35
Full-stack investment management: from philosophy to execution. Research, analyze, decide, execute, track, and optimize across traditional and alternative asset classes.
finance-substrate (Layer 1: Accounting & Tax)
├── Bank transaction import, certificate parsing
├── Form 210 tax projection, DIAN integration
├── Parafiscales, patrimonio, retenciones
└── Gmail document collector
↓
wealth-management (Layer 2: Planning & Projections)
├── Compound growth projections
├── Goal-based planning, Monte Carlo
├── Portfolio summary & asset allocation
└── Budget planning with tax savings
↓
investment-management (Layer 3: Analysis & Execution) ← THIS SKILL
├── RESEARCH: Market data, fundamentals, screening
├── ANALYZE: Factor models, backtests, risk metrics
├── DECIDE: Philosophy-driven frameworks, scoring
├── EXECUTE: Trade via APIs (Alpaca, Coinbase, Polymarket)
├── TRACK: Multi-platform position aggregation
└── OPTIMIZE: Rebalancing, tax-loss harvesting, lot management
The skill embeds decision frameworks from legendary investors. Each philosophy is a scoring lens that can be applied to any investment.
| Principle | Implementation |
|---|
| Economic moat analysis | Score competitive advantage: brand, network, switching cost, scale |
| Margin of safety | Require 25%+ discount to intrinsic value (DCF, owner earnings) |
| Circle of competence | Flag unfamiliar sectors; require deeper research threshold |
| Owner earnings | Net income + depreciation - capex (not GAAP earnings) |
| Quality over price | ROIC > WACC, consistent ROE > 15%, low debt/equity |
| Principle | Implementation |
|---|---|
| All-Weather allocation | Risk-parity: equal risk contribution from growth, inflation, deflation |
| Factor exposure | Decompose returns into market, value, momentum, quality, size |
| Risk parity | Weight by inverse volatility, target equal risk contribution |
| Regime awareness | Detect growth/inflation quadrant, adjust allocation |
| Correlation regime | Monitor rolling correlations; diversification fails in crises |
| Principle | Implementation |
|---|---|
| Three-fund portfolio | Total market + international + bonds; rebalance annually |
| Minimize costs | Flag any fund with expense ratio > 0.20% |
| Tax efficiency | Index funds in taxable, bonds in tax-deferred |
| Stay the course | Reject market timing; dollar-cost average |
| Simple beats complex | Baseline comparison for every active strategy |
| Principle | Implementation |
|---|---|
| Consensus vs reality | Flag positions where market consensus is priced in |
| Risk is not volatility | Focus on permanent capital loss, not price fluctuation |
| Market cycles | Track Shiller CAPE, yield spreads, sentiment indicators |
| Asymmetric outcomes | Seek situations where upside >> downside |
| Know what you don't know | Confidence-weighted recommendations |
| Principle | Implementation |
|---|---|
| 85% ultra-safe + 15% high-convexity | Split portfolio into safe (CDTs, treasuries) + optionality (crypto, VC, prediction markets) |
| Antifragile positions | Identify investments that benefit from volatility |
| Avoid the middle | Skip mediocre risk-return profiles |
| Small bets, big payoffs | Position size by max loss tolerance, not expected return |
screen — Security ScreeningSearch and filter stocks, ETFs, crypto, and other securities by criteria.
Script: scripts/screener.py
Screening criteria:
Data sources: yfinance, Financial Modeling Prep, OpenBB
research — Deep Investment ResearchIn-depth analysis of a specific security or market.
Script: scripts/research.py
Analysis includes:
Data sources: yfinance fundamentals, SEC EDGAR (edgartools), news sentiment (FinBERT)
factor — Factor AnalysisDecompose portfolio returns into systematic factor exposures.
Script: scripts/factor_analysis.py
Factors analyzed:
Output: Factor loadings, R², alpha significance, factor exposure drift over time
backtest — Strategy BacktestingTest investment strategies against historical data.
Script: scripts/backtest.py
Built-in strategies:
Metrics: CAGR, Sharpe, Sortino, max drawdown, Calmar, win rate, average gain/loss
optimize — Portfolio OptimizationFind optimal portfolio weights given constraints.
Script: scripts/portfolio_optimizer.py
Methods:
Constraints: Long-only, sector limits, position size caps, turnover limits, tax-awareness
Libraries: PyPortfolioOpt, Riskfolio-Lib, cvxpy
risk — Risk AnalysisComprehensive risk assessment of current or proposed portfolio.
Script: scripts/risk_analysis.py
Metrics:
trade — Trade ExecutionExecute trades via supported platform APIs.
Script: scripts/trade.py
Supported platforms:
| Platform | Assets | Auth | Library |
|---|---|---|---|
| Alpaca | US stocks, ETFs | API key pair | alpaca-trade-api |
| Coinbase | Crypto | CDP API key + JWT | coinbase-advanced-py |
| Polymarket | Prediction markets | Wallet signature | py-clob-client |
| Interactive Brokers | Everything | TWS API | ib_async |
Features:
track — Multi-Platform Position TrackingAggregate positions across all investment platforms.
Script: scripts/tracker.py
Sources (in priority order):
Output: Unified position list with cost basis, current value, unrealized gain/loss, allocation %
rebalance — Intelligent RebalancingGenerate and optionally execute rebalancing trades.
Script: scripts/rebalancer.py
Rebalancing modes:
Tax-loss harvesting:
data — Market Data RetrievalFetch market data from multiple sources.
Script: scripts/market_data.py
Sources:
| Source | Data | Cost | Library |
|---|---|---|---|
| yfinance | US/intl stocks, fundamentals | Free | yfinance |
| Financial Modeling Prep | Financial statements, ratios | Free tier | fmpsdk |
| CoinGecko | Crypto prices, market data | Free tier | pycoingecko |
| FRED | Macro indicators (800K series) | Free | fredapi |
| datos.gov.co | TRM (USD/COP) | Free | requests |
| Banco de la República | CPI, interest rates | Free | requests |
| Alpha Vantage | Technical data, forex | Free tier | alpha_vantage |
| Polymarket | Prediction market odds | Free | py-clob-client |
score — Investment ScoringScore a security through multiple investment philosophy lenses.
Script: scripts/scorer.py
Scoring dimensions:
Output: 0-100 score per dimension, overall composite, philosophy alignment
| Class | Screening | Research | Trading | Tracking |
|---|---|---|---|---|
| US Stocks | yfinance, FMP | EDGAR, fundamentals | Alpaca, IBKR | API |
| International Stocks | yfinance | Limited fundamentals | IBKR | API |
| ETFs | yfinance | Holdings analysis | Alpaca, IBKR | API |
| Bonds/Fixed Income | FRED yield curves | Duration, credit | IBKR | Manual |
| CDTs (Colombia) | Superfinanciera rates | Yield comparison | Manual | Certificates |
| Class | Screening | Research | Trading | Tracking |
|---|---|---|---|---|
| Crypto | CoinGecko, CMC | On-chain, sentiment | Coinbase, Binance | API |
| Prediction Markets | Polymarket API | Market analysis | Polymarket CLOB | API |
| Real Estate | Manual | Cap rate, appreciation | Manual | Exogena/manual |
| VC/Startups | Manual | Due diligence framework | Manual | Manual |
| Colombian Equities | Yahoo (BVC tickers) | Limited | Davivienda Corredores (browser) | Browser/manual |
| Vehicle | Max Benefit | Tracking |
|---|---|---|
| AFC (Davivienda) | 1,340 UVT cap | finance-substrate certs |
| Pensión Voluntaria (Skandia) | Combined w/ AFC | finance-substrate certs |
| Cesantías | Forced savings | finance-substrate certs |
investment-management
│
├── API-first (real-time)
│ ├── Alpaca ──── US stocks, ETFs (paper + live)
│ ├── Coinbase ── Crypto (BTC, ETH, SOL, etc.)
│ ├── Polymarket ── Prediction markets
│ ├── CoinGecko ── Crypto market data
│ ├── FRED ──── Macro indicators
│ └── yfinance ── Stock data, fundamentals
│
├── Browser-automated (agent-browser)
│ ├── Davivienda Corredores ── Colombian equities
│ ├── Tyba ── Colombian robo-advisor
│ ├── Skandia Portal ── Pension fund data
│ └── MiDataCredito ── Credit profile
│
├── File-based (finance-substrate)
│ ├── certificates.jsonl ── Bank saldos, investment funds
│ ├── exogena.jsonl ── Third-party reported assets
│ └── salary-history.jsonl ── Income trajectory
│
└── Manual (portfolio.json)
├── Private investments
├── Real estate
└── VC/startup positions
| Purpose | Library | Install |
|---|---|---|
| Portfolio optimization | PyPortfolioOpt | pip install pyportfolioopt |
| Advanced risk optimization | Riskfolio-Lib | pip install riskfolio-lib |
| Custom optimization | cvxpy | pip install cvxpy |
| Volatility modeling | arch | pip install arch |
| Technical indicators | pandas-ta | pip install pandas_ta |
| Factor data | pandas-datareader | pip install pandas-datareader |
| Backtesting | VectorBT | pip install vectorbt |
| Sentiment | transformers (FinBERT) | pip install transformers |
| Fundamental data | edgartools | pip install edgartools |
| Macro data | fredapi | pip install fredapi |
| Formula | Expression | Use |
|---|---|---|
| Sharpe Ratio | (R_p - R_f) / σ_p | Risk-adjusted return |
| Sortino Ratio | (R_p - R_f) / σ_downside | Downside risk-adjusted |
| Kelly Fraction | (bp - q) / b | Optimal position size |
| Intrinsic Value (DCF) | Σ FCF_t / (1+r)^t + TV | Valuation |
| WACC | E/(E+D)×Re + D/(E+D)×Rd×(1-T) | Discount rate |
| Black-Scholes | C = S·N(d1) - K·e^(-rT)·N(d2) | Option pricing |
| VaR (parametric) | μ - z_α × σ | Tail risk |
| CVaR | E[L | L > VaR] | Expected tail loss |
| HHI (concentration) | Σ w_i² | Diversification |
~/.investment-management/
├── portfolio.json # Master holdings (all platforms)
├── targets.json # Target allocation by strategy
├── watchlist.json # Securities under observation
├── trades/ # Trade history
│ └── trades.jsonl # All executed trades
├── research/ # Security research cache
│ └── research-{ticker}.json
├── backtests/ # Backtest results
│ └── backtest-{strategy}-{date}.json
├── scores/ # Investment scores
│ └── scores-{date}.json
├── market-data/ # Cached market data
│ ├── prices/ # Historical price cache
│ └── fundamentals/ # Fundamental data cache
└── config/
├── api-keys.json # Platform API keys (encrypted)
├── strategies.json # Active strategy configurations
└── rebalance-rules.json # Rebalancing parameters
This skill is EGRI-aware. When a user's request implies iterative optimization
or strategy search, the agent should scaffold a problem-spec from the templates
below and delegate to /autoany for autonomous improvement.
Invoke /autoany when the user asks to:
| Template | Artifact | Evaluator | Score | Use When |
|---|---|---|---|---|
strategy-optimization | strategy.yaml (weights, rules) | backtest.py --egri | Sharpe ratio | Optimizing portfolio allocation |
screen-evolution | screen_criteria.yaml (thresholds) | screener.py + eval_screen.py | Forward return | Evolving stock selection criteria |
Templates are at templates/egri/. The strategy artifact schema is at
templates/egri/strategy-artifact.yaml.
1. User request → agent detects optimization intent
2. Load personal context from finance-substrate (patrimonio, salary, TRM)
3. Pull historical market data (market_data.py)
4. Scaffold problem-spec from template, fill in:
- Starting allocation as baseline artifact
- Period, constraints from policy.yaml
- Goal metrics from user's request
5. Invoke /autoany with scaffolded problem-spec
6. EGRI loop runs: Proposer → Executor (backtest.py) → Evaluator → Selector
7. Return promoted strategy + ledger summary to user
8. Log results for cross-session strategy inheritance (autoany-lago)
scripts/eval_backtest.py wraps backtest.py for use as an EGRI evaluator:
Outcome (score, constraints_passed, violations)python3 eval_backtest.py --strategy-file strategy.yaml --period 10y-15% (from policy S6)<= 25% (from policy S2)finance-substrate skill (accounting, tax, certificates)wealth-management skill (projections, goals, portfolio summary)autoany (optional, for EGRI optimization loops)yfinance, fredapi, pycoingecko (free)pypfopt, riskfolio-lib, cvxpy (optional, for advanced modes)alpaca-trade-api, coinbase-advanced-py (optional, for execution)pandas-ta, arch (optional, for quantitative modes)investment-management/
├── SKILL.md # This file
├── skill.json # Schema definition (11 modes)
├── scripts/
│ ├── screener.py # Mode 1: security screening
│ ├── research.py # Mode 2: deep research
│ ├── factor_analysis.py # Mode 3: factor decomposition
│ ├── backtest.py # Mode 4: strategy backtesting
│ ├── portfolio_optimizer.py # Mode 5: portfolio optimization
│ ├── risk_analysis.py # Mode 6: risk metrics
│ ├── trade.py # Mode 7: trade execution
│ ├── tracker.py # Mode 8: position tracking
│ ├── rebalancer.py # Mode 9: intelligent rebalancing
│ ├── market_data.py # Mode 10: data retrieval
│ ├── scorer.py # Mode 11: investment scoring
│ └── eval_backtest.py # EGRI evaluator wrapper (autoany bridge)
├── references/
│ ├── investment-philosophies.md # Legendary investor frameworks
│ ├── platform-apis.md # API reference for all platforms
│ ├── quantitative-toolkit.md # Libraries, formulas, models
│ ├── colombian-markets.md # BVC, CDTs, FICs, regulations
│ └── alternative-investments.md # Crypto, prediction markets, RE, VC
├── templates/
│ ├── strategies.json # Pre-built strategy configurations
│ ├── scoring-weights.json # Philosophy scoring weights
│ └── egri/ # EGRI problem-spec templates (autoany)
│ ├── strategy-optimization.yaml # Portfolio strategy optimization
│ ├── screen-evolution.yaml # Screening criteria evolution
│ └── strategy-artifact.yaml # Strategy YAML schema (mutable artifact)
├── .control/
│ └── policy.yaml # Trading limits, risk gates
└── README.md