{"uid":"cap_mTVRfuorkGteXF0eK0T1A","slug":"animica-portfolio-risk-analytics-api-53f0d05c","name":"Animica Portfolio Risk Analytics API","description":"Animica Python Cloud: deploy a Python function to animica.dev, get a public endpoint, and earn ANM every time someone runs it. Free AI (OpenAI-compatible, no key), free scheduled Workers, and an 80/20 developer split.","url":"https://animica.dev/x402/alpha/risk","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"positions":{"type":"object","description":"up to 64 positions keyed by name: {\"BTC\": {\"weight\": 0.6, \"returns\": [...]}}. Supply either returns[] (simple, oldest first) or prices[] and we derive them. At least 20 observations per position, and every series must cover the SAME periods — misaligned series make every correlation meaningless. Negative weight is a short."},"confidence":{"type":"number","description":"VaR/ES confidence level in (0,1), default 0.95. 0.99 needs a longer series to mean anything."},"data_timestamp":{"type":"string","description":"ISO timestamp of the most recent observation. Carried through to provenance so an agent can judge how old the analysis is."},"periods_per_year":{"type":"integer","description":"periods per year for annualisation (252 daily, 8760 hourly, 52 weekly). Omit it and nothing is annualised — we do not guess the frequency of a series we did not collect, because a daily series annualised as hourly is wrong by about 5x and looks plausible."},"portfolio_value_usd":{"type":"number","description":"total book value; when given, VaR and expected shortfall are also returned in dollars."}}},"responseSchema":{"type":"json"},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.006","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.006/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.006","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.006","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_on5Vqv6uHvoh65Wdt-p5r","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.006","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Computes portfolio risk metrics (VaR, Expected Shortfall, correlations) for a multi-asset position set using historical returns or prices.","exampleAgentPrompt":"Analyze the risk of my portfolio: BTC at 60% weight with 252 daily returns [0.01, -0.02, ...], ETH at 40% weight with matching returns, using a 0.95 confidence level, 252 periods per year, and a total book value of $500,000 — give me the VaR and Expected Shortfall in dollars.","exampleUseCases":[{"title":"Daily crypto portfolio risk check","prompt":"Run a risk analysis on my crypto book — BTC at 70% weight and ETH at 30%, both with the last 60 daily returns I'll provide, 95% confidence, 252 periods per year, and the total portfolio is worth $200,000. What's my VaR and expected shortfall in dollars?"},{"title":"Multi-asset hedge fund tail risk report","prompt":"I have a 5-asset portfolio including a short position in GLD (weight -0.15) and longs in SPY, QQQ, TLT, and GLD with at least 60 weekly observations each. Compute the 99% confidence VaR and ES annualised at 52 periods per year on a $10 million book, with data timestamp 2024-06-01T00:00:00Z."},{"title":"Volatility and correlation check before rebalancing","prompt":"Before I rebalance, can you compute portfolio risk for my three positions — AAPL 50%, MSFT 30%, NVDA 20% — using 100 daily returns per asset at 95% confidence and 252 periods per year? I want to see if the correlations are making my portfolio riskier than I think."}],"resultDescription":"Returns a JSON object containing Value at Risk (VaR) and Expected Shortfall (ES) at the requested confidence level, correlation matrix across positions, annualised risk statistics (when periods_per_year is supplied), dollar-denominated risk figures (when portfolio_value_usd is provided), and provenance metadata including the data_timestamp so the agent can assess how current the analysis is.","failureModes":["Misaligned return series (different lengths or periods) result in meaningless correlations — API requires all series to cover the same periods","Fewer than 20 observations per position triggers rejection or unreliable estimates","Confidence level at or above 1.0 or at or below 0.0 is invalid","Missing periods_per_year means no annualisation is returned — not an error but a silent omission","99% confidence level with short series produces statistically unreliable results","Malformed position weights or missing returns/prices fields cause schema validation errors"],"whenToPreferThis":"Choose this endpoint when you need on-demand, quantitative portfolio risk metrics (VaR, ES, correlations) for up to 64 named positions without standing up your own risk infrastructure. It is particularly suited for AI agents that need to embed risk analysis in automated workflows, support multi-asset books including shorts, and require dollar-denominated risk figures with provenance timestamps. Prefer it over generic statistics APIs when the specific financial risk framing (VaR, ES, annualisation) and multi-position correlation output are needed.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-14T12:44:40.659Z","isFirstParty":false}