{
  "schemaVersion": "1.0",
  "item": {
    "slug": "afrexai-portfolio-risk",
    "name": "Portfolio Risk Analyzer",
    "source": "tencent",
    "type": "skill",
    "category": "数据分析",
    "sourceUrl": "https://clawhub.ai/1kalin/afrexai-portfolio-risk",
    "canonicalUrl": "https://clawhub.ai/1kalin/afrexai-portfolio-risk",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadMode": "redirect",
    "downloadUrl": "/downloads/afrexai-portfolio-risk",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=afrexai-portfolio-risk",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "installMethod": "Manual import",
    "extraction": "Extract archive",
    "prerequisites": [
      "OpenClaw"
    ],
    "packageFormat": "ZIP package",
    "includedAssets": [
      "README.md",
      "SKILL.md"
    ],
    "primaryDoc": "SKILL.md",
    "quickSetup": [
      "Download the package from Yavira.",
      "Extract the archive and review SKILL.md first.",
      "Import or place the package into your OpenClaw setup."
    ],
    "agentAssist": {
      "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
      "steps": [
        "Download the package from Yavira.",
        "Extract it into a folder your agent can access.",
        "Paste one of the prompts below and point your agent at the extracted folder."
      ],
      "prompts": [
        {
          "label": "New install",
          "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Then review README.md for any prerequisites, environment setup, or post-install checks. Tell me what you changed and call out any manual steps you could not complete."
        },
        {
          "label": "Upgrade existing",
          "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Then review README.md for any prerequisites, environment setup, or post-install checks. Summarize what changed and any follow-up checks I should run."
        }
      ]
    },
    "sourceHealth": {
      "source": "tencent",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-04-23T16:43:11.935Z",
      "expiresAt": "2026-04-30T16:43:11.935Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=4claw-imageboard",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=4claw-imageboard",
        "contentDisposition": "attachment; filename=\"4claw-imageboard-1.0.1.zip\"",
        "redirectLocation": null,
        "bodySnippet": null
      },
      "scope": "source",
      "summary": "Source download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this source.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/afrexai-portfolio-risk"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    },
    "downloadPageUrl": "https://openagent3.xyz/downloads/afrexai-portfolio-risk",
    "agentPageUrl": "https://openagent3.xyz/skills/afrexai-portfolio-risk/agent",
    "manifestUrl": "https://openagent3.xyz/skills/afrexai-portfolio-risk/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/afrexai-portfolio-risk/agent.md"
  },
  "agentAssist": {
    "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
    "steps": [
      "Download the package from Yavira.",
      "Extract it into a folder your agent can access.",
      "Paste one of the prompts below and point your agent at the extracted folder."
    ],
    "prompts": [
      {
        "label": "New install",
        "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Then review README.md for any prerequisites, environment setup, or post-install checks. Tell me what you changed and call out any manual steps you could not complete."
      },
      {
        "label": "Upgrade existing",
        "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Then review README.md for any prerequisites, environment setup, or post-install checks. Summarize what changed and any follow-up checks I should run."
      }
    ]
  },
  "documentation": {
    "source": "clawhub",
    "primaryDoc": "SKILL.md",
    "sections": [
      {
        "title": "Portfolio Risk Analyzer",
        "body": "Complete investment portfolio risk management system. Analyze positions, calculate risk metrics, stress test scenarios, optimize allocations, and generate institutional-grade risk reports — all without external APIs."
      },
      {
        "title": "1. Portfolio Intake",
        "body": "When the user shares their portfolio (positions, tickers, amounts), structure it into this format:\n\nportfolio:\n  name: \"User Portfolio\"\n  currency: USD\n  as_of: \"2026-02-15\"\n  positions:\n    - ticker: AAPL\n      shares: 50\n      avg_cost: 185.00\n      current_price: 228.50  # Look up via web search\n      asset_class: US_EQUITY\n      sector: Technology\n    - ticker: BTC\n      units: 0.5\n      avg_cost: 42000\n      current_price: 97500\n      asset_class: CRYPTO\n      sector: Digital Assets\n    - ticker: VOO\n      shares: 100\n      avg_cost: 410.00\n      current_price: 535.00\n      asset_class: US_EQUITY_ETF\n      sector: Broad Market\n  cash:\n    amount: 15000\n    currency: USD"
      },
      {
        "title": "Price Lookup",
        "body": "For each position, use web search to find current price:\n\nSearch: [TICKER] stock price today\nFor crypto: [COIN] price USD today\nRecord source and timestamp"
      },
      {
        "title": "Portfolio Summary Table",
        "body": "PositionSharesCost BasisCurrent ValueWeightP&LP&L %AAPL50$9,250$11,42518.2%+$2,175+23.5%.....................TOTAL$XX,XXX$XX,XXX100%±$X,XXX±X.X%"
      },
      {
        "title": "2. Risk Metrics Calculator",
        "body": "Calculate ALL of the following for every portfolio analysis:"
      },
      {
        "title": "2.1 Concentration Risk",
        "body": "Position Concentration:\n- Any single position >20% of portfolio = HIGH RISK ⚠️\n- Any single position >10% = MODERATE RISK\n- Top 3 positions >50% = CONCENTRATED\n\nSector Concentration:\n- Any sector >30% = OVERWEIGHT\n- Count unique sectors — fewer than 4 = UNDER-DIVERSIFIED\n\nAsset Class Breakdown:\n- Equities: X%\n- Fixed Income: X%\n- Crypto: X%\n- Cash: X%\n- Alternatives: X%"
      },
      {
        "title": "2.2 Value at Risk (VaR) — Parametric Method",
        "body": "Calculate the maximum expected loss at given confidence levels:\n\nDaily VaR Calculation:\n1. Look up each position's historical volatility (annualized)\n   - Use web search: \"[TICKER] historical volatility 30 day\"\n   - Typical ranges: Large cap stocks 15-25%, Crypto 50-80%, Bonds 5-10%\n\n2. Convert to daily volatility:\n   Daily Vol = Annual Vol / √252\n\n3. Position VaR (95% confidence):\n   Position VaR = Position Value × Daily Vol × 1.645\n\n4. Position VaR (99% confidence):\n   Position VaR = Position Value × Daily Vol × 2.326\n\n5. Portfolio VaR (simplified — assumes correlation ≈ 0.5 for stocks):\n   Portfolio VaR ≈ √(Σ(Position VaR²) + 2×0.5×Σ(VaR_i × VaR_j))\n\nReport:\n- 1-Day 95% VaR: $X,XXX (X.X% of portfolio)\n- 1-Day 99% VaR: $X,XXX (X.X% of portfolio)\n- 10-Day 95% VaR: $X,XXX (= 1-Day VaR × √10)\n- Monthly 95% VaR: $X,XXX (= 1-Day VaR × √21)"
      },
      {
        "title": "2.3 Maximum Drawdown Estimation",
        "body": "Based on asset class historical max drawdowns:\n- US Large Cap: -50% (2008-09), typical correction -20%\n- US Small Cap: -55%, typical correction -25%\n- International Equity: -55%, typical -25%\n- Emerging Markets: -65%, typical -30%\n- Investment Grade Bonds: -15%, typical -5%\n- High Yield Bonds: -30%, typical -10%\n- REITs: -70%, typical -25%\n- Crypto (BTC): -85%, typical -50%\n- Gold: -45%, typical -15%\n- Cash: 0%\n\nPortfolio Max Drawdown Estimate:\n= Σ(Position Weight × Asset Class Max Drawdown)\n\nReport:\n- Estimated worst-case drawdown: -$XX,XXX (XX.X%)\n- Estimated typical correction: -$XX,XXX (XX.X%)\n- Recovery time estimate: X-X months (based on historical averages)"
      },
      {
        "title": "2.4 Beta & Market Sensitivity",
        "body": "For each equity position:\n- Look up beta via web search: \"[TICKER] beta\"\n- Portfolio Beta = Σ(Position Weight × Position Beta)\n\nInterpretation:\n- Beta > 1.2: Portfolio is AGGRESSIVE (amplifies market moves)\n- Beta 0.8-1.2: Portfolio is NEUTRAL\n- Beta < 0.8: Portfolio is DEFENSIVE\n- Negative beta positions: HEDGE value\n\nMarket Impact:\n- If S&P 500 drops 10%, portfolio expected to move: Beta × -10%"
      },
      {
        "title": "2.5 Sharpe Ratio Estimation",
        "body": "Portfolio Expected Return = Σ(Weight × Expected Return)\nWhere Expected Return by asset class:\n- US Large Cap: 8-10% annually\n- US Small Cap: 9-11%\n- International Developed: 6-8%\n- Emerging Markets: 8-12%\n- Investment Grade Bonds: 4-5%\n- High Yield: 6-7%\n- Crypto: highly variable (use 0% for conservative estimate)\n- REITs: 7-9%\n- Cash: current money market rate (~4.5%)\n\nRisk-Free Rate: current 3-month T-bill rate (search if needed)\n\nSharpe Ratio = (Portfolio Expected Return - Risk-Free Rate) / Portfolio Volatility\n\nRating:\n- > 1.0: EXCELLENT risk-adjusted returns\n- 0.5-1.0: GOOD\n- 0-0.5: MEDIOCRE — consider rebalancing\n- < 0: POOR — return doesn't justify risk"
      },
      {
        "title": "2.6 Income Analysis",
        "body": "For dividend-paying positions:\n- Look up dividend yield: \"[TICKER] dividend yield\"\n- Annual Income = Shares × Annual Dividend per Share\n- Portfolio Yield = Total Annual Dividends / Portfolio Value\n\nReport:\n- Monthly estimated income: $XXX\n- Annual estimated income: $X,XXX\n- Yield on cost: X.X%\n- Current yield: X.X%"
      },
      {
        "title": "3. Stress Testing",
        "body": "Run these scenarios against the portfolio and report impact:"
      },
      {
        "title": "3.1 Standard Scenarios",
        "body": "scenarios:\n  market_crash_2008:\n    name: \"2008 Financial Crisis\"\n    impacts:\n      US_EQUITY: -0.50\n      INTL_EQUITY: -0.55\n      EMERGING: -0.60\n      BONDS: +0.05\n      HIGH_YIELD: -0.30\n      REITS: -0.70\n      CRYPTO: -0.80  # projected based on risk profile\n      GOLD: +0.10\n      CASH: 0\n\n  covid_crash_2020:\n    name: \"COVID-19 Crash (Feb-Mar 2020)\"\n    impacts:\n      US_EQUITY: -0.34\n      INTL_EQUITY: -0.35\n      EMERGING: -0.35\n      BONDS: +0.03\n      HIGH_YIELD: -0.20\n      REITS: -0.40\n      CRYPTO: -0.50\n      GOLD: -0.05\n      CASH: 0\n\n  dot_com_2000:\n    name: \"Dot-Com Bust (2000-2002)\"\n    impacts:\n      US_EQUITY: -0.45\n      TECH: -0.75  # Apply to technology sector specifically\n      INTL_EQUITY: -0.40\n      BONDS: +0.15\n      CASH: 0\n\n  rate_hike_shock:\n    name: \"Rapid Rate Hike (+300bps)\"\n    impacts:\n      US_EQUITY: -0.15\n      BONDS: -0.15\n      HIGH_YIELD: -0.10\n      REITS: -0.25\n      CRYPTO: -0.20\n      GOLD: -0.10\n      CASH: +0.01  # higher yields\n\n  inflation_surge:\n    name: \"Stagflation (persistent 8%+ inflation)\"\n    impacts:\n      US_EQUITY: -0.20\n      BONDS: -0.20\n      CRYPTO: -0.10  # debatable hedge\n      GOLD: +0.15\n      REITS: -0.05\n      COMMODITIES: +0.20\n      CASH: -0.03  # real value erosion\n\n  crypto_winter:\n    name: \"Crypto Winter (80% drawdown)\"\n    impacts:\n      CRYPTO: -0.80\n      US_EQUITY: -0.05  # minor contagion"
      },
      {
        "title": "3.2 Stress Test Report Format",
        "body": "For each scenario:\n\n📉 SCENARIO: [Name]\n\n| Position | Current Value | Stressed Value | Loss |\n|----------|--------------|----------------|------|\n| AAPL     | $11,425      | $5,713         | -$5,712 |\n| ...      | ...          | ...            | ...  |\n| TOTAL    | $XX,XXX      | $XX,XXX        | -$XX,XXX (-XX.X%) |\n\nCould you survive this? [YES/NO based on cash reserves and income needs]\nRecovery estimate: X-X months"
      },
      {
        "title": "3.3 Custom Scenario Builder",
        "body": "If user describes a specific worry, build a custom scenario:\n\nUser: \"What if tech crashes 40% but bonds rally?\"\n→ Build custom impact map, apply to portfolio, report results"
      },
      {
        "title": "4.1 Current Allocation Assessment",
        "body": "Compare current allocation to standard models:\n\nAGGRESSIVE (Age <35, high risk tolerance):\n  Equities: 80-90%, Bonds: 5-10%, Alternatives: 5-10%, Cash: 2-5%\n\nGROWTH (Age 35-50):\n  Equities: 60-75%, Bonds: 15-25%, Alternatives: 5-10%, Cash: 5%\n\nBALANCED (Age 50-60):\n  Equities: 40-60%, Bonds: 30-40%, Alternatives: 5-10%, Cash: 5-10%\n\nCONSERVATIVE (Age 60+, income focus):\n  Equities: 20-40%, Bonds: 40-50%, Alternatives: 5%, Cash: 10-20%\n\nCurrent allocation matches: [MODEL] profile\nRecommended adjustments: [specific moves]"
      },
      {
        "title": "4.2 Risk Parity Analysis",
        "body": "Risk Parity Target: Each asset class contributes EQUAL risk to portfolio\n\nSteps:\n1. Calculate each position's risk contribution:\n   Risk Contribution = Weight × Volatility × Correlation_with_portfolio\n\n2. For equal risk contribution:\n   Target Weight_i = (1/Vol_i) / Σ(1/Vol_j)\n\n3. Report:\n   Current vs Risk-Parity weights\n   Trades needed to rebalance\n   Expected impact on Sharpe Ratio"
      },
      {
        "title": "4.3 Rebalancing Recommendations",
        "body": "Check rebalancing triggers:\n- Any position drifted >5% from target? → REBALANCE\n- Any asset class drifted >10% from target? → REBALANCE\n- Last rebalance >6 months ago? → REVIEW\n\nRebalancing Method:\n1. Calculate target weights\n2. Calculate current weights\n3. Determine trades needed (minimize transactions)\n4. Tax-lot optimization: sell highest-cost lots first (minimize tax)\n5. Consider wash sale rules if harvesting losses\n\nOutput trade list:\n| Action | Ticker | Shares | Est. Value | Reason |\n|--------|--------|--------|-----------|--------|\n| SELL   | AAPL   | 15     | $3,428    | Overweight tech |\n| BUY    | BND    | 25     | $1,850    | Underweight bonds |"
      },
      {
        "title": "4.4 Correlation Analysis",
        "body": "Assess diversification quality:\n\nHIGH correlation pairs (>0.7) — these DON'T diversify each other:\n- Tech stocks with each other\n- US equity ETFs with each other\n- High yield bonds with equities\n\nLOW correlation pairs (<0.3) — TRUE diversifiers:\n- Stocks vs Treasury bonds\n- US vs Gold\n- Equities vs Managed Futures\n\nNEGATIVE correlation — HEDGES:\n- Long equity + Put options\n- Stocks + VIX products\n- Growth + Value in some regimes\n\nGrade portfolio diversification: A/B/C/D/F"
      },
      {
        "title": "5. Risk Score Card (0-100)",
        "body": "Generate a single risk score:\n\nrisk_scorecard:\n  concentration_risk:\n    weight: 20\n    score: X  # 100 = well diversified, 0 = single stock\n    details: \"Top position is X%, X sectors represented\"\n\n  volatility_risk:\n    weight: 20\n    score: X  # 100 = low vol, 0 = extremely volatile\n    details: \"Portfolio annualized vol: X%\"\n\n  drawdown_risk:\n    weight: 20\n    score: X  # 100 = minimal drawdown exposure, 0 = could lose 50%+\n    details: \"Max estimated drawdown: X%\"\n\n  liquidity_risk:\n    weight: 15\n    score: X  # 100 = all highly liquid, 0 = illiquid positions\n    details: \"X% in liquid large-cap, X% in illiquid\"\n\n  income_resilience:\n    weight: 10\n    score: X  # 100 = strong income, 0 = no yield\n    details: \"Portfolio yield: X%, X% from reliable dividend payers\"\n\n  market_sensitivity:\n    weight: 15\n    score: X  # 100 = low beta/defensive, 0 = highly aggressive\n    details: \"Portfolio beta: X.XX\"\n\n  overall_score: X/100\n  rating: \"[CONSERVATIVE|MODERATE|AGGRESSIVE|SPECULATIVE]\"\n  recommendation: \"[Key action item]\""
      },
      {
        "title": "Score Interpretation",
        "body": "80-100: FORTRESS — Well-protected, may be too conservative for growth\n60-79: SOLID — Good risk management, minor improvements possible\n40-59: MODERATE — Reasonable but has notable risk exposures\n20-39: ELEVATED — Significant vulnerabilities, rebalancing recommended\n0-19: DANGER ZONE — Extreme concentration or volatility, urgent action needed"
      },
      {
        "title": "Daily Check Template (for cron/heartbeat use)",
        "body": "For each portfolio position:\n1. Check price vs previous close (web search)\n2. Flag if any position moved >3% in a day\n3. Flag if any position hit stop-loss level\n4. Check for earnings/events in next 7 days\n\nAlert Thresholds:\n- Single position -5% in a day → ALERT\n- Portfolio -3% in a day → ALERT\n- Position hits 52-week low → WATCH\n- VIX > 25 → ELEVATED CAUTION\n- VIX > 35 → HIGH ALERT — review hedges"
      },
      {
        "title": "Weekly Review Template",
        "body": "## Portfolio Weekly Review — [Date]\n\n### Performance\n- Portfolio value: $XX,XXX (±X.X% week)\n- Best performer: [TICKER] +X.X%\n- Worst performer: [TICKER] -X.X%\n- vs S&P 500: [outperformed/underperformed] by X.X%\n\n### Risk Changes\n- VaR change: $X,XXX → $X,XXX\n- Any new concentration issues? [Y/N]\n- Rebalancing needed? [Y/N]\n\n### Upcoming Events\n- Earnings: [tickers and dates]\n- Ex-dividend dates: [tickers and dates]\n- Fed/macro events: [list]\n\n### Action Items\n1. [Specific recommendation]\n2. [Specific recommendation]"
      },
      {
        "title": "7. Tax-Loss Harvesting Scanner",
        "body": "For each position with unrealized losses:\n1. Calculate unrealized loss: (Current Price - Avg Cost) × Shares\n2. Check if loss >$500 (worth harvesting)\n3. Identify tax-efficient replacement:\n   - Same sector ETF (avoids wash sale)\n   - Similar factor exposure\n   - Hold replacement 31+ days before switching back\n\nReport:\n| Ticker | Unrealized Loss | Replacement | Wash Sale Clear Date |\n|--------|----------------|-------------|---------------------|\n| XYZ    | -$2,500        | Similar ETF | [date + 31 days]   |\n\nEstimated tax savings: $X,XXX (at X% marginal rate)"
      },
      {
        "title": "Crypto Portfolio Risk",
        "body": "Additional crypto-specific metrics:\n\nBitcoin dominance correlation\nExchange risk (centralized vs self-custody)\nProtocol risk for DeFi positions\nStablecoin exposure and depeg risk\nTax implications of staking/yield"
      },
      {
        "title": "Real Estate (REITs/Property)",
        "body": "FFO yield vs dividend yield\nInterest rate sensitivity\nGeographic concentration\nProperty type diversification (residential/commercial/industrial)"
      },
      {
        "title": "Options Positions",
        "body": "If portfolio includes options:\n\nDelta exposure (equivalent stock position)\nTheta decay (daily time value loss)\nImplied volatility vs historical\nMax loss calculation\nBreakeven prices"
      },
      {
        "title": "Full Risk Report (on request)",
        "body": "Generate a complete PDF-ready markdown report:\n\n# Portfolio Risk Report\n## Prepared: [Date]\n## Portfolio: [Name]\n\n### Executive Summary\n[2-3 sentence overview: total value, risk rating, top recommendation]\n\n### 1. Holdings Summary\n[Position table from Section 1]\n\n### 2. Risk Metrics\n[All calculations from Section 2]\n\n### 3. Stress Test Results\n[All scenarios from Section 3]\n\n### 4. Optimization Recommendations\n[From Section 4]\n\n### 5. Risk Scorecard\n[From Section 5]\n\n### 6. Action Plan\n[Prioritized list of recommended changes]\n\n### Disclaimer\nThis analysis is for informational purposes only and does not constitute\nfinancial advice. Past performance and historical data do not guarantee\nfuture results. Consult a qualified financial advisor before making\ninvestment decisions."
      },
      {
        "title": "10. Quick Commands",
        "body": "Respond to these natural language requests:\n\nUser SaysAction\"Analyze my portfolio\"Full Section 1-5 analysis\"What's my risk?\"Risk Scorecard (Section 5)\"Stress test my portfolio\"All scenarios (Section 3)\"What if the market crashes?\"2008 + COVID scenarios\"How should I rebalance?\"Section 4 optimization\"Tax loss harvest\"Section 7 scanner\"Weekly review\"Section 6 weekly template\"Add [position]\"Update portfolio YAML, recalculate\"Remove [position]\"Update portfolio YAML, recalculate\"What's my VaR?\"Value at Risk calculation (Section 2.2)\"Compare to S&P 500\"Benchmark comparison\"How diversified am I?\"Concentration + correlation analysis\"What's my Sharpe ratio?\"Section 2.5\"Set alert for [ticker] at [price]\"Add to monitoring (Section 6)"
      },
      {
        "title": "Small Portfolios (<$10K)",
        "body": "Skip VaR (not meaningful for small amounts)\nFocus on concentration risk and savings rate\nRecommend index-first approach"
      },
      {
        "title": "Single Stock Portfolios (e.g., company RSUs)",
        "body": "ALWAYS flag extreme concentration risk\nModel collar strategies (protective put + covered call)\n10b5-1 plan reminder for insiders\nCalculate how much to diversify per quarter"
      },
      {
        "title": "Crypto-Heavy (>50% crypto)",
        "body": "Apply crypto winter scenario prominently\nFlag exchange counterparty risk\nRecommend cold storage percentage\nNote tax complexity of DeFi/staking"
      },
      {
        "title": "International Portfolios",
        "body": "Currency risk calculation\nCountry risk premium\nWithholding tax impact on dividends\nADR vs local share considerations"
      },
      {
        "title": "Leveraged Positions (margin/options)",
        "body": "Calculate margin call price\nStress test at 2x normal drawdown\nFlag if margin utilization >50%\nModel forced liquidation scenarios"
      },
      {
        "title": "Retirement Accounts (IRA/401k)",
        "body": "Different tax treatment (no tax-loss harvesting needed)\nRMD impact for traditional IRA\nRoth conversion opportunity analysis\nSequence of returns risk for near-retirees"
      }
    ],
    "body": "Portfolio Risk Analyzer\n\nComplete investment portfolio risk management system. Analyze positions, calculate risk metrics, stress test scenarios, optimize allocations, and generate institutional-grade risk reports — all without external APIs.\n\n1. Portfolio Intake\n\nWhen the user shares their portfolio (positions, tickers, amounts), structure it into this format:\n\nportfolio:\n  name: \"User Portfolio\"\n  currency: USD\n  as_of: \"2026-02-15\"\n  positions:\n    - ticker: AAPL\n      shares: 50\n      avg_cost: 185.00\n      current_price: 228.50  # Look up via web search\n      asset_class: US_EQUITY\n      sector: Technology\n    - ticker: BTC\n      units: 0.5\n      avg_cost: 42000\n      current_price: 97500\n      asset_class: CRYPTO\n      sector: Digital Assets\n    - ticker: VOO\n      shares: 100\n      avg_cost: 410.00\n      current_price: 535.00\n      asset_class: US_EQUITY_ETF\n      sector: Broad Market\n  cash:\n    amount: 15000\n    currency: USD\n\nPrice Lookup\n\nFor each position, use web search to find current price:\n\nSearch: [TICKER] stock price today\nFor crypto: [COIN] price USD today\nRecord source and timestamp\nPortfolio Summary Table\nPosition\tShares\tCost Basis\tCurrent Value\tWeight\tP&L\tP&L %\nAAPL\t50\t$9,250\t$11,425\t18.2%\t+$2,175\t+23.5%\n...\t...\t...\t...\t...\t...\t...\nTOTAL\t\t$XX,XXX\t$XX,XXX\t100%\t±$X,XXX\t±X.X%\n2. Risk Metrics Calculator\n\nCalculate ALL of the following for every portfolio analysis:\n\n2.1 Concentration Risk\nPosition Concentration:\n- Any single position >20% of portfolio = HIGH RISK ⚠️\n- Any single position >10% = MODERATE RISK\n- Top 3 positions >50% = CONCENTRATED\n\nSector Concentration:\n- Any sector >30% = OVERWEIGHT\n- Count unique sectors — fewer than 4 = UNDER-DIVERSIFIED\n\nAsset Class Breakdown:\n- Equities: X%\n- Fixed Income: X%\n- Crypto: X%\n- Cash: X%\n- Alternatives: X%\n\n2.2 Value at Risk (VaR) — Parametric Method\n\nCalculate the maximum expected loss at given confidence levels:\n\nDaily VaR Calculation:\n1. Look up each position's historical volatility (annualized)\n   - Use web search: \"[TICKER] historical volatility 30 day\"\n   - Typical ranges: Large cap stocks 15-25%, Crypto 50-80%, Bonds 5-10%\n\n2. Convert to daily volatility:\n   Daily Vol = Annual Vol / √252\n\n3. Position VaR (95% confidence):\n   Position VaR = Position Value × Daily Vol × 1.645\n\n4. Position VaR (99% confidence):\n   Position VaR = Position Value × Daily Vol × 2.326\n\n5. Portfolio VaR (simplified — assumes correlation ≈ 0.5 for stocks):\n   Portfolio VaR ≈ √(Σ(Position VaR²) + 2×0.5×Σ(VaR_i × VaR_j))\n\nReport:\n- 1-Day 95% VaR: $X,XXX (X.X% of portfolio)\n- 1-Day 99% VaR: $X,XXX (X.X% of portfolio)\n- 10-Day 95% VaR: $X,XXX (= 1-Day VaR × √10)\n- Monthly 95% VaR: $X,XXX (= 1-Day VaR × √21)\n\n2.3 Maximum Drawdown Estimation\nBased on asset class historical max drawdowns:\n- US Large Cap: -50% (2008-09), typical correction -20%\n- US Small Cap: -55%, typical correction -25%\n- International Equity: -55%, typical -25%\n- Emerging Markets: -65%, typical -30%\n- Investment Grade Bonds: -15%, typical -5%\n- High Yield Bonds: -30%, typical -10%\n- REITs: -70%, typical -25%\n- Crypto (BTC): -85%, typical -50%\n- Gold: -45%, typical -15%\n- Cash: 0%\n\nPortfolio Max Drawdown Estimate:\n= Σ(Position Weight × Asset Class Max Drawdown)\n\nReport:\n- Estimated worst-case drawdown: -$XX,XXX (XX.X%)\n- Estimated typical correction: -$XX,XXX (XX.X%)\n- Recovery time estimate: X-X months (based on historical averages)\n\n2.4 Beta & Market Sensitivity\nFor each equity position:\n- Look up beta via web search: \"[TICKER] beta\"\n- Portfolio Beta = Σ(Position Weight × Position Beta)\n\nInterpretation:\n- Beta > 1.2: Portfolio is AGGRESSIVE (amplifies market moves)\n- Beta 0.8-1.2: Portfolio is NEUTRAL\n- Beta < 0.8: Portfolio is DEFENSIVE\n- Negative beta positions: HEDGE value\n\nMarket Impact:\n- If S&P 500 drops 10%, portfolio expected to move: Beta × -10%\n\n2.5 Sharpe Ratio Estimation\nPortfolio Expected Return = Σ(Weight × Expected Return)\nWhere Expected Return by asset class:\n- US Large Cap: 8-10% annually\n- US Small Cap: 9-11%\n- International Developed: 6-8%\n- Emerging Markets: 8-12%\n- Investment Grade Bonds: 4-5%\n- High Yield: 6-7%\n- Crypto: highly variable (use 0% for conservative estimate)\n- REITs: 7-9%\n- Cash: current money market rate (~4.5%)\n\nRisk-Free Rate: current 3-month T-bill rate (search if needed)\n\nSharpe Ratio = (Portfolio Expected Return - Risk-Free Rate) / Portfolio Volatility\n\nRating:\n- > 1.0: EXCELLENT risk-adjusted returns\n- 0.5-1.0: GOOD\n- 0-0.5: MEDIOCRE — consider rebalancing\n- < 0: POOR — return doesn't justify risk\n\n2.6 Income Analysis\nFor dividend-paying positions:\n- Look up dividend yield: \"[TICKER] dividend yield\"\n- Annual Income = Shares × Annual Dividend per Share\n- Portfolio Yield = Total Annual Dividends / Portfolio Value\n\nReport:\n- Monthly estimated income: $XXX\n- Annual estimated income: $X,XXX\n- Yield on cost: X.X%\n- Current yield: X.X%\n\n3. Stress Testing\n\nRun these scenarios against the portfolio and report impact:\n\n3.1 Standard Scenarios\nscenarios:\n  market_crash_2008:\n    name: \"2008 Financial Crisis\"\n    impacts:\n      US_EQUITY: -0.50\n      INTL_EQUITY: -0.55\n      EMERGING: -0.60\n      BONDS: +0.05\n      HIGH_YIELD: -0.30\n      REITS: -0.70\n      CRYPTO: -0.80  # projected based on risk profile\n      GOLD: +0.10\n      CASH: 0\n\n  covid_crash_2020:\n    name: \"COVID-19 Crash (Feb-Mar 2020)\"\n    impacts:\n      US_EQUITY: -0.34\n      INTL_EQUITY: -0.35\n      EMERGING: -0.35\n      BONDS: +0.03\n      HIGH_YIELD: -0.20\n      REITS: -0.40\n      CRYPTO: -0.50\n      GOLD: -0.05\n      CASH: 0\n\n  dot_com_2000:\n    name: \"Dot-Com Bust (2000-2002)\"\n    impacts:\n      US_EQUITY: -0.45\n      TECH: -0.75  # Apply to technology sector specifically\n      INTL_EQUITY: -0.40\n      BONDS: +0.15\n      CASH: 0\n\n  rate_hike_shock:\n    name: \"Rapid Rate Hike (+300bps)\"\n    impacts:\n      US_EQUITY: -0.15\n      BONDS: -0.15\n      HIGH_YIELD: -0.10\n      REITS: -0.25\n      CRYPTO: -0.20\n      GOLD: -0.10\n      CASH: +0.01  # higher yields\n\n  inflation_surge:\n    name: \"Stagflation (persistent 8%+ inflation)\"\n    impacts:\n      US_EQUITY: -0.20\n      BONDS: -0.20\n      CRYPTO: -0.10  # debatable hedge\n      GOLD: +0.15\n      REITS: -0.05\n      COMMODITIES: +0.20\n      CASH: -0.03  # real value erosion\n\n  crypto_winter:\n    name: \"Crypto Winter (80% drawdown)\"\n    impacts:\n      CRYPTO: -0.80\n      US_EQUITY: -0.05  # minor contagion\n\n3.2 Stress Test Report Format\n\nFor each scenario:\n\n📉 SCENARIO: [Name]\n\n| Position | Current Value | Stressed Value | Loss |\n|----------|--------------|----------------|------|\n| AAPL     | $11,425      | $5,713         | -$5,712 |\n| ...      | ...          | ...            | ...  |\n| TOTAL    | $XX,XXX      | $XX,XXX        | -$XX,XXX (-XX.X%) |\n\nCould you survive this? [YES/NO based on cash reserves and income needs]\nRecovery estimate: X-X months\n\n3.3 Custom Scenario Builder\n\nIf user describes a specific worry, build a custom scenario:\n\nUser: \"What if tech crashes 40% but bonds rally?\"\n→ Build custom impact map, apply to portfolio, report results\n\n4. Portfolio Optimization\n4.1 Current Allocation Assessment\nCompare current allocation to standard models:\n\nAGGRESSIVE (Age <35, high risk tolerance):\n  Equities: 80-90%, Bonds: 5-10%, Alternatives: 5-10%, Cash: 2-5%\n\nGROWTH (Age 35-50):\n  Equities: 60-75%, Bonds: 15-25%, Alternatives: 5-10%, Cash: 5%\n\nBALANCED (Age 50-60):\n  Equities: 40-60%, Bonds: 30-40%, Alternatives: 5-10%, Cash: 5-10%\n\nCONSERVATIVE (Age 60+, income focus):\n  Equities: 20-40%, Bonds: 40-50%, Alternatives: 5%, Cash: 10-20%\n\nCurrent allocation matches: [MODEL] profile\nRecommended adjustments: [specific moves]\n\n4.2 Risk Parity Analysis\nRisk Parity Target: Each asset class contributes EQUAL risk to portfolio\n\nSteps:\n1. Calculate each position's risk contribution:\n   Risk Contribution = Weight × Volatility × Correlation_with_portfolio\n\n2. For equal risk contribution:\n   Target Weight_i = (1/Vol_i) / Σ(1/Vol_j)\n\n3. Report:\n   Current vs Risk-Parity weights\n   Trades needed to rebalance\n   Expected impact on Sharpe Ratio\n\n4.3 Rebalancing Recommendations\nCheck rebalancing triggers:\n- Any position drifted >5% from target? → REBALANCE\n- Any asset class drifted >10% from target? → REBALANCE\n- Last rebalance >6 months ago? → REVIEW\n\nRebalancing Method:\n1. Calculate target weights\n2. Calculate current weights\n3. Determine trades needed (minimize transactions)\n4. Tax-lot optimization: sell highest-cost lots first (minimize tax)\n5. Consider wash sale rules if harvesting losses\n\nOutput trade list:\n| Action | Ticker | Shares | Est. Value | Reason |\n|--------|--------|--------|-----------|--------|\n| SELL   | AAPL   | 15     | $3,428    | Overweight tech |\n| BUY    | BND    | 25     | $1,850    | Underweight bonds |\n\n4.4 Correlation Analysis\nAssess diversification quality:\n\nHIGH correlation pairs (>0.7) — these DON'T diversify each other:\n- Tech stocks with each other\n- US equity ETFs with each other\n- High yield bonds with equities\n\nLOW correlation pairs (<0.3) — TRUE diversifiers:\n- Stocks vs Treasury bonds\n- US vs Gold\n- Equities vs Managed Futures\n\nNEGATIVE correlation — HEDGES:\n- Long equity + Put options\n- Stocks + VIX products\n- Growth + Value in some regimes\n\nGrade portfolio diversification: A/B/C/D/F\n\n5. Risk Score Card (0-100)\n\nGenerate a single risk score:\n\nrisk_scorecard:\n  concentration_risk:\n    weight: 20\n    score: X  # 100 = well diversified, 0 = single stock\n    details: \"Top position is X%, X sectors represented\"\n\n  volatility_risk:\n    weight: 20\n    score: X  # 100 = low vol, 0 = extremely volatile\n    details: \"Portfolio annualized vol: X%\"\n\n  drawdown_risk:\n    weight: 20\n    score: X  # 100 = minimal drawdown exposure, 0 = could lose 50%+\n    details: \"Max estimated drawdown: X%\"\n\n  liquidity_risk:\n    weight: 15\n    score: X  # 100 = all highly liquid, 0 = illiquid positions\n    details: \"X% in liquid large-cap, X% in illiquid\"\n\n  income_resilience:\n    weight: 10\n    score: X  # 100 = strong income, 0 = no yield\n    details: \"Portfolio yield: X%, X% from reliable dividend payers\"\n\n  market_sensitivity:\n    weight: 15\n    score: X  # 100 = low beta/defensive, 0 = highly aggressive\n    details: \"Portfolio beta: X.XX\"\n\n  overall_score: X/100\n  rating: \"[CONSERVATIVE|MODERATE|AGGRESSIVE|SPECULATIVE]\"\n  recommendation: \"[Key action item]\"\n\nScore Interpretation\n80-100: FORTRESS — Well-protected, may be too conservative for growth\n60-79: SOLID — Good risk management, minor improvements possible\n40-59: MODERATE — Reasonable but has notable risk exposures\n20-39: ELEVATED — Significant vulnerabilities, rebalancing recommended\n0-19: DANGER ZONE — Extreme concentration or volatility, urgent action needed\n6. Monitoring & Alerts\nDaily Check Template (for cron/heartbeat use)\nFor each portfolio position:\n1. Check price vs previous close (web search)\n2. Flag if any position moved >3% in a day\n3. Flag if any position hit stop-loss level\n4. Check for earnings/events in next 7 days\n\nAlert Thresholds:\n- Single position -5% in a day → ALERT\n- Portfolio -3% in a day → ALERT\n- Position hits 52-week low → WATCH\n- VIX > 25 → ELEVATED CAUTION\n- VIX > 35 → HIGH ALERT — review hedges\n\nWeekly Review Template\n## Portfolio Weekly Review — [Date]\n\n### Performance\n- Portfolio value: $XX,XXX (±X.X% week)\n- Best performer: [TICKER] +X.X%\n- Worst performer: [TICKER] -X.X%\n- vs S&P 500: [outperformed/underperformed] by X.X%\n\n### Risk Changes\n- VaR change: $X,XXX → $X,XXX\n- Any new concentration issues? [Y/N]\n- Rebalancing needed? [Y/N]\n\n### Upcoming Events\n- Earnings: [tickers and dates]\n- Ex-dividend dates: [tickers and dates]\n- Fed/macro events: [list]\n\n### Action Items\n1. [Specific recommendation]\n2. [Specific recommendation]\n\n7. Tax-Loss Harvesting Scanner\nFor each position with unrealized losses:\n1. Calculate unrealized loss: (Current Price - Avg Cost) × Shares\n2. Check if loss >$500 (worth harvesting)\n3. Identify tax-efficient replacement:\n   - Same sector ETF (avoids wash sale)\n   - Similar factor exposure\n   - Hold replacement 31+ days before switching back\n\nReport:\n| Ticker | Unrealized Loss | Replacement | Wash Sale Clear Date |\n|--------|----------------|-------------|---------------------|\n| XYZ    | -$2,500        | Similar ETF | [date + 31 days]   |\n\nEstimated tax savings: $X,XXX (at X% marginal rate)\n\n8. Special Asset Classes\nCrypto Portfolio Risk\n\nAdditional crypto-specific metrics:\n\nBitcoin dominance correlation\nExchange risk (centralized vs self-custody)\nProtocol risk for DeFi positions\nStablecoin exposure and depeg risk\nTax implications of staking/yield\nReal Estate (REITs/Property)\nFFO yield vs dividend yield\nInterest rate sensitivity\nGeographic concentration\nProperty type diversification (residential/commercial/industrial)\nOptions Positions\n\nIf portfolio includes options:\n\nDelta exposure (equivalent stock position)\nTheta decay (daily time value loss)\nImplied volatility vs historical\nMax loss calculation\nBreakeven prices\n9. Report Generation\nFull Risk Report (on request)\n\nGenerate a complete PDF-ready markdown report:\n\n# Portfolio Risk Report\n## Prepared: [Date]\n## Portfolio: [Name]\n\n### Executive Summary\n[2-3 sentence overview: total value, risk rating, top recommendation]\n\n### 1. Holdings Summary\n[Position table from Section 1]\n\n### 2. Risk Metrics\n[All calculations from Section 2]\n\n### 3. Stress Test Results\n[All scenarios from Section 3]\n\n### 4. Optimization Recommendations\n[From Section 4]\n\n### 5. Risk Scorecard\n[From Section 5]\n\n### 6. Action Plan\n[Prioritized list of recommended changes]\n\n### Disclaimer\nThis analysis is for informational purposes only and does not constitute\nfinancial advice. Past performance and historical data do not guarantee\nfuture results. Consult a qualified financial advisor before making\ninvestment decisions.\n\n10. Quick Commands\n\nRespond to these natural language requests:\n\nUser Says\tAction\n\"Analyze my portfolio\"\tFull Section 1-5 analysis\n\"What's my risk?\"\tRisk Scorecard (Section 5)\n\"Stress test my portfolio\"\tAll scenarios (Section 3)\n\"What if the market crashes?\"\t2008 + COVID scenarios\n\"How should I rebalance?\"\tSection 4 optimization\n\"Tax loss harvest\"\tSection 7 scanner\n\"Weekly review\"\tSection 6 weekly template\n\"Add [position]\"\tUpdate portfolio YAML, recalculate\n\"Remove [position]\"\tUpdate portfolio YAML, recalculate\n\"What's my VaR?\"\tValue at Risk calculation (Section 2.2)\n\"Compare to S&P 500\"\tBenchmark comparison\n\"How diversified am I?\"\tConcentration + correlation analysis\n\"What's my Sharpe ratio?\"\tSection 2.5\n\"Set alert for [ticker] at [price]\"\tAdd to monitoring (Section 6)\nEdge Cases\nSmall Portfolios (<$10K)\nSkip VaR (not meaningful for small amounts)\nFocus on concentration risk and savings rate\nRecommend index-first approach\nSingle Stock Portfolios (e.g., company RSUs)\nALWAYS flag extreme concentration risk\nModel collar strategies (protective put + covered call)\n10b5-1 plan reminder for insiders\nCalculate how much to diversify per quarter\nCrypto-Heavy (>50% crypto)\nApply crypto winter scenario prominently\nFlag exchange counterparty risk\nRecommend cold storage percentage\nNote tax complexity of DeFi/staking\nInternational Portfolios\nCurrency risk calculation\nCountry risk premium\nWithholding tax impact on dividends\nADR vs local share considerations\nLeveraged Positions (margin/options)\nCalculate margin call price\nStress test at 2x normal drawdown\nFlag if margin utilization >50%\nModel forced liquidation scenarios\nRetirement Accounts (IRA/401k)\nDifferent tax treatment (no tax-loss harvesting needed)\nRMD impact for traditional IRA\nRoth conversion opportunity analysis\nSequence of returns risk for near-retirees"
  },
  "trust": {
    "sourceLabel": "tencent",
    "provenanceUrl": "https://clawhub.ai/1kalin/afrexai-portfolio-risk",
    "publisherUrl": "https://clawhub.ai/1kalin/afrexai-portfolio-risk",
    "owner": "1kalin",
    "version": "1.0.0",
    "license": null,
    "verificationStatus": "Indexed source record"
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/afrexai-portfolio-risk",
    "downloadUrl": "https://openagent3.xyz/downloads/afrexai-portfolio-risk",
    "agentUrl": "https://openagent3.xyz/skills/afrexai-portfolio-risk/agent",
    "manifestUrl": "https://openagent3.xyz/skills/afrexai-portfolio-risk/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/afrexai-portfolio-risk/agent.md"
  }
}