# generated by datamodel-codegen:
#   filename:  openapi.yaml
#   timestamp: 2023-05-12T11:09:34+00:00

from __future__ import annotations

from datetime import date, datetime
from enum import Enum
from typing import Any, Dict, List, Optional, Union

from pydantic import BaseModel, Extra, Field, StrictBool, StrictStr, conint, constr
from typing_extensions import Literal


class PostType(Enum):
    EOD = "EOD"
    RT = "RT"
    EOD_AND_RT = "EOD_AND_RT"


class BloombergProviderKwargs(BaseModel):
    class Config:
        extra = Extra.forbid

    post_type: PostType = Field(
        ...,
        description="How to post the data to Bloomberg, either the end of day method (EOD), real time method (RT) or both (EOD_AND_RT)",
    )


class BloombergProviderKwargsPostType(Enum):
    EOD = "EOD"
    RT = "RT"
    EOD_AND_RT = "EOD_AND_RT"


class CashPosition(BaseModel):
    class Config:
        extra = Extra.forbid

    amount: float = Field(..., title="Amount")
    asset_type: Literal["CASH"] = Field(..., title="Asset Type")
    identifier: constr(min_length=3, max_length=3, strict=True) = Field(..., title="Identifier")
    identifier_type: Literal["CURRENCY_CODE"] = Field(..., title="Identifier Type")
    position_id: Optional[StrictStr] = Field(None, title="Position Id")


class ChartType(Enum):
    line = "line"
    spline = "spline"
    area = "area"
    bar = "bar"
    column = "column"


class CompareMode(Enum):
    absolute = "absolute"
    percent = "percent"


class ConstructorType(Enum):
    chart = "chart"
    stockChart = "stockChart"


class Value(BaseModel):
    class Config:
        extra = Extra.forbid

    display_name: StrictStr
    path: StrictStr


class Datum(BaseModel):
    class Config:
        extra = Extra.forbid

    array_field: StrictStr
    key_field: StrictStr
    url: StrictStr
    values: List[Value]


class CustomCharts(BaseModel):
    class Config:
        extra = Extra.forbid

    chart_type: Optional[ChartType] = "line"
    compare_mode: Optional[CompareMode] = "percent"
    constructor_type: Optional[ConstructorType] = "stockChart"
    data: Optional[List[Datum]] = None
    name: StrictStr
    size: Optional[float] = 12
    xlabel: StrictStr
    ylabel: StrictStr


class Compression(Enum):
    NONE = "NONE"
    GZIP = "GZIP"


class LayoutType(Enum):
    SINGLE_FILE = "SINGLE_FILE"
    YEARLY_DIR_DAILY_FILE = "YEARLY_DIR_DAILY_FILE"


class DataCollectionsSpec(BaseModel):
    class Config:
        extra = Extra.allow

    auto_persist: Optional[StrictBool] = Field(
        False, description="Boolean to indicate whether to automatically persist the data. Default is False."
    )
    compression: Optional[Compression] = "GZIP"
    date_col: Optional[StrictStr] = "date"
    format: Optional[Literal["csv"]] = "csv"
    index_dc_subtype: StrictStr = Field(
        ..., description="Index Data Collection Subtype object key moves to array after transformation"
    )
    layout_type: Optional[LayoutType] = Field(
        "SINGLE_FILE",
        description="SINGLE_FILE: one file. YEARLY_DIR_DAILY_FILE: one directory per year, each day, a file with YYYYMMDD format.",
    )
    location: StrictStr
    name: constr(regex=r"^[A-Za-z0-9_]*$", min_length=3, max_length=128, strict=True)
    seed_file_path: Optional[StrictStr] = Field(None, description="Seed file for the data collection.")
    start_time: Optional[StrictStr] = None


class RealTimeTradeType(Enum):
    ELIGIBLE = "ELIGIBLE"
    INELIGIBLE = "INELIGIBLE"


class Position(BaseModel):
    class Config:
        extra = Extra.forbid

    amount: float = Field(..., title="Amount")
    asset_type: Literal["EQUITY"] = Field(..., title="Asset Type")
    identifier: StrictStr = Field(..., title="Identifier")
    identifier_type: Literal["RIC"] = Field(..., title="Identifier Type")
    position_id: Optional[StrictStr] = Field(None, title="Position Id")
    real_time_trade_types: Optional[List[RealTimeTradeType]] = None
    use_primary_listing: Optional[StrictBool] = Field(
        False,
        description="use the security's primary listing rather than the one from the identifier",
        title="Use Primary Listing",
    )


class Position1(BaseModel):
    class Config:
        extra = Extra.forbid

    amount: float = Field(..., title="Amount")
    asset_type: Literal["CASH"] = Field(..., title="Asset Type")
    identifier: constr(min_length=3, max_length=3, strict=True) = Field(..., title="Identifier")
    identifier_type: Literal["CURRENCY_CODE"] = Field(..., title="Identifier Type")
    position_id: Optional[StrictStr] = Field(None, title="Position Id")


class UnitOfMeasure(BaseModel):
    pass


class EquityBasketPortfolio(BaseModel):
    class Config:
        extra = Extra.forbid

    positions: List[Union[Position, Position1]] = Field(..., title="Positions")
    timestamp: Union[
        datetime,
        date,
        constr(regex=r"^[0-9]{4}-[0-9]{2}-[0-9]{2}(?:[ T][0-9]{2}:[0-9]{2}:[0-9]{2})?(?:[.][0-9]{1,6})?$", strict=True),
    ] = Field(..., description="the time at which the portfolio should take effect", title="Timestamp")
    unit_of_measure: UnitOfMeasure = Field(
        ...,
        description="indicates if the quantities in positions are absolute values, e.g. shares of equity positions, or relative weights of the total portfolio.",
    )


class ErrorCodes(BaseModel):
    code: Optional[StrictStr] = None
    message: Optional[StrictStr] = None


class FindStrikeResponse(BaseModel):
    request_id: Optional[StrictStr] = Field(None, description="Request ID sent in the request")
    spot: Optional[float] = Field(None, description="Underlying spot price.")
    strike: Optional[float] = Field(None, description="Strike that prices to the given budget.")
    strike_percentage: Optional[float] = Field(
        None, description="Strike as a percentage of the underlying spot price that prices to the given budget."
    )


class ProviderKwarg(BaseModel):
    class Config:
        extra = Extra.forbid

    post_type: PostType = Field(
        ...,
        description="How to post the data to Bloomberg, either the end of day method (EOD), real time method (RT) or both (EOD_AND_RT)",
    )


class ProviderKwarg1(BaseModel):
    class Config:
        extra = Extra.forbid

    post_type: Optional[PostType] = Field(
        None,
        description="How to post the data to Reuters, either the end of day method (EOD), real time method (RT) or both (EOD_AND_RT)",
    )


class ProviderKwarg2(BaseModel):
    class Config:
        extra = Extra.forbid

    metric: StrictStr
    security_name: StrictStr
    security_type: StrictStr


class NasdaqEnv(Enum):
    testing = "testing"
    production = "production"


class ProviderKwarg3(BaseModel):
    class Config:
        extra = Extra.forbid

    eod_date_delta: Optional[int] = Field(
        None,
        description="How many days to offset the Nasdaq date (T if before 6:30pm EST otherwise T + 1) when getting EOD data from the Index",
    )
    nasdaq_env: NasdaqEnv = Field(..., description="Which Nasdaq environment to send data to")


class Status(BaseModel):
    created_at: Optional[StrictStr] = None
    created_by: Optional[StrictStr] = None
    last_modified: StrictStr
    last_modified_by: Optional[StrictStr] = None
    locked_after: Optional[datetime] = Field(
        None,
        description="If this is set (non null), the manifest is locked for all edits to any other field after this timestamp. A PUT/PATCH may be used to first unlock the manifest, by setting this field (to a max of one hour in the future), or to `null` again, to make other edits.",
    )


class IdentifierUUIDPatchPutGet(BaseModel):
    class Config:
        extra = Extra.forbid

    display_name: Optional[StrictStr] = None
    index_name: StrictStr
    metric: Optional[StrictStr] = None
    name: StrictStr = Field(..., description="unique name among all other Identifiers of the provider resource type.")
    namespace: Optional[StrictStr] = None
    provider_kwargs: Optional[Union[ProviderKwarg, ProviderKwarg1, ProviderKwarg2, ProviderKwarg3]] = None
    rounding_decimals: Optional[int] = None
    start_date: Optional[date] = None
    ticker: StrictStr
    id: StrictStr
    status: Status


class ProviderKwarg4(BaseModel):
    class Config:
        extra = Extra.forbid

    post_type: PostType = Field(
        ...,
        description="How to post the data to Bloomberg, either the end of day method (EOD), real time method (RT) or both (EOD_AND_RT)",
    )


class ProviderKwarg5(BaseModel):
    class Config:
        extra = Extra.forbid

    post_type: Optional[PostType] = Field(
        None,
        description="How to post the data to Reuters, either the end of day method (EOD), real time method (RT) or both (EOD_AND_RT)",
    )


class ProviderKwarg6(BaseModel):
    class Config:
        extra = Extra.forbid

    metric: StrictStr
    security_name: StrictStr
    security_type: StrictStr


class ProviderKwarg7(BaseModel):
    class Config:
        extra = Extra.forbid

    eod_date_delta: Optional[int] = Field(
        None,
        description="How many days to offset the Nasdaq date (T if before 6:30pm EST otherwise T + 1) when getting EOD data from the Index",
    )
    nasdaq_env: NasdaqEnv = Field(..., description="Which Nasdaq environment to send data to")


class IdentifierUUIDPost(BaseModel):
    class Config:
        extra = Extra.forbid

    display_name: Optional[StrictStr] = None
    index_name: StrictStr
    metric: Optional[StrictStr] = None
    name: StrictStr = Field(..., description="unique name among all other Identifiers of the provider resource type.")
    namespace: Optional[StrictStr] = None
    provider_kwargs: Optional[Union[ProviderKwarg4, ProviderKwarg5, ProviderKwarg6, ProviderKwarg7]] = None
    rounding_decimals: Optional[int] = None
    start_date: Optional[date] = None
    ticker: StrictStr


class Provider(Enum):
    bloomberg = "bloomberg"
    reuters = "reuters"
    morningstar = "morningstar"
    factset = "factset"
    nasdaq = "nasdaq"
    wind = "wind"
    secapi = "secapi"


class IdentifierUUIDRef(BaseModel):
    class Config:
        extra = Extra.forbid

    name: StrictStr
    provider: Provider = Field(..., description="currently supported providers", example="bloomberg")


class IndexBenchmark(BaseModel):
    class Config:
        extra = Extra.forbid

    index_metric: Optional[StrictStr] = Field(
        "price_return",
        description="the metric to compare against the ticker/threshold, eg can compare some other metric than price_return",
    )
    threshold: float
    ticker: StrictStr


class IndexClassDefinitionPatchPutGet(BaseModel):
    class Config:
        extra = Extra.forbid

    index_class_args_spec: Dict[str, Any]
    name: StrictStr
    namespace: Optional[StrictStr] = None
    id: StrictStr
    status: Status


class IndexClassDefinitionPost(BaseModel):
    class Config:
        extra = Extra.forbid

    index_class_args_spec: Dict[str, Any]
    name: StrictStr
    namespace: Optional[StrictStr] = None


class Role(Enum):
    data_point = "data point"
    verification = "verification"
    calculation = "calculation"
    development = "development"
    administration = "administration"


class Administrative(BaseModel):
    class Config:
        extra = Extra.forbid

    role: Role


class BenchmarkItem(BaseModel):
    class Config:
        extra = Extra.forbid

    index_metric: Optional[StrictStr] = Field(
        "price_return",
        description="the metric to compare against the ticker/threshold, eg can compare some other metric than price_return",
    )
    threshold: float
    ticker: StrictStr


class CalcFreq(Enum):
    Daily = "Daily"
    Daily__EOD = "Daily, EOD"
    Intraday = "Intraday"


class DataType(Enum):
    string = "string"
    float64 = "float64"
    datetime64 = "datetime64"
    int64 = "int64"
    bool = "bool"
    object = "object"


class CustomMetric(BaseModel):
    data_type: DataType
    description: StrictStr = Field(..., description="a description of what this metric represents")
    name: StrictStr = Field(..., description="metric name")
    object_schema: Optional[Dict[str, Any]] = Field(
        None,
        description="optional - this supports complex objects, ie you can specify the  metric is of this schema. THis allows you to upload a json schema itself of this metric. THis is for downstream users of this metric.",
    )


class DisplayMonth(Enum):
    Jan = "Jan"
    Feb = "Feb"
    Mar = "Mar"
    Apr = "Apr"
    May = "May"
    Jun = "Jun"
    Jul = "Jul"
    Aug = "Aug"
    Sep = "Sep"
    Oct = "Oct"
    Nov = "Nov"
    Dec = "Dec"


class Identifier(BaseModel):
    class Config:
        extra = Extra.forbid

    name: StrictStr
    provider: Provider = Field(..., description="currently supported providers", example="bloomberg")


class ActiveTimeRange(BaseModel):
    class Config:
        extra = Extra.forbid

    days_of_week: Optional[List[int]] = Field(
        None,
        description="Which days of the week to run the index. Each day of the week is denoted by an integer with Monday = 0 and Sunday = 6",
    )
    end_date: Optional[
        Union[
            datetime,
            date,
            constr(
                regex=r"^[0-9]{4}-[0-9]{2}-[0-9]{2}(?:[ T][0-9]{2}:[0-9]{2}:[0-9]{2})?(?:[.][0-9]{1, 6})?$", strict=True
            ),
        ]
    ] = Field(None, example=["2021-01-01", "2021-01-01T01:01:01", "2021-01-01T01:01:01.zzzzz"])
    end_time: Optional[StrictStr] = Field(
        None,
        description="Inclusive end time of the day to stop running this intraday index. Format is %H:%M:%S.%f. This should be in the timezone of the index based on tzinfo.",
        example="20:39:00.262345",
    )
    exclude_holidays: Optional[StrictBool] = Field(
        None,
        description="If this is True use the index holiday calendar to decide which days to run the index. It will only run on non-holidays.",
    )
    start_date: Optional[
        Union[
            datetime,
            date,
            constr(
                regex=r"^[0-9]{4}-[0-9]{2}-[0-9]{2}(?:[ T][0-9]{2}:[0-9]{2}:[0-9]{2})?(?:[.][0-9]{1, 6})?$", strict=True
            ),
        ]
    ] = Field(None, example=["2021-01-01", "2021-01-01T01:01:01", "2021-01-01T01:01:01.zzzzz"])
    start_time: Optional[StrictStr] = Field(
        None,
        description="Inclusive start time of the day to start running this intraday index. Format is %H:%M:%S.%f. This should be in the timezone of the index based on tzinfo.",
        example="20:39:00.262345",
    )


class DefaultActiveTimeRange(BaseModel):
    class Config:
        extra = Extra.forbid

    days_of_week: Optional[List[int]] = Field(
        None,
        description="Which days of the week to run the index. Each day of the week is denoted by an integer with Monday = 0 and Sunday = 6",
    )
    end_date: Optional[
        Union[
            datetime,
            date,
            constr(
                regex=r"^[0-9]{4}-[0-9]{2}-[0-9]{2}(?:[ T][0-9]{2}:[0-9]{2}:[0-9]{2})?(?:[.][0-9]{1, 6})?$", strict=True
            ),
        ]
    ] = Field(None, example=["2021-01-01", "2021-01-01T01:01:01", "2021-01-01T01:01:01.zzzzz"])
    end_time: Optional[StrictStr] = Field(
        None,
        description="Inclusive end time of the day to stop running this intraday index. Format is %H:%M:%S.%f. This should be in the timezone of the index based on tzinfo.",
        example="20:39:00.262345",
    )
    exclude_holidays: Optional[StrictBool] = Field(
        None,
        description="If this is True use the index holiday calendar to decide which days to run the index. It will only run on non-holidays.",
    )
    start_date: Optional[
        Union[
            datetime,
            date,
            constr(
                regex=r"^[0-9]{4}-[0-9]{2}-[0-9]{2}(?:[ T][0-9]{2}:[0-9]{2}:[0-9]{2})?(?:[.][0-9]{1, 6})?$", strict=True
            ),
        ]
    ] = Field(None, example=["2021-01-01", "2021-01-01T01:01:01", "2021-01-01T01:01:01.zzzzz"])
    start_time: Optional[StrictStr] = Field(
        None,
        description="Inclusive start time of the day to start running this intraday index. Format is %H:%M:%S.%f. This should be in the timezone of the index based on tzinfo.",
        example="20:39:00.262345",
    )


class Target(BaseModel):
    active_time_ranges: Optional[List[ActiveTimeRange]] = Field(
        None,
        description="Time ranges during which values should be published to this target. Target level active_time_ranges override publish_config metric level active_time_ranges.",
    )
    target: Literal["db"]


class Target1(BaseModel):
    active_time_ranges: Optional[List[ActiveTimeRange]] = Field(
        None,
        description="Time ranges during which values should be published to this target. Target level active_time_ranges override publish_config metric level active_time_ranges.",
    )
    target: Literal["secapi"]


class Params(BaseModel):
    class Config:
        extra = Extra.forbid

    rounding_decimals: Optional[int] = None
    ticker: Optional[StrictStr] = None


class Target2(BaseModel):
    active_time_ranges: Optional[List[ActiveTimeRange]] = Field(
        None,
        description="Time ranges during which values should be published to this target. Target level active_time_ranges override publish_config metric level active_time_ranges.",
    )
    params: Optional[Params] = None
    target: Literal["bloomberg"]


class Params1(BaseModel):
    class Config:
        extra = Extra.forbid

    post_type: Optional[PostType] = Field(
        None,
        description="How to post the data to Reuters, either the end of day method (EOD), real time method (RT) or both (EOD_AND_RT)",
    )
    rounding_decimals: Optional[int] = None
    ticker: Optional[StrictStr] = None


class Target3(BaseModel):
    active_time_ranges: Optional[List[ActiveTimeRange]] = Field(
        None,
        description="Time ranges during which values should be published to this target. Target level active_time_ranges override publish_config metric level active_time_ranges.",
    )
    params: Optional[Params1] = None
    target: Literal["reuters"]


class PublishConfigItem(BaseModel):
    class Config:
        extra = Extra.forbid

    default_active_time_ranges: Optional[List[DefaultActiveTimeRange]] = Field(
        None,
        description="Time ranges during which values should be published for this metric. This will be overriden if a target level active_time_ranges is set.",
    )
    targets: List[Union[Target, Target1, Target2, Target3]] = Field(
        ..., description="List of targets to send this index metric too"
    )


class PublishConfigItem1(BaseModel):
    active_time_ranges: Optional[List[ActiveTimeRange]] = Field(
        None,
        description="Time ranges during which values should be published to this target. Target level active_time_ranges override publish_config metric level active_time_ranges.",
    )
    target: Literal["db"]


class PublishConfigItem2(BaseModel):
    active_time_ranges: Optional[List[ActiveTimeRange]] = Field(
        None,
        description="Time ranges during which values should be published to this target. Target level active_time_ranges override publish_config metric level active_time_ranges.",
    )
    target: Literal["secapi"]


class Params2(BaseModel):
    class Config:
        extra = Extra.forbid

    rounding_decimals: Optional[int] = None
    ticker: Optional[StrictStr] = None


class PublishConfigItem3(BaseModel):
    active_time_ranges: Optional[List[ActiveTimeRange]] = Field(
        None,
        description="Time ranges during which values should be published to this target. Target level active_time_ranges override publish_config metric level active_time_ranges.",
    )
    params: Optional[Params2] = None
    target: Literal["bloomberg"]


class Params3(BaseModel):
    class Config:
        extra = Extra.forbid

    post_type: Optional[PostType] = Field(
        None,
        description="How to post the data to Reuters, either the end of day method (EOD), real time method (RT) or both (EOD_AND_RT)",
    )
    rounding_decimals: Optional[int] = None
    ticker: Optional[StrictStr] = None


class PublishConfigItem4(BaseModel):
    active_time_ranges: Optional[List[ActiveTimeRange]] = Field(
        None,
        description="Time ranges during which values should be published to this target. Target level active_time_ranges override publish_config metric level active_time_ranges.",
    )
    params: Optional[Params3] = None
    target: Literal["reuters"]


class Intraday(BaseModel):
    class Config:
        extra = Extra.forbid

    active_time_ranges: Optional[List[ActiveTimeRange]] = None
    calculation_max_retry_delay: Optional[conint(ge=0)] = Field(
        None,
        description="How many seconds to keep retrying the real time calculation before setting the force flag. Defalts to 0 which means retry forever.",
    )
    data_refresh_period: Optional[conint(ge=0)] = Field(
        None,
        description="After the rtindex refreshes its data this is the number of seconds to wait before refreshing again. 0 means do not refresh. Defaults to 3600 seconds (60min)",
    )
    enabled: StrictBool = Field(..., description="If the intraday process should be run or not")
    heartbeat_timeout: Optional[conint(ge=1)] = Field(
        None, description="Max number of seconds between heartbeats before the rtindex pod is considered unhealthy"
    )
    publish_config: Optional[
        Dict[
            str,
            Union[
                PublishConfigItem,
                List[Union[PublishConfigItem1, PublishConfigItem2, PublishConfigItem3, PublishConfigItem4]],
            ],
        ]
    ] = Field(None, description="Mapping of index metric to targets it should be sent to")
    resource_cpu_request: Optional[conint(ge=1)] = Field(
        None, description="Minimum cpu resources requested in milliCPU"
    )
    resource_memory_request: Optional[conint(ge=0)] = Field(
        None, description="Minimum memory resources requested in mebibytes."
    )
    security_id: Optional[StrictStr] = Field(
        None, description="Security ID of the intraday_index security where ticker data is served"
    )
    startup_failure_timeout: Optional[conint(ge=1)] = Field(
        None,
        description="Max number of seconds to wait for the first heartbeat from the rtindex pod before considering it a failed startup. By default it will wait 40sec",
    )
    ticker_period: Optional[float] = Field(None, description="Duration between ticker datapoints. In seconds")
    tzinfo: Optional[StrictStr] = Field(None, description="Timezone of intraday tick timestamp comparisons")


class FieldModel(BaseModel):
    display_name: Optional[StrictStr] = None
    field_name: Optional[StrictStr] = None


class PortfolioDisplay(BaseModel):
    fields: Optional[List[FieldModel]] = None


class RebalFreq(Enum):
    Annual = "Annual"
    Daily = "Daily"
    Monthly = "Monthly"
    Quarterly = "Quarterly"
    Semi_Annual = "Semi-Annual"
    Weekly = "Weekly"
    Bi_Monthly = "Bi-Monthly"
    Intraday = "Intraday"
    None_ = "None"


class Type(Enum):
    security = "security"
    index = "index"


class RelatedItem(BaseModel):
    default_display: Optional[StrictBool] = False
    id: StrictStr
    metric: Optional[StrictStr] = None
    name: StrictStr
    type: Type


class S3Location(BaseModel):
    class Config:
        extra = Extra.forbid

    bucket: StrictStr
    path: Optional[StrictStr] = None


class Subpod(BaseModel):
    class Config:
        extra = Extra.forbid

    arguments: Optional[List[List[StrictStr]]] = None
    command: StrictStr
    pod_type: StrictStr
    uuid: StrictStr


class AirflowConfig(BaseModel):
    class Config:
        extra = Extra.forbid

    dag: Optional[Dict[str, Any]] = Field(None, description="use this to set kwargs for the dag")
    description: Optional[StrictStr] = Field(None, description="A short description related with the generated runner")
    env: Optional[Dict[str, Any]] = Field(None, description="use this to set ENV variables in the pod")
    pod: Optional[Dict[str, Any]] = Field(None, description="use this to set kwargs for the pod")
    s3_location: Optional[S3Location] = None
    subpods: Optional[List[Subpod]] = None


class Condition(Enum):
    any = "any"
    all = "all"
    custom = "custom"


class WeekmaskEnum(Enum):
    Mon = "Mon"
    Tue = "Tue"
    Wed = "Wed"
    Thu = "Thu"
    Fri = "Fri"
    Sat = "Sat"
    Sun = "Sun"


class HolidayCalendar(BaseModel):
    class Config:
        extra = Extra.forbid

    calendar_identifiers: Optional[List[constr(regex=r"^(FUT|MIC|FX):.+$", strict=True)]] = None
    condition: Optional[Condition] = None
    holidays_to_add: Optional[List[date]] = None
    holidays_to_remove: Optional[List[date]] = None
    swaps_monitor_codes: Optional[List[constr(regex=r"^[a-zA-Z]{3}$", strict=True)]] = None
    weekmask: Optional[List[WeekmaskEnum]] = Field(
        ["Mon", "Tue", "Wed", "Thu", "Fri"], description="weekmask of valid business days"
    )


class EmailDissapiConfig(BaseModel):
    bcc_list: Optional[List[StrictStr]] = None
    cc_list: Optional[List[StrictStr]] = None
    content: Optional[StrictStr] = None
    email_list: Optional[List[StrictStr]] = None
    file_keys: Optional[List[StrictStr]] = None
    recipient_list: List[StrictStr] = Field(..., min_items=1)
    subject: StrictStr


class S3DissapiConfig(BaseModel):
    bucket: StrictStr
    file_keys: List[StrictStr]
    key_prefix: StrictStr


class SftpDissapiConfig(BaseModel):
    file_keys: List[StrictStr]
    sftp_ids: List[StrictStr]


class DisseminationDestinations(BaseModel):
    email_dissapi_configs: Optional[List[EmailDissapiConfig]] = Field(None, min_items=1)
    s3_dissapi_configs: Optional[List[S3DissapiConfig]] = None
    sftp_dissapi_configs: Optional[List[SftpDissapiConfig]] = None


class IndexReport(BaseModel):
    dissemination_destinations: Optional[DisseminationDestinations] = None
    program_args: Optional[Dict[str, Any]] = None
    uuid: StrictStr


class HolidayCalendar1(BaseModel):
    cal_type: Optional[StrictStr] = Field(None, example="MIC")
    mic: Optional[StrictStr] = Field(None, example="XNYS")


class Schedule(BaseModel):
    class Config:
        extra = Extra.forbid

    business_days_prior: Optional[int] = Field(None, example=1)
    holiday_calendar: Optional[HolidayCalendar1] = None
    retries: int
    retry_interval_min: int
    schedule_cron: Optional[StrictStr] = None
    schedule_start: StrictStr
    timeout_delta: Optional[StrictStr] = Field(None, example="minutes=17")


class RunConfiguration(BaseModel):
    class Config:
        extra = Extra.allow

    airflow_config: Optional[AirflowConfig] = None
    command: Optional[StrictStr] = None
    command_arguments: Optional[List[List[StrictStr]]] = None
    holiday_calendar: Optional[HolidayCalendar] = None
    index_report_uuids: Optional[List[StrictStr]] = None
    index_reports: Optional[Union[List[StrictStr], List[IndexReport]]] = None
    job_enabled: StrictBool
    pod_image_and_tag: Optional[StrictStr] = Field(None, description="overrides the image")
    schedule: Schedule
    tzinfo: Optional[StrictStr] = None


class AirflowConfig1(BaseModel):
    class Config:
        extra = Extra.forbid

    dag: Optional[Dict[str, Any]] = Field(None, description="use this to set kwargs for the dag")
    description: Optional[StrictStr] = Field(None, description="A short description related with the generated runner")
    env: Optional[Dict[str, Any]] = Field(None, description="use this to set ENV variables in the pod")
    pod: Optional[Dict[str, Any]] = Field(None, description="use this to set kwargs for the pod")
    s3_location: Optional[S3Location] = None
    subpods: Optional[List[Subpod]] = None


class HolidayCalendar2(BaseModel):
    class Config:
        extra = Extra.forbid

    calendar_identifiers: Optional[List[constr(regex=r"^(FUT|MIC|FX):.+$", strict=True)]] = None
    condition: Optional[Condition] = None
    holidays_to_add: Optional[List[date]] = None
    holidays_to_remove: Optional[List[date]] = None
    swaps_monitor_codes: Optional[List[constr(regex=r"^[a-zA-Z]{3}$", strict=True)]] = None
    weekmask: Optional[List[WeekmaskEnum]] = Field(
        ["Mon", "Tue", "Wed", "Thu", "Fri"], description="weekmask of valid business days"
    )


class DisseminationDestinations1(BaseModel):
    email_dissapi_configs: Optional[List[EmailDissapiConfig]] = Field(None, min_items=1)
    s3_dissapi_configs: Optional[List[S3DissapiConfig]] = None
    sftp_dissapi_configs: Optional[List[SftpDissapiConfig]] = None


class IndexReport1(BaseModel):
    dissemination_destinations: Optional[DisseminationDestinations1] = None
    program_args: Optional[Dict[str, Any]] = None
    uuid: StrictStr


class HolidayCalendar3(BaseModel):
    cal_type: Optional[StrictStr] = Field(None, example="MIC")
    mic: Optional[StrictStr] = Field(None, example="XNYS")


class Schedule1(BaseModel):
    class Config:
        extra = Extra.forbid

    business_days_prior: Optional[int] = Field(None, example=1)
    holiday_calendar: Optional[HolidayCalendar3] = None
    retries: int
    retry_interval_min: int
    schedule_cron: Optional[StrictStr] = None
    schedule_start: StrictStr
    timeout_delta: Optional[StrictStr] = Field(None, example="minutes=17")


class RunConfiguration1(BaseModel):
    class Config:
        extra = Extra.allow

    airflow_config: Optional[AirflowConfig1] = None
    command: Optional[StrictStr] = None
    command_arguments: Optional[List[List[StrictStr]]] = None
    holiday_calendar: Optional[HolidayCalendar2] = None
    index_report_uuids: Optional[List[StrictStr]] = None
    index_reports: Optional[Union[List[StrictStr], List[IndexReport1]]] = None
    job_enabled: StrictBool
    pod_image_and_tag: Optional[StrictStr] = Field(None, description="overrides the image")
    schedule: Schedule1
    tzinfo: Optional[StrictStr] = None
    label: StrictStr = Field(..., description="unique label of this rc")


class Spec(BaseModel):
    index_class: Optional[StrictStr] = None
    index_class_args: Optional[Dict[str, Any]] = Field(
        None,
        description="should validate against index_class_args_spec field of the IndexClassDefinition identified by index_class",
    )
    index_variables: Optional[Dict[str, Any]] = Field(None, description="TODO")
    version: Optional[int] = None


class Stage(Enum):
    prod = "prod"
    test = "test"
    development = "development"


class Datum1(BaseModel):
    class Config:
        extra = Extra.forbid

    array_field: StrictStr
    key_field: StrictStr
    url: StrictStr
    values: List[Value]


class CustomChart(BaseModel):
    class Config:
        extra = Extra.forbid

    chart_type: Optional[ChartType] = "line"
    compare_mode: Optional[CompareMode] = "percent"
    constructor_type: Optional[ConstructorType] = "stockChart"
    data: Optional[List[Datum1]] = None
    name: StrictStr
    size: Optional[float] = 12
    xlabel: StrictStr
    ylabel: StrictStr


class Webpage(BaseModel):
    custom_charts: Optional[List[CustomChart]] = None
    visible: Optional[StrictBool] = True


class WeightingMethod(Enum):
    Other = "Other"
    Equal = "Equal"


class IndexDefinitionPatchPutGet(BaseModel):
    class Config:
        extra = Extra.forbid

    administrative: Administrative
    base_date: Optional[StrictStr] = None
    base_year: Optional[int] = None
    benchmark: Optional[Union[BenchmarkItem, List[BenchmarkItem]]] = None
    buffer_end: Optional[float] = None
    buffer_start: Optional[float] = None
    calc_freq: Optional[CalcFreq] = None
    currency: Optional[StrictStr] = None
    custom_metrics: Optional[List[CustomMetric]] = None
    description: StrictStr
    display_month: Optional[DisplayMonth] = None
    documents: Optional[Dict[str, Any]] = None
    excess_strategy: Optional[Literal["keep_in_cash"]] = None
    family: StrictStr
    family_description: Optional[StrictStr] = None
    identifiers: Optional[List[Identifier]] = Field(None, min_items=0)
    index_class_uuid: Optional[StrictStr] = None
    intraday: Optional[Intraday] = Field(
        None, description="Only available for indexes with intraday tick computation", title="Intraday Details"
    )
    launch_date: StrictStr
    methodology: Optional[StrictStr] = None
    month: Optional[int] = None
    name: constr(regex=r"^[a-zA-Z][a-zA-Z0-9-_]{0,99}$", strict=True)
    namespace: Optional[StrictStr] = None
    plot_metric: Optional[StrictStr] = None
    portfolio_allocation_display: Optional[StrictBool] = Field(
        None, description="whether or not portfolio_allocations are shown on the website. False by default"
    )
    portfolio_display: Optional[PortfolioDisplay] = None
    rebal_freq: Optional[RebalFreq] = None
    related: Optional[List[RelatedItem]] = None
    run_configuration: Optional[RunConfiguration] = None
    run_configurations: Optional[List[RunConfiguration1]] = None
    spec: Optional[Spec] = None
    stage: Stage
    tags: Optional[StrictStr] = None
    title: StrictStr
    webpage: Optional[Webpage] = None
    weighting_method: Optional[WeightingMethod] = None
    id: StrictStr
    status: Status


class Administrative1(BaseModel):
    class Config:
        extra = Extra.forbid

    role: Role


class CustomMetric1(BaseModel):
    data_type: DataType
    description: StrictStr = Field(..., description="a description of what this metric represents")
    name: StrictStr = Field(..., description="metric name")
    object_schema: Optional[Dict[str, Any]] = Field(
        None,
        description="optional - this supports complex objects, ie you can specify the  metric is of this schema. THis allows you to upload a json schema itself of this metric. THis is for downstream users of this metric.",
    )


class Identifier1(BaseModel):
    class Config:
        extra = Extra.forbid

    name: StrictStr
    provider: Provider = Field(..., description="currently supported providers", example="bloomberg")


class Target4(BaseModel):
    active_time_ranges: Optional[List[ActiveTimeRange]] = Field(
        None,
        description="Time ranges during which values should be published to this target. Target level active_time_ranges override publish_config metric level active_time_ranges.",
    )
    target: Literal["db"]


class Target5(BaseModel):
    active_time_ranges: Optional[List[ActiveTimeRange]] = Field(
        None,
        description="Time ranges during which values should be published to this target. Target level active_time_ranges override publish_config metric level active_time_ranges.",
    )
    target: Literal["secapi"]


class Params4(BaseModel):
    class Config:
        extra = Extra.forbid

    rounding_decimals: Optional[int] = None
    ticker: Optional[StrictStr] = None


class Target6(BaseModel):
    active_time_ranges: Optional[List[ActiveTimeRange]] = Field(
        None,
        description="Time ranges during which values should be published to this target. Target level active_time_ranges override publish_config metric level active_time_ranges.",
    )
    params: Optional[Params4] = None
    target: Literal["bloomberg"]


class Params5(BaseModel):
    class Config:
        extra = Extra.forbid

    post_type: Optional[PostType] = Field(
        None,
        description="How to post the data to Reuters, either the end of day method (EOD), real time method (RT) or both (EOD_AND_RT)",
    )
    rounding_decimals: Optional[int] = None
    ticker: Optional[StrictStr] = None


class Target7(BaseModel):
    active_time_ranges: Optional[List[ActiveTimeRange]] = Field(
        None,
        description="Time ranges during which values should be published to this target. Target level active_time_ranges override publish_config metric level active_time_ranges.",
    )
    params: Optional[Params5] = None
    target: Literal["reuters"]


class PublishConfigItem5(BaseModel):
    class Config:
        extra = Extra.forbid

    default_active_time_ranges: Optional[List[DefaultActiveTimeRange]] = Field(
        None,
        description="Time ranges during which values should be published for this metric. This will be overriden if a target level active_time_ranges is set.",
    )
    targets: List[Union[Target4, Target5, Target6, Target7]] = Field(
        ..., description="List of targets to send this index metric too"
    )


class PublishConfigItem6(BaseModel):
    active_time_ranges: Optional[List[ActiveTimeRange]] = Field(
        None,
        description="Time ranges during which values should be published to this target. Target level active_time_ranges override publish_config metric level active_time_ranges.",
    )
    target: Literal["db"]


class PublishConfigItem7(BaseModel):
    active_time_ranges: Optional[List[ActiveTimeRange]] = Field(
        None,
        description="Time ranges during which values should be published to this target. Target level active_time_ranges override publish_config metric level active_time_ranges.",
    )
    target: Literal["secapi"]


class Params6(BaseModel):
    class Config:
        extra = Extra.forbid

    rounding_decimals: Optional[int] = None
    ticker: Optional[StrictStr] = None


class PublishConfigItem8(BaseModel):
    active_time_ranges: Optional[List[ActiveTimeRange]] = Field(
        None,
        description="Time ranges during which values should be published to this target. Target level active_time_ranges override publish_config metric level active_time_ranges.",
    )
    params: Optional[Params6] = None
    target: Literal["bloomberg"]


class Params7(BaseModel):
    class Config:
        extra = Extra.forbid

    post_type: Optional[PostType] = Field(
        None,
        description="How to post the data to Reuters, either the end of day method (EOD), real time method (RT) or both (EOD_AND_RT)",
    )
    rounding_decimals: Optional[int] = None
    ticker: Optional[StrictStr] = None


class PublishConfigItem9(BaseModel):
    active_time_ranges: Optional[List[ActiveTimeRange]] = Field(
        None,
        description="Time ranges during which values should be published to this target. Target level active_time_ranges override publish_config metric level active_time_ranges.",
    )
    params: Optional[Params7] = None
    target: Literal["reuters"]


class Intraday1(BaseModel):
    class Config:
        extra = Extra.forbid

    active_time_ranges: Optional[List[ActiveTimeRange]] = None
    calculation_max_retry_delay: Optional[conint(ge=0)] = Field(
        None,
        description="How many seconds to keep retrying the real time calculation before setting the force flag. Defalts to 0 which means retry forever.",
    )
    data_refresh_period: Optional[conint(ge=0)] = Field(
        None,
        description="After the rtindex refreshes its data this is the number of seconds to wait before refreshing again. 0 means do not refresh. Defaults to 3600 seconds (60min)",
    )
    enabled: StrictBool = Field(..., description="If the intraday process should be run or not")
    heartbeat_timeout: Optional[conint(ge=1)] = Field(
        None, description="Max number of seconds between heartbeats before the rtindex pod is considered unhealthy"
    )
    publish_config: Optional[
        Dict[
            str,
            Union[
                PublishConfigItem5,
                List[Union[PublishConfigItem6, PublishConfigItem7, PublishConfigItem8, PublishConfigItem9]],
            ],
        ]
    ] = Field(None, description="Mapping of index metric to targets it should be sent to")
    resource_cpu_request: Optional[conint(ge=1)] = Field(
        None, description="Minimum cpu resources requested in milliCPU"
    )
    resource_memory_request: Optional[conint(ge=0)] = Field(
        None, description="Minimum memory resources requested in mebibytes."
    )
    security_id: Optional[StrictStr] = Field(
        None, description="Security ID of the intraday_index security where ticker data is served"
    )
    startup_failure_timeout: Optional[conint(ge=1)] = Field(
        None,
        description="Max number of seconds to wait for the first heartbeat from the rtindex pod before considering it a failed startup. By default it will wait 40sec",
    )
    ticker_period: Optional[float] = Field(None, description="Duration between ticker datapoints. In seconds")
    tzinfo: Optional[StrictStr] = Field(None, description="Timezone of intraday tick timestamp comparisons")


class PortfolioDisplay1(BaseModel):
    fields: Optional[List[FieldModel]] = None


class RelatedItem1(BaseModel):
    default_display: Optional[StrictBool] = False
    id: StrictStr
    metric: Optional[StrictStr] = None
    name: StrictStr
    type: Type


class AirflowConfig2(BaseModel):
    class Config:
        extra = Extra.forbid

    dag: Optional[Dict[str, Any]] = Field(None, description="use this to set kwargs for the dag")
    description: Optional[StrictStr] = Field(None, description="A short description related with the generated runner")
    env: Optional[Dict[str, Any]] = Field(None, description="use this to set ENV variables in the pod")
    pod: Optional[Dict[str, Any]] = Field(None, description="use this to set kwargs for the pod")
    s3_location: Optional[S3Location] = None
    subpods: Optional[List[Subpod]] = None


class HolidayCalendar4(BaseModel):
    class Config:
        extra = Extra.forbid

    calendar_identifiers: Optional[List[constr(regex=r"^(FUT|MIC|FX):.+$", strict=True)]] = None
    condition: Optional[Condition] = None
    holidays_to_add: Optional[List[date]] = None
    holidays_to_remove: Optional[List[date]] = None
    swaps_monitor_codes: Optional[List[constr(regex=r"^[a-zA-Z]{3}$", strict=True)]] = None
    weekmask: Optional[List[WeekmaskEnum]] = Field(
        ["Mon", "Tue", "Wed", "Thu", "Fri"], description="weekmask of valid business days"
    )


class DisseminationDestinations2(BaseModel):
    email_dissapi_configs: Optional[List[EmailDissapiConfig]] = Field(None, min_items=1)
    s3_dissapi_configs: Optional[List[S3DissapiConfig]] = None
    sftp_dissapi_configs: Optional[List[SftpDissapiConfig]] = None


class IndexReport2(BaseModel):
    dissemination_destinations: Optional[DisseminationDestinations2] = None
    program_args: Optional[Dict[str, Any]] = None
    uuid: StrictStr


class HolidayCalendar5(BaseModel):
    cal_type: Optional[StrictStr] = Field(None, example="MIC")
    mic: Optional[StrictStr] = Field(None, example="XNYS")


class Schedule2(BaseModel):
    class Config:
        extra = Extra.forbid

    business_days_prior: Optional[int] = Field(None, example=1)
    holiday_calendar: Optional[HolidayCalendar5] = None
    retries: int
    retry_interval_min: int
    schedule_cron: Optional[StrictStr] = None
    schedule_start: StrictStr
    timeout_delta: Optional[StrictStr] = Field(None, example="minutes=17")


class RunConfiguration2(BaseModel):
    class Config:
        extra = Extra.allow

    airflow_config: Optional[AirflowConfig2] = None
    command: Optional[StrictStr] = None
    command_arguments: Optional[List[List[StrictStr]]] = None
    holiday_calendar: Optional[HolidayCalendar4] = None
    index_report_uuids: Optional[List[StrictStr]] = None
    index_reports: Optional[Union[List[StrictStr], List[IndexReport2]]] = None
    job_enabled: StrictBool
    pod_image_and_tag: Optional[StrictStr] = Field(None, description="overrides the image")
    schedule: Schedule2
    tzinfo: Optional[StrictStr] = None


class AirflowConfig3(BaseModel):
    class Config:
        extra = Extra.forbid

    dag: Optional[Dict[str, Any]] = Field(None, description="use this to set kwargs for the dag")
    description: Optional[StrictStr] = Field(None, description="A short description related with the generated runner")
    env: Optional[Dict[str, Any]] = Field(None, description="use this to set ENV variables in the pod")
    pod: Optional[Dict[str, Any]] = Field(None, description="use this to set kwargs for the pod")
    s3_location: Optional[S3Location] = None
    subpods: Optional[List[Subpod]] = None


class HolidayCalendar6(BaseModel):
    class Config:
        extra = Extra.forbid

    calendar_identifiers: Optional[List[constr(regex=r"^(FUT|MIC|FX):.+$", strict=True)]] = None
    condition: Optional[Condition] = None
    holidays_to_add: Optional[List[date]] = None
    holidays_to_remove: Optional[List[date]] = None
    swaps_monitor_codes: Optional[List[constr(regex=r"^[a-zA-Z]{3}$", strict=True)]] = None
    weekmask: Optional[List[WeekmaskEnum]] = Field(
        ["Mon", "Tue", "Wed", "Thu", "Fri"], description="weekmask of valid business days"
    )


class DisseminationDestinations3(BaseModel):
    email_dissapi_configs: Optional[List[EmailDissapiConfig]] = Field(None, min_items=1)
    s3_dissapi_configs: Optional[List[S3DissapiConfig]] = None
    sftp_dissapi_configs: Optional[List[SftpDissapiConfig]] = None


class IndexReport3(BaseModel):
    dissemination_destinations: Optional[DisseminationDestinations3] = None
    program_args: Optional[Dict[str, Any]] = None
    uuid: StrictStr


class HolidayCalendar7(BaseModel):
    cal_type: Optional[StrictStr] = Field(None, example="MIC")
    mic: Optional[StrictStr] = Field(None, example="XNYS")


class Schedule3(BaseModel):
    class Config:
        extra = Extra.forbid

    business_days_prior: Optional[int] = Field(None, example=1)
    holiday_calendar: Optional[HolidayCalendar7] = None
    retries: int
    retry_interval_min: int
    schedule_cron: Optional[StrictStr] = None
    schedule_start: StrictStr
    timeout_delta: Optional[StrictStr] = Field(None, example="minutes=17")


class RunConfiguration3(BaseModel):
    class Config:
        extra = Extra.allow

    airflow_config: Optional[AirflowConfig3] = None
    command: Optional[StrictStr] = None
    command_arguments: Optional[List[List[StrictStr]]] = None
    holiday_calendar: Optional[HolidayCalendar6] = None
    index_report_uuids: Optional[List[StrictStr]] = None
    index_reports: Optional[Union[List[StrictStr], List[IndexReport3]]] = None
    job_enabled: StrictBool
    pod_image_and_tag: Optional[StrictStr] = Field(None, description="overrides the image")
    schedule: Schedule3
    tzinfo: Optional[StrictStr] = None
    label: StrictStr = Field(..., description="unique label of this rc")


class Datum2(BaseModel):
    class Config:
        extra = Extra.forbid

    array_field: StrictStr
    key_field: StrictStr
    url: StrictStr
    values: List[Value]


class CustomChart1(BaseModel):
    class Config:
        extra = Extra.forbid

    chart_type: Optional[ChartType] = "line"
    compare_mode: Optional[CompareMode] = "percent"
    constructor_type: Optional[ConstructorType] = "stockChart"
    data: Optional[List[Datum2]] = None
    name: StrictStr
    size: Optional[float] = 12
    xlabel: StrictStr
    ylabel: StrictStr


class Webpage1(BaseModel):
    custom_charts: Optional[List[CustomChart1]] = None
    visible: Optional[StrictBool] = True


class IndexDefinitionPost(BaseModel):
    class Config:
        extra = Extra.forbid

    administrative: Administrative1
    base_date: Optional[StrictStr] = None
    base_year: Optional[int] = None
    benchmark: Optional[Union[BenchmarkItem, List[BenchmarkItem]]] = None
    buffer_end: Optional[float] = None
    buffer_start: Optional[float] = None
    calc_freq: Optional[CalcFreq] = None
    currency: Optional[StrictStr] = None
    custom_metrics: Optional[List[CustomMetric1]] = None
    description: StrictStr
    display_month: Optional[DisplayMonth] = None
    documents: Optional[Dict[str, Any]] = None
    excess_strategy: Optional[Literal["keep_in_cash"]] = None
    family: StrictStr
    family_description: Optional[StrictStr] = None
    identifiers: Optional[List[Identifier1]] = Field(None, min_items=0)
    index_class_uuid: Optional[StrictStr] = None
    intraday: Optional[Intraday1] = Field(
        None, description="Only available for indexes with intraday tick computation", title="Intraday Details"
    )
    launch_date: StrictStr
    methodology: Optional[StrictStr] = None
    month: Optional[int] = None
    name: constr(regex=r"^[a-zA-Z][a-zA-Z0-9-_]{0,99}$", strict=True)
    namespace: Optional[StrictStr] = None
    plot_metric: Optional[StrictStr] = None
    portfolio_allocation_display: Optional[StrictBool] = Field(
        None, description="whether or not portfolio_allocations are shown on the website. False by default"
    )
    portfolio_display: Optional[PortfolioDisplay1] = None
    rebal_freq: Optional[RebalFreq] = None
    related: Optional[List[RelatedItem1]] = None
    run_configuration: Optional[RunConfiguration2] = None
    run_configurations: Optional[List[RunConfiguration3]] = None
    spec: Optional[Spec] = None
    stage: Stage
    tags: Optional[StrictStr] = None
    title: StrictStr
    webpage: Optional[Webpage1] = None
    weighting_method: Optional[WeightingMethod] = None


class IndexSpec(BaseModel):
    index_class: Optional[StrictStr] = None
    index_class_args: Optional[Dict[str, Any]] = Field(
        None,
        description="should validate against index_class_args_spec field of the IndexClassDefinition identified by index_class",
    )
    index_variables: Optional[Dict[str, Any]] = Field(None, description="TODO")
    version: Optional[int] = None


class Target8(BaseModel):
    active_time_ranges: Optional[List[ActiveTimeRange]] = Field(
        None,
        description="Time ranges during which values should be published to this target. Target level active_time_ranges override publish_config metric level active_time_ranges.",
    )
    target: Literal["db"]


class Target9(BaseModel):
    active_time_ranges: Optional[List[ActiveTimeRange]] = Field(
        None,
        description="Time ranges during which values should be published to this target. Target level active_time_ranges override publish_config metric level active_time_ranges.",
    )
    target: Literal["secapi"]


class Params8(BaseModel):
    class Config:
        extra = Extra.forbid

    rounding_decimals: Optional[int] = None
    ticker: Optional[StrictStr] = None


class Target10(BaseModel):
    active_time_ranges: Optional[List[ActiveTimeRange]] = Field(
        None,
        description="Time ranges during which values should be published to this target. Target level active_time_ranges override publish_config metric level active_time_ranges.",
    )
    params: Optional[Params8] = None
    target: Literal["bloomberg"]


class Params9(BaseModel):
    class Config:
        extra = Extra.forbid

    post_type: Optional[PostType] = Field(
        None,
        description="How to post the data to Reuters, either the end of day method (EOD), real time method (RT) or both (EOD_AND_RT)",
    )
    rounding_decimals: Optional[int] = None
    ticker: Optional[StrictStr] = None


class Target11(BaseModel):
    active_time_ranges: Optional[List[ActiveTimeRange]] = Field(
        None,
        description="Time ranges during which values should be published to this target. Target level active_time_ranges override publish_config metric level active_time_ranges.",
    )
    params: Optional[Params9] = None
    target: Literal["reuters"]


class IntradayPublishConfigItem(BaseModel):
    class Config:
        extra = Extra.forbid

    default_active_time_ranges: Optional[List[DefaultActiveTimeRange]] = Field(
        None,
        description="Time ranges during which values should be published for this metric. This will be overriden if a target level active_time_ranges is set.",
    )
    targets: List[Union[Target8, Target9, Target10, Target11]] = Field(
        ..., description="List of targets to send this index metric too"
    )


class IntradayPublishConfigItem1(BaseModel):
    active_time_ranges: Optional[List[ActiveTimeRange]] = Field(
        None,
        description="Time ranges during which values should be published to this target. Target level active_time_ranges override publish_config metric level active_time_ranges.",
    )
    target: Literal["db"]


class IntradayPublishConfigItem2(BaseModel):
    active_time_ranges: Optional[List[ActiveTimeRange]] = Field(
        None,
        description="Time ranges during which values should be published to this target. Target level active_time_ranges override publish_config metric level active_time_ranges.",
    )
    target: Literal["secapi"]


class Params10(BaseModel):
    class Config:
        extra = Extra.forbid

    rounding_decimals: Optional[int] = None
    ticker: Optional[StrictStr] = None


class IntradayPublishConfigItem3(BaseModel):
    active_time_ranges: Optional[List[ActiveTimeRange]] = Field(
        None,
        description="Time ranges during which values should be published to this target. Target level active_time_ranges override publish_config metric level active_time_ranges.",
    )
    params: Optional[Params10] = None
    target: Literal["bloomberg"]


class Params11(BaseModel):
    class Config:
        extra = Extra.forbid

    post_type: Optional[PostType] = Field(
        None,
        description="How to post the data to Reuters, either the end of day method (EOD), real time method (RT) or both (EOD_AND_RT)",
    )
    rounding_decimals: Optional[int] = None
    ticker: Optional[StrictStr] = None


class IntradayPublishConfigItem4(BaseModel):
    active_time_ranges: Optional[List[ActiveTimeRange]] = Field(
        None,
        description="Time ranges during which values should be published to this target. Target level active_time_ranges override publish_config metric level active_time_ranges.",
    )
    params: Optional[Params11] = None
    target: Literal["reuters"]


class IntradayPublishConfig(BaseModel):
    __root__: Optional[
        Dict[
            str,
            Union[
                IntradayPublishConfigItem,
                List[
                    Union[
                        IntradayPublishConfigItem1,
                        IntradayPublishConfigItem2,
                        IntradayPublishConfigItem3,
                        IntradayPublishConfigItem4,
                    ]
                ],
            ],
        ]
    ] = None


class Params12(BaseModel):
    class Config:
        extra = Extra.forbid

    rounding_decimals: Optional[int] = None
    ticker: Optional[StrictStr] = None


class IntradayPublishConfigBloombergTarget(BaseModel):
    active_time_ranges: Optional[List[ActiveTimeRange]] = Field(
        None,
        description="Time ranges during which values should be published to this target. Target level active_time_ranges override publish_config metric level active_time_ranges.",
    )
    params: Optional[Params12] = None
    target: Literal["bloomberg"]


class IntradayPublishConfigBloombergTargetParams(BaseModel):
    class Config:
        extra = Extra.forbid

    rounding_decimals: Optional[int] = None
    ticker: Optional[StrictStr] = None


class IntradayPublishConfigDbTarget(BaseModel):
    active_time_ranges: Optional[List[ActiveTimeRange]] = Field(
        None,
        description="Time ranges during which values should be published to this target. Target level active_time_ranges override publish_config metric level active_time_ranges.",
    )
    target: Literal["db"]


class Params13(BaseModel):
    class Config:
        extra = Extra.forbid

    post_type: Optional[PostType] = Field(
        None,
        description="How to post the data to Reuters, either the end of day method (EOD), real time method (RT) or both (EOD_AND_RT)",
    )
    rounding_decimals: Optional[int] = None
    ticker: Optional[StrictStr] = None


class IntradayPublishConfigReutersTarget(BaseModel):
    active_time_ranges: Optional[List[ActiveTimeRange]] = Field(
        None,
        description="Time ranges during which values should be published to this target. Target level active_time_ranges override publish_config metric level active_time_ranges.",
    )
    params: Optional[Params13] = None
    target: Literal["reuters"]


class IntradayPublishConfigReutersTargetParams(BaseModel):
    class Config:
        extra = Extra.forbid

    post_type: Optional[PostType] = Field(
        None,
        description="How to post the data to Reuters, either the end of day method (EOD), real time method (RT) or both (EOD_AND_RT)",
    )
    rounding_decimals: Optional[int] = None
    ticker: Optional[StrictStr] = None


class IntradayPublishConfigSecapiTarget(BaseModel):
    active_time_ranges: Optional[List[ActiveTimeRange]] = Field(
        None,
        description="Time ranges during which values should be published to this target. Target level active_time_ranges override publish_config metric level active_time_ranges.",
    )
    target: Literal["secapi"]


class IntradayPublishConfigTargetItem(BaseModel):
    active_time_ranges: Optional[List[ActiveTimeRange]] = Field(
        None,
        description="Time ranges during which values should be published to this target. Target level active_time_ranges override publish_config metric level active_time_ranges.",
    )
    target: Literal["db"]


class IntradayPublishConfigTargetItem1(BaseModel):
    active_time_ranges: Optional[List[ActiveTimeRange]] = Field(
        None,
        description="Time ranges during which values should be published to this target. Target level active_time_ranges override publish_config metric level active_time_ranges.",
    )
    target: Literal["secapi"]


class Params14(BaseModel):
    class Config:
        extra = Extra.forbid

    rounding_decimals: Optional[int] = None
    ticker: Optional[StrictStr] = None


class IntradayPublishConfigTargetItem2(BaseModel):
    active_time_ranges: Optional[List[ActiveTimeRange]] = Field(
        None,
        description="Time ranges during which values should be published to this target. Target level active_time_ranges override publish_config metric level active_time_ranges.",
    )
    params: Optional[Params14] = None
    target: Literal["bloomberg"]


class Params15(BaseModel):
    class Config:
        extra = Extra.forbid

    post_type: Optional[PostType] = Field(
        None,
        description="How to post the data to Reuters, either the end of day method (EOD), real time method (RT) or both (EOD_AND_RT)",
    )
    rounding_decimals: Optional[int] = None
    ticker: Optional[StrictStr] = None


class IntradayPublishConfigTargetItem3(BaseModel):
    active_time_ranges: Optional[List[ActiveTimeRange]] = Field(
        None,
        description="Time ranges during which values should be published to this target. Target level active_time_ranges override publish_config metric level active_time_ranges.",
    )
    params: Optional[Params15] = None
    target: Literal["reuters"]


class IntradayPublishConfigTarget(BaseModel):
    __root__: Union[
        IntradayPublishConfigTargetItem,
        IntradayPublishConfigTargetItem1,
        IntradayPublishConfigTargetItem2,
        IntradayPublishConfigTargetItem3,
    ]


class IntradayPublishConfigTargetBase(BaseModel):
    active_time_ranges: Optional[List[ActiveTimeRange]] = Field(
        None,
        description="Time ranges during which values should be published to this target. Target level active_time_ranges override publish_config metric level active_time_ranges.",
    )


class IntradayTickFilter(BaseModel):
    class Config:
        extra = Extra.forbid

    days_of_week: Optional[List[int]] = Field(
        None,
        description="Which days of the week to run the index. Each day of the week is denoted by an integer with Monday = 0 and Sunday = 6",
    )
    end_date: Optional[
        Union[
            datetime,
            date,
            constr(
                regex=r"^[0-9]{4}-[0-9]{2}-[0-9]{2}(?:[ T][0-9]{2}:[0-9]{2}:[0-9]{2})?(?:[.][0-9]{1, 6})?$", strict=True
            ),
        ]
    ] = Field(None, example=["2021-01-01", "2021-01-01T01:01:01", "2021-01-01T01:01:01.zzzzz"])
    end_time: Optional[StrictStr] = Field(
        None,
        description="Inclusive end time of the day to stop running this intraday index. Format is %H:%M:%S.%f. This should be in the timezone of the index based on tzinfo.",
        example="20:39:00.262345",
    )
    exclude_holidays: Optional[StrictBool] = Field(
        None,
        description="If this is True use the index holiday calendar to decide which days to run the index. It will only run on non-holidays.",
    )
    start_date: Optional[
        Union[
            datetime,
            date,
            constr(
                regex=r"^[0-9]{4}-[0-9]{2}-[0-9]{2}(?:[ T][0-9]{2}:[0-9]{2}:[0-9]{2})?(?:[.][0-9]{1, 6})?$", strict=True
            ),
        ]
    ] = Field(None, example=["2021-01-01", "2021-01-01T01:01:01", "2021-01-01T01:01:01.zzzzz"])
    start_time: Optional[StrictStr] = Field(
        None,
        description="Inclusive start time of the day to start running this intraday index. Format is %H:%M:%S.%f. This should be in the timezone of the index based on tzinfo.",
        example="20:39:00.262345",
    )


class Metric(BaseModel):
    id: Optional[StrictStr] = Field(None, example="price_return")
    value: Optional[float] = Field(None, example=1000.0000000000002)


class Metrics(BaseModel):
    metrics: Optional[List[Metric]] = None
    ts: Optional[datetime] = Field(None, description="iso8601 format")


class MetricsArrItem(BaseModel):
    id: Optional[StrictStr] = Field(None, example="price_return")
    value: Optional[float] = Field(None, example=1000.0000000000002)


class MetricsArr(BaseModel):
    __root__: List[MetricsArrItem]


class MetricsDef(BaseModel):
    name: Optional[StrictStr] = Field(None, example="daily_return")
    type: Optional[StrictStr] = Field(None, example="double")


class MetricsSchema(BaseModel):
    data_type: DataType
    description: StrictStr = Field(..., description="a description of what this metric represents")
    name: StrictStr = Field(..., description="metric name")
    object_schema: Optional[Dict[str, Any]] = Field(
        None,
        description="optional - this supports complex objects, ie you can specify the  metric is of this schema. THis allows you to upload a json schema itself of this metric. THis is for downstream users of this metric.",
    )


class NasdaqProviderKwargs(BaseModel):
    class Config:
        extra = Extra.forbid

    eod_date_delta: Optional[int] = Field(
        None,
        description="How many days to offset the Nasdaq date (T if before 6:30pm EST otherwise T + 1) when getting EOD data from the Index",
    )
    nasdaq_env: NasdaqEnv = Field(..., description="Which Nasdaq environment to send data to")


class NewSecurity(BaseModel):
    class Config:
        extra = Extra.forbid

    eff_ts: Optional[
        Union[
            datetime,
            date,
            constr(
                regex=r"^[0-9]{4}-[0-9]{2}-[0-9]{2}(?:[ T][0-9]{2}:[0-9]{2}:[0-9]{2})?(?:[.][0-9]{1, 6})?$", strict=True
            ),
        ]
    ] = Field(None, example=["2021-01-01", "2021-01-01T01:01:01", "2021-01-01T01:01:01.zzzzz"])
    name: StrictStr
    namespace: StrictStr = Field(
        ...,
        description="the calling user must have permission to this namespace to create the security in this namespace",
    )
    prov_ts: Union[
        datetime,
        date,
        constr(regex=r"^[0-9]{4}-[0-9]{2}-[0-9]{2}(?:[ T][0-9]{2}:[0-9]{2}:[0-9]{2})?(?:[.][0-9]{1,6})?$", strict=True),
    ] = Field(..., example=["2021-01-01", "2021-01-01T01:01:01", "2021-01-01T01:01:01.zzzzz"])
    source: Optional[StrictStr] = None


class OptionResponse(BaseModel):
    bid_ask_spread: Optional[float] = Field(
        None, description="Spread between Bid and Ask prices of the option being priced"
    )
    delta: Optional[float] = Field(None, description="Delta of this option")
    dividend_yield: Optional[float] = Field(None, description="Implied Dividend Yield for the underlying")
    gamma: Optional[float] = Field(None, description="Gamma of the option being priced")
    interest_rate: Optional[float] = Field(None, description="Implied Interest Rate")
    price: Optional[float] = Field(None, description="Option Price")
    request_id: Optional[StrictStr] = Field(None, description="Request ID sent in the request")
    spot: Optional[float] = Field(None, description="Underlying spot price")
    theta: Optional[float] = Field(None, description="Theta of the option being priced")
    vega: Optional[float] = Field(None, description="Vega of the option being priced")
    vol: Optional[float] = Field(None, description="Implied Volatility")


class PortfolioUom(Enum):
    WEIGHT = "WEIGHT"
    UNITS = "UNITS"


class Related(BaseModel):
    default_display: Optional[StrictBool] = False
    id: StrictStr
    metric: Optional[StrictStr] = None
    name: StrictStr
    type: Type


class ReutersProviderKwargs(BaseModel):
    class Config:
        extra = Extra.forbid

    post_type: Optional[PostType] = Field(
        None,
        description="How to post the data to Reuters, either the end of day method (EOD), real time method (RT) or both (EOD_AND_RT)",
    )


class ReutersProviderKwargsPostType(Enum):
    EOD = "EOD"
    RT = "RT"
    EOD_AND_RT = "EOD_AND_RT"


class RicEquityPosition(BaseModel):
    class Config:
        extra = Extra.forbid

    amount: float = Field(..., title="Amount")
    asset_type: Literal["EQUITY"] = Field(..., title="Asset Type")
    identifier: StrictStr = Field(..., title="Identifier")
    identifier_type: Literal["RIC"] = Field(..., title="Identifier Type")
    position_id: Optional[StrictStr] = Field(None, title="Position Id")
    real_time_trade_types: Optional[List[RealTimeTradeType]] = None
    use_primary_listing: Optional[StrictBool] = Field(
        False,
        description="use the security's primary listing rather than the one from the identifier",
        title="Use Primary Listing",
    )


class SecapiProviderKwargs(BaseModel):
    class Config:
        extra = Extra.forbid

    metric: StrictStr
    security_name: StrictStr
    security_type: StrictStr


class SecurityCreationResponse(BaseModel):
    id: Optional[StrictStr] = None
    inserts: Optional[int] = None


class IdentifierType(Enum):
    RIC = "RIC"
    secapi_name = "secapi_name"


class Security(BaseModel):
    class Config:
        extra = Extra.forbid

    identifier_type: IdentifierType
    identifier_value: StrictStr = Field(..., example="AAPL.QQ")
    security_type: StrictStr = Field(..., example="equity")


class SecurityListPatchPutGet(BaseModel):
    class Config:
        extra = Extra.forbid

    name: StrictStr = Field(..., description="unique name among all other security lists")
    namespace: Optional[StrictStr] = None
    realtime: Optional[StrictBool] = None
    securities: List[Security]
    id: StrictStr
    status: Status


class Security1(BaseModel):
    class Config:
        extra = Extra.forbid

    identifier_type: IdentifierType
    identifier_value: StrictStr = Field(..., example="AAPL.QQ")
    security_type: StrictStr = Field(..., example="equity")


class SecurityListPost(BaseModel):
    class Config:
        extra = Extra.forbid

    name: StrictStr = Field(..., description="unique name among all other security lists")
    namespace: Optional[StrictStr] = None
    realtime: Optional[StrictBool] = None
    securities: List[Security1]


class SecurityMetrics(BaseModel):
    eff_ts: Union[
        datetime,
        date,
        constr(regex=r"^[0-9]{4}-[0-9]{2}-[0-9]{2}(?:[ T][0-9]{2}:[0-9]{2}:[0-9]{2})?(?:[.][0-9]{1,6})?$", strict=True),
    ] = Field(..., example=["2021-01-01", "2021-01-01T01:01:01", "2021-01-01T01:01:01.zzzzz"])
    id: StrictStr = Field(..., example="0000699a-fcd7-45d4-8ce4-064a4ffeced0")
    metric: StrictStr = Field(..., example="Level")
    prov_ts: Union[
        datetime,
        date,
        constr(regex=r"^[0-9]{4}-[0-9]{2}-[0-9]{2}(?:[ T][0-9]{2}:[0-9]{2}:[0-9]{2})?(?:[.][0-9]{1,6})?$", strict=True),
    ] = Field(..., example=["2021-01-01", "2021-01-01T01:01:01", "2021-01-01T01:01:01.zzzzz"])
    source: Optional[StrictStr] = Field(None, example="some_gcp_feed")
    value: Union[StrictStr, float, int, StrictBool, List, Dict[str, Any]]


class SecurityMetricsDeletion(BaseModel):
    eff_ts: Union[
        datetime,
        date,
        constr(regex=r"^[0-9]{4}-[0-9]{2}-[0-9]{2}(?:[ T][0-9]{2}:[0-9]{2}:[0-9]{2})?(?:[.][0-9]{1,6})?$", strict=True),
    ] = Field(..., example=["2021-01-01", "2021-01-01T01:01:01", "2021-01-01T01:01:01.zzzzz"])
    id: StrictStr = Field(..., example="0000699a-fcd7-45d4-8ce4-064a4ffeced0")
    metric: StrictStr = Field(..., example="Level")
    prov_ts: Optional[
        Union[
            datetime,
            date,
            constr(
                regex=r"^[0-9]{4}-[0-9]{2}-[0-9]{2}(?:[ T][0-9]{2}:[0-9]{2}:[0-9]{2})?(?:[.][0-9]{1, 6})?$", strict=True
            ),
        ]
    ] = Field(None, example=["2021-01-01", "2021-01-01T01:01:01", "2021-01-01T01:01:01.zzzzz"])
    source: Optional[StrictStr] = Field(None, example="some_gcp_feed")


class Stats(BaseModel):
    annual_volatility: Optional[float] = Field(None, example=3.717606464173326)
    annualized_return: Optional[float] = Field(None, example=6.665050717276233)
    cumulative_return: Optional[float] = Field(None, example=2.7597506251556547)
    end_date: Optional[
        Union[
            datetime,
            date,
            constr(
                regex=r"^[0-9]{4}-[0-9]{2}-[0-9]{2}(?:[ T][0-9]{2}:[0-9]{2}:[0-9]{2})?(?:[.][0-9]{1, 6})?$", strict=True
            ),
        ]
    ] = Field(None, example=["2021-01-01", "2021-01-01T01:01:01", "2021-01-01T01:01:01.zzzzz"])
    id: Optional[StrictStr] = Field(None, example="YTD")
    max_drawdown: Optional[float] = Field(None, example=-1.3877029296510448)
    sharpe_ratio: Optional[float] = Field(None, example=1.759543308780235)
    start_date: Optional[
        Union[
            datetime,
            date,
            constr(
                regex=r"^[0-9]{4}-[0-9]{2}-[0-9]{2}(?:[ T][0-9]{2}:[0-9]{2}:[0-9]{2})?(?:[.][0-9]{1, 6})?$", strict=True
            ),
        ]
    ] = Field(None, example=["2021-01-01", "2021-01-01T01:01:01", "2021-01-01T01:01:01.zzzzz"])


class Datum3(BaseModel):
    class Config:
        extra = Extra.forbid

    array_field: StrictStr
    key_field: StrictStr
    url: StrictStr
    values: List[Value]


class CustomChart2(BaseModel):
    class Config:
        extra = Extra.forbid

    chart_type: Optional[ChartType] = "line"
    compare_mode: Optional[CompareMode] = "percent"
    constructor_type: Optional[ConstructorType] = "stockChart"
    data: Optional[List[Datum3]] = None
    name: StrictStr
    size: Optional[float] = 12
    xlabel: StrictStr
    ylabel: StrictStr


class Webpage2(BaseModel):
    custom_charts: Optional[List[CustomChart2]] = None
    visible: Optional[StrictBool] = True
