Developer guide

How to design and read a portfolio risk API.

Risk is not one field. Concentration, market sensitivity, company quality, trend, context, liquidity, and user constraints answer different questions and should remain distinguishable.

Separate structural risk from market forecasts

A portfolio API can measure current structure and historical evidence. It cannot know the next return. Concentration and cash exposure are structural. Beta and correlation estimate historical sensitivity. Trend and regime fields describe recent market evidence. Quality fields describe characteristics of holdings. Mixing them into one unexplained “risk” value makes the result difficult to audit.

Concentration comes first

Maximum position weight, effective positions, top sector, and top-sector weight identify dependencies that can dominate every other metric. A low-volatility stock at forty percent of a portfolio is still a large single-name risk. Show this before more elaborate factor or regime analysis.

Market sensitivity needs coverage

A weighted beta is meaningful only when beta exists for enough invested weight and uses a consistent benchmark and window. If coverage is weak, return null or a qualified result—not zero. The same principle applies to factor correlations and market-regime alignment.

Risk profile changes the target

A conservative user and an aggressive user can hold the same securities but have different appropriate cash and invested targets. PORTIQA therefore takes a risk level and returns the selected profile and exposure plan in diagnostics. The profile is a scoring context, not proof that the portfolio suits a person’s complete financial situation.

Use component scores as evidence lanes

Present these beside the health score. If risk is strong while diversification is weak, the right explanation is not “medium overall.” The right explanation is that stable individual holdings are concentrated.

Expose uncertainty directly

Useful risk output includes the percentage of holdings or invested weight covered by each evidence type, classification confidence, factor-evidence confidence, low-confidence tickers, and explicit data gaps. Downstream applications can then set presentation rules—for example, hiding a factor-alignment badge below a chosen confidence threshold.

Plan for operational failures

Risk analysis often sits in an interactive workflow, so latency and failure handling affect trust. Set a finite timeout, log the request time and returned status, and never retry authentication or validation failures. For transient server errors, use limited exponential backoff. Preserve the last valid analysis with its timestamp and engine version rather than silently replacing it with an error-state score.

Questions your integration should answer

  1. Which holdings dominate the result?
  2. Which components disagree, and why?
  3. How much invested weight has usable evidence?
  4. Which fields are missing or low confidence?
  5. Which engine version produced the result?
  6. What does the stated risk profile change?
  7. Which suggestions are structural, and which depend on recent market context?

Continue with the PORTIQA methodology, data-source and coverage notes, or the API field reference.