#!/usr/bin/env bash
set -euo pipefail

# FinanceGPT generated client starter
# Source: FinanceGPT API v2 OpenAPI index
# OpenAPI SHA-256: 228f3cf999f801d03634f0dad1fc6d296671bc13a8cf0d80994b00a57b62f910
# Operations: post-investment-portfolios-portfolio-generative-markets
# Credential: FINANCEGPT_API_KEY environment variable; no credential is embedded.
# Authority: API identity and generated code do not create model-promotion, QLM-binding or Financial Actions authority.

# Generate an evidence-sealed synthetic counterfactual market scenario for a portfolio | scope: investment:run
curl -X POST \
  -H "Authorization: Bearer $FINANCEGPT_API_KEY" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  --data '{
    "regime": "contraction",
    "sample_count": 8,
    "horizon": 6,
    "seed": 42,
    "base_volatility_pct": 20,
    "base_rate_pct": 4,
    "yield_curve_slope_bps_per_year": 20,
    "base_credit_spread_bps": 150,
    "credit_curve_slope_bps_per_year": 10,
    "base_fx_level": 1,
    "stress": {
        "equity_pct": -100,
        "fx_pct": -100,
        "rates_bps": -10000,
        "credit_bps": -10000,
        "commodity_pct": -100,
        "volatility_pct": -100
    }
}' \
  "https://financegpt.dev/api/v2/investment/portfolios/{portfolio}/generative-markets"
