# 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.instrument_event import InstrumentEvent
from lusid.models.lapse_election import LapseElection
from lusid.models.new_instrument import NewInstrument
from lusid.models.option_exercise_election import OptionExerciseElection
from lusid.models.units_ratio import UnitsRatio
[docs]
class WarrantsExerciseEvent(InstrumentEvent):
"""
Warrants Exercise (EXWA) — the holder's election to exercise an outstanding warrant, paying the strike and receiving the underlying security, or to let it lapse at zero proceeds. Elective (Voluntary / MandatoryWithChoices) on EquityOption (EquityOptionType = Warrant) and SimpleInstrument. # noqa: E501
"""
payment_date: Optional[datetime] = Field(default=None, description="The DvP settlement date on which the strike is paid and the underlying is delivered. Must be on or after PeriodOfActionEnd.", alias="paymentDate")
period_of_action_start: Optional[datetime] = Field(default=None, description="Start of the exercise window.", alias="periodOfActionStart")
period_of_action_end: Optional[datetime] = Field(default=None, description="End of the exercise window.", alias="periodOfActionEnd")
response_deadline_date: Optional[datetime] = Field(default=None, description="Holder response deadline. Required when participation is MandatoryWithChoices.", alias="responseDeadlineDate")
market_deadline_date: Optional[datetime] = Field(default=None, description="Market deadline. Required when participation is MandatoryWithChoices.", alias="marketDeadlineDate")
early_response_deadline: Optional[datetime] = Field(default=None, description="Early response deadline. Optional; populated by some vendor wires.", alias="earlyResponseDeadline")
strike_per_unit: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Cash payable per warrant on exercise. Null-allowed on upsert if the warrant instrument resolves a non-null EquityOption.Strike (instrument-level fallback applied later). If supplied, must be strictly positive and accompanied by a StrikeCurrency.", alias="strikePerUnit")
strike_currency: Optional[StrictStr] = Field(None,alias="strikeCurrency", description="Currency of the strike (ISO 4217 3-letter code). Required if StrikePerUnit is non-null.")
units_ratio: Optional[UnitsRatio] = Field(default=None, alias="unitsRatio")
new_instrument: Optional[NewInstrument] = Field(default=None, alias="newInstrument")
fraction_disposition: Optional[StrictStr] = Field(None,alias="fractionDisposition", description="Handling of fractional underlying units. Defaults to round-down (RDDN) in the holdings engine when null. Supported string (enumeration) values are: [RDDN, CINL]. Available values: RDDN, CINL.")
option_exercise_elections: Optional[List[OptionExerciseElection]] = Field(default=None, description="Option exercise elections for this event. At least one entry.", alias="optionExerciseElections")
lapse_elections: Optional[List[LapseElection]] = Field(default=None, description="Lapse elections for this event. Required when participation is MandatoryWithChoices or when the issuer publishes a no-action default.", alias="lapseElections")
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, InterestPaymentEvent, PriorityIssueEvent, ClassActionEvent, BankruptcyEvent, LiquidationPaymentEvent, PartialDefeasanceEvent, SecurityWriteOffEvent, WarrantsExerciseEvent, PariPassuEvent.")
additional_properties: Dict[str, Any] = {}
__properties = ["instrumentEventType", "paymentDate", "periodOfActionStart", "periodOfActionEnd", "responseDeadlineDate", "marketDeadlineDate", "earlyResponseDeadline", "strikePerUnit", "strikeCurrency", "unitsRatio", "newInstrument", "fractionDisposition", "optionExerciseElections", "lapseElections"]
[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 'WarrantsExerciseEvent' 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', 'InterestPaymentEvent', 'PriorityIssueEvent', 'ClassActionEvent', 'BankruptcyEvent', 'LiquidationPaymentEvent', 'PartialDefeasanceEvent', 'SecurityWriteOffEvent', 'WarrantsExerciseEvent', 'PariPassuEvent']:
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', 'InterestPaymentEvent', 'PriorityIssueEvent', 'ClassActionEvent', 'BankruptcyEvent', 'LiquidationPaymentEvent', 'PartialDefeasanceEvent', 'SecurityWriteOffEvent', 'WarrantsExerciseEvent', 'PariPassuEvent')")
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) -> WarrantsExerciseEvent:
"""Create an instance of WarrantsExerciseEvent 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 units_ratio
if self.units_ratio:
_dict['unitsRatio'] = self.units_ratio.to_dict()
# override the default output from pydantic by calling `to_dict()` of new_instrument
if self.new_instrument:
_dict['newInstrument'] = self.new_instrument.to_dict()
# override the default output from pydantic by calling `to_dict()` of each item in option_exercise_elections (list)
_items = []
if self.option_exercise_elections:
for _item in self.option_exercise_elections:
if _item:
_items.append(_item.to_dict())
_dict['optionExerciseElections'] = _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 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 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 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 strike_per_unit (nullable) is None
# and __fields_set__ contains the field
if self.strike_per_unit is None and "strike_per_unit" in self.__fields_set__:
_dict['strikePerUnit'] = None
# set to None if strike_currency (nullable) is None
# and __fields_set__ contains the field
if self.strike_currency is None and "strike_currency" in self.__fields_set__:
_dict['strikeCurrency'] = None
# set to None if fraction_disposition (nullable) is None
# and __fields_set__ contains the field
if self.fraction_disposition is None and "fraction_disposition" in self.__fields_set__:
_dict['fractionDisposition'] = None
# set to None if option_exercise_elections (nullable) is None
# and __fields_set__ contains the field
if self.option_exercise_elections is None and "option_exercise_elections" in self.__fields_set__:
_dict['optionExerciseElections'] = None
# set to None if lapse_elections (nullable) is None
# and __fields_set__ contains the field
if self.lapse_elections is None and "lapse_elections" in self.__fields_set__:
_dict['lapseElections'] = None
return _dict
[docs]
@classmethod
def from_dict(cls, obj: dict) -> WarrantsExerciseEvent:
"""Create an instance of WarrantsExerciseEvent from a dict"""
if obj is None:
return None
if not isinstance(obj, dict):
return WarrantsExerciseEvent.parse_obj(obj)
_obj = WarrantsExerciseEvent.parse_obj({
"instrument_event_type": obj.get("instrumentEventType"),
"payment_date": obj.get("paymentDate"),
"period_of_action_start": obj.get("periodOfActionStart"),
"period_of_action_end": obj.get("periodOfActionEnd"),
"response_deadline_date": obj.get("responseDeadlineDate"),
"market_deadline_date": obj.get("marketDeadlineDate"),
"early_response_deadline": obj.get("earlyResponseDeadline"),
"strike_per_unit": obj.get("strikePerUnit"),
"strike_currency": obj.get("strikeCurrency"),
"units_ratio": UnitsRatio.from_dict(obj.get("unitsRatio")) if obj.get("unitsRatio") is not None else None,
"new_instrument": NewInstrument.from_dict(obj.get("newInstrument")) if obj.get("newInstrument") is not None else None,
"fraction_disposition": obj.get("fractionDisposition"),
"option_exercise_elections": [OptionExerciseElection.from_dict(_item) for _item in obj.get("optionExerciseElections")] if obj.get("optionExerciseElections") 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
})
# 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
WarrantsExerciseEvent.update_forward_refs()