Asteria Portfolio Risk
Environment
The Asteria Investment Office API is available at:
http://task-env:9010/
No authentication is required. All endpoints return JSON. Read references/api_reference.md for endpoint schemas and field descriptions.
Core Principle: Environment Precedence
Local request payloads may contain stale marks, outdated worksheets, or preferences from earlier analysis. The API is the current book of record. Always fetch current data from the API and treat it as authoritative over any locally-provided snapshot. When the answer template includes a data_precedence field, set it to "current_environment_over_stale_payload" unless the local payload contains information not available from the API.
API Inventory
Before starting any task, run:
curl -s http://task-env:9010/api/catalog | python3 -m json.tool
This returns all available IDs: portfolios, policies, indices, bonds, issuers, and opportunity sets.
After reading the catalog, fetch the specific data the task requires. Always fetch the full bond universe (/api/instruments/bonds) and full issuer set (/api/issuers) for any credit or portfolio task. Constraint checks depend on watchlist status, rating buckets, and subsector classification from those lists.
For policy thresholds and constraint rules, read references/policy_reference.md.
Computation Script
scripts/compute_metrics.py provides deterministic calculations:
Pearson correlation from index levels: Pipe two JSON arrays of [date, level] pairs on stdin:
echo JSON_ARRAYS | python3 scripts/compute_metrics.py pearson
Output: {"correlation": 0.915} rounded to 3 decimals.
Post-trade portfolio statistics: Pipe a JSON object with holdings, bonds, issuers, and optional trades:
python3 scripts/compute_metrics.py portfolio_stats < input.json
Output includes total_market_value_usd_m, hy_allocation_pct, weighted_modified_duration_years, weighted_yield_to_maturity_pct, and watchlist_exposure_usd_m.
Task Workflows
1. Energy-Credit Trade Strategy
For PF-EN-* portfolios. The task provides a desk request with stale holdings and preferences.
Steps:
- Fetch portfolio holdings from /api/portfolios/{id}/holdings
- Fetch all bonds from /api/instruments/bonds
- Fetch all issuers from /api/issuers
- Fetch energy market signals from /api/market/energy
- Fetch policies from /api/policies
- Filter candidate bonds: candidate=true, energy_linked=true, issuer watchlist=false
- Select bonds aligned with desk preferences (LNG exporters, gas demand, etc.) that improve carry while staying inside constraints
- Compute pre-trade then post-trade metrics with the script
- Run constraint checks against the portfolio policy
- Choose sales positioning segment and theme matching bond selections
- Fill the answer template, rounding to template precision
2. International Equity Correlation Review
For PF-INT-* portfolios. The task provides a review window and index universe.
Steps:
- Fetch portfolio holdings from /api/portfolios/{id}/holdings
- Fetch all indices from /api/indices
- Fetch index levels for every index in the universe from /api/index-levels/{index_id}
- Filter levels to the requested window
- For every pair of indices, compute Pearson correlation using the script
- Identify the highest-positive and lowest correlation pairs
- Assess concentration: check if any correlation exceeds 0.8 threshold
- Identify diversification candidates with low correlation to concentrated sleeves
- Propose exactly 2 sleeve actions (trim a concentrated sleeve, add a diversifier)
- Fill the answer template; return_observations = number of monthly return data points (level count minus 1)
3. Active Allocation View Refresh
For CIO desk allocation tasks with target_quarter and prior_quarter.
Steps:
- Fetch opportunity sets from /api/allocation/opportunity-sets
- Fetch prior views from /api/allocation/prior-views, filtering for previous_quarter={prior_quarter} and quarter={target_quarter}
- Fetch macro signals from /api/macro-signals for quarter={target_quarter}
- Fetch policies from /api/policies
- For each opportunity set in the focus list, look up its signal score
- Map score to view using policy thresholds: score >= 0.35 -> OW, score <= -0.35 -> UW, otherwise -> N
- Map abs(score) to conviction:
= 0.7 -> HIGH, >= 0.35 -> MEDIUM, < 0.35 -> LOW
- Compare to prior view to determine change: UP/DOWN/UNCHANGED
- Use rationale_code directly from the signal data
- Determine risk overlay by scanning all signal scores for the dominant theme
- Fill the answer template in request payload focus order
4. Fixed-Income Risk Rebalance
For PF-FI-* portfolios. The task provides a meeting memo with preferences and a stale exception board.
Steps:
- Fetch portfolio holdings from /api/portfolios/{id}/holdings
- Fetch all bonds from /api/instruments/bonds
- Fetch all issuers from /api/issuers
- Fetch policies from /api/policies
- Identify HY and watchlist positions to sell
- Select eligible buys: candidate=true, issuer watchlist=false, appropriate rating and sector diversification
- Build trades: SELL first, BUY second; sort by instrument_id within each
- Compute post-trade metrics with the script
- Check exception flags against the portfolio policy
- Record watchlist handling
- Choose the risk_note_code that characterizes the primary risk pressure
5. Multi-Asset Committee Decision
For PF-MA-* portfolios. Links correlation to allocation views.
Steps:
- Fetch portfolio holdings from /api/portfolios/{id}/holdings
- Fetch index levels for committee-specified index IDs
- Compute correlations for the focused pairs
- Fetch opportunity sets, prior views, macro signals, and policies
- Produce allocation views for the requested opportunity sets
- Determine sleeve actions from correlation and view synthesis
- Set rebalance_trigger, portfolio_risk_concentration_flag, and next_step
Precision and Rounding
Match the precision declared in each answer template. The script rounds to 2 decimals for percentages and durations, 1 decimal for USD millions, and 3 decimals for correlations. Adjust inline when the template differs.
Constraint Check Rules
Apply these from the portfolio policy (credit_default or credit_risk_reduction):
- HY cap: hy_allocation_pct <= max_hy_allocation_pct (default 20%)
- Duration band: weighted duration within band min/max (default 3.0-5.0)
- Issuer diversification: no single issuer > 12% of post-trade MV
- Subsector diversification: at least 2 distinct subsectors among new buys
- Watchlist avoidance: no BUY ticket references a watchlisted issuer
For credit_risk_reduction: also verify HY reduction meets target_hy_reduction_pct.
See references/policy_reference.md for full policy structure.