{"uid":"cap_Q51o_sOmuUfgymXP_FwXi","slug":"treasury-risk-analyzer-portfolio-risk-analysis-5ecdf66b","name":"Treasury Risk Analyzer — Portfolio Risk Analysis","description":"Deterministic financial intelligence for autonomous AI Treasury/CFO agents, paid per call in USDC on Base via x402 — no account, no API key. Two payment rails are accepted on every paid route: Circle Gateway batched payments and standard x402 `exact` (EIP-3009) payments, so any x402 v2 client can pay. Exposes three atomic capabilities — treasury/portfolio risk analysis, FX exposure analysis, and liquidity forecasting — plus a composite POST /treasury-decision endpoint that orchestrates all three to answer \"can we safely execute this payment today?\" All share one deterministic engine and one agent-native response format. No LLM is used to produce or estimate a financial value. Requests are validated before payment: invalid input returns a free 400 and is never charged.","url":"https://portfolio-risk-analyzer-g9ao.onrender.com/analyze?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"type":"object","required":["returns","weights"],"properties":{"returns":{"type":"object","description":"Per-period historical return series by symbol. All series must be the same length (≥2 observations)."},"weights":{"type":"object","description":"Portfolio weights by symbol. Must cover exactly the same symbols as `returns` and sum to 1."},"baseCurrency":{"type":"string"},"riskFreeRate":{"type":"number","description":"Annualized risk-free rate, e.g. 0.04 for 4%."},"periodsPerYear":{"type":"number","description":"Periods per year in the return series (252 for daily equities, 365 for daily crypto)."},"sectorExposure":{"type":"object","description":"Optional weight distribution by sector, for concentration analysis."},"stressScenarios":{"type":"array","description":"Optional stress scenarios. Shocks on the listed symbols propagate to unshocked symbols via covariance-based beta mapping (correlated impact), alongside the direct-only impact."},"benchmarkReturns":{"type":"array","description":"Optional per-period benchmark series (same length as each `returns` series) to compute beta and correlation."},"confidenceLevels":{"type":"array","description":"Confidence levels for VaR/Expected Shortfall. Supported: 0.9, 0.95, 0.975, 0.99, 0.995."},"currencyExposure":{"type":"object","description":"Optional weight distribution by currency, for concentration analysis."},"geographyExposure":{"type":"object","description":"Optional weight distribution by geography, for concentration analysis."},"minimumAcceptableReturn":{"type":"number","description":"Per-period MAR used for downside deviation / Sortino ratio."}}},"responseSchema":{"type":"object","properties":{"status":{"enum":["success"],"type":"string"},"warnings":{"type":"array","items":{"type":"string"}},"portfolio":{"type":"object","properties":{"assets":{"type":"integer"},"base_currency":{"type":"string"}}},"timestamp":{"type":"string","format":"date-time"},"analysis_id":{"type":"string","format":"uuid"},"limitations":{"type":"array","items":{"type":"string"}},"methodology":{"type":"object","additionalProperties":{"type":"string"}},"stress_test":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"propagation":{"type":"object","description":"Per unshocked symbol, why its implied shock is what it is. `propagated` only when the regression on the usable drivers is significant (F-test p < 0.05); `not_significant` (implied shock 0), `zero_variance` (the symbol never moved historically), or `no_usable_driver` (every shocked symbol was excluded, see excludedDrivers).","additionalProperties":{"type":"object","properties":{"pValue":{"type":"number","nullable":true},"status":{"enum":["propagated","not_significant","zero_variance","no_usable_driver"],"type":"string"},"rSquared":{"type":"number","nullable":true}}}},"directShocks":{"type":"object","description":"The user-specified shocks that matched a portfolio symbol.","additionalProperties":{"type":"number"}},"impliedShocks":{"type":"object","description":"Shocks inferred for portfolio symbols not directly named in the scenario, via factor-beta mapping on the historical covariance matrix of the directly-shocked symbols. Empty if every portfolio symbol was directly shocked, or if none of the scenario's shocks matched a portfolio symbol. A value is exactly 0 when the relationship was not propagated — see `propagation` for the reason.","additionalProperties":{"type":"number"}},"excludedDrivers":{"type":"array","items":{"type":"object","properties":{"reason":{"enum":["zero_variance","extrapolation"],"type":"string"},"symbol":{"type":"string"},"sigmaMultiple":{"type":"number","nullable":true}}},"description":"Shocked symbols NOT used to infer other symbols' moves: `zero_variance` (no historical movement to learn from) or `extrapolation` (the shock exceeds 50 of the symbol's own per-period standard deviations — a regime change such as a stablecoin depeg, outside the range the correlation was estimated on). Their direct shock still counts in portfolioImpact."},"portfolioImpact":{"type":"number","description":"Total portfolio impact including both direct shocks and correlated implied shocks."},"directOnlyImpact":{"type":"number","description":"Naive portfolio impact from directShocks alone, ignoring correlation to unshocked symbols — kept for comparison."},"unmatchedSymbols":{"type":"array","items":{"type":"string"},"description":"Scenario shock keys that did not match any portfolio symbol (e.g. a macro factor name) — excluded from both direct and implied impact."}}}},"data_quality":{"type":"object","properties":{"sample_size":{"type":"integer"},"benchmark_provided":{"type":"boolean"},"sufficient_sample_size":{"type":"boolean"},"minimum_recommended_sample_size":{"type":"integer"}}},"risk_metrics":{"type":"object","properties":{"hhi":{"type":"number"},"beta":{"type":"number","nullable":true},"calmar_ratio":{"type":"number","nullable":true},"max_drawdown":{"type":"number"},"sharpe_ratio":{"type":"number","nullable":true},"sortino_ratio":{"type":"number","nullable":true},"value_at_risk":{"type":"object","additionalProperties":{"type":"object","properties":{"historical":{"type":"number"},"parametric":{"type":"number","nullable":true}}}},"annualized_return":{"type":"number"},"expected_shortfall":{"type":"object","additionalProperties":{"type":"object","properties":{"historical":{"type":"number"},"parametric":{"type":"number","nullable":true}}}},"annualized_volatility":{"type":"number"},"diversification_ratio":{"type":"number","nullable":true},"correlation_to_benchmark":{"type":"number","nullable":true},"annualized_downside_deviation":{"type":"number"}}},"concentration":{"type":"object","additionalProperties":{"type":"object","properties":{"hhi":{"type":"number"},"effectiveCount":{"type":"number","nullable":true}}}},"risk_contribution":{"type":"object","additionalProperties":{"type":"number"}},"risk_classification":{"type":"object","properties":{"level":{"enum":["LOW","MEDIUM","HIGH"],"type":"string"},"score":{"type":"integer","maximum":100,"minimum":0}}}}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.1","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.1/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.1","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.1","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_vHufdwPlo6QojHQEtoV_t","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.1","costPer":"request","priority":0,"asset":"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Runs deterministic portfolio risk analysis (volatility, VaR, Sharpe/Sortino, stress tests, benchmark metrics) on a submitted portfolio of return series and weights, paid per call in USDC via x402.","exampleAgentPrompt":"Analyze the risk of my portfolio: BTC weighted 60% with daily returns [0.01, -0.02, 0.03, -0.01, 0.02] and ETH weighted 40% with daily returns [0.02, -0.03, 0.01, 0.00, 0.015], using 365 periods per year, a 4% risk-free rate, and VaR at 95% and 99% confidence levels.","exampleUseCases":[{"title":"Daily crypto treasury risk check","prompt":"Run a risk analysis on my crypto treasury: BTC at 50% weight with daily returns [0.01, -0.02, 0.03, -0.01, 0.02, 0.005], ETH at 30% with [0.02, -0.03, 0.01, 0.00, 0.015, -0.01], and USDC at 20% with [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]. Use 365 periods per year, a 4.5% risk-free rate, and give me VaR at 95% and 99% confidence."},{"title":"Stress-test portfolio under rate shock","prompt":"Stress-test my equity portfolio — SPY at 70% weight and QQQ at 30%, daily returns over the last 10 periods, 252 periods per year — under a scenario where SPY drops 20% and QQQ drops 25%. Show me the implied shocks on unshocked symbols too."},{"title":"Benchmark-relative risk and Sortino for MAR","prompt":"Compute Sharpe, Sortino, and beta against my benchmark for a portfolio with AAPL at 40%, MSFT at 35%, GOOG at 25%, using daily returns for the past 8 periods, 252 periods per year, 5% risk-free rate, and a minimum acceptable return of 0.0003 per period. Here are the benchmark daily returns for the same 8 periods: [0.001, -0.002, 0.003, -0.001, 0.002, 0.001, -0.001, 0.002]."}],"resultDescription":"Returns a JSON object with a UUID analysis ID, timestamp, portfolio summary (asset count, base currency), computed risk metrics (volatility, VaR and Expected Shortfall at requested confidence levels, Sharpe ratio, Sortino ratio), stress test results with direct and propagated shocks per symbol (including propagation diagnostics), benchmark correlation and beta if supplied, concentration analysis by sector/currency/geography if supplied, plus warnings and methodology notes describing any limitations.","failureModes":["400 Bad Request (free, no charge): invalid input such as mismatched symbol sets between returns and weights, weights not summing to 1, return series of different lengths, unsupported confidence levels — returns descriptive error message","Payment failure: x402 or Circle Gateway payment not confirmed — request not processed","Return series too short (fewer than 2 observations): 400 error","Stress scenario names a symbol not in the portfolio: scenario may produce empty directShocks or limited propagation","Render.com cold-start latency on first request after idle period"],"whenToPreferThis":"Use this endpoint when you need deterministic, auditable portfolio risk metrics — VaR, Expected Shortfall, Sharpe/Sortino ratios, stress tests — with no LLM estimation involved. Prefer it over LLM-based financial summaries when you need mathematically exact outputs suitable for autonomous treasury or CFO agent decision-making. It is particularly well-suited for agents that must justify risk decisions with reproducible quantitative evidence. The x402 pay-per-call model means no account setup is required.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-12-02T18:32:07.255Z","isFirstParty":false,"canonicalSlug":"treasury-risk-analyzer-portfolio-risk-analysis-5ecdf66b"}