{"openapi":"3.1.0","info":{"title":"Portfolio Analytics API","version":"1.0.0","description":"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. Paid with x402 exact USDC on Base. No account is required.","contact":{"email":"support@brainiac.software"},"x-guidance":"BRAINIAC.software is a pay-per-call API for software agents. No account or API key is required.\nPayment uses x402 with exact USDC on Base (8453). Each paid resource accepts POST for the call; unpaid GET/HEAD return the same 402 payment challenge for discovery.\nHow to call an operation:\n1. POST JSON matching the requestBody. An unpaid POST (including empty body) returns 402 payment terms before body validation.\n2. Compare 402 payTo, asset, and network with /api/v1/catalog and /.well-known/x402 — not only with the 402 itself.\n3. Pay and retry with payment-signature. Invalid JSON/schema after payment-signature returns 400 and is not charged. Settlement (a charge) only on 2xx. payment-signature attached ≠ charged.\nIdempotency-Key: 64 hex chars from 32 random bytes. Reuse only for the same operation and body (replays stored response, including status=partial). A new key runs a fresh call.\nIdempotency after errors: unpaid 402 does not store the key. Post-signature 402/503 release it (retry same key). Pre-reserve schema 400 does not store it. Other post-signature responses (2xx/4xx/5xx) are stored: same key+body replays; different body → 409. Stored 4xx/5xx replays are not a second charge. Prefer a new key after fixing a 4xx; after 5xx reuse the same key only for the stored error.\nPost-signature 402/503 include prior-payment-attempt (nonce, settled false|unknown). A facilitator 502 is SETTLEMENT_UNKNOWN (stored under the Idempotency-Key; cross-instance replay needs the shared store; may already be charged) — check USDC authorizationState(payer, nonce) on Base before re-signing.\nSettlement signal: settled 2xx include payment-response. 4xx/5xx do not. Do not book a cost from payment-signature alone.\nCoverage billing: HTTP 200 with status complete, partial, or failed is charged at the full listed price. Retrying missing checks needs a new settled call. 4xx/5xx are not charged.\nmissing_items.reason: timeout/rate_limited → one delayed retry (new key); upstream_down → after recovery; not_supported → never.\nInvariants: any missing_items ⇒ not status complete; sources[] is provenance only (source, url, retrievedAt), never success/error keyed by check.\nFree lookup: GET /api/v1/results/{result_id} returns stored coverage JSON (404 RESULT_NOT_FOUND if unknown/expired; not a 402). Prior-Result-Id sets replaces_result_id.\nOutputs are prechecks/drafts for human review — not official determinations, legal advice, or certified filings."},"servers":[{"url":"https://www.brainiac.software"}],"paths":{"/api/v1/portfolio-analytics/performance-twr-mwr":{"post":{"operationId":"time_weighted_and_money_weighted_returns","summary":"Time-weighted and money-weighted returns","description":"Compute linked TWR, Modified Dietz and XIRR from valuations and external cash flows, with optional annualisation.","tags":["portfolio-analytics"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"valuations":{"minItems":2,"maxItems":100000,"type":"array","items":{"type":"object","properties":{"date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"value":{"type":"number"},"beforeFlow":{"type":"boolean"}},"required":["date","value"],"additionalProperties":false}},"flows":{"default":[],"maxItems":100000,"type":"array","items":{"type":"object","properties":{"date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"amount":{"type":"number"}},"required":["date","amount"],"additionalProperties":false}},"annualize":{"default":false,"type":"boolean"}},"required":["valuations"],"additionalProperties":false},"example":{"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}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"description":"Fresh random 32-byte value encoded as 64 hexadecimal characters. Reuse unchanged only for retries of the same operation and request.","schema":{"type":"string","pattern":"^[0-9a-fA-F]{64}$"}}],"responses":{"200":{"description":"Illustrative endpoint-specific JSON response shape. For coverage operations, HTTP 200 is used for status complete, partial, and failed; all three settle and are charged at the full listed price. A settled 2xx includes a payment-response response header (facilitator settlement receipt; may include a transaction reference). Conditional fields depend on the result and data-source availability.","headers":{"payment-response":{"description":"Present on settled 2xx only. Facilitator settlement receipt for the x402 payment (not present on 4xx/5xx, which are not charged).","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"twr":{"type":"number"},"modifiedDietz":{"type":"number"},"xirr":{"type":"number"},"days":{"type":"number"},"subPeriods":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string"},"to":{"type":"string"},"return":{"type":"number"}},"additionalProperties":true}},"status":{"type":"string"},"sources":{"type":"array","items":{"type":"object","properties":{"source":{"type":"string"},"url":{"type":"string"},"retrievedAt":{"type":"string"},"status":{"type":"string"}},"additionalProperties":true},"description":"Provenance only (source, url, retrievedAt). Not keyed by check id and does not carry success or error. A check in missing_items does not remove its upstream from sources[]; unavailability is only in missing_items (and unavailable findings)."},"limitations":{"type":"array","items":{"type":"string"}}},"additionalProperties":true},"example":{"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.","…"]}}}},"400":{"description":"Invalid JSON or request schema. Not charged (no payment-response). If this 400 is returned before the Idempotency-Key is reserved, the key is not stored — fix the body and you may reuse the key. If an operation-path 400 was stored after a payment-signature was attached, the same key + same body replays it; the same key + a different body returns 409."},"402":{"description":"Payment required. The JSON body is the x402 PaymentRequired object. An unpaid 402 does not store the Idempotency-Key. A 402 after payment-signature releases the key and includes prior-payment-attempt (nonce, settled false|unknown). Not charged; no payment-response. Before re-signing after a post-signature 402, check USDC authorizationState(payer, nonce) on Base."},"409":{"description":"Idempotency conflict, in-progress payment, or expired result cache. Same key with a different body after a stored result returns conflict. Reusing the key cannot trigger a second charge. Not charged when settlement did not occur."},"413":{"description":"Request body exceeds the 24 MB limit. Not charged."},"500":{"description":"Operation failed before settlement, so no payment is taken (no payment-response). The error is stored: reuse the same Idempotency-Key and body to retrieve it without paying again. Use a new key for a fresh attempt with a new payment-signature."},"502":{"description":"Facilitator verify/settle transport failure (often timeout). After payment-signature this is returned as SETTLEMENT_UNKNOWN with prior-payment-attempt; the outcome is stored under the Idempotency-Key. With the shared store configured, other instances replay it instead of settling again; without it, each instance keeps its own memory. The authorization may already be settled on-chain — do not re-sign until USDC authorizationState(payer, nonce) on Base is false."},"503":{"description":"Payment or retry-safe result storage is unavailable; the operation is not run. Not charged; no payment-response. A 503 after payment-signature releases the Idempotency-Key and includes prior-payment-attempt."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.04"},"protocols":[{"x402":{"facilitator":"https://api.cdp.coinbase.com/platform/v2/x402"}}],"facilitator":"https://api.cdp.coinbase.com/platform/v2/x402"}}},"/api/v1/portfolio-analytics/risk-metrics":{"post":{"operationId":"volatility_sharpe_sortino_and_drawdown","summary":"Volatility, Sharpe, Sortino and drawdown","description":"Annualised volatility, Sharpe, Sortino, Calmar, max drawdown with peak/trough/recovery indices, skewness and excess kurtosis from a return series.","tags":["portfolio-analytics"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"returns":{"minItems":3,"maxItems":100000,"type":"array","items":{"anyOf":[{"type":"number","exclusiveMinimum":-1},{"type":"object","properties":{"date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"r":{"type":"number","exclusiveMinimum":-1}},"required":["date","r"],"additionalProperties":false}]}},"periodsPerYear":{"default":12,"type":"number","exclusiveMinimum":0},"riskFreePerPeriod":{"default":0,"anyOf":[{"type":"number"},{"type":"array","items":{"type":"number"}}]},"mar":{"type":["number","null"]}},"required":["returns"],"additionalProperties":false},"example":{"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}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"description":"Fresh random 32-byte value encoded as 64 hexadecimal characters. Reuse unchanged only for retries of the same operation and request.","schema":{"type":"string","pattern":"^[0-9a-fA-F]{64}$"}}],"responses":{"200":{"description":"Illustrative endpoint-specific JSON response shape. For coverage operations, HTTP 200 is used for status complete, partial, and failed; all three settle and are charged at the full listed price. A settled 2xx includes a payment-response response header (facilitator settlement receipt; may include a transaction reference). Conditional fields depend on the result and data-source availability.","headers":{"payment-response":{"description":"Present on settled 2xx only. Facilitator settlement receipt for the x402 payment (not present on 4xx/5xx, which are not charged).","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"volatility":{"type":"number"},"annualReturn":{"type":"number"},"sharpe":{"type":"number"},"sortino":{"type":"number"},"maxDrawdown":{"type":"number"},"drawdownPeakIndex":{"type":"number"},"drawdownTroughIndex":{"type":"number"},"recoveryIndex":{"type":"number"},"calmar":{"type":"number"},"skewness":{"type":"number"},"excessKurtosis":{"type":"number"},"sources":{"type":"array","items":{"type":"object","properties":{"source":{"type":"string"},"url":{"type":"string"},"retrievedAt":{"type":"string"},"status":{"type":"string"}},"additionalProperties":true},"description":"Provenance only (source, url, retrievedAt). Not keyed by check id and does not carry success or error. A check in missing_items does not remove its upstream from sources[]; unavailability is only in missing_items (and unavailable findings)."},"limitations":{"type":"array","items":{"type":"string"}}},"additionalProperties":true},"example":{"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…","…"]}}}},"400":{"description":"Invalid JSON or request schema. Not charged (no payment-response). If this 400 is returned before the Idempotency-Key is reserved, the key is not stored — fix the body and you may reuse the key. If an operation-path 400 was stored after a payment-signature was attached, the same key + same body replays it; the same key + a different body returns 409."},"402":{"description":"Payment required. The JSON body is the x402 PaymentRequired object. An unpaid 402 does not store the Idempotency-Key. A 402 after payment-signature releases the key and includes prior-payment-attempt (nonce, settled false|unknown). Not charged; no payment-response. Before re-signing after a post-signature 402, check USDC authorizationState(payer, nonce) on Base."},"409":{"description":"Idempotency conflict, in-progress payment, or expired result cache. Same key with a different body after a stored result returns conflict. Reusing the key cannot trigger a second charge. Not charged when settlement did not occur."},"413":{"description":"Request body exceeds the 24 MB limit. Not charged."},"500":{"description":"Operation failed before settlement, so no payment is taken (no payment-response). The error is stored: reuse the same Idempotency-Key and body to retrieve it without paying again. Use a new key for a fresh attempt with a new payment-signature."},"502":{"description":"Facilitator verify/settle transport failure (often timeout). After payment-signature this is returned as SETTLEMENT_UNKNOWN with prior-payment-attempt; the outcome is stored under the Idempotency-Key. With the shared store configured, other instances replay it instead of settling again; without it, each instance keeps its own memory. The authorization may already be settled on-chain — do not re-sign until USDC authorizationState(payer, nonce) on Base is false."},"503":{"description":"Payment or retry-safe result storage is unavailable; the operation is not run. Not charged; no payment-response. A 503 after payment-signature releases the Idempotency-Key and includes prior-payment-attempt."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.03"},"protocols":[{"x402":{"facilitator":"https://api.cdp.coinbase.com/platform/v2/x402"}}],"facilitator":"https://api.cdp.coinbase.com/platform/v2/x402"}}},"/api/v1/portfolio-analytics/var-cvar":{"post":{"operationId":"value_at_risk_and_expected_shortfall","summary":"Value-at-Risk and Expected Shortfall","description":"Historical, parametric normal and Monte Carlo VaR/ES at caller confidence levels from a return series.","tags":["portfolio-analytics"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"returns":{"minItems":10,"maxItems":100000,"type":"array","items":{"type":"number","exclusiveMinimum":-1}},"confidence":{"minItems":1,"maxItems":20,"type":"array","items":{"type":"number","exclusiveMinimum":0.5,"exclusiveMaximum":0.9999}},"methods":{"default":["historical","parametric","monte_carlo"],"minItems":1,"type":"array","items":{"type":"string","enum":["historical","parametric","monte_carlo"]}},"portfolioValue":{"type":"number","exclusiveMinimum":0},"horizonPeriods":{"default":1,"type":"integer","minimum":1,"maximum":9007199254740991},"simulations":{"default":10000,"type":"integer","minimum":1000,"maximum":200000},"seed":{"default":42,"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["returns","confidence"],"additionalProperties":false},"example":{"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}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"description":"Fresh random 32-byte value encoded as 64 hexadecimal characters. Reuse unchanged only for retries of the same operation and request.","schema":{"type":"string","pattern":"^[0-9a-fA-F]{64}$"}}],"responses":{"200":{"description":"Illustrative endpoint-specific JSON response shape. For coverage operations, HTTP 200 is used for status complete, partial, and failed; all three settle and are charged at the full listed price. A settled 2xx includes a payment-response response header (facilitator settlement receipt; may include a transaction reference). Conditional fields depend on the result and data-source availability.","headers":{"payment-response":{"description":"Present on settled 2xx only. Facilitator settlement receipt for the x402 payment (not present on 4xx/5xx, which are not charged).","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"results":{"type":"array","items":{"type":"object","properties":{"method":{"type":"string"},"confidence":{"type":"number"},"var":{"type":"number"},"es":{"type":"number"},"varAmount":{"type":"number"}},"additionalProperties":true}},"sources":{"type":"array","items":{"type":"object","properties":{"source":{"type":"string"},"url":{"type":"string"},"retrievedAt":{"type":"string"},"status":{"type":"string"}},"additionalProperties":true},"description":"Provenance only (source, url, retrievedAt). Not keyed by check id and does not carry success or error. A check in missing_items does not remove its upstream from sources[]; unavailability is only in missing_items (and unavailable findings)."},"limitations":{"type":"array","items":{"type":"string"}}},"additionalProperties":true},"example":{"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…","…"]}}}},"400":{"description":"Invalid JSON or request schema. Not charged (no payment-response). If this 400 is returned before the Idempotency-Key is reserved, the key is not stored — fix the body and you may reuse the key. If an operation-path 400 was stored after a payment-signature was attached, the same key + same body replays it; the same key + a different body returns 409."},"402":{"description":"Payment required. The JSON body is the x402 PaymentRequired object. An unpaid 402 does not store the Idempotency-Key. A 402 after payment-signature releases the key and includes prior-payment-attempt (nonce, settled false|unknown). Not charged; no payment-response. Before re-signing after a post-signature 402, check USDC authorizationState(payer, nonce) on Base."},"409":{"description":"Idempotency conflict, in-progress payment, or expired result cache. Same key with a different body after a stored result returns conflict. Reusing the key cannot trigger a second charge. Not charged when settlement did not occur."},"413":{"description":"Request body exceeds the 24 MB limit. Not charged."},"500":{"description":"Operation failed before settlement, so no payment is taken (no payment-response). The error is stored: reuse the same Idempotency-Key and body to retrieve it without paying again. Use a new key for a fresh attempt with a new payment-signature."},"502":{"description":"Facilitator verify/settle transport failure (often timeout). After payment-signature this is returned as SETTLEMENT_UNKNOWN with prior-payment-attempt; the outcome is stored under the Idempotency-Key. With the shared store configured, other instances replay it instead of settling again; without it, each instance keeps its own memory. The authorization may already be settled on-chain — do not re-sign until USDC authorizationState(payer, nonce) on Base is false."},"503":{"description":"Payment or retry-safe result storage is unavailable; the operation is not run. Not charged; no payment-response. A 503 after payment-signature releases the Idempotency-Key and includes prior-payment-attempt."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.04"},"protocols":[{"x402":{"facilitator":"https://api.cdp.coinbase.com/platform/v2/x402"}}],"facilitator":"https://api.cdp.coinbase.com/platform/v2/x402"}}},"/api/v1/portfolio-analytics/brinson-attribution":{"post":{"operationId":"brinson_fachler_attribution","summary":"Brinson-Fachler attribution","description":"Allocation, selection and interaction effects by segment for one or more periods, with optional Carino linking.","tags":["portfolio-analytics"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"periods":{"minItems":1,"maxItems":600,"type":"array","items":{"type":"object","properties":{"segments":{"minItems":1,"maxItems":200,"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":64},"wp":{"type":"number"},"wb":{"type":"number"},"rp":{"type":"number"},"rb":{"type":"number"}},"required":["name","wp","wb","rp","rb"],"additionalProperties":false}}},"required":["segments"],"additionalProperties":false}},"linking":{"default":"carino","type":"string","enum":["carino","none"]},"normalizeWeights":{"default":true,"type":"boolean"},"allowNegativeWeights":{"default":false,"type":"boolean"}},"required":["periods"],"additionalProperties":false},"example":{"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}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"description":"Fresh random 32-byte value encoded as 64 hexadecimal characters. Reuse unchanged only for retries of the same operation and request.","schema":{"type":"string","pattern":"^[0-9a-fA-F]{64}$"}}],"responses":{"200":{"description":"Illustrative endpoint-specific JSON response shape. For coverage operations, HTTP 200 is used for status complete, partial, and failed; all three settle and are charged at the full listed price. A settled 2xx includes a payment-response response header (facilitator settlement receipt; may include a transaction reference). Conditional fields depend on the result and data-source availability.","headers":{"payment-response":{"description":"Present on settled 2xx only. Facilitator settlement receipt for the x402 payment (not present on 4xx/5xx, which are not charged).","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"portfolioReturn":{"type":"number"},"benchmarkReturn":{"type":"number"},"activeReturn":{"type":"number"},"segments":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"allocation":{"type":"number"},"selection":{"type":"number"},"interaction":{"type":"number"}},"additionalProperties":true}},"totals":{"type":"object","properties":{"allocation":{"type":"number"},"selection":{"type":"number"},"interaction":{"type":"number"}},"additionalProperties":true},"sources":{"type":"array","items":{"type":"object","properties":{"source":{"type":"string"},"url":{"type":"string"},"retrievedAt":{"type":"string"},"status":{"type":"string"}},"additionalProperties":true},"description":"Provenance only (source, url, retrievedAt). Not keyed by check id and does not carry success or error. A check in missing_items does not remove its upstream from sources[]; unavailability is only in missing_items (and unavailable findings)."},"limitations":{"type":"array","items":{"type":"string"}}},"additionalProperties":true},"example":{"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)."]}}}},"400":{"description":"Invalid JSON or request schema. Not charged (no payment-response). If this 400 is returned before the Idempotency-Key is reserved, the key is not stored — fix the body and you may reuse the key. If an operation-path 400 was stored after a payment-signature was attached, the same key + same body replays it; the same key + a different body returns 409."},"402":{"description":"Payment required. The JSON body is the x402 PaymentRequired object. An unpaid 402 does not store the Idempotency-Key. A 402 after payment-signature releases the key and includes prior-payment-attempt (nonce, settled false|unknown). Not charged; no payment-response. Before re-signing after a post-signature 402, check USDC authorizationState(payer, nonce) on Base."},"409":{"description":"Idempotency conflict, in-progress payment, or expired result cache. Same key with a different body after a stored result returns conflict. Reusing the key cannot trigger a second charge. Not charged when settlement did not occur."},"413":{"description":"Request body exceeds the 24 MB limit. Not charged."},"500":{"description":"Operation failed before settlement, so no payment is taken (no payment-response). The error is stored: reuse the same Idempotency-Key and body to retrieve it without paying again. Use a new key for a fresh attempt with a new payment-signature."},"502":{"description":"Facilitator verify/settle transport failure (often timeout). After payment-signature this is returned as SETTLEMENT_UNKNOWN with prior-payment-attempt; the outcome is stored under the Idempotency-Key. With the shared store configured, other instances replay it instead of settling again; without it, each instance keeps its own memory. The authorization may already be settled on-chain — do not re-sign until USDC authorizationState(payer, nonce) on Base is false."},"503":{"description":"Payment or retry-safe result storage is unavailable; the operation is not run. Not charged; no payment-response. A 503 after payment-signature releases the Idempotency-Key and includes prior-payment-attempt."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.04"},"protocols":[{"x402":{"facilitator":"https://api.cdp.coinbase.com/platform/v2/x402"}}],"facilitator":"https://api.cdp.coinbase.com/platform/v2/x402"}}},"/api/v1/portfolio-analytics/factor-regression":{"post":{"operationId":"factor_regression_of_excess_returns","summary":"Factor regression of excess returns","description":"OLS of portfolio excess returns on caller-supplied factors with intercept, betas, alpha and optional Newey-West standard errors.","tags":["portfolio-analytics"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"returns":{"minItems":4,"maxItems":100000,"type":"array","items":{"type":"number","exclusiveMinimum":-1}},"riskFree":{"default":0,"anyOf":[{"type":"number"},{"type":"array","items":{"type":"number"}}]},"factors":{"type":"object","propertyNames":{"type":"string","minLength":1,"maxLength":32},"additionalProperties":{"type":"array","items":{"type":"number"}}},"periodsPerYear":{"default":12,"type":"number","exclusiveMinimum":0},"neweyWestLags":{"default":0,"type":"integer","minimum":0,"maximum":100}},"required":["returns","factors"],"additionalProperties":false},"example":{"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}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"description":"Fresh random 32-byte value encoded as 64 hexadecimal characters. Reuse unchanged only for retries of the same operation and request.","schema":{"type":"string","pattern":"^[0-9a-fA-F]{64}$"}}],"responses":{"200":{"description":"Illustrative endpoint-specific JSON response shape. For coverage operations, HTTP 200 is used for status complete, partial, and failed; all three settle and are charged at the full listed price. A settled 2xx includes a payment-response response header (facilitator settlement receipt; may include a transaction reference). Conditional fields depend on the result and data-source availability.","headers":{"payment-response":{"description":"Present on settled 2xx only. Facilitator settlement receipt for the x402 payment (not present on 4xx/5xx, which are not charged).","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"alphaPerPeriod":{"type":"number"},"alphaAnnualized":{"type":"number"},"betas":{"type":"array","items":{"type":"object","properties":{"factor":{"type":"string"},"beta":{"type":"number"},"se":{"type":"number"}},"additionalProperties":true}},"alphaSe":{"type":"number"},"rSquared":{"type":"number"},"n":{"type":"number"},"sources":{"type":"array","items":{"type":"object","properties":{"source":{"type":"string"},"url":{"type":"string"},"retrievedAt":{"type":"string"},"status":{"type":"string"}},"additionalProperties":true},"description":"Provenance only (source, url, retrievedAt). Not keyed by check id and does not carry success or error. A check in missing_items does not remove its upstream from sources[]; unavailability is only in missing_items (and unavailable findings)."},"limitations":{"type":"array","items":{"type":"string"}}},"additionalProperties":true},"example":{"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.","…"]}}}},"400":{"description":"Invalid JSON or request schema. Not charged (no payment-response). If this 400 is returned before the Idempotency-Key is reserved, the key is not stored — fix the body and you may reuse the key. If an operation-path 400 was stored after a payment-signature was attached, the same key + same body replays it; the same key + a different body returns 409."},"402":{"description":"Payment required. The JSON body is the x402 PaymentRequired object. An unpaid 402 does not store the Idempotency-Key. A 402 after payment-signature releases the key and includes prior-payment-attempt (nonce, settled false|unknown). Not charged; no payment-response. Before re-signing after a post-signature 402, check USDC authorizationState(payer, nonce) on Base."},"409":{"description":"Idempotency conflict, in-progress payment, or expired result cache. Same key with a different body after a stored result returns conflict. Reusing the key cannot trigger a second charge. Not charged when settlement did not occur."},"413":{"description":"Request body exceeds the 24 MB limit. Not charged."},"500":{"description":"Operation failed before settlement, so no payment is taken (no payment-response). The error is stored: reuse the same Idempotency-Key and body to retrieve it without paying again. Use a new key for a fresh attempt with a new payment-signature."},"502":{"description":"Facilitator verify/settle transport failure (often timeout). After payment-signature this is returned as SETTLEMENT_UNKNOWN with prior-payment-attempt; the outcome is stored under the Idempotency-Key. With the shared store configured, other instances replay it instead of settling again; without it, each instance keeps its own memory. The authorization may already be settled on-chain — do not re-sign until USDC authorizationState(payer, nonce) on Base is false."},"503":{"description":"Payment or retry-safe result storage is unavailable; the operation is not run. Not charged; no payment-response. A 503 after payment-signature releases the Idempotency-Key and includes prior-payment-attempt."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.04"},"protocols":[{"x402":{"facilitator":"https://api.cdp.coinbase.com/platform/v2/x402"}}],"facilitator":"https://api.cdp.coinbase.com/platform/v2/x402"}}},"/api/v1/portfolio-analytics/mean-variance-optimize":{"post":{"operationId":"markowitz_mean_variance_optimisation","summary":"Markowitz mean-variance optimisation","description":"Minimum variance, target return, max Sharpe or target volatility portfolios from expected returns and a covariance matrix, with bounds.","tags":["portfolio-analytics"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"assets":{"minItems":2,"maxItems":500,"type":"array","items":{"type":"string","minLength":1,"maxLength":64}},"expectedReturns":{"minItems":2,"maxItems":500,"type":"array","items":{"type":"number"}},"covariance":{"type":"array","items":{"type":"array","items":{"type":"number"}}},"returns":{"type":"array","items":{"type":"array","items":{"type":"number"}}},"objective":{"type":"string","enum":["min_variance","target_return","max_sharpe","target_volatility"]},"targetReturn":{"type":"number"},"targetVolatility":{"type":"number","exclusiveMinimum":0},"riskFree":{"default":0,"type":"number"},"bounds":{"default":{"min":0,"max":1},"type":"object","properties":{"min":{"default":0,"type":"number"},"max":{"default":1,"type":"number"}},"additionalProperties":false},"groups":{"default":[],"maxItems":100,"type":"array","items":{"type":"object","properties":{"assets":{"minItems":1,"type":"array","items":{"type":"string"}},"min":{"type":"number"},"max":{"type":"number"}},"required":["assets","min","max"],"additionalProperties":false}},"frontierPoints":{"default":0,"type":"integer","minimum":0,"maximum":100},"shrinkage":{"default":"none","type":"string","enum":["none","ledoit_wolf"]}},"required":["assets","expectedReturns","objective"],"additionalProperties":false},"example":{"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"}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"description":"Fresh random 32-byte value encoded as 64 hexadecimal characters. Reuse unchanged only for retries of the same operation and request.","schema":{"type":"string","pattern":"^[0-9a-fA-F]{64}$"}}],"responses":{"200":{"description":"Illustrative endpoint-specific JSON response shape. For coverage operations, HTTP 200 is used for status complete, partial, and failed; all three settle and are charged at the full listed price. A settled 2xx includes a payment-response response header (facilitator settlement receipt; may include a transaction reference). Conditional fields depend on the result and data-source availability.","headers":{"payment-response":{"description":"Present on settled 2xx only. Facilitator settlement receipt for the x402 payment (not present on 4xx/5xx, which are not charged).","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"weights":{"type":"array","items":{"type":"object","properties":{"asset":{"type":"string"},"weight":{"type":"number"}},"additionalProperties":true}},"expectedReturn":{"type":"number"},"volatility":{"type":"number"},"sharpe":{"type":"number"},"activeConstraints":{"type":"array","items":{}},"status":{"type":"string"},"sources":{"type":"array","items":{"type":"object","properties":{"source":{"type":"string"},"url":{"type":"string"},"retrievedAt":{"type":"string"},"status":{"type":"string"}},"additionalProperties":true},"description":"Provenance only (source, url, retrievedAt). Not keyed by check id and does not carry success or error. A check in missing_items does not remove its upstream from sources[]; unavailability is only in missing_items (and unavailable findings)."},"limitations":{"type":"array","items":{"type":"string"}}},"additionalProperties":true},"example":{"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 Σ⁻¹ …"]}}}},"400":{"description":"Invalid JSON or request schema. Not charged (no payment-response). If this 400 is returned before the Idempotency-Key is reserved, the key is not stored — fix the body and you may reuse the key. If an operation-path 400 was stored after a payment-signature was attached, the same key + same body replays it; the same key + a different body returns 409."},"402":{"description":"Payment required. The JSON body is the x402 PaymentRequired object. An unpaid 402 does not store the Idempotency-Key. A 402 after payment-signature releases the key and includes prior-payment-attempt (nonce, settled false|unknown). Not charged; no payment-response. Before re-signing after a post-signature 402, check USDC authorizationState(payer, nonce) on Base."},"409":{"description":"Idempotency conflict, in-progress payment, or expired result cache. Same key with a different body after a stored result returns conflict. Reusing the key cannot trigger a second charge. Not charged when settlement did not occur."},"413":{"description":"Request body exceeds the 24 MB limit. Not charged."},"500":{"description":"Operation failed before settlement, so no payment is taken (no payment-response). The error is stored: reuse the same Idempotency-Key and body to retrieve it without paying again. Use a new key for a fresh attempt with a new payment-signature."},"502":{"description":"Facilitator verify/settle transport failure (often timeout). After payment-signature this is returned as SETTLEMENT_UNKNOWN with prior-payment-attempt; the outcome is stored under the Idempotency-Key. With the shared store configured, other instances replay it instead of settling again; without it, each instance keeps its own memory. The authorization may already be settled on-chain — do not re-sign until USDC authorizationState(payer, nonce) on Base is false."},"503":{"description":"Payment or retry-safe result storage is unavailable; the operation is not run. Not charged; no payment-response. A 503 after payment-signature releases the Idempotency-Key and includes prior-payment-attempt."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.05"},"protocols":[{"x402":{"facilitator":"https://api.cdp.coinbase.com/platform/v2/x402"}}],"facilitator":"https://api.cdp.coinbase.com/platform/v2/x402"}}},"/api/v1/portfolio-analytics/risk-parity-weights":{"post":{"operationId":"equal_risk_contribution_and_inverse_volatility_weights","summary":"Equal-risk-contribution and inverse-volatility weights","description":"Spinu ERC (or caller risk-budget) weights and inverse-volatility weights with risk-contribution breakdown.","tags":["portfolio-analytics"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"assets":{"minItems":2,"maxItems":500,"type":"array","items":{"type":"string","minLength":1,"maxLength":64}},"covariance":{"minItems":2,"maxItems":500,"type":"array","items":{"type":"array","items":{"type":"number"}}},"riskBudget":{"anyOf":[{"type":"array","items":{"type":"number","exclusiveMinimum":0}},{"type":"null"}]},"method":{"default":"erc","type":"string","enum":["erc","inverse_volatility"]}},"required":["assets","covariance"],"additionalProperties":false},"example":{"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"}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"description":"Fresh random 32-byte value encoded as 64 hexadecimal characters. Reuse unchanged only for retries of the same operation and request.","schema":{"type":"string","pattern":"^[0-9a-fA-F]{64}$"}}],"responses":{"200":{"description":"Illustrative endpoint-specific JSON response shape. For coverage operations, HTTP 200 is used for status complete, partial, and failed; all three settle and are charged at the full listed price. A settled 2xx includes a payment-response response header (facilitator settlement receipt; may include a transaction reference). Conditional fields depend on the result and data-source availability.","headers":{"payment-response":{"description":"Present on settled 2xx only. Facilitator settlement receipt for the x402 payment (not present on 4xx/5xx, which are not charged).","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"weights":{"type":"array","items":{"type":"number"}},"riskContributions":{"type":"array","items":{"type":"number"}},"portfolioVolatility":{"type":"number"},"inverseVolatility":{"type":"array","items":{"type":"number"}},"iterations":{"type":"number"},"converged":{"type":"boolean"},"sources":{"type":"array","items":{"type":"object","properties":{"source":{"type":"string"},"url":{"type":"string"},"retrievedAt":{"type":"string"},"status":{"type":"string"}},"additionalProperties":true},"description":"Provenance only (source, url, retrievedAt). Not keyed by check id and does not carry success or error. A check in missing_items does not remove its upstream from sources[]; unavailability is only in missing_items (and unavailable findings)."},"limitations":{"type":"array","items":{"type":"string"}}},"additionalProperties":true},"example":{"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."]}}}},"400":{"description":"Invalid JSON or request schema. Not charged (no payment-response). If this 400 is returned before the Idempotency-Key is reserved, the key is not stored — fix the body and you may reuse the key. If an operation-path 400 was stored after a payment-signature was attached, the same key + same body replays it; the same key + a different body returns 409."},"402":{"description":"Payment required. The JSON body is the x402 PaymentRequired object. An unpaid 402 does not store the Idempotency-Key. A 402 after payment-signature releases the key and includes prior-payment-attempt (nonce, settled false|unknown). Not charged; no payment-response. Before re-signing after a post-signature 402, check USDC authorizationState(payer, nonce) on Base."},"409":{"description":"Idempotency conflict, in-progress payment, or expired result cache. Same key with a different body after a stored result returns conflict. Reusing the key cannot trigger a second charge. Not charged when settlement did not occur."},"413":{"description":"Request body exceeds the 24 MB limit. Not charged."},"500":{"description":"Operation failed before settlement, so no payment is taken (no payment-response). The error is stored: reuse the same Idempotency-Key and body to retrieve it without paying again. Use a new key for a fresh attempt with a new payment-signature."},"502":{"description":"Facilitator verify/settle transport failure (often timeout). After payment-signature this is returned as SETTLEMENT_UNKNOWN with prior-payment-attempt; the outcome is stored under the Idempotency-Key. With the shared store configured, other instances replay it instead of settling again; without it, each instance keeps its own memory. The authorization may already be settled on-chain — do not re-sign until USDC authorizationState(payer, nonce) on Base is false."},"503":{"description":"Payment or retry-safe result storage is unavailable; the operation is not run. Not charged; no payment-response. A 503 after payment-signature releases the Idempotency-Key and includes prior-payment-attempt."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.04"},"protocols":[{"x402":{"facilitator":"https://api.cdp.coinbase.com/platform/v2/x402"}}],"facilitator":"https://api.cdp.coinbase.com/platform/v2/x402"}}},"/api/v1/portfolio-analytics/rebalance-trades":{"post":{"operationId":"rebalance_trades_to_target_weights","summary":"Rebalance trades to target weights","description":"Compute buys and sells that restore target weights with tolerance bands, a cash buffer, minimum trade size and whole-share rounding.","tags":["portfolio-analytics"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"holdings":{"minItems":1,"maxItems":10000,"type":"array","items":{"type":"object","properties":{"symbol":{"type":"string","minLength":1,"maxLength":64},"quantity":{"type":"number"},"price":{"type":"number","exclusiveMinimum":0}},"required":["symbol","quantity","price"],"additionalProperties":false}},"cash":{"default":0,"type":"number","minimum":0},"targets":{"type":"object","propertyNames":{"type":"string","minLength":1,"maxLength":64},"additionalProperties":{"type":"number","minimum":0,"maximum":1}},"band":{"default":{"type":"absolute","value":0},"type":"object","properties":{"type":{"type":"string","enum":["absolute","relative"]},"value":{"type":"number","minimum":0,"maximum":1}},"required":["type","value"],"additionalProperties":false},"cashBuffer":{"default":0,"type":"number","minimum":0,"maximum":0.5},"minTradeValue":{"default":0,"type":"number","minimum":0},"fractional":{"default":false,"type":"boolean"},"restricted":{"default":[],"type":"array","items":{"type":"string","minLength":1,"maxLength":64}}},"required":["holdings","targets"],"additionalProperties":false},"example":{"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":[]}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"description":"Fresh random 32-byte value encoded as 64 hexadecimal characters. Reuse unchanged only for retries of the same operation and request.","schema":{"type":"string","pattern":"^[0-9a-fA-F]{64}$"}}],"responses":{"200":{"description":"Illustrative endpoint-specific JSON response shape. For coverage operations, HTTP 200 is used for status complete, partial, and failed; all three settle and are charged at the full listed price. A settled 2xx includes a payment-response response header (facilitator settlement receipt; may include a transaction reference). Conditional fields depend on the result and data-source availability.","headers":{"payment-response":{"description":"Present on settled 2xx only. Facilitator settlement receipt for the x402 payment (not present on 4xx/5xx, which are not charged).","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"totalValue":{"type":"number"},"investable":{"type":"number"},"trades":{"type":"array","items":{"type":"object","properties":{"symbol":{"type":"string"},"side":{"type":"string"},"quantity":{"type":"number"},"value":{"type":"number"}},"additionalProperties":true}},"untouched":{"type":"array","items":{"type":"object","properties":{"symbol":{"type":"string"},"reason":{"type":"string"},"drift":{"type":"number"}},"additionalProperties":true}},"cashAfter":{"type":"number"},"weightsAfter":{"type":"object","properties":{"VTI":{"type":"number"},"BND":{"type":"number"},"VXUS":{"type":"number"}},"additionalProperties":true},"sources":{"type":"array","items":{"type":"object","properties":{"source":{"type":"string"},"url":{"type":"string"},"retrievedAt":{"type":"string"},"status":{"type":"string"}},"additionalProperties":true},"description":"Provenance only (source, url, retrievedAt). Not keyed by check id and does not carry success or error. A check in missing_items does not remove its upstream from sources[]; unavailability is only in missing_items (and unavailable findings)."},"limitations":{"type":"array","items":{"type":"string"}}},"additionalProperties":true},"example":{"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…"]}}}},"400":{"description":"Invalid JSON or request schema. Not charged (no payment-response). If this 400 is returned before the Idempotency-Key is reserved, the key is not stored — fix the body and you may reuse the key. If an operation-path 400 was stored after a payment-signature was attached, the same key + same body replays it; the same key + a different body returns 409."},"402":{"description":"Payment required. The JSON body is the x402 PaymentRequired object. An unpaid 402 does not store the Idempotency-Key. A 402 after payment-signature releases the key and includes prior-payment-attempt (nonce, settled false|unknown). Not charged; no payment-response. Before re-signing after a post-signature 402, check USDC authorizationState(payer, nonce) on Base."},"409":{"description":"Idempotency conflict, in-progress payment, or expired result cache. Same key with a different body after a stored result returns conflict. Reusing the key cannot trigger a second charge. Not charged when settlement did not occur."},"413":{"description":"Request body exceeds the 24 MB limit. Not charged."},"500":{"description":"Operation failed before settlement, so no payment is taken (no payment-response). The error is stored: reuse the same Idempotency-Key and body to retrieve it without paying again. Use a new key for a fresh attempt with a new payment-signature."},"502":{"description":"Facilitator verify/settle transport failure (often timeout). After payment-signature this is returned as SETTLEMENT_UNKNOWN with prior-payment-attempt; the outcome is stored under the Idempotency-Key. With the shared store configured, other instances replay it instead of settling again; without it, each instance keeps its own memory. The authorization may already be settled on-chain — do not re-sign until USDC authorizationState(payer, nonce) on Base is false."},"503":{"description":"Payment or retry-safe result storage is unavailable; the operation is not run. Not charged; no payment-response. A 503 after payment-signature releases the Idempotency-Key and includes prior-payment-attempt."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.03"},"protocols":[{"x402":{"facilitator":"https://api.cdp.coinbase.com/platform/v2/x402"}}],"facilitator":"https://api.cdp.coinbase.com/platform/v2/x402"}}},"/api/v1/portfolio-analytics/correlation-matrix":{"post":{"operationId":"correlation_and_ledoit_wolf_covariance","summary":"Correlation and Ledoit-Wolf covariance","description":"Pearson and Spearman correlation, optional covariance, rolling windows and Ledoit-Wolf shrinkage covariance from caller series.","tags":["portfolio-analytics"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"series":{"type":"object","propertyNames":{"type":"string","minLength":1,"maxLength":64},"additionalProperties":{"type":"array","items":{"type":["number","null"]}}},"methods":{"default":["pearson","spearman","ledoit_wolf"],"minItems":1,"type":"array","items":{"type":"string","enum":["pearson","spearman","ledoit_wolf","covariance"]}},"missing":{"default":"pairwise","type":"string","enum":["pairwise","listwise"]},"rollingWindow":{"anyOf":[{"type":"integer","minimum":3,"maximum":9007199254740991},{"type":"null"}]}},"required":["series"],"additionalProperties":false},"example":{"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}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"description":"Fresh random 32-byte value encoded as 64 hexadecimal characters. Reuse unchanged only for retries of the same operation and request.","schema":{"type":"string","pattern":"^[0-9a-fA-F]{64}$"}}],"responses":{"200":{"description":"Illustrative endpoint-specific JSON response shape. For coverage operations, HTTP 200 is used for status complete, partial, and failed; all three settle and are charged at the full listed price. A settled 2xx includes a payment-response response header (facilitator settlement receipt; may include a transaction reference). Conditional fields depend on the result and data-source availability.","headers":{"payment-response":{"description":"Present on settled 2xx only. Facilitator settlement receipt for the x402 payment (not present on 4xx/5xx, which are not charged).","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"pairCounts":{"type":"array","items":{"type":"array","items":{"type":"number"}}},"sources":{"type":"array","items":{"type":"object","properties":{"source":{"type":"string"},"url":{"type":"string"},"retrievedAt":{"type":"string"},"status":{"type":"string"}},"additionalProperties":true},"description":"Provenance only (source, url, retrievedAt). Not keyed by check id and does not carry success or error. A check in missing_items does not remove its upstream from sources[]; unavailability is only in missing_items (and unavailable findings)."},"limitations":{"type":"array","items":{"type":"string"}},"pearson":{"type":"array","items":{"type":"array","items":{"type":"number"}}},"psd":{"type":"boolean"},"spearman":{"type":"array","items":{"type":"array","items":{"type":"number"}}},"ledoitWolf":{"type":"object","properties":{"shrinkage":{"type":"number"},"covariance":{"type":"array","items":{"type":"array","items":{"type":"number"}}}},"additionalProperties":true}},"additionalProperties":true},"example":{"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,"…"],"…"]}}}}},"400":{"description":"Invalid JSON or request schema. Not charged (no payment-response). If this 400 is returned before the Idempotency-Key is reserved, the key is not stored — fix the body and you may reuse the key. If an operation-path 400 was stored after a payment-signature was attached, the same key + same body replays it; the same key + a different body returns 409."},"402":{"description":"Payment required. The JSON body is the x402 PaymentRequired object. An unpaid 402 does not store the Idempotency-Key. A 402 after payment-signature releases the key and includes prior-payment-attempt (nonce, settled false|unknown). Not charged; no payment-response. Before re-signing after a post-signature 402, check USDC authorizationState(payer, nonce) on Base."},"409":{"description":"Idempotency conflict, in-progress payment, or expired result cache. Same key with a different body after a stored result returns conflict. Reusing the key cannot trigger a second charge. Not charged when settlement did not occur."},"413":{"description":"Request body exceeds the 24 MB limit. Not charged."},"500":{"description":"Operation failed before settlement, so no payment is taken (no payment-response). The error is stored: reuse the same Idempotency-Key and body to retrieve it without paying again. Use a new key for a fresh attempt with a new payment-signature."},"502":{"description":"Facilitator verify/settle transport failure (often timeout). After payment-signature this is returned as SETTLEMENT_UNKNOWN with prior-payment-attempt; the outcome is stored under the Idempotency-Key. With the shared store configured, other instances replay it instead of settling again; without it, each instance keeps its own memory. The authorization may already be settled on-chain — do not re-sign until USDC authorizationState(payer, nonce) on Base is false."},"503":{"description":"Payment or retry-safe result storage is unavailable; the operation is not run. Not charged; no payment-response. A 503 after payment-signature releases the Idempotency-Key and includes prior-payment-attempt."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.03"},"protocols":[{"x402":{"facilitator":"https://api.cdp.coinbase.com/platform/v2/x402"}}],"facilitator":"https://api.cdp.coinbase.com/platform/v2/x402"}}},"/api/v1/portfolio-analytics/stress-test":{"post":{"operationId":"scenario_stress_test_on_holdings","summary":"Scenario stress test on holdings","description":"Apply caller-defined asset-class, factor and rate shocks to holdings and report P/L by holding and in total.","tags":["portfolio-analytics"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"holdings":{"minItems":1,"maxItems":10000,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64},"value":{"type":"number"},"mapping":{"type":"object","properties":{"assetClass":{"type":"string","minLength":1,"maxLength":64}},"additionalProperties":false},"betas":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"number"}},"duration":{"type":"number"},"convexity":{"type":"number"}},"required":["id","value"],"additionalProperties":false}},"scenarios":{"minItems":1,"maxItems":100,"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":128},"assetClassShocks":{"default":{},"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"number"}},"factorShocks":{"default":{},"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"number"}},"rateShockBp":{"type":"number"}},"required":["name"],"additionalProperties":false}}},"required":["holdings","scenarios"],"additionalProperties":false},"example":{"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}]}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"description":"Fresh random 32-byte value encoded as 64 hexadecimal characters. Reuse unchanged only for retries of the same operation and request.","schema":{"type":"string","pattern":"^[0-9a-fA-F]{64}$"}}],"responses":{"200":{"description":"Illustrative endpoint-specific JSON response shape. For coverage operations, HTTP 200 is used for status complete, partial, and failed; all three settle and are charged at the full listed price. A settled 2xx includes a payment-response response header (facilitator settlement receipt; may include a transaction reference). Conditional fields depend on the result and data-source availability.","headers":{"payment-response":{"description":"Present on settled 2xx only. Facilitator settlement receipt for the x402 payment (not present on 4xx/5xx, which are not charged).","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"scenarios":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"pnl":{"type":"number"},"pnlPct":{"type":"number"},"byHolding":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"pnl":{"type":"number"}},"additionalProperties":true}},"unmapped":{"type":"array","items":{}}},"additionalProperties":true}},"sources":{"type":"array","items":{"type":"object","properties":{"source":{"type":"string"},"url":{"type":"string"},"retrievedAt":{"type":"string"},"status":{"type":"string"}},"additionalProperties":true},"description":"Provenance only (source, url, retrievedAt). Not keyed by check id and does not carry success or error. A check in missing_items does not remove its upstream from sources[]; unavailability is only in missing_items (and unavailable findings)."},"limitations":{"type":"array","items":{"type":"string"}}},"additionalProperties":true},"example":{"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…"]}}}},"400":{"description":"Invalid JSON or request schema. Not charged (no payment-response). If this 400 is returned before the Idempotency-Key is reserved, the key is not stored — fix the body and you may reuse the key. If an operation-path 400 was stored after a payment-signature was attached, the same key + same body replays it; the same key + a different body returns 409."},"402":{"description":"Payment required. The JSON body is the x402 PaymentRequired object. An unpaid 402 does not store the Idempotency-Key. A 402 after payment-signature releases the key and includes prior-payment-attempt (nonce, settled false|unknown). Not charged; no payment-response. Before re-signing after a post-signature 402, check USDC authorizationState(payer, nonce) on Base."},"409":{"description":"Idempotency conflict, in-progress payment, or expired result cache. Same key with a different body after a stored result returns conflict. Reusing the key cannot trigger a second charge. Not charged when settlement did not occur."},"413":{"description":"Request body exceeds the 24 MB limit. Not charged."},"500":{"description":"Operation failed before settlement, so no payment is taken (no payment-response). The error is stored: reuse the same Idempotency-Key and body to retrieve it without paying again. Use a new key for a fresh attempt with a new payment-signature."},"502":{"description":"Facilitator verify/settle transport failure (often timeout). After payment-signature this is returned as SETTLEMENT_UNKNOWN with prior-payment-attempt; the outcome is stored under the Idempotency-Key. With the shared store configured, other instances replay it instead of settling again; without it, each instance keeps its own memory. The authorization may already be settled on-chain — do not re-sign until USDC authorizationState(payer, nonce) on Base is false."},"503":{"description":"Payment or retry-safe result storage is unavailable; the operation is not run. Not charged; no payment-response. A 503 after payment-signature releases the Idempotency-Key and includes prior-payment-attempt."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.03"},"protocols":[{"x402":{"facilitator":"https://api.cdp.coinbase.com/platform/v2/x402"}}],"facilitator":"https://api.cdp.coinbase.com/platform/v2/x402"}}},"/api/v1/portfolio-analytics/monte-carlo-goal":{"post":{"operationId":"monte_carlo_retirement_or_savings_goal","summary":"Monte Carlo retirement or savings goal","description":"Project a contribution/withdrawal plan with mulberry32 Monte Carlo paths and report success probability and terminal wealth percentiles.","tags":["portfolio-analytics"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"startValue":{"type":"number","exclusiveMinimum":0},"years":{"type":"integer","minimum":1,"maximum":100},"annualContribution":{"default":0,"type":"number"},"annualWithdrawal":{"default":0,"type":"number","minimum":0},"timing":{"default":"start","type":"string","enum":["start","end"]},"meanReturn":{"type":"number"},"volatility":{"type":"number","minimum":0},"inflation":{"default":0,"type":"number","minimum":0},"paths":{"default":2000,"type":"integer","minimum":100,"maximum":100000},"seed":{"default":42,"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"percentiles":{"default":[10,50,90],"minItems":1,"maxItems":21,"type":"array","items":{"type":"number","minimum":0,"maximum":100}}},"required":["startValue","years","meanReturn","volatility"],"additionalProperties":false},"example":{"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]}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"description":"Fresh random 32-byte value encoded as 64 hexadecimal characters. Reuse unchanged only for retries of the same operation and request.","schema":{"type":"string","pattern":"^[0-9a-fA-F]{64}$"}}],"responses":{"200":{"description":"Illustrative endpoint-specific JSON response shape. For coverage operations, HTTP 200 is used for status complete, partial, and failed; all three settle and are charged at the full listed price. A settled 2xx includes a payment-response response header (facilitator settlement receipt; may include a transaction reference). Conditional fields depend on the result and data-source availability.","headers":{"payment-response":{"description":"Present on settled 2xx only. Facilitator settlement receipt for the x402 payment (not present on 4xx/5xx, which are not charged).","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"successProbability":{"type":"number"},"terminalPercentiles":{"type":"object","properties":{"10":{"type":"number"},"50":{"type":"number"},"90":{"type":"number"}},"additionalProperties":true},"medianDepletionYear":{"type":"number"},"sources":{"type":"array","items":{"type":"object","properties":{"source":{"type":"string"},"url":{"type":"string"},"retrievedAt":{"type":"string"},"status":{"type":"string"}},"additionalProperties":true},"description":"Provenance only (source, url, retrievedAt). Not keyed by check id and does not carry success or error. A check in missing_items does not remove its upstream from sources[]; unavailability is only in missing_items (and unavailable findings)."},"limitations":{"type":"array","items":{"type":"string"}}},"additionalProperties":true},"example":{"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…"]}}}},"400":{"description":"Invalid JSON or request schema. Not charged (no payment-response). If this 400 is returned before the Idempotency-Key is reserved, the key is not stored — fix the body and you may reuse the key. If an operation-path 400 was stored after a payment-signature was attached, the same key + same body replays it; the same key + a different body returns 409."},"402":{"description":"Payment required. The JSON body is the x402 PaymentRequired object. An unpaid 402 does not store the Idempotency-Key. A 402 after payment-signature releases the key and includes prior-payment-attempt (nonce, settled false|unknown). Not charged; no payment-response. Before re-signing after a post-signature 402, check USDC authorizationState(payer, nonce) on Base."},"409":{"description":"Idempotency conflict, in-progress payment, or expired result cache. Same key with a different body after a stored result returns conflict. Reusing the key cannot trigger a second charge. Not charged when settlement did not occur."},"413":{"description":"Request body exceeds the 24 MB limit. Not charged."},"500":{"description":"Operation failed before settlement, so no payment is taken (no payment-response). The error is stored: reuse the same Idempotency-Key and body to retrieve it without paying again. Use a new key for a fresh attempt with a new payment-signature."},"502":{"description":"Facilitator verify/settle transport failure (often timeout). After payment-signature this is returned as SETTLEMENT_UNKNOWN with prior-payment-attempt; the outcome is stored under the Idempotency-Key. With the shared store configured, other instances replay it instead of settling again; without it, each instance keeps its own memory. The authorization may already be settled on-chain — do not re-sign until USDC authorizationState(payer, nonce) on Base is false."},"503":{"description":"Payment or retry-safe result storage is unavailable; the operation is not run. Not charged; no payment-response. A 503 after payment-signature releases the Idempotency-Key and includes prior-payment-attempt."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.05"},"protocols":[{"x402":{"facilitator":"https://api.cdp.coinbase.com/platform/v2/x402"}}],"facilitator":"https://api.cdp.coinbase.com/platform/v2/x402"}}},"/api/v1/portfolio-analytics/wash-sale-detect":{"post":{"operationId":"detect_potential_us_wash_sales","summary":"Detect potential US wash sales","description":"Flag IRC §1091 wash sales in caller transactions with FIFO lots, disallowed losses and replacement basis adjustments per IRS Publication 550.","tags":["portfolio-analytics"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"transactions":{"minItems":1,"maxItems":100000,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64},"date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"symbol":{"type":"string","minLength":1,"maxLength":64},"side":{"type":"string","enum":["buy","sell"]},"quantity":{"type":"number","exclusiveMinimum":0},"amount":{"type":"number","exclusiveMinimum":0}},"required":["id","date","symbol","side","quantity","amount"],"additionalProperties":false}},"identicalGroups":{"default":[],"type":"array","items":{"minItems":2,"type":"array","items":{"type":"string","minLength":1,"maxLength":64}}},"lotMethod":{"default":"fifo","type":"string","enum":["fifo"]}},"required":["transactions"],"additionalProperties":false},"example":{"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"}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"description":"Fresh random 32-byte value encoded as 64 hexadecimal characters. Reuse unchanged only for retries of the same operation and request.","schema":{"type":"string","pattern":"^[0-9a-fA-F]{64}$"}}],"responses":{"200":{"description":"Illustrative endpoint-specific JSON response shape. For coverage operations, HTTP 200 is used for status complete, partial, and failed; all three settle and are charged at the full listed price. A settled 2xx includes a payment-response response header (facilitator settlement receipt; may include a transaction reference). Conditional fields depend on the result and data-source availability.","headers":{"payment-response":{"description":"Present on settled 2xx only. Facilitator settlement receipt for the x402 payment (not present on 4xx/5xx, which are not charged).","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"washSales":{"type":"array","items":{"type":"object","properties":{"saleId":{"type":"string"},"replacementId":{"type":"string"},"sharesAffected":{"type":"number"},"disallowedLoss":{"type":"number"},"replacementAdjustedBasis":{"type":"number"},"holdingPeriodStart":{"type":"string"}},"additionalProperties":true}},"allowedLosses":{"type":"array","items":{}},"sources":{"type":"array","items":{"type":"object","properties":{"source":{"type":"string"},"url":{"type":"string"},"retrievedAt":{"type":"string"},"status":{"type":"string"}},"additionalProperties":true},"description":"Provenance only (source, url, retrievedAt). Not keyed by check id and does not carry success or error. A check in missing_items does not remove its upstream from sources[]; unavailability is only in missing_items (and unavailable findings)."},"limitations":{"type":"array","items":{"type":"string"}}},"additionalProperties":true},"example":{"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…"]}}}},"400":{"description":"Invalid JSON or request schema. Not charged (no payment-response). If this 400 is returned before the Idempotency-Key is reserved, the key is not stored — fix the body and you may reuse the key. If an operation-path 400 was stored after a payment-signature was attached, the same key + same body replays it; the same key + a different body returns 409."},"402":{"description":"Payment required. The JSON body is the x402 PaymentRequired object. An unpaid 402 does not store the Idempotency-Key. A 402 after payment-signature releases the key and includes prior-payment-attempt (nonce, settled false|unknown). Not charged; no payment-response. Before re-signing after a post-signature 402, check USDC authorizationState(payer, nonce) on Base."},"409":{"description":"Idempotency conflict, in-progress payment, or expired result cache. Same key with a different body after a stored result returns conflict. Reusing the key cannot trigger a second charge. Not charged when settlement did not occur."},"413":{"description":"Request body exceeds the 24 MB limit. Not charged."},"500":{"description":"Operation failed before settlement, so no payment is taken (no payment-response). The error is stored: reuse the same Idempotency-Key and body to retrieve it without paying again. Use a new key for a fresh attempt with a new payment-signature."},"502":{"description":"Facilitator verify/settle transport failure (often timeout). After payment-signature this is returned as SETTLEMENT_UNKNOWN with prior-payment-attempt; the outcome is stored under the Idempotency-Key. With the shared store configured, other instances replay it instead of settling again; without it, each instance keeps its own memory. The authorization may already be settled on-chain — do not re-sign until USDC authorizationState(payer, nonce) on Base is false."},"503":{"description":"Payment or retry-safe result storage is unavailable; the operation is not run. Not charged; no payment-response. A 503 after payment-signature releases the Idempotency-Key and includes prior-payment-attempt."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.04"},"protocols":[{"x402":{"facilitator":"https://api.cdp.coinbase.com/platform/v2/x402"}}],"facilitator":"https://api.cdp.coinbase.com/platform/v2/x402"}}},"/api/v1/portfolio-analytics/fee-drag-project":{"post":{"operationId":"project_long_run_fee_drag","summary":"Project long-run fee drag","description":"Compare terminal wealth with and without expense ratios, advisory fees and loads under multiplicative or subtractive fee methods.","tags":["portfolio-analytics"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"initial":{"type":"number","exclusiveMinimum":0},"annualContribution":{"default":0,"type":"number"},"years":{"type":"integer","minimum":1,"maximum":100},"grossReturn":{"type":"number"},"fees":{"default":[],"maxItems":20,"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":64},"rate":{"type":"number","minimum":0,"maximum":0.2}},"required":["name","rate"],"additionalProperties":false}},"frontLoad":{"default":0,"type":"number","minimum":0,"maximum":1},"feeMethod":{"default":"multiplicative","type":"string","enum":["multiplicative","subtractive"]},"includeByYear":{"default":false,"type":"boolean"}},"required":["initial","years","grossReturn"],"additionalProperties":false},"example":{"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"}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"description":"Fresh random 32-byte value encoded as 64 hexadecimal characters. Reuse unchanged only for retries of the same operation and request.","schema":{"type":"string","pattern":"^[0-9a-fA-F]{64}$"}}],"responses":{"200":{"description":"Illustrative endpoint-specific JSON response shape. For coverage operations, HTTP 200 is used for status complete, partial, and failed; all three settle and are charged at the full listed price. A settled 2xx includes a payment-response response header (facilitator settlement receipt; may include a transaction reference). Conditional fields depend on the result and data-source availability.","headers":{"payment-response":{"description":"Present on settled 2xx only. Facilitator settlement receipt for the x402 payment (not present on 4xx/5xx, which are not charged).","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"terminalNoFees":{"type":"number"},"terminalWithFees":{"type":"number"},"feeDrag":{"type":"number"},"feeDragPct":{"type":"number"},"byYear":{"type":"array","items":{}},"sources":{"type":"array","items":{"type":"object","properties":{"source":{"type":"string"},"url":{"type":"string"},"retrievedAt":{"type":"string"},"status":{"type":"string"}},"additionalProperties":true},"description":"Provenance only (source, url, retrievedAt). Not keyed by check id and does not carry success or error. A check in missing_items does not remove its upstream from sources[]; unavailability is only in missing_items (and unavailable findings)."},"limitations":{"type":"array","items":{"type":"string"}}},"additionalProperties":true},"example":{"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 …"]}}}},"400":{"description":"Invalid JSON or request schema. Not charged (no payment-response). If this 400 is returned before the Idempotency-Key is reserved, the key is not stored — fix the body and you may reuse the key. If an operation-path 400 was stored after a payment-signature was attached, the same key + same body replays it; the same key + a different body returns 409."},"402":{"description":"Payment required. The JSON body is the x402 PaymentRequired object. An unpaid 402 does not store the Idempotency-Key. A 402 after payment-signature releases the key and includes prior-payment-attempt (nonce, settled false|unknown). Not charged; no payment-response. Before re-signing after a post-signature 402, check USDC authorizationState(payer, nonce) on Base."},"409":{"description":"Idempotency conflict, in-progress payment, or expired result cache. Same key with a different body after a stored result returns conflict. Reusing the key cannot trigger a second charge. Not charged when settlement did not occur."},"413":{"description":"Request body exceeds the 24 MB limit. Not charged."},"500":{"description":"Operation failed before settlement, so no payment is taken (no payment-response). The error is stored: reuse the same Idempotency-Key and body to retrieve it without paying again. Use a new key for a fresh attempt with a new payment-signature."},"502":{"description":"Facilitator verify/settle transport failure (often timeout). After payment-signature this is returned as SETTLEMENT_UNKNOWN with prior-payment-attempt; the outcome is stored under the Idempotency-Key. With the shared store configured, other instances replay it instead of settling again; without it, each instance keeps its own memory. The authorization may already be settled on-chain — do not re-sign until USDC authorizationState(payer, nonce) on Base is false."},"503":{"description":"Payment or retry-safe result storage is unavailable; the operation is not run. Not charged; no payment-response. A 503 after payment-signature releases the Idempotency-Key and includes prior-payment-attempt."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.02"},"protocols":[{"x402":{"facilitator":"https://api.cdp.coinbase.com/platform/v2/x402"}}],"facilitator":"https://api.cdp.coinbase.com/platform/v2/x402"}}},"/api/v1/portfolio-analytics/tracking-error-capture":{"post":{"operationId":"tracking_error_and_capture_ratios","summary":"Tracking error and capture ratios","description":"Tracking error, information ratio, up/down capture, batting average and optional active share versus a benchmark.","tags":["portfolio-analytics"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"portfolio":{"minItems":2,"maxItems":100000,"type":"array","items":{"type":"number","exclusiveMinimum":-1}},"benchmark":{"minItems":2,"maxItems":100000,"type":"array","items":{"type":"number","exclusiveMinimum":-1}},"periodsPerYear":{"default":12,"type":"number","exclusiveMinimum":0},"holdings":{"type":"object","properties":{"portfolio":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"number"}},"benchmark":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"number"}}},"required":["portfolio","benchmark"],"additionalProperties":false},"captureMethod":{"default":"arithmetic","type":"string","enum":["arithmetic","geometric"]}},"required":["portfolio","benchmark"],"additionalProperties":false},"example":{"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}}}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"description":"Fresh random 32-byte value encoded as 64 hexadecimal characters. Reuse unchanged only for retries of the same operation and request.","schema":{"type":"string","pattern":"^[0-9a-fA-F]{64}$"}}],"responses":{"200":{"description":"Illustrative endpoint-specific JSON response shape. For coverage operations, HTTP 200 is used for status complete, partial, and failed; all three settle and are charged at the full listed price. A settled 2xx includes a payment-response response header (facilitator settlement receipt; may include a transaction reference). Conditional fields depend on the result and data-source availability.","headers":{"payment-response":{"description":"Present on settled 2xx only. Facilitator settlement receipt for the x402 payment (not present on 4xx/5xx, which are not charged).","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"trackingError":{"type":"number"},"informationRatio":{"type":"number"},"upCapture":{"type":"number"},"downCapture":{"type":"number"},"battingAverage":{"type":"number"},"activeShare":{"type":"number"},"sources":{"type":"array","items":{"type":"object","properties":{"source":{"type":"string"},"url":{"type":"string"},"retrievedAt":{"type":"string"},"status":{"type":"string"}},"additionalProperties":true},"description":"Provenance only (source, url, retrievedAt). Not keyed by check id and does not carry success or error. A check in missing_items does not remove its upstream from sources[]; unavailability is only in missing_items (and unavailable findings)."},"limitations":{"type":"array","items":{"type":"string"}}},"additionalProperties":true},"example":{"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…"]}}}},"400":{"description":"Invalid JSON or request schema. Not charged (no payment-response). If this 400 is returned before the Idempotency-Key is reserved, the key is not stored — fix the body and you may reuse the key. If an operation-path 400 was stored after a payment-signature was attached, the same key + same body replays it; the same key + a different body returns 409."},"402":{"description":"Payment required. The JSON body is the x402 PaymentRequired object. An unpaid 402 does not store the Idempotency-Key. A 402 after payment-signature releases the key and includes prior-payment-attempt (nonce, settled false|unknown). Not charged; no payment-response. Before re-signing after a post-signature 402, check USDC authorizationState(payer, nonce) on Base."},"409":{"description":"Idempotency conflict, in-progress payment, or expired result cache. Same key with a different body after a stored result returns conflict. Reusing the key cannot trigger a second charge. Not charged when settlement did not occur."},"413":{"description":"Request body exceeds the 24 MB limit. Not charged."},"500":{"description":"Operation failed before settlement, so no payment is taken (no payment-response). The error is stored: reuse the same Idempotency-Key and body to retrieve it without paying again. Use a new key for a fresh attempt with a new payment-signature."},"502":{"description":"Facilitator verify/settle transport failure (often timeout). After payment-signature this is returned as SETTLEMENT_UNKNOWN with prior-payment-attempt; the outcome is stored under the Idempotency-Key. With the shared store configured, other instances replay it instead of settling again; without it, each instance keeps its own memory. The authorization may already be settled on-chain — do not re-sign until USDC authorizationState(payer, nonce) on Base is false."},"503":{"description":"Payment or retry-safe result storage is unavailable; the operation is not run. Not charged; no payment-response. A 503 after payment-signature releases the Idempotency-Key and includes prior-payment-attempt."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.03"},"protocols":[{"x402":{"facilitator":"https://api.cdp.coinbase.com/platform/v2/x402"}}],"facilitator":"https://api.cdp.coinbase.com/platform/v2/x402"}}},"/api/v1/portfolio-analytics/allocation-xray":{"post":{"operationId":"look_through_allocation_x_ray","summary":"Look-through allocation x-ray","description":"Aggregate caller-supplied fund look-through holdings by asset class, sector, region and top underlying positions.","tags":["portfolio-analytics"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"positions":{"minItems":1,"maxItems":10000,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64},"value":{"type":"number"},"lookThrough":{"maxItems":100000,"type":"array","items":{"type":"object","properties":{"security":{"type":"string","minLength":1,"maxLength":64},"weight":{"type":"number","minimum":0,"maximum":1},"assetClass":{"type":"string","minLength":1,"maxLength":64},"sector":{"type":"string","minLength":1,"maxLength":64},"region":{"type":"string","minLength":1,"maxLength":64}},"required":["security","weight"],"additionalProperties":false}},"otherWeight":{"type":"number","minimum":0,"maximum":1},"otherClass":{"type":"object","properties":{"assetClass":{"type":"string","minLength":1,"maxLength":64},"sector":{"type":"string","minLength":1,"maxLength":64},"region":{"type":"string","minLength":1,"maxLength":64}},"additionalProperties":false},"assetClass":{"type":"string","minLength":1,"maxLength":64},"sector":{"type":"string","minLength":1,"maxLength":64},"region":{"type":"string","minLength":1,"maxLength":64}},"required":["id","value"],"additionalProperties":false}},"top":{"default":10,"type":"integer","minimum":1,"maximum":100}},"required":["positions"],"additionalProperties":false},"example":{"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}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"description":"Fresh random 32-byte value encoded as 64 hexadecimal characters. Reuse unchanged only for retries of the same operation and request.","schema":{"type":"string","pattern":"^[0-9a-fA-F]{64}$"}}],"responses":{"200":{"description":"Illustrative endpoint-specific JSON response shape. For coverage operations, HTTP 200 is used for status complete, partial, and failed; all three settle and are charged at the full listed price. A settled 2xx includes a payment-response response header (facilitator settlement receipt; may include a transaction reference). Conditional fields depend on the result and data-source availability.","headers":{"payment-response":{"description":"Present on settled 2xx only. Facilitator settlement receipt for the x402 payment (not present on 4xx/5xx, which are not charged).","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"total":{"type":"number"},"byAssetClass":{"type":"object","properties":{"equity":{"type":"number"},"bond":{"type":"number"}},"additionalProperties":true},"bySector":{"type":"object","properties":{"Technology":{"type":"number"},"Government":{"type":"number"},"Unclassified":{"type":"number"}},"additionalProperties":true},"byRegion":{"type":"object","properties":{"US":{"type":"number"},"Unknown":{"type":"number"}},"additionalProperties":true},"topUnderlying":{"type":"array","items":{"type":"object","properties":{"security":{"type":"string"},"value":{"type":"number"},"weight":{"type":"number"},"via":{"type":"array","items":{"type":"string"}}},"additionalProperties":true}},"sources":{"type":"array","items":{"type":"object","properties":{"source":{"type":"string"},"url":{"type":"string"},"retrievedAt":{"type":"string"},"status":{"type":"string"}},"additionalProperties":true},"description":"Provenance only (source, url, retrievedAt). Not keyed by check id and does not carry success or error. A check in missing_items does not remove its upstream from sources[]; unavailability is only in missing_items (and unavailable findings)."},"limitations":{"type":"array","items":{"type":"string"}}},"additionalProperties":true},"example":{"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…"]}}}},"400":{"description":"Invalid JSON or request schema. Not charged (no payment-response). If this 400 is returned before the Idempotency-Key is reserved, the key is not stored — fix the body and you may reuse the key. If an operation-path 400 was stored after a payment-signature was attached, the same key + same body replays it; the same key + a different body returns 409."},"402":{"description":"Payment required. The JSON body is the x402 PaymentRequired object. An unpaid 402 does not store the Idempotency-Key. A 402 after payment-signature releases the key and includes prior-payment-attempt (nonce, settled false|unknown). Not charged; no payment-response. Before re-signing after a post-signature 402, check USDC authorizationState(payer, nonce) on Base."},"409":{"description":"Idempotency conflict, in-progress payment, or expired result cache. Same key with a different body after a stored result returns conflict. Reusing the key cannot trigger a second charge. Not charged when settlement did not occur."},"413":{"description":"Request body exceeds the 24 MB limit. Not charged."},"500":{"description":"Operation failed before settlement, so no payment is taken (no payment-response). The error is stored: reuse the same Idempotency-Key and body to retrieve it without paying again. Use a new key for a fresh attempt with a new payment-signature."},"502":{"description":"Facilitator verify/settle transport failure (often timeout). After payment-signature this is returned as SETTLEMENT_UNKNOWN with prior-payment-attempt; the outcome is stored under the Idempotency-Key. With the shared store configured, other instances replay it instead of settling again; without it, each instance keeps its own memory. The authorization may already be settled on-chain — do not re-sign until USDC authorizationState(payer, nonce) on Base is false."},"503":{"description":"Payment or retry-safe result storage is unavailable; the operation is not run. Not charged; no payment-response. A 503 after payment-signature releases the Idempotency-Key and includes prior-payment-attempt."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.03"},"protocols":[{"x402":{"facilitator":"https://api.cdp.coinbase.com/platform/v2/x402"}}],"facilitator":"https://api.cdp.coinbase.com/platform/v2/x402"}}}},"components":{"schemas":{"ApiError":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}}}}}}}}