Skip to main content

Optimization Engine API (Multi-period) client library for Python

Project description

FactSet

Optimization Engine API (Multi-period) client library for Python

PyPi Apache-2 license

No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

This Python package is automatically generated by the OpenAPI Generator project:

  • API version: 1
  • Package version: 0.21.6
  • Build package: org.openapitools.codegen.languages.PythonClientCodegen

Requirements

  • Python >= 3.7

Installation

Poetry

poetry add fds.sdk.utils fds.sdk.OptimizationEngineAPIMultiperiod

pip

pip install fds.sdk.utils fds.sdk.OptimizationEngineAPIMultiperiod

Usage

  1. Generate authentication credentials.
  2. Setup Python environment.
    1. Install and activate python 3.7+. If you're using pyenv:

      pyenv install 3.9.7
      pyenv shell 3.9.7
      
    2. (optional) Install poetry.

  3. Install dependencies.
  4. Run the following:
from fds.sdk.utils.authentication import ConfidentialClient

import fds.sdk.OptimizationEngineAPIMultiperiod
from fds.sdk.OptimizationEngineAPIMultiperiod.api import default_api
from fds.sdk.OptimizationEngineAPIMultiperiod.models import *
from dateutil.parser import parse as dateutil_parser
from pprint import pprint

# See configuration.py for a list of all supported configuration parameters.

# Examples for each supported authentication method are below,
# choose one that satisfies your use case.

# (Preferred) OAuth 2.0: FactSetOAuth2
# See https://github.com/FactSet/enterprise-sdk#oauth-20
# for information on how to create the app-config.json file
# See https://github.com/FactSet/enterprise-sdk-utils-python#authentication
# for more information on using the ConfidentialClient class
configuration = fds.sdk.OptimizationEngineAPIMultiperiod.Configuration(
    fds_oauth_client=ConfidentialClient('/path/to/app-config.json')
)

# Basic authentication: FactSetApiKey
# See https://github.com/FactSet/enterprise-sdk#api-key
# for information how to create an API key
# configuration = fds.sdk.OptimizationEngineAPIMultiperiod.Configuration(
#     username='USERNAME-SERIAL',
#     password='API-KEY'
# )

# Enter a context with an instance of the API client
with fds.sdk.OptimizationEngineAPIMultiperiod.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = default_api.DefaultApi(api_client)
    # NOTE: The parameter variable defined below is just an example and may potentially contain non valid values. So please replace this with valid values.
    multi_period_input = OptimizerInputsMultiPeriodInput(
        strategy=OptimizerInputsMultiPeriodStrategy(
            objective=OptimizerInputsMultiPeriodObjective(
                factor_exposure=[
                    OptimizerInputsMPFactorExposureTerm(
                        term=OptimizerInputsFactorExposureTerm(
                            name="name_example",
                            multiplier=OptimizerInputsValue(
                                value_type=OptimizerInputsEValueTypeEnum(0),
                                raw_value=3.14,
                                ref_index=1,
                            ),
                            factors=[
                                "factors_example",
                            ],
                            direction=OptimizerInputsEObjectiveTermDirectionEnum(0),
                            rel_to_benchmark=True,
                            benchmark_index=1,
                        ),
                        on_periods=OptimizerInputsOnPeriods(
                            periods=[
                                1,
                            ],
                        ),
                        across_periods=OptimizerInputsAcrossPeriods(
                            start_period=1,
                            end_period=1,
                            rolling=OptimizerInputsAcrossPeriodsRollingPeriods(
                                frequency=1,
                                method=OptimizerInputsRollingMethodEnum(0),
                            ),
                        ),
                    ),
                ],
                volatility=[
                    OptimizerInputsMPVolatilityTerm(
                        term=OptimizerInputsVolatilityTerm(
                            name="name_example",
                            multiplier=OptimizerInputsValue(
                                value_type=OptimizerInputsEValueTypeEnum(0),
                                raw_value=3.14,
                                ref_index=1,
                            ),
                            direction=OptimizerInputsEObjectiveTermDirectionEnum(0),
                            risk_type=OptimizerInputsEObjectiveRiskTypeEnum(0),
                            factors=[
                                "factors_example",
                            ],
                            active_risk=True,
                            benchmark_index=1,
                        ),
                        term_on=OptimizerInputsBoundSourceEnum(0),
                        on_periods=OptimizerInputsOnPeriods(
                            periods=[
                                1,
                            ],
                        ),
                        across_periods=OptimizerInputsAcrossPeriods(
                            start_period=1,
                            end_period=1,
                            rolling=OptimizerInputsAcrossPeriodsRollingPeriods(
                                frequency=1,
                                method=OptimizerInputsRollingMethodEnum(0),
                            ),
                        ),
                    ),
                ],
                general_linear=[
                    OptimizerInputsMPGeneralLinearTerm(
                        term=OptimizerInputsGeneralLinearTerm(
                            name="name_example",
                            multiplier=OptimizerInputsValue(
                                value_type=OptimizerInputsEValueTypeEnum(0),
                                raw_value=3.14,
                                ref_index=1,
                            ),
                            attribute=OptimizerInputsValue(
                                value_type=OptimizerInputsEValueTypeEnum(0),
                                raw_value=3.14,
                                ref_index=1,
                            ),
                            direction=OptimizerInputsEObjectiveTermDirectionEnum(0),
                            method=OptimizerInputsEAggregationMethodEnum(0),
                            rel_to_benchmark=True,
                            benchmark_index=1,
                        ),
                        on_periods=OptimizerInputsOnPeriods(
                            periods=[
                                1,
                            ],
                        ),
                        across_periods=OptimizerInputsAcrossPeriods(
                            start_period=1,
                            end_period=1,
                            rolling=OptimizerInputsAcrossPeriodsRollingPeriods(
                                frequency=1,
                                method=OptimizerInputsRollingMethodEnum(0),
                            ),
                        ),
                    ),
                ],
                expected_return=[
                    OptimizerInputsMPExpectedReturnTerm(
                        term=OptimizerInputsExpectedReturnTerm(
                            name="name_example",
                            multiplier=OptimizerInputsValue(
                                value_type=OptimizerInputsEValueTypeEnum(0),
                                raw_value=3.14,
                                ref_index=1,
                            ),
                            return_values=OptimizerInputsValue(
                                value_type=OptimizerInputsEValueTypeEnum(0),
                                raw_value=3.14,
                                ref_index=1,
                            ),
                            direction=OptimizerInputsEObjectiveTermDirectionEnum(0),
                            use_alpha=True,
                            rel_to_benchmark=True,
                            benchmark_index=1,
                        ),
                        term_on=OptimizerInputsBoundSourceEnum(0),
                        annualization_factor=3.14,
                        on_periods=OptimizerInputsOnPeriods(
                            periods=[
                                1,
                            ],
                        ),
                        across_periods=OptimizerInputsAcrossPeriods(
                            start_period=1,
                            end_period=1,
                            rolling=OptimizerInputsAcrossPeriodsRollingPeriods(
                                frequency=1,
                                method=OptimizerInputsRollingMethodEnum(0),
                            ),
                        ),
                    ),
                ],
                sensitivity=[
                    OptimizerInputsMPSensitivityTerm(
                        term=OptimizerInputsSensitivityTerm(
                            name="name_example",
                            multiplier=OptimizerInputsValue(
                                value_type=OptimizerInputsEValueTypeEnum(0),
                                raw_value=3.14,
                                ref_index=1,
                            ),
                            sensitivity_attribute=OptimizerInputsValue(
                                value_type=OptimizerInputsEValueTypeEnum(0),
                                raw_value=3.14,
                                ref_index=1,
                            ),
                            direction=OptimizerInputsEObjectiveTermDirectionEnum(0),
                            rel_to_benchmark=True,
                            benchmark_index=1,
                        ),
                        on_periods=OptimizerInputsOnPeriods(
                            periods=[
                                1,
                            ],
                        ),
                        across_periods=OptimizerInputsAcrossPeriods(
                            start_period=1,
                            end_period=1,
                            rolling=OptimizerInputsAcrossPeriodsRollingPeriods(
                                frequency=1,
                                method=OptimizerInputsRollingMethodEnum(0),
                            ),
                        ),
                    ),
                ],
                objective_ratio=OptimizerInputsMPObjectiveRatioTerm(
                    sharpe_ratio=OptimizerInputsSharpeRatioTerm(
                        name="name_example",
                        multiplier=OptimizerInputsValue(
                            value_type=OptimizerInputsEValueTypeEnum(0),
                            raw_value=3.14,
                            ref_index=1,
                        ),
                        risk_free_rate=OptimizerInputsValue(
                            value_type=OptimizerInputsEValueTypeEnum(0),
                            raw_value=3.14,
                            ref_index=1,
                        ),
                        direction=OptimizerInputsEObjectiveTermDirectionEnum(0),
                        active_risk=True,
                        benchmark_index=1,
                    ),
                    starr=OptimizerInputsSTARRTerm(
                        name="name_example",
                        multiplier=OptimizerInputsValue(
                            value_type=OptimizerInputsEValueTypeEnum(0),
                            raw_value=3.14,
                            ref_index=1,
                        ),
                        risk_free_rate=OptimizerInputsValue(
                            value_type=OptimizerInputsEValueTypeEnum(0),
                            raw_value=3.14,
                            ref_index=1,
                        ),
                        direction=OptimizerInputsEObjectiveTermDirectionEnum(0),
                        confidence_level=3.14,
                        use_centered_etl=True,
                        active_risk=True,
                        benchmark_index=1,
                    ),
                    diversification_ratio=OptimizerInputsDiversificationRatioTerm(
                        name="name_example",
                        multiplier=OptimizerInputsValue(
                            value_type=OptimizerInputsEValueTypeEnum(0),
                            raw_value=3.14,
                            ref_index=1,
                        ),
                        direction=OptimizerInputsEObjectiveTermDirectionEnum(0),
                    ),
                    on_periods=OptimizerInputsOnPeriods(
                        periods=[
                            1,
                        ],
                    ),
                    across_periods=OptimizerInputsAcrossPeriods(
                        start_period=1,
                        end_period=1,
                        rolling=OptimizerInputsAcrossPeriodsRollingPeriods(
                            frequency=1,
                            method=OptimizerInputsRollingMethodEnum(0),
                        ),
                    ),
                ),
                tail_risk=[
                    OptimizerInputsMPTailRiskTerm(
                        term=OptimizerInputsTailRiskTerm(
                            name="name_example",
                            multiplier=OptimizerInputsValue(
                                value_type=OptimizerInputsEValueTypeEnum(0),
                                raw_value=3.14,
                                ref_index=1,
                            ),
                            direction=OptimizerInputsEObjectiveTermDirectionEnum(0),
                            risk_measure=OptimizerInputsTailRiskMeasureEnum(0),
                            confidence_level=3.14,
                            use_centered_etl=True,
                            active_risk=True,
                            benchmark_index=1,
                        ),
                        term_on=OptimizerInputsBoundSourceEnum(0),
                        on_periods=OptimizerInputsOnPeriods(
                            periods=[
                                1,
                            ],
                        ),
                        across_periods=OptimizerInputsAcrossPeriods(
                            start_period=1,
                            end_period=1,
                            rolling=OptimizerInputsAcrossPeriodsRollingPeriods(
                                frequency=1,
                                method=OptimizerInputsRollingMethodEnum(0),
                            ),
                        ),
                    ),
                ],
                target_probability=[
                    OptimizerInputsMPTargetProbabilityTerm(
                        term=OptimizerInputsTargetProbabilityTerm(
                            name="name_example",
                            multiplier=OptimizerInputsValue(
                                value_type=OptimizerInputsEValueTypeEnum(0),
                                raw_value=3.14,
                                ref_index=1,
                            ),
                            direction=OptimizerInputsEObjectiveTermDirectionEnum(0),
                            threshold_min=OptimizerInputsValue(
                                value_type=OptimizerInputsEValueTypeEnum(0),
                                raw_value=3.14,
                                ref_index=1,
                            ),
                            threshold_max=OptimizerInputsValue(
                                value_type=OptimizerInputsEValueTypeEnum(0),
                                raw_value=3.14,
                                ref_index=1,
                            ),
                        ),
                        constrain_on=OptimizerInputsBoundSourceEnum(0),
                        on_periods=OptimizerInputsOnPeriods(
                            periods=[
                                1,
                            ],
                        ),
                        across_periods=OptimizerInputsAcrossPeriods(
                            start_period=1,
                            end_period=1,
                            rolling=OptimizerInputsAcrossPeriodsRollingPeriods(
                                frequency=1,
                                method=OptimizerInputsRollingMethodEnum(0),
                            ),
                        ),
                    ),
                ],
            ),
            constraints=OptimizerInputsMultiPeriodConstraints(
                expected_returns=[
                    OptimizerInputsMPExpectedReturnConstraint(
                        constraint=OptimizerInputsExpectedReturnConstraint(
                            name="name_example",
                            min=OptimizerInputsValue(
                                value_type=OptimizerInputsEValueTypeEnum(0),
                                raw_value=3.14,
                                ref_index=1,
                            ),
                            max=OptimizerInputsValue(
                                value_type=OptimizerInputsEValueTypeEnum(0),
                                raw_value=3.14,
                                ref_index=1,
                            ),
                            return_value=OptimizerInputsValue(
                                value_type=OptimizerInputsEValueTypeEnum(0),
                                raw_value=3.14,
                                ref_index=1,
                            ),
                            use_strategy_return_value=True,
                            penalty=OptimizerInputsPenalty(
                                enabled=True,
                                penalty_type=OptimizerInputsEConstraintPenaltyTypeEnum(0),
                                penalty_value=OptimizerInputsValue(
                                    value_type=OptimizerInputsEValueTypeEnum(0),
                                    raw_value=3.14,
                                    ref_index=1,
                                ),
                                max_violation=OptimizerInputsValue(
                                    value_type=OptimizerInputsEValueTypeEnum(0),
                                    raw_value=3.14,
                                    ref_index=1,
                                ),
                            ),
                            groups=[
                                OptimizerInputsConstraintGroup(
                                    min=OptimizerInputsValue(
                                        value_type=OptimizerInputsEValueTypeEnum(0),
                                        raw_value=3.14,
                                        ref_index=1,
                                    ),
                                    max=OptimizerInputsValue(
                                        value_type=OptimizerInputsEValueTypeEnum(0),
                                        raw_value=3.14,
                                        ref_index=1,
                                    ),
                                    id="id_example",
                                    nested_groups=[],
                                    group_lookup_index=1,
                                ),
                            ],
                            level=OptimizerInputsEConstraintLevelEnum(0),
                            return_type=OptimizerInputsEConstraintReturnTypeEnum(0),
                            rel_to_benchmark=True,
                            benchmark_index=1,
                            hierarchy=1,
                        ),
                        constraint_on=OptimizerInputsBoundSourceEnum(0),
                        annualization_factor=3.14,
                        on_periods=OptimizerInputsOnPeriods(
                            periods=[
                                1,
                            ],
                        ),
                        across_periods=OptimizerInputsAcrossPeriods(
                            start_period=1,
                            end_period=1,
                            rolling=OptimizerInputsAcrossPeriodsRollingPeriods(
                                frequency=1,
                                method=OptimizerInputsRollingMethodEnum(0),
                            ),
                        ),
                    ),
                ],
                diversification=[
                    OptimizerInputsMPDiversificationConstraint(
                        constraint=OptimizerInputsDiversificationConstraint(
                            name="name_example",
                            asset_value=OptimizerInputsValue(
                                value_type=OptimizerInputsEValueTypeEnum(0),
                                raw_value=3.14,
                                ref_index=1,
                            ),
                            max_percent=OptimizerInputsValue(
                                value_type=OptimizerInputsEValueTypeEnum(0),
                                raw_value=3.14,
                                ref_index=1,
                            ),
                            penalty=OptimizerInputsPenalty(
                                enabled=True,
                                penalty_type=OptimizerInputsEConstraintPenaltyTypeEnum(0),
                                penalty_value=OptimizerInputsValue(
                                    value_type=OptimizerInputsEValueTypeEnum(0),
                                    raw_value=3.14,
                                    ref_index=1,
                                ),
                                max_violation=OptimizerInputsValue(
                                    value_type=OptimizerInputsEValueTypeEnum(0),
                                    raw_value=3.14,
                                    ref_index=1,
                                ),
                            ),
                            groups=[
                                OptimizerInputsConstraintGroup(
                                    min=OptimizerInputsValue(
                                        value_type=OptimizerInputsEValueTypeEnum(0),
                                        raw_value=3.14,
                                        ref_index=1,
                                    ),
                                    max=OptimizerInputsValue(
                                        value_type=OptimizerInputsEValueTypeEnum(0),
                                        raw_value=3.14,
                                        ref_index=1,
                                    ),
                                    id="id_example",
                                    nested_groups=[],
                                    group_lookup_index=1,
                                ),
                            ],
                            unit=OptimizerInputsEConstraintUnitTypeEnum(0),
                            level=OptimizerInputsEConstraintLevelEnum(0),
                            hierarchy=1,
                        ),
                        on_periods=OptimizerInputsOnPeriods(
                            periods=[
                                1,
                            ],
                        ),
                    ),
                ],
                factor_exposures=[
                    OptimizerInputsMPFactorExposureConstraint(
                        constraint=OptimizerInputsFactorExposureConstraint(
                            name="name_example",
                            penalty=OptimizerInputsPenalty(
                                enabled=True,
                                penalty_type=OptimizerInputsEConstraintPenaltyTypeEnum(0),
                                penalty_value=OptimizerInputsValue(
                                    value_type=OptimizerInputsEValueTypeEnum(0),
                                    raw_value=3.14,
                                    ref_index=1,
                                ),
                                max_violation=OptimizerInputsValue(
                                    value_type=OptimizerInputsEValueTypeEnum(0),
                                    raw_value=3.14,
                                    ref_index=1,
                                ),
                            ),
                            rel_to_benchmark=True,
                            benchmark_index=1,
                            factors=OptimizerInputsFactorExposureAttributes(
                                min=OptimizerInputsValue(
                                    value_type=OptimizerInputsEValueTypeEnum(0),
                                    raw_value=3.14,
                                    ref_index=1,
                                ),
                                max=OptimizerInputsValue(
                                    value_type=OptimizerInputsEValueTypeEnum(0),
                                    raw_value=3.14,
                                    ref_index=1,
                                ),
                            ),
                            hierarchy=1,
                            groups=[
                                OptimizerInputsConstraintGroup(
                                    min=OptimizerInputsValue(
                                        value_type=OptimizerInputsEValueTypeEnum(0),
                                        raw_value=3.14,
                                        ref_index=1,
                                    ),
                                    max=OptimizerInputsValue(
                                        value_type=OptimizerInputsEValueTypeEnum(0),
                                        raw_value=3.14,
                                        ref_index=1,
                                    ),
                                    id="id_example",
                                    nested_groups=[],
                                    group_lookup_index=1,
                                ),
                            ],
                        ),
                        on_periods=OptimizerInputsOnPeriods(
                            periods=[
                                1,
                            ],
                        ),
                        across_periods=OptimizerInputsAcrossPeriods(
                            start_period=1,
                            end_period=1,
                            rolling=OptimizerInputsAcrossPeriodsRollingPeriods(
                                frequency=1,
                                method=OptimizerInputsRollingMethodEnum(0),
                            ),
                        ),
                    ),
                ],
                general_linear=[
                    OptimizerInputsMPGeneralLinearConstraint(
                        constraint=OptimizerInputsGeneralLinearConstraint(
                            name="name_example",
                            security_attribute=OptimizerInputsValue(
                                value_type=OptimizerInputsEValueTypeEnum(0),
                                raw_value=3.14,
                                ref_index=1,
                            ),
                            min=OptimizerInputsValue(
                                value_type=OptimizerInputsEValueTypeEnum(0),
                                raw_value=3.14,
                                ref_index=1,
                            ),
                            max=OptimizerInputsValue(
                                value_type=OptimizerInputsEValueTypeEnum(0),
                                raw_value=3.14,
                                ref_index=1,
                            ),
                            penalty=OptimizerInputsPenalty(
                                enabled=True,
                                penalty_type=OptimizerInputsEConstraintPenaltyTypeEnum(0),
                                penalty_value=OptimizerInputsValue(
                                    value_type=OptimizerInputsEValueTypeEnum(0),
                                    raw_value=3.14,
                                    ref_index=1,
                                ),
                                max_violation=OptimizerInputsValue(
                                    value_type=OptimizerInputsEValueTypeEnum(0),
                                    raw_value=3.14,
                                    ref_index=1,
                                ),
                            ),
                            groups=[
                                OptimizerInputsConstraintGroup(
                                    min=OptimizerInputsValue(
                                        value_type=OptimizerInputsEValueTypeEnum(0),
                                        raw_value=3.14,
                                        ref_index=1,
                                    ),
                                    max=OptimizerInputsValue(
                                        value_type=OptimizerInputsEValueTypeEnum(0),
                                        raw_value=3.14,
                                        ref_index=1,
                                    ),
                                    id="id_example",
                                    nested_groups=[],
                                    group_lookup_index=1,
                                ),
                            ],
                            weighting_method=OptimizerInputsEWeightingMethodTypeEnum(0),
                            level=OptimizerInputsEConstraintLevelEnum(0),
                            hierarchy=1,
                            rel_to_benchmark=True,
                            benchmark_index=1,
                        ),
                        on_periods=OptimizerInputsOnPeriods(
                            periods=[
                                1,
                            ],
                        ),
                        across_periods=OptimizerInputsAcrossPeriods(
                            start_period=1,
                            end_period=1,
                            rolling=OptimizerInputsAcrossPeriodsRollingPeriods(
                                frequency=1,
                                method=OptimizerInputsRollingMethodEnum(0),
                            ),
                        ),
                    ),
                ],
                holding_threshold=[
                    OptimizerInputsMPHoldingsThresholdConstraint(
                        constraint=OptimizerInputsHoldingsThresholdConstraint(
                            name="name_example",
                            custom_asset=OptimizerInputsValue(
                                value_type=OptimizerInputsEValueTypeEnum(0),
                                raw_value=3.14,
                                ref_index=1,
                            ),
                            min=OptimizerInputsValue(
                                value_type=OptimizerInputsEValueTypeEnum(0),
                                raw_value=3.14,
                                ref_index=1,
                            ),
                            groups=[
                                OptimizerInputsConstraintGroup(
                                    min=OptimizerInputsValue(
                                        value_type=OptimizerInputsEValueTypeEnum(0),
                                        raw_value=3.14,
                                        ref_index=1,
                                    ),
                                    max=OptimizerInputsValue(
                                        value_type=OptimizerInputsEValueTypeEnum(0),
                                        raw_value=3.14,
                                        ref_index=1,
                                    ),
                                    id="id_example",
                                    nested_groups=[],
                                    group_lookup_index=1,
                                ),
                            ],
                            asset_type=OptimizerInputsEFPOConstraintAssetTypeEnum(0),
                            level=OptimizerInputsEConstraintLevelEnum(0),
                            unit=OptimizerInputsEConstraintUnitTypeEnum(0),
                            hierarchy=1,
                        ),
                        on_periods=OptimizerInputsOnPeriods(
                            periods=[
                                1,
                            ],
                        ),
                    ),
                ],
                leverage=[
                    OptimizerInputsMPLeverageConstraint(
                        constraint=OptimizerInputsLeverageConstraint(
                            name="name_example",
                            value=OptimizerInputsValue(
                                value_type=OptimizerInputsEValueTypeEnum(0),
                                raw_value=3.14,
                                ref_index=1,
                            ),
                            value_type=OptimizerInputsELeverageValueTypeEnum(0),
                            hierarchy=1,
                            groups=[
                                OptimizerInputsConstraintGroup(
                                    min=OptimizerInputsValue(
                                        value_type=OptimizerInputsEValueTypeEnum(0),
                                        raw_value=3.14,
                                        ref_index=1,
                                    ),
                                    max=OptimizerInputsValue(
                                        value_type=OptimizerInputsEValueTypeEnum(0),
                                        raw_value=3.14,
                                        ref_index=1,
                                    ),
                                    id="id_example",
                                    nested_groups=[],
                                    group_lookup_index=1,
                                ),
                            ],
                            level=OptimizerInputsEConstraintLevelEnum(0),
                        ),
                        on_periods=OptimizerInputsOnPeriods(
                            periods=[
                                1,
                            ],
                        ),
                    ),
                ],
                num_of_assets=[
                    OptimizerInputsMPNumberofAssetsConstraint(
                        constraint=OptimizerInputsNumberofAssetsConstraint(
                            name="name_example",
                            min=OptimizerInputsValue(
                                value_type=OptimizerInputsEValueTypeEnum(0),
                                raw_value=3.14,
                                ref_index=1,
                            ),
                            max=OptimizerInputsValue(
                                value_type=OptimizerInputsEValueTypeEnum(0),
                                raw_value=3.14,
                                ref_index=1,
                            ),
                            groups=[
                                OptimizerInputsConstraintGroup(
                                    min=OptimizerInputsValue(
                                        value_type=OptimizerInputsEValueTypeEnum(0),
                                        raw_value=3.14,
                                        ref_index=1,
                                    ),
                                    max=OptimizerInputsValue(
                                        value_type=OptimizerInputsEValueTypeEnum(0),
                                        raw_value=3.14,
                                        ref_index=1,
                                    ),
                                    id="id_example",
                                    nested_groups=[],
                                    group_lookup_index=1,
                                ),
                            ],
                            level=OptimizerInputsEConstraintLevelEnum(0),
                            hierarchy=1,
                        ),
                        on_periods=OptimizerInputsOnPeriods(
                            periods=[
                                1,
                            ],
                        ),
                    ),
                ],
                sensitivity=[
                    OptimizerInputsMPSensitivityConstraint(
                        constraint=OptimizerInputsSensitivityConstraint(
                            name="name_example",
                            min=OptimizerInputsValue(
                                value_type=OptimizerInputsEValueTypeEnum(0),
                                raw_value=3.14,
                                ref_index=1,
                            ),
                            max=OptimizerInputsValue(
                                value_type=OptimizerInputsEValueTypeEnum(0),
                                raw_value=3.14,
                                ref_index=1,
                            ),
                            sensitivity_attribute=OptimizerInputsValue(
                                value_type=OptimizerInputsEValueTypeEnum(0),
                                raw_value=3.14,
                                ref_index=1,
                            ),
                            penalty=OptimizerInputsPenalty(
                                enabled=True,
                                penalty_type=OptimizerInputsEConstraintPenaltyTypeEnum(0),
                                penalty_value=OptimizerInputsValue(
                                    value_type=OptimizerInputsEValueTypeEnum(0),
                                    raw_value=3.14,
                                    ref_index=1,
                                ),
                                max_violation=OptimizerInputsValue(
                                    value_type=OptimizerInputsEValueTypeEnum(0),
                                    raw_value=3.14,
                                    ref_index=1,
                                ),
                            ),
                            groups=[
                                OptimizerInputsConstraintGroup(
                                    min=OptimizerInputsValue(
                                        value_type=OptimizerInputsEValueTypeEnum(0),
                                        raw_value=3.14,
                                        ref_index=1,
                                    ),
                                    max=OptimizerInputsValue(
                                        value_type=OptimizerInputsEValueTypeEnum(0),
                                        raw_value=3.14,
                                        ref_index=1,
                                    ),
                                    id="id_example",
                                    nested_groups=[],
                                    group_lookup_index=1,
                                ),
                            ],
                            level=OptimizerInputsEConstraintLevelEnum(0),
                            rel_to_benchmark=True,
                            benchmark_index=1,
                            hierarchy=1,
                            unit=OptimizerInputsEConstraintUnitTypeEnum(0),
                        ),
                        on_periods=OptimizerInputsOnPeriods(
                            periods=[
                                1,
                            ],
                        ),
                        across_periods=OptimizerInputsAcrossPeriods(
                            start_period=1,
                            end_period=1,
                            rolling=OptimizerInputsAcrossPeriodsRollingPeriods(
                                frequency=1,
                                method=OptimizerInputsRollingMethodEnum(0),
                            ),
                        ),
                    ),
                ],
                weight_constraint=[
                    OptimizerInputsMPHoldingsWeightConstraint(
                        constraint=OptimizerInputsHoldingsWeightConstraint(
                            name="name_example",
                            custom_asset=OptimizerInputsValue(
                                value_type=OptimizerInputsEValueTypeEnum(0),
                                raw_value=3.14,
                                ref_index=1,
                            ),
                            min=OptimizerInputsValue(
                                value_type=OptimizerInputsEValueTypeEnum(0),
                                raw_value=3.14,
                                ref_index=1,
                            ),
                            max=OptimizerInputsValue(
                                value_type=OptimizerInputsEValueTypeEnum(0),
                                raw_value=3.14,
                                ref_index=1,
                            ),
                            penalty=OptimizerInputsPenalty(
                                enabled=True,
                                penalty_type=OptimizerInputsEConstraintPenaltyTypeEnum(0),
                                penalty_value=OptimizerInputsValue(
                                    value_type=OptimizerInputsEValueTypeEnum(0),
                                    raw_value=3.14,
                                    ref_index=1,
                                ),
                                max_violation=OptimizerInputsValue(
                                    value_type=OptimizerInputsEValueTypeEnum(0),
                                    raw_value=3.14,
                                    ref_index=1,
                                ),
                            ),
                            groups=[
                                OptimizerInputsConstraintGroup(
                                    min=OptimizerInputsValue(
                                        value_type=OptimizerInputsEValueTypeEnum(0),
                                        raw_value=3.14,
                                        ref_index=1,
                                    ),
                                    max=OptimizerInputsValue(
                                        value_type=OptimizerInputsEValueTypeEnum(0),
                                        raw_value=3.14,
                                        ref_index=1,
                                    ),
                                    id="id_example",
                                    nested_groups=[],
                                    group_lookup_index=1,
                                ),
                            ],
                            unit=OptimizerInputsEConstraintUnitTypeEnum(0),
                            weight_type=OptimizerInputsEFPOConstraintWeightTypeEnum(0),
                            level=OptimizerInputsEConstraintLevelEnum(0),
                            asset_type=OptimizerInputsEFPOConstraintAssetTypeEnum(0),
                            rel_to_benchmark=True,
                            benchmark_index=1,
                            hierarchy=1,
                            apply_only_to_direct=True,
                        ),
                        on_periods=OptimizerInputsOnPeriods(
                            periods=[
                                1,
                            ],
                        ),
                    ),
                ],
                number_of_buys=[
                    OptimizerInputsMPNumberOfBuysConstraint(
                        constraint=OptimizerInputsNumberOfBuysConstraint(
                            name="name_example",
                            max=OptimizerInputsValue(
                                value_type=OptimizerInputsEValueTypeEnum(0),
                                raw_value=3.14,
                                ref_index=1,
                            ),
                            groups=[
                                OptimizerInputsConstraintGroup(
                                    min=OptimizerInputsValue(
                                        value_type=OptimizerInputsEValueTypeEnum(0),
                                        raw_value=3.14,
                                        ref_index=1,
                                    ),
                                    max=OptimizerInputsValue(
                                        value_type=OptimizerInputsEValueTypeEnum(0),
                                        raw_value=3.14,
                                        ref_index=1,
                                    ),
                                    id="id_example",
                                    nested_groups=[],
                                    group_lookup_index=1,
                                ),
                            ],
                            level=OptimizerInputsEConstraintLevelEnum(0),
                            hierarchy=1,
                        ),
                        on_periods=OptimizerInputsOnPeriods(
                            periods=[
                                1,
                            ],
                        ),
                    ),
                ],
                number_of_sells=[
                    OptimizerInputsMPNumberOfSellsConstraint(
                        constraint=OptimizerInputsNumberOfSellsConstraint(
                            name="name_example",
                            max=OptimizerInputsValue(
                                value_type=OptimizerInputsEValueTypeEnum(0),
                                raw_value=3.14,
                                ref_index=1,
                            ),
                            groups=[
                                OptimizerInputsConstraintGroup(
                                    min=OptimizerInputsValue(
                                        value_type=OptimizerInputsEValueTypeEnum(0),
                                        raw_value=3.14,
                                        ref_index=1,
                                    ),
                                    max=OptimizerInputsValue(
                                        value_type=OptimizerInputsEValueTypeEnum(0),
                                        raw_value=3.14,
                                        ref_index=1,
                                    ),
                                    id="id_example",
                                    nested_groups=[],
                                    group_lookup_index=1,
                                ),
                            ],
                            level=OptimizerInputsEConstraintLevelEnum(0),
                            hierarchy=1,
                        ),
                        on_periods=OptimizerInputsOnPeriods(
                            periods=[
                                1,
                            ],
                        ),
                    ),
                ],
                round_lots=[
                    OptimizerInputsMPRoundlotsConstraint(
                        constraint=OptimizerInputsRoundlotsConstraint(
                            name="name_example",
                            asset_level=OptimizerInputsValue(
                                value_type=OptimizerInputsEValueTypeEnum(0),
                                raw_value=3.14,
                                ref_index=1,
                            ),
                            custom_asset=OptimizerInputsValue(
                                value_type=OptimizerInputsEValueTypeEnum(0),
                                raw_value=3.14,
                                ref_index=1,
                            ),
                            groups=[
                                OptimizerInputsConstraintGroup(
                                    min=OptimizerInputsValue(
                                        value_type=OptimizerInputsEValueTypeEnum(0),
                                        raw_value=3.14,
                                        ref_index=1,
                                    ),
                                    max=OptimizerInputsValue(
                                        value_type=OptimizerInputsEValueTypeEnum(0),
                                        raw_value=3.14,
                                        ref_index=1,
                                    ),
                                    id="id_example",
                                    nested_groups=[],
                                    group_lookup_index=1,
                                ),
                            ],
                            level=OptimizerInputsEConstraintLevelEnum(0),
                            asset_type=OptimizerInputsEFPOConstraintAssetTypeEnum(0),
                            general_value=3.14,
                            hierarchy=1,
                        ),
                        on_periods=OptimizerInputsOnPeriods(
                            periods=[
                                1,
                            ],
                        ),
                    ),
                ],
                trade_threshold=[
                    OptimizerInputsMPTradeThresholdConstraint(
                        constraint=OptimizerInputsTradeThresholdConstraint(
                            name="name_example",
                            min=OptimizerInputsValue(
                                value_type=OptimizerInputsEValueTypeEnum(0),
                                raw_value=3.14,
                                ref_index=1,
                            ),
                            custom_asset=OptimizerInputsValue(
                                value_type=OptimizerInputsEValueTypeEnum(0),
                                raw_value=3.14,
                                ref_index=1,
                            ),
                            groups=[
                                OptimizerInputsConstraintGroup(
                                    min=OptimizerInputsValue(
                                        value_type=OptimizerInputsEValueTypeEnum(0),
                                        raw_value=3.14,
                                        ref_index=1,
                                    ),
                                    max=OptimizerInputsValue(
                                        value_type=OptimizerInputsEValueTypeEnum(0),
                                        raw_value=3.14,
                                        ref_index=1,
                                    ),
                                    id="id_example",
                                    nested_groups=[],
                                    group_lookup_index=1,
                                ),
                            ],
                            level=OptimizerInputsEConstraintLevelEnum(0),
                            unit=OptimizerInputsEConstraintUnitTypeEnum(0),
                            asset_type=OptimizerInputsEFPOConstraintAssetTypeEnum(0),
                            hierarchy=1,
                        ),
                        on_periods=OptimizerInputsOnPeriods(
                            periods=[
                                1,
                            ],
                        ),
                    ),
                ],
                trading_turnover=[
                    OptimizerInputsMPTurnoverConstraint(
                        constraint=OptimizerInputsTurnoverConstraint(
                            name="name_example",
                            max=OptimizerInputsValue(
                                value_type=OptimizerInputsEValueTypeEnum(0),
                                raw_value=3.14,
                                ref_index=1,
                            ),
                            custom_asset=OptimizerInputsValue(
                                value_type=OptimizerInputsEValueTypeEnum(0),
                                raw_value=3.14,
                                ref_index=1,
                            ),
                            penalty=OptimizerInputsPenalty(
                                enabled=True,
                                penalty_type=OptimizerInputsEConstraintPenaltyTypeEnum(0),
                                penalty_value=OptimizerInputsValue(
                                    value_type=OptimizerInputsEValueTypeEnum(0),
                                    raw_value=3.14,
                                    ref_index=1,
                                ),
                                max_violation=OptimizerInputsValue(
                                    value_type=OptimizerInputsEValueTypeEnum(0),
                                    raw_value=3.14,
                                    ref_index=1,
                                ),
                            ),
                            groups=[
                                OptimizerInputsConstraintGroup(
                                    min=OptimizerInputsValue(
                                        value_type=OptimizerInputsEValueTypeEnum(0),
                                        raw_value=3.14,
                                        ref_index=1,
                                    ),
                                    max=OptimizerInputsValue(
                                        value_type=OptimizerInputsEValueTypeEnum(0),
                                        raw_value=3.14,
                                        ref_index=1,
                                    ),
                                    id="id_example",
                                    nested_groups=[],
                                    group_lookup_index=1,
                                ),
                            ],
                            level=OptimizerInputsEConstraintLevelEnum(0),
                            value_type=OptimizerInputsEConstraintValueTypeEnum(0),
                            asset_type=OptimizerInputsEFPOConstraintAssetTypeEnum(0),
                            turnover_type=OptimizerInputsEConstraintTurnoverTypeEnum(0),
                            hierarchy=1,
                        ),
                        on_periods=OptimizerInputsOnPeriods(
                            periods=[
                                1,
                            ],
                        ),
                        across_periods=OptimizerInputsAcrossPeriods(
                            start_period=1,
                            end_period=1,
                            rolling=OptimizerInputsAcrossPeriodsRollingPeriods(
                                frequency=1,
                                method=OptimizerInputsRollingMethodEnum(0),
                            ),
                        ),
                    ),
                ],
                risk_contribution=[
                    OptimizerInputsMPRiskContributionConstraint(
                        constraint=OptimizerInputsRiskContributionConstraint(
                            name="name_example",
                            max_percent=OptimizerInputsValue(
                                value_type=OptimizerInputsEValueTypeEnum(0),
                                raw_value=3.14,
                                ref_index=1,
                            ),
                            custom_asset=OptimizerInputsValue(
                                value_type=OptimizerInputsEValueTypeEnum(0),
                                raw_value=3.14,
                                ref_index=1,
                            ),
                            groups=[
                                OptimizerInputsConstraintGroup(
                                    min=OptimizerInputsValue(
                                        value_type=OptimizerInputsEValueTypeEnum(0),
                                        raw_value=3.14,
                                        ref_index=1,
                                    ),
                                    max=OptimizerInputsValue(
                                        value_type=OptimizerInputsEValueTypeEnum(0),
                                        raw_value=3.14,
                                        ref_index=1,
                                    ),
                                    id="id_example",
                                    nested_groups=[],
                                    group_lookup_index=1,
                                ),
                            ],
                            level=OptimizerInputsEConstraintLevelEnum(0),
                            asset_type=OptimizerInputsEFPOConstraintAssetTypeEnum(0),
                            risk_type=OptimizerInputsEConstraintRiskTypeEnum(0),
                            hierarchy=1,
                        ),
                        on_periods=OptimizerInputsOnPeriods(
                            periods=[
                                1,
                            ],
                        ),
                    ),
                ],
                risk_volatility=[
                    OptimizerInputsMPRiskVolatilityConstraint(
                        constraint=OptimizerInputsRiskVolatilityConstraint(
                            name="name_example",
                            max_value_of_risk=OptimizerInputsValue(
                                value_type=OptimizerInputsEValueTypeEnum(0),
                                raw_value=3.14,
                                ref_index=1,
                            ),
                            level=OptimizerInputsEConstraintLevelEnum(0),
                            penalty=OptimizerInputsPenalty(
                                enabled=True,
                                penalty_type=OptimizerInputsEConstraintPenaltyTypeEnum(0),
                                penalty_value=OptimizerInputsValue(
                                    value_type=OptimizerInputsEValueTypeEnum(0),
                                    raw_value=3.14,
                                    ref_index=1,
                                ),
                                max_violation=OptimizerInputsValue(
                                    value_type=OptimizerInputsEValueTypeEnum(0),
                                    raw_value=3.14,
                                    ref_index=1,
                                ),
                            ),
                            groups=[
                                OptimizerInputsConstraintGroup(
                                    min=OptimizerInputsValue(
                                        value_type=OptimizerInputsEValueTypeEnum(0),
                                        raw_value=3.14,
                                        ref_index=1,
                                    ),
                                    max=OptimizerInputsValue(
                                        value_type=OptimizerInputsEValueTypeEnum(0),
                                        raw_value=3.14,
                                        ref_index=1,
                                    ),
                                    id="id_example",
                                    nested_groups=[],
                                    group_lookup_index=1,
                                ),
                            ],
                            risk_type=OptimizerInputsEConstraintRiskTypeEnum(0),
                            active_risk=True,
                            benchmark_index=1,
                            hierarchy=1,
                        ),
                        constraint_on=OptimizerInputsBoundSourceEnum(0),
                        on_periods=OptimizerInputsOnPeriods(
                            periods=[
                                1,
                            ],
                        ),
                        across_periods=OptimizerInputsAcrossPeriods(
                            start_period=1,
                            end_period=1,
                            rolling=OptimizerInputsAcrossPeriodsRollingPeriods(
                                frequency=1,
                                method=OptimizerInputsRollingMethodEnum(0),
                            ),
                        ),
                    ),
                ],
                tail_risk=[
                    OptimizerInputsMPLimitTailRiskConstraint(
                        constraint=OptimizerInputsLimitTailRiskConstraint(
                            name="name_example",
                            risk_measure=OptimizerInputsTailRiskMeasureEnum(0),
                            max_risk=OptimizerInputsValue(
                                value_type=OptimizerInputsEValueTypeEnum(0),
                                raw_value=3.14,
                                ref_index=1,
                            ),
                            confidence_level=OptimizerInputsValue(
                                value_type=OptimizerInputsEValueTypeEnum(0),
                                raw_value=3.14,
                                ref_index=1,
                            ),
                            penalty=OptimizerInputsPenalty(
                                enabled=True,
                                penalty_type=OptimizerInputsEConstraintPenaltyTypeEnum(0),
                                penalty_value=OptimizerInputsValue(
                                    value_type=OptimizerInputsEValueTypeEnum(0),
                                    raw_value=3.14,
                                    ref_index=1,
                                ),
                                max_violation=OptimizerInputsValue(
                                    value_type=OptimizerInputsEValueTypeEnum(0),
                                    raw_value=3.14,
                                    ref_index=1,
                                ),
                            ),
                            active_risk=True,
                            benchmark_index=1,
                            hierarchy=1,
                        ),
                        constraint_on=OptimizerInputsBoundSourceEnum(0),
                        on_periods=OptimizerInputsOnPeriods(
                            periods=[
                                1,
                            ],
                        ),
                        across_periods=OptimizerInputsAcrossPeriods(
                            start_period=1,
                            end_period=1,
                            rolling=OptimizerInputsAcrossPeriodsRollingPeriods(
                                frequency=1,
                                method=OptimizerInputsRollingMethodEnum(0),
                            ),
                        ),
                    ),
                ],
                target_probability=[
                    OptimizerInputsMPTargetProbabilityConstraint(
                        constraint=OptimizerInputsTargetProbabilityConstraint(
                            name="name_example",
                            threshold_min=OptimizerInputsValue(
                                value_type=OptimizerInputsEValueTypeEnum(0),
                                raw_value=3.14,
                                ref_index=1,
                            ),
                            threshold_max=OptimizerInputsValue(
                                value_type=OptimizerInputsEValueTypeEnum(0),
                                raw_value=3.14,
                                ref_index=1,
                            ),
                            min_probability=OptimizerInputsValue(
                                value_type=OptimizerInputsEValueTypeEnum(0),
                                raw_value=3.14,
                                ref_index=1,
                            ),
                            max_probability=OptimizerInputsValue(
                                value_type=OptimizerInputsEValueTypeEnum(0),
                                raw_value=3.14,
                                ref_index=1,
                            ),
                            hierarchy=1,
                        ),
                        constraint_on=OptimizerInputsBoundSourceEnum(0),
                        on_periods=OptimizerInputsOnPeriods(
                            periods=[
                                1,
                            ],
                        ),
                        across_periods=OptimizerInputsAcrossPeriods(
                            start_period=1,
                            end_period=1,
                            rolling=OptimizerInputsAcrossPeriodsRollingPeriods(
                                frequency=1,
                                method=OptimizerInputsRollingMethodEnum(0),
                            ),
                        ),
                    ),
                ],
            ),
            transaction_cost=OptimizerInputsTransactionCost(
                unit_type=OptimizerInputsETransactionCostUnitTypeEnum(0),
                buy_cost=OptimizerInputsValue(
                    value_type=OptimizerInputsEValueTypeEnum(0),
                    raw_value=3.14,
                    ref_index=1,
                ),
                sell_cost=OptimizerInputsValue(
                    value_type=OptimizerInputsEValueTypeEnum(0),
                    raw_value=3.14,
                    ref_index=1,
                ),
            ),
            options=OptimizerInputsMultiPeriodOptions(
                options=OptimizerInputsOptions(
                    max_run_time=1,
                    convergence_tolerance=3.14,
                    cash_flow_formula=OptimizerInputsValue(
                        value_type=OptimizerInputsEValueTypeEnum(0),
                        raw_value=3.14,
                        ref_index=1,
                    ),
                    convert_weights_to_cash_for_ip=True,
                    convert_weights_to_cash_for_bmk=True,
                    composite_asset_lookthrough_level=1,
                ),
                weight_rebalance_periods=[
                    1,
                ],
                total_periods_count=1,
                initial_point_randomization_count=1,
            ),
            expected_return=OptimizerInputsExpectedReturn(
                alpha=OptimizerInputsValue(
                    value_type=OptimizerInputsEValueTypeEnum(0),
                    raw_value=3.14,
                    ref_index=1,
                ),
                alpha_unit=OptimizerInputsEAlphaUnitTypeEnum(0),
            ),
        ),
        universe=OptimizerInputsTotalUniverse(
            assets=[
                OptimizerInputsAsset(
                    symbol="symbol_example",
                    price=3.14,
                ),
            ],
            composite_assets=OptimizerInputsCompositeAsset(
                constituents=[
                    OptimizerInputsCompositeConstituent(
                        univ_index=1,
                        weight=3.14,
                        price=OptimizerInputsAssetPrice(
                            source=OptimizerInputsAssetPriceEPriceSource(0),
                            price_override=3.14,
                        ),
                    ),
                ],
            ),
            derivatives=OptimizerInputsDerivative(
                offset_index=1,
                future=OptimizerInputsDerivativeFuture(
                    contract_size=3.14,
                    method=OptimizerInputsDerivativeFutureEComputationMethodEnum(0),
                    using_pa_multiply=True,
                ),
                forward=True,
            ),
        ),
        portfolios=OptimizerInputsPortfolios(
            initial=OptimizerInputsPortfolio(
                holdings=[
                    OptimizerInputsPortfolioItem(
                        univ_index=1,
                        price=OptimizerInputsAssetPrice(
                            source=OptimizerInputsAssetPriceEPriceSource(0),
                            price_override=3.14,
                        ),
                        shares=3.14,
                    ),
                ],
            ),
            benchmarks=[
                OptimizerInputsPortfolio(
                    holdings=[
                        OptimizerInputsPortfolioItem(
                            univ_index=1,
                            price=OptimizerInputsAssetPrice(
                                source=OptimizerInputsAssetPriceEPriceSource(0),
                                price_override=3.14,
                            ),
                            shares=3.14,
                        ),
                    ],
                ),
            ],
            buylist=[
                OptimizerInputsBuyListItem(
                    univ_index=1,
                    price=OptimizerInputsAssetPrice(
                        source=OptimizerInputsAssetPriceEPriceSource(0),
                        price_override=3.14,
                    ),
                ),
            ],
            cash_univ_index=1,
        ),
        riskmodels=OptimizerInputsMultiPeriodRiskModels(
            risk_models=[
                OptimizerInputsRiskModelForPeriods(
                    risk_model=OptimizerInputsRiskModel(
                        simulated_risk_model=OptimizerInputsSimulatedRiskModel(
                            raw_data=VARDistributionDataMessage(
                                description=VARDistributionDescription(
                                    risk_model="risk_model_example",
                                    factor_group="factor_group_example",
                                    factors=[
                                        "factors_example",
                                    ],
                                    distribution_type=VARDistributionType(0),
                                    report_date=1,
                                    report_currency="report_currency_example",
                                    horizon_in_trading_days=3.14,
                                    return_dates=[
                                        1,
                                    ],
                                ),
                                security_simulations=[
                                    VARSimulatedReturns(
                                        entity="entity_example",
                                        returns=[
                                            3.14,
                                        ],
                                    ),
                                ],
                                status=VARDistributionStatus(
                                    indicator=VARStatusIndicator(0),
                                    message="message_example",
                                ),
                            ),
                            request_info=OptimizerInputsSimulatedRiskRequestInfo(
                                url="url_example",
                                lima_header="lima_header_example",
                            ),
                        ),
                        quant_risk_model=OptimizerInputsQuantRiskModel(
                            raw_data=OptimizerInputsQuantRiskModelRawData(
                                labels=OptimizerInputsLabels(
                                    factor=OptimizerInputsFactor(
                                        ids=[
                                            "ids_example",
                                        ],
                                        names=[
                                            "names_example",
                                        ],
                                    ),
                                    security=OptimizerInputsSecurity(
                                        ids=[
                                            "ids_example",
                                        ],
                                    ),
                                ),
                                raw_asset_covariance_matrix=OptimizerInputsSparseMatrix(
                                    rows=1,
                                    columns=1,
                                    index_pointer=[
                                        1,
                                    ],
                                    indices=[
                                        1,
                                    ],
                                    value=[
                                        3.14,
                                    ],
                                ),
                                raw_factor_exposure=OptimizerInputsSparseMatrix(
                                    rows=1,
                                    columns=1,
                                    index_pointer=[
                                        1,
                                    ],
                                    indices=[
                                        1,
                                    ],
                                    value=[
                                        3.14,
                                    ],
                                ),
                                raw_factor_covariance_matrix=OptimizerInputsDenseMatrix(
                                    value=[
                                        GoogleProtobufListValue(
                                            values=[
                                                OptimizerInputsValue(
                                                    value_type=OptimizerInputsEValueTypeEnum(0),
                                                    raw_value=3.14,
                                                    ref_index=1,
                                                ),
                                            ],
                                        ),
                                    ],
                                ),
                                risk_model_coverage_flag=[
                                    1,
                                ],
                            ),
                            request_info=OptimizerInputsQuantRiskRequestInfo(
                                service_url="service_url_example",
                                json_post_body="json_post_body_example",
                                lima_header="lima_header_example",
                                pickup_base_url="pickup_base_url_example",
                            ),
                        ),
                        raw_model=OptimizerInputsRawRiskModel(
                            simulations=[
                                OptimizerInputsRawRiskModelSimulations(
                                    id="id_example",
                                    simulated_returns=[
                                        3.14,
                                    ],
                                ),
                            ],
                        ),
                    ),
                    periods=OptimizerInputsOnPeriods(
                        periods=[
                            1,
                        ],
                    ),
                ),
            ],
        ),
        lookup_tables=OptimizerInputsLookupTables(
            groups=[
                OptimizerInputsGroupDefinition(
                    univ_indices=[
                        1,
                    ],
                ),
            ],
            values=[
                OptimizerInputsValueReference(
                    asset_values=3.14,
                ),
            ],
        ),
        output_statistics=True,
    ) # OptimizerInputsMultiPeriodInput | Multiperiod protobuf input (optional)

    try:
        # example passing only required values which don't have defaults set
        # and optional values
        api_response = api_instance.mpo_v1_optimize_fpo_post(multi_period_input=multi_period_input)

        pprint(api_response)
    except fds.sdk.OptimizationEngineAPIMultiperiod.ApiException as e:
        print("Exception when calling DefaultApi->mpo_v1_optimize_fpo_post: %s\n" % e)

    # # Get response, http status code and response headers
    # try:
    #     api_response, http_status_code, response_headers = api_instance.mpo_v1_optimize_fpo_post_with_http_info(multi_period_input=multi_period_input)


    #     pprint(api_response)
    #     pprint(http_status_code)
    #     pprint(response_headers)
    # except fds.sdk.OptimizationEngineAPIMultiperiod.ApiException as e:
    #     print("Exception when calling DefaultApi->mpo_v1_optimize_fpo_post: %s\n" % e)

    # # Get response asynchronous
    # try:
    #     async_result = api_instance.mpo_v1_optimize_fpo_post_async(multi_period_input=multi_period_input)
    #     api_response = async_result.get()


    #     pprint(api_response)
    # except fds.sdk.OptimizationEngineAPIMultiperiod.ApiException as e:
    #     print("Exception when calling DefaultApi->mpo_v1_optimize_fpo_post: %s\n" % e)

    # # Get response, http status code and response headers asynchronous
    # try:
    #     async_result = api_instance.mpo_v1_optimize_fpo_post_with_http_info_async(multi_period_input=multi_period_input)
    #     api_response, http_status_code, response_headers = async_result.get()


    #     pprint(api_response)
    #     pprint(http_status_code)
    #     pprint(response_headers)
    # except fds.sdk.OptimizationEngineAPIMultiperiod.ApiException as e:
    #     print("Exception when calling DefaultApi->mpo_v1_optimize_fpo_post: %s\n" % e)

Using Pandas

To convert an API response to a Pandas DataFrame, it is necessary to transform it first to a dictionary.

import pandas as pd

response_dict = api_response.to_dict()['data']

simple_json_response = pd.DataFrame(response_dict)
nested_json_response = pd.json_normalize(response_dict)

Debugging

The SDK uses the standard library logging module.

Setting debug to True on an instance of the Configuration class sets the log-level of related packages to DEBUG and enables additional logging in Pythons HTTP Client.

Note: This prints out sensitive information (e.g. the full request and response). Use with care.

import logging
import fds.sdk.OptimizationEngineAPIMultiperiod

logging.basicConfig(level=logging.DEBUG)

configuration = fds.sdk.OptimizationEngineAPIMultiperiod.Configuration(...)
configuration.debug = True

Configure a Proxy

You can pass proxy settings to the Configuration class:

  • proxy: The URL of the proxy to use.
  • proxy_headers: a dictionary to pass additional headers to the proxy (e.g. Proxy-Authorization).
import fds.sdk.OptimizationEngineAPIMultiperiod

configuration = fds.sdk.OptimizationEngineAPIMultiperiod.Configuration(
    # ...
    proxy="http://secret:password@localhost:5050",
    proxy_headers={
        "Custom-Proxy-Header": "Custom-Proxy-Header-Value"
    }
)

Custom SSL Certificate

TLS/SSL certificate verification can be configured with the following Configuration parameters:

  • ssl_ca_cert: a path to the certificate to use for verification in PEM format.
  • verify_ssl: setting this to False disables the verification of certificates. Disabling the verification is not recommended, but it might be useful during local development or testing.
import fds.sdk.OptimizationEngineAPIMultiperiod

configuration = fds.sdk.OptimizationEngineAPIMultiperiod.Configuration(
    # ...
    ssl_ca_cert='/path/to/ca.pem'
)

Documentation for API Endpoints

All URIs are relative to http://localhost

Class Method HTTP request Description
DefaultApi mpo_v1_optimize_fpo_post POST /mpo/v1/optimizeFPO

Documentation For Models

Documentation For Authorization

FactSetApiKey

  • Type: HTTP basic authentication

FactSetOAuth2

  • Type: OAuth
  • Flow: application
  • Authorization URL:
  • Scopes: N/A

Notes for Large OpenAPI documents

If the OpenAPI document is large, imports in fds.sdk.OptimizationEngineAPIMultiperiod.apis and fds.sdk.OptimizationEngineAPIMultiperiod.models may fail with a RecursionError indicating the maximum recursion limit has been exceeded. In that case, there are a couple of solutions:

Solution 1: Use specific imports for apis and models like:

  • from fds.sdk.OptimizationEngineAPIMultiperiod.api.default_api import DefaultApi
  • from fds.sdk.OptimizationEngineAPIMultiperiod.model.pet import Pet

Solution 2: Before importing the package, adjust the maximum recursion limit as shown below:

import sys
sys.setrecursionlimit(1500)
import fds.sdk.OptimizationEngineAPIMultiperiod
from fds.sdk.OptimizationEngineAPIMultiperiod.apis import *
from fds.sdk.OptimizationEngineAPIMultiperiod.models import *

Contributing

Please refer to the contributing guide.

Copyright

Copyright 2022 FactSet Research Systems Inc

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page