openapi: 3.0.1
servers:
  - url: https://api.portfoliooptimizer.io/v1
  - url: https://eu-west-1.api.portfoliooptimizer.io/v1
info:
  contact:
    email: contact@portfoliooptimizer.io
    name: Support
    url: https://portfoliooptimizer.io/
  description: |
    Portfolio Optimizer is a [Web API](https://en.wikipedia.org/wiki/Web_API) to analyze and optimize investment portfolios (collection of financial assets such as stocks, bonds, ETFs, crypto-currencies) using modern portfolio theory algorithms (mean-variance, VaR, etc.).

    # API General Information

      Portfolio Optimizer is based on [REST](https://en.wikipedia.org/wiki/Representational_state_transfer) for easy integration, uses [JSON](https://en.wikipedia.org/wiki/JSON) for the exchange of data and uses a standard [HTTP verb](https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Request_methods) (`POST`) to represent the action(s).

    Portfolio Optimizer is also as secured as a Web API could be: 
    * [256-bit HTTPS Encryption](https://en.wikipedia.org/wiki/HTTPS)
    * No usage of cookies
    * No usage of personal data  

    ## API Headers 
    The following HTTP header(s) are required when calling Portfolio Optimizer endpoints:
    * `Content-type: application/json`  
      This header specifies that the data provided in input to the endpoint is in JSON format

    The following HTTP header(s) are optional when calling Portfolio Optimizer endpoints:
    * `Content-Encoding: gzip`  
      This header indicates that the data provided in input to the endpoint is compressed with gzip.
    * `X-API-Key: <private API key>`  
      This header enables [authenticated users](#auth) to provide their private [API key](#overview--api-key) in order to [benefit from higher API limits](#overview--api-limits)

    ## API Key
    Portfolio Optimizer is free to use, but not free to run.

    In order to obtain an API key and benefit from [higher API limits](#overview--api-limits), a *small* participation to Portfolio Optimizer running costs is required.

    This participation takes the form of coffee(s), with one coffee = one month of usage.

    <p><a href="https://www.buymeacoffee.com/portfolioopt"><img alt='Buy a Coffee at buymeacoffee.com' src="https://img.buymeacoffee.com/button-api/?text=Buymeacoffee.com&emoji=&slug=portfolioopt&button_colour=000000&font_colour=ffffff&font_family=Cookie&outline_colour=ffffff&coffee_colour=FFDD00"></a></p>


    > **Notes:** 
    > * Please make sure not to expose your API key publicly!

    ## API Limits 

    Portfolio Optimizer comes with *fairly reasonable* API limits.

    For anonymous users:  
    * The API requests are restricted to a subset of all the available endpoints and/or endpoints features  
    * The API requests are limited to 1 request per second for all the anonymous users combined, with concurrent requests rejected 
    * The API requests are limited to 1 second of execution time
    * The API requests are limited to 20 assets, 250 portfolios, 500 series data points and 5 factors

    For authenticated users with an [API key](#overview--api-key):  
    * The API requests have access to all the available endpoints and endpoints features
    * The API requests are limited to 10000 requests per 24 hour per API key, with concurrent requests queued
    * The API requests are limited to 2.5 seconds of execution time
    * The API requests are limited to 100 assets, 1250 portfolios, 2500 series data points and 25 factors

    > **Notes:** 
    > * It is possible to further relax the API limits, or to disable the API limits alltogether; please [contact the support](https://portfoliooptimizer.io/contact/) for more details.
    > * Information on the API rate limits are provided in response messages HTTP headers `x-ratelimit-*`:  
    >   * `x-ratelimit-limit-second`, the limit on the number of API requests per second
    >   * `x-ratelimit-remaining-second`, the number of remaining API requests in the current second    
    >   * `x-ratelimit-limit-minute`, the limit on the number of API requests per minute
    >   * ...

    ## API Regions
    Portfolio Optimizer servers are located in Western Europe.

    > **Notes:** 
    > * It is possible to deploy Portfolio Optimizer in other geographical regions, for example to improve the API latency; please [contact the support](https://portfoliooptimizer.io/contact/) for more details. 

    ## API Response Codes       

    Standard [HTTP response codes](https://en.wikipedia.org/wiki/List_of_HTTP_status_codes) are used by Portfolio Optimizer to provide details on the status of API requests.

    | HTTP Code | Description | Notes |
    | --------- | ----------- | ----- |
    | 200 | Request successfully processed | - |
    | 400 | Request failed to be processed because of incorrect content | The response message body contains information on the incorrect content |
    | 401 | Request failed to be processed because of invalid API key | - |
    | 404 | Request failed to be processed because of non existing endpoint | The requested endpoint might exist, but needs to be accessed with another HTTP method (e.g., `POST` instead of `GET`) |
    | 429 | Request failed to be processed because of API limits violated | The response message HTTP headers `x-ratelimit-*` contain information on the [API limits](#overview--api-limits) |
    | 500 | Request failed to be processed because of an internal error | Something went wrong on Portfolio Optimizer side, do not hesitate to [report the issue](#overview--support) |
    | 502 | Request failed to be processed because of a temporary connectivity error | Something went wrong on Portfolio Optimizer side, please check the [API status](#overview--api-status) and do not hesitate to [report the issue](#overview--support) |

    ## API Status  

    Portfolio Optimizer is monitored 24/7 by [UptimeRobot](https://stats.uptimerobot.com/wgW71SL1AW).

    # Support

    For any issue or question about Portfolio Optimizer, please do not hesitate to [contact the support](https://portfoliooptimizer.io/contact/).
  license:
    name: Apache 2.0
    url: http://www.apache.org/licenses/LICENSE-2.0.html
  termsOfService: https://portfoliooptimizer.io/terms-of-service
  title: Portfolio Optimizer
  version: 1.0.9
  x-apisguru-categories:
    - financial
  x-logo:
    url: https://portfoliooptimizer.io/assets/images/88x88.png
  x-origin:
    - format: openapi
      url: https://docs.portfoliooptimizer.io/openapi/portfoliooptimizer.yaml
      version: "3.0"
  x-providerName: portfoliooptimizer.io
externalDocs:
  description: External documentation
  url: https://docs.portfoliooptimizer.io/
security:
  - ApiKeyAuth: []
paths:
  /assets/analysis/absorption-ratio:
    post:
      description: |
        Compute the absorption ratio associated to a universe of assets.

        References
        * [Mark Kritzman, Yuanzhen Li, Sebastien Page and Roberto Rigobon, Principal Components as a Measure of Systemic Risk, The Journal of Portfolio Management Summer 2011, 37 (4) 112-126](https://jpm.pm-research.com/content/37/4/112)
      requestBody:
        content:
          application/json:
            examples:
              Example:
                description: Compute the absorption ratio of 2 assets
                value:
                  assets: 2
                  assetsCovarianceMatrix:
                    - - 9
                      - 1
                    - - 1
                      - 1
            schema:
              properties:
                assets:
                  description: The number of assets
                  minimum: 1
                  type: integer
                assetsCovarianceMatrix:
                  description: assetsCovarianceMatrix[i][j] is the covariance between the asset i and the asset j
                  items:
                    items:
                      type: number
                    minItems: 2
                    type: array
                  minItems: 2
                  type: array
                assetsCovarianceMatrixEigenvectors:
                  properties:
                    eigenvectorsRetained:
                      description: The number of eigenvectors to retain in the numerator of the absorption ratio, which must be lower than the number of assets; defaults to [1/5-th] the number of assets
                      minimum: 1
                      type: integer
                  type: object
              required:
                - assets
                - assetsCovarianceMatrix
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Computed absorption ratio of 2 assets
                  value:
                    assetsAbsorptionRatio: 0.9123105625617661
              schema:
                properties:
                  assetsAbsorptionRatio:
                    description: The absorption ratio of the universe of assets
                    type: number
                required:
                  - assetsAbsorptionRatio
                type: object
          description: OK
      summary: Absorption Ratio
      tags:
        - Assets / Analysis
      x-codegen-request-body-name: body
  /assets/analysis/turbulence-index:
    post:
      description: |
        Compute the turbulence index associated to a universe of assets.

        References
        * [M. Kritzman, Y. Li, Skulls, Financial Turbulence, and Risk Management,Financial Analysts Journal, Volume 66, Number 5, Pages 30-41, Year 2010](https://www.tandfonline.com/doi/abs/10.2469/faj.v66.n5.3)
        * [Kinlaw, W., Turkington, D. Correlation surprise. J Asset Manag 14, 385–399 (2013)](https://link.springer.com/article/10.1057/jam.2013.27)
      requestBody:
        content:
          application/json:
            examples:
              Example (1 asset):
                description: Compute the turbulence index of 1 asset
                value:
                  assets: 1
                  assetsAverageReturns:
                    - 0.5
                  assetsCovarianceMatrix:
                    - - 1
                  assetsReturns:
                    - 1
              Example (2 assets):
                description: Compute the turbulence index of 2 assets
                value:
                  assets: 2
                  assetsAverageReturns:
                    - 1
                    - 1
                  assetsCovarianceMatrix:
                    - - 9
                      - 1
                    - - 1
                      - 1
                  assetsReturns:
                    - 1
                    - 0
            schema:
              properties:
                assets:
                  description: The number of assets
                  minimum: 1
                  type: integer
                assetsAverageReturns:
                  description: assetsAverageReturns[i] is the average return of asset i over an historical reference period
                  items:
                    type: number
                  minItems: 1
                  type: array
                assetsCovarianceMatrix:
                  description: assetsCovarianceMatrix[i][j] is the covariance between the asset i and the asset j over an historical reference period
                  items:
                    items:
                      type: number
                    minItems: 1
                    type: array
                  minItems: 1
                  type: array
                assetsReturns:
                  description: assetsReturns[i] is the return of asset i over a period different from the historical reference period
                  items:
                    type: number
                  minItems: 1
                  type: array
              required:
                - assets
                - assetsCovarianceMatrix
                - assetsAverageReturns
                - assetsReturns
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Computed turbulence index
                  value:
                    assetsTurbulenceIndex: 0.5624999999999999
              schema:
                properties:
                  assetsTurbulenceIndex:
                    description: the turbulence index of the universe of assets
                    type: number
                required:
                  - assetsTurbulenceIndex
                type: object
          description: OK
      summary: Turbulence Index
      tags:
        - Assets / Analysis
      x-codegen-request-body-name: body
  /assets/correlation/matrix:
    post:
      description: |
        Compute the Pearson asset correlation matrix from either:  
        * The asset returns
        * The asset covariance matrix

        References
        * [Wikipedia, Correlation and Dependence](https://en.wikipedia.org/wiki/Correlation_and_dependence#Correlation_matrices)
      requestBody:
        content:
          application/json:
            examples:
              From covariance matrix:
                description: Computes the correlation matrix of 2 assets based on their covariance matrix
                value:
                  assets: 2
                  assetsCovarianceMatrix:
                    - - 0.01
                      - -0.0025
                    - - -0.0025
                      - 0.0025
              From returns:
                description: Computes the correlation matrix of 2 assets based on 4 returns per asset
                value:
                  assets:
                    - assetReturns:
                        - 0.01
                        - 0
                        - 0.02
                        - -0.03
                    - assetReturns:
                        - 0.01
                        - 0
                        - 0.02
                        - -0.03
            schema:
              oneOf:
                - properties:
                    assets:
                      items:
                        properties:
                          assetReturns:
                            description: assetReturns[t] is the return of the asset at the time t; all the assetReturns arrays must have the same length
                            items:
                              type: number
                            minItems: 2
                            type: array
                        required:
                          - assetReturns
                        type: object
                      minItems: 2
                      type: array
                  required:
                    - assets
                  type: object
                - properties:
                    assets:
                      description: The number of assets
                      minimum: 2
                      type: integer
                    assetsCovarianceMatrix:
                      description: assetsCovarianceMatrix[i][j] is the covariance between the asset i and the asset j
                      items:
                        items:
                          type: number
                        minItems: 2
                        type: array
                      minItems: 2
                      type: array
                  required:
                    - assets
                    - assetsCovarianceMatrix
                  type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Computed correlation matrix
                  value:
                    assetsCorrelationMatrix:
                      - - 1
                        - 0.5
                      - - 0.5
                        - 1
              schema:
                properties:
                  assetsCorrelationMatrix:
                    description: assetsCorrelationMatrix[i][j] is the correlation between the asset i and the asset j
                    items:
                      items:
                        type: number
                      minItems: 2
                      type: array
                    minItems: 2
                    type: array
                required:
                  - assetsCorrelationMatrix
                type: object
          description: OK
      summary: Correlation Matrix
      tags:
        - Assets / Correlation Matrix
      x-codegen-request-body-name: body
  /assets/correlation/matrix/bounds:
    post:
      description: |
        Compute the lower bounds and the upper bounds of an asset correlation matrix associated to a given group of assets.
         
         References
         * [Kawee Numpacharoen & Kornkanok Bunwong (2013) Boundaries of Correlation Adjustment with Applications to Financial Risk Management, Applied Mathematical Finance, 20:4, 403-414](http://dx.doi.org/10.1080/1350486X.2012.723517).
      requestBody:
        content:
          application/json:
            examples:
              Example:
                description: Compute the lower and upper bounds of a 4x4 correlation matrix associated to the group of the 3 last assets
                value:
                  assets: 4
                  assetsCorrelationMatrix:
                    - - 1
                      - -0.55
                      - -0.15
                      - -0.1
                    - - -0.55
                      - 1
                      - 0.4
                      - 0.3
                    - - -0.15
                      - 0.4
                      - 1
                      - 0.5
                    - - -0.1
                      - 0.3
                      - 0.5
                      - 1
                  assetsGroup:
                    - 2
                    - 3
                    - 4
            schema:
              properties:
                assets:
                  minimum: 2
                  type: integer
                assetsCorrelationMatrix:
                  description: assetsCorrelationMatrix[i][j] is the correlation between the asset i and the asset j
                  items:
                    items:
                      type: number
                    minItems: 2
                    type: array
                  minItems: 2
                  type: array
                assetsGroup:
                  description: assetsGroup[k] is the indexes of the assets belonging to the assets group k
                  items:
                    minimum: 1
                    type: integer
                  minItems: 2
                  type: array
                  uniqueItems: true
              required:
                - assets
                - assetsCorrelationMatrix
                - assetsGroup
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Computed lower and upper bounds of a 3x3 correlation matrix associated to the group of the last 2 assets
                  value:
                    assetsCorrelationMatrixLowerBounds:
                      - - 1
                        - 0.5
                        - 0.5
                        - 0
                      - - 0.5
                        - 1
                        - 0.5
                        - 0.3
                      - - 0.5
                        - 0.5
                        - 1
                        - -0.6659
                      - - 0
                        - 0.3
                        - -0.6659
                        - 1
                    assetsCorrelationMatrixUpperBounds:
                      - - 1
                        - 0.5
                        - 0.5
                        - 0
                      - - 0.5
                        - 1
                        - 0.5
                        - 0.3
                      - - 0.5
                        - 0.5
                        - 1
                        - 0.8659
                      - - 0
                        - 0.3
                        - 0.8659
                        - 1
              schema:
                properties:
                  assetsCorrelationMatrixLowerBounds:
                    description: assetsCorrelationMatrixLowerBounds[i][j] is the lower bound of the correlation between the asset i and the asset j
                    items:
                      items:
                        type: number
                      minItems: 2
                      type: array
                    minItems: 2
                    type: array
                  assetsCorrelationMatrixUpperBounds:
                    description: assetsCorrelationMatrixUpperBounds[i][j] is the upper bound of the correlation between the asset i and the asset j
                    items:
                      items:
                        type: number
                      minItems: 2
                      type: array
                    minItems: 2
                    type: array
                required:
                  - assetsCorrelationMatrixLowerBounds
                  - assetsCorrelationMatrixUpperBounds
                type: object
          description: OK
      summary: Correlation Matrix Bounds
      tags:
        - Assets / Correlation Matrix
      x-codegen-request-body-name: body
  /assets/correlation/matrix/denoised:
    post:
      description: |
        Compute a denoised asset correlation matrix, using one of the following methods:
         * The eigenvalues clipping method, described in the first reference, which is based on random matrix theory
         
         References
         * [Laurent Laloux, Pierre Cizeau, Jean-Philippe Bouchaud, and Marc Potters, Noise Dressing of Financial Correlation Matrices, Phys. Rev. Lett. 83, 1467](https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.83.1467)
      requestBody:
        content:
          application/json:
            examples:
              Example:
                description: Denoise an asset correlation matrix of 3 assets
                value:
                  assets: 3
                  assetsCorrelationMatrix:
                    - - 1
                      - 0.5
                      - 0.9
                    - - 0.5
                      - 1
                      - 0.7
                    - - 0.9
                      - 0.7
                      - 1
                  assetsCorrelationMatrixAspectRatio: 0.5
            schema:
              properties:
                assets:
                  minimum: 2
                  type: integer
                assetsCorrelationMatrix:
                  description: assetsCorrelationMatrix[i][j] is the correlation between the asset i and the asset j
                  items:
                    items:
                      type: number
                    minItems: 2
                    type: array
                  minItems: 2
                  type: array
                assetsCorrelationMatrixAspectRatio:
                  description: The aspect ratio of the asset correlation matrix, defined as the number of assets divided by the number of asset returns per asset used to compute the asset correlation matrix
                  exclusiveMinimum: true
                  minimum: 0
                  type: number
                denoisingMethod:
                  default: eigenvaluesClipping
                  description: The method used to denoise the asset correlation matrix
                  enum:
                    - eigenvaluesClipping
                  type: string
              required:
                - assets
                - assetsCorrelationMatrix
                - assetsCorrelationMatrixAspectRatio
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Denoised correlation matrix
                  value:
                    assetsCorrelationMatrix:
                      - - 1
                        - 0.6838346015086407
                        - 0.7246659534718176
                      - - 0.6838346015086407
                        - 1
                        - 0.6978824315038066
                      - - 0.7246659534718176
                        - 0.6978824315038066
                        - 1
                Example of failing denoising method:
                  description: No denoised correlation matrix
                  value:
                    assetsCorrelationMatrix: null
              schema:
                properties:
                  assetsCorrelationMatrix:
                    description: assetsCorrelationMatrix[i][j] is the correlation between the asset i and the asset j; assetsCorrelationMatrix is possibly null in case the denoising method did not manage to denoise the provided asset correlation matrix
                    items:
                      items:
                        type: number
                      minItems: 2
                      type: array
                    minItems: 2
                    type: array
                required:
                  - assetsCorrelationMatrix
                type: object
          description: OK
      summary: Denoised Correlation Matrix
      tags:
        - Assets / Correlation Matrix
      x-codegen-request-body-name: body
  /assets/correlation/matrix/distance:
    post:
      description: |
        Compute the distance between an asset correlation matrix and a reference correlation matrix, using one of the following distance metrics:
        * Euclidean distance (default), which is the distance induced by [the Frobenius norm](https://en.wikipedia.org/wiki/Matrix_norm#Frobenius_norm)
        * Correlation matrix distance, defined in the first reference, which corresponds to [the cosine distance](https://en.wikipedia.org/wiki/Cosine_similarity) between the two vectorized asset correlation matrices
        * Bures distance, defined in the second reference

         References
         * [M. Herdin, N. Czink, H. Ozcelik and E. Bonek, Correlation matrix distance, a meaningful measure for evaluation of non-stationary MIMO channels, 2005 IEEE 61st Vehicular Technology Conference, 2005, pp. 136-140 Vol. 1](https://ieeexplore.ieee.org/document/1543265)
         * [Rajendra Bhatia, Tanvi Jain, Yongdo Lim, On the Bures–Wasserstein distance between positive definite matrices, Expositiones Mathematicae, Volume 37, Issue 2, 2019](https://www.sciencedirect.com/science/article/pii/S0723086918300021)
      requestBody:
        content:
          application/json:
            examples:
              Example (correlation matrix distance):
                description: Compute the correlation matrix distance between an asset correlation matrix and an equicorrelation matrix
                value:
                  assets: 3
                  assetsCorrelationMatrix:
                    - - 1
                      - 0.5
                      - 0.9
                    - - 0.5
                      - 1
                      - 0.7
                    - - 0.9
                      - 0.7
                      - 1
                  distanceMetric: correlationMatrix
                  referenceCorrelationMatrix:
                    - - 1
                      - 1
                      - 1
                    - - 1
                      - 1
                      - 1
                    - - 1
                      - 1
                      - 1
              Example (euclidean distance):
                description: Compute the euclidean distance between an asset correlation matrix and an equicorrelation matrix
                value:
                  assets: 3
                  assetsCorrelationMatrix:
                    - - 1
                      - 0.5
                      - 0.9
                    - - 0.5
                      - 1
                      - 0.7
                    - - 0.9
                      - 0.7
                      - 1
                  referenceCorrelationMatrix:
                    - - 1
                      - 1
                      - 1
                    - - 1
                      - 1
                      - 1
                    - - 1
                      - 1
                      - 1
            schema:
              properties:
                assets:
                  minimum: 2
                  type: integer
                assetsCorrelationMatrix:
                  description: assetsCorrelationMatrix[i][j] is the correlation between the asset i and the asset j
                  items:
                    items:
                      type: number
                    minItems: 2
                    type: array
                  minItems: 2
                  type: array
                distanceMetric:
                  default: euclidean
                  description: The distance metric to use to compute the distance between the asset correlation matrix and the reference correlation matrix
                  enum:
                    - euclidean
                    - correlationMatrix
                    - bures
                  type: string
                referenceCorrelationMatrix:
                  description: referenceCorrelationMatrix[i][j] is the reference correlation between the asset i and the asset j
                  items:
                    items:
                      type: number
                    minItems: 2
                    type: array
                  minItems: 2
                  type: array
              required:
                - assets
                - assetsCorrelationMatrix
                - referenceCorrelationMatrix
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Computed distance
                  value:
                    assetsCorrelationMatrixDistance: 0.8366600265340757
              schema:
                properties:
                  assetsCorrelationMatrixDistance:
                    description: The computed distance between the two correlation matrices
                    minimum: 0
                    type: number
                required:
                  - assetsCorrelationMatrixDistance
                type: object
          description: OK
      summary: Correlation Matrix Distance
      tags:
        - Assets / Correlation Matrix
      x-codegen-request-body-name: body
  /assets/correlation/matrix/effective-rank:
    post:
      description: |
        Compute the effective rank of an asset correlation matrix.

        References
        * [Olivier Roy and Martin Vetterli, The effective rank: A measure of effective dimensionality, 15th European Signal Processing Conference, 2007](https://ieeexplore.ieee.org/document/7098875)
      requestBody:
        content:
          application/json:
            examples:
              Example:
                description: Compute the effective rank of a correlation matrix of 2 assets
                value:
                  assets: 2
                  assetsCorrelationMatrix:
                    - - 1
                      - 0
                    - - 0
                      - 1
            schema:
              properties:
                assets:
                  description: The number of assets
                  minimum: 2
                  type: integer
                assetsCorrelationMatrix:
                  description: assetsCorrelationMatrix[i][j] is the correlation between the asset i and the asset j
                  items:
                    items:
                      type: number
                    minItems: 2
                    type: array
                  minItems: 2
                  type: array
              required:
                - assets
                - assetsCorrelationMatrix
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Computed effective rank
                  value:
                    assetsCorrelationMatrixEffectiveRank: 2
              schema:
                properties:
                  assetsCorrelationMatrixEffectiveRank:
                    description: The effective rank of the asset correlation matrix
                    items:
                      items:
                        type: number
                      minItems: 2
                      type: array
                    minItems: 2
                    type: array
                required:
                  - assetsCorrelationMatrixEffectiveRank
                type: object
          description: OK
      summary: Correlation Matrix Effective Rank
      tags:
        - Assets / Correlation Matrix
      x-codegen-request-body-name: body
  /assets/correlation/matrix/informativeness:
    post:
      description: |
        Compute the informativeness of an asset correlation matrix, using one of the following distance metrics:
        * Euclidean distance (default), which is the distance induced by [the Frobenius norm](https://en.wikipedia.org/wiki/Matrix_norm#Frobenius_norm)
        * Correlation matrix distance, defined in the second reference, which corresponds to [the cosine distance](https://en.wikipedia.org/wiki/Cosine_similarity) between the two vectorized asset correlation matrices
        * Bures distance, defined in the third reference

         References
         * [Austin J. Brockmeier and Tingting Mu and Sophia Ananiadou and John Y. Goulermas, Quantifying the Informativeness of Similarity Measurements, Journal of Machine Learning Research, 2017](http://jmlr.org/papers/v18/16-296.html)
         * [M. Herdin, N. Czink, H. Ozcelik and E. Bonek, Correlation matrix distance, a meaningful measure for evaluation of non-stationary MIMO channels, 2005 IEEE 61st Vehicular Technology Conference, 2005, pp. 136-140 Vol. 1](https://ieeexplore.ieee.org/document/1543265)
         * [Rajendra Bhatia, Tanvi Jain, Yongdo Lim, On the Bures–Wasserstein distance between positive definite matrices, Expositiones Mathematicae, Volume 37, Issue 2, 2019](https://www.sciencedirect.com/science/article/pii/S0723086918300021)
      requestBody:
        content:
          application/json:
            examples:
              Example (Bures distance):
                description: Compute the informativeness of an asset correlation matrix usingn the Bures distance
                value:
                  assets: 3
                  assetsCorrelationMatrix:
                    - - 1
                      - 0.5
                      - 0.9
                    - - 0.5
                      - 1
                      - 0.7
                    - - 0.9
                      - 0.7
                      - 1
                  distanceMetric: bures
              Example (euclidean distance):
                description: Compute the informativeness of an asset correlation matrix usingn the euclidean distance
                value:
                  assets: 3
                  assetsCorrelationMatrix:
                    - - 1
                      - 0.5
                      - 0.9
                    - - 0.5
                      - 1
                      - 0.7
                    - - 0.9
                      - 0.7
                      - 1
            schema:
              properties:
                assets:
                  minimum: 2
                  type: integer
                assetsCorrelationMatrix:
                  description: assetsCorrelationMatrix[i][j] is the correlation between the asset i and the asset j
                  items:
                    items:
                      type: number
                    minItems: 2
                    type: array
                  minItems: 2
                  type: array
                distanceMetric:
                  default: euclidean
                  description: The distance metric to use to compute the informativeness of the asset correlation matrix
                  enum:
                    - euclidean
                    - correlationMatrix
                    - bures
                  type: string
              required:
                - assets
                - assetsCorrelationMatrix
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Computed informativeness
                  value:
                    assetsCorrelationMatrixInformativeness: 0.020539611658192996
              schema:
                properties:
                  assetsCorrelationMatrixInformativeness:
                    description: The informativeness of the asset correlation matrix
                    minimum: 0
                    type: number
                required:
                  - assetsCorrelationMatrixInformativeness
                type: object
          description: OK
      summary: Correlation Matrix Informativeness
      tags:
        - Assets / Correlation Matrix
      x-codegen-request-body-name: body
  /assets/correlation/matrix/nearest:
    post:
      description: |
        Compute the _closest_ - in terms of [the Frobenius norm](https://en.wikipedia.org/wiki/Matrix_norm#Frobenius_norm) - asset correlation matrix to an approximate asset correlation matrix, optionally keeping a selected number of correlations fixed.

        References
        * [Nicholas J. Higham, Computing the Nearest Correlation Matrix—A Problem from Finance, IMA J. Numer. Anal. 22, 329–343, 2002.](http://www.maths.manchester.ac.uk/~higham/narep/narep369.pdf)
      requestBody:
        content:
          application/json:
            examples:
              Nearest correlation matrix:
                description: Compute the nearest correlation matrix to an approximate correlation matrix
                value:
                  assets: 3
                  assetsApproximateCorrelationMatrix:
                    - - 1
                      - 1
                      - 0
                    - - 1
                      - 1
                      - 1
                    - - 0
                      - 1
                      - 1
              Nearest correlation matrix with fixed a correlation:
                description: Compute the nearest correlation matrix to an approximate correlation matrix, keeping one correlation coefficient fixed
                value:
                  assets: 3
                  assetsApproximateCorrelationMatrix:
                    - - 1
                      - 0.5
                      - 0.9
                    - - 0.5
                      - 1
                      - -0.2
                    - - 0.9
                      - -0.2
                      - 1
                  assetsFixedCorrelations:
                    - - 2
                      - 3
            schema:
              properties:
                assets:
                  description: The number of assets
                  minimum: 2
                  type: integer
                assetsApproximateCorrelationMatrix:
                  description: assetsApproximateCorrelationMatrix[i][i] is the approximate correlation between the asset i and the asset j
                  items:
                    items:
                      type: number
                    minItems: 2
                    type: array
                  minItems: 2
                  type: array
                assetsFixedCorrelations:
                  description: assetsFixedCorrelations[k] is the couple of indices (i,j) of the assets i and j for which to keep the approximate correlation assetsApproximateCorrelationMatrix[i][j] fixed
                  items:
                    items:
                      type: integer
                    maxItems: 2
                    minItems: 2
                    type: array
                  type: array
              required:
                - assets
                - assetsApproximateCorrelationMatrix
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Nearest correlation matrix:
                  description: Computed nearest correlation matrix
                  value:
                    assetsCorrelationMatrix:
                      - - 1
                        - 0.7606306078350177
                        - 0.15733356650676536
                      - - 0.7606306078350177
                        - 1
                        - 0.7606306078350177
                      - - 0.15733356650676536
                        - 0.7606306078350177
                        - 1
                Nearest correlation matrix with fixed a correlation:
                  description: Computed nearest correlation matrix keeping one correlation coefficient fixed
                  value:
                    assetsCorrelationMatrix:
                      - - 1
                        - 0.4314569968899409
                        - 0.7974943959465133
                      - - 0.4314569968899409
                        - 1
                        - -0.2
                      - - 0.7974943959465133
                        - -0.2
                        - 1
              schema:
                properties:
                  assetsCorrelationMatrix:
                    description: assetsCorrelationMatrix[i][j] is the correlation between the asset i and the asset j
                    items:
                      items:
                        type: number
                      minItems: 2
                      type: array
                    minItems: 2
                    type: array
                required:
                  - assetsCorrelationMatrix
                type: object
          description: OK
      summary: Nearest Correlation Matrix
      tags:
        - Assets / Correlation Matrix
      x-codegen-request-body-name: body
  /assets/correlation/matrix/random:
    post:
      description: |
        Generate an asset correlation matrix uniformly at random over the space of positive definite correlation matrices.

        References
        * [Joe, H., Generating random correlation matrices based on partial correlations. Journal of Multivariate Analysis, 2006, 97, 2177-2189](https://www.sciencedirect.com/science/article/pii/S0047259X05000886)
      requestBody:
        content:
          application/json:
            examples:
              Example:
                description: Generate a 2x2 correlation matrix
                value:
                  assets: 2
            schema:
              properties:
                assets:
                  description: The number of assets
                  minimum: 2
                  type: integer
              required:
                - assets
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Computed random correlation matrix
                  value:
                    assetsCorrelationMatrix:
                      - - 1
                        - 0.7606306078350177
                        - 0.15733356650676536
                      - - 0.7606306078350177
                        - 1
                        - 0.7606306078350177
                      - - 0.15733356650676536
                        - 0.7606306078350177
                        - 1
              schema:
                properties:
                  assetsCorrelationMatrix:
                    description: assetsCorrelationMatrix[i][j] is the correlation between the asset i and the asset j
                    items:
                      items:
                        type: number
                      minItems: 2
                      type: array
                    minItems: 2
                    type: array
                required:
                  - assetsCorrelationMatrix
                type: object
          description: OK
      summary: Random Correlation Matrix
      tags:
        - Assets / Correlation Matrix
      x-codegen-request-body-name: body
  /assets/correlation/matrix/shrinkage:
    post:
      description: |
        Compute an asset correlation matrix as a convex linear combination of an asset correlation matrix and a target correlation matrix, the target correlation matrix being either:  
         * An equicorrelation matrix made of 1
         * An equicorrelation matrix made of 0
         * An equicorrelation matrix made of -1/(n-1), with n the number of assets
         * A provided correlation matrix
         
         References
         * [Steiner, Andreas, Manipulating Valid Correlation Matrices](https://papers.ssrn.com/sol3/papers.cfm?abstract_id=1878165)
      requestBody:
        content:
          application/json:
            examples:
              Shrinkage toward a provided correlation matrix:
                description: Shrinkage toward a provided correlation matrix, here the identity matrix
                value:
                  assets: 3
                  assetsCorrelationMatrix:
                    - - 1
                      - 0.5
                      - 0.9
                    - - 0.5
                      - 1
                      - 0.7
                    - - 0.9
                      - 0.7
                      - 1
                  shrinkageFactor: 0.5
                  targetCorrelationMatrix:
                    - - 1
                      - 0
                      - 0
                    - - 0
                      - 1
                      - 0
                    - - 0
                      - 0
                      - 1
              Shrinkage toward an equicorrelation matrix:
                description: Shrinkage toward the equicorrelation matrix made of 1
                value:
                  assets: 3
                  assetsCorrelationMatrix:
                    - - 1
                      - 0.5
                      - 0.9
                    - - 0.5
                      - 1
                      - 0.7
                    - - 0.9
                      - 0.7
                      - 1
                  shrinkageFactor: 0.5
                  targetEquicorrelationMatrix: maximumEquicorrelationMatrix
            schema:
              oneOf:
                - properties:
                    assets:
                      minimum: 2
                      type: integer
                    assetsCorrelationMatrix:
                      description: assetsCorrelationMatrix[i][j] is the correlation between the asset i and the asset j
                      items:
                        items:
                          type: number
                        minItems: 2
                        type: array
                      minItems: 2
                      type: array
                    shrinkageFactor:
                      description: The shrinkage factor
                      maximum: 1
                      minimum: 0
                      type: number
                    targetEquicorrelationMatrix:
                      description: The shrinkage target correlation matrix
                      enum:
                        - minimumEquicorrelationMatrix
                        - zeroEquicorrelationMatrix
                        - maximumEquicorrelationMatrix
                      type: string
                  required:
                    - assets
                    - assetsCorrelationMatrix
                    - targetEquicorrelationMatrix
                    - shrinkageFactor
                  type: object
                - properties:
                    assets:
                      minimum: 2
                      type: integer
                    assetsCorrelationMatrix:
                      description: assetsCorrelationMatrix[i][j] is the correlation between the asset i and the asset j
                      items:
                        items:
                          type: number
                        minItems: 2
                        type: array
                      minItems: 2
                      type: array
                    shrinkageFactor:
                      maximum: 1
                      minimum: 0
                      type: number
                    targetCorrelationMatrix:
                      description: targetCorrelationMatrix[i][j] is the target correlation between the asset i and the asset j
                      items:
                        items:
                          type: number
                        minItems: 2
                        type: array
                      minItems: 2
                      type: array
                  required:
                    - assets
                    - assetsCorrelationMatrix
                    - targetCorrelationMatrix
                    - shrinkageFactor
                  type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Shrinkage:
                  description: Shrunk correlation matrix
                  value:
                    assetsCorrelationMatrix:
                      - - 1
                        - 0.75
                        - 0.95
                      - - 0.75
                        - 1
                        - 0.85
                      - - 0.95
                        - 0.85
                        - 1
              schema:
                properties:
                  assetsCorrelationMatrix:
                    description: assetsCorrelationMatrix[i][j] is the correlation between the asset i and the asset j
                    items:
                      items:
                        type: number
                      minItems: 2
                      type: array
                    minItems: 2
                    type: array
                required:
                  - assetsCorrelationMatrix
                type: object
          description: OK
      summary: Correlation Matrix Shrinkage
      tags:
        - Assets / Correlation Matrix
      x-codegen-request-body-name: body
  /assets/correlation/matrix/theory-implied:
    post:
      description: |
        Compute the theory-implied asset correlation matrix associated with:
        * A hierarchical classification of a universe of assets
        * An asset correlation matrix

        References
        * [Lopez de Prado, Marcos Estimation of Theory-Implied Correlation Matrices (November 9, 2019)](https://papers.ssrn.com/sol3/papers.cfm?abstract_id=3484152)
      requestBody:
        content:
          application/json:
            examples:
              Example (integers):
                description: Compute the theory-implied asset correlation matrix of 2 assets, using their GICS hierarchical classification
                value:
                  assets:
                    - assetHierarchicalClassification:
                        - 35
                        - 3510
                        - 351010
                        - 35101010
                    - assetHierarchicalClassification:
                        - 20
                        - 2030
                        - 203020
                        - 20302010
                  assetsCorrelationMatrix:
                    - - 1
                      - -0.00035
                    - - -0.00035
                      - 1
              Example (strings):
                description: Compute the theory-implied asset correlation matrix of 3 assets, using their MSCI ACWI hierarchical classification
                value:
                  assets:
                    - assetHierarchicalClassification:
                        - acwi
                        - dm
                        - americas
                    - assetHierarchicalClassification:
                        - acwi
                        - dm
                        - americas
                    - assetHierarchicalClassification:
                        - standalone
                        - ""
                        - americas
                  assetsCorrelationMatrix:
                    - - 1
                      - 0.95
                      - 0.6
                    - - 0.95
                      - 1
                      - 0.65
                    - - 0.6
                      - 0.65
                      - 1
            schema:
              properties:
                assets:
                  items:
                    properties:
                      assetHierarchicalClassification:
                        description: assetHierarchicalClassification[i] is the i+1-th level of the hierarchical classification of the asset, from the most generic classification to the most specific classification; all the assetHierarchicalClassification arrays must have the same length
                        items:
                          oneOf:
                            - type: string
                            - type: integer
                        maxItems: 4
                        minItems: 1
                        type: array
                    required:
                      - assetHierarchicalClassification
                    type: object
                  minItems: 2
                  type: array
                assetsCorrelationMatrix:
                  description: assetsCorrelationMatrix[i][j] is the correlation between the asset i and the asset j
                  items:
                    items:
                      type: number
                    minItems: 2
                    type: array
                  minItems: 2
                  type: array
                clusteringMethod:
                  default: averageLinkage
                  description: The hierarchical clustering method to use
                  enum:
                    - singleLinkage
                    - averageLinkage
                    - completeLinkage
                    - wardLinkage
                  type: string
              required:
                - assets
                - assetsCorrelationMatrix
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Computed theory-implied asset correlation matrix
                  value:
                    assetsCorrelationMatrix:
                      - - 1
                        - -0.00034999999999985043
                      - - -0.00034999999999985043
                        - 1
              schema:
                properties:
                  assetsCorrelationMatrix:
                    description: assetsCorrelationMatrix[i][j] is the correlation between the asset i and the asset j
                    items:
                      items:
                        type: number
                      minItems: 2
                      type: array
                    minItems: 2
                    type: array
                required:
                  - assetsCorrelationMatrix
                type: object
          description: OK
      summary: Theory-Implied Correlation Matrix
      tags:
        - Assets / Correlation Matrix
      x-codegen-request-body-name: body
  /assets/correlation/matrix/validation:
    post:
      description: |
        Validate whether a matrix is an asset correlation matrix.

        References
        * [Wikipedia, Correlation and Dependence](https://en.wikipedia.org/wiki/Correlation_and_dependence#Correlation_matrices)
      requestBody:
        content:
          application/json:
            examples:
              Example:
                description: Validate whether the provided matrix is a correlation matrix
                value:
                  assets: 2
                  assetsCorrelationMatrix:
                    - - 1
                      - -0.00035
                    - - -0.00035
                      - 1
            schema:
              properties:
                assets:
                  description: The number of assets
                  minimum: 2
                  type: integer
                assetsCorrelationMatrix:
                  description: assetsCorrelationMatrix[i][j] is the correlation between the asset i and the asset j
                  items:
                    items:
                      type: number
                    minItems: 2
                    type: array
                  minItems: 2
                  type: array
              required:
                - assets
                - assetsCorrelationMatrix
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Valid correlation matrix
                  value:
                    message: valid correlation matrix
              schema:
                properties:
                  message:
                    description: Indicates whether the matrix is a valid correlation matrix
                    enum:
                      - valid correlation matrix
                      - invalid correlation matrix - non symmetric matrix
                      - invalid correlation matrix - non positive diagonal elements
                      - invalid correlation matrix - non positive semi-definite matrix
                    type: string
                required:
                  - message
                type: object
          description: OK
      summary: Correlation Matrix Validation
      tags:
        - Assets / Correlation Matrix
      x-codegen-request-body-name: body
  /assets/covariance/matrix:
    post:
      description: |
        Compute the covariance matrix of assets from either:  
        * The asset correlation matrix and their volatilities (i.e., standard deviations)
        * The asset correlation matrix and their variances
        * The asset returns

        References
        * [Wikipedia, Covariance Matrix](https://en.wikipedia.org/wiki/Covariance_matrix)
      requestBody:
        content:
          application/json:
            examples:
              From asset correlation matrix and standard deviations:
                description: Compute the covariance matrix of 2 assets based on their correlation matrix and their standard deviations
                value:
                  assets: 2
                  assetsCorrelationMatrix:
                    - - 1
                      - -0.5
                    - - -0.5
                      - 1
                  assetsVolatilities:
                    - 0.1
                    - 0.05
              From asset correlation matrix and variances:
                description: Compute the covariance matrix of 2 assets based on their correlation matrix and their variances
                value:
                  assets: 2
                  assetsCorrelationMatrix:
                    - - 1
                      - -0.5
                    - - -0.5
                      - 1
                  assetsVariances:
                    - 0.01
                    - 0.0025
              From assets returns:
                description: Compute the covariance matrix of 2 assets based on 4 returns per asset
                value:
                  assets:
                    - assetReturns:
                        - 0.01
                        - 0
                        - 0.02
                        - -0.03
                    - assetReturns:
                        - 0.01
                        - 0
                        - 0.02
                        - -0.03
            schema:
              oneOf:
                - properties:
                    assets:
                      items:
                        properties:
                          assetReturns:
                            description: assetReturns[t] is the return of the asset at the time t; all the assetReturns arrays must have the same length
                            items:
                              type: number
                            minItems: 2
                            type: array
                        required:
                          - assetReturns
                        type: object
                      minItems: 2
                      type: array
                  required:
                    - assets
                  type: object
                - properties:
                    assets:
                      description: The number of assets
                      minimum: 2
                      type: integer
                    assetsCorrelationMatrix:
                      description: assetsCorrelationMatrix[i][j] is the correlation between the asset i and the asset j
                      items:
                        items:
                          type: number
                        minItems: 2
                        type: array
                      minItems: 2
                      type: array
                    assetsVariances:
                      description: assetsVariances[i] is the variance of the asset i
                      items:
                        minimum: 0
                        type: number
                      minItems: 2
                      type: array
                  required:
                    - assets
                    - assetsCorrelationMatrix
                    - assetsVariances
                  type: object
                - properties:
                    assets:
                      description: The number of assets
                      minimum: 2
                      type: integer
                    assetsCorrelationMatrix:
                      description: assetsCorrelationMatrix[i][j] is the correlation between the asset i and the asset j
                      items:
                        items:
                          type: number
                        minItems: 2
                        type: array
                      minItems: 2
                      type: array
                    assetsVolatilities:
                      description: assetsVolatilities[i] is the volatility of the asset i
                      items:
                        minimum: 0
                        type: number
                      minItems: 2
                      type: array
                  required:
                    - assets
                    - assetsCorrelationMatrix
                    - assetsVolatilities
                  type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                From correlation matrix and standard deviations:
                  description: Computed covariance matrix
                  value:
                    assetsCovarianceMatrix:
                      - - 0.010000000000000002
                        - -0.0025000000000000005
                      - - -0.0025000000000000005
                        - 0.0025000000000000005
                From correlation matrix and variances:
                  description: Computed covariance matrix
                  value:
                    assetsCovarianceMatrix:
                      - - 0.010000000000000002
                        - -0.0025000000000000005
                      - - -0.0025000000000000005
                        - 0.0025000000000000005
                From returns:
                  description: Computed covariance matrix
                  value:
                    assetsCovarianceMatrix:
                      - - 0.00035
                        - 0.00035
                      - - 0.00035
                        - 0.00035
              schema:
                properties:
                  assetsCovarianceMatrix:
                    description: assetsCovarianceMatrix[i][j] is the covariance between the asset i and the asset j
                    items:
                      items:
                        type: number
                      minItems: 2
                      type: array
                    minItems: 2
                    type: array
                required:
                  - assetsCovarianceMatrix
                type: object
          description: OK
      summary: Covariance Matrix
      tags:
        - Assets / Covariance Matrix
      x-codegen-request-body-name: body
  /assets/covariance/matrix/effective-rank:
    post:
      description: |
        Compute the effective rank of an asset covariance matrix.

        References
        * [Olivier Roy and Martin Vetterli, The effective rank: A measure of effective dimensionality, 15th European Signal Processing Conference, 2007](https://ieeexplore.ieee.org/document/7098875)
      requestBody:
        content:
          application/json:
            examples:
              Example:
                description: Compute the effective rank of a covariance matrix of 2 assets
                value:
                  assets: 2
                  assetsCovarianceMatrix:
                    - - 0.00035
                      - -0.00035
                    - - -0.00035
                      - 0.00035
            schema:
              properties:
                assets:
                  description: The number of assets
                  minimum: 2
                  type: integer
                assetsCovarianceMatrix:
                  description: assetsCovarianceMatrix[i][j] is the covariance between the asset i and the asset j
                  items:
                    items:
                      type: number
                    minItems: 2
                    type: array
                  minItems: 2
                  type: array
              required:
                - assets
                - assetsCovarianceMatrix
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Computed effective rank
                  value:
                    assetsCovarianceMatrixEffectiveRank: 1
              schema:
                properties:
                  assetsCovarianceMatrixEffectiveRank:
                    description: The effective rank of the asset covariance matrix
                    items:
                      items:
                        type: number
                      minItems: 2
                      type: array
                    minItems: 2
                    type: array
                required:
                  - assetsCovarianceMatrixEffectiveRank
                type: object
          description: OK
      summary: Covariance Matrix Effective Rank
      tags:
        - Assets / Covariance Matrix
      x-codegen-request-body-name: body
  /assets/covariance/matrix/exponentially-weighted:
    post:
      description: |
        Compute an exponentially weighted covariance matrix of assets returns.

        References
        * [RiskMetrics Group. Longerstaey, J. (1996). RiskMetrics technical document, Technical Report fourth edition](https://www.msci.com/documents/10199/5915b101-4206-4ba0-aee2-3449d5c7e95a)
      requestBody:
        content:
          application/json:
            examples:
              Example:
                description: Computes an exponentially weighted covariance matrix of 2 assets based on 4 returns per asset and a decay factor of 0.5
                value:
                  assets:
                    - assetReturns:
                        - 0.01
                        - 0.01
                        - 0.02
                        - 0.01
                    - assetReturns:
                        - -0.02
                        - -0.02
                        - -0.04
                        - -0.02
                  decayFactor: 0.5
            schema:
              properties:
                assets:
                  items:
                    properties:
                      assetReturns:
                        description: assetReturns[t] is the return of the asset at the time t; all the assetReturns arrays must have the same length
                        items:
                          type: number
                        minItems: 2
                        type: array
                    required:
                      - assetReturns
                    type: object
                  minItems: 2
                  type: array
                decayFactor:
                  default: 0.94
                  description: The exponential decay factor
                  exclusiveMaximum: true
                  exclusiveMinimum: true
                  maximum: 1
                  minimum: 0
                  type: number
              required:
                - assets
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Computed exponentially weighted covariance matrix
                  value:
                    assetsCovarianceMatrix:
                      - - 0.000019583333333333333
                        - -0.000039166666666666665
                      - - -0.000039166666666666665
                        - 0.00007833333333333333
              schema:
                properties:
                  assetsCovarianceMatrix:
                    description: assetsCovarianceMatrix[i][j] is the sample covariance between the asset i returns and the asset j returns
                    items:
                      items:
                        type: number
                      minItems: 2
                      type: array
                    minItems: 2
                    type: array
                required:
                  - assetsCovarianceMatrix
                type: object
          description: OK
      summary: Exponentially Weighted Covariance Matrix
      tags:
        - Assets / Covariance Matrix
      x-codegen-request-body-name: body
  /assets/covariance/matrix/validation:
    post:
      description: |
        Validate whether a matrix is a covariance matrix.

        References
        * [Wikipedia, Covariance Matrix](https://en.wikipedia.org/wiki/Covariance_matrix)
      requestBody:
        content:
          application/json:
            examples:
              Example:
                description: Validate whether the provided matrix is a covariance matrix
                value:
                  assets: 2
                  assetsCovarianceMatrix:
                    - - 0.00035
                      - -0.00035
                    - - -0.00035
                      - 0.00035
            schema:
              properties:
                assets:
                  description: The number of assets
                  minimum: 2
                  type: integer
                assetsCovarianceMatrix:
                  description: assetsCovarianceMatrix[i][j] is the covariance between the asset i and the asset j
                  items:
                    items:
                      type: number
                    minItems: 2
                    type: array
                  minItems: 2
                  type: array
              required:
                - assets
                - assetsCovarianceMatrix
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Valid covariance matrix
                  value:
                    message: valid covariance matrix
              schema:
                properties:
                  message:
                    description: Indicates whether the matrix is a valid covariance matrix
                    enum:
                      - valid covariance matrix
                      - invalid covariance matrix - non symmetric matrix
                      - invalid covariance matrix - non positive diagonal elements
                      - invalid covariance matrix - non positive semi-definite matrix
                    type: string
                required:
                  - message
                type: object
          description: OK
      summary: Covariance Matrix Validation
      tags:
        - Assets / Covariance Matrix
      x-codegen-request-body-name: body
  /assets/kurtosis:
    post:
      description: |
        Compute the kurtosis of one or several asset(s), from the asset returns.

        References
        * [Wikipedia, Kurtosis](https://en.wikipedia.org/wiki/Kurtosis)
      requestBody:
        content:
          application/json:
            examples:
              Example:
                description: Compute the kurtosis of 1 asset based on 4 returns
                value:
                  assets:
                    - assetReturns:
                        - 0.01
                        - 0
                        - 0.02
                        - -0.03
            schema:
              properties:
                assets:
                  items:
                    properties:
                      assetReturns:
                        description: assetReturns[t] is the return of the asset at the time t
                        items:
                          type: number
                        minItems: 4
                        type: array
                    required:
                      - assetReturns
                    type: object
                  minItems: 1
                  type: array
              required:
                - assets
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Computed kurtosis of 1 assetx
                  value:
                    assets:
                      - assetKurtosis: 2
              schema:
                properties:
                  assets:
                    items:
                      properties:
                        assetKurtosis:
                          description: The kurtosis of the asset
                          type: number
                      required:
                        - assetKurtosis
                      type: object
                    type: array
                required:
                  - assets
                type: object
          description: OK
      summary: Kurtosis
      tags:
        - Assets / Kurtosis
      x-codegen-request-body-name: body
  /assets/prices/adjusted:
    post:
      description: |
        Compute the backward-adjusted prices of one or several asset(s) for one or several date(s) from:
        * Unadjusted prices
        * Capital distributions, like stock dividends
        * Splits, like stock splits

        The adjustment base date is chosen to be the last date for which unadjusted prices are available, which implies that:
        * The price on the last date for which unadjusted prices are available is left unadjusted
        * The price on any other date is adjusted based on the capital distributions and the splits which occurred between this date and the last date for which unadjusted prices are available

        References
        * [Center for Research in Security Prices](https://www.crsp.org/products/documentation/crsp-calculations)
      requestBody:
        content:
          application/json:
            examples:
              Example:
                description: Illustrate the 1-to-5 TSLA stock split which took place on August 31, 2020
                value:
                  assets:
                    - assetPrices:
                        - close: 2213.4
                          date: 2020-08-28
                        - close: 498.32
                          date: 2020-08-31
                        - close: 475.05
                          date: 2020-09-01
                      assetSplits:
                        - date: 2020-08-31
                          factor: 5
            schema:
              properties:
                assets:
                  items:
                    properties:
                      assetDividends:
                        description: assetDividends[t] contains dividend information for the asset at the date t
                        items:
                          properties:
                            amount:
                              description: The dividend amount distributed by the asset at the date t
                              exclusiveMinimum: true
                              minimum: 0
                              type: number
                            date:
                              description: The date corresponding to the date t in format YYYY-MM-DD, which is usually the ex-distribution date
                              type: string
                          required:
                            - date
                            - amount
                          type: object
                        type: array
                      assetPrices:
                        description: assetPrices[t] contains price information for the asset at the date t
                        items:
                          properties:
                            close:
                              description: The unadjusted close price of the asset at the date t
                              exclusiveMinimum: true
                              minimum: 0
                              type: number
                            date:
                              description: The date corresponding to the date t in format YYYY-MM-DD
                              type: string
                          required:
                            - date
                            - close
                          type: object
                        minItems: 1
                        type: array
                      assetSplits:
                        description: assetSplits[t] contains split information for the asset at the date t
                        items:
                          properties:
                            date:
                              description: The date corresponding to the date t in format YYYY-MM-DD, which is usually the ex-distribution date
                              type: string
                            factor:
                              description: The split factor of the asset at the date t
                              exclusiveMinimum: true
                              minimum: 0
                              type: number
                          required:
                            - date
                            - factor
                          type: object
                        type: array
                    required:
                      - assetPrices
                    type: object
                  minItems: 1
                  type: array
              required:
                - assets
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Illustrate the 1-to-5 TSLA stock split which took place on August 31, 2020
                  value:
                    assets:
                      - assetAdjustedPrices:
                          - date: 2020-09-01
                            fullyAdjustedClose: 475.05
                            splitAdjustedClose: 475.05
                          - date: 2020-08-31
                            fullyAdjustedClose: 498.32
                            splitAdjustedClose: 498.32
                          - date: 2020-08-28
                            fullyAdjustedClose: 442.68
                            splitAdjustedClose: 442.68
              schema:
                properties:
                  assets:
                    items:
                      properties:
                        assetAdjustedPrices:
                          description: assetAdjustedPrices[t] contains adjusted price information for the asset at the date t
                          items:
                            properties:
                              date:
                                description: The date corresponding to the date t in format YYYY-MM-DD
                                type: string
                              dividendAdjustedClose:
                                description: The dividend(s) adjusted close price of the asset at the date t, only present if dividend(s) information are provided
                                exclusiveMinimum: true
                                minimum: 0
                                type: number
                              fullyAdjustedClose:
                                description: The dividend(s) and split(s) adjusted close price of the asset at the date t
                                exclusiveMinimum: true
                                minimum: 0
                                type: number
                              splitAdjustedClose:
                                description: The split(s) adjusted close price of the asset at the date t, only present if split(s) information are provided
                                exclusiveMinimum: true
                                minimum: 0
                                type: number
                            required:
                              - date
                              - fullyAdjustedClose
                            type: object
                          minItems: 1
                          type: array
                      required:
                        - assetAdjustedPrices
                      type: object
                    type: array
                required:
                  - assets
                type: object
          description: OK
      summary: Adjusted Prices
      tags:
        - Assets / Prices
      x-codegen-request-body-name: body
  /assets/prices/adjusted/forward:
    post:
      description: |
        Compute the forward-adjusted prices of one or several asset(s) for one or several date(s) from:
        * Unadjusted prices
        * Capital distributions, like stock dividends
        * Splits, like stock splits

        The adjustment base date is chosen to be the first date for which unadjusted prices are available, which implies that:
        * The price on the first date for which unadjusted prices are available is left unadjusted
        * The price on any other date is adjusted based on the capital distributions and the splits which occurred between this date and the first date for which unadjusted prices are available

        References
        * [Center for Research in Security Prices](https://www.crsp.org/products/documentation/crsp-calculations)
      requestBody:
        content:
          application/json:
            examples:
              Example:
                description: Illustrate the 1-to-5 TSLA stock split which took place on August 31, 2020
                value:
                  assets:
                    - assetPrices:
                        - close: 2213.4
                          date: 2020-08-28
                        - close: 498.32
                          date: 2020-08-31
                        - close: 475.05
                          date: 2020-09-01
                      assetSplits:
                        - date: 2020-08-31
                          factor: 5
            schema:
              properties:
                assets:
                  items:
                    properties:
                      assetDividends:
                        description: assetDividends[t] contains dividend information for the asset at the date t
                        items:
                          properties:
                            amount:
                              description: The dividend amount distributed by the asset at the date t
                              exclusiveMinimum: true
                              minimum: 0
                              type: number
                            date:
                              description: The date corresponding to the date t in format YYYY-MM-DD, which is usually the ex-distribution date
                              type: string
                          required:
                            - date
                            - amount
                          type: object
                        type: array
                      assetPrices:
                        description: assetPrices[t] contains price information for the asset at the date t
                        items:
                          properties:
                            close:
                              description: The unadjusted close price of the asset at the date t
                              exclusiveMinimum: true
                              minimum: 0
                              type: number
                            date:
                              description: The date corresponding to the date t in format YYYY-MM-DD
                              type: string
                          required:
                            - date
                            - close
                          type: object
                        minItems: 1
                        type: array
                      assetSplits:
                        description: assetSplits[t] contains split information for the asset at the date t
                        items:
                          properties:
                            date:
                              description: The date corresponding to the date t in format YYYY-MM-DD, which is usually the ex-distribution date
                              type: string
                            factor:
                              description: The split factor of the asset at the date t
                              exclusiveMinimum: true
                              minimum: 0
                              type: number
                          required:
                            - date
                            - factor
                          type: object
                        type: array
                    required:
                      - assetPrices
                    type: object
                  minItems: 1
                  type: array
              required:
                - assets
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Illustrate the 1-to-5 TSLA stock split which took place on August 31, 2020
                  value:
                    assets:
                      - assetAdjustedPrices:
                          - date: 2020-08-28
                            fullyAdjustedClose: 2213.4
                            splitAdjustedClose: 2213.4
                          - date: 2020-08-31
                            fullyAdjustedClose: 2491.6
                            splitAdjustedClose: 2491.6
                          - date: 2020-09-01
                            fullyAdjustedClose: 2375.25
                            splitAdjustedClose: 2375.25
              schema:
                properties:
                  assets:
                    items:
                      properties:
                        assetAdjustedPrices:
                          description: assetAdjustedPrices[t] contains adjusted price information for the asset at the date t
                          items:
                            properties:
                              date:
                                description: The date corresponding to the date t in format YYYY-MM-DD
                                type: string
                              dividendAdjustedClose:
                                description: The dividend(s) adjusted close price of the asset at the date t, only present if dividend(s) information are provided
                                exclusiveMinimum: true
                                minimum: 0
                                type: number
                              fullyAdjustedClose:
                                description: The dividend(s) and split(s) adjusted close price of the asset at the date t
                                exclusiveMinimum: true
                                minimum: 0
                                type: number
                              splitAdjustedClose:
                                description: The split(s) adjusted close price of the asset at the date t, only present if split(s) information are provided
                                exclusiveMinimum: true
                                minimum: 0
                                type: number
                            required:
                              - date
                              - fullyAdjustedClose
                            type: object
                          minItems: 1
                          type: array
                      required:
                        - assetAdjustedPrices
                      type: object
                    type: array
                required:
                  - assets
                type: object
          description: OK
      summary: Forward-Adjusted Prices
      tags:
        - Assets / Prices
      x-codegen-request-body-name: body
  /assets/returns:
    post:
      description: |
        Compute the arithmetic return(s) of one or several asset(s) for one or several time period(s).

        References
        * [Wikipedia, Rate of Return](https://en.wikipedia.org/wiki/Rate_of_return#Return)
      requestBody:
        content:
          application/json:
            examples:
              Example:
                description: Compute the arithmetic returns of 2 assets, one with prices 1,2 and the other with prices 2,3,6
                value:
                  assets:
                    - assetPrices:
                        - 1
                        - 2
                    - assetPrices:
                        - 2
                        - 3
                        - 6
            schema:
              properties:
                assets:
                  items:
                    properties:
                      assetPrices:
                        description: assetPrices[t] is the price of the asset at the time t
                        items:
                          exclusiveMinimum: true
                          minimum: 0
                          type: number
                        minItems: 2
                        type: array
                    required:
                      - assetPrices
                    type: object
                  minItems: 1
                  type: array
              required:
                - assets
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Computed arithmetic returns for 2 assets
                  value:
                    assets:
                      - assetReturns:
                          - 1
                      - assetReturns:
                          - 0.5
                          - 1
              schema:
                properties:
                  assets:
                    items:
                      properties:
                        assetReturns:
                          description: assetReturns[t] is the arithmetic return of the asset from the time t-1 to the time t, in percentage
                          items:
                            type: number
                          type: array
                      required:
                        - assetReturns
                      type: object
                    type: array
                required:
                  - assets
                type: object
          description: OK
      summary: Arithmetic Returns
      tags:
        - Assets / Returns
      x-codegen-request-body-name: body
  /assets/returns/average:
    post:
      description: |
        Compute the arithmetic average of the return(s) of one or several asset(s).

        References
        * [Wikipedia, Arithmetic Average Rate of Return](https://en.wikipedia.org/wiki/Rate_of_return#Arithmetic_average_rate_of_return)
      requestBody:
        content:
          application/json:
            examples:
              Example:
                description: Compute the arithmetic average return of 2 assets, one with returns 10%, -5% and the other with returns 0%,-1%,1%
                value:
                  assets:
                    - assetReturns:
                        - 0.1
                        - -0.05
                    - assetReturns:
                        - 0
                        - -0.01
                        - 0.01
            schema:
              properties:
                assets:
                  items:
                    properties:
                      assetReturns:
                        description: assetReturns[t] is the return of the asset at the time t
                        items:
                          type: number
                        minItems: 1
                        type: array
                    required:
                      - assetReturns
                    type: object
                  minItems: 1
                  type: array
              required:
                - assets
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Computed average arithmetic return of 2.5% for the first asset, and average arithmetic return of 0% for the second asset
                  value:
                    assets:
                      - assetAverageReturn: 0.025
                      - assetAverageReturn: 0
              schema:
                properties:
                  assets:
                    items:
                      properties:
                        assetAverageReturn:
                          description: The arithmetic average return of the asset
                          type: number
                      required:
                        - assetAverageReturn
                      type: object
                    type: array
                required:
                  - assets
                type: object
          description: OK
      summary: Arithmetic Average Return
      tags:
        - Assets / Returns
      x-codegen-request-body-name: body
  /assets/returns/logarithmic:
    post:
      description: |
        Compute the logarithmic return(s) of one or several asset(s) for one or several time period(s).

        References
        * [Wikipedia, Logarithmic or continuously compounded return](https://en.wikipedia.org/wiki/Rate_of_return#Logarithmic_or_continuously_compounded_return)
      requestBody:
        content:
          application/json:
            examples:
              Example:
                description: Compute the logarithmic returns of 2 assets, one with prices 1,2 and the other with prices 2,3,6
                value:
                  assets:
                    - assetPrices:
                        - 1
                        - 2
                    - assetPrices:
                        - 2
                        - 3
                        - 6
            schema:
              properties:
                assets:
                  items:
                    properties:
                      assetPrices:
                        description: assetPrices[t] is the price of the asset at the time t
                        items:
                          exclusiveMinimum: true
                          minimum: 0
                          type: number
                        minItems: 2
                        type: array
                    required:
                      - assetPrices
                    type: object
                  minItems: 1
                  type: array
              required:
                - assets
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Computed logarithmic returns for 2 assets
                  value:
                    assets:
                      - assetReturns:
                          - 0.6931471805599453
                      - assetReturns:
                          - 0.4054651081081644
                          - 0.6931471805599453
              schema:
                properties:
                  assets:
                    items:
                      properties:
                        assetReturns:
                          description: assetReturns[t] is the logarithmic return of the asset from the time t-1 to the time t, in percentage
                          items:
                            type: number
                          type: array
                      required:
                        - assetReturns
                      type: object
                    type: array
                required:
                  - assets
                type: object
          description: OK
      summary: Logarithmic Returns
      tags:
        - Assets / Returns
      x-codegen-request-body-name: body
  /assets/returns/simulation/bootstrap:
    post:
      description: |
        Simulate the return(s) of one or several asset(s) for one or several time period(s) using a bootstrap method.

        References
        * [Efron, B. (1979), Bootstrap methods: Another look at the jackknife, The Annals of Statistics 7, 1-26](https://projecteuclid.org/journals/annals-of-statistics/volume-7/issue-1/Bootstrap-Methods-Another-Look-at-the-Jackknife/10.1214/aos/1176344552.full)
        * [Politis, D. N. and Romano, J. P., A circular block resampling procedure for stationary data, in R. Lepage and L. Billard, eds, Exploring the Limits of Bootstrap, Wiley, New York, pp. 263-270](https://statistics.stanford.edu/technical-reports/circular-block-resampling-procedure-stationary-data)
        * [Politis, D. N. and Romano, J. P., The stationary bootstrap, Journal of the American Statistical Association 89, 1303-1313](https://www.jstor.org/stable/2290993)
      requestBody:
        content:
          application/json:
            examples:
              Example:
                description: Perform 5 simulations over 4 time periods of the returns of 2 assets using the circular block bootstrap method with a block length of 2 time periods.
                value:
                  assets:
                    - assetReturns:
                        - 0.1
                        - -0.05
                        - 0.01
                        - 0.025
                        - -0.1
                    - assetReturns:
                        - 0
                        - 0.01
                        - 0.02
                        - -0.01
                        - 0.05
                  bootstrapBlockLength: 2
                  bootstrapMethod: circularBlock
                  simulations: 5
                  simulationsLength: 4
            schema:
              properties:
                assets:
                  items:
                    properties:
                      assetReturns:
                        description: assetReturns[t] is the return of the asset over the time period t; all the assetReturns arrays must have the same length
                        items:
                          type: number
                        minItems: 2
                        type: array
                    required:
                      - assetReturns
                    type: object
                  minItems: 2
                  type: array
                bootstrapAverageBlockLength:
                  description: The average length of the blocks to use in case the bootstrap method is 'stationaryBlock', in time periods; if not provided, defaults to the inverse of 3.15 * the common length of the assetReturns arrays^1/3
                  minimum: 1
                  type: number
                bootstrapBlockLength:
                  description: The length of the blocks to use in case the bootstrap method is 'circularBlock', in time periods; if not provided, defaults to [3.15 * the common length of the assetReturns arrays^1/3]
                  minimum: 2
                  type: integer
                bootstrapMethod:
                  default: stationaryBlock
                  description: The bootstrap method to use
                  enum:
                    - iid
                    - circularBlock
                    - stationaryBlock
                  type: string
                simulations:
                  default: 1
                  description: The number of simulations to perform
                  minimum: 1
                  type: integer
                simulationsLength:
                  description: The number of time period(s) to simulate per simulation; if not provided, defaults to the common length of the assetReturns arrays
                  minimum: 1
                  type: integer
              required:
                - assets
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Results of 1 simulation of returns for 2 assets and for 2 time periods
                  value:
                    simulations:
                      - assets:
                          - assetReturns:
                              - 0.01
                              - 0.02
                          - assetReturns:
                              - 0.01
                              - -0.02
              schema:
                properties:
                  simulations:
                    items:
                      properties:
                        assets:
                          description: assets[i] is the data for the i-th asset
                          items:
                            properties:
                              assetReturns:
                                description: assetReturns[t] is the simulated return of the i-th asset for the t-th time period
                                items:
                                  type: number
                                minItems: 1
                                type: array
                            required:
                              - assetReturns
                            type: object
                          type: array
                      required:
                        - assets
                      type: object
                    type: array
                required:
                  - simulations
                type: object
          description: OK
      summary: Bootstrap
      tags:
        - Assets / Returns Simulation
      x-codegen-request-body-name: body
  /assets/returns/simulation/monte-carlo/cornish-fisher:
    post:
      description: |
        Simulate the return(s) of one asset for one or several time period(s) using a Cornish-Fisher distribution.

        References
        * [Maillard, Didier, A User’s Guide to the Cornish Fisher Expansion](https://papers.ssrn.com/sol3/papers.cfm?abstract_id=1997178)
        * [Lamb, John D., Maura E. Monville, and Kai-Hong Tee. Making Cornish–Fisher Fit for Risk Measurement, Journal of Risk, Volume 21, Number 5, p. 53-81](http://doi.org/10.21314/JOR.2019.408)
      requestBody:
        content:
          application/json:
            examples:
              Example:
                description: Perform 5 simulations over 4 time periods using a Cornish-Fisher distribution with mean parameter 5%, standard deviation parameter 20%, skewness parameter 0.5 and (excess) kurtosis parameter 1.
                value:
                  assetAverageReturnParameter: 0.05
                  assetKurtosisParameter: 1
                  assetSkewnessParameter: 0.5
                  assetVolatilityParameter: 0.2
                  simulations: 5
                  simulationsLength: 4
            schema:
              properties:
                assetAverageReturnParameter:
                  description: The mean parameter of the Cornish-Fisher distribution, corresponding to the arithmetic average return of the asset
                  type: number
                assetKurtosisParameter:
                  description: The (excess) kurtosis parameter of the Cornish-Fisher distribution, corresponding approximately to the (excess) kurtosis of the asset returns
                  type: number
                assetSkewnessParameter:
                  description: The skewness parameter of the Cornish-Fisher distribution, corresponding approximately to the skewness of the asset returns
                  type: number
                assetVolatilityParameter:
                  description: The volatility parameter of the Cornish-Fisher distribution, corresponding approximately to the volatility of the asset returns
                  exclusiveMinimum: true
                  minimum: 0
                  type: number
                simulations:
                  default: 1
                  description: The number of simulations to perform
                  minimum: 1
                  type: integer
                simulationsLength:
                  default: 1
                  description: The number of time period(s) to simulate per simulation
                  minimum: 1
                  type: integer
              required:
                - assetAverageReturnParameter
                - assetVolatilityParameter
                - assetSkewnessParameter
                - assetKurtosisParameter
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Results of 1 simulation of returns for 2 time periods
                  value:
                    simulations:
                      - assets:
                          - assetReturns:
                              - 0.01
                              - 0.02
              schema:
                properties:
                  simulations:
                    items:
                      properties:
                        assets:
                          description: assets[i] is the data for the i-th asset
                          items:
                            properties:
                              assetReturns:
                                description: assetReturns[t] is the simulated return of the i-th asset for the t-th time period
                                items:
                                  type: number
                                minItems: 1
                                type: array
                            required:
                              - assetReturns
                            type: object
                          maxItems: 1
                          minItems: 1
                          type: array
                      required:
                        - assets
                      type: object
                    type: array
                required:
                  - simulations
                type: object
          description: OK
      summary: Cornish-Fisher Distribution
      tags:
        - Assets / Monte Carlo Returns Simulation
      x-codegen-request-body-name: body
  /assets/returns/simulation/monte-carlo/cornish-fisher/corrected:
    post:
      description: |
        Simulate the return(s) of one asset for one or several time period(s) using a corrected Cornish-Fisher distribution.

        References
        * [Maillard, Didier, A User’s Guide to the Cornish Fisher Expansion](https://papers.ssrn.com/sol3/papers.cfm?abstract_id=1997178)
        * [Lamb, John D., Maura E. Monville, and Kai-Hong Tee. Making Cornish–fisher Fit for Risk Measurement, Journal of Risk, Volume 21, Number 5, p. 53-81](http://doi.org/10.21314/JOR.2019.408)
      requestBody:
        content:
          application/json:
            examples:
              Example:
                description: Perform 5 simulations over 4 time periods using a corrected Cornish-Fisher distribution with mean 5%, standard deviation 20%, skewness 0.5 and (excess) kurtosis 1.
                value:
                  assetAverageReturn: 0.05
                  assetKurtosis: 1
                  assetSkewness: 0.5
                  assetVolatility: 0.2
                  simulations: 5
                  simulationsLength: 4
            schema:
              properties:
                assetAverageReturn:
                  description: The arithmetic average return of the asset, corresponding to the mean of the corrected Cornish-Fisher distribution
                  type: number
                assetKurtosis:
                  description: The kurtosis of the asset returns, corresponding to the kurtosis of the Cornish-Fisher distribution
                  type: number
                assetSkewness:
                  description: The skewness of the asset returns, corresponding to the skewness of the Cornish-Fisher distribution
                  type: number
                assetVolatility:
                  description: The volatility of the asset returns, corresponding to the volatility of the Cornish-Fisher distribution
                  exclusiveMinimum: true
                  minimum: 0
                  type: number
                simulations:
                  default: 1
                  description: The number of simulations to perform
                  minimum: 1
                  type: integer
                simulationsLength:
                  default: 1
                  description: The number of time period(s) to simulate per simulation
                  minimum: 1
                  type: integer
              required:
                - assetAverageReturn
                - assetVolatility
                - assetSkewness
                - assetKurtosis
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Results of 1 simulation of returns for 2 time periods
                  value:
                    simulations:
                      - assets:
                          - assetReturns:
                              - 0.01
                              - 0.02
              schema:
                properties:
                  simulations:
                    items:
                      properties:
                        assets:
                          description: assets[i] is the data for the i-th asset
                          items:
                            properties:
                              assetReturns:
                                description: assetReturns[t] is the simulated return of the i-th asset for the t-th time period
                                items:
                                  type: number
                                minItems: 1
                                type: array
                            required:
                              - assetReturns
                            type: object
                          maxItems: 1
                          minItems: 1
                          type: array
                      required:
                        - assets
                      type: object
                    type: array
                required:
                  - simulations
                type: object
          description: OK
        "500":
          content:
            application/json:
              examples:
                Example:
                  description: Failed computation of skewness and kurtosis parameters
                  value:
                    message: "internal error: impossible to compute accurate Cornish-Fisher parameters"
          description: Failed computation of Cornish-Fisher skewness and (excess) kurtosis parameters corresponding to the asset skewness and (excess) kurtosis
      summary: Corrected Cornish-Fisher Distribution
      tags:
        - Assets / Monte Carlo Returns Simulation
      x-codegen-request-body-name: body
  /assets/returns/simulation/monte-carlo/gaussian:
    post:
      description: |
        Simulate the return(s) of one asset for one or several time period(s) using a Gaussian distribution.

        References
        * [Wikipedia, Normal distribution](https://en.wikipedia.org/wiki/Normal_distribution)
      requestBody:
        content:
          application/json:
            examples:
              Example:
                description: Perform 5 simulations over 4 time periods using a Gaussian distribution with mean 5% and standard deviation 20%.
                value:
                  assetAverageReturn: 0.05
                  assetVolatility: 0.2
                  simulations: 5
                  simulationsLength: 4
            schema:
              properties:
                assetAverageReturn:
                  description: The arithmetic average return of the asset, corresponding to the mean of the Gaussian distribution
                  type: number
                assetVolatility:
                  description: The volatility of the asset returns, corresponding to the standard deviation of the Gaussian distribution
                  exclusiveMinimum: true
                  minimum: 0
                  type: number
                simulations:
                  default: 1
                  description: The number of simulations to perform
                  minimum: 1
                  type: integer
                simulationsLength:
                  default: 1
                  description: The number of time period(s) to simulate per simulation
                  minimum: 1
                  type: integer
              required:
                - assetAverageReturn
                - assetVolatility
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Results of 1 simulation of returns for 2 time periods
                  value:
                    simulations:
                      - assets:
                          - assetReturns:
                              - 0.01
                              - 0.02
              schema:
                properties:
                  simulations:
                    items:
                      properties:
                        assets:
                          description: assets[i] is the data for the i-th asset
                          items:
                            properties:
                              assetReturns:
                                description: assetReturns[t] is the simulated return of the i-th asset for the t-th time period
                                items:
                                  type: number
                                minItems: 1
                                type: array
                            required:
                              - assetReturns
                            type: object
                          maxItems: 1
                          minItems: 1
                          type: array
                      required:
                        - assets
                      type: object
                    type: array
                required:
                  - simulations
                type: object
          description: OK
      summary: Gaussian Distribution
      tags:
        - Assets / Monte Carlo Returns Simulation
      x-codegen-request-body-name: body
  /assets/returns/turbulence-partitioned:
    post:
      description: |
        Partition asset returns into several subsets based on their turbulence index.

        References
        * [George Chow, Jacquier, E., Kritzman, M., & Kenneth Lowry. (1999). Optimal Portfolios in Good Times and Bad. Financial Analysts Journal, 55(3), 65–73.](https://www.jstor.org/stable/4480169)
      requestBody:
        content:
          application/json:
            examples:
              Example:
                description: Partition the asset returns of 2 assets, using two turbulence thresholds of 80% and 95%
                value:
                  assets:
                    - assetReturns:
                        - 0
                        - 0.1
                        - 0.05
                        - -0.01
                        - 0.025
                    - assetReturns:
                        - 0.005
                        - 0.05
                        - 0.1
                        - -0.02
                        - 0
                  turbulenceThresholds:
                    - 0.8
                    - 0.95
            schema:
              properties:
                assets:
                  items:
                    properties:
                      assetReturns:
                        description: assetReturns[t] is the return of the asset at the time t; all the assetReturns arrays must have the same length
                        items:
                          type: number
                        minItems: 2
                        type: array
                    required:
                      - assetReturns
                    type: object
                  minItems: 1
                  type: array
                turbulenceThresholds:
                  description: The turbulence threshold(s), in percentage; in case several turbulence thresholds are provided, they must be provided in increasing order
                  items:
                    exclusiveMaximum: true
                    exclusiveMinimum: true
                    maximum: 1
                    minimum: 0
                    type: number
                  maxItems: 3
                  minItems: 1
                  type: array
                turbulenceThresholdsConversionMethod:
                  default: chisquareInverseDistribution
                  description: The method to use to convert the turbulence threshold(s) into turbulence score(s)
                  enum:
                    - empiricalQuantileDistribution
                    - chisquareInverseDistribution
                  type: string
              required:
                - assets
                - turbulenceThresholds
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Computed partitioning of the asset returns of 2 assets, using 2 turbulence thresholds
                  value:
                    assets:
                      - assetTurbulencePartitionedReturns:
                          - assetReturns:
                              - 0
                              - -0.01
                              - 0.025
                          - assetReturns:
                              - 0.1
                              - 0.05
                          - assetReturns: []
                      - assetTurbulencePartitionedReturns:
                          - assetReturns:
                              - 0.005
                              - -0.02
                              - 0
                          - assetReturns:
                              - 0.05
                              - 0.1
                          - assetReturns: []
              schema:
                properties:
                  assets:
                    items:
                      properties:
                        assetTurbulencePartitionedReturns:
                          description: assetTurbulencePartitionedReturns[k] corresponds to all the asset returns whose turbulence index is lower than or equal to the turbulence score associated with the turbulence threshold turbulenceThresholds[k]; the length of the array assetTurbulencePartitionedReturns is equal to the length of the array turbulenceThresholds plus 1
                          items:
                            properties:
                              assetReturns:
                                description: assetReturns[t] is the return of the asset at a time t; the array assetReturns is possibly empty in case no asset returns have a turbulence index lower than or equal to the turbulence score associated with the turbulence threshold turbulenceThresholds[k]
                                items:
                                  type: number
                                minItems: 0
                                type: array
                            required:
                              - assetReturns
                            type: object
                          maxItems: 4
                          minItems: 2
                          type: array
                      required:
                        - assetTurbulencePartitionedReturns
                      type: object
                    type: array
                required:
                  - assets
                type: object
          description: OK
      summary: Turbulence-partitioned Asset Returns
      tags:
        - Assets / Returns
      x-codegen-request-body-name: body
  /assets/skewness:
    post:
      description: |
        Compute the skewness of one or several asset(s), from the asset returns.

        References
        * [Wikipedia, Skewness](https://en.wikipedia.org/wiki/Skewness)
      requestBody:
        content:
          application/json:
            examples:
              Example:
                description: Compute the skewness of 1 asset based on 4 returns
                value:
                  assets:
                    - assetReturns:
                        - 0.01
                        - 0
                        - 0.02
                        - -0.03
            schema:
              properties:
                assets:
                  items:
                    properties:
                      assetReturns:
                        description: assetReturns[t] is the return of the asset at the time t
                        items:
                          type: number
                        minItems: 3
                        type: array
                    required:
                      - assetReturns
                    type: object
                  minItems: 1
                  type: array
              required:
                - assets
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Computed skewness of 1 assetx
                  value:
                    assets:
                      - assetSkewness: -0.6872431934890911
              schema:
                properties:
                  assets:
                    items:
                      properties:
                        assetSkewness:
                          description: The skewness of the asset
                          type: number
                      required:
                        - assetSkewness
                      type: object
                    type: array
                required:
                  - assets
                type: object
          description: OK
      summary: Skewness
      tags:
        - Assets / Skewness
      x-codegen-request-body-name: body
  /assets/variance:
    post:
      description: |
        Compute the variance of one or several asset(s) from either:  
        * The asset returns
        * The asset covariance matrix
        * The asset volatility(ies)

        References
        * [Wikipedia, Variance](https://en.wikipedia.org/wiki/Variance)        
      requestBody:
        content:
          application/json:
            examples:
              From asset covariance matrix:
                description: Compute the variance of 2 assets based on their covariance matrix
                value:
                  assets: 2
                  assetsCovarianceMatrix:
                    - - 0.01
                      - -0.0025
                    - - -0.0025
                      - 0.0025
              From asset returns:
                description: Compute the variance of 2 assets based on 4 returns per asset
                value:
                  assets:
                    - assetReturns:
                        - 0.01
                        - 0
                        - 0.02
                        - -0.03
                    - assetReturns:
                        - 0.01
                        - 0
                        - 0.02
                        - -0.03
              From asset volatilities:
                description: Compute the variance of 2 assets based on their volatility
                value:
                  assets:
                    - assetVolatility: 1
                    - assetVolatility: 0.05
            schema:
              oneOf:
                - properties:
                    assets:
                      items:
                        properties:
                          assetReturns:
                            description: assetReturns[t] is the return of the asset at the time t
                            items:
                              type: number
                            minItems: 2
                            type: array
                        required:
                          - assetReturns
                        type: object
                      minItems: 1
                      type: array
                  required:
                    - assets
                  type: object
                - properties:
                    assets:
                      description: The number of assets
                      minimum: 2
                      type: integer
                    assetsCovarianceMatrix:
                      description: assetsCovarianceMatrix[i][j] is the covariance between the asset i and the asset j
                      items:
                        items:
                          type: number
                        minItems: 2
                        type: array
                      minItems: 2
                      type: array
                  required:
                    - assets
                    - assetsCovarianceMatrix
                  type: object
                - properties:
                    assets:
                      items:
                        properties:
                          assetVolatility:
                            description: The asset volatility
                            minimum: 0
                            type: number
                        required:
                          - assetVolatility
                        type: object
                      minItems: 1
                      type: array
                  required:
                    - assets
                  type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                From covariance matrix:
                  description: Computed variance of 2 assets
                  value:
                    assets:
                      - assetVariance: 0.01
                      - assetVariance: 0.0025
                From returns:
                  description: Computed variance of 2 assets
                  value:
                    assets:
                      - assetVariance: 0.00035
                      - assetVariance: 0.00035
                From volatilities:
                  description: Computed variance of 2 assets
                  value:
                    assets:
                      - assetVariance: 0.010000000000000002
                      - assetVariance: 0.0025000000000000005
              schema:
                properties:
                  assets:
                    items:
                      properties:
                        assetVariance:
                          description: The variance of the asset
                          minimum: 0
                          type: number
                      required:
                        - assetVariance
                      type: object
                    type: array
                required:
                  - assets
                type: object
          description: OK
      summary: Variance
      tags:
        - Assets / Variance
      x-codegen-request-body-name: body
  /assets/volatility:
    post:
      description: |
        Compute the volatility (i.e., standard deviation) of one or several asset(s) from either:  
        * The asset returns
        * The asset covariance matrix
        * The asset variance(s)

        References
        * [Wikipedia, Standard Deviation](https://en.wikipedia.org/wiki/Standard_deviation)
      requestBody:
        content:
          application/json:
            examples:
              From asset covariance matrix:
                description: Compute the volatility of 2 assets based on their covariance matrix
                value:
                  assets: 2
                  assetsCovarianceMatrix:
                    - - 0.01
                      - -0.0025
                    - - -0.0025
                      - 0.0025
              From asset returns:
                description: Compute the volatility of 2 assets based on 4 returns per asset
                value:
                  assets:
                    - assetReturns:
                        - 0.01
                        - 0
                        - 0.02
                        - -0.03
                    - assetReturns:
                        - 0.01
                        - 0
                        - 0.02
                        - -0.03
              From asset variance:
                description: Compute the volatility of 2 assets based on their variance
                value:
                  assets:
                    - assetVariance: 0.01
                    - assetVariance: 0.0025
            schema:
              oneOf:
                - properties:
                    assets:
                      items:
                        properties:
                          assetReturns:
                            description: assetReturns[t] is the return of the asset at the time t
                            items:
                              type: number
                            minItems: 2
                            type: array
                        required:
                          - assetReturns
                        type: object
                      minItems: 1
                      type: array
                  required:
                    - assets
                  type: object
                - properties:
                    assets:
                      description: The number of assets
                      minimum: 2
                      type: integer
                    assetsCovarianceMatrix:
                      description: assetsCovarianceMatrix[i][j] is the covariance between the asset i and the asset j
                      items:
                        items:
                          type: number
                        minItems: 2
                        type: array
                      minItems: 2
                      type: array
                  required:
                    - assets
                    - assetsCovarianceMatrix
                  type: object
                - properties:
                    assets:
                      items:
                        properties:
                          assetVariance:
                            description: The asset variance
                            minimum: 0
                            type: number
                        required:
                          - assetVariance
                        type: object
                      minItems: 1
                      type: array
                  required:
                    - assets
                  type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                From covariance matrix:
                  description: Computed volatility of 2 assets
                  value:
                    assets:
                      - assetVolatility: 0.1
                      - assetVolatility: 0.05
                From returns:
                  description: Computed volatility of 2 assets
                  value:
                    assets:
                      - assetVolatility: 0.01870828693386971
                      - assetVolatility: 0.01870828693386971
                From variances:
                  description: Computed volatility of 2 assets
                  value:
                    assets:
                      - assetVolatility: 0.1
                      - assetVolatility: 0.05
              schema:
                properties:
                  assets:
                    items:
                      properties:
                        assetVolatility:
                          description: The volatility of the asset
                          minimum: 0
                          type: number
                      required:
                        - assetVolatility
                      type: object
                    type: array
                required:
                  - assets
                type: object
          description: OK
      summary: Volatility
      tags:
        - Assets / Volatility
      x-codegen-request-body-name: body
  /factors/residualization:
    post:
      description: |
        Compute the residuals of a factor against a set of factors, using a returns-based linear regression analysis.

        References
        * [Factor Research, Factor Exposure Analysis: Exploring Residualization](https://insights.factorresearch.com/research-factor-exposure-analysis-exploring-residualization/)
        * [Catalina B. Garcia, Román Salmeron, Claudia Garcia & Jose Garcia (2019): Residualization: justification, properties and application, Journal of Applied Statistics](https://doi.org/10.1080/02664763.2019.1701638)
      requestBody:
        content:
          application/json:
            examples:
              Example:
                description: Residualize the returns of the first factor among a set of 2 factors, observed during 3 time periods
                value:
                  factors:
                    - factorReturns:
                        - 0.01
                        - 0.02
                        - -0.01
                    - factorReturns:
                        - 0.025
                        - 0.005
                        - -0.02
                  residualizedFactor: 1
            schema:
              properties:
                factors:
                  items:
                    properties:
                      factorReturns:
                        description: factorReturns[t] is the return of the factor at the time t; all the factorReturns arrays must have the same length
                        items:
                          type: number
                        minItems: 2
                        type: array
                    required:
                      - factorReturns
                    type: object
                  minItems: 2
                  type: array
                residualizedFactor:
                  description: The index of the factor to residualize
                  minimum: 1
                  type: integer
              required:
                - factors
                - residualizedFactor
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Computed returns of a residualized factor, observed during 3 time periods
                  value:
                    residualizedFactorReturns:
                      - -0.001885245901639342
                      - 0.017622950819672134
                      - -0.0004918032786885261
              schema:
                properties:
                  residualizedFactorReturns:
                    description: residualizedFactorReturns[t] is the return of the residualized factor at the time t
                    items:
                      type: number
                    type: array
                required:
                  - residualizedFactorReturns
                type: object
          description: OK
      summary: Residualization
      tags:
        - Factors
      x-codegen-request-body-name: body
  /portfolio/analysis/alpha:
    post:
      description: |
        Compute the Jensen’s alpha of one or several portfolio(s) in the Capital Asset Pricing Model (CAPM).

        References
        * Carl R. Bacon, Practical Portfolio Performance Measurement and Attribution  
      requestBody:
        content:
          application/json:
            examples:
              Example:
                description: Compute the Jensen’s alpha of one portfolio
                value:
                  benchmarkReturns:
                    - 0.002
                    - 0.025
                    - 0.018
                    - -0.011
                    - 0.014
                  portfolios:
                    - portfolioReturns:
                        - 0.003
                        - 0.026
                        - 0.011
                        - -0.01
                        - 0.015
                  riskFreeRate: 0.01
            schema:
              oneOf:
                - properties:
                    benchmarkReturns:
                      description: benchmarkReturns[t] is the return of the benchmark at the time t; the benchmarkReturns array must have the same length as all the portfolioReturns arrays
                      items:
                        type: number
                      minItems: 2
                      type: array
                    portfolios:
                      items:
                        properties:
                          portfolioReturns:
                            description: portfolioReturns[t] is the return of the portfolio at the time t, all the portfolioReturns arrays must have the same length, equal to the length of the benchmarkReturns array
                            items:
                              type: number
                            minItems: 2
                            type: array
                        required:
                          - portfolioReturns
                        type: object
                      minItems: 1
                      type: array
                    riskFreeRate:
                      description: The risk free rate, assumed to be constant for any time t
                      type: number
                  required:
                    - benchmarkReturns
                    - portfolios
                  type: object
                - properties:
                    benchmarkReturns:
                      description: benchmarkReturns[t] is the return of the benchmark at the time t; the benchmarkReturns array must have the same length as all the portfolioReturns arrays
                      items:
                        type: number
                      minItems: 2
                      type: array
                    portfolios:
                      items:
                        properties:
                          portfolioReturns:
                            description: portfolioReturns[t] is the return of the portfolio at the time t, all the portfolioReturns arrays must have the same length, equal to the length of the benchmarkReturns array
                            items:
                              type: number
                            minItems: 2
                            type: array
                        required:
                          - portfolioReturns
                        type: object
                      minItems: 1
                      type: array
                    riskFreeReturns:
                      description: riskFreeReturns[t] is the risk free return at the time t; the riskFreeReturns array must have the same length as all the portfolioReturns arrays
                      items:
                        type: number
                      minItems: 2
                      type: array
                  required:
                    - benchmarkReturns
                    - portfolios
                  type: object
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Computed Jensen's alpha of one portfolio
                  value:
                    portfolios:
                      - portfolioAlpha: -0.0006332179930795853
              schema:
                properties:
                  portfolios:
                    items:
                      properties:
                        portfolioAlpha:
                          description: The portfolio Jensen's alpha, which correponds to the portfolio excess return adjusted for the systematic risk in the Capital Asset Pricing Model (CAPM)
                          type: number
                      required:
                        - portfolioAlpha
                      type: object
                    minItems: 1
                    type: array
                required:
                  - portfolios
                type: object
          description: OK
      summary: Alpha
      tags:
        - Portfolio Analysis
      x-codegen-request-body-name: body
  /portfolio/analysis/beta:
    post:
      description: |
        Compute the beta of one or several portfolio(s) in the Capital Asset Pricing Model (CAPM).

        References
        * Carl R. Bacon, Practical Portfolio Performance Measurement and Attribution  
      requestBody:
        content:
          application/json:
            examples:
              Example:
                description: Compute the beta of one portfolio
                value:
                  benchmarkReturns:
                    - 0.002
                    - 0.025
                    - 0.018
                    - -0.011
                    - 0.014
                  portfolios:
                    - portfolioReturns:
                        - 0.003
                        - 0.026
                        - 0.011
                        - -0.01
                        - 0.015
                  riskFreeRate: 0.01
            schema:
              oneOf:
                - properties:
                    benchmarkReturns:
                      description: benchmarkReturns[t] is the return of the benchmark at the time t; the benchmarkReturns array must have the same length as all the portfolioReturns arrays
                      items:
                        type: number
                      minItems: 2
                      type: array
                    portfolios:
                      items:
                        properties:
                          portfolioReturns:
                            description: portfolioReturns[t] is the return of the portfolio at the time t, all the portfolioReturns arrays must have the same length, equal to the length of the benchmarkReturns array
                            items:
                              type: number
                            minItems: 2
                            type: array
                        required:
                          - portfolioReturns
                        type: object
                      minItems: 1
                      type: array
                    riskFreeRate:
                      description: The risk free rate, assumed to be constant for any time t
                      type: number
                  required:
                    - benchmarkReturns
                    - portfolios
                  type: object
                - properties:
                    benchmarkReturns:
                      description: benchmarkReturns[t] is the return of the benchmark at the time t; the benchmarkReturns array must have the same length as all the portfolioReturns arrays
                      items:
                        type: number
                      minItems: 2
                      type: array
                    portfolios:
                      items:
                        properties:
                          portfolioReturns:
                            description: portfolioReturns[t] is the return of the portfolio at the time t, all the portfolioReturns arrays must have the same length, equal to the length of the benchmarkReturns array
                            items:
                              type: number
                            minItems: 2
                            type: array
                        required:
                          - portfolioReturns
                        type: object
                      minItems: 1
                      type: array
                    riskFreeReturns:
                      description: riskFreeReturns[t] is the risk free return at the time t; the riskFreeReturns array must have the same length as all the portfolioReturns arrays
                      items:
                        type: number
                      minItems: 2
                      type: array
                  required:
                    - benchmarkReturns
                    - portfolios
                  type: object
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Computed beta of one portfolio
                  value:
                    portfolios:
                      - portfolioBeta: 0.9169550173010382
              schema:
                properties:
                  portfolios:
                    items:
                      properties:
                        portfolioBeta:
                          description: The portfolio beta, which correponds to the portfolio systematic risk in the Capital Asset Pricing Model (CAPM)
                          type: number
                      required:
                        - portfolioBeta
                      type: object
                    minItems: 1
                    type: array
                required:
                  - portfolios
                type: object
          description: OK
      summary: Beta
      tags:
        - Portfolio Analysis
      x-codegen-request-body-name: body
  /portfolio/analysis/contributions/return:
    post:
      description: |
        Perform a return contribution analysis of one or several portfolio(s), optionally using groups of assets.

        References
        * Carl R. Bacon, Practical Portfolio Performance Measurement and Attribution
      requestBody:
        content:
          application/json:
            examples:
              Example:
                description: Perform a return contributions analysis of a portfolio made of 3 assets with the first 2 assets grouped together
                value:
                  assets: 3
                  assetsGroups:
                    - - 1
                      - 2
                  assetsReturns:
                    - 0.01
                    - -0.01
                    - 0.025
                  portfolios:
                    - assetsWeights:
                        - 0.5
                        - 0.25
                        - 0.25
            schema:
              properties:
                assets:
                  description: The number of assets
                  minimum: 1
                  type: integer
                assetsGroups:
                  items:
                    description: assetsGroups[k] is the indexes of the assets belonging to the assets group k
                    items:
                      minimum: 1
                      type: integer
                    minItems: 2
                    type: array
                    uniqueItems: true
                  minItems: 1
                  type: array
                assetsReturns:
                  description: assetsReturns[i] is the arithmetic return of asset i
                  items:
                    type: number
                  minItems: 1
                  type: array
                portfolios:
                  items:
                    properties:
                      assetsWeights:
                        description: assetsWeights[i] is the weight of the asset i in the portfolio, in percentage
                        items:
                          maximum: 1
                          minimum: 0
                          type: number
                        minItems: 1
                        type: array
                    required:
                      - assetsWeights
                    type: object
                  minItems: 1
                  type: array
              required:
                - assets
                - assetsReturns
                - portfolios
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Computed the return contributions of 3 assets and 2 groups of assets
                  value:
                    portfolios:
                      - assetsGroupsReturnContributions:
                          - 0.0025
                          - 0.00625
                        assetsReturnContributions:
                          - 0.005
                          - -0.0025
                          - 0.00625
              schema:
                properties:
                  portfolios:
                    items:
                      properties:
                        assetsGroupsReturnContributions:
                          description: assetsGroupsReturnContributions[k] is the return contribution of the group of assets k to the return of the portfolio
                          items:
                            type: number
                          minItems: 1
                          type: array
                        assetsReturnContributions:
                          description: assetsReturnContributions[i] is the return contribution of the asset i to the return of the portfolio
                          items:
                            type: number
                          minItems: 1
                          type: array
                      required:
                        - assetsReturnContributions
                      type: object
                    type: array
                required:
                  - portfolios
                type: object
          description: OK
      summary: Return Contributions
      tags:
        - Portfolio Analysis
      x-codegen-request-body-name: body
  /portfolio/analysis/contributions/risk:
    post:
      description: |
        Perform a risk contribution analysis of one or several portfolio(s), optionally using groups of assets.

        References
        * Carl R. Bacon, Practical Portfolio Performance Measurement and Attribution
      requestBody:
        content:
          application/json:
            examples:
              Example:
                description: Perform a risk contributions analysis of a portfolio made of 3 assets
                value:
                  assets: 3
                  assetsCovarianceMatrix:
                    - - 0.0001
                      - 0
                      - 0
                    - - 0
                      - 0.0001
                      - 0
                    - - 0
                      - 0
                      - 0.04
                  portfolios:
                    - assetsWeights:
                        - 0.5
                        - 0.25
                        - 0.25
            schema:
              properties:
                assets:
                  description: The number of assets
                  minimum: 1
                  type: integer
                assetsCovarianceMatrix:
                  description: assetsCovarianceMatrix[i][j] is the covariance between the asset i and the asset j
                  items:
                    items:
                      type: number
                    minItems: 2
                    type: array
                  minItems: 2
                  type: array
                assetsGroups:
                  items:
                    description: assetsGroups[k] is the indexes of the assets belonging to the assets group k
                    items:
                      minimum: 1
                      type: integer
                    minItems: 2
                    type: array
                    uniqueItems: true
                  minItems: 1
                  type: array
                portfolios:
                  items:
                    properties:
                      assetsWeights:
                        description: assetsWeights[i] is the weight of the asset i in the portfolio, in percentage
                        items:
                          maximum: 1
                          minimum: 0
                          type: number
                        minItems: 1
                        type: array
                    required:
                      - assetsWeights
                    type: object
                  minItems: 1
                  type: array
              required:
                - assets
                - assetsCovarianceMatrix
                - portfolios
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Computed the risk contributions of 3 assets
                  value:
                    portfolios:
                      - assetsRiskContributions:
                          - 0.0004969039949999533
                          - 0.00012422599874998834
                          - 0.049690399499995326
              schema:
                properties:
                  portfolios:
                    items:
                      properties:
                        assetsGroupsRiskContributions:
                          description: assetsGroupsRiskContributions[k] is the risk contribution of the group of assets k to the risk of the portfolio
                          items:
                            type: number
                          minItems: 1
                          type: array
                        assetsRiskContributions:
                          description: assetsRiskContributions[i] is the risk contribution of the asset i to the risk of the portfolio
                          items:
                            type: number
                          minItems: 1
                          type: array
                      required:
                        - assetsRiskContributions
                      type: object
                    type: array
                required:
                  - portfolios
                type: object
          description: OK
      summary: Risk Contributions
      tags:
        - Portfolio Analysis
      x-codegen-request-body-name: body
  /portfolio/analysis/correlation-spectrum:
    post:
      description: |
        Compute the correlation spectrum of one or several portfolio(s).

        References
        * [Tristan Froidure, Khalid Jalalzai and Yves Choueifaty, Portfolio Rho-Representativity, International Journal of Theoretical and Applied FinanceVol. 22, No. 07, 1950034 (2019)](https://www.worldscientific.com/doi/10.1142/S0219024919500341)
      requestBody:
        content:
          application/json:
            examples:
              From asset covariance matrix:
                description: Compute the correlation spectrum of a portfolio
                value:
                  assets: 2
                  assetsCovarianceMatrix:
                    - - 0.0025
                      - 0.0005
                    - - 0.0005
                      - 0.01
                  portfolios:
                    - assetsWeights:
                        - 0.5
                        - 0.5
              From assets prices and portfolio values:
                description: Compute the correlation spectrum of a portfolio
                value:
                  assets:
                    - assetPrices:
                        - 100
                        - 101
                        - 105
                    - assetPrices:
                        - 100
                        - 99
                        - 101
                  portfolios:
                    - portfolioValues:
                        - 100
                        - 100.5
                        - 101
            schema:
              oneOf:
                - properties:
                    assets:
                      description: The number of assets
                      minimum: 2
                      type: integer
                    assetsCovarianceMatrix:
                      description: assetsCovarianceMatrix[i][j] is the covariance between the asset i and the asset j
                      items:
                        items:
                          type: number
                        minItems: 2
                        type: array
                      minItems: 2
                      type: array
                    portfolios:
                      items:
                        properties:
                          assetsWeights:
                            description: assetsWeights[i] is the weight of the asset i in the portfolio, in percentage
                            items:
                              maximum: 1
                              minimum: 0
                              type: number
                            minItems: 1
                            type: array
                        required:
                          - assetsWeights
                        type: object
                      minItems: 1
                      type: array
                  required:
                    - assets
                    - assetsCovarianceMatrix
                    - portfolios
                  type: object
                - properties:
                    assets:
                      items:
                        properties:
                          assetPrices:
                            description: assetPrices[t] is the price of the asset at the time t; all the assetPrices arrays must have the same length
                            items:
                              exclusiveMinimum: true
                              minimum: 0
                              type: number
                            minItems: 2
                            type: array
                        required:
                          - assetPrices
                        type: object
                      minItems: 1
                      type: array
                    portfolios:
                      items:
                        properties:
                          portfolioValues:
                            description: portfolioValues[t] is the value of the portfolio at the time t; all the portfolioValues arrays must have the same length, equal to the common length of the assetPrices arrays
                            items:
                              exclusiveMinimum: true
                              minimum: 0
                              type: number
                            minItems: 2
                            type: array
                        required:
                          - portfolioValues
                        type: object
                      minItems: 1
                      type: array
                  required:
                    - assets
                    - portfolios
                  type: object
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Computed correlation spectrum of a portfolio
                  value:
                    portfolios:
                      - portfolioCorrelationSpectrum:
                          - 0.9543679526112243
                          - 0.5767242991086425
                          - 0.9573818866065777
              schema:
                properties:
                  portfolios:
                    items:
                      properties:
                        portfolioCorrelationSpectrum:
                          description: The correlation spectrum of the portfolio
                          items:
                            maximum: 1
                            minimum: -1
                            type: number
                          minItems: 2
                          type: array
                      required:
                        - portfolioCorrelationSpectrum
                      type: object
                    type: array
                required:
                  - portfolios
                type: object
          description: OK
      summary: Correlation Spectrum
      tags:
        - Portfolio Analysis
      x-codegen-request-body-name: body
  /portfolio/analysis/diversification-ratio:
    post:
      description: |
        Compute the diversification ratio of one or several portfolio(s).

        References
        * [Yves Choueifaty and Yves Coignard, Toward Maximum Diversification, The Journal of Portfolio Management Fall 2008, 35 (1) 40-51](https://doi.org/10.3905/JPM.2008.35.1.40)
        * [Tristan Froidure, Khalid Jalalzai and Yves Choueifaty, Portfolio Rho-Representativity, International Journal of Theoretical and Applied FinanceVol. 22, No. 07, 1950034 (2019)](https://www.worldscientific.com/doi/10.1142/S0219024919500341)
      requestBody:
        content:
          application/json:
            examples:
              From asset covariance matrix:
                description: Compute the diversification ratio of a portfolio
                value:
                  assets: 2
                  assetsCovarianceMatrix:
                    - - 0.0025
                      - 0.0005
                    - - 0.0005
                      - 0.01
                  portfolios:
                    - assetsWeights:
                        - 0.5
                        - 0.5
              From assets prices and portfolio values:
                description: Compute the diversification ratio of a portfolio
                value:
                  assets:
                    - assetPrices:
                        - 100
                        - 101
                        - 105
                    - assetPrices:
                        - 100
                        - 99
                        - 101
                  portfolios:
                    - portfolioValues:
                        - 100
                        - 100.5
                        - 101
            schema:
              oneOf:
                - properties:
                    assets:
                      description: The number of assets
                      minimum: 2
                      type: integer
                    assetsCovarianceMatrix:
                      description: assetsCovarianceMatrix[i][j] is the covariance between the asset i and the asset j
                      items:
                        items:
                          type: number
                        minItems: 2
                        type: array
                      minItems: 2
                      type: array
                    portfolios:
                      items:
                        properties:
                          assetsWeights:
                            description: assetsWeights[i] is the weight of the asset i in the portfolio, in percentage
                            items:
                              maximum: 1
                              minimum: 0
                              type: number
                            minItems: 1
                            type: array
                        required:
                          - assetsWeights
                        type: object
                      minItems: 1
                      type: array
                  required:
                    - assets
                    - assetsCovarianceMatrix
                    - portfolios
                  type: object
                - properties:
                    assets:
                      items:
                        properties:
                          assetPrices:
                            description: assetPrices[t] is the price of the asset at the time t; all the assetPrices arrays must have the same length
                            items:
                              exclusiveMinimum: true
                              minimum: 0
                              type: number
                            minItems: 2
                            type: array
                        required:
                          - assetPrices
                        type: object
                      minItems: 1
                      type: array
                    portfolios:
                      items:
                        properties:
                          portfolioValues:
                            description: portfolioValues[t] is the value of the portfolio at the time t; all the portfolioValues arrays must have the same length, equal to the common length of the assetPrices arrays
                            items:
                              exclusiveMinimum: true
                              minimum: 0
                              type: number
                            minItems: 2
                            type: array
                        required:
                          - portfolioValues
                        type: object
                      minItems: 1
                      type: array
                  required:
                    - assets
                    - portfolios
                  type: object
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Computed diversification ratio of a portfolio
                  value:
                    portfolios:
                      - portfolioDiversificationRatio: 1.2909944487358058
              schema:
                properties:
                  portfolios:
                    items:
                      properties:
                        portfolioDiversificationRatio:
                          description: The diversification ratio of the portfolio
                          minimum: 0
                          type: number
                      required:
                        - portfolioDiversificationRatio
                      type: object
                    type: array
                required:
                  - portfolios
                type: object
          description: OK
      summary: Diversification Ratio
      tags:
        - Portfolio Analysis
      x-codegen-request-body-name: body
  /portfolio/analysis/drawdowns:
    post:
      description: |
        Compute the drawdown function - also called the underwater equity curve -, as well as the worst 10 drawdowns of one or several portfolio(s).

        References
        * [Wikipedia, Drawdown](https://en.wikipedia.org/wiki/Drawdown_(economics))        
      requestBody:
        content:
          application/json:
            examples:
              Example:
                description: Computes the drawdown (underwater) curve and the worst 10 drawdowns of a portfolio
                value:
                  portfolios:
                    - portfolioValues:
                        - 100
                        - 95
                        - 100
                        - 90
                        - 85
                        - 70
            schema:
              properties:
                portfolios:
                  items:
                    properties:
                      portfolioValues:
                        description: portfolioValues[t] is the value of the portfolio at the time t
                        items:
                          exclusiveMinimum: true
                          minimum: 0
                          type: number
                        type: array
                    required:
                      - portfolioValues
                    type: object
                  minItems: 1
                  type: array
              required:
                - portfolios
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Computed a maximum drawdown of 30%, which began in the third period, which reached its bottom in the sixth period, and which is not ended yet
                  value:
                    portfolios:
                      - portfolioDrawdowns:
                          - 0
                          - 0.05
                          - 0
                          - 0.1
                          - 0.15
                          - 0.3
                        portfolioWorstDrawdowns:
                          - drawdownBottom: 6
                            drawdownDepth: 0.3
                            drawdownEnd: 0
                            drawdownStart: 3
                          - drawdownBottom: 2
                            drawdownDepth: 0.05
                            drawdownEnd: 3
                            drawdownStart: 1
              schema:
                properties:
                  portfolios:
                    items:
                      properties:
                        portfolioDrawdowns:
                          description: portfolioDrawdowns[t] is the value of the drawdown function at the time t
                          items:
                            minimum: 0
                            type: number
                          minItems: 1
                          type: array
                        portfolioWorstDrawdowns:
                          items:
                            properties:
                              drawdownBottom:
                                minimum: 0
                                type: integer
                              drawdownDepth:
                                minimum: 0
                                type: number
                              drawdownEnd:
                                minimum: 0
                                type: integer
                              drawdownStart:
                                minimum: 0
                                type: integer
                            required:
                              - drawdownDepth
                              - drawdownStart
                              - drawdownBottom
                              - drawdownEnd
                            type: object
                          minItems: 1
                          type: array
                      required:
                        - portfolioDrawdowns
                        - portfolioWorstDrawdowns
                      type: object
                    type: array
                required:
                  - portfolios
                type: object
          description: OK
      summary: Drawdowns
      tags:
        - Portfolio Analysis
      x-codegen-request-body-name: body
  /portfolio/analysis/effective-number-of-bets:
    post:
      description: |
        Compute the effective number of bets of one or several portfolio(s).

        References
        * [Meucci, Attilio and Santangelo, Alberto and Deguest, Romain, Risk Budgeting and Diversification Based on Optimized Uncorrelated Factors (November 10, 2015)](https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2276632)
      requestBody:
        content:
          application/json:
            examples:
              Example:
                description: Compute the effective number of bets of a portfolio made of 3 assets
                value:
                  assets: 3
                  assetsCovarianceMatrix:
                    - - 1
                      - 0
                      - 0
                    - - 0
                      - 286.31
                      - 100.79
                    - - 0
                      - 100.79
                      - 601.36
                  portfolios:
                    - assetsWeights:
                        - 10.96
                        - 1.06
                        - 0.22
            schema:
              properties:
                assets:
                  description: The number of assets
                  minimum: 2
                  type: integer
                assetsCovarianceMatrix:
                  description: assetsCovarianceMatrix[i][j] is the covariance between the asset i and the asset j
                  items:
                    items:
                      type: number
                    minItems: 2
                    type: array
                  minItems: 2
                  type: array
                factorsExtractionMethod:
                  default: exactMinimumLinearTorsion
                  description: The method used to extract the uncorrelated risk factors from the asset covariance matrix
                  enum:
                    - principalComponentAnalysis
                    - exactMinimumLinearTorsion
                    - approximateMinimumLinearTorsion
                  type: string
                portfolios:
                  items:
                    properties:
                      assetsWeights:
                        description: assetsWeights[i] is the weight of the asset i in the portfolio, in percentage
                        items:
                          type: number
                        minItems: 2
                        type: array
                    required:
                      - assetsWeights
                    type: object
                  minItems: 1
                  type: array
              required:
                - assets
                - assetsCovarianceMatrix
                - portfolios
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Computed effective number of bets of a portfolio of 3 assets
                  value:
                    portfolios:
                      - portfolioEffectiveNumberOfBets: 2.3564325389900276
              schema:
                properties:
                  portfolios:
                    items:
                      properties:
                        portfolioEffectiveNumberOfBets:
                          description: The effective number of bets of the portfolio
                          minimum: 0
                          type: number
                      required:
                        - portfolioEffectiveNumberOfBets
                      type: object
                    type: array
                required:
                  - portfolios
                type: object
          description: OK
      summary: Effective Number of Bets
      tags:
        - Portfolio Analysis
      x-codegen-request-body-name: body
  /portfolio/analysis/factors/exposures:
    post:
      description: |
        Compute the exposures of one or several portfolio(s) to a set of factors, using a returns-based linear regression analysis.

        References
        * [Measuring Factor Exposures: Uses and Abuses, Ronen Israel and Adrienne Ross, The Journal of Alternative Investments Summer 2017, 20 (1) 10-25](https://jai.pm-research.com/content/20/1/10.short) 
      requestBody:
        content:
          application/json:
            examples:
              Example:
                description: Compute the exposures of one portfolio to two factors
                value:
                  factors:
                    - factorReturns:
                        - -0.00414169934
                        - 0.01201656108
                        - 0.0087181369
                    - factorReturns:
                        - -0.01387258782
                        - -0.01097961581
                        - 0.01742002062
                  portfolios:
                    - portfolioReturns:
                        - -0.04302
                        - 0.01310372213
                        - 0.06482589323
            schema:
              properties:
                factors:
                  items:
                    properties:
                      factorReturns:
                        description: factorReturns[t] is the return of the factor at the time t; all the factorReturns arrays must have the same length, equal to the common length of the portfolioReturns arrays
                        items:
                          type: number
                        minItems: 2
                        type: array
                    required:
                      - factorReturns
                    type: object
                  minItems: 1
                  type: array
                portfolios:
                  items:
                    properties:
                      portfolioReturns:
                        description: portfolioReturns[t] is the return of the portfolio at the time t, all the portfolioReturns arrays must have the same length, equal to the common length of the factorReturns arrays
                        items:
                          type: number
                        minItems: 2
                        type: array
                    required:
                      - portfolioReturns
                    type: object
                  minItems: 1
                  type: array
              required:
                - factorReturns
                - portfolios
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Computed exposures of one portfolio to two factors
                  value:
                    portfolios:
                      - portfolioAlpha: -0.000017563172006410804
                        portfolioBetas:
                          - 3.083191766752847
                          - 2.17931822921701
                        portfolioRSquared: 1
              schema:
                properties:
                  portfolios:
                    items:
                      properties:
                        portfolioAlpha:
                          description: The portfolio alpha, which correponds to the portion of the portfolio returns that cannot be explained by the portfolio factor exposures
                          type: number
                        portfolioBetas:
                          description: The portfolio betas, which correspond to the portfolio factor exposures
                          items:
                            type: number
                          minItems: 1
                          type: array
                        portfolioRSquared:
                          description: The portfolio R^2, which indicates how much of the variability in the portfolio returns can be explained by the portfolio factor exposures; generally, the higher the R^2 the better the portfolio factor exposures explain the portfolio returns
                          type: number
                      required:
                        - portfolioAlpha
                        - portfolioBetas
                        - portfolioRSquared
                      type: object
                    minItems: 1
                    type: array
                required:
                  - portfolios
                type: object
          description: OK
      summary: Factor Exposures
      tags:
        - Portfolio Analysis
      x-codegen-request-body-name: body
  /portfolio/analysis/mean-variance/efficient-frontier:
    post:
      description: |
        Compute the discretized mean-variance efficient frontier associated to a list of assets, optionally subject to:
        * Minimum and maximum weights constraints
        * Maximum group weights constraints
        * Minimum and maximum portfolio exposure constraint

        References
         * Harry M. Markowitz, Portfolio Selection, Efficient Diversification of Investments, Second edition, Blackwell Publishers Inc.
      requestBody:
        content:
          application/json:
            examples:
              Example:
                description: Compute 3 portfolios belonging to the mean-variance efficient frontier
                value:
                  assets: 2
                  assetsCovarianceMatrix:
                    - - 0.0025
                      - 0.0005
                    - - 0.0005
                      - 0.01
                  assetsReturns:
                    - 0.01
                    - 0.05
                  constraints:
                    minimumAssetsWeights:
                      - 0.2
                      - 0
                  portfolios: 3
            schema:
              properties:
                assets:
                  description: The number of assets
                  minimum: 2
                  type: integer
                assetsCovarianceMatrix:
                  description: assetsCovarianceMatrix[i][j] is the covariance between the asset i and the asset j
                  items:
                    items:
                      type: number
                    minItems: 2
                    type: array
                  minItems: 2
                  type: array
                assetsReturns:
                  description: assetsReturns[i] is the arithmetic return of asset i
                  items:
                    type: number
                  minItems: 1
                  type: array
                constraints:
                  properties:
                    assetsGroups:
                      items:
                        description: assetsGroups[k] is the indexes of the assets belonging to the assets group k in the portfolio; exclusive with assetsGroupsMatrix
                        items:
                          minimum: 1
                          type: integer
                        minItems: 2
                        type: array
                        uniqueItems: true
                      minItems: 1
                      type: array
                    assetsGroupsMatrix:
                      description: assetsGroupsMatrix[k][i] is the weight of the asset i in the group of assets k; exclusive with assetsGroups
                      items:
                        items:
                          type: number
                        minItems: 2
                        type: array
                      minItems: 1
                      type: array
                    maximumAssetsGroupsWeights:
                      description: maximumAssetsGroupsWeights[k] is the maximum weight of the assets group k in the portfolio, in percentage between 0 and 1 if assetsGroups is provided
                      items:
                        type: number
                      type: array
                    maximumAssetsWeights:
                      description: maximumAssetsWeights[i] is the maximum weight of the asset i in the portfolio, in percentage
                      items:
                        maximum: 1
                        minimum: 0
                        type: number
                      type: array
                    maximumPortfolioExposure:
                      default: 1
                      description: The maximum portfolio exposure; must be higher than or equal to minimumPortfolioExposure
                      maximum: 1
                      minimum: 0
                      type: number
                    minimumAssetsWeights:
                      description: minimumAssetsWeights[i] is the minimum weight of the asset i in the portfolio, in percentage
                      items:
                        maximum: 1
                        minimum: 0
                        type: number
                      type: array
                    minimumPortfolioExposure:
                      default: 1
                      description: The minimum portfolio exposure; must be lower than or equal to maximumPortfolioExposure
                      maximum: 1
                      minimum: 0
                      type: number
                  type: object
                portfolios:
                  default: 25
                  description: The number of portfolios to compute on the mean-variance efficient frontier
                  minimum: 2
                  type: integer
              required:
                - assets
                - assetsReturns
                - assetsCovarianceMatrix
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Computed 3 mean-variance efficient portfolios
                  value:
                    portfolios:
                      - assetsWeights:
                          - 0.8260869565217391
                          - 0.17391304347826086
                        portfolioReturn: 0.016956521739130433
                        portfolioVolatility: 0.0463915284620315
                      - assetsWeights:
                          - 0.5130434782608696
                          - 0.48695652173913045
                        portfolioReturn: 0.02947826086956522
                        portfolioVolatility: 0.05726369211623199
                      - assetsWeights:
                          - 0.2
                          - 0.8
                        portfolioReturn: 0.04200000000000001
                        portfolioVolatility: 0.08160882305241265
              schema:
                properties:
                  portfolios:
                    items:
                      properties:
                        assetsWeights:
                          description: assetsWeights[i] is the weight of the asset i in the portfolio, in percentage
                          items:
                            maximum: 1
                            minimum: 0
                            type: number
                          minItems: 2
                          type: array
                        portfolioReturn:
                          description: The arithmetic return of the portfolio
                          type: number
                        portfolioVolatility:
                          description: The volatility of the portfolio
                          minimum: 0
                          type: number
                      required:
                        - assetsWeights
                        - portfolioReturn
                        - portfolioVolatility
                      type: object
                    minItems: 1
                    type: array
                required:
                  - portfolios
                type: object
          description: OK
      summary: Mean-Variance Efficient Frontier
      tags:
        - Portfolio Analysis
      x-codegen-request-body-name: body
  /portfolio/analysis/mean-variance/minimum-variance-frontier:
    post:
      description: |
        Compute the discretized mean-variance minimum variance frontier associated to a list of assets, optionally subject to:
        * Minimum and maximum weights constraints
        * Maximum group weights constraints
        * Minimum and maximum portfolio exposure constraint

        > This endpoint is similar to the endpoint [`/portfolio/analysis/mean-variance/efficient-frontier`](#post-/portfolio/analysis/mean-variance/efficient-frontier), because the mean-variance efficient frontier is the "top" portion of the mean-variance minimum variance frontier.

        References
         * Harry M. Markowitz, Portfolio Selection, Efficient Diversification of Investments, Second edition, Blackwell Publishers Inc.
      requestBody:
        content:
          application/json:
            examples:
              Example:
                description: Compute 4 portfolios belonging to the mean-variance minimum variance frontier
                value:
                  assets: 2
                  assetsCovarianceMatrix:
                    - - 0.0025
                      - 0.0005
                    - - 0.0005
                      - 0.01
                  assetsReturns:
                    - 0.01
                    - 0.05
                  constraints:
                    minimumAssetsWeights:
                      - 0.2
                      - 0
                  portfolios: 4
            schema:
              properties:
                assets:
                  description: The number of assets
                  minimum: 2
                  type: integer
                assetsCovarianceMatrix:
                  description: assetsCovarianceMatrix[i][j] is the covariance between the asset i and the asset j
                  items:
                    items:
                      type: number
                    minItems: 2
                    type: array
                  minItems: 2
                  type: array
                assetsReturns:
                  description: assetsReturns[i] is the arithmetic return of asset i
                  items:
                    type: number
                  minItems: 1
                  type: array
                constraints:
                  properties:
                    assetsGroups:
                      items:
                        description: assetsGroups[k] is the indexes of the assets belonging to the assets group k in the portfolio; exclusive with assetsGroupsMatrix
                        items:
                          minimum: 1
                          type: integer
                        minItems: 2
                        type: array
                        uniqueItems: true
                      minItems: 1
                      type: array
                    assetsGroupsMatrix:
                      description: assetsGroupsMatrix[k][i] is the weight of the asset i in the group of assets k; exclusive with assetsGroups
                      items:
                        items:
                          type: number
                        minItems: 2
                        type: array
                      minItems: 1
                      type: array
                    maximumAssetsGroupsWeights:
                      description: maximumAssetsGroupsWeights[k] is the maximum weight of the assets group k in the portfolio, in percentage between 0 and 1 if assetsGroups is provided
                      items:
                        type: number
                      type: array
                    maximumAssetsWeights:
                      description: maximumAssetsWeights[i] is the maximum weight of the asset i in the portfolio, in percentage
                      items:
                        maximum: 1
                        minimum: 0
                        type: number
                      type: array
                    maximumPortfolioExposure:
                      default: 1
                      description: The maximum portfolio exposure; must be higher than or equal to minimumPortfolioExposure
                      maximum: 1
                      minimum: 0
                      type: number
                    minimumAssetsWeights:
                      description: minimumAssetsWeights[i] is the minimum weight of the asset i in the portfolio, in percentage
                      items:
                        maximum: 1
                        minimum: 0
                        type: number
                      type: array
                    minimumPortfolioExposure:
                      default: 1
                      description: The minimum portfolio exposure; must be lower than or equal to maximumPortfolioExposure
                      maximum: 1
                      minimum: 0
                      type: number
                  type: object
                portfolios:
                  default: 25
                  description: The number of portfolios to compute on the mean-variance minimum variance frontier
                  minimum: 2
                  type: integer
              required:
                - assets
                - assetsReturns
                - assetsCovarianceMatrix
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Computed 4 mean-variance minimum variance portfolios
                  value:
                    portfolios:
                      - assetsWeights:
                          - 1
                          - 0
                        portfolioReturn: 0.01
                        portfolioVolatility: 0.05
                      - assetsWeights:
                          - 0.7333333333333333
                          - 0.2666666666666667
                        portfolioReturn: 0.02066666666666667
                        portfolioVolatility: 0.04744587559642156
                      - assetsWeights:
                          - 0.4666666666666667
                          - 0.5333333333333333
                        portfolioReturn: 0.03133333333333334
                        portfolioVolatility: 0.06031399321697891
                      - assetsWeights:
                          - 0.2
                          - 0.8
                        portfolioReturn: 0.04200000000000001
                        portfolioVolatility: 0.08160882305241265
              schema:
                properties:
                  portfolios:
                    items:
                      properties:
                        assetsWeights:
                          description: assetsWeights[i] is the weight of the asset i in the portfolio, in percentage
                          items:
                            maximum: 1
                            minimum: 0
                            type: number
                          minItems: 2
                          type: array
                        portfolioReturn:
                          description: The arithmetic return of the portfolio
                          type: number
                        portfolioVolatility:
                          description: The volatility of the portfolio
                          minimum: 0
                          type: number
                      required:
                        - assetsWeights
                        - portfolioReturn
                        - portfolioVolatility
                      type: object
                    minItems: 1
                    type: array
                required:
                  - portfolios
                type: object
          description: OK
      summary: Mean-Variance Minimum Variance Frontier
      tags:
        - Portfolio Analysis
      x-codegen-request-body-name: body
  /portfolio/analysis/return:
    post:
      description: |
        Compute the arithmetic return of one or several portfolio(s) from either:  
        * Portfolio assets arithmetic returns
        * Portfolio values

        References
        * [Wikipedia, Rate of Return](https://en.wikipedia.org/wiki/Rate_of_return#Return)
        * Harry M. Markowitz, Portfolio Selection, Efficient Diversification of Investments, Second edition, Blackwell Publishers Inc.
      requestBody:
        content:
          application/json:
            examples:
              From assets arithmetic returns:
                description: Compute the arithmetic return of 2 portfolios based on the assets arithmetic returns
                value:
                  assets: 2
                  assetsReturns:
                    - 0.01
                    - 0.05
                  portfolios:
                    - assetsWeights:
                        - 1
                        - 0
                    - assetsWeights:
                        - 0
                        - 1
              From portfolio values:
                description: Compute the arithmetic return of a portfolio based on portfolio values
                value:
                  portfolios:
                    - portfolioValues:
                        - 100
                        - 95
                        - 100
                        - 90
                        - 85
                        - 70
            schema:
              oneOf:
                - properties:
                    assets:
                      description: The number of assets
                      minimum: 1
                      type: integer
                    assetsReturns:
                      description: assetsReturns[i] is the arithmetic return of asset i
                      items:
                        type: number
                      minItems: 1
                      type: array
                    portfolios:
                      items:
                        properties:
                          assetsWeights:
                            description: assetsWeights[i] is the weight of the asset i in the portfolio, in percentage
                            items:
                              maximum: 1
                              minimum: 0
                              type: number
                            minItems: 1
                            type: array
                        required:
                          - assetsWeights
                        type: object
                      minItems: 1
                      type: array
                  required:
                    - portfolios
                    - assets
                    - assetsReturns
                  type: object
                - properties:
                    portfolios:
                      items:
                        properties:
                          portfolioValues:
                            description: portfolioValues[t] is the value of the portfolio at the time t
                            items:
                              exclusiveMinimum: true
                              minimum: 0
                              type: number
                            minItems: 2
                            type: array
                        required:
                          - portfolioValues
                        type: object
                      minItems: 1
                      type: array
                  required:
                    - portfolios
                  type: object
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Computed arithmetic return of 2 portfolios
                  value:
                    portfolios:
                      - portfolioReturn: 0.01
                      - portfolioReturn: 0.05
              schema:
                properties:
                  portfolios:
                    items:
                      properties:
                        portfolioReturn:
                          description: The arithmetic return of the portfolio
                          type: number
                      required:
                        - portfolioReturn
                      type: object
                    minItems: 1
                    type: array
                required:
                  - portfolios
                type: object
          description: OK
      summary: Arithmetic Return
      tags:
        - Portfolio Analysis
      x-codegen-request-body-name: body
  /portfolio/analysis/returns/average:
    post:
      description: |
        Compute the arithmetic average of the arithmetic return(s) of one or several portfolio(s).

        References
        * [Wikipedia, Arithmetic Average Rate of Return](https://en.wikipedia.org/wiki/Rate_of_return#Arithmetic_average_rate_of_return)
      requestBody:
        content:
          application/json:
            examples:
              From portfolio values:
                description: Compute the arithmetic average return of a portfolio
                value:
                  portfolios:
                    - portfolioValues:
                        - 100
                        - 95
                        - 100
                        - 90
                        - 85
                        - 70
            schema:
              properties:
                portfolios:
                  items:
                    properties:
                      portfolioValues:
                        description: portfolioValues[t] is the value of the portfolio at the time t
                        items:
                          exclusiveMinimum: true
                          minimum: 0
                          type: number
                        type: array
                    required:
                      - portfolioValues
                    type: object
                  minItems: 1
                  type: array
              required:
                - portfolios
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Computed average arithmetic return of 1% for the first portfolio
                  value:
                    portfolios:
                      - portfolioAverageReturn: 0.01
              schema:
                properties:
                  portfolios:
                    items:
                      properties:
                        portfolioAverageReturn:
                          description: The arithmetic average return of the portfolio
                          type: number
                      required:
                        - portfolioAverageReturn
                      type: object
                    type: array
                required:
                  - portfolios
                type: object
          description: OK
      summary: Arithmetic Average Return
      tags:
        - Portfolio Analysis
      x-codegen-request-body-name: body
  /portfolio/analysis/sharpe-ratio:
    post:
      description: |
        Compute the Sharpe ratio of one or several portfolio(s) from either:
        * Portfolio assets arithmetic returns and assets covariance matrix
        * Portfolio values

        References
        * Carl R. Bacon, Practical Portfolio Performance Measurement and Attribution
        * Harry M. Markowitz, Portfolio Selection, Efficient Diversification of Investments, Second edition, Blackwell Publishers Inc.
      requestBody:
        content:
          application/json:
            examples:
              From assets arithmetic returns and asset covariance matrix:
                description: Compute the Sharpe ratio of 2 portfolios based on the assets arithmetic returns and covariance matrix
                value:
                  assets: 2
                  assetsCovarianceMatrix:
                    - - 0.0025
                      - 0.0005
                    - - 0.0005
                      - 0.01
                  assetsReturns:
                    - 0.01
                    - 0.05
                  portfolios:
                    - assetsWeights:
                        - 1
                        - 0
                    - assetsWeights:
                        - 0
                        - 1
                  riskFreeRate: 0
              From portfolio values:
                description: Compute the Sharpe ratio of a portfolio based on portfolio values
                value:
                  portfolios:
                    - portfolioValues:
                        - 100
                        - 95
                        - 100
                        - 90
                        - 85
                        - 70
                  riskFreeRate: 0
            schema:
              oneOf:
                - properties:
                    assets:
                      description: The number of assets
                      minimum: 2
                      type: integer
                    assetsCovarianceMatrix:
                      description: assetsCovarianceMatrix[i][j] is the covariance between the asset i and the asset j
                      items:
                        items:
                          type: number
                        minItems: 2
                        type: array
                      minItems: 2
                      type: array
                    assetsReturns:
                      description: assetsReturns[i] is the arithmetic return of asset i
                      items:
                        type: number
                      minItems: 2
                      type: array
                    portfolios:
                      items:
                        properties:
                          assetsWeights:
                            description: assetsWeights[i] is the weight of the asset i in the portfolio, in percentage
                            items:
                              maximum: 1
                              minimum: 0
                              type: number
                            minItems: 2
                            type: array
                        required:
                          - assetsWeights
                        type: object
                      minItems: 1
                      type: array
                    riskFreeRate:
                      description: The risk free rate
                      type: number
                  required:
                    - portfolios
                    - riskFreeRate
                    - assets
                    - assetsReturns
                    - assetsCovarianceMatrix
                  type: object
                - properties:
                    portfolios:
                      items:
                        properties:
                          portfolioValues:
                            description: portfolioValues[t] is the value of the portfolio at the time t
                            items:
                              exclusiveMinimum: true
                              minimum: 0
                              type: number
                            minItems: 2
                            type: array
                        required:
                          - portfolioValues
                        type: object
                      minItems: 1
                      type: array
                    riskFreeRate:
                      description: The risk free rate
                      type: number
                  required:
                    - portfolios
                    - riskFreeRate
                  type: object
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Computed Sharpe ratio of a portfolio
                  value:
                    portfolios:
                      - portfolioSharpeRatio: -0.8835333925060923
              schema:
                properties:
                  portfolios:
                    items:
                      properties:
                        portfolioSharpeRatio:
                          description: The Sharpe ratio of the portfolio
                          type: number
                      required:
                        - portfolioSharpeRatio
                      type: object
                    minItems: 1
                    type: array
                required:
                  - portfolios
                type: object
          description: OK
      summary: Sharpe Ratio
      tags:
        - Portfolio Analysis / Sharpe ratio
      x-codegen-request-body-name: body
  /portfolio/analysis/sharpe-ratio/bias-adjusted:
    post:
      description: |
        Compute the Sharpe ratio of one or several portfolio(s), adjusted for small sample bias.

        References
        * [Opdyke, J., Comparing Sharpe ratios: So where are the p-values?. J Asset Manag 8, 308–336 (2007)](https://link.springer.com/article/10.1057/palgrave.jam.2250084)
      requestBody:
        content:
          application/json:
            examples:
              Example:
                description: Compute the bias-adjusted Sharpe ratio of a portfolio
                value:
                  portfolios:
                    - portfolioValues:
                        - 100
                        - 95
                        - 100
                        - 90
                        - 85
                        - 70
                  riskFreeRate: 0
            schema:
              properties:
                portfolios:
                  items:
                    properties:
                      portfolioValues:
                        description: portfolioValues[t] is the value of the portfolio at the time t
                        items:
                          exclusiveMinimum: true
                          minimum: 0
                          type: number
                        minItems: 4
                        type: array
                    required:
                      - portfolioValues
                    type: object
                  minItems: 1
                  type: array
                riskFreeRate:
                  description: The risk free rate
                  type: number
              required:
                - portfolios
                - riskFreeRate
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Computed bias-adjusted Sharpe ratio of a portfolio
                  value:
                    portfolios:
                      - portfolioBiasAdjustedSharpeRatio: -0.8314248234836994
              schema:
                properties:
                  portfolios:
                    items:
                      properties:
                        portfolioBiasAdjustedSharpeRatio:
                          description: The bias-adjusted Sharpe ratio of the portfolio
                          type: number
                      required:
                        - portfolioBiasAdjustedSharpeRatio
                      type: object
                    minItems: 1
                    type: array
                required:
                  - portfolios
                type: object
          description: OK
      summary: Bias-Adjusted Sharpe Ratio
      tags:
        - Portfolio Analysis / Sharpe ratio
      x-codegen-request-body-name: body
  /portfolio/analysis/sharpe-ratio/confidence-interval:
    post:
      description: |
        Build a confidence interval for the Sharpe ratio of one or several portfolio(s).

        References
        * [Opdyke, J.D., Comparing Sharpe ratios: So where are the p-values?. J Asset Manag 8, 308–336 (2007)](https://link.springer.com/article/10.1057/palgrave.jam.2250084)
      requestBody:
        content:
          application/json:
            examples:
              Example:
                description: Build a two-sided confidence interval at a confidence level 99%
                value:
                  confidenceIntervalType: twoSided
                  confidenceLevel: 0.99
                  portfolios:
                    - portfolioValues:
                        - 100
                        - 95
                        - 100
                        - 90
                        - 85
                        - 70
                  riskFreeRate: 0
            schema:
              properties:
                confidenceIntervalType:
                  default: twoSided
                  description: The type of confidence interval to build
                  enum:
                    - twoSided
                    - lowerOneSided
                    - upperOneSided
                  type: string
                confidenceLevel:
                  default: 0.95
                  description: The confidence level of the confidence interval to build, in percentage
                  exclusiveMaximum: true
                  exclusiveMinimum: true
                  maximum: 1
                  minimum: 0
                  type: number
                portfolios:
                  items:
                    properties:
                      portfolioValues:
                        description: portfolioValues[t] is the value of the portfolio at the time t
                        items:
                          exclusiveMinimum: true
                          minimum: 0
                          type: number
                        minItems: 4
                        type: array
                    required:
                      - portfolioValues
                    type: object
                  minItems: 1
                  type: array
                riskFreeRate:
                  description: The risk free rate
                  type: number
              required:
                - portfolios
                - riskFreeRate
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example of a one-sided confidence interval:
                  description: A one-sided lower confidence interval of a portfolio
                  value:
                    portfolios:
                      - portfolioSharpeRatioConfidenceInterval:
                          - null
                          - 0.3309901925834179
                Example of a two-sided confidence interval:
                  description: A two-sided confidence interval of a portfolio
                  value:
                    portfolios:
                      - portfolioSharpeRatioConfidenceInterval:
                          - -2.2283045143292535
                          - 0.46123772931706875
              schema:
                properties:
                  portfolios:
                    items:
                      properties:
                        portfolioSharpeRatioConfidenceInterval:
                          description: portfolioSharpeRatioConfidenceInterval[0] (resp. portfolioSharpeRatioConfidenceInterval[1]) is the lower (resp. upper) bound of the built confidence interval, possibly equal to null in case of a negative infinite (resp. positive infinite) bound
                          items:
                            type: number
                          maxItems: 2
                          minItems: 2
                          type: array
                      required:
                        - portfolioSharpeRatioConfidenceInterval
                      type: object
                    minItems: 1
                    type: array
                required:
                  - portfolios
                type: object
          description: OK
      summary: Sharpe Ratio Confidence Interval
      tags:
        - Portfolio Analysis / Sharpe ratio
      x-codegen-request-body-name: body
  /portfolio/analysis/sharpe-ratio/probabilistic:
    post:
      description: |
        Compute the probabilistic Sharpe ratio of one or several portfolio(s).

        References
        * [Opdyke, J.D., Comparing Sharpe ratios: So where are the p-values?. J Asset Manag 8, 308–336 (2007)](https://link.springer.com/article/10.1057/palgrave.jam.2250084)
        * [Bailey, David H. and Lopez de Prado, Marcos, The Sharpe Ratio Efficient Frontier (April 1, 2012). Journal of Risk, Vol. 15, No. 2, Winter 2012/13](https://ssrn.com/abstract=1821643)
      requestBody:
        content:
          application/json:
            examples:
              Probabilistic Sharpe ratio of a portfolio v.s. a benchmark:
                description: Compute the probabilistic Sharpe ratio for a portfolio v.s. a benchmark
                value:
                  benchmarkValues:
                    - 100
                    - 101
                    - 98
                    - 102
                    - 95
                    - 90
                  portfolios:
                    - portfolioValues:
                        - 100
                        - 95
                        - 100
                        - 90
                        - 85
                        - 70
                  riskFreeRate: 0
              Probabilistic Sharpe ratio of a portfolio v.s. a benchmark Sharpe ratio:
                description: Compute the probabilistic Sharpe ratio for a portfolio v.s. a benchmark Sharpe ratio
                value:
                  benchmarkSharpeRatio: 0
                  portfolios:
                    - portfolioValues:
                        - 100
                        - 95
                        - 100
                        - 90
                        - 85
                        - 70
                  riskFreeRate: 0
            schema:
              oneOf:
                - properties:
                    benchmarkSharpeRatio:
                      description: The Sharpe ratio of the benchmark, in the same sampling frequency as the sampling frequency of the portfolio values
                      type: number
                    portfolios:
                      items:
                        properties:
                          portfolioValues:
                            description: portfolioValues[t] is the value of the portfolio at the time t
                            items:
                              exclusiveMinimum: true
                              minimum: 0
                              type: number
                            minItems: 4
                            type: array
                        required:
                          - portfolioValues
                        type: object
                      minItems: 1
                      type: array
                    riskFreeRate:
                      description: The risk free rate
                      type: number
                  required:
                    - portfolios
                    - riskFreeRate
                    - benchmarkSharpeRatio
                  type: object
                - properties:
                    benchmarkValues:
                      description: benchmarkValues[t] is the value of the benchmark at the time t; the benchmarkValues array must have the same length as all the portfolioValues arrays
                      items:
                        exclusiveMinimum: true
                        minimum: 0
                        type: number
                      minItems: 4
                      type: array
                    portfolios:
                      items:
                        properties:
                          portfolioValues:
                            description: portfolioValues[t] is the value of the portfolio at the time t; all the portfolioValues arrays must have the same length as the benchmarkValues array
                            items:
                              exclusiveMinimum: true
                              minimum: 0
                              type: number
                            minItems: 4
                            type: array
                        required:
                          - portfolioValues
                        type: object
                      minItems: 1
                      type: array
                    riskFreeRate:
                      description: The risk free rate
                      type: number
                  required:
                    - portfolios
                    - riskFreeRate
                    - benchmarkValues
                  type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: The probabilistic Sharpe ratio of a portfolio
                  value:
                    portfolios:
                      - portfolioProbabilisticSharpeRatio: 0.0452890775705429
              schema:
                properties:
                  portfolios:
                    items:
                      properties:
                        portfolioProbabilisticSharpeRatio:
                          description: The probabilistic Sharpe ratio of the portfolio, in percentage
                          type: number
                      required:
                        - portfolioProbabilisticSharpeRatio
                      type: object
                    minItems: 1
                    type: array
                required:
                  - portfolios
                type: object
          description: OK
      summary: Probabilistic Sharpe Ratio
      tags:
        - Portfolio Analysis / Sharpe ratio
      x-codegen-request-body-name: body
  /portfolio/analysis/sharpe-ratio/probabilistic/minimum-track-record-length:
    post:
      description: |
        Compute the minimum track record length of one or several portfolio(s).

        References
        * [Bailey, David H. and Lopez de Prado, Marcos, The Sharpe Ratio Efficient Frontier (April 1, 2012). Journal of Risk, Vol. 15, No. 2, Winter 2012/13](https://ssrn.com/abstract=1821643)
      requestBody:
        content:
          application/json:
            examples:
              Minimum Track Record Length of a portfolio v.s. a benchmark:
                description: Compute the minimum track record length of a portfolio v.s. a benchmark at a confidence level of 95%
                value:
                  benchmarkValues:
                    - 100
                    - 101
                    - 98
                    - 85
                    - 75
                    - 65
                  portfolios:
                    - portfolioValues:
                        - 100
                        - 95
                        - 100
                        - 90
                        - 85
                        - 70
                  riskFreeRate: 0
              Minimum Track Record Length of a portfolio v.s. a benchmark Sharpe ratio:
                description: Compute the minimum track record length of a portfolio v.s. a benchmark Sharpe ratio of 0 at a confidence level of 95%
                value:
                  benchmarkSharpeRatio: 0
                  portfolios:
                    - portfolioValues:
                        - 100
                        - 95
                        - 100
                        - 90
                        - 85
                        - 70
                  riskFreeRate: 0
            schema:
              oneOf:
                - properties:
                    benchmarkSharpeRatio:
                      description: The Sharpe ratio of the benchmark, in the same sampling frequency as the sampling frequency of the portfolio values
                      type: number
                    confidenceLevel:
                      default: 0.95
                      description: The confidence level of the minimum track record length, in percentage
                      exclusiveMaximum: true
                      exclusiveMinimum: true
                      maximum: 1
                      minimum: 0
                      type: number
                    portfolios:
                      items:
                        properties:
                          portfolioValues:
                            description: portfolioValues[t] is the value of the portfolio at the time t
                            items:
                              exclusiveMinimum: true
                              minimum: 0
                              type: number
                            minItems: 4
                            type: array
                        required:
                          - portfolioValues
                        type: object
                      minItems: 1
                      type: array
                    riskFreeRate:
                      description: The risk free rate
                      type: number
                  required:
                    - portfolios
                    - riskFreeRate
                    - benchmarkSharpeRatio
                  type: object
                - properties:
                    benchmarkValues:
                      description: benchmarkValues[t] is the value of the benchmark at the time t; the benchmarkValues array must have the same length as all the portfolioValues arrays
                      items:
                        exclusiveMinimum: true
                        minimum: 0
                        type: number
                      minItems: 4
                      type: array
                    confidenceLevel:
                      default: 0.95
                      description: The confidence level of the minimum track record length, in percentage
                      exclusiveMaximum: true
                      exclusiveMinimum: true
                      maximum: 1
                      minimum: 0
                      type: number
                    portfolios:
                      items:
                        properties:
                          portfolioValues:
                            description: portfolioValues[t] is the value of the portfolio at the time t
                            items:
                              exclusiveMinimum: true
                              minimum: 0
                              type: number
                            minItems: 4
                            type: array
                        required:
                          - portfolioValues
                        type: object
                      minItems: 1
                      type: array
                    riskFreeRate:
                      description: The risk free rate
                      type: number
                  required:
                    - portfolios
                    - riskFreeRate
                    - benchmarkSharpeRatio
                  type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example of non-existing minimum track record length:
                  description: Non-existing minimum track record length of a portfolio
                  value:
                    portfolios:
                      - portfolioSharpeRatioMinimumTrackRecordLength: null
              schema:
                properties:
                  portfolios:
                    items:
                      properties:
                        portfolioSharpeRatioMinimumTrackRecordLength:
                          description: The minimum track record length of the portfolio, in number of required arithmetic returns, possibly equal to null in case the minimum track record length does not exist
                          type: number
                      required:
                        - portfolioSharpeRatioMinimumTrackRecordLength
                      type: object
                    minItems: 1
                    type: array
                required:
                  - portfolios
                type: object
          description: OK
      summary: Minimum Track Record Length
      tags:
        - Portfolio Analysis / Sharpe ratio
      x-codegen-request-body-name: body
  /portfolio/analysis/tracking-error:
    post:
      description: |
        Compute the tracking error between a benchmark and one or several portfolio(s).

        References
        * [Wikipedia, Tracking error](https://en.wikipedia.org/wiki/Tracking_error) 
        * Carl R. Bacon, Practical Portfolio Performance Measurement and Attribution 
      requestBody:
        content:
          application/json:
            examples:
              Example:
                description: Computes the tracking error using the example in Bacon's book
                value:
                  benchmarkReturns:
                    - 0.002
                    - 0.025
                    - 0.018
                    - -0.011
                    - 0.014
                    - 0.018
                    - 0.014
                    - 0.065
                    - -0.015
                    - 0.042
                    - -0.006
                    - 0.083
                    - 0.039
                    - -0.038
                    - -0.062
                    - 0.015
                    - -0.048
                    - 0.021
                    - 0.06
                    - 0.056
                    - -0.067
                    - 0.019
                    - -0.003
                    - 0
                  portfolios:
                    - portfolioReturns:
                        - 0.003
                        - 0.026
                        - 0.011
                        - -0.01
                        - 0.015
                        - 0.025
                        - 0.016
                        - 0.067
                        - -0.014
                        - 0.04
                        - -0.005
                        - 0.081
                        - 0.04
                        - -0.037
                        - -0.061
                        - 0.017
                        - -0.049
                        - -0.022
                        - 0.07
                        - 0.058
                        - -0.065
                        - 0.024
                        - -0.005
                        - -0.009
            schema:
              properties:
                benchmarkReturns:
                  description: benchmarkReturns[t] is the return of the benchmark at the time t; the benchmarkReturns array must have the same length as all the portfolioReturns arrays
                  items:
                    type: number
                  minItems: 2
                  type: array
                portfolios:
                  items:
                    properties:
                      portfolioReturns:
                        description: portfolioReturns[t] is the return of the portfolio at the time t, the portfolioReturns must have the same length as the benchmarkReturns array
                        items:
                          type: number
                        minItems: 2
                        type: array
                    required:
                      - portfolioReturns
                    type: object
                  minItems: 1
                  type: array
              required:
                - benchmarkReturns
                - portfolios
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: The computed tracking error using the example in Bacon's book
                  value:
                    portfolios:
                      - portfolioTrackingError: 0.00950648535942116
              schema:
                properties:
                  portfolios:
                    items:
                      properties:
                        portfolioTrackingError:
                          description: The tracking error of the portfolio
                          minimum: 0
                          type: number
                      required:
                        - portfolioTrackingError
                      type: object
                    minItems: 1
                    type: array
                required:
                  - portfolios
                type: object
          description: OK
      summary: Tracking Error
      tags:
        - Portfolio Analysis
      x-codegen-request-body-name: body
  /portfolio/analysis/ulcer-index:
    post:
      description: |
        Compute the Ulcer Index of one or several portfolio(s).

        References
        * Carl R. Bacon, Practical Portfolio Performance Measurement and Attribution
        * [Peter G. Martin, Ulcer Index, An Alternative Approach to the Measurement of Investment Risk & Risk-Adjusted Performance](http://www.tangotools.com/ui/ui.htm)
      requestBody:
        content:
          application/json:
            examples:
              From portfolio values:
                description: Compute the Ulcer Index of a portfolio based on portfolio values
                value:
                  portfolios:
                    - portfolioValues:
                        - 100
                        - 95
                        - 100
                        - 90
                        - 85
                        - 70
            schema:
              properties:
                portfolios:
                  items:
                    properties:
                      portfolioValues:
                        description: portfolioValues[t] is the value of the portfolio at the time t
                        items:
                          exclusiveMinimum: true
                          minimum: 0
                          type: number
                        minItems: 2
                        type: array
                    required:
                      - portfolioValues
                    type: object
                  minItems: 1
                  type: array
                riskFreeRate:
                  description: The risk free rate
                  type: number
              required:
                - portfolios
                - riskFreeRate
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Computed Ulcer Index of a portfolio
                  value:
                    portfolios:
                      - portfolioUlcerIndex: 0.14433756729740643
              schema:
                properties:
                  portfolios:
                    items:
                      properties:
                        portfolioUlcerIndex:
                          description: The Ulcer Index of the portfolio
                          type: number
                      required:
                        - portfolioUlcerIndex
                      type: object
                    type: array
                required:
                  - portfolios
                type: object
          description: OK
      summary: Ulcer Index
      tags:
        - Portfolio Analysis
      x-codegen-request-body-name: body
  /portfolio/analysis/ulcer-performance-index:
    post:
      description: |
        Compute the Ulcer Performance Index of one or several portfolio(s).

        References
        * Carl R. Bacon, Practical Portfolio Performance Measurement and Attribution
        * [Peter G. Martin, Ulcer Index, An Alternative Approach to the Measurement of Investment Risk & Risk-Adjusted Performance](http://www.tangotools.com/ui/ui.htm)
      requestBody:
        content:
          application/json:
            examples:
              From portfolio values:
                description: Compute the Ulcer Performance Index of a portfolio based on portfolio values
                value:
                  portfolios:
                    - portfolioValues:
                        - 100
                        - 95
                        - 100
                        - 90
                        - 85
                        - 70
                  riskFreeRate: 0
            schema:
              properties:
                portfolios:
                  items:
                    properties:
                      portfolioValues:
                        description: portfolioValues[t] is the value of the portfolio at the time t
                        items:
                          exclusiveMinimum: true
                          minimum: 0
                          type: number
                        minItems: 2
                        type: array
                    required:
                      - portfolioValues
                    type: object
                  minItems: 1
                  type: array
                riskFreeRate:
                  description: The risk free rate
                  type: number
              required:
                - portfolios
                - riskFreeRate
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Computed Ulcer Performance Index of a portfolio
                  value:
                    portfolios:
                      - portfolioUlcerPerformanceIndex: -0.45642249763676057
              schema:
                properties:
                  portfolios:
                    items:
                      properties:
                        portfolioUlcerPerformanceIndex:
                          description: The Ulcer Performance Index of the portfolio
                          type: number
                      required:
                        - portfolioUlcerPerformanceIndex
                      type: object
                    type: array
                required:
                  - portfolios
                type: object
          description: OK
      summary: Ulcer Performance Index
      tags:
        - Portfolio Analysis
      x-codegen-request-body-name: body
  /portfolio/analysis/value-at-risk/conditional/cornish-fisher:
    post:
      description: |
        Compute the Cornish-Fisher conditional value at risk of one or several portfolio(s) from portfolio values.

        References
        * [Boudt, Kris and Peterson, Brian G. and Croux, Christophe, Estimation and Decomposition of Downside Risk for Portfolios with Non-Normal Returns (October 31, 2007). Journal of Risk, Vol. 11, No. 2, pp. 79-103, 2008](https://papers.ssrn.com/sol3/papers.cfm?abstract_id=1024151).
        * [Maillard, Didier, A User’s Guide to the Cornish Fisher Expansion](https://papers.ssrn.com/sol3/papers.cfm?abstract_id=1997178)
        * [Lamb, John D., Maura E. Monville, and Kai-Hong Tee. Making Cornish–fisher Fit for Risk Measurement, Journal of Risk, Volume 21, Number 5, p. 53-81](http://doi.org/10.21314/JOR.2019.408)
      requestBody:
        content:
          application/json:
            examples:
              From portfolio values:
                description: Compute the Cornish-Fisher conditional value at risk of a portfolio based on portfolio values, at the default 95% confidence level
                value:
                  portfolios:
                    - portfolioValues:
                        - 100
                        - 95
                        - 100
                        - 90
                        - 85
                        - 70
            schema:
              properties:
                confidenceLevel:
                  default: 0.95
                  description: The confidence level
                  exclusiveMaximum: true
                  exclusiveMinimum: true
                  maximum: 1
                  minimum: 0
                  type: number
                portfolios:
                  items:
                    properties:
                      portfolioValues:
                        description: portfolioValues[t] is the value of the portfolio at the time t
                        items:
                          exclusiveMinimum: true
                          minimum: 0
                          type: number
                        minItems: 5
                        type: array
                    required:
                      - portfolioValues
                    type: object
                  minItems: 1
                  type: array
              required:
                - portfolios
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Computed conditional value at risk of a portfolio
                  value:
                    portfolios:
                      - portfolioConditionalValueAtRisk: 0.17647058823529413
              schema:
                properties:
                  portfolios:
                    items:
                      properties:
                        portfolioConditionalValueAtRisk:
                          description: The conditional value at risk of the portfolio
                          type: number
                      required:
                        - portfolioConditionalValueAtRisk
                      type: object
                    minItems: 1
                    type: array
                required:
                  - portfolios
                type: object
          description: OK
      summary: Cornish-Fisher Conditional Value At Risk
      tags:
        - Portfolio Analysis / Conditional Value At Risk
      x-codegen-request-body-name: body
  /portfolio/analysis/value-at-risk/conditional/cornish-fisher/corrected:
    post:
      description: |
        Compute the corrected Cornish-Fisher conditional value at risk of one or several portfolio(s) from portfolio values.

        References
        * [Maillard, Didier, A User’s Guide to the Cornish Fisher Expansion](https://papers.ssrn.com/sol3/papers.cfm?abstract_id=1997178)
        * [Lamb, John D., Maura E. Monville, and Kai-Hong Tee. Making Cornish–fisher Fit for Risk Measurement, Journal of Risk, Volume 21, Number 5, p. 53-81](http://doi.org/10.21314/JOR.2019.408)
      requestBody:
        content:
          application/json:
            examples:
              From portfolio values:
                description: Compute the corrected Cornish-Fisher conditional value at risk of a portfolio based on portfolio values, at the default 95% confidence level
                value:
                  portfolios:
                    - portfolioValues:
                        - 100
                        - 95
                        - 100
                        - 90
                        - 85
                        - 70
            schema:
              properties:
                confidenceLevel:
                  default: 0.95
                  description: The confidence level
                  exclusiveMaximum: true
                  exclusiveMinimum: true
                  maximum: 1
                  minimum: 0
                  type: number
                portfolios:
                  items:
                    properties:
                      portfolioValues:
                        description: portfolioValues[t] is the value of the portfolio at the time t
                        items:
                          exclusiveMinimum: true
                          minimum: 0
                          type: number
                        minItems: 5
                        type: array
                    required:
                      - portfolioValues
                    type: object
                  minItems: 1
                  type: array
              required:
                - portfolios
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Computed conditional value at risk of a portfolio
                  value:
                    portfolios:
                      - portfolioConditionalValueAtRisk: 0.17647058823529413
              schema:
                properties:
                  portfolios:
                    items:
                      properties:
                        portfolioConditionalValueAtRisk:
                          description: The conditional value at risk of the portfolio
                          type: number
                      required:
                        - portfolioConditionalValueAtRisk
                      type: object
                    minItems: 1
                    type: array
                required:
                  - portfolios
                type: object
          description: OK
      summary: Corrected Cornish-Fisher Conditional Value At Risk
      tags:
        - Portfolio Analysis / Conditional Value At Risk
      x-codegen-request-body-name: body
  /portfolio/analysis/value-at-risk/conditional/gaussian:
    post:
      description: |
        Compute the Gaussian conditional value at risk of one or several portfolio(s) from portfolio values.

        References
        * [Boudt, Kris and Peterson, Brian G. and Croux, Christophe, Estimation and Decomposition of Downside Risk for Portfolios with Non-Normal Returns (October 31, 2007). Journal of Risk, Vol. 11, No. 2, pp. 79-103, 2008](https://papers.ssrn.com/sol3/papers.cfm?abstract_id=1024151).
      requestBody:
        content:
          application/json:
            examples:
              From portfolio values:
                description: Compute the Gaussian conditional value at risk of a portfolio based on portfolio values, at the default 95% confidence level
                value:
                  portfolios:
                    - portfolioValues:
                        - 100
                        - 95
                        - 100
                        - 90
                        - 85
                        - 70
            schema:
              properties:
                confidenceLevel:
                  default: 0.95
                  description: The confidence level
                  exclusiveMaximum: true
                  exclusiveMinimum: true
                  maximum: 1
                  minimum: 0
                  type: number
                portfolios:
                  items:
                    properties:
                      portfolioValues:
                        description: portfolioValues[t] is the value of the portfolio at the time t
                        items:
                          exclusiveMinimum: true
                          minimum: 0
                          type: number
                        minItems: 3
                        type: array
                    required:
                      - portfolioValues
                    type: object
                  minItems: 1
                  type: array
              required:
                - portfolios
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Computed conditional value at risk of a portfolio
                  value:
                    portfolios:
                      - portfolioConditionalValueAtRisk: 0.17647058823529413
              schema:
                properties:
                  portfolios:
                    items:
                      properties:
                        portfolioConditionalValueAtRisk:
                          description: The conditional value at risk of the portfolio
                          type: number
                      required:
                        - portfolioConditionalValueAtRisk
                      type: object
                    minItems: 1
                    type: array
                required:
                  - portfolios
                type: object
          description: OK
      summary: Gaussian Conditional Value At Risk
      tags:
        - Portfolio Analysis / Conditional Value At Risk
      x-codegen-request-body-name: body
  /portfolio/analysis/value-at-risk/conditional/historical:
    post:
      description: |
        Compute the historical conditional value at risk of one or several portfolio(s) from portfolio values.

        References
        * [Wikipedia, Value at risk](https://en.wikipedia.org/wiki/Value_at_risk)
        * [Acerbi, C. and Tasche, D. (2002), Expected Shortfall: A Natural Coherent Alternative to Value at Risk. Economic Notes, 31: 379-388](https://onlinelibrary.wiley.com/doi/abs/10.1111/1468-0300.00091)
      requestBody:
        content:
          application/json:
            examples:
              From portfolio values:
                description: Compute the historical conditional value at risk of a portfolio based on portfolio values, at the default 95% confidence level
                value:
                  portfolios:
                    - portfolioValues:
                        - 100
                        - 95
                        - 100
                        - 90
                        - 85
                        - 70
            schema:
              properties:
                confidenceLevel:
                  default: 0.95
                  description: The confidence level
                  exclusiveMaximum: true
                  exclusiveMinimum: true
                  maximum: 1
                  minimum: 0
                  type: number
                portfolios:
                  items:
                    properties:
                      portfolioValues:
                        description: portfolioValues[t] is the value of the portfolio at the time t
                        items:
                          exclusiveMinimum: true
                          minimum: 0
                          type: number
                        minItems: 2
                        type: array
                    required:
                      - portfolioValues
                    type: object
                  minItems: 1
                  type: array
              required:
                - portfolios
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Computed conditional value at risk of a portfolio
                  value:
                    portfolios:
                      - portfolioConditionalValueAtRisk: 0.17647058823529413
              schema:
                properties:
                  portfolios:
                    items:
                      properties:
                        portfolioConditionalValueAtRisk:
                          description: The conditional value at risk of the portfolio
                          type: number
                      required:
                        - portfolioConditionalValueAtRisk
                      type: object
                    minItems: 1
                    type: array
                required:
                  - portfolios
                type: object
          description: OK
      summary: Historical Conditional Value At Risk
      tags:
        - Portfolio Analysis / Conditional Value At Risk
      x-codegen-request-body-name: body
  /portfolio/analysis/value-at-risk/cornish-fisher:
    post:
      description: |
        Compute the Cornish-Fisher value at risk of one or several portfolio(s) from portfolio values.

        References
        * [Laurent Favre and José-Antonio Galeano, Mean-Modified Value-at-Risk Optimization with Hedge Funds, The Journal of Alternative Investments Fall 2002, 5 (2) 21-25](https://jai.pm-research.com/content/5/2/21)
        * [Lamb, John D., Maura E. Monville, and Kai-Hong Tee. Making Cornish–fisher Fit for Risk Measurement, Journal of Risk, Volume 21, Number 5, p. 53-81](http://doi.org/10.21314/JOR.2019.408)
      requestBody:
        content:
          application/json:
            examples:
              From portfolio values:
                description: Compute the Cornish-Fisher value at risk of a portfolio based on portfolio values, at the default 95% confidence level
                value:
                  portfolios:
                    - portfolioValues:
                        - 100
                        - 95
                        - 100
                        - 90
                        - 85
                        - 70
            schema:
              properties:
                confidenceLevel:
                  default: 0.95
                  description: The confidence level
                  exclusiveMaximum: true
                  exclusiveMinimum: true
                  maximum: 1
                  minimum: 0
                  type: number
                portfolios:
                  items:
                    properties:
                      portfolioValues:
                        description: portfolioValues[t] is the value of the portfolio at the time t
                        items:
                          exclusiveMinimum: true
                          minimum: 0
                          type: number
                        minItems: 5
                        type: array
                    required:
                      - portfolioValues
                    type: object
                  minItems: 1
                  type: array
              required:
                - portfolios
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Computed value at risk of a portfolio
                  value:
                    portfolios:
                      - portfolioValueAtRisk: 0.17647058823529413
              schema:
                properties:
                  portfolios:
                    items:
                      properties:
                        portfolioValueAtRisk:
                          description: The value at risk of the portfolio
                          type: number
                      required:
                        - portfolioValueAtRisk
                      type: object
                    minItems: 1
                    type: array
                required:
                  - portfolios
                type: object
          description: OK
      summary: Cornish-Fisher Value At Risk
      tags:
        - Portfolio Analysis / Value At Risk
      x-codegen-request-body-name: body
  /portfolio/analysis/value-at-risk/cornish-fisher/corrected:
    post:
      description: |
        Compute the corrected Cornish-Fisher value at risk of one or several portfolio(s) from portfolio values.

        References
        * [Lamb, John D., Maura E. Monville, and Kai-Hong Tee. Making Cornish–fisher Fit for Risk Measurement, Journal of Risk, Volume 21, Number 5, p. 53-81](http://doi.org/10.21314/JOR.2019.408)
      requestBody:
        content:
          application/json:
            examples:
              From portfolio values:
                description: Compute the corrected Cornish-Fisher value at risk of a portfolio based on portfolio values, at the default 95% confidence level
                value:
                  portfolios:
                    - portfolioValues:
                        - 100
                        - 95
                        - 100
                        - 90
                        - 85
                        - 70
            schema:
              properties:
                confidenceLevel:
                  default: 0.95
                  description: The confidence level
                  exclusiveMaximum: true
                  exclusiveMinimum: true
                  maximum: 1
                  minimum: 0
                  type: number
                portfolios:
                  items:
                    properties:
                      portfolioValues:
                        description: portfolioValues[t] is the value of the portfolio at the time t
                        items:
                          exclusiveMinimum: true
                          minimum: 0
                          type: number
                        minItems: 5
                        type: array
                    required:
                      - portfolioValues
                    type: object
                  minItems: 1
                  type: array
              required:
                - portfolios
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Computed value at risk of a portfolio
                  value:
                    portfolios:
                      - portfolioValueAtRisk: 0.17647058823529413
              schema:
                properties:
                  portfolios:
                    items:
                      properties:
                        portfolioValueAtRisk:
                          description: The value at risk of the portfolio
                          type: number
                      required:
                        - portfolioValueAtRisk
                      type: object
                    minItems: 1
                    type: array
                required:
                  - portfolios
                type: object
          description: OK
      summary: Corrected Cornish-Fisher Value At Risk
      tags:
        - Portfolio Analysis / Value At Risk
      x-codegen-request-body-name: body
  /portfolio/analysis/value-at-risk/gaussian:
    post:
      description: |
        Compute the Gaussian value at risk of one or several portfolio(s) from portfolio values.

        References
        * [Ballotta, Laura and Fusai, Gianluca, A Gentle Introduction to Value at Risk](https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2942138)
      requestBody:
        content:
          application/json:
            examples:
              From portfolio values:
                description: Compute the Gaussian value at risk of a portfolio based on portfolio values, at the default 95% confidence level
                value:
                  portfolios:
                    - portfolioValues:
                        - 100
                        - 95
                        - 100
                        - 90
                        - 85
                        - 70
            schema:
              properties:
                confidenceLevel:
                  default: 0.95
                  description: The confidence level
                  exclusiveMaximum: true
                  exclusiveMinimum: true
                  maximum: 1
                  minimum: 0
                  type: number
                portfolios:
                  items:
                    properties:
                      portfolioValues:
                        description: portfolioValues[t] is the value of the portfolio at the time t
                        items:
                          exclusiveMinimum: true
                          minimum: 0
                          type: number
                        minItems: 3
                        type: array
                    required:
                      - portfolioValues
                    type: object
                  minItems: 1
                  type: array
              required:
                - portfolios
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Computed value at risk of a portfolio
                  value:
                    portfolios:
                      - portfolioValueAtRisk: 0.17647058823529413
              schema:
                properties:
                  portfolios:
                    items:
                      properties:
                        portfolioValueAtRisk:
                          description: The value at risk of the portfolio
                          type: number
                      required:
                        - portfolioValueAtRisk
                      type: object
                    minItems: 1
                    type: array
                required:
                  - portfolios
                type: object
          description: OK
      summary: Gaussian Value At Risk
      tags:
        - Portfolio Analysis / Value At Risk
      x-codegen-request-body-name: body
  /portfolio/analysis/value-at-risk/historical:
    post:
      description: |
        Compute the historical value at risk of one or several portfolio(s) from portfolio values.

        References
        * [Wikipedia, Value at risk](https://en.wikipedia.org/wiki/Value_at_risk)
        * [Acerbi, C. and Tasche, D. (2002), Expected Shortfall: A Natural Coherent Alternative to Value at Risk. Economic Notes, 31: 379-388](https://onlinelibrary.wiley.com/doi/abs/10.1111/1468-0300.00091)
      requestBody:
        content:
          application/json:
            examples:
              From portfolio values:
                description: Compute the historical value at risk of a portfolio based on portfolio values, at the default 95% confidence level
                value:
                  portfolios:
                    - portfolioValues:
                        - 100
                        - 95
                        - 100
                        - 90
                        - 85
                        - 70
            schema:
              properties:
                confidenceLevel:
                  default: 0.95
                  description: The confidence level
                  exclusiveMaximum: true
                  exclusiveMinimum: true
                  maximum: 1
                  minimum: 0
                  type: number
                portfolios:
                  items:
                    properties:
                      portfolioValues:
                        description: portfolioValues[t] is the value of the portfolio at the time t
                        items:
                          exclusiveMinimum: true
                          minimum: 0
                          type: number
                        minItems: 2
                        type: array
                    required:
                      - portfolioValues
                    type: object
                  minItems: 1
                  type: array
              required:
                - portfolios
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Computed value at risk of a portfolio
                  value:
                    portfolios:
                      - portfolioValueAtRisk: 0.17647058823529413
              schema:
                properties:
                  portfolios:
                    items:
                      properties:
                        portfolioValueAtRisk:
                          description: The value at risk of the portfolio
                          type: number
                      required:
                        - portfolioValueAtRisk
                      type: object
                    minItems: 1
                    type: array
                required:
                  - portfolios
                type: object
          description: OK
      summary: Historical Value At Risk
      tags:
        - Portfolio Analysis / Value At Risk
      x-codegen-request-body-name: body
  /portfolio/analysis/volatility:
    post:
      description: |
        Compute the volatility (i.e., standard deviation) of one or several portfolio(s) from either:  
        * Portfolio assets covariance matrix
        * Portfolio values

        References
        * [Wikipedia, Standard Deviation](https://en.wikipedia.org/wiki/Standard_deviation#Finance)
        * Carl R. Bacon, Practical Portfolio Performance Measurement and Attribution
        * Harry M. Markowitz, Portfolio Selection, Efficient Diversification of Investments, Second edition, Blackwell Publishers Inc.
      requestBody:
        content:
          application/json:
            examples:
              From asset covariance matrix:
                description: Compute the volatility of 2 portfolios based on the assets covariance matrix
                value:
                  assets: 2
                  assetsCovarianceMatrix:
                    - - 0.0025
                      - 0.0005
                    - - 0.0005
                      - 0.01
                  portfolios:
                    - assetsWeights:
                        - 1
                        - 0
                    - assetsWeights:
                        - 0
                        - 1
              From portfolio values:
                description: Compute the volatility of a portfolio based on portfolio values
                value:
                  portfolios:
                    - portfolioValues:
                        - 100
                        - 95
                        - 100
                        - 90
                        - 85
                        - 70
            schema:
              oneOf:
                - properties:
                    assets:
                      description: The number of assets
                      minimum: 2
                      type: integer
                    assetsCovarianceMatrix:
                      description: assetsCovarianceMatrix[i][j] is the covariance between the asset i and the asset j
                      items:
                        items:
                          type: number
                        minItems: 2
                        type: array
                      minItems: 2
                      type: array
                    portfolios:
                      items:
                        properties:
                          assetsWeights:
                            description: assetsWeights[i] is the weight of the asset i in the portfolio, in percentage
                            items:
                              maximum: 1
                              minimum: 0
                              type: number
                            minItems: 2
                            type: array
                        required:
                          - assetsWeights
                        type: object
                      minItems: 1
                      type: array
                  required:
                    - portfolios
                    - assets
                    - assetsCovarianceMatrix
                  type: object
                - properties:
                    portfolios:
                      items:
                        properties:
                          portfolioValues:
                            description: portfolioValues[t] is the value of the portfolio at the time t
                            items:
                              exclusiveMinimum: true
                              minimum: 0
                              type: number
                            minItems: 2
                            type: array
                        required:
                          - portfolioValues
                        type: object
                      minItems: 1
                      type: array
                  required:
                    - portfolios
                  type: object
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Computed volatility of 2 portfolios
                  value:
                    portfolios:
                      - portfolioVolatility: 0.05
                      - portfolioVolatility: 0.1
              schema:
                properties:
                  portfolios:
                    items:
                      properties:
                        portfolioVolatility:
                          description: The volatility of the portfolio
                          minimum: 0
                          type: number
                      required:
                        - portfolioVolatility
                      type: object
                    minItems: 1
                    type: array
                required:
                  - portfolios
                type: object
          description: OK
      summary: Volatility
      tags:
        - Portfolio Analysis
      x-codegen-request-body-name: body
  /portfolio/construction/investable:
    post:
      description: |
        Compute an investable portfolio as close as possible, in terms of assets weights, to a desired portfolio, taking into account:
        * The desired assets weights
        * The desired assets groups weights
        * The desired maximum assets groups weights
        * The prices of the assets
        * The portfolio value
        * The requirement to purchase some assets by round lots or by odd lots
        * The possibility to purchase some assets by a fractional quantity of shares
        * The requirement to purchase a minimum number of shares, or a minimum monetary value, for some assets

        References
        * [Steiner, Andreas, Accuracy and Rounding in Portfolio Construction](https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2261131)
      requestBody:
        content:
          application/json:
            examples:
              Example (groups weights):
                description: Construct an investable portfolio of 10,000$ made of 4 assets with assets groups weights
                value:
                  assets: 4
                  assetsGroups:
                    - - 1
                      - 2
                    - - 3
                      - 4
                  assetsGroupsWeights:
                    - 0.4
                    - 0.4
                  assetsPrices:
                    - 10
                    - 25
                    - 100
                    - 500
                  assetsWeights:
                    - 0.2
                    - null
                    - null
                    - null
                  portfolioValue: 10000
              Example (no groups weights):
                description: Construct an investable portfolio of 10,000$ made of 3 assets
                value:
                  assets: 3
                  assetsPrices:
                    - 10
                    - 25
                    - 500
                  assetsWeights:
                    - 0.05
                    - 0.6
                    - 0.35
                  portfolioValue: 10000
            schema:
              properties:
                assets:
                  description: The number of assets
                  minimum: 2
                  type: integer
                assetsGroups:
                  items:
                    description: assetsGroups[k] is the indexes of the assets belonging to the assets group k in the portfolio; requires either assetsGroupsWeights or maximumAssetsGroupsWeights to be present
                    items:
                      minimum: 1
                      type: integer
                    minItems: 2
                    type: array
                    uniqueItems: true
                  minItems: 1
                  type: array
                assetsGroupsWeights:
                  description: assetsGroupsWeights[i] is the desired weight of the assets group k in the portfolio, in percentage (can be null to indicate no specific desire); requires assetsGroups to be present
                  items:
                    maximum: 1
                    minimum: 0
                    type: number
                  minItems: 1
                  type: array
                assetsMinimumNotionalValues:
                  description: assetsMinimumNotionalValues[i] is the minimum monetary value that the position in the asset i is required to represent when the asset i is included in the portfolio
                  items:
                    default: 0
                    minimum: 0
                    type: number
                  minItems: 2
                  type: array
                assetsMinimumPositions:
                  description: assetsMinimumPositions[i] is the minimum number of shares of the asset i that is required to purchase when the asset i is included in the portfolio (usual values are the same as for assetsSizeLots)
                  items:
                    default: 1
                    exclusiveMinimum: true
                    minimum: 0
                    type: number
                  minItems: 2
                  type: array
                assetsPrices:
                  description: assetsPrices[i] is the price of the asset i
                  items:
                    exclusiveMinimum: true
                    minimum: 0
                    type: number
                  minItems: 2
                  type: array
                assetsSizeLots:
                  description: assetsSizeLots[i] is the number of shares by which it is required to purchase the asset i (usual values are 1 if the asset needs to be purchased share by share, 100 if the asset needs to be purchased by an integer multiple of 100 shares, and 1/1000000 - e.g. for Robinhood broker - if the asset can be purchased by fractional shares)
                  items:
                    default: 1
                    exclusiveMinimum: true
                    minimum: 0
                    type: number
                  minItems: 2
                  type: array
                assetsWeights:
                  description: assetsWeights[i] is the desired weight of the asset i in the portfolio, in percentage (can be null to indicate no specific desire)
                  items:
                    maximum: 1
                    minimum: 0
                    type: number
                  minItems: 2
                  type: array
                maximumAssetsGroupsWeights:
                  description: maximumAssetsGroupsWeights[k] is the maximum desired weight of the assets group k in the portfolio, in percentage (can be null to indicate no specific desire); requires assetsGroups to be present
                  items:
                    maximum: 1
                    minimum: 0
                    type: number
                  minItems: 1
                  type: array
                portfolioValue:
                  description: The monetary value of the portfolio
                  exclusiveMinimum: true
                  minimum: 0
                  type: number
              required:
                - assets
                - assetsPrices
                - portfolioValue
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example (groups weights):
                  description: Computed investable portfolio with 4 assets not fully invested
                  value:
                    assetsPositions:
                      - 200
                      - 80
                      - 20
                      - 4
                    assetsWeights:
                      - 0.2
                      - 0.2
                      - 0.2
                      - 0.2
                Example (no groups weights):
                  description: Computed investable portfolio with 3 assets fully invested
                  value:
                    assetsPositions:
                      - 50
                      - 240
                      - 7
                    assetsWeights:
                      - 0.05
                      - 0.6
                      - 0.35
              schema:
                properties:
                  assetsPositions:
                    description: assetsPositions[i] is the number of shares of the asset i in the portfolio
                    items:
                      minimum: 0
                      type: number
                    minItems: 2
                    type: array
                  assetsWeights:
                    description: assetsWeights[i] is the weight of the asset i in the portfolio, in percentage
                    items:
                      maximum: 1
                      minimum: 0
                      type: number
                    minItems: 2
                    type: array
                required:
                  - assetsPositions
                  - assetsWeights
                type: object
          description: OK
      summary: Investable Portfolio
      tags:
        - Portfolio Construction
      x-codegen-request-body-name: body
  /portfolio/construction/mimicking:
    post:
      description: |
        Construct a portfolio as close as possible, in terms of returns, to a benchmark, optionally subject to:
        * Minimum and maximum weights constraints
        * Maximum group weights constraints
        * Minimum and maximum portfolio exposure constraints

        References 
        * Konstantinos Benidis, Yiyong Feng, Daniel P. Palomar, Optimization Methods for Financial Index Tracking: From Theory to Practice, now publishers Inc (7 juin 2018)
      requestBody:
        content:
          application/json:
            examples:
              Example:
                description: Construct a portfolio mimicking a benchmark with null returns, using 2 assets with opposite returns
                value:
                  assets:
                    - assetReturns:
                        - 0.01
                        - 0.02
                        - 0.03
                    - assetReturns:
                        - -0.01
                        - -0.02
                        - -0.03
                  benchmarkReturns:
                    - 0
                    - 0
                    - 0
              Example with group constraints:
                description: Construct a portfolio mimicking a benchmark using 3 assets and the constraint that the first two assets taken together cannot represent more than 35% of the portfolio
                value:
                  assets:
                    - assetReturns:
                        - 0.01
                        - 0.02
                        - 0.03
                    - assetReturns:
                        - -0.01
                        - 0.04
                        - 0.01
                    - assetReturns:
                        - 0.05
                        - -0.01
                        - 0
                  benchmarkReturns:
                    - 0.02
                    - 0.01
                    - 0.06
                  constraints:
                    assetsGroups:
                      - - 1
                        - 2
                    maximumAssetsGroupsWeights:
                      - 0.35
            schema:
              properties:
                assets:
                  items:
                    properties:
                      assetReturns:
                        description: assetReturns[t] is the return of the asset at the time t; all the assetReturns arrays must have the same length
                        items:
                          type: number
                        minItems: 2
                        type: array
                    required:
                      - assetReturns
                    type: object
                  minItems: 2
                  type: array
                benchmarkReturns:
                  description: benchmarkReturns[t] is the return of the benchmark at the time t; the benchmarkReturns array must have the same length as all the assetReturns arrays
                  items:
                    type: number
                  minItems: 2
                  type: array
                constraints:
                  properties:
                    assetsGroups:
                      items:
                        description: assetsGroups[k] is the indexes of the assets belonging to the assets group k in the portfolio; exclusive with assetsGroupsMatrix
                        items:
                          minimum: 1
                          type: integer
                        minItems: 2
                        type: array
                        uniqueItems: true
                      minItems: 1
                      type: array
                    assetsGroupsMatrix:
                      description: assetsGroupsMatrix[k][i] is the weight of the asset i in the group of assets k; exclusive with assetsGroups
                      items:
                        items:
                          type: number
                        minItems: 2
                        type: array
                      minItems: 1
                      type: array
                    maximumAssetsGroupsWeights:
                      description: maximumAssetsGroupsWeights[k] is the maximum weight of the assets group k in the portfolio, in percentage between 0 and 1 if assetsGroups is provided
                      items:
                        type: number
                      type: array
                    maximumAssetsWeights:
                      description: maximumAssetsWeights[i] is the maximum weight of the asset i in the portfolio, in percentage
                      items:
                        maximum: 1
                        minimum: 0
                        type: number
                      type: array
                    maximumPortfolioExposure:
                      default: 1
                      description: The maximum portfolio exposure; must be higher than or equal to minimumPortfolioExposure
                      maximum: 1
                      minimum: 0
                      type: number
                    minimumAssetsWeights:
                      description: minimumAssetsWeights[i] is the minimum weight of the asset i in the portfolio, in percentage
                      items:
                        maximum: 1
                        minimum: 0
                        type: number
                      type: array
                    minimumPortfolioExposure:
                      default: 1
                      description: The minimum portfolio exposure; must be lower than or equal to maximumPortfolioExposure
                      maximum: 1
                      minimum: 0
                      type: number
                  type: object
              required:
                - assets
                - benchmarkReturns
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Constructed mimicking portfolio is invested equally in the 2 assets
                  value:
                    assetsWeights:
                      - 0.5
                      - 0.5
              schema:
                properties:
                  assetsWeights:
                    description: assetsWeights[i] is the weight of the asset i in the portfolio, in percentage
                    items:
                      maximum: 1
                      minimum: 0
                      type: number
                    minItems: 2
                    type: array
                required:
                  - assetsWeights
                type: object
          description: OK
      summary: Mimicking Portfolio
      tags:
        - Portfolio Construction
      x-codegen-request-body-name: body
  /portfolio/construction/random:
    post:
      description: |
        Construct one or several random portfolio(s), optionally subject to:       
        * Minimum and maximum weights constraints
        * Minimum and maximum portfolio exposure constraints

        > Because of the nature of the endpoint, subsequent calls with the same input data will result in different output data.

        References
        * [William Thornton Shaw, Monte Carlo Portfolio Optimization for General Investor Risk-Return Objectives and Arbitrary Return Distributions: A Solution for Long-Only Portfolios](https://papers.ssrn.com/sol3/papers.cfm?abstract_id=1680224)
      requestBody:
        content:
          application/json:
            examples:
              Example:
                description: Construct 2 random portfolios, each made of 3 assets
                value:
                  assets: 3
                  portfolios: 2
            schema:
              properties:
                assets:
                  description: The number of assets
                  minimum: 1
                  type: integer
                constraints:
                  properties:
                    maximumAssetsWeights:
                      description: maximumAssetsWeights[i] is the maximum weight of the asset i in the portfolio, in percentage
                      items:
                        maximum: 1
                        minimum: 0
                        type: number
                      type: array
                    maximumPortfolioExposure:
                      default: 1
                      description: The maximum portfolio exposure; must be higher than or equal to minimumPortfolioExposure
                      maximum: 1
                      minimum: 0
                      type: number
                    minimumAssetsWeights:
                      description: minimumAssetsWeights[i] is the minimum weight of the asset i in the portfolio, in percentage
                      items:
                        maximum: 1
                        minimum: 0
                        type: number
                      type: array
                    minimumPortfolioExposure:
                      default: 1
                      description: The minimum portfolio exposure; must be lower than or equal to maximumPortfolioExposure
                      maximum: 1
                      minimum: 0
                      type: number
                  type: object
                portfolios:
                  default: 25
                  description: The number of portfolios to construct
                  minimum: 1
                  type: integer
              required:
                - assets
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Constructed 2 random portfolios, each made of 3 assets
                  value:
                    portfolios:
                      - assetsWeights:
                          - 0.11429744284625785
                          - 0.0038592674702259393
                          - 0.8818432896835162
                      - assetsWeights:
                          - 0.546026607601722
                          - 0.07707923859010406
                          - 0.376894153808174
              schema:
                properties:
                  portfolios:
                    items:
                      properties:
                        assetsWeights:
                          description: assetsWeights[i] is the weight of the asset i in the portfolio, in percentage
                          items:
                            maximum: 1
                            minimum: 0
                            type: number
                          minItems: 1
                          type: array
                      required:
                        - assetsWeights
                      type: object
                    minItems: 1
                    type: array
                required:
                  - portfolios
                type: object
          description: OK
      summary: Random Portfolio
      tags:
        - Portfolio Construction
      x-codegen-request-body-name: body
  /portfolio/optimization/equal-risk-contributions:
    post:
      description: |
        Compute the asset weights of the equal risk contributions portfolio, optionally subject to:  
        * Minimum and maximum weights constraints  

        References
         * [Richard, Jean-Charles and Roncalli, Thierry, Constrained Risk Budgeting Portfolios: Theory, Algorithms, Applications & Puzzles](https://papers.ssrn.com/sol3/papers.cfm?abstract_id=3331184)
      requestBody:
        content:
          application/json:
            examples:
              Example:
                description: Compute the portfolio weights for 2 assets, with maximum assets weights constraints
                value:
                  assets: 2
                  assetsCovarianceMatrix:
                    - - 0.0025
                      - 0.0005
                    - - 0.0005
                      - 0.01
                  constraints:
                    maximumAssetsWeights:
                      - 0.4
                      - 1
            schema:
              properties:
                assets:
                  description: The number of assets
                  minimum: 2
                  type: integer
                assetsCovarianceMatrix:
                  description: assetsCovarianceMatrix[i][j] is the covariance between the asset i and the asset j
                  items:
                    items:
                      type: number
                    minItems: 2
                    type: array
                  minItems: 2
                  type: array
                constraints:
                  properties:
                    maximumAssetsWeights:
                      description: maximumAssetsWeights[i] is the maximum weight of the asset i in the portfolio, in percentage
                      items:
                        maximum: 1
                        minimum: 0
                        type: number
                      type: array
                    minimumAssetsWeights:
                      description: minimumAssetsWeights[i] is the minimum weight of the asset i in the portfolio, in percentage
                      items:
                        maximum: 1
                        minimum: 0
                        type: number
                      type: array
                  type: object
              required:
                - assets
                - assetsCovarianceMatrix
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Computed equal risk contributions portfolio of 2 assets
                  value:
                    assetsWeights:
                      - 0.4
                      - 0.5999975015091795
              schema:
                properties:
                  assetsWeights:
                    description: assetsWeights[i] is the weight of the asset i in the portfolio, in percentage
                    items:
                      maximum: 1
                      minimum: 0
                      type: number
                    minItems: 2
                    type: array
                required:
                  - assetsWeights
                type: object
          description: OK
      summary: Equal Risk Contributions Portfolio
      tags:
        - Portfolio Optimization
      x-codegen-request-body-name: body
  /portfolio/optimization/equal-sharpe-ratio-contributions:
    post:
      description: |
        Compute the asset weights of the equal Sharpe Ratio contributions portfolio.

        References
         * [Andreas Steiner, Sharpe Ratio Contribution and Attribution Analysis](https://papers.ssrn.com/sol3/papers.cfm?abstract_id=1839166")
      requestBody:
        content:
          application/json:
            examples:
              Example:
                description: Compute the portfolio weights for 2 assets
                value:
                  assets: 2
                  assetsCovarianceMatrix:
                    - - 0.05
                      - 0.02
                    - - 0.02
                      - 0.07
                  assetsReturns:
                    - 0.05
                    - 0.1
                  riskFreeRate: 0
            schema:
              properties:
                assets:
                  description: The number of assets
                  minimum: 2
                  type: integer
                assetsCovarianceMatrix:
                  description: assetsCovarianceMatrix[i][j] is the covariance between the asset i and the asset j
                  items:
                    items:
                      type: number
                    minItems: 2
                    type: array
                  minItems: 2
                  type: array
                assetsReturns:
                  description: assetsReturns[i] is the arithmetic return of asset i
                  items:
                    type: number
                  minItems: 2
                  type: array
                riskFreeRate:
                  description: The risk free rate
                  type: number
              required:
                - assets
                - assetsReturns
                - riskFreeRate
                - assetsCovarianceMatrix
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Computed portfolio weights for 2 assets
                  value:
                    assetsWeights:
                      - 0.6666666666666666
                      - 0.3333333333333333
              schema:
                properties:
                  assetsWeights:
                    description: assetsWeights[i] is the weight of the asset i in the portfolio, in percentage
                    items:
                      maximum: 1
                      minimum: 0
                      type: number
                    minItems: 2
                    type: array
                required:
                  - assetsWeights
                type: object
          description: OK
      summary: Equal Sharpe Ratio Contributions Portfolio
      tags:
        - Portfolio Optimization
      x-codegen-request-body-name: body
  /portfolio/optimization/equal-volatility-weighted:
    post:
      description: |
        Compute the asset weights of the equal volatility-weighted portfolio.

        References
         * [Tristan Froidure, Khalid Jalalzai and Yves Choueifaty, Portfolio Rho-Representativity, International Journal of Theoretical and Applied FinanceVol. 22, No. 07, 1950034 (2019)](https://www.worldscientific.com/doi/10.1142/S0219024919500341)
      requestBody:
        content:
          application/json:
            examples:
              Example:
                description: Compute the portfolio weights for 2 assets with volatilities equal to 0.05 and 0.1
                value:
                  assets: 2
                  assetsVolatilities:
                    - 0.05
                    - 0.1
            schema:
              properties:
                assets:
                  description: The number of assets
                  minimum: 2
                  type: integer
                assetsVolatilities:
                  description: assetsVolatilities[i] is the volatility of the asset i
                  items:
                    minimum: 0
                    type: number
                  minItems: 2
                  type: array
              required:
                - assets
                - assetsVolatilities
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Computed equal volatility-weighted portfolio of 2 assets
                  value:
                    assetsWeights:
                      - 0.3333333333333333
                      - 0.6666666666666666
              schema:
                properties:
                  assetsWeights:
                    description: assetsWeights[i] is the weight of the asset i in the portfolio, in percentage
                    items:
                      maximum: 1
                      minimum: 0
                      type: number
                    minItems: 2
                    type: array
                required:
                  - assetsWeights
                type: object
          description: OK
      summary: Equal Volatility Weighted Portfolio
      tags:
        - Portfolio Optimization
      x-codegen-request-body-name: body
  /portfolio/optimization/equal-weighted:
    post:
      description: |
        Compute the asset weights of the equal-weighted portfolio.

        References
         * [Victor DeMiguel and al., Optimal Versus Naive Diversification: How Inefficient is the 1/N Portfolio Strategy?](https://academic.oup.com/rfs/article-abstract/22/5/1915/1592901?redirectedFrom=fulltext)
      requestBody:
        content:
          application/json:
            examples:
              Example:
                description: Compute the portfolio weights for 2 assets
                value:
                  assets: 2
            schema:
              properties:
                assets:
                  description: The number of assets
                  minimum: 2
                  type: integer
              required:
                - assets
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Computed equal-weighted portfolio of 2 assets
                  value:
                    assetsWeights:
                      - 0.5
                      - 0.5
              schema:
                properties:
                  assetsWeights:
                    description: assetsWeights[i] is the weight of the asset i in the portfolio, in percentage
                    items:
                      maximum: 1
                      minimum: 0
                      type: number
                    minItems: 2
                    type: array
                required:
                  - assetsWeights
                type: object
          description: OK
      summary: Equal Weighted Portfolio
      tags:
        - Portfolio Optimization
      x-codegen-request-body-name: body
  /portfolio/optimization/hierarchical-risk-parity:
    post:
      description: |
        Compute the asset weights of the hierarchical risk parity portfolio, optionally subject to:  
        * Minimum and maximum weights constraints
        * Minimum and maximum portfolio exposure constraints

        References
         * [Lopez de Prado, M. (2016). Building diversified portfolios that outperform out-of-sample. Journal of Portfolio Management, 42(4), 59–69](https://jpm.pm-research.com/content/42/4/59)
         * [Johann Pfitzinger & Nico Katzke, 2019. A constrained hierarchical risk parity algorithm with cluster-based capital allocation. Working Papers 14/2019, Stellenbosch University, Department of Economics](https://ideas.repec.org/p/sza/wpaper/wpapers328.html)
      requestBody:
        content:
          application/json:
            examples:
              Example:
                description: Compute the portfolio weights for 2 assets, with maximum assets weights and portfolio exposure constraints
                value:
                  assets: 2
                  assetsCovarianceMatrix:
                    - - 0.0025
                      - 0.0005
                    - - 0.0005
                      - 0.01
                  constraints:
                    maximumAssetsWeights:
                      - 0.4
                      - 1
                    maximumPortfolioExposure: 0.5
                    minimumPortfolioExposure: 0.5
            schema:
              properties:
                assets:
                  description: The number of assets
                  minimum: 2
                  type: integer
                assetsCovarianceMatrix:
                  description: assetsCovarianceMatrix[i][j] is the covariance between the asset i and the asset j
                  items:
                    items:
                      type: number
                    minItems: 2
                    type: array
                  minItems: 2
                  type: array
                clusteringMethod:
                  default: singleLinkage
                  description: The hierarchical clustering method to use
                  enum:
                    - singleLinkage
                    - averageLinkage
                    - completeLinkage
                    - wardLinkage
                  type: string
                clusteringOrdering:
                  default: r-hclust
                  description: The order to impose on the hierarchical clustering tree leaves
                  enum:
                    - r-hclust
                    - optimal
                  type: string
                constraints:
                  properties:
                    maximumAssetsWeights:
                      description: maximumAssetsWeights[i] is the maximum weight of the asset i in the portfolio, in percentage
                      items:
                        maximum: 1
                        minimum: 0
                        type: number
                      type: array
                    maximumPortfolioExposure:
                      default: 1
                      description: The maximum portfolio exposure; must be higher than or equal to minimumPortfolioExposure
                      maximum: 1
                      minimum: 0
                      type: number
                    minimumAssetsWeights:
                      description: minimumAssetsWeights[i] is the minimum weight of the asset i in the portfolio, in percentage
                      items:
                        maximum: 1
                        minimum: 0
                        type: number
                      type: array
                    minimumPortfolioExposure:
                      default: 1
                      description: The minimum portfolio exposure; must be lower than or equal to maximumPortfolioExposure
                      maximum: 1
                      minimum: 0
                      type: number
                  type: object
              required:
                - assets
                - assetsCovarianceMatrix
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Computed portfolio of 2 assets
                  value:
                    assetsWeights:
                      - 0.4
                      - 0.09999999999998999
              schema:
                properties:
                  assetsWeights:
                    description: assetsWeights[i] is the weight of the asset i in the portfolio, in percentage
                    items:
                      maximum: 1
                      minimum: 0
                      type: number
                    minItems: 2
                    type: array
                required:
                  - assetsWeights
                type: object
          description: OK
      summary: Hierarchical Risk Parity Portfolio
      tags:
        - Portfolio Optimization
      x-codegen-request-body-name: body
  /portfolio/optimization/hierarchical-risk-parity/clustering-based:
    post:
      description: |
        Compute the asset weights of the hierarchical clustering-based risk parity portfolio, optionally subject to:  
        * Minimum and maximum weights constraints
        * Minimum and maximum portfolio exposure constraints

        References
         * [Machine Learning for Asset Management: New Developments and Financial Applications, Emmanuel Jurczenko, Chapter 9, Harald Lohre,Carsten Rother,Kilian Axel Schäfer, Hierarchical Risk Parity: Accounting for Tail Dependencies in Multi-asset Multi-factor Allocations](https://onlinelibrary.wiley.com/doi/10.1002/9781119751182.ch9)
         * [Thomas Raffinot, Hierarchical Clustering-Based Asset Allocation, The Journal of Portfolio Management Multi-Asset Special Issue 2018, 44 (2) 89-99](https://jpm.pm-research.com/content/44/2/89.abstract)
         * [Raffinot, Thomas, The Hierarchical Equal Risk Contribution Portfolio](https://ssrn.com/abstract=3237540)
         * [Johann Pfitzinger & Nico Katzke, 2019. A constrained hierarchical risk parity algorithm with cluster-based capital allocation. Working Papers 14/2019, Stellenbosch University, Department of Economics](https://ideas.repec.org/p/sza/wpaper/wpapers328.html)
      requestBody:
        content:
          application/json:
            examples:
              Example:
                description: Compute the portfolio weights for 2 assets, with maximum assets weights and portfolio exposure constraints
                value:
                  assets: 2
                  assetsCovarianceMatrix:
                    - - 0.0025
                      - 0.0005
                    - - 0.0005
                      - 0.01
                  constraints:
                    maximumAssetsWeights:
                      - 0.4
                      - 1
                    maximumPortfolioExposure: 0.5
                    minimumPortfolioExposure: 0.5
            schema:
              properties:
                acrossClusterAllocationMethod:
                  default: equalWeighting
                  description: The allocation method to use across clusters
                  enum:
                    - equalWeighting
                    - inverseVolatility
                    - inverseVariance
                  type: string
                assets:
                  description: The number of assets
                  minimum: 2
                  type: integer
                assetsCovarianceMatrix:
                  description: assetsCovarianceMatrix[i][j] is the covariance between the asset i and the asset j
                  items:
                    items:
                      type: number
                    minItems: 2
                    type: array
                  minItems: 2
                  type: array
                clusteringMethod:
                  default: wardLinkage
                  description: The hierarchical clustering method to use
                  enum:
                    - singleLinkage
                    - averageLinkage
                    - completeLinkage
                    - wardLinkage
                  type: string
                clusteringOrdering:
                  default: r-hclust
                  description: The order to impose on the hierarchical clustering tree leaves
                  enum:
                    - r-hclust
                    - optimal
                  type: string
                clusters:
                  description: The number of clusters to use in the hierarchical clustering tree; if not provided, the number of clusters to use is computed using the gap statistic method, as described in the first reference
                  minimum: 1
                  type: integer
                constraints:
                  properties:
                    maximumAssetsWeights:
                      description: maximumAssetsWeights[i] is the maximum weight of the asset i in the portfolio, in percentage
                      items:
                        maximum: 1
                        minimum: 0
                        type: number
                      type: array
                    maximumPortfolioExposure:
                      default: 1
                      description: The maximum portfolio exposure; must be higher than or equal to minimumPortfolioExposure
                      maximum: 1
                      minimum: 0
                      type: number
                    minimumAssetsWeights:
                      description: minimumAssetsWeights[i] is the minimum weight of the asset i in the portfolio, in percentage
                      items:
                        maximum: 1
                        minimum: 0
                        type: number
                      type: array
                    minimumPortfolioExposure:
                      default: 1
                      description: The minimum portfolio exposure; must be lower than or equal to maximumPortfolioExposure
                      maximum: 1
                      minimum: 0
                      type: number
                  type: object
                withinClusterAllocationMethod:
                  default: equalWeighting
                  description: The allocation method to use within clusters
                  enum:
                    - equalWeighting
                    - inverseVolatility
                    - inverseVariance
                  type: string
              required:
                - assets
                - assetsCovarianceMatrix
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Computed portfolio of 2 assets
                  value:
                    assetsWeights:
                      - 0.4
                      - 0.09999999999998999
              schema:
                properties:
                  assetsWeights:
                    description: assetsWeights[i] is the weight of the asset i in the portfolio, in percentage
                    items:
                      maximum: 1
                      minimum: 0
                      type: number
                    minItems: 2
                    type: array
                required:
                  - assetsWeights
                type: object
          description: OK
      summary: Hierarchical Clustering-Based Risk Parity Portfolio
      tags:
        - Portfolio Optimization
      x-codegen-request-body-name: body
  /portfolio/optimization/inverse-variance-weighted:
    post:
      description: |
        Compute the asset weights of the inverse variance-weighted portfolio.

        References
         * [Raul Leote de Carvalho and al., Demystifying Equity Risk-Based Strategies: A Simple Alpha Plus Beta Description](https://doi.org/10.3905/jpm.2012.38.3.056)
      requestBody:
        content:
          application/json:
            examples:
              Example:
                description: Compute the portfolio weights for 2 assets with variances equal to 1 and 0.5
                value:
                  assets: 2
                  assetsVariances:
                    - 1
                    - 0.5
            schema:
              properties:
                assets:
                  description: The number of assets
                  minimum: 2
                  type: integer
                assetsVariances:
                  description: assetsVariances[i] is the variance of the asset i
                  items:
                    minimum: 0
                    type: number
                  minItems: 2
                  type: array
              required:
                - assets
                - assetsVariances
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Computed inverse variance-weighted portfolio of 2 assets
                  value:
                    assetsWeights:
                      - 0.3333333333333333
                      - 0.6666666666666666
              schema:
                properties:
                  assetsWeights:
                    description: assetsWeights[i] is the weight of the asset i in the portfolio, in percentage
                    items:
                      maximum: 1
                      minimum: 0
                      type: number
                    minItems: 2
                    type: array
                required:
                  - assetsWeights
                type: object
          description: OK
      summary: Inverse Variance Weighted Portfolio
      tags:
        - Portfolio Optimization
      x-codegen-request-body-name: body
  /portfolio/optimization/inverse-volatility-weighted:
    post:
      description: |
        Compute the asset weights of the inverse volatility-weighted portfolio.

        References
         * [Raul Leote de Carvalho and al., Demystifying Equity Risk-Based Strategies: A Simple Alpha Plus Beta Description](https://doi.org/10.3905/jpm.2012.38.3.056)
      requestBody:
        content:
          application/json:
            examples:
              Example:
                description: Compute the portfolio weights for 2 assets with volatilities equal to 0.05 and 0.1
                value:
                  assets: 2
                  assetsVolatilities:
                    - 0.05
                    - 0.1
            schema:
              properties:
                assets:
                  description: The number of assets
                  minimum: 2
                  type: integer
                assetsVolatilities:
                  description: assetsVolatilities[i] is the volatility of the asset i
                  items:
                    minimum: 0
                    type: number
                  minItems: 2
                  type: array
              required:
                - assets
                - assetsVolatilities
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Computed inverse volatility-weighted portfolio of 2 assets
                  value:
                    assetsWeights:
                      - 0.6666666666666666
                      - 0.3333333333333333
              schema:
                properties:
                  assetsWeights:
                    description: assetsWeights[i] is the weight of the asset i in the portfolio, in percentage
                    items:
                      maximum: 1
                      minimum: 0
                      type: number
                    minItems: 2
                    type: array
                required:
                  - assetsWeights
                type: object
          description: OK
      summary: Inverse Volatility Weighted Portfolio
      tags:
        - Portfolio Optimization
      x-codegen-request-body-name: body
  /portfolio/optimization/market-capitalization-weighted:
    post:
      description: |
        Compute the asset weights of the market capitalization-weighted portfolio.

        References
         * [Wikipedia, Capitalization-weighted Index](https://en.wikipedia.org/wiki/Capitalization-weighted_index)
      requestBody:
        content:
          application/json:
            examples:
              Example:
                description: Compute the portfolio weights for 2 assets with market capitalizations equal to 1 and 2
                value:
                  assets: 2
                  assetsMarketCapitalizations:
                    - 1
                    - 2
            schema:
              properties:
                assets:
                  description: The number of assets
                  minimum: 2
                  type: integer
                assetsMarketCapitalizations:
                  description: assetsMarketCapitalizations[i] is the market capitalization of the asset i
                  items:
                    minimum: 0
                    type: number
                  minItems: 2
                  type: array
              required:
                - assets
                - assetsMarketCapitalizations
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Computed market capitalization-weighted portfolio of 2 assets
                  value:
                    assetsWeights:
                      - 0.3333333333333333
                      - 0.6666666666666666
              schema:
                properties:
                  assetsWeights:
                    description: assetsWeights[i] is the weight of the asset i in the portfolio, in percentage
                    items:
                      maximum: 1
                      minimum: 0
                      type: number
                    minItems: 2
                    type: array
                required:
                  - assetsWeights
                type: object
          description: OK
      summary: Market Capitalization Weighted Portfolio
      tags:
        - Portfolio Optimization
      x-codegen-request-body-name: body
  /portfolio/optimization/maximum-decorrelation:
    post:
      description: |
        Compute the asset weights of the maximum decorrelation portfolio, optionally subject to:  
        * Minimum and maximum weights constraints
        * Maximum group weights constraints
        * Minimum and maximum portfolio exposure constraints

        References
         * [F. Goltz, S. Sivasubramanian, Scientific Beta Maximum Decorrelation Indices](http://www.scientificbeta.com/download/file/scientific-beta-max-decorrelation-indices)
      requestBody:
        content:
          application/json:
            examples:
              Example:
                description: Compute the portfolio weights for 3 assets
                value:
                  assets: 3
                  assetsCorrelationMatrix:
                    - - 1
                      - 0.9
                      - 0.85
                    - - 0.9
                      - 1
                      - 0.7
                    - - 0.85
                      - 0.7
                      - 1
            schema:
              properties:
                assets:
                  description: The number of assets
                  minimum: 2
                  type: integer
                assetsCorrelationMatrix:
                  description: assetsCorrelationMatrix[i][j] is the correlation between the asset i and the asset j
                  items:
                    items:
                      type: number
                    minItems: 2
                    type: array
                  minItems: 2
                  type: array
                assetsReturns:
                  description: assetsReturns[i] is the arithmetic return of asset i
                  items:
                    type: number
                  minItems: 1
                  type: array
                constraints:
                  properties:
                    assetsGroups:
                      items:
                        description: assetsGroups[k] is the indexes of the assets belonging to the assets group k in the portfolio; exclusive with assetsGroupsMatrix
                        items:
                          minimum: 1
                          type: integer
                        minItems: 2
                        type: array
                        uniqueItems: true
                      minItems: 1
                      type: array
                    assetsGroupsMatrix:
                      description: assetsGroupsMatrix[k][i] is the weight of the asset i in the group of assets k; exclusive with assetsGroups
                      items:
                        items:
                          type: number
                        minItems: 2
                        type: array
                      minItems: 1
                      type: array
                    maximumAssetsGroupsWeights:
                      description: maximumAssetsGroupsWeights[k] is the maximum weight of the assets group k in the portfolio, in percentage between 0 and 1 if assetsGroups is provided
                      items:
                        type: number
                      type: array
                    maximumAssetsWeights:
                      description: maximumAssetsWeights[i] is the maximum weight of the asset i in the portfolio, in percentage
                      items:
                        maximum: 1
                        minimum: 0
                        type: number
                      type: array
                    maximumPortfolioExposure:
                      default: 1
                      description: The maximum portfolio exposure; must be higher than or equal to minimumPortfolioExposure
                      maximum: 1
                      minimum: 0
                      type: number
                    minimumAssetsWeights:
                      description: minimumAssetsWeights[i] is the minimum weight of the asset i in the portfolio, in percentage
                      items:
                        maximum: 1
                        minimum: 0
                        type: number
                      type: array
                    minimumPortfolioExposure:
                      default: 1
                      description: The minimum portfolio exposure; must be lower than or equal to maximumPortfolioExposure
                      maximum: 1
                      minimum: 0
                      type: number
                  type: object
              required:
                - assets
                - assetsCorrelationMatrix
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Computed maximum decorrelation portfolio of 3 assets
                  value:
                    assetsWeights:
                      - 0
                      - 0.5
                      - 0.5
              schema:
                properties:
                  assetsWeights:
                    description: assetsWeights[i] is the weight of the asset i in the portfolio, in percentage
                    items:
                      maximum: 1
                      minimum: 0
                      type: number
                    minItems: 2
                    type: array
                required:
                  - assetsWeights
                type: object
          description: OK
      summary: Maximum Decorrelation Portfolio
      tags:
        - Portfolio Optimization
      x-codegen-request-body-name: body
  /portfolio/optimization/maximum-return:
    post:
      description: |
        Compute the asset weights of the maximum return portfolio, optionally subject to:  
        * Minimum and maximum weights constraints
        * Maximum group weights constraints
        * Minimum and maximum portfolio exposure constraints

        References
         * Harry M. Markowitz, Portfolio Selection, Efficient Diversification of Investments, Second edition, Blackwell Publishers Inc.
      requestBody:
        content:
          application/json:
            examples:
              Example:
                description: Compute the portfolio weights for 2 assets, with maximum assets weights constraints
                value:
                  assets: 2
                  assetsReturns:
                    - 0.02
                    - 0.01
                  constraints:
                    maximumAssetsWeights:
                      - 0.4
                      - 1
            schema:
              properties:
                assets:
                  description: The number of assets
                  minimum: 2
                  type: integer
                assetsCovarianceMatrix:
                  description: assetsCovarianceMatrix[i][j] is the covariance between the asset i and the asset j
                  items:
                    items:
                      type: number
                    minItems: 2
                    type: array
                  minItems: 2
                  type: array
                assetsReturns:
                  description: assetsReturns[i] is the arithmetic return of asset i
                  items:
                    type: number
                  minItems: 1
                  type: array
                constraints:
                  properties:
                    assetsGroups:
                      items:
                        description: assetsGroups[k] is the indexes of the assets belonging to the assets group k in the portfolio; exclusive with assetsGroupsMatrix
                        items:
                          minimum: 1
                          type: integer
                        minItems: 2
                        type: array
                        uniqueItems: true
                      minItems: 1
                      type: array
                    assetsGroupsMatrix:
                      description: assetsGroupsMatrix[k][i] is the weight of the asset i in the group of assets k; exclusive with assetsGroups
                      items:
                        items:
                          type: number
                        minItems: 2
                        type: array
                      minItems: 1
                      type: array
                    maximumAssetsGroupsWeights:
                      description: maximumAssetsGroupsWeights[k] is the maximum weight of the assets group k in the portfolio, in percentage between 0 and 1 if assetsGroups is provided
                      items:
                        type: number
                      type: array
                    maximumAssetsWeights:
                      description: maximumAssetsWeights[i] is the maximum weight of the asset i in the portfolio, in percentage
                      items:
                        maximum: 1
                        minimum: 0
                        type: number
                      type: array
                    maximumPortfolioExposure:
                      default: 1
                      description: The maximum portfolio exposure; must be higher than or equal to minimumPortfolioExposure
                      maximum: 1
                      minimum: 0
                      type: number
                    minimumAssetsWeights:
                      description: minimumAssetsWeights[i] is the minimum weight of the asset i in the portfolio, in percentage
                      items:
                        maximum: 1
                        minimum: 0
                        type: number
                      type: array
                    minimumPortfolioExposure:
                      default: 1
                      description: The minimum portfolio exposure; must be lower than or equal to maximumPortfolioExposure
                      maximum: 1
                      minimum: 0
                      type: number
                  type: object
              required:
                - assets
                - assetsReturns
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Computed maximum return portfolio of 2 assets
                  value:
                    assetsWeights:
                      - 0.4
                      - 0.6
              schema:
                properties:
                  assetsWeights:
                    description: assetsWeights[i] is the weight of the asset i in the portfolio, in percentage
                    items:
                      maximum: 1
                      minimum: 0
                      type: number
                    minItems: 2
                    type: array
                required:
                  - assetsWeights
                type: object
          description: OK
      summary: Maximum Return Portfolio
      tags:
        - Portfolio Optimization / Mean-Variance
      x-codegen-request-body-name: body
  /portfolio/optimization/maximum-return/diversified:
    post:
      description: |
        Compute the asset weights of the diversified maximum return portfolio, as defined in the first reference, optionally subject to:  
        * Minimum and maximum weights constraints
        * Maximum group weights constraints
        * Minimum and maximum portfolio exposure constraints

        The diversification measure used in the optimization procedure is the [Herfindahl-Hirschman Index](https://en.wikipedia.org/wiki/Herfindahl%E2%80%93Hirschman_index) of the assets weights.

        References
         * [Alejandro Corvalan, 2005. Well Diversified Efficient Portfolios, Working Papers Central Bank of Chile 336, Central Bank of Chile](https://ideas.repec.org/p/chb/bcchwp/336.html)
         * [Bouchaud, Jean-Philippe and Potters, Marc and Aguilar, Jean-Pierre, Missing Information and Asset Allocation, arXiv, 1997](https://arxiv.org/abs/cond-mat/9707042)
         * Harry M. Markowitz, Portfolio Selection, Efficient Diversification of Investments, Second edition, Blackwell Publishers Inc.
      requestBody:
        content:
          application/json:
            examples:
              Example:
                description: Compute the portfolio weights for 2 assets, with maximum assets weights constraints
                value:
                  assets: 2
                  assetsReturns:
                    - 0.02
                    - 0.01
                  constraints:
                    maximumAssetsWeights:
                      - 0.4
                      - 1
            schema:
              properties:
                assets:
                  description: The number of assets
                  minimum: 2
                  type: integer
                assetsCovarianceMatrix:
                  description: assetsCovarianceMatrix[i][j] is the covariance between the asset i and the asset j
                  items:
                    items:
                      type: number
                    minItems: 2
                    type: array
                  minItems: 2
                  type: array
                assetsReturns:
                  description: assetsReturns[i] is the arithmetic return of asset i
                  items:
                    type: number
                  minItems: 1
                  type: array
                constraints:
                  properties:
                    assetsGroups:
                      items:
                        description: assetsGroups[k] is the indexes of the assets belonging to the assets group k in the portfolio; exclusive with assetsGroupsMatrix
                        items:
                          minimum: 1
                          type: integer
                        minItems: 2
                        type: array
                        uniqueItems: true
                      minItems: 1
                      type: array
                    assetsGroupsMatrix:
                      description: assetsGroupsMatrix[k][i] is the weight of the asset i in the group of assets k; exclusive with assetsGroups
                      items:
                        items:
                          type: number
                        minItems: 2
                        type: array
                      minItems: 1
                      type: array
                    deltaReturn:
                      default: 0.1
                      description: The relative tolerance over the maximum return portfolio return
                      minimum: 0
                      type: number
                    deltaVolatility:
                      default: 0.1
                      description: The relative tolerance over the maximum return portfolio volatility, if applicable
                      minimum: 0
                      type: number
                    maximumAssetsGroupsWeights:
                      description: maximumAssetsGroupsWeights[k] is the maximum weight of the assets group k in the portfolio, in percentage between 0 and 1 if assetsGroups is provided
                      items:
                        type: number
                      type: array
                    maximumAssetsWeights:
                      description: maximumAssetsWeights[i] is the maximum weight of the asset i in the portfolio, in percentage
                      items:
                        maximum: 1
                        minimum: 0
                        type: number
                      type: array
                    maximumPortfolioExposure:
                      default: 1
                      description: The maximum portfolio exposure; must be higher than or equal to minimumPortfolioExposure
                      maximum: 1
                      minimum: 0
                      type: number
                    minimumAssetsWeights:
                      description: minimumAssetsWeights[i] is the minimum weight of the asset i in the portfolio, in percentage
                      items:
                        maximum: 1
                        minimum: 0
                        type: number
                      type: array
                    minimumPortfolioExposure:
                      default: 1
                      description: The minimum portfolio exposure; must be lower than or equal to maximumPortfolioExposure
                      maximum: 1
                      minimum: 0
                      type: number
                  type: object
              required:
                - assets
                - assetsReturns
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Computed diversified maximum return portfolio of 2 assets
                  value:
                    assetsWeights:
                      - 0.3999998369710335
                      - 0.6000001630289665
              schema:
                properties:
                  assetsWeights:
                    description: assetsWeights[i] is the weight of the asset i in the portfolio, in percentage
                    items:
                      maximum: 1
                      minimum: 0
                      type: number
                    minItems: 2
                    type: array
                required:
                  - assetsWeights
                type: object
          description: OK
      summary: Diversified Maximum Return Portfolio
      tags:
        - Portfolio Optimization / Mean-Variance
      x-codegen-request-body-name: body
  /portfolio/optimization/maximum-return/subset-resampling-based:
    post:
      description: |
        Compute the asset weights of the subset resampling-based maximum return portfolio, following the methodology described in the first and the second references, optionally subject to:  
        * Minimum and maximum weights constraints
        * Maximum group weights constraints
        * Minimum and maximum portfolio exposure constraints

        References
         * [CSSA, Random Subspace Optimization (RSO)](https://cssanalytics.wordpress.com/2013/10/06/random-subspace-optimization-rso/)
         * [Subset Optimization for Asset Allocation,Benjamin J. Gillen](https://www.bengillen.com/uploads/1/2/3/8/123891022/subsets.pdf)
         * Harry M. Markowitz, Portfolio Selection, Efficient Diversification of Investments, Second edition, Blackwell Publishers Inc.
      requestBody:
        content:
          application/json:
            examples:
              Example:
                description: Compute the portfolio weights for 3 assets, with complete enumeration of subsets
                value:
                  assets: 3
                  assetsReturns:
                    - 0.01
                    - 0.02
                    - 0.03
                  subsetPortfoliosEnumerationMethod: complete
            schema:
              properties:
                assets:
                  description: The number of assets
                  minimum: 2
                  type: integer
                assetsCovarianceMatrix:
                  description: assetsCovarianceMatrix[i][j] is the covariance between the asset i and the asset j
                  items:
                    items:
                      type: number
                    minItems: 2
                    type: array
                  minItems: 2
                  type: array
                assetsReturns:
                  description: assetsReturns[i] is the arithmetic return of asset i
                  items:
                    type: number
                  minItems: 1
                  type: array
                constraints:
                  properties:
                    assetsGroups:
                      items:
                        description: assetsGroups[k] is the indexes of the assets belonging to the assets group k in the portfolio; exclusive with assetsGroupsMatrix
                        items:
                          minimum: 1
                          type: integer
                        minItems: 2
                        type: array
                        uniqueItems: true
                      minItems: 1
                      type: array
                    assetsGroupsMatrix:
                      description: assetsGroupsMatrix[k][i] is the weight of the asset i in the group of assets k; exclusive with assetsGroups
                      items:
                        items:
                          type: number
                        minItems: 2
                        type: array
                      minItems: 1
                      type: array
                    maximumAssetsGroupsWeights:
                      description: maximumAssetsGroupsWeights[k] is the maximum weight of the assets group k in the portfolio, in percentage between 0 and 1 if assetsGroups is provided
                      items:
                        type: number
                      type: array
                    maximumAssetsWeights:
                      description: maximumAssetsWeights[i] is the maximum weight of the asset i in the portfolio, in percentage
                      items:
                        maximum: 1
                        minimum: 0
                        type: number
                      type: array
                    maximumPortfolioExposure:
                      default: 1
                      description: The maximum portfolio exposure; must be higher than or equal to minimumPortfolioExposure
                      maximum: 1
                      minimum: 0
                      type: number
                    minimumAssetsWeights:
                      description: minimumAssetsWeights[i] is the minimum weight of the asset i in the portfolio, in percentage
                      items:
                        maximum: 1
                        minimum: 0
                        type: number
                      type: array
                    minimumPortfolioExposure:
                      default: 1
                      description: The minimum portfolio exposure; must be lower than or equal to maximumPortfolioExposure
                      maximum: 1
                      minimum: 0
                      type: number
                  type: object
                subsetPortfolios:
                  default: 128
                  description: The number of subset portfolios to compute; only applicable if the enumeration method for the subset portfolios is random sampling
                  minimum: 1
                  type: integer
                subsetPortfoliosAggregationMethod:
                  default: average
                  description: The method to aggregate the subset portfolios
                  enum:
                    - average
                    - median
                  type: string
                subsetPortfoliosEnumerationMethod:
                  default: randomSampling
                  description: The method to enumerate the subset portfolios
                  enum:
                    - complete
                    - randomSampling
                  type: string
                subsetSize:
                  description: The number of assets to include in each subset portfolio; defaults to a value of order the square root of the total number of assets
                  minimum: 2
                  type: integer
              required:
                - assets
                - assetsReturns
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Computed portfolio of 3 assets
                  value:
                    assetsWeights:
                      - 0
                      - 0.3333333333333333
                      - 0.6666666666666666
              schema:
                properties:
                  assetsWeights:
                    description: assetsWeights[i] is the weight of the asset i in the portfolio, in percentage
                    items:
                      maximum: 1
                      minimum: 0
                      type: number
                    minItems: 2
                    type: array
                required:
                  - assetsWeights
                type: object
          description: OK
      summary: Subset Resampling-Based Maximum Return Portfolio
      tags:
        - Portfolio Optimization / Mean-Variance
      x-codegen-request-body-name: body
  /portfolio/optimization/maximum-sharpe-ratio:
    post:
      description: |
        Compute the asset weights of the maximum Sharpe ratio portfolio, optionally subject to:  
        * Minimum and maximum weights constraints
        * Maximum group weights constraints
        * Minimum and maximum portfolio exposure constraints

        References
         * Harry M. Markowitz, Portfolio Selection, Efficient Diversification of Investments, Second edition, Blackwell Publishers Inc.
      requestBody:
        content:
          application/json:
            examples:
              Example:
                description: Compute the portfolio weights for 2 assets with a risk free rate of 0%
                value:
                  assets: 2
                  assetsCovarianceMatrix:
                    - - 0.05
                      - 0.02
                    - - 0.02
                      - 0.07
                  assetsReturns:
                    - 0.05
                    - 0.1
                  riskFreeRate: 0
            schema:
              properties:
                assets:
                  description: The number of assets
                  minimum: 2
                  type: integer
                assetsCovarianceMatrix:
                  description: assetsCovarianceMatrix[i][j] is the covariance between the asset i and the asset j
                  items:
                    items:
                      type: number
                    minItems: 2
                    type: array
                  minItems: 2
                  type: array
                assetsReturns:
                  description: assetsReturns[i] is the arithmetic return of asset i
                  items:
                    type: number
                  minItems: 1
                  type: array
                constraints:
                  properties:
                    assetsGroups:
                      items:
                        description: assetsGroups[k] is the indexes of the assets belonging to the assets group k in the portfolio; exclusive with assetsGroupsMatrix
                        items:
                          minimum: 1
                          type: integer
                        minItems: 2
                        type: array
                        uniqueItems: true
                      minItems: 1
                      type: array
                    assetsGroupsMatrix:
                      description: assetsGroupsMatrix[k][i] is the weight of the asset i in the group of assets k; exclusive with assetsGroups
                      items:
                        items:
                          type: number
                        minItems: 2
                        type: array
                      minItems: 1
                      type: array
                    maximumAssetsGroupsWeights:
                      description: maximumAssetsGroupsWeights[k] is the maximum weight of the assets group k in the portfolio, in percentage between 0 and 1 if assetsGroups is provided
                      items:
                        type: number
                      type: array
                    maximumAssetsWeights:
                      description: maximumAssetsWeights[i] is the maximum weight of the asset i in the portfolio, in percentage
                      items:
                        maximum: 1
                        minimum: 0
                        type: number
                      type: array
                    maximumPortfolioExposure:
                      default: 1
                      description: The maximum portfolio exposure; must be higher than or equal to minimumPortfolioExposure
                      maximum: 1
                      minimum: 0
                      type: number
                    minimumAssetsWeights:
                      description: minimumAssetsWeights[i] is the minimum weight of the asset i in the portfolio, in percentage
                      items:
                        maximum: 1
                        minimum: 0
                        type: number
                      type: array
                    minimumPortfolioExposure:
                      default: 1
                      description: The minimum portfolio exposure; must be lower than or equal to maximumPortfolioExposure
                      maximum: 1
                      minimum: 0
                      type: number
                  type: object
                riskFreeRate:
                  description: The risk free rate
                  type: number
              required:
                - assets
                - assetsReturns
                - assetsCovarianceMatrix
                - riskFreeRate
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Computed portfolio weights for 2 assets
                  value:
                    assetsWeights:
                      - 0.27272727272727276
                      - 0.7272727272727273
              schema:
                properties:
                  assetsWeights:
                    description: assetsWeights[i] is the weight of the asset i in the portfolio, in percentage
                    items:
                      maximum: 1
                      minimum: 0
                      type: number
                    minItems: 2
                    type: array
                required:
                  - assetsWeights
                type: object
          description: OK
      summary: Maximum Sharpe Ratio Portfolio
      tags:
        - Portfolio Optimization / Mean-Variance
      x-codegen-request-body-name: body
  /portfolio/optimization/maximum-sharpe-ratio/diversified:
    post:
      description: |
        Compute the asset weights of the diversified maximum Sharpe ratio portfolio, as defined in the first reference, optionally subject to:  
        * Minimum and maximum weights constraints
        * Maximum group weights constraints
        * Minimum and maximum portfolio exposure constraints

        The diversification measure used in the optimization procedure is the [Herfindahl-Hirschman Index](https://en.wikipedia.org/wiki/Herfindahl%E2%80%93Hirschman_index) of the assets weights.

        References
         * [Alejandro Corvalan, 2005. Well Diversified Efficient Portfolios, Working Papers Central Bank of Chile 336, Central Bank of Chile](https://ideas.repec.org/p/chb/bcchwp/336.html)
         * [Bouchaud, Jean-Philippe and Potters, Marc and Aguilar, Jean-Pierre, Missing Information and Asset Allocation, arXiv, 1997](https://arxiv.org/abs/cond-mat/9707042)
         * Harry M. Markowitz, Portfolio Selection, Efficient Diversification of Investments, Second edition, Blackwell Publishers Inc.
      requestBody:
        content:
          application/json:
            examples:
              Example:
                description: Compute the portfolio weights for 2 assets with a risk free rate of 0%
                value:
                  assets: 2
                  assetsCovarianceMatrix:
                    - - 0.05
                      - 0.02
                    - - 0.02
                      - 0.07
                  assetsReturns:
                    - 0.05
                    - 0.1
                  riskFreeRate: 0
            schema:
              properties:
                assets:
                  description: The number of assets
                  minimum: 2
                  type: integer
                assetsCovarianceMatrix:
                  description: assetsCovarianceMatrix[i][j] is the covariance between the asset i and the asset j
                  items:
                    items:
                      type: number
                    minItems: 2
                    type: array
                  minItems: 2
                  type: array
                assetsReturns:
                  description: assetsReturns[i] is the arithmetic return of asset i
                  items:
                    type: number
                  minItems: 1
                  type: array
                constraints:
                  properties:
                    assetsGroups:
                      items:
                        description: assetsGroups[k] is the indexes of the assets belonging to the assets group k in the portfolio; exclusive with assetsGroupsMatrix
                        items:
                          minimum: 1
                          type: integer
                        minItems: 2
                        type: array
                        uniqueItems: true
                      minItems: 1
                      type: array
                    assetsGroupsMatrix:
                      description: assetsGroupsMatrix[k][i] is the weight of the asset i in the group of assets k; exclusive with assetsGroups
                      items:
                        items:
                          type: number
                        minItems: 2
                        type: array
                      minItems: 1
                      type: array
                    deltaReturn:
                      default: 0.1
                      description: The relative tolerance over the maximum Sharpe ratio portfolio return
                      minimum: 0
                      type: number
                    deltaVolatility:
                      default: 0.1
                      description: The relative tolerance over the maximum Sharpe ratio portfolio volatility
                      minimum: 0
                      type: number
                    maximumAssetsGroupsWeights:
                      description: maximumAssetsGroupsWeights[k] is the maximum weight of the assets group k in the portfolio, in percentage between 0 and 1 if assetsGroups is provided
                      items:
                        type: number
                      type: array
                    maximumAssetsWeights:
                      description: maximumAssetsWeights[i] is the maximum weight of the asset i in the portfolio, in percentage
                      items:
                        maximum: 1
                        minimum: 0
                        type: number
                      type: array
                    maximumPortfolioExposure:
                      default: 1
                      description: The maximum portfolio exposure; must be higher than or equal to minimumPortfolioExposure
                      maximum: 1
                      minimum: 0
                      type: number
                    minimumAssetsWeights:
                      description: minimumAssetsWeights[i] is the minimum weight of the asset i in the portfolio, in percentage
                      items:
                        maximum: 1
                        minimum: 0
                        type: number
                      type: array
                    minimumPortfolioExposure:
                      default: 1
                      description: The minimum portfolio exposure; must be lower than or equal to maximumPortfolioExposure
                      maximum: 1
                      minimum: 0
                      type: number
                  type: object
                riskFreeRate:
                  description: The risk free rate
                  type: number
              required:
                - assets
                - assetsReturns
                - assetsCovarianceMatrix
                - riskFreeRate
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Computed portfolio weights for 2 assets
                  value:
                    assetsWeights:
                      - 0.44545623478220464
                      - 0.5545437652177954
              schema:
                properties:
                  assetsWeights:
                    description: assetsWeights[i] is the weight of the asset i in the portfolio, in percentage
                    items:
                      maximum: 1
                      minimum: 0
                      type: number
                    minItems: 2
                    type: array
                required:
                  - assetsWeights
                type: object
          description: OK
      summary: Diversified Maximum Sharpe Ratio Portfolio
      tags:
        - Portfolio Optimization / Mean-Variance
      x-codegen-request-body-name: body
  /portfolio/optimization/maximum-sharpe-ratio/subset-resampling-based:
    post:
      description: |
        Compute the asset weights of the susbet resampling-based maximum Sharpe ratio portfolio, following the methodology described in the first and the second references, optionally subject to:  
        * Minimum and maximum weights constraints
        * Maximum group weights constraints
        * Minimum and maximum portfolio exposure constraints

        References
         * [CSSA, Random Subspace Optimization (RSO)](https://cssanalytics.wordpress.com/2013/10/06/random-subspace-optimization-rso/)
         * [Subset Optimization for Asset Allocation,Benjamin J. Gillen](https://www.bengillen.com/uploads/1/2/3/8/123891022/subsets.pdf)
         * Harry M. Markowitz, Portfolio Selection, Efficient Diversification of Investments, Second edition, Blackwell Publishers Inc.
      requestBody:
        content:
          application/json:
            examples:
              Example:
                description: Compute the portfolio weights for 2 assets with a risk free rate of 0%
                value:
                  assets: 3
                  assetsCovarianceMatrix:
                    - - 0.05
                      - 0.02
                      - 0
                    - - 0.02
                      - 0.07
                      - 0.5
                    - - 0
                      - 0.5
                      - 0.1
                  assetsReturns:
                    - 0.05
                    - 0.1
                    - 0.025
                  riskFreeRate: 0
            schema:
              properties:
                assets:
                  description: The number of assets
                  minimum: 2
                  type: integer
                assetsCovarianceMatrix:
                  description: assetsCovarianceMatrix[i][j] is the covariance between the asset i and the asset j
                  items:
                    items:
                      type: number
                    minItems: 2
                    type: array
                  minItems: 2
                  type: array
                assetsReturns:
                  description: assetsReturns[i] is the arithmetic return of asset i
                  items:
                    type: number
                  minItems: 1
                  type: array
                constraints:
                  properties:
                    assetsGroups:
                      items:
                        description: assetsGroups[k] is the indexes of the assets belonging to the assets group k in the portfolio; exclusive with assetsGroupsMatrix
                        items:
                          minimum: 1
                          type: integer
                        minItems: 2
                        type: array
                        uniqueItems: true
                      minItems: 1
                      type: array
                    assetsGroupsMatrix:
                      description: assetsGroupsMatrix[k][i] is the weight of the asset i in the group of assets k; exclusive with assetsGroups
                      items:
                        items:
                          type: number
                        minItems: 2
                        type: array
                      minItems: 1
                      type: array
                    maximumAssetsGroupsWeights:
                      description: maximumAssetsGroupsWeights[k] is the maximum weight of the assets group k in the portfolio, in percentage between 0 and 1 if assetsGroups is provided
                      items:
                        type: number
                      type: array
                    maximumAssetsWeights:
                      description: maximumAssetsWeights[i] is the maximum weight of the asset i in the portfolio, in percentage
                      items:
                        maximum: 1
                        minimum: 0
                        type: number
                      type: array
                    maximumPortfolioExposure:
                      default: 1
                      description: The maximum portfolio exposure; must be higher than or equal to minimumPortfolioExposure
                      maximum: 1
                      minimum: 0
                      type: number
                    minimumAssetsWeights:
                      description: minimumAssetsWeights[i] is the minimum weight of the asset i in the portfolio, in percentage
                      items:
                        maximum: 1
                        minimum: 0
                        type: number
                      type: array
                    minimumPortfolioExposure:
                      default: 1
                      description: The minimum portfolio exposure; must be lower than or equal to maximumPortfolioExposure
                      maximum: 1
                      minimum: 0
                      type: number
                  type: object
                riskFreeRate:
                  description: The risk free rate
                  type: number
                subsetPortfolios:
                  default: 128
                  description: The number of subset portfolios to compute; only applicable if the enumeration method for the subset portfolios is random sampling
                  minimum: 1
                  type: integer
                subsetPortfoliosAggregationMethod:
                  default: average
                  description: The method to aggregate the subset portfolios
                  enum:
                    - average
                    - median
                  type: string
                subsetPortfoliosEnumerationMethod:
                  default: randomSampling
                  description: The method to enumerate the subset portfolios
                  enum:
                    - complete
                    - randomSampling
                  type: string
                subsetSize:
                  description: The number of assets to include in each subset portfolio; defaults to a value of order the square root of the total number of assets
                  minimum: 2
                  type: integer
              required:
                - assets
                - assetsReturns
                - assetsCovarianceMatrix
                - riskFreeRate
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Computed portfolio weights for 3 assets
                  value:
                    assetsWeights:
                      - 0.35454545454545444
                      - 0.5845170454545454
                      - 0.06093750000000007
              schema:
                properties:
                  assetsWeights:
                    description: assetsWeights[i] is the weight of the asset i in the portfolio, in percentage
                    items:
                      maximum: 1
                      minimum: 0
                      type: number
                    minItems: 2
                    type: array
                required:
                  - assetsWeights
                type: object
          description: OK
      summary: Subset Resampling-Based Maximum Sharpe Ratio Portfolio
      tags:
        - Portfolio Optimization / Mean-Variance
      x-codegen-request-body-name: body
  /portfolio/optimization/maximum-ulcer-performance-index:
    post:
      description: |
        Compute the asset weights of the maximum Ulcer Performance Index portfolio, optionally subject to:  
        * Minimum and maximum weights constraints
        * Maximum group weights constraints
        * Minimum and maximum portfolio exposure constraints

        Notes:  
        * This endpoint will return an error if the maximum Ulcer Performance Index portfolio has a negative Ulcer Performance Index

        References
         * [Peter G. Martin, Ulcer Index, An Alternative Approach to the Measurement of Investment Risk & Risk-Adjusted Performance](http://www.tangotools.com/ui/ui.htm)
         * [A. Chekhlov, S. Uryasev, M. Zabarankin, Portfolio Optimization with Drawdown Constraints, Supply Chain and Finance, p 209-228](https://doi.org/10.1142/9789812562586_0013)
         * [A. Chekhlov, S. Uryasev, M. Zabarankin, Drawdown Measure in Portfolio Optimization, International Journal of Theoretical and Applied FinanceVol. 08, No. 01, pp. 13-58 (2005)](https://www.worldscientific.com/doi/10.1142/S0219024905002767)
      requestBody:
        content:
          application/json:
            examples:
              Example:
                description: Compute the portfolio weights for 2 assets with a risk free rate of 0%
                value:
                  assets:
                    - assetPrices:
                        - 100
                        - 95
                        - 110
                    - assetPrices:
                        - 100
                        - 105
                        - 100
                  riskFreeRate: 0
            schema:
              properties:
                assets:
                  items:
                    properties:
                      assetPrices:
                        description: assetPrices[t] is the price of the asset at the time t
                        items:
                          exclusiveMinimum: true
                          minimum: 0
                          type: number
                        minItems: 2
                        type: array
                    required:
                      - assetPrices
                    type: object
                  minItems: 1
                  type: array
                constraints:
                  properties:
                    assetsGroups:
                      items:
                        description: assetsGroups[k] is the indexes of the assets belonging to the assets group k in the portfolio; exclusive with assetsGroupsMatrix
                        items:
                          minimum: 1
                          type: integer
                        minItems: 2
                        type: array
                        uniqueItems: true
                      minItems: 1
                      type: array
                    assetsGroupsMatrix:
                      description: assetsGroupsMatrix[k][i] is the weight of the asset i in the group of assets k; exclusive with assetsGroups
                      items:
                        items:
                          type: number
                        minItems: 2
                        type: array
                      minItems: 1
                      type: array
                    maximumAssetsGroupsWeights:
                      description: maximumAssetsGroupsWeights[k] is the maximum weight of the assets group k in the portfolio, in percentage between 0 and 1 if assetsGroups is provided
                      items:
                        type: number
                      type: array
                    maximumAssetsWeights:
                      description: maximumAssetsWeights[i] is the maximum weight of the asset i in the portfolio, in percentage
                      items:
                        maximum: 1
                        minimum: 0
                        type: number
                      type: array
                    maximumPortfolioExposure:
                      default: 1
                      description: The maximum portfolio exposure; must be higher than or equal to minimumPortfolioExposure
                      maximum: 1
                      minimum: 0
                      type: number
                    minimumAssetsWeights:
                      description: minimumAssetsWeights[i] is the minimum weight of the asset i in the portfolio, in percentage
                      items:
                        maximum: 1
                        minimum: 0
                        type: number
                      type: array
                    minimumPortfolioExposure:
                      default: 1
                      description: The minimum portfolio exposure; must be lower than or equal to maximumPortfolioExposure
                      maximum: 1
                      minimum: 0
                      type: number
                  type: object
                riskFreeRate:
                  description: The risk free rate
                  type: number
              required:
                - assets
                - riskFreeRate
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Computed portfolio weights for 2 assets
                  value:
                    assetsWeights:
                      - 0.3101913068855954
                      - 0.6898086931144047
              schema:
                properties:
                  assetsWeights:
                    description: assetsWeights[i] is the weight of the asset i in the portfolio, in percentage
                    items:
                      maximum: 1
                      minimum: 0
                      type: number
                    minItems: 2
                    type: array
                required:
                  - assetsWeights
                type: object
          description: OK
      summary: Maximum Ulcer Performance Index Portfolio
      tags:
        - Portfolio Optimization
      x-codegen-request-body-name: body
  /portfolio/optimization/mean-variance-efficient:
    post:
      description: |
        Compute the asset weights of a mean-variance efficient portfolio, optionally subject to:  
        * Minimum and maximum weights constraints
        * Maximum group weights constraints
        * Minimum and maximum portfolio exposure constraints

        > A mean-variance efficient portfolio is a portfolio belonging to [the mean-variance efficient frontier](#post-/portfolio/analysis/mean-variance/efficient-frontier).

        References
         * Harry M. Markowitz, Portfolio Selection, Efficient Diversification of Investments, Second edition, Blackwell Publishers Inc.
      requestBody:
        content:
          application/json:
            examples:
              Example:
                description: Compute the portfolio weights for 2 assets with a portfolio return constraint of 15%
                value:
                  assets: 2
                  assetsCovarianceMatrix:
                    - - 1
                      - 0.3
                    - - 0.3
                      - 1
                  assetsReturns:
                    - 0.1
                    - 0.2
                  constraints:
                    portfolioReturn: 0.15
              Example with group constraints:
                description: Compute the portfolio weights for 3 assets with a maximum group weights constraint and a portfolio return constraint of 15%
                value:
                  assets: 3
                  assetsCovarianceMatrix:
                    - - 1
                      - 0.3
                      - -0.2
                    - - 0.3
                      - 1
                      - 0.2
                    - - -0.2
                      - 0.2
                      - 1
                  assetsReturns:
                    - 0.1
                    - 0.2
                    - 0.15
                  constraints:
                    assetsGroups:
                      - - 1
                        - 2
                    maximumAssetsGroupsWeights:
                      - 0.5
                    portfolioReturn: 0.15
            schema:
              properties:
                assets:
                  description: The number of assets
                  minimum: 2
                  type: integer
                assetsCovarianceMatrix:
                  description: assetsCovarianceMatrix[i][j] is the covariance between the asset i and the asset j
                  items:
                    items:
                      type: number
                    minItems: 2
                    type: array
                  minItems: 2
                  type: array
                assetsReturns:
                  description: assetsReturns[i] is the arithmetic return of asset i
                  items:
                    type: number
                  minItems: 1
                  type: array
                constraints:
                  properties:
                    assetsGroups:
                      items:
                        description: assetsGroups[k] is the indexes of the assets belonging to the assets group k in the portfolio; exclusive with assetsGroupsMatrix
                        items:
                          minimum: 1
                          type: integer
                        minItems: 2
                        type: array
                        uniqueItems: true
                      minItems: 1
                      type: array
                    assetsGroupsMatrix:
                      description: assetsGroupsMatrix[k][i] is the weight of the asset i in the group of assets k; exclusive with assetsGroups
                      items:
                        items:
                          type: number
                        minItems: 2
                        type: array
                      minItems: 1
                      type: array
                    maximumAssetsGroupsWeights:
                      description: maximumAssetsGroupsWeights[k] is the maximum weight of the assets group k in the portfolio, in percentage between 0 and 1 if assetsGroups is provided
                      items:
                        type: number
                      type: array
                    maximumAssetsWeights:
                      description: maximumAssetsWeights[i] is the maximum weight of the asset i in the portfolio, in percentage
                      items:
                        maximum: 1
                        minimum: 0
                        type: number
                      type: array
                    maximumPortfolioExposure:
                      default: 1
                      description: The maximum portfolio exposure; must be higher than or equal to minimumPortfolioExposure
                      maximum: 1
                      minimum: 0
                      type: number
                    minimumAssetsWeights:
                      description: minimumAssetsWeights[i] is the minimum weight of the asset i in the portfolio, in percentage
                      items:
                        maximum: 1
                        minimum: 0
                        type: number
                      type: array
                    minimumPortfolioExposure:
                      default: 1
                      description: The minimum portfolio exposure; must be lower than or equal to maximumPortfolioExposure
                      maximum: 1
                      minimum: 0
                      type: number
                    portfolioReturn:
                      description: The portfolio return; exclusive with portfolioVolatility and riskTolerance
                      type: number
                    portfolioVolatility:
                      description: The portfolio volatility; exclusive with portfolioReturn and riskTolerance
                      minimum: 0
                      type: number
                    riskTolerance:
                      description: The portfolio risk tolerance; exclusive with portfolioReturn and portfolioVolatility
                      minimum: 0
                      type: number
                  type: object
              required:
                - assets
                - assetsReturns
                - assetsCovarianceMatrix
                - constraints
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Computed mean-variance efficient portfolio of 2 assets
                  value:
                    assetsWeights:
                      - 0.5
                      - 0.5
              schema:
                properties:
                  assetsWeights:
                    description: assetsWeights[i] is the weight of the asset i in the portfolio, in percentage
                    items:
                      maximum: 1
                      minimum: 0
                      type: number
                    minItems: 2
                    type: array
                required:
                  - assetsWeights
                type: object
          description: OK
      summary: Mean-Variance Efficient Portfolio
      tags:
        - Portfolio Optimization / Mean-Variance
      x-codegen-request-body-name: body
  /portfolio/optimization/mean-variance-efficient/diversified:
    post:
      description: |
        Compute the asset weights of a diversified mean-variance efficient portfolio, as defined in the first reference, optionally subject to:  
        * Minimum and maximum weights constraints
        * Maximum group weights constraints
        * Minimum and maximum portfolio exposure constraints

        The diversification measure used in the optimization procedure is the [Herfindahl-Hirschman Index](https://en.wikipedia.org/wiki/Herfindahl%E2%80%93Hirschman_index) of the assets weights.

        > A diversified mean-variance efficient portfolio does NOT belong to [the mean-variance efficient frontier](#post-/portfolio/analysis/mean-variance/efficient-frontier), but is close to this frontier.

        References
         * [Alejandro Corvalan, 2005. Well Diversified Efficient Portfolios, Working Papers Central Bank of Chile 336, Central Bank of Chile](https://ideas.repec.org/p/chb/bcchwp/336.html)
         * [Bouchaud, Jean-Philippe and Potters, Marc and Aguilar, Jean-Pierre, Missing Information and Asset Allocation, arXiv, 1997](https://arxiv.org/abs/cond-mat/9707042)
         * Harry M. Markowitz, Portfolio Selection, Efficient Diversification of Investments, Second edition, Blackwell Publishers Inc.
      requestBody:
        content:
          application/json:
            examples:
              Example:
                description: Compute the portfolio weights for 2 assets with a portfolio return constraint of 15%
                value:
                  assets: 2
                  assetsCovarianceMatrix:
                    - - 1
                      - 0.3
                    - - 0.3
                      - 1
                  assetsReturns:
                    - 0.1
                    - 0.2
                  constraints:
                    deltaReturn: 0.05
                    deltaVolatility: 0.05
                    portfolioReturn: 0.175
              Example with group constraints:
                description: Compute the portfolio weights for 3 assets with a maximum group weights constraint and a portfolio return constraint of 15%
                value:
                  assets: 3
                  assetsCovarianceMatrix:
                    - - 1
                      - 0.3
                      - -0.2
                    - - 0.3
                      - 1
                      - 0.2
                    - - -0.2
                      - 0.2
                      - 1
                  assetsReturns:
                    - 0.1
                    - 0.2
                    - 0.15
                  constraints:
                    assetsGroups:
                      - - 1
                        - 2
                    maximumAssetsGroupsWeights:
                      - 0.5
                    portfolioReturn: 0.15
            schema:
              properties:
                assets:
                  description: The number of assets
                  minimum: 2
                  type: integer
                assetsCovarianceMatrix:
                  description: assetsCovarianceMatrix[i][j] is the covariance between the asset i and the asset j
                  items:
                    items:
                      type: number
                    minItems: 2
                    type: array
                  minItems: 2
                  type: array
                assetsReturns:
                  description: assetsReturns[i] is the arithmetic return of asset i
                  items:
                    type: number
                  minItems: 1
                  type: array
                constraints:
                  properties:
                    assetsGroups:
                      items:
                        description: assetsGroups[k] is the indexes of the assets belonging to the assets group k in the portfolio; exclusive with assetsGroupsMatrix
                        items:
                          minimum: 1
                          type: integer
                        minItems: 2
                        type: array
                        uniqueItems: true
                      minItems: 1
                      type: array
                    assetsGroupsMatrix:
                      description: assetsGroupsMatrix[k][i] is the weight of the asset i in the group of assets k; exclusive with assetsGroups
                      items:
                        items:
                          type: number
                        minItems: 2
                        type: array
                      minItems: 1
                      type: array
                    deltaReturn:
                      default: 0.1
                      description: The relative tolerance over the mean-variance efficient portfolio return
                      minimum: 0
                      type: number
                    deltaVolatility:
                      default: 0.1
                      description: The relative tolerance over the mean-variance efficient portfolio volatility
                      minimum: 0
                      type: number
                    maximumAssetsGroupsWeights:
                      description: maximumAssetsGroupsWeights[k] is the maximum weight of the assets group k in the portfolio, in percentage between 0 and 1 if assetsGroups is provided
                      items:
                        type: number
                      type: array
                    maximumAssetsWeights:
                      description: maximumAssetsWeights[i] is the maximum weight of the asset i in the portfolio, in percentage
                      items:
                        maximum: 1
                        minimum: 0
                        type: number
                      type: array
                    maximumPortfolioExposure:
                      default: 1
                      description: The maximum portfolio exposure; must be higher than or equal to minimumPortfolioExposure
                      maximum: 1
                      minimum: 0
                      type: number
                    minimumAssetsWeights:
                      description: minimumAssetsWeights[i] is the minimum weight of the asset i in the portfolio, in percentage
                      items:
                        maximum: 1
                        minimum: 0
                        type: number
                      type: array
                    minimumPortfolioExposure:
                      default: 1
                      description: The minimum portfolio exposure; must be lower than or equal to maximumPortfolioExposure
                      maximum: 1
                      minimum: 0
                      type: number
                    portfolioReturn:
                      description: The portfolio return; exclusive with portfolioVolatility and riskTolerance
                      type: number
                    portfolioVolatility:
                      description: The portfolio volatility; exclusive with portfolioReturn and riskTolerance
                      minimum: 0
                      type: number
                    riskTolerance:
                      description: The portfolio risk tolerance; exclusive with portfolioReturn and portfolioVolatility
                      minimum: 0
                      type: number
                  type: object
              required:
                - assets
                - assetsReturns
                - assetsCovarianceMatrix
                - constraints
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Computed diversified mean-variance efficient portfolio of 2 assets
                  value:
                    assetsWeights:
                      - 0.3375016499673578
                      - 0.6624983500326422
              schema:
                properties:
                  assetsWeights:
                    description: assetsWeights[i] is the weight of the asset i in the portfolio, in percentage
                    items:
                      maximum: 1
                      minimum: 0
                      type: number
                    minItems: 2
                    type: array
                required:
                  - assetsWeights
                type: object
          description: OK
      summary: Diversified Mean-Variance Efficient Portfolio
      tags:
        - Portfolio Optimization / Mean-Variance
      x-codegen-request-body-name: body
  /portfolio/optimization/mean-variance-efficient/subset-resampling-based:
    post:
      description: |
        Compute the asset weights of a subset resampling-based  mean-variance efficient portfolio, following the methodology described in the first and the second references, optionally subject to:  
        * Minimum and maximum weights constraints
        * Maximum group weights constraints
        * Minimum and maximum portfolio exposure constraints

        References
         * [CSSA, Random Subspace Optimization (RSO)](https://cssanalytics.wordpress.com/2013/10/06/random-subspace-optimization-rso/)
         * [Subset Optimization for Asset Allocation,Benjamin J. Gillen](https://www.bengillen.com/uploads/1/2/3/8/123891022/subsets.pdf)
         * Harry M. Markowitz, Portfolio Selection, Efficient Diversification of Investments, Second edition, Blackwell Publishers Inc.
      requestBody:
        content:
          application/json:
            examples:
              Example:
                description: Compute the portfolio weights for 3 assets with a risk tolerance constraint of 2
                value:
                  assets: 3
                  assetsCovarianceMatrix:
                    - - 1
                      - 0
                      - 0
                    - - 0
                      - 1
                      - 0
                    - - 0
                      - 0
                      - 1
                  assetsReturns:
                    - 0.1
                    - 0.2
                    - 0.3
                  constraints:
                    riskTolerance: 2
            schema:
              properties:
                assets:
                  description: The number of assets
                  minimum: 2
                  type: integer
                assetsCovarianceMatrix:
                  description: assetsCovarianceMatrix[i][j] is the covariance between the asset i and the asset j
                  items:
                    items:
                      type: number
                    minItems: 2
                    type: array
                  minItems: 2
                  type: array
                assetsReturns:
                  description: assetsReturns[i] is the arithmetic return of asset i
                  items:
                    type: number
                  minItems: 1
                  type: array
                constraints:
                  properties:
                    assetsGroups:
                      items:
                        description: assetsGroups[k] is the indexes of the assets belonging to the assets group k in the portfolio; exclusive with assetsGroupsMatrix
                        items:
                          minimum: 1
                          type: integer
                        minItems: 2
                        type: array
                        uniqueItems: true
                      minItems: 1
                      type: array
                    assetsGroupsMatrix:
                      description: assetsGroupsMatrix[k][i] is the weight of the asset i in the group of assets k; exclusive with assetsGroups
                      items:
                        items:
                          type: number
                        minItems: 2
                        type: array
                      minItems: 1
                      type: array
                    maximumAssetsGroupsWeights:
                      description: maximumAssetsGroupsWeights[k] is the maximum weight of the assets group k in the portfolio, in percentage between 0 and 1 if assetsGroups is provided
                      items:
                        type: number
                      type: array
                    maximumAssetsWeights:
                      description: maximumAssetsWeights[i] is the maximum weight of the asset i in the portfolio, in percentage
                      items:
                        maximum: 1
                        minimum: 0
                        type: number
                      type: array
                    maximumPortfolioExposure:
                      default: 1
                      description: The maximum portfolio exposure; must be higher than or equal to minimumPortfolioExposure
                      maximum: 1
                      minimum: 0
                      type: number
                    minimumAssetsWeights:
                      description: minimumAssetsWeights[i] is the minimum weight of the asset i in the portfolio, in percentage
                      items:
                        maximum: 1
                        minimum: 0
                        type: number
                      type: array
                    minimumPortfolioExposure:
                      default: 1
                      description: The minimum portfolio exposure; must be lower than or equal to maximumPortfolioExposure
                      maximum: 1
                      minimum: 0
                      type: number
                    portfolioReturn:
                      description: The portfolio return; exclusive with portfolioVolatility and riskTolerance
                      type: number
                    portfolioVolatility:
                      description: The portfolio volatility; exclusive with portfolioReturn and riskTolerance
                      minimum: 0
                      type: number
                    riskTolerance:
                      description: The portfolio risk tolerance; exclusive with portfolioReturn and portfolioVolatility
                      minimum: 0
                      type: number
                  type: object
                subsetPortfolios:
                  default: 128
                  description: The number of subset portfolios to compute; only applicable if the enumeration method for the subset portfolios is random sampling
                  minimum: 1
                  type: integer
                subsetPortfoliosAggregationMethod:
                  default: average
                  description: The method to aggregate the subset portfolios
                  enum:
                    - average
                    - median
                  type: string
                subsetPortfoliosEnumerationMethod:
                  default: randomSampling
                  description: The method to enumerate the subset portfolios
                  enum:
                    - complete
                    - randomSampling
                  type: string
                subsetSize:
                  description: The number of assets to include in each subset portfolio; defaults to a value of order the square root of the total number of assets
                  minimum: 2
                  type: integer
              required:
                - assets
                - assetsReturns
                - assetsCovarianceMatrix
                - constraints
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Computed portfolio of 3 assets
                  value:
                    assetsWeights:
                      - 0.24609375
                      - 0.3125
                      - 0.44140624999999994
              schema:
                properties:
                  assetsWeights:
                    description: assetsWeights[i] is the weight of the asset i in the portfolio, in percentage
                    items:
                      maximum: 1
                      minimum: 0
                      type: number
                    minItems: 2
                    type: array
                required:
                  - assetsWeights
                type: object
          description: OK
      summary: Subset Resampling-Based Mean-Variance Efficient Portfolio
      tags:
        - Portfolio Optimization / Mean-Variance
      x-codegen-request-body-name: body
  /portfolio/optimization/minimum-correlation:
    post:
      description: |
        Compute the asset weights of the (heuristic) minimum correlation portfolio, which is a portfolio built using the Minimum Correlation Algorithm discovered by [David Varadi](https://cssanalytics.wordpress.com/).

        References
         * [CSSA, Minimum Correlation Algorithm Paper Release](https://cssanalytics.wordpress.com/2012/09/21/minimum-correlation-algorithm-paper-release/)
      requestBody:
        content:
          application/json:
            examples:
              Example:
                description: Compute the portfolio weights for 3 assets
                value:
                  assets: 3
                  assetsCorrelationMatrix:
                    - - 1
                      - 0.9
                      - 0.85
                    - - 0.9
                      - 1
                      - 0.7
                    - - 0.85
                      - 0.7
                      - 1
                  assetsVolatilities:
                    - 0.14
                    - 0.18
                    - 0.22
            schema:
              properties:
                assets:
                  minimum: 2
                  type: integer
                assetsCorrelationMatrix:
                  description: assetsCorrelationMatrix[i][j] is the correlation between the asset i and the asset j; required if assetsReturns is not provided
                  items:
                    items:
                      type: number
                    minItems: 2
                    type: array
                  minItems: 2
                  type: array
                assetsVolatilities:
                  description: assetsVariances[i] is the volatility of the asset i; required if assetsCorrelationMatrix is provided and assetsVariances is not provided
                  items:
                    minimum: 0
                    type: number
                  minItems: 2
                  type: array
              required:
                - assets
                - assetsCorrelationMatrix
                - assetsVolatilities
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Computed minimum correlation portfolio portfolio of 3 assets
                  value:
                    assetsWeights:
                      - 0.21059806981924115
                      - 0.3087866303991204
                      - 0.48061529978163836
              schema:
                properties:
                  assetsWeights:
                    description: assetsWeights[i] is the weight of the asset i in the portfolio, in percentage
                    items:
                      maximum: 1
                      minimum: 0
                      type: number
                    minItems: 2
                    type: array
                required:
                  - assetsWeights
                type: object
          description: OK
      summary: Minimum Correlation Portfolio
      tags:
        - Portfolio Optimization
      x-codegen-request-body-name: body
  /portfolio/optimization/minimum-ulcer-index:
    post:
      description: |
        Compute the asset weights of the minimum Ulcer Index portfolio, optionally subject to:  
        * Minimum and maximum weights constraints
        * Maximum group weights constraints
        * Minimum and maximum portfolio exposure constraints

        References
         * [Peter G. Martin, Ulcer Index, An Alternative Approach to the Measurement of Investment Risk & Risk-Adjusted Performance](http://www.tangotools.com/ui/ui.htm)
         * [A. Chekhlov, S. Uryasev, M. Zabarankin, Portfolio Optimization with Drawdown Constraints, Supply Chain and Finance, p 209-228](https://doi.org/10.1142/9789812562586_0013)
         * [A. Chekhlov, S. Uryasev, M. Zabarankin, Drawdown Measure in Portfolio Optimization, International Journal of Theoretical and Applied FinanceVol. 08, No. 01, pp. 13-58 (2005)](https://www.worldscientific.com/doi/10.1142/S0219024905002767)
      requestBody:
        content:
          application/json:
            examples:
              Example:
                description: Compute the portfolio weights for 2 assets
                value:
                  assets:
                    - assetPrices:
                        - 100
                        - 95
                        - 110
                    - assetPrices:
                        - 100
                        - 105
                        - 100
            schema:
              properties:
                assets:
                  items:
                    properties:
                      assetPrices:
                        description: assetPrices[t] is the price of the asset at the time t
                        items:
                          exclusiveMinimum: true
                          minimum: 0
                          type: number
                        minItems: 2
                        type: array
                    required:
                      - assetPrices
                    type: object
                  minItems: 1
                  type: array
                constraints:
                  properties:
                    assetsGroups:
                      items:
                        description: assetsGroups[k] is the indexes of the assets belonging to the assets group k in the portfolio; exclusive with assetsGroupsMatrix
                        items:
                          minimum: 1
                          type: integer
                        minItems: 2
                        type: array
                        uniqueItems: true
                      minItems: 1
                      type: array
                    assetsGroupsMatrix:
                      description: assetsGroupsMatrix[k][i] is the weight of the asset i in the group of assets k; exclusive with assetsGroups
                      items:
                        items:
                          type: number
                        minItems: 2
                        type: array
                      minItems: 1
                      type: array
                    maximumAssetsGroupsWeights:
                      description: maximumAssetsGroupsWeights[k] is the maximum weight of the assets group k in the portfolio, in percentage between 0 and 1 if assetsGroups is provided
                      items:
                        type: number
                      type: array
                    maximumAssetsWeights:
                      description: maximumAssetsWeights[i] is the maximum weight of the asset i in the portfolio, in percentage
                      items:
                        maximum: 1
                        minimum: 0
                        type: number
                      type: array
                    maximumPortfolioExposure:
                      default: 1
                      description: The maximum portfolio exposure; must be higher than or equal to minimumPortfolioExposure
                      maximum: 1
                      minimum: 0
                      type: number
                    minimumAssetsWeights:
                      description: minimumAssetsWeights[i] is the minimum weight of the asset i in the portfolio, in percentage
                      items:
                        maximum: 1
                        minimum: 0
                        type: number
                      type: array
                    minimumPortfolioExposure:
                      default: 1
                      description: The minimum portfolio exposure; must be lower than or equal to maximumPortfolioExposure
                      maximum: 1
                      minimum: 0
                      type: number
                  type: object
              required:
                - assets
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Computed portfolio weights for 2 assets
                  value:
                    assetsWeights:
                      - 0.24615095383708674
                      - 0.7538490461629133
              schema:
                properties:
                  assetsWeights:
                    description: assetsWeights[i] is the weight of the asset i in the portfolio, in percentage
                    items:
                      maximum: 1
                      minimum: 0
                      type: number
                    minItems: 2
                    type: array
                required:
                  - assetsWeights
                type: object
          description: OK
      summary: Minimum Ulcer Index Portfolio
      tags:
        - Portfolio Optimization
      x-codegen-request-body-name: body
  /portfolio/optimization/minimum-variance:
    post:
      description: |
        Compute the asset weights of the minimum variance portfolio, optionally subject to:  
        * Minimum and maximum weights constraints
        * Maximum group weights constraints
        * Minimum and maximum portfolio exposure constraints

        References
         * Harry M. Markowitz, Portfolio Selection, Efficient Diversification of Investments, Second edition, Blackwell Publishers Inc.
      requestBody:
        content:
          application/json:
            examples:
              Example:
                description: Compute the portfolio weights for 2 assets, with maximum assets weights and portfolio exposure constraints
                value:
                  assets: 2
                  assetsCovarianceMatrix:
                    - - 0.0025
                      - 0.0005
                    - - 0.0005
                      - 0.01
                  constraints:
                    maximumAssetsWeights:
                      - 0.4
                      - 1
                    maximumPortfolioExposure: 0.5
                    minimumPortfolioExposure: 0.5
            schema:
              properties:
                assets:
                  description: The number of assets
                  minimum: 2
                  type: integer
                assetsCovarianceMatrix:
                  description: assetsCovarianceMatrix[i][j] is the covariance between the asset i and the asset j
                  items:
                    items:
                      type: number
                    minItems: 2
                    type: array
                  minItems: 2
                  type: array
                assetsReturns:
                  description: assetsReturns[i] is the arithmetic return of asset i
                  items:
                    type: number
                  minItems: 1
                  type: array
                constraints:
                  properties:
                    assetsGroups:
                      items:
                        description: assetsGroups[k] is the indexes of the assets belonging to the assets group k in the portfolio; exclusive with assetsGroupsMatrix
                        items:
                          minimum: 1
                          type: integer
                        minItems: 2
                        type: array
                        uniqueItems: true
                      minItems: 1
                      type: array
                    assetsGroupsMatrix:
                      description: assetsGroupsMatrix[k][i] is the weight of the asset i in the group of assets k; exclusive with assetsGroups
                      items:
                        items:
                          type: number
                        minItems: 2
                        type: array
                      minItems: 1
                      type: array
                    maximumAssetsGroupsWeights:
                      description: maximumAssetsGroupsWeights[k] is the maximum weight of the assets group k in the portfolio, in percentage between 0 and 1 if assetsGroups is provided
                      items:
                        type: number
                      type: array
                    maximumAssetsWeights:
                      description: maximumAssetsWeights[i] is the maximum weight of the asset i in the portfolio, in percentage
                      items:
                        maximum: 1
                        minimum: 0
                        type: number
                      type: array
                    maximumPortfolioExposure:
                      default: 1
                      description: The maximum portfolio exposure; must be higher than or equal to minimumPortfolioExposure
                      maximum: 1
                      minimum: 0
                      type: number
                    minimumAssetsWeights:
                      description: minimumAssetsWeights[i] is the minimum weight of the asset i in the portfolio, in percentage
                      items:
                        maximum: 1
                        minimum: 0
                        type: number
                      type: array
                    minimumPortfolioExposure:
                      default: 1
                      description: The minimum portfolio exposure; must be lower than or equal to maximumPortfolioExposure
                      maximum: 1
                      minimum: 0
                      type: number
                  type: object
              required:
                - assets
                - assetsCovarianceMatrix
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Computed minimum variance portfolio of 2 assets
                  value:
                    assetsWeights:
                      - 0.4
                      - 0.09999999999998999
              schema:
                properties:
                  assetsWeights:
                    description: assetsWeights[i] is the weight of the asset i in the portfolio, in percentage
                    items:
                      maximum: 1
                      minimum: 0
                      type: number
                    minItems: 2
                    type: array
                required:
                  - assetsWeights
                type: object
          description: OK
      summary: Minimum Variance Portfolio
      tags:
        - Portfolio Optimization / Mean-Variance
      x-codegen-request-body-name: body
  /portfolio/optimization/minimum-variance/diversified:
    post:
      description: |
        Compute the asset weights of the diversified minimum variance portfolio, as defined in the first reference, optionally subject to:  
        * Minimum and maximum weights constraints
        * Maximum group weights constraints
        * Minimum and maximum portfolio exposure constraints

        The diversification measure used in the optimization procedure is the [Herfindahl-Hirschman Index](https://en.wikipedia.org/wiki/Herfindahl%E2%80%93Hirschman_index) of the assets weights.

        References
         * [Alejandro Corvalan, 2005. Well Diversified Efficient Portfolios, Working Papers Central Bank of Chile 336, Central Bank of Chile](https://ideas.repec.org/p/chb/bcchwp/336.html)
         * [Bouchaud, Jean-Philippe and Potters, Marc and Aguilar, Jean-Pierre, Missing Information and Asset Allocation, arXiv, 1997](https://arxiv.org/abs/cond-mat/9707042)
         * Harry M. Markowitz, Portfolio Selection, Efficient Diversification of Investments, Second edition, Blackwell Publishers Inc.
      requestBody:
        content:
          application/json:
            examples:
              Example:
                description: Compute the portfolio weights for 2 assets, with maximum assets weights and portfolio exposure constraints
                value:
                  assets: 2
                  assetsCovarianceMatrix:
                    - - 0.0025
                      - 0.0005
                    - - 0.0005
                      - 0.01
                  constraints:
                    maximumAssetsWeights:
                      - 0.4
                      - 1
                    maximumPortfolioExposure: 0.5
                    minimumPortfolioExposure: 0.5
            schema:
              properties:
                assets:
                  description: The number of assets
                  minimum: 2
                  type: integer
                assetsCovarianceMatrix:
                  description: assetsCovarianceMatrix[i][j] is the covariance between the asset i and the asset j
                  items:
                    items:
                      type: number
                    minItems: 2
                    type: array
                  minItems: 2
                  type: array
                assetsReturns:
                  description: assetsReturns[i] is the arithmetic return of asset i
                  items:
                    type: number
                  minItems: 1
                  type: array
                constraints:
                  properties:
                    assetsGroups:
                      items:
                        description: assetsGroups[k] is the indexes of the assets belonging to the assets group k in the portfolio; exclusive with assetsGroupsMatrix
                        items:
                          minimum: 1
                          type: integer
                        minItems: 2
                        type: array
                        uniqueItems: true
                      minItems: 1
                      type: array
                    assetsGroupsMatrix:
                      description: assetsGroupsMatrix[k][i] is the weight of the asset i in the group of assets k; exclusive with assetsGroups
                      items:
                        items:
                          type: number
                        minItems: 2
                        type: array
                      minItems: 1
                      type: array
                    deltaReturn:
                      default: 0.1
                      description: The relative tolerance over the minimum variance portfolio return, if applicable
                      minimum: 0
                      type: number
                    deltaVolatility:
                      default: 0.1
                      description: The relative tolerance over the minimum variance portfolio volatility
                      minimum: 0
                      type: number
                    maximumAssetsGroupsWeights:
                      description: maximumAssetsGroupsWeights[k] is the maximum weight of the assets group k in the portfolio, in percentage between 0 and 1 if assetsGroups is provided
                      items:
                        type: number
                      type: array
                    maximumAssetsWeights:
                      description: maximumAssetsWeights[i] is the maximum weight of the asset i in the portfolio, in percentage
                      items:
                        maximum: 1
                        minimum: 0
                        type: number
                      type: array
                    maximumPortfolioExposure:
                      default: 1
                      description: The maximum portfolio exposure; must be higher than or equal to minimumPortfolioExposure
                      maximum: 1
                      minimum: 0
                      type: number
                    minimumAssetsWeights:
                      description: minimumAssetsWeights[i] is the minimum weight of the asset i in the portfolio, in percentage
                      items:
                        maximum: 1
                        minimum: 0
                        type: number
                      type: array
                    minimumPortfolioExposure:
                      default: 1
                      description: The minimum portfolio exposure; must be lower than or equal to maximumPortfolioExposure
                      maximum: 1
                      minimum: 0
                      type: number
                  type: object
              required:
                - assets
                - assetsCovarianceMatrix
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Computed diversified minimum variance portfolio of 2 assets
                  value:
                    assetsWeights:
                      - 0.31288809725799416
                      - 0.18711190967754268
              schema:
                properties:
                  assetsWeights:
                    description: assetsWeights[i] is the weight of the asset i in the portfolio, in percentage
                    items:
                      maximum: 1
                      minimum: 0
                      type: number
                    minItems: 2
                    type: array
                required:
                  - assetsWeights
                type: object
          description: OK
      summary: Diversified Minimum Variance Portfolio
      tags:
        - Portfolio Optimization / Mean-Variance
      x-codegen-request-body-name: body
  /portfolio/optimization/minimum-variance/subset-resampling-based:
    post:
      description: |
        Compute the asset weights of the subset resampling-based minimum variance portfolio, following the methodology described in the first and the second references, optionally subject to:  
        * Minimum and maximum weights constraints
        * Maximum group weights constraints
        * Minimum and maximum portfolio exposure constraints

        References
         * [CSSA, Random Subspace Optimization (RSO)](https://cssanalytics.wordpress.com/2013/10/06/random-subspace-optimization-rso/)
         * [Subset Optimization for Asset Allocation,Benjamin J. Gillen](https://www.bengillen.com/uploads/1/2/3/8/123891022/subsets.pdf)
         * Harry M. Markowitz, Portfolio Selection, Efficient Diversification of Investments, Second edition, Blackwell Publishers Inc.
      requestBody:
        content:
          application/json:
            examples:
              Example:
                description: Compute the portfolio weights for 2 assets, with maximum assets weights and portfolio exposure constraints; because of only 2 assets, the computed portfolio will be identical to the equivalent minimum variance portfolio
                value:
                  assets: 2
                  assetsCovarianceMatrix:
                    - - 0.0025
                      - 0.0005
                    - - 0.0005
                      - 0.01
                  constraints:
                    maximumAssetsWeights:
                      - 0.4
                      - 1
                    maximumPortfolioExposure: 0.5
                    minimumPortfolioExposure: 0.5
                  subsetPortfolios: 1
            schema:
              properties:
                assets:
                  description: The number of assets
                  minimum: 2
                  type: integer
                assetsCovarianceMatrix:
                  description: assetsCovarianceMatrix[i][j] is the covariance between the asset i and the asset j
                  items:
                    items:
                      type: number
                    minItems: 2
                    type: array
                  minItems: 2
                  type: array
                assetsReturns:
                  description: assetsReturns[i] is the arithmetic return of asset i
                  items:
                    type: number
                  minItems: 1
                  type: array
                constraints:
                  properties:
                    assetsGroups:
                      items:
                        description: assetsGroups[k] is the indexes of the assets belonging to the assets group k in the portfolio; exclusive with assetsGroupsMatrix
                        items:
                          minimum: 1
                          type: integer
                        minItems: 2
                        type: array
                        uniqueItems: true
                      minItems: 1
                      type: array
                    assetsGroupsMatrix:
                      description: assetsGroupsMatrix[k][i] is the weight of the asset i in the group of assets k; exclusive with assetsGroups
                      items:
                        items:
                          type: number
                        minItems: 2
                        type: array
                      minItems: 1
                      type: array
                    maximumAssetsGroupsWeights:
                      description: maximumAssetsGroupsWeights[k] is the maximum weight of the assets group k in the portfolio, in percentage between 0 and 1 if assetsGroups is provided
                      items:
                        type: number
                      type: array
                    maximumAssetsWeights:
                      description: maximumAssetsWeights[i] is the maximum weight of the asset i in the portfolio, in percentage
                      items:
                        maximum: 1
                        minimum: 0
                        type: number
                      type: array
                    maximumPortfolioExposure:
                      default: 1
                      description: The maximum portfolio exposure; must be higher than or equal to minimumPortfolioExposure
                      maximum: 1
                      minimum: 0
                      type: number
                    minimumAssetsWeights:
                      description: minimumAssetsWeights[i] is the minimum weight of the asset i in the portfolio, in percentage
                      items:
                        maximum: 1
                        minimum: 0
                        type: number
                      type: array
                    minimumPortfolioExposure:
                      default: 1
                      description: The minimum portfolio exposure; must be lower than or equal to maximumPortfolioExposure
                      maximum: 1
                      minimum: 0
                      type: number
                  type: object
                subsetPortfolios:
                  default: 128
                  description: The number of subset portfolios to compute; only applicable if the enumeration method for the subset portfolios is random sampling
                  minimum: 1
                  type: integer
                subsetPortfoliosAggregationMethod:
                  default: average
                  description: The method to aggregate the subset portfolios
                  enum:
                    - average
                    - median
                  type: string
                subsetPortfoliosEnumerationMethod:
                  default: randomSampling
                  description: The method to enumerate the subset portfolios
                  enum:
                    - complete
                    - randomSampling
                  type: string
                subsetSize:
                  description: The number of assets to include in each subset portfolio; defaults to a value of order the square root of the total number of assets
                  minimum: 2
                  type: integer
              required:
                - assets
                - assetsCovarianceMatrix
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Computed portfolio of 2 assets
                  value:
                    assetsWeights:
                      - 0.4
                      - 0.09999999999998999
              schema:
                properties:
                  assetsWeights:
                    description: assetsWeights[i] is the weight of the asset i in the portfolio, in percentage
                    items:
                      maximum: 1
                      minimum: 0
                      type: number
                    minItems: 2
                    type: array
                required:
                  - assetsWeights
                type: object
          description: OK
      summary: Subset Resampling-Based Minimum Variance Portfolio
      tags:
        - Portfolio Optimization / Mean-Variance
      x-codegen-request-body-name: body
  /portfolio/optimization/most-diversified:
    post:
      description: |
        Compute the asset weights of the most diversified portfolio, optionally subject to:  
        * Minimum and maximum weights constraints
        * Maximum group weights constraints
        * Minimum and maximum portfolio exposure constraints

        References
         * [Yves Choueifaty and Yves Coignard, Toward Maximum Diversification, The Journal of Portfolio Management Fall 2008, 35 (1) 40-51](https://doi.org/10.3905/JPM.2008.35.1.40)
      requestBody:
        content:
          application/json:
            examples:
              Example:
                description: Compute the portfolio weights for 2 assets
                value:
                  assets: 2
                  assetsCovarianceMatrix:
                    - - 0.04
                      - 0.01
                    - - 0.01
                      - 0.01
            schema:
              properties:
                assets:
                  description: The number of assets
                  minimum: 2
                  type: integer
                assetsCovarianceMatrix:
                  description: assetsCovarianceMatrix[i][j] is the covariance between the asset i and the asset j
                  items:
                    items:
                      type: number
                    minItems: 2
                    type: array
                  minItems: 2
                  type: array
                constraints:
                  properties:
                    assetsGroups:
                      items:
                        description: assetsGroups[k] is the indexes of the assets belonging to the assets group k in the portfolio; exclusive with assetsGroupsMatrix
                        items:
                          minimum: 1
                          type: integer
                        minItems: 2
                        type: array
                        uniqueItems: true
                      minItems: 1
                      type: array
                    assetsGroupsMatrix:
                      description: assetsGroupsMatrix[k][i] is the weight of the asset i in the group of assets k; exclusive with assetsGroups
                      items:
                        items:
                          type: number
                        minItems: 2
                        type: array
                      minItems: 1
                      type: array
                    maximumAssetsGroupsWeights:
                      description: maximumAssetsGroupsWeights[k] is the maximum weight of the assets group k in the portfolio, in percentage between 0 and 1 if assetsGroups is provided
                      items:
                        type: number
                      type: array
                    maximumAssetsWeights:
                      description: maximumAssetsWeights[i] is the maximum weight of the asset i in the portfolio, in percentage
                      items:
                        maximum: 1
                        minimum: 0
                        type: number
                      type: array
                    maximumPortfolioExposure:
                      default: 1
                      description: The maximum portfolio exposure; must be higher than or equal to minimumPortfolioExposure
                      maximum: 1
                      minimum: 0
                      type: number
                    minimumAssetsWeights:
                      description: minimumAssetsWeights[i] is the minimum weight of the asset i in the portfolio, in percentage
                      items:
                        maximum: 1
                        minimum: 0
                        type: number
                      type: array
                    minimumPortfolioExposure:
                      default: 1
                      description: The minimum portfolio exposure; must be lower than or equal to maximumPortfolioExposure
                      maximum: 1
                      minimum: 0
                      type: number
                  type: object
              required:
                - assets
                - assetsCovarianceMatrix
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Computed most diversified portfolio of 2 assets
                  value:
                    assetsWeights:
                      - 0.33333333333333337
                      - 0.6666666666666666
              schema:
                properties:
                  assetsWeights:
                    description: assetsWeights[i] is the weight of the asset i in the portfolio, in percentage
                    items:
                      maximum: 1
                      minimum: 0
                      type: number
                    minItems: 2
                    type: array
                required:
                  - assetsWeights
                type: object
          description: OK
      summary: Most Diversified Portfolio
      tags:
        - Portfolio Optimization
      x-codegen-request-body-name: body
  /portfolio/simulation/rebalancing/drift-weight:
    post:
      description: |
        Simulate the evolution of one or several portfolio(s) over one or several time period(s), the portfolio(s) being never rebalanced (a.k.a. buy and hold).

        References
        * [Hillion, Pierre, The Ex-Ante Rebalancing Premium (March 11, 2016). INSEAD Working Paper No. 2016/15/FIN](https://ssrn.com/abstract=2746471)
      requestBody:
        content:
          application/json:
            examples:
              Example:
                description: Simulate 3 buy and hold portfolios, each made of 3 assets with only one asset invested
                value:
                  assets:
                    - assetPrices:
                        - 100
                        - 105
                        - 110
                    - assetPrices:
                        - 15
                        - 12.5
                        - 11.25
                    - assetPrices:
                        - 0.5
                        - 0.51
                        - 0.49
                  portfolios:
                    - assetsWeights:
                        - 1
                        - 0
                        - 0
                    - assetsWeights:
                        - 0
                        - 1
                        - 0
                    - assetsWeights:
                        - 0
                        - 0
                        - 1
            schema:
              properties:
                assets:
                  items:
                    properties:
                      assetPrices:
                        description: assetPrices[t] is the price of the asset at the time t
                        items:
                          exclusiveMinimum: true
                          minimum: 0
                          type: number
                        minItems: 2
                        type: array
                    required:
                      - assetPrices
                    type: object
                  minItems: 1
                  type: array
                portfolios:
                  items:
                    properties:
                      assetsWeights:
                        description: assetsWeights[i] is the weight of the asset i in the portfolio, in percentage
                        items:
                          maximum: 1
                          minimum: 0
                          type: number
                        minItems: 1
                        type: array
                    required:
                      - assetsWeights
                    type: object
                  minItems: 1
                  type: array
              required:
                - assets
                - portfolios
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Simulated portfolios over 2 time periods
                  value:
                    portfolios:
                      - portfolioValues:
                          - 100
                          - 105
                          - 110
                      - portfolioValues:
                          - 100
                          - 83.33333333333334
                          - 75
                      - portfolioValues:
                          - 100
                          - 102
                          - 98
              schema:
                properties:
                  portfolios:
                    items:
                      properties:
                        portfolioValues:
                          description: portfolioValues[t] is the value of the portfolio at the time t
                          items:
                            minimum: 0
                            type: number
                          type: array
                      required:
                        - portfolioValues
                      type: object
                    type: array
                required:
                  - portfolios
                type: object
          description: OK
      summary: Drift-weight Portfolio Rebalancing
      tags:
        - Portfolio Simulation
      x-codegen-request-body-name: body
  /portfolio/simulation/rebalancing/fixed-weight:
    post:
      description: |
        Simulate the evolution of one or several portfolio(s) over one or several time period(s), the portfolio(s) being rebalanced toward fixed weights at the beginning of each time period.

        References
        * [Hillion, Pierre, The Ex-Ante Rebalancing Premium (March 11, 2016). INSEAD Working Paper No. 2016/15/FIN](https://ssrn.com/abstract=2746471)        
      requestBody:
        content:
          application/json:
            examples:
              Example:
                description: Simulate 3 portfolios, each rebalanced toward the provided assets weights at the beginning of each of the 2 time periods
                value:
                  assets:
                    - assetPrices:
                        - 100
                        - 105
                        - 110
                    - assetPrices:
                        - 15
                        - 12.5
                        - 11.25
                    - assetPrices:
                        - 0.5
                        - 0.51
                        - 0.49
                  portfolios:
                    - assetsWeights:
                        - 0.5
                        - 0.5
                        - 0
                    - assetsWeights:
                        - 0
                        - 0.5
                        - 0.5
                    - assetsWeights:
                        - 0.5
                        - 0
                        - 0.5
            schema:
              properties:
                assets:
                  items:
                    properties:
                      assetPrices:
                        description: assetPrices[t] is the price of the asset at the time t
                        items:
                          exclusiveMinimum: true
                          minimum: 0
                          type: number
                        minItems: 2
                        type: array
                    required:
                      - assetPrices
                    type: object
                  minItems: 1
                  type: array
                portfolios:
                  items:
                    properties:
                      assetsWeights:
                        description: assetsWeights[i] is the weight of the asset i in the portfolio, in percentage
                        items:
                          maximum: 1
                          minimum: 0
                          type: number
                        minItems: 1
                        type: array
                    required:
                      - assetsWeights
                    type: object
                  minItems: 1
                  type: array
              required:
                - assets
                - portfolios
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Simulated portfolios over 2 time periods
                  value:
                    portfolios:
                      - portfolioValues:
                          - 100
                          - 94.16666666666667
                          - 91.70039682539684
                      - portfolioValues:
                          - 100
                          - 92.66666666666667
                          - 86.21633986928106
                      - portfolioValues:
                          - 100
                          - 103.5
                          - 103.93487394957984
              schema:
                properties:
                  portfolios:
                    items:
                      properties:
                        portfolioValues:
                          description: portfolioValues[t] is the value of the portfolio at the time t
                          items:
                            minimum: 0
                            type: number
                          type: array
                      required:
                        - portfolioValues
                      type: object
                    type: array
                required:
                  - portfolios
                type: object
          description: OK
      summary: Fixed-weight Portfolio Rebalancing
      tags:
        - Portfolio Simulation
      x-codegen-request-body-name: body
  /portfolio/simulation/rebalancing/random-weight:
    post:
      description: |
        Simulate the evolution of one or several portfolio(s) over one or several time period(s), the portfolio(s) being rebalanced toward random weights at the beginning of each time period.

        References
        * [R Stein, Not fooled by randomness: Using random portfolios to analyse investment funds, Investment Analysts Journal, 43:79, 1-15, DOI: 10.1080/10293523.2014.11082564](https://www.tandfonline.com/doi/abs/10.1080/10293523.2014.11082564)
      requestBody:
        content:
          application/json:
            examples:
              Example:
                description: Simulate 2 portfolios each rebalanced toward random assets weights at the beginning of each of the 2 time periods
                value:
                  assets:
                    - assetPrices:
                        - 100
                        - 105
                        - 110
                    - assetPrices:
                        - 15
                        - 12.5
                        - 11.25
                    - assetPrices:
                        - 0.5
                        - 0.51
                        - 0.49
                  portfolios: 2
            schema:
              properties:
                assets:
                  items:
                    properties:
                      assetPrices:
                        description: assetPrices[t] is the price of the asset at the time t
                        items:
                          exclusiveMinimum: true
                          minimum: 0
                          type: number
                        minItems: 2
                        type: array
                    required:
                      - assetPrices
                    type: object
                  minItems: 1
                  type: array
                portfolios:
                  default: 25
                  description: The number of portfolios to simulate
                  minimum: 1
                  type: integer
              required:
                - assets
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  description: Simulated portfolios over 2 time periods
                  value:
                    portfolios:
                      - portfolioValues:
                          - 100
                          - 90.8178403620342
                          - 84.65407625993741
                      - portfolioValues:
                          - 100
                          - 102.43258698946813
                          - 101.32419718013273
              schema:
                properties:
                  portfolios:
                    items:
                      properties:
                        portfolioValues:
                          description: portfolioValues[t] is the value of the portfolio at the time t
                          items:
                            minimum: 0
                            type: number
                          type: array
                      required:
                        - portfolioValues
                      type: object
                    type: array
                required:
                  - portfolios
                type: object
          description: OK
      summary: Random-weight Portfolio Rebalancing
      tags:
        - Portfolio Simulation
      x-codegen-request-body-name: body
components:
  securitySchemes:
    ApiKeyAuth:
      description: |
        An [API key](#overview--api-key) is required to benefit from [higher API limits](#overview--api-limits).
      in: header
      name: X-API-Key
      type: apiKey
