Source code for sdk.lusid.models.put_redemption_event

# 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 List, Dict, Optional, Any, Union, TYPE_CHECKING
from typing_extensions import Annotated
from pydantic.v1 import BaseModel, StrictStr, StrictInt, StrictBool, StrictFloat, StrictBytes, Field, validator, ValidationError, conlist, constr
from datetime import datetime
from lusid.models.cash_offer_election import CashOfferElection
from lusid.models.instrument_event import InstrumentEvent
from lusid.models.lapse_election import LapseElection

[docs] class PutRedemptionEvent(InstrumentEvent): """ Put Redemption (BPUT) โ€” early redemption of a bond at the holder's election under an indenture-defined put option. Supports both Voluntary (the AMI-SeCo canonical shape) and Mandatory (a deliberate market extension beyond SCoRE) participation on Bond, ComplexBond, and InflationLinkedBond instruments. Cloned from RepurchaseOfferEvent (BIDS) and narrowed to debt with a fixed event-level OfferPrice instead of a per-election holder-bid price. # noqa: E501 """ payment_date: Optional[datetime] = Field(default=None, description="Settlement date for the cash + security legs of the put redemption.", alias="paymentDate") offer_price: Union[StrictFloat, StrictInt] = Field(description="Put price per unit of face value (AMI-SeCo OFFR). Per-100 PRCT semantics โ€” `OfferPrice = 100.00` means par; `97.50` means 97.5% of par. Must be strictly positive.", alias="offerPrice") currency: StrictStr = Field(...,alias="currency", description="Settlement currency of the cash leg (ISO 4217 3-letter code).") cash_offer_elections: List[CashOfferElection] = Field(description="List of possible CashOfferElections. Exactly one entry per event in both Mandatory and Voluntary paths.", alias="cashOfferElections") lapse_elections: List[LapseElection] = Field(description="List of possible LapseElections. Exactly one entry for Voluntary (NOAC default). Empty for Mandatory.", alias="lapseElections") market_deadline_date: Optional[datetime] = Field(default=None, description="Issuer / agent deadline for holder instructions. Required for Voluntary participation; optional for Mandatory (no holder-deadline concept).", alias="marketDeadlineDate") response_deadline_date: Optional[datetime] = Field(default=None, description="Account-servicer deadline. Defaults to MarketDeadlineDate when omitted. If set, must be on or before MarketDeadlineDate.", alias="responseDeadlineDate") early_response_deadline: Optional[datetime] = Field(default=None, description="Early-participation deadline. Rare on BPUT; carried for cross-event consistency. If set, must be on or before ResponseDeadlineDate.", alias="earlyResponseDeadline") ex_date: Optional[datetime] = Field(default=None, description="AMI-SeCo ยง4.6 does not list this for BPUT; carried for cross-event consistency. If set, must be on or before MarketDeadlineDate.", alias="exDate") announcement_date: Optional[datetime] = Field(default=None, description="Public announcement date. If set, must be on or before ExDate.", alias="announcementDate") accrued_interest_per_unit: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Per-unit accrued interest. Optional โ€” loader / post-processor derives from the bond's coupon schedule and day-count when not supplied. EconomicallyComplete enforces non-null for accrual-bearing instruments via InstrumentTypeAccruesInterest.", alias="accruedInterestPerUnit") proration_rate: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Issuer-side aggregate proration cap (AMI-SeCo PROR). Default 1.0; range (0, 1].", alias="prorationRate") instrument_event_type: StrictStr = Field(...,alias="instrumentEventType", description="The Type of Event. Available values: TransitionEvent, InformationalEvent, OpenEvent, CloseEvent, StockSplitEvent, BondDefaultEvent, CashDividendEvent, AmortisationEvent, CashFlowEvent, ExerciseEvent, ResetEvent, TriggerEvent, RawVendorEvent, InformationalErrorEvent, BondCouponEvent, DividendReinvestmentEvent, AccumulationEvent, BondPrincipalEvent, DividendOptionEvent, MaturityEvent, FxForwardSettlementEvent, ExpiryEvent, ScripDividendEvent, StockDividendEvent, ReverseStockSplitEvent, CapitalDistributionEvent, SpinOffEvent, MergerEvent, FutureExpiryEvent, SwapCashFlowEvent, SwapPrincipalEvent, CreditPremiumCashFlowEvent, CdsCreditEvent, CdxCreditEvent, MbsCouponEvent, MbsPrincipalEvent, BonusIssueEvent, MbsPrincipalWriteOffEvent, MbsInterestDeferralEvent, MbsInterestShortfallEvent, TenderEvent, CallOnIntermediateSecuritiesEvent, IntermediateSecuritiesDistributionEvent, OptionExercisePhysicalEvent, OptionExerciseCashEvent, ProtectionPayoutCashFlowEvent, TermDepositInterestEvent, TermDepositPrincipalEvent, EarlyRedemptionEvent, FutureMarkToMarketEvent, AdjustGlobalCommitmentEvent, ContractInitialisationEvent, DrawdownEvent, LoanInterestRepaymentEvent, UpdateDepositAmountEvent, LoanPrincipalRepaymentEvent, DepositInterestPaymentEvent, DepositCloseEvent, LoanFacilityContractRolloverEvent, RepurchaseOfferEvent, RepoPartialClosureEvent, RepoCashFlowEvent, FlexibleRepoInterestPaymentEvent, FlexibleRepoCashFlowEvent, FlexibleRepoCollateralEvent, ConversionEvent, FlexibleRepoPartialClosureEvent, FlexibleRepoFullClosureEvent, CapletFloorletCashFlowEvent, EarlyCloseOutEvent, DepositRollEvent, ConsentEvent, DrawingEvent, CapitalGainsDistributionEvent, ExchangeOfferEvent, DutchAuctionEvent, WorthlessEvent, PutRedemptionEvent, LoanFacilityDelayedCompensationPaymentEvent.") additional_properties: Dict[str, Any] = {} __properties = ["instrumentEventType", "paymentDate", "offerPrice", "currency", "cashOfferElections", "lapseElections", "marketDeadlineDate", "responseDeadlineDate", "earlyResponseDeadline", "exDate", "announcementDate", "accruedInterestPerUnit", "prorationRate"]
[docs] @validator('instrument_event_type') def instrument_event_type_validate_enum(cls, value): """Validates the enum""" # Finbourne have removed enum validation on all models, except for this use case: # Workflow and notification application SDK use the property name 'type' as the discriminator on a number of classes. # During instantiation, the value of 'type' is checked against the enum values, # check it's a class that uses the 'type' property as a discriminator # list of classes can be found by searching for 'actual_instance: Union[' in the generated code if 'PutRedemptionEvent' not in [ # For notification application classes 'AmazonSqsNotificationType', 'AmazonSqsNotificationTypeResponse', 'AmazonSqsPrincipalAuthNotificationType', 'AmazonSqsPrincipalAuthNotificationTypeResponse', 'AzureServiceBusTypeResponse', 'AzureServiceBusNotificationType', 'EmailNotificationType', 'EmailNotificationTypeResponse', 'SmsNotificationType', 'SmsNotificationTypeResponse', 'WebhookNotificationType', 'WebhookNotificationTypeResponse', # For workflow application classes 'CreateChildTasksAction', 'RunWorkerAction', 'TriggerParentTaskAction', 'CreateChildTasksActionResponse', 'RunWorkerActionResponse', 'TriggerChildTasksAction', 'TriggerChildTasksActionResponse', 'TriggerParentTaskActionResponse', 'CreateNewTaskActivity', 'UpdateMatchingTasksActivity', 'CreateNewTaskActivityResponse', 'UpdateMatchingTasksActivityResponse', 'Fail', 'GroupReconciliation', 'HealthCheck', 'LuminesceView', 'SchedulerJob', 'Sleep', 'FailResponse', 'GroupReconciliationResponse', 'HealthCheckResponse', 'LuminesceViewResponse', 'SchedulerJobResponse', 'SleepResponse', 'Library', 'LibraryResponse', 'DayRegularity', 'RelativeMonthRegularity', 'SpecificMonthRegularity', 'WeekRegularity', 'YearRegularity', 'LusidEntityDataQualityCheck', 'LusidEntityDataQualityCheckResponse', 'TriggerChildTasksActionResponse']: return value # Only validate the 'type' property of the class if "instrument_event_type" != "type": return value if value not in ['TransitionEvent', 'InformationalEvent', 'OpenEvent', 'CloseEvent', 'StockSplitEvent', 'BondDefaultEvent', 'CashDividendEvent', 'AmortisationEvent', 'CashFlowEvent', 'ExerciseEvent', 'ResetEvent', 'TriggerEvent', 'RawVendorEvent', 'InformationalErrorEvent', 'BondCouponEvent', 'DividendReinvestmentEvent', 'AccumulationEvent', 'BondPrincipalEvent', 'DividendOptionEvent', 'MaturityEvent', 'FxForwardSettlementEvent', 'ExpiryEvent', 'ScripDividendEvent', 'StockDividendEvent', 'ReverseStockSplitEvent', 'CapitalDistributionEvent', 'SpinOffEvent', 'MergerEvent', 'FutureExpiryEvent', 'SwapCashFlowEvent', 'SwapPrincipalEvent', 'CreditPremiumCashFlowEvent', 'CdsCreditEvent', 'CdxCreditEvent', 'MbsCouponEvent', 'MbsPrincipalEvent', 'BonusIssueEvent', 'MbsPrincipalWriteOffEvent', 'MbsInterestDeferralEvent', 'MbsInterestShortfallEvent', 'TenderEvent', 'CallOnIntermediateSecuritiesEvent', 'IntermediateSecuritiesDistributionEvent', 'OptionExercisePhysicalEvent', 'OptionExerciseCashEvent', 'ProtectionPayoutCashFlowEvent', 'TermDepositInterestEvent', 'TermDepositPrincipalEvent', 'EarlyRedemptionEvent', 'FutureMarkToMarketEvent', 'AdjustGlobalCommitmentEvent', 'ContractInitialisationEvent', 'DrawdownEvent', 'LoanInterestRepaymentEvent', 'UpdateDepositAmountEvent', 'LoanPrincipalRepaymentEvent', 'DepositInterestPaymentEvent', 'DepositCloseEvent', 'LoanFacilityContractRolloverEvent', 'RepurchaseOfferEvent', 'RepoPartialClosureEvent', 'RepoCashFlowEvent', 'FlexibleRepoInterestPaymentEvent', 'FlexibleRepoCashFlowEvent', 'FlexibleRepoCollateralEvent', 'ConversionEvent', 'FlexibleRepoPartialClosureEvent', 'FlexibleRepoFullClosureEvent', 'CapletFloorletCashFlowEvent', 'EarlyCloseOutEvent', 'DepositRollEvent', 'ConsentEvent', 'DrawingEvent', 'CapitalGainsDistributionEvent', 'ExchangeOfferEvent', 'DutchAuctionEvent', 'WorthlessEvent', 'PutRedemptionEvent', 'LoanFacilityDelayedCompensationPaymentEvent']: raise ValueError("must be one of enum values ('TransitionEvent', 'InformationalEvent', 'OpenEvent', 'CloseEvent', 'StockSplitEvent', 'BondDefaultEvent', 'CashDividendEvent', 'AmortisationEvent', 'CashFlowEvent', 'ExerciseEvent', 'ResetEvent', 'TriggerEvent', 'RawVendorEvent', 'InformationalErrorEvent', 'BondCouponEvent', 'DividendReinvestmentEvent', 'AccumulationEvent', 'BondPrincipalEvent', 'DividendOptionEvent', 'MaturityEvent', 'FxForwardSettlementEvent', 'ExpiryEvent', 'ScripDividendEvent', 'StockDividendEvent', 'ReverseStockSplitEvent', 'CapitalDistributionEvent', 'SpinOffEvent', 'MergerEvent', 'FutureExpiryEvent', 'SwapCashFlowEvent', 'SwapPrincipalEvent', 'CreditPremiumCashFlowEvent', 'CdsCreditEvent', 'CdxCreditEvent', 'MbsCouponEvent', 'MbsPrincipalEvent', 'BonusIssueEvent', 'MbsPrincipalWriteOffEvent', 'MbsInterestDeferralEvent', 'MbsInterestShortfallEvent', 'TenderEvent', 'CallOnIntermediateSecuritiesEvent', 'IntermediateSecuritiesDistributionEvent', 'OptionExercisePhysicalEvent', 'OptionExerciseCashEvent', 'ProtectionPayoutCashFlowEvent', 'TermDepositInterestEvent', 'TermDepositPrincipalEvent', 'EarlyRedemptionEvent', 'FutureMarkToMarketEvent', 'AdjustGlobalCommitmentEvent', 'ContractInitialisationEvent', 'DrawdownEvent', 'LoanInterestRepaymentEvent', 'UpdateDepositAmountEvent', 'LoanPrincipalRepaymentEvent', 'DepositInterestPaymentEvent', 'DepositCloseEvent', 'LoanFacilityContractRolloverEvent', 'RepurchaseOfferEvent', 'RepoPartialClosureEvent', 'RepoCashFlowEvent', 'FlexibleRepoInterestPaymentEvent', 'FlexibleRepoCashFlowEvent', 'FlexibleRepoCollateralEvent', 'ConversionEvent', 'FlexibleRepoPartialClosureEvent', 'FlexibleRepoFullClosureEvent', 'CapletFloorletCashFlowEvent', 'EarlyCloseOutEvent', 'DepositRollEvent', 'ConsentEvent', 'DrawingEvent', 'CapitalGainsDistributionEvent', 'ExchangeOfferEvent', 'DutchAuctionEvent', 'WorthlessEvent', 'PutRedemptionEvent', 'LoanFacilityDelayedCompensationPaymentEvent')") return value
[docs] class Config: """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True
def __str__(self): """For `print` and `pprint`""" return pprint.pformat(self.dict(by_alias=False)) def __repr__(self): """For `print` and `pprint`""" return self.to_str()
[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) -> PutRedemptionEvent: """Create an instance of PutRedemptionEvent 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={ "additional_properties" }, exclude_none=True) # override the default output from pydantic by calling `to_dict()` of each item in cash_offer_elections (list) _items = [] if self.cash_offer_elections: for _item in self.cash_offer_elections: if _item: _items.append(_item.to_dict()) _dict['cashOfferElections'] = _items # override the default output from pydantic by calling `to_dict()` of each item in lapse_elections (list) _items = [] if self.lapse_elections: for _item in self.lapse_elections: if _item: _items.append(_item.to_dict()) _dict['lapseElections'] = _items # puts key-value pairs in additional_properties in the top level if self.additional_properties is not None: for _key, _value in self.additional_properties.items(): _dict[_key] = _value # set to None if market_deadline_date (nullable) is None # and __fields_set__ contains the field if self.market_deadline_date is None and "market_deadline_date" in self.__fields_set__: _dict['marketDeadlineDate'] = None # set to None if response_deadline_date (nullable) is None # and __fields_set__ contains the field if self.response_deadline_date is None and "response_deadline_date" in self.__fields_set__: _dict['responseDeadlineDate'] = None # set to None if early_response_deadline (nullable) is None # and __fields_set__ contains the field if self.early_response_deadline is None and "early_response_deadline" in self.__fields_set__: _dict['earlyResponseDeadline'] = None # set to None if ex_date (nullable) is None # and __fields_set__ contains the field if self.ex_date is None and "ex_date" in self.__fields_set__: _dict['exDate'] = None # set to None if announcement_date (nullable) is None # and __fields_set__ contains the field if self.announcement_date is None and "announcement_date" in self.__fields_set__: _dict['announcementDate'] = None # set to None if accrued_interest_per_unit (nullable) is None # and __fields_set__ contains the field if self.accrued_interest_per_unit is None and "accrued_interest_per_unit" in self.__fields_set__: _dict['accruedInterestPerUnit'] = None return _dict
[docs] @classmethod def from_dict(cls, obj: dict) -> PutRedemptionEvent: """Create an instance of PutRedemptionEvent from a dict""" if obj is None: return None if not isinstance(obj, dict): return PutRedemptionEvent.parse_obj(obj) _obj = PutRedemptionEvent.parse_obj({ "instrument_event_type": obj.get("instrumentEventType"), "payment_date": obj.get("paymentDate"), "offer_price": obj.get("offerPrice"), "currency": obj.get("currency"), "cash_offer_elections": [CashOfferElection.from_dict(_item) for _item in obj.get("cashOfferElections")] if obj.get("cashOfferElections") is not None else None, "lapse_elections": [LapseElection.from_dict(_item) for _item in obj.get("lapseElections")] if obj.get("lapseElections") is not None else None, "market_deadline_date": obj.get("marketDeadlineDate"), "response_deadline_date": obj.get("responseDeadlineDate"), "early_response_deadline": obj.get("earlyResponseDeadline"), "ex_date": obj.get("exDate"), "announcement_date": obj.get("announcementDate"), "accrued_interest_per_unit": obj.get("accruedInterestPerUnit"), "proration_rate": obj.get("prorationRate") }) # store additional fields in additional_properties for _key in obj.keys(): if _key not in cls.__properties: _obj.additional_properties[_key] = obj.get(_key) return _obj
PutRedemptionEvent.update_forward_refs()