Developer guide

How to integrate a portfolio analysis API.

A useful portfolio API does more than return a number. It resolves holdings, measures structure, exposes evidence quality, and gives your product enough detail to explain the result.

What a portfolio analysis API should do

The core input is simple: a list of securities and their values. The hard part begins after the request arrives. Tickers must be matched to the correct instruments, values normalised into weights, classifications and market evidence attached, and missing data surfaced. The result then has to separate portfolio structure from market opinion.

PORTIQA’s POST /evaluate endpoint returns the portfolio score and status, a breakdown by component, and the share of holdings that could be assessed. Give readers the evaluation date and display coverage next to the score.

1. Define the request contract

Send market values when you already calculate them. If you send amounts, the service must have a usable reference price. Use the canonical ticker format expected by the security master, keep cash separate from invested positions, and choose a risk level deliberately rather than accepting a default without telling the user.

curl -X POST https://portiqa.ai/evaluate \
  -H "Authorization: Bearer $PORTIQA_KEY" \
  -H "Portiqa-Response-Profile: public" \
  -H "Content-Type: application/json" \
  -d '{
    "risk_level": "medium",
    "cash_balance": 5000,
    "positions": [
      {"ticker": "AAPL", "market_value": 25000},
      {"ticker": "MSFT", "market_value": 22000},
      {"ticker": "NVDA", "market_value": 8000}
    ]
  }'

Keep the bearer key on your server. Browser and mobile clients should call your backend, which validates the user and then calls PORTIQA. This prevents a public bundle from exposing a reusable credential.

2. Read the response in layers

  1. Identity: store engine_version with the result.
  2. Triage: use score and status for the initial summary.
  3. Structure: inspect maximum position weight, effective positions, top sector, and its weight.
  4. Use component_assessments to display the lower, middle or upper band for each component. Show a missing value as unavailable.
  5. Check analysis_coverage for excluded holdings and data_sources for dates and availability.
  6. Use the score_drivers explanations to help the reader choose what to review.

3. Design for disagreement

Component disagreement is information. A portfolio can contain strong companies and still be concentrated in one sector. It can be diversified but poorly aligned with the selected risk level. Your UI should make those tensions visible with separate labels or bars. A single green score that hides a weak component creates false certainty.

4. Handle incomplete evidence

An unresolved ticker should produce a visible warning. Low factor coverage should reduce confidence in forward-looking context. A missing beta should not become zero, because zero is a real value with a different meaning. Use the response coverage and diagnostics to decide whether to show a component, mark it provisional, or ask the user to correct an identifier.

5. Make versioning explicit

Keep the evaluation time, inputs and engine_version with a user’s saved result. Label comparisons across different model versions. Existing integrations can send Portiqa-Response-Profile: public on an individual request to try the current response format.

6. Treat errors as product states

Build checklist

Use the API reference for the field contract, the code examples for complete requests, and the methodology for calculation context.