Portfolio Management JSON Generation Skill
Purpose
Generate structured portfolio-management decision JSONs by combining shared-environment data with request-specific constraints. The tasks span fixed-income (PF-FI-LUMEN) and multi-asset (PF-MA-HELIO) portfolios.
When to Use
- You receive a prompt asking to prepare a desk proposal, portfolio review, allocation update, risk meeting memo, or committee decision file.
- The prompt references a
portfolio_id (PF-FI-LUMEN or PF-MA-HELIO) and points to input/payloads/committee_request.json (or similar request file) and input/payloads/answer_template.json.
- You must return only JSON matching a strict schema.
SOP
1. Read the Three Input Files
Always read, in this order:
input/prompt.txt — the narrative instruction (what the stakeholder wants).
input/payloads/<request>.json — the structured request (dates, instruments, bands, candidate shortlists, baseline weights, etc.).
input/payloads/answer_template.json — the schema contract (required top-level keys, field types, enums, precisions, ordering rules, required values).
Key insight: The answer template is a specification, not an example. Every key, enum value, precision, and ordering rule is enforced.
2. Fetch All Shared-Environment Data
Query the Asteria Investment Office environment for the endpoints relevant to the portfolio:
| Endpoint |
What It Contains |
Used By |
/api/environment/portfolio |
Current holdings, quantities, prices, sectors, asset classes |
All tasks |
/api/environment/index-levels |
Time-series of index levels (e.g., MSCI_EM, NIFTY_50, MSCI_LATAM, BLOOMBERG_USD) |
Correlation, return calculations |
/api/environment/policies |
CIO bands (HY max, duration min/max, max single-name %, rebalance thresholds) |
Constraint checking |
/api/environment/prior-views |
Previous allocation views (UW / N / OW) and convictions |
Change detection |
/api/environment/macro-signals |
Quantitative signal scores (Growth, Rates, Credit Spreads, USD Strength) |
View derivation |
Fetch all five endpoints even if the prompt only names a subset; cross-referencing is usually required.
3. Map Request Requirements to Template Fields
Create a field-by-field checklist. Common mappings:
Fixed-Income (PF-FI-LUMEN) Tasks
portfolio_id → always "PF-FI-LUMEN" (hard-coded).
proposal_date / review_date → from request payload or prompt.
trades / sells / buys → derived from:
- Watchlist instruments that must be reduced/removed.
- HY exposure that exceeds the policy band.
- Cash injection or stale exceptions that fund new positions.
- Candidate shortlist that provides replacement IG instruments.
post_trade_hy_exposure_pct → recalculate after sells/buys; must respect target_hy_band_max.
post_trade_duration → net duration after rotation; must stay inside CIO range.
watchlist_breach_flag → true if any watchlist instrument remains post-trade.
next_step → depends on whether all constraints are satisfied.
Multi-Asset (PF-MA-HELIO) Tasks
portfolio_id → always "PF-MA-HELIO".
review_quarter → often hard-coded (e.g., "Q2_2026").
correlation_summary → compute Pearson correlation of monthly simple returns from consecutive index levels for the pairs listed in the request.
target_sleeve_actions → derive from views and risk flags (trim overweight, add underweight, hold neutral, hedge/rotate for risk).
allocation_views → for each opportunity set:
- Read
prior_view from /api/environment/prior-views.
- Compute or read
signal_score from macro signals.
- Derive
view (UW / N / OW) from signal score and policy thresholds.
- Set
change by comparing view to prior_view.
- Set
conviction based on signal strength dispersion.
- Pick
rationale_code from the allowed enum that best matches the dominant macro signal.
rebalance_trigger → select the enum value that matches the primary reason for the committee action.
portfolio_risk_concentration_flag → true if any correlation, band, or watchlist threshold is breached.
4. Perform Calculations Rigorously
Monthly Simple Returns
return_t = (level_t - level_{t-1}) / level_{t-1}
Use consecutive index levels from the review period. Do not annualize.
Pearson Correlation
Compute between the return series of each pair. Round to 3 decimal places.
Critical: Pairs inside the correlation_summary object must have their two index IDs sorted alphabetically.
Post-Trade Portfolio Metrics (Fixed Income)
- HY exposure % = sum of HY holdings / total portfolio value.
- Duration = weighted average of instrument durations (weight = market value).
- Cash = prior cash + proceeds from sells - cost of buys + any injection.
- Round HY exposure to 4 decimal places, duration to 2, cash to 2.
Signal Score to View Mapping (Multi-Asset)
- Typical threshold: signal_score > 0.5 →
OW, < -0.5 → UW, else N. (Confirm against policy document if provided.)
change is UP if view improves from prior, DOWN if worsens, UNCHANGED if same.
5. Apply Business Rules in Priority Order
- Watchlist reduction first — sell watchlist instruments to the extent possible.
- HY band compliance — if post-trade HY % > max band, sell more HY or add IG.
- Duration band compliance — keep duration inside CIO min/max; use duration ballast candidates if needed.
- Avoid new watchlist buys — if the request specifies
avoid_new_watchlist_buy: true, exclude candidates flagged as watchlist risk.
- Stale exception handling — stale exceptions may be swapped for cleaner candidates of similar profile.
- Cash deployment — inject or deploy cash only after risk constraints are met.
6. Enforce Schema Compliance
Before returning JSON, verify every field against the answer template:
Common pitfall: Using "USD" in a trade action field when the template expects "buy" or "sell". Always cross-check the enum list in the template.
7. Validate Logical Consistency
- If
watchlist_breach_flag is false, ensure no watchlist instruments remain.
- If
cio_review_flag is true, the cio_review_reason must not be "NONE".
hy_reduction_pct_points should equal the difference between pre- and post-trade HY %.
target_allocations deviations must sum to zero (or near-zero within rounding).
signal_score sign should match the direction of view (positive → OW or N, negative → UW or N).
8. Output Only Valid JSON
Return the raw JSON object. Do not wrap it in markdown code fences, do not add a preamble like "Here is the JSON:", and do not include any narrative explanation. The downstream consumer parses the response directly.
Task-Specific Cheat Sheet
| Task Type |
Portfolio |
Key Calculations |
Critical Checks |
| Desk Proposal |
PF-FI-LUMEN |
Trades, post-trade HY %, duration, cash |
HY band, duration band, watchlist breach |
| Portfolio Review |
PF-FI-LUMEN |
Watchlist status changes, new position reasons |
All watchlist statuses updated, summary flags consistent |
| Allocation Update |
PF-MA-HELIO |
Target weights, deviations, signal scores |
Deviations sum to ~0, macro signal summary dominant signal matches top view |
| Rotation Memo |
PF-FI-LUMEN |
Sell/buy lists, HY reduction, duration change |
Watchlist cleared flag matches sells, CIO review flag consistent with constraints |
| Committee JSON |
PF-MA-HELIO |
Correlations (monthly returns), sleeve actions, allocation views |
Correlation pairs alphabetically sorted, views derived from signals and prior views |
Remember
- The answer template is the contract: every rule, enum, precision, and ordering constraint in it is enforced.
- Fixed-income tasks revolve around HY exposure, duration, and watchlist.
- Multi-asset tasks revolve around correlations, macro signals, and active views.
- Always fetch all five environment endpoints even when the prompt only names a subset; the data is cross-referenced implicitly.
- Return only the JSON object—no markdown, no preamble, no trailing commentary.
1---2name: reflect-3-attempt-01-383description: Portfolio Management JSON Generation Skill4---5# Portfolio Management JSON Generation Skill67## Purpose8Generate structured portfolio-management decision JSONs by combining shared-environment data with request-specific constraints. The tasks span fixed-income (PF-FI-LUMEN) and multi-asset (PF-MA-HELIO) portfolios.910## When to Use11- You receive a prompt asking to prepare a desk proposal, portfolio review, allocation update, risk meeting memo, or committee decision file.12- The prompt references a `portfolio_id` (PF-FI-LUMEN or PF-MA-HELIO) and points to `input/payloads/committee_request.json` (or similar request file) and `input/payloads/answer_template.json`.13- You must return **only JSON** matching a strict schema.1415## SOP1617### 1. Read the Three Input Files18Always read, in this order:191. `input/prompt.txt` — the narrative instruction (what the stakeholder wants).202. `input/payloads/<request>.json` — the structured request (dates, instruments, bands, candidate shortlists, baseline weights, etc.).213. `input/payloads/answer_template.json` — the schema contract (required top-level keys, field types, enums, precisions, ordering rules, required values).2223> **Key insight:** The answer template is a specification, not an example. Every key, enum value, precision, and ordering rule is enforced.2425### 2. Fetch All Shared-Environment Data26Query the Asteria Investment Office environment for the endpoints relevant to the portfolio:2728| Endpoint | What It Contains | Used By |29|----------|------------------|---------|30| `/api/environment/portfolio` | Current holdings, quantities, prices, sectors, asset classes | All tasks |31| `/api/environment/index-levels` | Time-series of index levels (e.g., MSCI_EM, NIFTY_50, MSCI_LATAM, BLOOMBERG_USD) | Correlation, return calculations |32| `/api/environment/policies` | CIO bands (HY max, duration min/max, max single-name %, rebalance thresholds) | Constraint checking |33| `/api/environment/prior-views` | Previous allocation views (UW / N / OW) and convictions | Change detection |34| `/api/environment/macro-signals` | Quantitative signal scores (Growth, Rates, Credit Spreads, USD Strength) | View derivation |3536Fetch **all five** endpoints even if the prompt only names a subset; cross-referencing is usually required.3738### 3. Map Request Requirements to Template Fields39Create a field-by-field checklist. Common mappings:4041#### Fixed-Income (PF-FI-LUMEN) Tasks42- `portfolio_id` → always `"PF-FI-LUMEN"` (hard-coded).43- `proposal_date` / `review_date` → from request payload or prompt.44- `trades` / `sells` / `buys` → derived from:45 - **Watchlist instruments** that must be reduced/removed.46 - **HY exposure** that exceeds the policy band.47 - **Cash injection** or **stale exceptions** that fund new positions.48 - **Candidate shortlist** that provides replacement IG instruments.49- `post_trade_hy_exposure_pct` → recalculate after sells/buys; must respect `target_hy_band_max`.50- `post_trade_duration` → net duration after rotation; must stay inside CIO range.51- `watchlist_breach_flag` → `true` if any watchlist instrument remains post-trade.52- `next_step` → depends on whether all constraints are satisfied.5354#### Multi-Asset (PF-MA-HELIO) Tasks55- `portfolio_id` → always `"PF-MA-HELIO"`.56- `review_quarter` → often hard-coded (e.g., `"Q2_2026"`).57- `correlation_summary` → compute Pearson correlation of **monthly simple returns** from consecutive index levels for the pairs listed in the request.58- `target_sleeve_actions` → derive from views and risk flags (trim overweight, add underweight, hold neutral, hedge/rotate for risk).59- `allocation_views` → for each opportunity set:60 1. Read `prior_view` from `/api/environment/prior-views`.61 2. Compute or read `signal_score` from macro signals.62 3. Derive `view` (UW / N / OW) from signal score and policy thresholds.63 4. Set `change` by comparing `view` to `prior_view`.64 5. Set `conviction` based on signal strength dispersion.65 6. Pick `rationale_code` from the allowed enum that best matches the dominant macro signal.66- `rebalance_trigger` → select the enum value that matches the primary reason for the committee action.67- `portfolio_risk_concentration_flag` → `true` if any correlation, band, or watchlist threshold is breached.6869### 4. Perform Calculations Rigorously7071#### Monthly Simple Returns72```73return_t = (level_t - level_{t-1}) / level_{t-1}74```75Use consecutive index levels from the review period. Do **not** annualize.7677#### Pearson Correlation78Compute between the return series of each pair. Round to **3 decimal places**.7980> **Critical:** Pairs inside the `correlation_summary` object must have their two index IDs sorted **alphabetically**.8182#### Post-Trade Portfolio Metrics (Fixed Income)83- **HY exposure %** = sum of HY holdings / total portfolio value.84- **Duration** = weighted average of instrument durations (weight = market value).85- **Cash** = prior cash + proceeds from sells - cost of buys + any injection.86- Round HY exposure to **4 decimal places**, duration to **2**, cash to **2**.8788#### Signal Score to View Mapping (Multi-Asset)89- Typical threshold: signal_score > 0.5 → `OW`, < -0.5 → `UW`, else `N`. (Confirm against policy document if provided.)90- `change` is `UP` if view improves from prior, `DOWN` if worsens, `UNCHANGED` if same.9192### 5. Apply Business Rules in Priority Order93941. **Watchlist reduction first** — sell watchlist instruments to the extent possible.952. **HY band compliance** — if post-trade HY % > max band, sell more HY or add IG.963. **Duration band compliance** — keep duration inside CIO min/max; use duration ballast candidates if needed.974. **Avoid new watchlist buys** — if the request specifies `avoid_new_watchlist_buy: true`, exclude candidates flagged as watchlist risk.985. **Stale exception handling** — stale exceptions may be swapped for cleaner candidates of similar profile.996. **Cash deployment** — inject or deploy cash only after risk constraints are met.100101### 6. Enforce Schema Compliance102103Before returning JSON, verify every field against the answer template:104105- [ ] All `required_top_level_keys` are present.106- [ ] Keys appear in the exact order specified (if an `item_order` is given).107- [ ] `required_value` fields match exactly (e.g., `portfolio_id`, `review_quarter`).108- [ ] Enum fields use only allowed values.109- [ ] Numbers match the specified precision.110- [ ] Lists have the required length.111- [ ] Nested objects contain only the declared sub-fields.112- [ ] No extra commentary, markdown, or keys outside the schema.113114> **Common pitfall:** Using `"USD"` in a trade `action` field when the template expects `"buy"` or `"sell"`. Always cross-check the enum list in the template.115116### 7. Validate Logical Consistency117118- If `watchlist_breach_flag` is `false`, ensure no watchlist instruments remain.119- If `cio_review_flag` is `true`, the `cio_review_reason` must **not** be `"NONE"`.120- `hy_reduction_pct_points` should equal the difference between pre- and post-trade HY %.121- `target_allocations` deviations must sum to zero (or near-zero within rounding).122- `signal_score` sign should match the direction of `view` (positive → OW or N, negative → UW or N).123124### 8. Output Only Valid JSON125126Return the raw JSON object. Do **not** wrap it in markdown code fences, do not add a preamble like "Here is the JSON:", and do not include any narrative explanation. The downstream consumer parses the response directly.127128## Task-Specific Cheat Sheet129130| Task Type | Portfolio | Key Calculations | Critical Checks |131|-----------|-----------|------------------|-----------------|132| Desk Proposal | PF-FI-LUMEN | Trades, post-trade HY %, duration, cash | HY band, duration band, watchlist breach |133| Portfolio Review | PF-FI-LUMEN | Watchlist status changes, new position reasons | All watchlist statuses updated, summary flags consistent |134| Allocation Update | PF-MA-HELIO | Target weights, deviations, signal scores | Deviations sum to ~0, macro signal summary dominant signal matches top view |135| Rotation Memo | PF-FI-LUMEN | Sell/buy lists, HY reduction, duration change | Watchlist cleared flag matches sells, CIO review flag consistent with constraints |136| Committee JSON | PF-MA-HELIO | Correlations (monthly returns), sleeve actions, allocation views | Correlation pairs alphabetically sorted, views derived from signals and prior views |137138## Remember139- The **answer template is the contract**: every rule, enum, precision, and ordering constraint in it is enforced.140- Fixed-income tasks revolve around **HY exposure, duration, and watchlist**.141- Multi-asset tasks revolve around **correlations, macro signals, and active views**.142- Always fetch **all five environment endpoints** even when the prompt only names a subset; the data is cross-referenced implicitly.143- Return **only** the JSON object—no markdown, no preamble, no trailing commentary.