> ## 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.

# CES Consumer Demand

> Compute optimal consumption bundle and utility for a consumer with Constant Elasticity of Substitution (CES) preferences. CES utility allows for varying degrees of substitutability between goods, from perfect substitutes to Leontief (perfect complements). Used in production theory, international trade models, and when goods have non-unit elasticity of substitution. [Tier: STANDARD, Credits: 2]



## OpenAPI

````yaml api-specs/economics.json post /quantlib/economics/equilibrium/ces
openapi: 3.1.0
info:
  title: FinceptQuantLib API - Economics
  description: >-
    Economics module endpoints for FinceptQuantLib API - general equilibrium,
    game theory, auctions, and utility functions
  version: 3.0.0
  contact:
    name: Fincept API Support
    url: https://fincept.in
servers:
  - url: https://api.fincept.in
    description: Fincept API Production Server
security:
  - APIKeyHeader: []
tags:
  - name: quantlib-economics
    description: >-
      Economics module - general equilibrium, game theory, auctions, and utility
      theory
    x-displayName: Economics
paths:
  /quantlib/economics/equilibrium/ces:
    post:
      tags:
        - quantlib-economics
      summary: CES Consumer Demand
      description: >-
        Compute optimal consumption bundle and utility for a consumer with
        Constant Elasticity of Substitution (CES) preferences. CES utility
        allows for varying degrees of substitutability between goods, from
        perfect substitutes to Leontief (perfect complements). Used in
        production theory, international trade models, and when goods have
        non-unit elasticity of substitution. [Tier: STANDARD, Credits: 2]
      operationId: ces_consumer_quantlib_economics_equilibrium_ces_post
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - rho
                - weights
                - income
                - prices
              properties:
                rho:
                  type: number
                  description: >-
                    Substitution parameter (rho = (sigma-1)/sigma where sigma is
                    elasticity of substitution). rho < 1 for substitutes, rho =
                    0 for Cobb-Douglas, rho → -∞ for Leontief.
                  example: -0.5
                weights:
                  type: array
                  description: Share parameters for the two goods [w1, w2]
                  items:
                    type: number
                    minimum: 0
                  minItems: 2
                  maxItems: 2
                  example:
                    - 0.5
                    - 0.5
                income:
                  type: number
                  description: Consumer's total income or budget
                  minimum: 0
                  example: 1000
                prices:
                  type: array
                  description: Prices of the two goods [p1, p2]
                  items:
                    type: number
                    minimum: 0
                  minItems: 2
                  maxItems: 2
                  example:
                    - 10
                    - 5
            example:
              rho: -0.5
              weights:
                - 0.5
                - 0.5
              income: 1000
              prices:
                - 10
                - 5
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: object
                    properties:
                      demand:
                        type: array
                        description: Optimal consumption bundle [x1*, x2*]
                        items:
                          type: number
                        example:
                          - 41.42
                          - 117.16
                      utility:
                        type: number
                        description: Utility level at optimal consumption
                        example: 75.45
                      elasticity_of_substitution:
                        type: number
                        description: >-
                          Elasticity of substitution between goods (sigma =
                          1/(1-rho))
                        example: 0.667
              example:
                success: true
                data:
                  demand:
                    - 41.42
                    - 117.16
                  utility: 75.45
                  elasticity_of_substitution: 0.667
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '402':
          $ref: '#/components/responses/InsufficientTierError'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: array
                    items:
                      type: object
              example:
                detail:
                  - loc:
                      - body
                      - rho
                    msg: field required
                    type: value_error.missing
      security:
        - APIKeyHeader: []
components:
  responses:
    UnauthorizedError:
      description: Authentication information is missing or invalid
      content:
        application/json:
          schema:
            type: object
            properties:
              detail:
                type: string
                example: Invalid API key
    InsufficientTierError:
      description: API tier insufficient for this endpoint
      content:
        application/json:
          schema:
            type: object
            properties:
              detail:
                type: string
                example: Endpoint requires Basic tier or higher
  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

````