Source code for sdk.lusid.models.quote_series_id

# coding: utf-8

"""
    LUSID API

    FINBOURNE Technology  # noqa: E501

    Contact: info@finbourne.com
    Generated by OpenAPI Generator (https://openapi-generator.tech)

    Do not edit the class manually.
"""


from __future__ import annotations
import pprint
import re  # noqa: F401
import json


from typing import Any, Dict, Optional
from pydantic.v1 import BaseModel, Field, StrictStr, constr, validator

[docs] class QuoteSeriesId(BaseModel): """ The time invariant unique identifier of the quote. Combined with the effective datetime of the quote this uniquely identifies the quote. This can be thought of as a unique identifier for a time series of quotes. # noqa: E501 """ provider: constr(strict=True, min_length=1) = Field(..., description="The platform or vendor that provided the quote. The available values are: Client, DataScope, Lusid, Edi, TraderMade, FactSet, SIX, Bloomberg, Rimes") price_source: Optional[StrictStr] = Field(None, alias="priceSource", description="The source or originator of the quote, e.g. a bank or financial institution.") instrument_id: constr(strict=True, min_length=1) = Field(..., alias="instrumentId", description="The value of the instrument identifier that uniquely identifies the instrument that the quote is for, e.g. 'BBG00JX0P539'.") instrument_id_type: Optional[StrictStr] = Field(..., alias="instrumentIdType", description="The type of instrument identifier used to uniquely identify the instrument that the quote is for, e.g. 'Figi'. The available values are: LusidInstrumentId, Figi, RIC, QuotePermId, Isin, CurrencyPair, ClientInternal, Sedol, Cusip") quote_type: Optional[StrictStr] = Field(..., alias="quoteType", description="The type of the quote. This allows for quotes other than prices e.g. rates or spreads to be used. The available values are: Price, Spread, Rate, LogNormalVol, NormalVol, ParSpread, IsdaSpread, Upfront, Index, Ratio, Delta, PoolFactor, InflationAssumption, DirtyPrice") field: constr(strict=True, min_length=1) = Field(..., description="The field of the quote e.g. bid, mid, ask etc. This should be consistent across a time series of quotes. The allowed values depend on the provider according to the following rules: Client : *Any value is accepted*; DataScope : 'bid', 'mid', 'ask'; Lusid : *Any value is accepted*; Edi : 'bid', 'mid', 'ask', 'open', 'close', 'last'; TraderMade : 'bid', 'mid', 'ask', 'open', 'close', 'high', 'low'; FactSet : 'bid', 'mid', 'ask', 'open', 'close'; SIX : 'bid', 'mid', 'ask', 'open', 'close', 'last', 'referencePrice', 'highPrice', 'lowPrice', 'maxRedemptionPrice', 'maxSubscriptionPrice', 'openPrice', 'bestBidPrice', 'lastBidPrice', 'bestAskPrice', 'lastAskPrice'; Bloomberg : 'bid', 'mid', 'ask', 'open', 'close', 'last'; Rimes : 'bid', 'mid', 'ask', 'open', 'close', 'last'") __properties = ["provider", "priceSource", "instrumentId", "instrumentIdType", "quoteType", "field"]
[docs] @validator('instrument_id_type') def instrument_id_type_validate_enum(cls, value): """Validates the enum""" if value is None: return value if value not in ('LusidInstrumentId', 'Figi', 'RIC', 'QuotePermId', 'Isin', 'CurrencyPair', 'ClientInternal', 'Sedol', 'Cusip'): raise ValueError("must be one of enum values ('LusidInstrumentId', 'Figi', 'RIC', 'QuotePermId', 'Isin', 'CurrencyPair', 'ClientInternal', 'Sedol', 'Cusip')") return value
[docs] @validator('quote_type') def quote_type_validate_enum(cls, value): """Validates the enum""" if value is None: return value if value not in ('Price', 'Spread', 'Rate', 'LogNormalVol', 'NormalVol', 'ParSpread', 'IsdaSpread', 'Upfront', 'Index', 'Ratio', 'Delta', 'PoolFactor', 'InflationAssumption', 'DirtyPrice'): raise ValueError("must be one of enum values ('Price', 'Spread', 'Rate', 'LogNormalVol', 'NormalVol', 'ParSpread', 'IsdaSpread', 'Upfront', 'Index', 'Ratio', 'Delta', 'PoolFactor', 'InflationAssumption', 'DirtyPrice')") return value
[docs] class Config: """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True
[docs] def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.dict(by_alias=True))
[docs] def to_json(self) -> str: """Returns the JSON representation of the model using alias""" return json.dumps(self.to_dict())
[docs] @classmethod def from_json(cls, json_str: str) -> QuoteSeriesId: """Create an instance of QuoteSeriesId from a JSON string""" return cls.from_dict(json.loads(json_str))
[docs] def to_dict(self): """Returns the dictionary representation of the model using alias""" _dict = self.dict(by_alias=True, exclude={ }, exclude_none=True) # set to None if price_source (nullable) is None # and __fields_set__ contains the field if self.price_source is None and "price_source" in self.__fields_set__: _dict['priceSource'] = None # set to None if instrument_id_type (nullable) is None # and __fields_set__ contains the field if self.instrument_id_type is None and "instrument_id_type" in self.__fields_set__: _dict['instrumentIdType'] = None # set to None if quote_type (nullable) is None # and __fields_set__ contains the field if self.quote_type is None and "quote_type" in self.__fields_set__: _dict['quoteType'] = None return _dict
[docs] @classmethod def from_dict(cls, obj: dict) -> QuoteSeriesId: """Create an instance of QuoteSeriesId from a dict""" if obj is None: return None if not isinstance(obj, dict): return QuoteSeriesId.parse_obj(obj) _obj = QuoteSeriesId.parse_obj({ "provider": obj.get("provider"), "price_source": obj.get("priceSource"), "instrument_id": obj.get("instrumentId"), "instrument_id_type": obj.get("instrumentIdType"), "quote_type": obj.get("quoteType"), "field": obj.get("field") }) return _obj