> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fincept.in/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Custom Stress Scenario

> Builds a custom stress testing scenario by defining shocks to risk factors. Used to assess portfolio performance under extreme market conditions like crashes, rate spikes, or commodity shocks. Essential for regulatory stress testing (CCAR, FRTB) and internal risk management. [Tier: PRO, Credits: 5]



## OpenAPI

````yaml api-specs/risk.json post /quantlib/risk/stress/scenario
openapi: 3.1.0
info:
  title: FinceptQuantLib API - Risk Module
  description: >-
    Professional-grade risk management endpoints including Value at Risk (VaR),
    stress testing, copulas, extreme value theory (EVT), XVA calculations,
    sensitivities, and portfolio hedging. Part of the Pro Tier (5 credits per
    request).
  version: 3.0.0
  contact:
    name: Fincept API Support
    url: https://fincept.in
    email: support@fincept.in
servers:
  - url: https://api.fincept.in
    description: Fincept API Production Server
security:
  - APIKeyHeader: []
tags:
  - name: quantlib-risk
    description: Risk Management Module - Pro Tier (5 credits/request)
    x-displayName: Risk
paths:
  /quantlib/risk/stress/scenario:
    post:
      tags:
        - quantlib-risk
      summary: Create Custom Stress Scenario
      description: >-
        Builds a custom stress testing scenario by defining shocks to risk
        factors. Used to assess portfolio performance under extreme market
        conditions like crashes, rate spikes, or commodity shocks. Essential for
        regulatory stress testing (CCAR, FRTB) and internal risk management.
        [Tier: PRO, Credits: 5]
      operationId: stress_scenario
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - name
                - factor_shocks
              properties:
                name:
                  type: string
                  description: Descriptive name for the stress scenario
                  example: 2008 Financial Crisis
                description:
                  type: string
                  description: Detailed description of the scenario
                  example: >-
                    Severe market downturn with equity crash and credit spread
                    widening
                  default: ''
                factor_shocks:
                  type: object
                  description: >-
                    Dictionary mapping factor names to percentage shocks (e.g.,
                    -0.30 for -30%)
                  additionalProperties:
                    type: number
                  example:
                    equities: -0.4
                    credit_spreads: 0.5
                    volatility: 1
            example:
              name: COVID-19 Pandemic Shock
              description: >-
                March 2020 market shock with equity selloff and flight to
                quality
              factor_shocks:
                SP500: -0.34
                VIX: 3.5
                USD_Index: 0.08
                Oil_Price: -0.55
                IG_Spreads: 0.85
                HY_Spreads: 2.1
      responses:
        '200':
          description: Stress scenario created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: object
                    properties:
                      name:
                        type: string
                        example: COVID-19 Pandemic Shock
                      factor_shocks:
                        type: object
                        additionalProperties:
                          type: number
                        example:
                          SP500: -0.34
                          VIX: 3.5
                      severity:
                        type: number
                        description: Calculated severity score of the scenario
                        example: 4.82
                        nullable: true
              example:
                success: true
                data:
                  name: COVID-19 Pandemic Shock
                  factor_shocks:
                    SP500: -0.34
                    VIX: 3.5
                    Oil_Price: -0.55
                  severity: 4.82
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '402':
          $ref: '#/components/responses/InsufficientCreditsError'
        '422':
          $ref: '#/components/responses/ValidationError'
components:
  responses:
    UnauthorizedError:
      description: Authentication information is missing or invalid
      content:
        application/json:
          schema:
            type: object
            properties:
              detail:
                type: string
                example: Invalid API key
    InsufficientCreditsError:
      description: Insufficient API credits for this request
      content:
        application/json:
          schema:
            type: object
            properties:
              detail:
                type: string
                example: Insufficient credits. This endpoint requires 5 credits.
    ValidationError:
      description: Request validation error
      content:
        application/json:
          schema:
            type: object
            properties:
              detail:
                type: array
                items:
                  type: object
                  properties:
                    loc:
                      type: array
                      items:
                        type: string
                    msg:
                      type: string
                    type:
                      type: string
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: X-API-Key
      description: >-
        API key for authentication. Get your key at
        https://api.fincept.in/auth/register

````