#!/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-performance-observations
# 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.

# Record a valuation subperiod and explicit external cash flow for portfolio performance | scope: investment:run
curl -X POST \
  -H "Authorization: Bearer $FINANCEGPT_API_KEY" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  --data '{
    "period_start": "2026-08-16",
    "period_end": "2026-08-16",
    "opening_value": 1.0000000000000000209225608301284726753266340892878361046314239501953125e-8,
    "closing_value": 0,
    "external_flow": 0,
    "flow_timing": "start",
    "currency": "string",
    "source_type": "manual",
    "source_reference": "string"
}' \
  "https://financegpt.dev/api/v2/investment/portfolios/{portfolio}/performance/observations"
