Asteria Portfolio Analytics
Support institutional portfolio workflows using the Asteria Investment Office shared API environment. Always treat the API as the current book of record; local payloads may contain stale marks.
Core Rules
Data Precedence
The shared Asteria API (http://task-env:9010/) is always the authoritative source. When a local payload date is earlier than the API as_of_date (2026-05-29), prefer API values. Report this in any data_precedence field as "current_environment_over_stale_payload". When dates match or no conflict exists, use "no_conflict_found".
Template Conformance
Every task provides an answer_template.json in input/payloads/. Read it first — it defines the exact output shape, required keys, allowed enum values, numeric precision, and sort orders. Produce only the JSON object that conforms; no narrative outside it unless the prompt explicitly calls for it.
Numeric Precision
Round every numeric field to the precision declared in the template (e.g., 1 decimal for USD millions, 2 decimals for percentages and duration, 3 decimals for correlations). Use standard round() semantics.
Sorting Conventions
- Trade lists: sort by
action (SELL before BUY), then instrument_id ascending within each action group. For BUY-only lists, sort ascending by instrument_id.
- Index pairs: sort alphabetically within each pair.
- Allocation view rows: follow the order in the request payload's
focus_opportunity_sets.
- Diversification candidates and index sets: ascending alphabetical.
API Endpoints
Full catalog: references/api_reference.md.
Key endpoints for the five standard workflow surfaces:
| Workflow |
Primary Endpoints |
| Energy credit trade |
/api/portfolios/{id}/holdings, /api/instruments/bonds, /api/issuers, /api/market/energy, /api/policies |
| Equity correlation review |
/api/indices, /api/index-levels, /api/index-levels/{id}, /api/policies |
| Allocation view refresh |
/api/allocation/opportunity-sets, /api/allocation/prior-views, /api/macro-signals, /api/policies |
| FI risk rebalance |
/api/portfolios/{id}/holdings, /api/instruments/bonds, /api/issuers, /api/policies |
| Multi-asset committee |
/api/portfolios/{id}/holdings, /api/indices, /api/index-levels/{id}, /api/allocation/prior-views, /api/macro-signals, /api/policies |
Always start by fetching the relevant policies (/api/policies) to know constraint thresholds, correlation windows, and allocation mapping rules.
Deterministic Scripts
Use these bundled scripts when the task requires computed values. They produce JSON you can read programmatically.
scripts/compute_correlations.py
Computes Pearson correlations from index-level JSON.
python3 scripts/compute_correlations.py <levels.json> <index_ids.txt>
levels.json is a JSON array of {"index_id": "...", "levels": [{"date": "...", "level": number}]} — fetch one /api/index-levels/{id} per index and combine. index_ids.txt lists index IDs, one per line. Outputs return_observations and all pair correlations rounded to 3 decimals, sorted alphabetically.
scripts/compute_portfolio_metrics.py
Computes portfolio-level metrics from holdings + bond master.
python3 scripts/compute_portfolio_metrics.py <holdings.json> <bonds.json> [<issuers.json>]
Outputs total_market_value_usd_m, hy_allocation_pct, weighted_modified_duration_years, weighted_yield_to_maturity_pct, watchlist_exposure_usd_m, issuer and subsector exposure maps. Run once on the pre-trade holdings and once on the simulated post-trade holdings to compute deltas.
Computation Methods
Details: references/formulas.md.
Pearson Correlation
Monthly simple returns: r_t = level_t / level_{t-1} - 1. Standard Pearson formula over the return series. 3-decimal rounding. The review window uses 12 monthly levels yielding 11 return observations.
Post-Trade Portfolio Metrics
Simulate post-trade holdings: start from current portfolio, add BUY quantities, subtract SELL quantities. Weight metrics by notional. Use the bond master for rating, duration, and yield data per instrument.
Allocation View Derivation
From the macro signal score in /api/macro-signals for the target quarter:
score ≥ 0.35 → OW, score ≤ -0.35 → UW, otherwise N
|score| ≥ 0.7 → HIGH conviction, 0.35 ≤ |score| < 0.7 → MEDIUM, < 0.35 → LOW
- Compare to prior quarter's view (from
/api/allocation/prior-views) to set change: rank(OW)=1, rank(N)=0, rank(UW)=-1. Current > prior → UP, current < prior → DOWN, equal → UNCHANGED
Constraint Checks
Read constraint thresholds from /api/policies (key varies by portfolio's constraint_policy_id):
- HY cap: post-trade HY allocation ≤
max_hy_allocation_pct (default 20%)
- Duration band: post-trade duration inside
duration_band_years (default 3.0–5.0)
- Issuer concentration: no single issuer >
issuer_concentration_limit_pct (default 12%)
- Subsector diversification: at least
subsector_min_count_for_diversified distinct subsectors (default 2) among the selected instruments
- Watchlist avoidance: BUY trades must not target watchlisted issuers
Correlation Concentration
china_asia_dependence_flag: IDX_CHINA vs IDX_AC_ASIA_PAC_EX_JP correlation > 0.8
high_threshold_breached: any pair correlation > correlation_high_threshold (0.8)
primary_code: CHINA_ASIA_DEPENDENCE if china flag true, GLOBAL_DEVELOPED_OVERLAP if EM-WORLD > 0.8 without china dependence, NO_MATERIAL_CONCENTRATION otherwise
Workflow Patterns
Energy Credit Trade Construction
- Fetch portfolio holdings, bond universe, issuers, energy market signals, and applicable credit policy
- Filter to
energy_linked: true and candidate: true bonds
- Exclude watchlisted issuers
- Rank candidates by yield-to-maturity within the desk's preferred exposures (e.g., LNG exporters, gas demand)
- Select the required ticket count and total notional, ensure post-trade metrics satisfy all constraints
- Position the trade thematically using the
sales_positioning segment and theme enums from the template
Equity Correlation Review
- Fetch the index set's levels from
/api/index-levels/{id} for each ID in the template's allowed_values
- Compute all pairwise Pearson correlations using the script or equivalent manual computation
- Identify
highest_positive and lowest correlation pairs
- Run the concentration check (china dependence, threshold breach)
- Select diversification candidates (indices with low or negative correlations to the concentrated region)
- Propose two sleeve actions (one trim, one add) targeting only the allowed
target_index_id values
Allocation View Refresh
- Fetch opportunity-set taxonomy, prior-quarter views, and macro signals for the target quarter
- For each opportunity set in the request's
focus_opportunity_sets, derive view, conviction, and change from scores
- Use the signal's
rationale_code directly as each row's rationale
- Derive the risk overlay by combining the most material risk signals across the book:
- If duration-support signals are strong and HY/credit signals are negative →
DURATION_QUALITY_TILT
- If HY valuation risk dominates →
CREDIT_RISK_REDUCTION
- If equity growth signals are strong →
EQUITY_BETA_EXTENSION
- If dollar weakness signals dominate →
CURRENCY_DEFENSIVE_HEDGE
- Order rationale codes by business priority (highest priority first)
Fixed-Income Risk Rebalance
- Fetch portfolio holdings, bond universe, issuers, and credit risk reduction policy
- Identify SELL candidates: HY-rated holdings (prioritize watchlisted), targeting sufficient notional to meet
target_hy_reduction_pct
- Identify BUY candidates:
candidate: true bonds, IG-rated, non-watchlisted, with duration complementary to the portfolio
- Simulate post-trade holdings and verify HY cap, duration band, and watchlist clearance
- Set
risk_note_code to the primary pressure addressed (watchlist_concentration, hy_cap_pressure, duration_preservation, carry_tradeoff, or no_action)
Multi-Asset Committee Decision
- Fetch indices and index levels for correlation, plus allocation prior views and macro signals
- Compute correlations for the committee's focus indices (typically EM, China, India, LatAm)
- Derive allocation views as in the allocation workflow for the committee's opportunity sets
- Set
rebalance_trigger based on the primary finding: correlation_cap_breach when high correlation is the issue, hy_cap_pressure for credit stress, committee_review for scheduled review
- Set
portfolio_risk_concentration_flag to true when correlation or credit flags fire
- Set
next_step based on constraint status: approve_rotation if clean, approve_with_monitoring if flagged but within limits, defer_pending_risk_review if borderline, reject_constraint_breach if constraints fail
1---2name: asteria-portfolio-43description: Institutional portfolio analytics for the Asteria Investment Office shared environment. Supports energy credit trade construction, international equity correlation review, active allocation view derivation, fixed-income risk rebalancing, and multi-asset committee decisions. Use when the task references Asteria portfolios (PF-EN-*, PF-INT-*, PF-FI-*, PF-MA-*), the Asteria API at http://task-env:9010/, institutional credit/equity/allocation workflows, or when a local payload contains a request_id and a stale worksheet that must be reconciled against the current API environment.4metadata:5 source: https://skillmd.com/skills/prism-shadow/asteria-portfolio-46---78# Asteria Portfolio Analytics910Support institutional portfolio workflows using the Asteria Investment Office shared API environment. Always treat the API as the current book of record; local payloads may contain stale marks.1112## Core Rules1314### Data Precedence1516The shared Asteria API (`http://task-env:9010/`) is always the authoritative source. When a local payload date is earlier than the API `as_of_date` (2026-05-29), prefer API values. Report this in any `data_precedence` field as `"current_environment_over_stale_payload"`. When dates match or no conflict exists, use `"no_conflict_found"`.1718### Template Conformance1920Every task provides an `answer_template.json` in `input/payloads/`. Read it first — it defines the exact output shape, required keys, allowed enum values, numeric precision, and sort orders. Produce only the JSON object that conforms; no narrative outside it unless the prompt explicitly calls for it.2122### Numeric Precision2324Round every numeric field to the precision declared in the template (e.g., 1 decimal for USD millions, 2 decimals for percentages and duration, 3 decimals for correlations). Use standard `round()` semantics.2526### Sorting Conventions2728- Trade lists: sort by `action` (SELL before BUY), then `instrument_id` ascending within each action group. For BUY-only lists, sort ascending by `instrument_id`.29- Index pairs: sort alphabetically within each pair.30- Allocation view rows: follow the order in the request payload's `focus_opportunity_sets`.31- Diversification candidates and index sets: ascending alphabetical.3233## API Endpoints3435Full catalog: [references/api_reference.md](references/api_reference.md).3637Key endpoints for the five standard workflow surfaces:3839| Workflow | Primary Endpoints |40|---|---|41| Energy credit trade | `/api/portfolios/{id}/holdings`, `/api/instruments/bonds`, `/api/issuers`, `/api/market/energy`, `/api/policies` |42| Equity correlation review | `/api/indices`, `/api/index-levels`, `/api/index-levels/{id}`, `/api/policies` |43| Allocation view refresh | `/api/allocation/opportunity-sets`, `/api/allocation/prior-views`, `/api/macro-signals`, `/api/policies` |44| FI risk rebalance | `/api/portfolios/{id}/holdings`, `/api/instruments/bonds`, `/api/issuers`, `/api/policies` |45| Multi-asset committee | `/api/portfolios/{id}/holdings`, `/api/indices`, `/api/index-levels/{id}`, `/api/allocation/prior-views`, `/api/macro-signals`, `/api/policies` |4647Always start by fetching the relevant policies (`/api/policies`) to know constraint thresholds, correlation windows, and allocation mapping rules.4849## Deterministic Scripts5051Use these bundled scripts when the task requires computed values. They produce JSON you can read programmatically.5253### `scripts/compute_correlations.py`5455Computes Pearson correlations from index-level JSON.5657```bash58python3 scripts/compute_correlations.py <levels.json> <index_ids.txt>59```6061`levels.json` is a JSON array of `{"index_id": "...", "levels": [{"date": "...", "level": number}]}` — fetch one `/api/index-levels/{id}` per index and combine. `index_ids.txt` lists index IDs, one per line. Outputs `return_observations` and all pair correlations rounded to 3 decimals, sorted alphabetically.6263### `scripts/compute_portfolio_metrics.py`6465Computes portfolio-level metrics from holdings + bond master.6667```bash68python3 scripts/compute_portfolio_metrics.py <holdings.json> <bonds.json> [<issuers.json>]69```7071Outputs `total_market_value_usd_m`, `hy_allocation_pct`, `weighted_modified_duration_years`, `weighted_yield_to_maturity_pct`, `watchlist_exposure_usd_m`, issuer and subsector exposure maps. Run once on the pre-trade holdings and once on the simulated post-trade holdings to compute deltas.7273## Computation Methods7475Details: [references/formulas.md](references/formulas.md).7677### Pearson Correlation7879Monthly simple returns: `r_t = level_t / level_{t-1} - 1`. Standard Pearson formula over the return series. 3-decimal rounding. The review window uses 12 monthly levels yielding 11 return observations.8081### Post-Trade Portfolio Metrics8283Simulate post-trade holdings: start from current portfolio, add BUY quantities, subtract SELL quantities. Weight metrics by notional. Use the bond master for rating, duration, and yield data per instrument.8485### Allocation View Derivation8687From the macro signal `score` in `/api/macro-signals` for the target quarter:8889- `score ≥ 0.35` → `OW`, `score ≤ -0.35` → `UW`, otherwise `N`90- `|score| ≥ 0.7` → `HIGH` conviction, `0.35 ≤ |score| < 0.7` → `MEDIUM`, `< 0.35` → `LOW`91- Compare to prior quarter's view (from `/api/allocation/prior-views`) to set `change`: rank(OW)=1, rank(N)=0, rank(UW)=-1. Current > prior → `UP`, current < prior → `DOWN`, equal → `UNCHANGED`9293### Constraint Checks9495Read constraint thresholds from `/api/policies` (key varies by portfolio's `constraint_policy_id`):9697- **HY cap**: post-trade HY allocation ≤ `max_hy_allocation_pct` (default 20%)98- **Duration band**: post-trade duration inside `duration_band_years` (default 3.0–5.0)99- **Issuer concentration**: no single issuer > `issuer_concentration_limit_pct` (default 12%)100- **Subsector diversification**: at least `subsector_min_count_for_diversified` distinct subsectors (default 2) among the selected instruments101- **Watchlist avoidance**: BUY trades must not target watchlisted issuers102103### Correlation Concentration104105- `china_asia_dependence_flag`: IDX_CHINA vs IDX_AC_ASIA_PAC_EX_JP correlation > 0.8106- `high_threshold_breached`: any pair correlation > `correlation_high_threshold` (0.8)107- `primary_code`: `CHINA_ASIA_DEPENDENCE` if china flag true, `GLOBAL_DEVELOPED_OVERLAP` if EM-WORLD > 0.8 without china dependence, `NO_MATERIAL_CONCENTRATION` otherwise108109## Workflow Patterns110111### Energy Credit Trade Construction1121131. Fetch portfolio holdings, bond universe, issuers, energy market signals, and applicable credit policy1142. Filter to `energy_linked: true` and `candidate: true` bonds1153. Exclude watchlisted issuers1164. Rank candidates by yield-to-maturity within the desk's preferred exposures (e.g., LNG exporters, gas demand)1175. Select the required ticket count and total notional, ensure post-trade metrics satisfy all constraints1186. Position the trade thematically using the `sales_positioning` segment and theme enums from the template119120### Equity Correlation Review1211221. Fetch the index set's levels from `/api/index-levels/{id}` for each ID in the template's `allowed_values`1232. Compute all pairwise Pearson correlations using the script or equivalent manual computation1243. Identify `highest_positive` and `lowest` correlation pairs1254. Run the concentration check (china dependence, threshold breach)1265. Select diversification candidates (indices with low or negative correlations to the concentrated region)1276. Propose two sleeve actions (one trim, one add) targeting only the allowed `target_index_id` values128129### Allocation View Refresh1301311. Fetch opportunity-set taxonomy, prior-quarter views, and macro signals for the target quarter1322. For each opportunity set in the request's `focus_opportunity_sets`, derive `view`, `conviction`, and `change` from scores1333. Use the signal's `rationale_code` directly as each row's rationale1344. Derive the risk overlay by combining the most material risk signals across the book:135 - If duration-support signals are strong and HY/credit signals are negative → `DURATION_QUALITY_TILT`136 - If HY valuation risk dominates → `CREDIT_RISK_REDUCTION`137 - If equity growth signals are strong → `EQUITY_BETA_EXTENSION`138 - If dollar weakness signals dominate → `CURRENCY_DEFENSIVE_HEDGE`139 - Order rationale codes by business priority (highest priority first)140141### Fixed-Income Risk Rebalance1421431. Fetch portfolio holdings, bond universe, issuers, and credit risk reduction policy1442. Identify SELL candidates: HY-rated holdings (prioritize watchlisted), targeting sufficient notional to meet `target_hy_reduction_pct`1453. Identify BUY candidates: `candidate: true` bonds, IG-rated, non-watchlisted, with duration complementary to the portfolio1464. Simulate post-trade holdings and verify HY cap, duration band, and watchlist clearance1475. Set `risk_note_code` to the primary pressure addressed (`watchlist_concentration`, `hy_cap_pressure`, `duration_preservation`, `carry_tradeoff`, or `no_action`)148149### Multi-Asset Committee Decision1501511. Fetch indices and index levels for correlation, plus allocation prior views and macro signals1522. Compute correlations for the committee's focus indices (typically EM, China, India, LatAm)1533. Derive allocation views as in the allocation workflow for the committee's opportunity sets1544. Set `rebalance_trigger` based on the primary finding: `correlation_cap_breach` when high correlation is the issue, `hy_cap_pressure` for credit stress, `committee_review` for scheduled review1555. Set `portfolio_risk_concentration_flag` to `true` when correlation or credit flags fire1566. Set `next_step` based on constraint status: `approve_rotation` if clean, `approve_with_monitoring` if flagged but within limits, `defer_pending_risk_review` if borderline, `reject_constraint_breach` if constraints fail