What you build
A pre-deposit check that hitsPOST /v2/yield/portfolio/analyze with the proposed position appended, and refuses to proceed if the resulting risk band exceeds the user’s tolerance.
1. Build the request
2. Read the response
The response carries:risk.band(1 to 5; lower is safer).risk.dominant_factorslisting the top 3 factors driving the score.expected_apy_netnet of fees.scenarios(wheninclude_scenarios=true) with stress-test outputs.
3. Concentration warnings
If the sameprotocol or the same oracle.provider already accounts for more than 40% of the user’s notional, surface a warning regardless of band. The response includes a concentration block; render the top dimension to the user.
4. Troubleshooting
- 422 with “unknown opportunity_id”: the id you pass must match
data[].idfrom the yield list endpoint exactly. Fetch fresh; ids change on protocol upgrades. - Stale data: check
meta._agentic.freshness.status. If it’sstale, gate the deposit and surface the issue rather than approving on bad data.