# Portfolio Analytics API > Time- and money-weighted returns, risk metrics, VaR/ES, Brinson attribution, factor regression, mean-variance and risk-parity weights, rebalance trades, correlation, stress tests, Monte Carlo goals, wash-sale detection, fee drag, tracking error and allocation look-through from caller-supplied holdings and returns. Each paid operation uses a fixed USDC price on Base with the x402 exact scheme. Unpaid GET, HEAD, and POST return 402 payment terms (POST validates the body only after payment terms are satisfied). A request that carries payment-signature is not yet charged: settlement happens only after a successful (2xx) result. HTTP 4xx/5xx are not charged. Coverage bodies with status complete, partial, or failed all return HTTP 200 and are charged at the full listed price. Settled 2xx responses include a payment-response header; 4xx/5xx do not. Follow https://www.brainiac.software/agent-instructions.txt for install, payment pins, idempotency, and billing rules. - Product: https://www.brainiac.software/api/portfolio-analytics - Docs: https://www.brainiac.software/api/portfolio-analytics/docs - OpenAPI: https://www.brainiac.software/api/portfolio-analytics/openapi.json - Contact: support@brainiac.software (https://www.brainiac.software/contact) ## Operations ### POST /api/v1/portfolio-analytics/performance-twr-mwr $0.04 USDC. Compute linked TWR, Modified Dietz and XIRR from valuations and external cash flows, with optional annualisation. Inputs: valuations, flows?, annualize? Docs: https://www.brainiac.software/api/portfolio-analytics/docs#portfolio-analytics-performance-twr-mwr Example request: ```json { "valuations": [ { "date": "2026-01-01", "value": 100000 }, { "date": "2026-07-02", "value": 105000, "beforeFlow": true }, { "date": "2027-01-01", "value": 120000 } ], "flows": [ { "date": "2026-07-02", "amount": 10000 } ], "annualize": true } ``` Example response: ```json { "twr": 0.09565217391304359, "modifiedDietz": 0.09522567179754761, "xirr": 0.09532897919588461, "days": 365, "subPeriods": [ { "from": "2026-01-01", "to": "2026-07-02", "return": 0.050000000000000044 }, { "from": "2026-07-02", "to": "2027-01-01", "return": 0.04347826086956519 } ], "status": "ok", "sources": [ { "source": "Caller-supplied holdings, returns, valuations and transactions processed locally", "url": "https://www.brainiac.software/api/v1/portfolio-analytics", "retrievedAt": "2026-11-14", "status": "ok" } ], "limitations": [ "Outputs are calculations on caller-supplied inputs for human review. No market data is fetched, and this is not investm…", "TWR links sub-period returns between external flow dates using beforeFlow valuations when provided.", "…" ] } ``` ### POST /api/v1/portfolio-analytics/risk-metrics $0.03 USDC. Annualised volatility, Sharpe, Sortino, Calmar, max drawdown with peak/trough/recovery indices, skewness and excess kurtosis from a return series. Inputs: returns, periodsPerYear?, riskFreePerPeriod?, mar? Docs: https://www.brainiac.software/api/portfolio-analytics/docs#portfolio-analytics-risk-metrics Example request: ```json { "returns": [ 0.02, -0.01, 0.03, -0.04, 0.015, 0.01, -0.02, 0.025, 0.005, -0.015, 0.03, 0.01 ], "periodsPerYear": 12, "riskFreePerPeriod": 0.002, "mar": null } ``` Example response: ```json { "volatility": 0.07603826787755083, "annualReturn": 0.05886860527185367, "sharpe": 0.4734458188602223, "sortino": 0.6952709657232169, "maxDrawdown": -0.040000000000000036, "drawdownPeakIndex": 3, "drawdownTroughIndex": 4, "recoveryIndex": 11, "calmar": 1.4717151317963404, "skewness": -0.7658791422339498, "excessKurtosis": -0.16094695621217464, "sources": [ { "source": "Caller-supplied holdings, returns, valuations and transactions processed locally", "url": "https://www.brainiac.software/api/v1/portfolio-analytics", "retrievedAt": "2026-11-14", "status": "ok" } ], "limitations": [ "Outputs are calculations on caller-supplied inputs for human review. No market data is fetched, and this is not investm…", "Volatility, Sharpe and Sortino use the sample standard deviation; Sortino downside deviation averages squared losses ov…", "…" ] } ``` ### POST /api/v1/portfolio-analytics/var-cvar $0.04 USDC. Historical, parametric normal and Monte Carlo VaR/ES at caller confidence levels from a return series. Inputs: returns, confidence, methods?, portfolioValue?, horizonPeriods?, simulations?, seed? Docs: https://www.brainiac.software/api/portfolio-analytics/docs#portfolio-analytics-var-cvar Example request: ```json { "returns": [ -0.031, 0.012, -0.008, 0.022, -0.045, 0.005, 0.017, -0.012, 0.009, -0.021, 0.014, -0.002, 0.026, -0.018, 0.003, 0.011, -0.027, 0.007, 0.019, -0.006 ], "confidence": [ 0.9, 0.95 ], "methods": [ "historical", "parametric", "monte_carlo" ], "portfolioValue": 1000000, "horizonPeriods": 1, "simulations": 10000, "seed": 42 } ``` Example response: ```json { "results": [ { "method": "historical", "confidence": 0.9, "var": 0.031, "es": 0.038, "varAmount": 31000 }, { "method": "parametric", "confidence": 0.9, "var": 0.026078892030377016, "es": 0.03525120030116119, "varAmount": 26078.892030377017 }, "…" ], "sources": [ { "source": "Caller-supplied holdings, returns, valuations and transactions processed locally", "url": "https://www.brainiac.software/api/v1/portfolio-analytics", "retrievedAt": "2026-11-14", "status": "ok" } ], "limitations": [ "Outputs are calculations on caller-supplied inputs for human review. No market data is fetched, and this is not investm…", "VaR and ES are positive loss fractions. Historical uses order statistics; parametric and Monte Carlo use the sample mea…", "…" ] } ``` ### POST /api/v1/portfolio-analytics/brinson-attribution $0.04 USDC. Allocation, selection and interaction effects by segment for one or more periods, with optional Carino linking. Inputs: periods, linking?, normalizeWeights?, allowNegativeWeights? Docs: https://www.brainiac.software/api/portfolio-analytics/docs#portfolio-analytics-brinson-attribution Example request: ```json { "periods": [ { "segments": [ { "name": "Equity", "wp": 0.5, "wb": 0.4, "rp": 0.1, "rb": 0.08 }, { "name": "Bonds", "wp": 0.3, "wb": 0.4, "rp": 0.04, "rb": 0.05 }, { "name": "Cash", "wp": 0.2, "wb": 0.2, "rp": 0.02, "rb": 0.03 } ] } ], "linking": "carino", "normalizeWeights": true } ``` Example response: ```json { "portfolioReturn": 0.066, "benchmarkReturn": 0.058, "activeReturn": 0.008, "segments": [ { "name": "Equity", "allocation": 0.0021999999999999993, "selection": 0.008000000000000002, "interaction": 0.002 }, { "name": "Bonds", "allocation": 0.0008000000000000003, "selection": -0.004000000000000001, "interaction": 0.0010000000000000005 }, "…" ], "totals": { "allocation": 0.0029999999999999996, "selection": 0.0020000000000000013, "interaction": 0.0030000000000000005 }, "sources": [ { "source": "Caller-supplied holdings, returns, valuations and transactions processed locally", "url": "https://www.brainiac.software/api/v1/portfolio-analytics", "retrievedAt": "2026-11-14", "status": "ok" } ], "limitations": [ "Outputs are calculations on caller-supplied inputs for human review. No market data is fetched, and this is not investm…", "Brinson-Fachler single-period effects: allocation (wp−wb)(rb−Rb), selection wb(rp−rb), interaction (wp−wb)(rp−rb)." ] } ``` ### POST /api/v1/portfolio-analytics/factor-regression $0.04 USDC. OLS of portfolio excess returns on caller-supplied factors with intercept, betas, alpha and optional Newey-West standard errors. Inputs: returns, riskFree?, factors, periodsPerYear?, neweyWestLags? Docs: https://www.brainiac.software/api/portfolio-analytics/docs#portfolio-analytics-factor-regression Example request: ```json { "returns": [ 0.025, -0.012, 0.035, -0.045, 0.018, 0.012, -0.021, 0.028, 0.007, -0.016, 0.033, 0.013 ], "riskFree": [ 0.002, 0.002, 0.002, 0.002, 0.002, 0.002, 0.002, 0.002, 0.002, 0.002, 0.002, 0.002 ], "factors": { "MKT_RF": [ 0.02, -0.01, 0.03, -0.04, 0.015, 0.01, -0.02, 0.025, 0.005, -0.015, 0.03, 0.01 ], "SMB": [ 0.005, 0.002, -0.003, 0.004, -0.001, 0, 0.003, -0.002, 0.001, 0.002, -0.004, 0.001 ], "HML": [ -0.002, 0.003, 0.001, -0.004, 0.002, 0.001, -0.001, 0, 0.003, -0.002, 0.001, 0.002 ] }, "periodsPerYear": 12, "neweyWestLags": 0 } ``` Example response: ```json { "alphaPerPeriod": -0.0016174328233197332, "alphaAnnualized": -0.01923745952752709, "betas": [ { "factor": "MKT_RF", "beta": 1.160864263661775, "se": 0.017006267834078596 }, { "factor": "SMB", "beta": 0.3452662232048083, "se": 0.13645405346721115 }, "…" ], "alphaSe": 0.0002994694423945589, "rSquared": 0.9991221247271498, "n": 12, "sources": [ { "source": "Caller-supplied holdings, returns, valuations and transactions processed locally", "url": "https://www.brainiac.software/api/v1/portfolio-analytics", "retrievedAt": "2026-11-14", "status": "ok" } ], "limitations": [ "Outputs are calculations on caller-supplied inputs for human review. No market data is fetched, and this is not investm…", "OLS of excess returns on caller-supplied factors with intercept via Householder QR. Alpha is annualised as (1+α)^P−1.", "…" ] } ``` ### POST /api/v1/portfolio-analytics/mean-variance-optimize $0.05 USDC. Minimum variance, target return, max Sharpe or target volatility portfolios from expected returns and a covariance matrix, with bounds. Inputs: assets, expectedReturns, covariance?, returns?, objective, targetReturn?, targetVolatility?, riskFree?, bounds?, groups?, frontierPoints?, shrinkage? Docs: https://www.brainiac.software/api/portfolio-analytics/docs#portfolio-analytics-mean-variance-optimize Example request: ```json { "assets": [ "A", "B", "C" ], "expectedReturns": [ 0.06, 0.08, 0.1 ], "covariance": [ [ 0.01, 0.0045, 0.004 ], [ 0.0045, 0.0225, 0.012 ], [ 0.004, 0.012, 0.04 ] ], "objective": "target_return", "targetReturn": 0.08, "riskFree": 0.02, "bounds": { "min": 0, "max": 1 }, "groups": [], "frontierPoints": 0, "shrinkage": "none" } ``` Example response: ```json { "weights": [ { "asset": "A", "weight": 0.34756097560975596 }, { "asset": "B", "weight": 0.3048780487804878 }, "…" ], "expectedReturn": 0.07999999999999999, "volatility": 0.11222527431520025, "sharpe": 0.5346389248422032, "activeConstraints": [], "status": "optimal", "sources": [ { "source": "Caller-supplied holdings, returns, valuations and transactions processed locally", "url": "https://www.brainiac.software/api/v1/portfolio-analytics", "retrievedAt": "2026-11-14", "status": "ok" } ], "limitations": [ "Outputs are calculations on caller-supplied inputs for human review. No market data is fetched, and this is not investm…", "Mean-variance uses an active-set quadratic programme on the covariance; unconstrained solutions match the analytic Σ⁻¹ …" ] } ``` ### POST /api/v1/portfolio-analytics/risk-parity-weights $0.04 USDC. Spinu ERC (or caller risk-budget) weights and inverse-volatility weights with risk-contribution breakdown. Inputs: assets, covariance, riskBudget?, method? Docs: https://www.brainiac.software/api/portfolio-analytics/docs#portfolio-analytics-risk-parity-weights Example request: ```json { "assets": [ "A", "B", "C" ], "covariance": [ [ 0.01, 0.0045, 0.004 ], [ 0.0045, 0.0225, 0.012 ], [ 0.004, 0.012, 0.04 ] ], "riskBudget": null, "method": "erc" } ``` Example response: ```json { "weights": [ 0.47817014333330193, 0.29216033634018823, "…" ], "riskContributions": [ 0.3333333333313619, 0.33333333333466947, "…" ], "portfolioVolatility": 0.10031567969401549, "inverseVolatility": [ 0.4615384615384615, 0.3076923076923077, "…" ], "iterations": 19, "converged": true, "sources": [ { "source": "Caller-supplied holdings, returns, valuations and transactions processed locally", "url": "https://www.brainiac.software/api/v1/portfolio-analytics", "retrievedAt": "2026-11-14", "status": "ok" } ], "limitations": [ "Outputs are calculations on caller-supplied inputs for human review. No market data is fetched, and this is not investm…", "ERC uses Spinu (2013): minimise ½yᵀΣy − Σ b_i ln y_i, then w = y/Σy." ] } ``` ### POST /api/v1/portfolio-analytics/rebalance-trades $0.03 USDC. Compute buys and sells that restore target weights with tolerance bands, a cash buffer, minimum trade size and whole-share rounding. Inputs: holdings, cash?, targets, band?, cashBuffer?, minTradeValue?, fractional?, restricted? Docs: https://www.brainiac.software/api/portfolio-analytics/docs#portfolio-analytics-rebalance-trades Example request: ```json { "holdings": [ { "symbol": "VTI", "quantity": 200, "price": 250 }, { "symbol": "BND", "quantity": 300, "price": 72 }, { "symbol": "VXUS", "quantity": 100, "price": 60 } ], "cash": 5000, "targets": { "VTI": 0.6, "BND": 0.3, "VXUS": 0.1 }, "band": { "type": "absolute", "value": 0.02 }, "cashBuffer": 0.01, "minTradeValue": 100, "fractional": false, "restricted": [] } ``` Example response: ```json { "totalValue": 82600, "investable": 81774, "trades": [ { "symbol": "BND", "side": "buy", "quantity": 33, "value": 2376 }, { "symbol": "VXUS", "side": "buy", "quantity": 29, "value": 1740 } ], "untouched": [ { "symbol": "VTI", "reason": "within_band", "drift": 0.0053268765133172025 } ], "cashAfter": 884, "weightsAfter": { "VTI": 0.6053268765133172, "BND": 0.29026634382566585, "VXUS": 0.0937046004842615 }, "sources": [ { "source": "Caller-supplied holdings, returns, valuations and transactions processed locally", "url": "https://www.brainiac.software/api/v1/portfolio-analytics", "retrievedAt": "2026-11-14", "status": "ok" } ], "limitations": [ "Outputs are calculations on caller-supplied inputs for human review. No market data is fetched, and this is not investm…", "Sells execute first. Buys are scaled pro rata when they would breach the cash buffer. Whole-share rounding truncates to…" ] } ``` ### POST /api/v1/portfolio-analytics/correlation-matrix $0.03 USDC. Pearson and Spearman correlation, optional covariance, rolling windows and Ledoit-Wolf shrinkage covariance from caller series. Inputs: series, methods?, missing?, rollingWindow? Docs: https://www.brainiac.software/api/portfolio-analytics/docs#portfolio-analytics-correlation-matrix Example request: ```json { "series": { "A": [ 0.02, -0.01, 0.03, -0.04, 0.015, 0.01, -0.02, 0.025, 0.005, -0.015, 0.03, 0.01 ], "B": [ 0.025, -0.012, 0.035, -0.045, 0.018, 0.012, -0.021, 0.028, 0.007, -0.016, 0.033, 0.013 ], "C": [ 0.005, 0.002, -0.003, 0.004, -0.001, 0, 0.003, -0.002, 0.001, 0.002, -0.004, 0.001 ] }, "methods": [ "pearson", "spearman", "ledoit_wolf" ], "missing": "pairwise", "rollingWindow": null } ``` Example response: ```json { "pairCounts": [ [ 12, 12, "…" ], [ 12, 12, "…" ], "…" ], "sources": [ { "source": "Caller-supplied holdings, returns, valuations and transactions processed locally", "url": "https://www.brainiac.software/api/v1/portfolio-analytics", "retrievedAt": "2026-11-14", "status": "ok" } ], "limitations": [ "Outputs are calculations on caller-supplied inputs for human review. No market data is fetched, and this is not investm…", "Pearson uses pairwise-complete observations; Spearman is Pearson on average ranks. Ledoit-Wolf uses listwise mean-centr…" ], "pearson": [ [ 1, 0.9991821892446439, "…" ], [ 0.9991821892446439, 1, "…" ], "…" ], "psd": true, "spearman": [ [ 1, 0.9964973622679556, "…" ], [ 0.9964973622679556, 1, "…" ], "…" ], "ledoitWolf": { "shrinkage": 0.18298785245889854, "covariance": [ [ 0.00042268464205499846, 0.0004078252303142664, "…" ], [ 0.0004078252303142664, 0.0005235118842352271, "…" ], "…" ] } } ``` ### POST /api/v1/portfolio-analytics/stress-test $0.03 USDC. Apply caller-defined asset-class, factor and rate shocks to holdings and report P/L by holding and in total. Inputs: holdings, scenarios Docs: https://www.brainiac.software/api/portfolio-analytics/docs#portfolio-analytics-stress-test Example request: ```json { "holdings": [ { "id": "VTI", "value": 50000, "mapping": { "assetClass": "us_equity" }, "betas": { "equity": 1 } }, { "id": "BND", "value": 21600, "mapping": { "assetClass": "bonds" }, "duration": 6.2 } ], "scenarios": [ { "name": "equity -20%, rates +100bp", "assetClassShocks": { "us_equity": -0.2 }, "factorShocks": {}, "rateShockBp": 100 } ] } ``` Example response: ```json { "scenarios": [ { "name": "equity -20%, rates +100bp", "pnl": -11339.2, "pnlPct": -0.1583687150837989, "byHolding": [ { "id": "VTI", "pnl": -10000 }, { "id": "BND", "pnl": -1339.2 } ], "unmapped": [] } ], "sources": [ { "source": "Caller-supplied holdings, returns, valuations and transactions processed locally", "url": "https://www.brainiac.software/api/v1/portfolio-analytics", "retrievedAt": "2026-11-14", "status": "ok" } ], "limitations": [ "Outputs are calculations on caller-supplied inputs for human review. No market data is fetched, and this is not investm…", "Asset-class shocks take priority over factor betas. Bonds with duration apply ΔP/P = −D·Δy + ½C·Δy². Options are not re…" ] } ``` ### POST /api/v1/portfolio-analytics/monte-carlo-goal $0.05 USDC. Project a contribution/withdrawal plan with mulberry32 Monte Carlo paths and report success probability and terminal wealth percentiles. Inputs: startValue, years, annualContribution?, annualWithdrawal?, timing?, meanReturn, volatility, inflation?, paths?, seed?, percentiles? Docs: https://www.brainiac.software/api/portfolio-analytics/docs#portfolio-analytics-monte-carlo-goal Example request: ```json { "startValue": 500000, "years": 30, "annualContribution": 0, "annualWithdrawal": 30000, "timing": "start", "meanReturn": 0.05, "volatility": 0.12, "inflation": 0, "paths": 2000, "seed": 42, "percentiles": [ 10, 50, 90 ] } ``` Example response: ```json { "successProbability": 0.421, "terminalPercentiles": { "10": 0, "50": 0, "90": 896865.8322841673 }, "medianDepletionYear": 21, "sources": [ { "source": "Caller-supplied holdings, returns, valuations and transactions processed locally", "url": "https://www.brainiac.software/api/v1/portfolio-analytics", "retrievedAt": "2026-11-14", "status": "ok" } ], "limitations": [ "Outputs are calculations on caller-supplied inputs for human review. No market data is fetched, and this is not investm…", "Paths are generated sequentially with one mulberry32/Box-Muller stream in path-major order. Percentiles use linear inte…" ] } ``` ### POST /api/v1/portfolio-analytics/wash-sale-detect $0.04 USDC. Flag IRC §1091 wash sales in caller transactions with FIFO lots, disallowed losses and replacement basis adjustments per IRS Publication 550. Inputs: transactions, identicalGroups?, lotMethod? Docs: https://www.brainiac.software/api/portfolio-analytics/docs#portfolio-analytics-wash-sale-detect Example request: ```json { "transactions": [ { "id": "t1", "date": "2026-01-10", "symbol": "X", "side": "buy", "quantity": 100, "amount": 1000 }, { "id": "t2", "date": "2026-03-01", "symbol": "X", "side": "sell", "quantity": 100, "amount": 750 }, { "id": "t3", "date": "2026-03-20", "symbol": "X", "side": "buy", "quantity": 100, "amount": 800 } ], "identicalGroups": [], "lotMethod": "fifo" } ``` Example response: ```json { "washSales": [ { "saleId": "t2", "replacementId": "t3", "sharesAffected": 100, "disallowedLoss": 250, "replacementAdjustedBasis": 1050, "holdingPeriodStart": "2026-01-10" } ], "allowedLosses": [], "sources": [ { "source": "IRS Publication 550 (2025), Wash Sales", "url": "https://www.irs.gov/publications/p550", "retrievedAt": "2026-11-14", "status": "ok" } ], "limitations": [ "Outputs are calculations on caller-supplied inputs for human review. No market data is fetched, and this is not investm…", "Implements IRS Publication 550 wash-sale matching on caller-declared identical groups with FIFO lots. Options, IRAs and…" ] } ``` ### POST /api/v1/portfolio-analytics/fee-drag-project $0.02 USDC. Compare terminal wealth with and without expense ratios, advisory fees and loads under multiplicative or subtractive fee methods. Inputs: initial, annualContribution?, years, grossReturn, fees?, frontLoad?, feeMethod?, includeByYear? Docs: https://www.brainiac.software/api/portfolio-analytics/docs#portfolio-analytics-fee-drag-project Example request: ```json { "initial": 100000, "annualContribution": 0, "years": 30, "grossReturn": 0.07, "fees": [ { "name": "expense ratio", "rate": 0.005 }, { "name": "advisory", "rate": 0.01 } ], "frontLoad": 0, "feeMethod": "multiplicative" } ``` Example response: ```json { "terminalNoFees": 761225.5042662045, "terminalWithFees": 483726.90707946173, "feeDrag": 277498.5971867428, "feeDragPct": 0.364541907268651, "byYear": [], "sources": [ { "source": "Caller-supplied holdings, returns, valuations and transactions processed locally", "url": "https://www.brainiac.software/api/v1/portfolio-analytics", "retrievedAt": "2026-11-14", "status": "ok" } ], "limitations": [ "Outputs are calculations on caller-supplied inputs for human review. No market data is fetched, and this is not investm…", "Multiplicative fees apply V×(1+g)×(1−Σf); subtractive fees apply V×(1+g−Σf). Front load reduces the initial amount and …" ] } ``` ### POST /api/v1/portfolio-analytics/tracking-error-capture $0.03 USDC. Tracking error, information ratio, up/down capture, batting average and optional active share versus a benchmark. Inputs: portfolio, benchmark, periodsPerYear?, holdings?, captureMethod? Docs: https://www.brainiac.software/api/portfolio-analytics/docs#portfolio-analytics-tracking-error-capture Example request: ```json { "portfolio": [ 0.025, -0.012, 0.035, -0.045, 0.018, 0.012, -0.021, 0.028, 0.007, -0.016, 0.033, 0.013 ], "benchmark": [ 0.02, -0.01, 0.03, -0.04, 0.015, 0.01, -0.02, 0.025, 0.005, -0.015, 0.03, 0.01 ], "periodsPerYear": 12, "holdings": { "portfolio": { "A": 0.4, "B": 0.3, "C": 0.3 }, "benchmark": { "A": 0.3, "B": 0.2, "D": 0.5 } } } ``` Example response: ```json { "trackingError": 0.010492421507493353, "informationRatio": 1.6202170288201965, "upCapture": 1.1793103448275861, "downCapture": 1.1058823529411763, "battingAverage": 0.6666666666666666, "activeShare": 0.5, "sources": [ { "source": "Caller-supplied holdings, returns, valuations and transactions processed locally", "url": "https://www.brainiac.software/api/v1/portfolio-analytics", "retrievedAt": "2026-11-14", "status": "ok" } ], "limitations": [ "Outputs are calculations on caller-supplied inputs for human review. No market data is fetched, and this is not investm…", "Tracking error is the annualised sample standard deviation of active returns. Information ratio uses mean(active)×P / T…" ] } ``` ### POST /api/v1/portfolio-analytics/allocation-xray $0.03 USDC. Aggregate caller-supplied fund look-through holdings by asset class, sector, region and top underlying positions. Inputs: positions, top? Docs: https://www.brainiac.software/api/portfolio-analytics/docs#portfolio-analytics-allocation-xray Example request: ```json { "positions": [ { "id": "FUND1", "value": 60000, "lookThrough": [ { "security": "AAPL", "weight": 0.07, "assetClass": "equity", "sector": "Technology", "region": "US" }, { "security": "UST10", "weight": 0.03, "assetClass": "bond", "sector": "Government", "region": "US" } ], "otherWeight": 0.9, "otherClass": { "assetClass": "equity", "sector": "Unclassified", "region": "Unknown" } }, { "id": "AAPL", "value": 10000, "assetClass": "equity", "sector": "Technology", "region": "US" } ], "top": 10 } ``` Example response: ```json { "total": 70000, "byAssetClass": { "equity": 0.9742857142857143, "bond": 0.025714285714285714 }, "bySector": { "Technology": 0.20285714285714285, "Government": 0.025714285714285714, "Unclassified": 0.7714285714285715 }, "byRegion": { "US": 0.22857142857142856, "Unknown": 0.7714285714285715 }, "topUnderlying": [ { "security": "AAPL", "value": 14200, "weight": 0.20285714285714285, "via": [ "FUND1", "direct" ] }, { "security": "UST10", "value": 1800, "weight": 0.025714285714285714, "via": [ "FUND1" ] } ], "sources": [ { "source": "Caller-supplied holdings, returns, valuations and transactions processed locally", "url": "https://www.brainiac.software/api/v1/portfolio-analytics", "retrievedAt": "2026-11-14", "status": "ok" } ], "limitations": [ "Outputs are calculations on caller-supplied inputs for human review. No market data is fetched, and this is not investm…", "Look-through exposures use caller-supplied fund holdings. Unclassified remainder is reported explicitly and never redis…" ] } ```