Time-weighted and money-weighted returns API

Compute linked TWR, Modified Dietz and XIRR from valuations and external cash flows, with optional annualisation.

The Time-weighted and money-weighted returns operation is part of the Portfolio TWR Risk Attribution Analytics API on BRAINIAC.software. Compute linked TWR, Modified Dietz and XIRR from valuations and external cash flows, with optional annualisation. It is exposed as POST /api/v1/portfolio-analytics/performance-twr-mwr and priced at $0.04 USDC on Base. Payment uses the x402 exact scheme: an unpaid call returns HTTP 402 with payment requirements; after paying the exact USDC amount, retry the same request with a payment-signature header and Idempotency-Key. No account and no API key are required. Data sources for this product: Caller-supplied holdings, valuations, returns, factor series and transactions processed locally IRS Publication 550 (2025) wash-sale rules for wash-sale-detect Limitations: Pure computation on caller input: no custodian, price, factor or market-data feed is called at request time. Outputs are calculations for human review. They are not investment, tax or legal advice. Monte Carlo endpoints use the documented mulberry32 generator so seeded runs are reproducible. Portfolio values and money amounts are decimals in one currency (not minor units) unless an endpoint states otherwise. Outputs are compliance prechecks, drafts, or data lookups for human review. They are not official determinations, legal advice, identity confirmation, or certified filings. Related operations in this group include Volatility, Sharpe, Sortino and drawdown, Value-at-Risk and Expected Shortfall, Brinson-Fachler attribution, Factor regression of excess returns. Open the group documentation for the full request schema, field notes, and response examples before integrating.

POST$0.04 USDC
/api/v1/portfolio-analytics/performance-twr-mwr

Example request

curl -i -X POST "https://www.brainiac.software/api/v1/portfolio-analytics/performance-twr-mwr" \
  -H 'content-type: application/json' \
  -H 'Idempotency-Key: <fresh-64-character-random-hex-key>' \
  --data-binary @- <<'JSON'
{
  "valuations": [
    {
      "date": "2026-01-01",
      "value": 100000
    },
    {
      "date": "2026-07-02",
      "value": 105000,
      "beforeFlow": true
    },
    {
      "date": "2027-01-01",
      "value": 120000
    }
  ],
  "flows": [
    {
      "date": "2026-07-02",
      "amount": 10000
    }
  ],
  "annualize": true
}
JSON

An unpaid probe returns HTTP 402 with x402 payment requirements. After paying the exact USDC amount on Base, retry the identical request with a payment-signature header.

FAQ

  • Do I need an API key? No. Pay the listed USDC amount with x402.
  • What network? Base (eip155:8453), USDC.
  • Is this an official determination? No. Results are for human review against the cited sources.

Related APIs

Portfolio TWR Risk Attribution Analytics APIFull docsHow it works