module Data.FpML.V53.Shared.Option
( module Data.FpML.V53.Shared.Option
, module Data.FpML.V53.Asset
) where
import Text.XML.HaXml.Schema.Schema (SchemaType(..),SimpleType(..),Extension(..),Restricts(..))
import Text.XML.HaXml.Schema.Schema as Schema
import Text.XML.HaXml.OneOfN
import qualified Text.XML.HaXml.Schema.PrimitiveTypes as Xsd
import Data.FpML.V53.Asset
import Data.FpML.V53.FX ( FxOption )
import Data.FpML.V53.FX ( FxDigitalOption )
import Data.FpML.V53.Swaps.Variance ( VarianceOptionTransactionSupplement )
import Data.FpML.V53.CD ( CreditDefaultSwapOption )
import Data.FpML.V53.Option.Bond ( BondOption )
data Asian = Asian
{ asian_averagingInOut :: Maybe AveragingInOutEnum
, asian_strikeFactor :: Maybe Xsd.Decimal
, asian_averagingPeriodIn :: Maybe AveragingPeriod
, asian_averagingPeriodOut :: Maybe AveragingPeriod
}
deriving (Eq,Show)
instance SchemaType Asian where
parseSchemaType s = do
(pos,e) <- posnElement [s]
commit $ interior e $ return Asian
`apply` optional (parseSchemaType "averagingInOut")
`apply` optional (parseSchemaType "strikeFactor")
`apply` optional (parseSchemaType "averagingPeriodIn")
`apply` optional (parseSchemaType "averagingPeriodOut")
schemaTypeToXML s x@Asian{} =
toXMLElement s []
[ maybe [] (schemaTypeToXML "averagingInOut") $ asian_averagingInOut x
, maybe [] (schemaTypeToXML "strikeFactor") $ asian_strikeFactor x
, maybe [] (schemaTypeToXML "averagingPeriodIn") $ asian_averagingPeriodIn x
, maybe [] (schemaTypeToXML "averagingPeriodOut") $ asian_averagingPeriodOut x
]
data AveragingObservationList = AveragingObservationList
{ averagObservList_averagingObservation :: [WeightedAveragingObservation]
}
deriving (Eq,Show)
instance SchemaType AveragingObservationList where
parseSchemaType s = do
(pos,e) <- posnElement [s]
commit $ interior e $ return AveragingObservationList
`apply` many (parseSchemaType "averagingObservation")
schemaTypeToXML s x@AveragingObservationList{} =
toXMLElement s []
[ concatMap (schemaTypeToXML "averagingObservation") $ averagObservList_averagingObservation x
]
data AveragingPeriod = AveragingPeriod
{ averagPeriod_schedule :: [AveragingSchedule]
, averagPeriod_choice1 :: (Maybe (OneOf2 DateTimeList AveragingObservationList))
, averagPeriod_marketDisruption :: Maybe MarketDisruption
}
deriving (Eq,Show)
instance SchemaType AveragingPeriod where
parseSchemaType s = do
(pos,e) <- posnElement [s]
commit $ interior e $ return AveragingPeriod
`apply` many (parseSchemaType "schedule")
`apply` optional (oneOf' [ ("DateTimeList", fmap OneOf2 (parseSchemaType "averagingDateTimes"))
, ("AveragingObservationList", fmap TwoOf2 (parseSchemaType "averagingObservations"))
])
`apply` optional (parseSchemaType "marketDisruption")
schemaTypeToXML s x@AveragingPeriod{} =
toXMLElement s []
[ concatMap (schemaTypeToXML "schedule") $ averagPeriod_schedule x
, maybe [] (foldOneOf2 (schemaTypeToXML "averagingDateTimes")
(schemaTypeToXML "averagingObservations")
) $ averagPeriod_choice1 x
, maybe [] (schemaTypeToXML "marketDisruption") $ averagPeriod_marketDisruption x
]
data AveragingSchedule = AveragingSchedule
{ averagSched_startDate :: Maybe Xsd.Date
, averagSched_endDate :: Maybe Xsd.Date
, averagSched_averagingPeriodFrequency :: Maybe CalculationPeriodFrequency
}
deriving (Eq,Show)
instance SchemaType AveragingSchedule where
parseSchemaType s = do
(pos,e) <- posnElement [s]
commit $ interior e $ return AveragingSchedule
`apply` optional (parseSchemaType "startDate")
`apply` optional (parseSchemaType "endDate")
`apply` optional (parseSchemaType "averagingPeriodFrequency")
schemaTypeToXML s x@AveragingSchedule{} =
toXMLElement s []
[ maybe [] (schemaTypeToXML "startDate") $ averagSched_startDate x
, maybe [] (schemaTypeToXML "endDate") $ averagSched_endDate x
, maybe [] (schemaTypeToXML "averagingPeriodFrequency") $ averagSched_averagingPeriodFrequency x
]
data Barrier = Barrier
{ barrier_cap :: Maybe TriggerEvent
, barrier_floor :: Maybe TriggerEvent
}
deriving (Eq,Show)
instance SchemaType Barrier where
parseSchemaType s = do
(pos,e) <- posnElement [s]
commit $ interior e $ return Barrier
`apply` optional (parseSchemaType "barrierCap")
`apply` optional (parseSchemaType "barrierFloor")
schemaTypeToXML s x@Barrier{} =
toXMLElement s []
[ maybe [] (schemaTypeToXML "barrierCap") $ barrier_cap x
, maybe [] (schemaTypeToXML "barrierFloor") $ barrier_floor x
]
data CalendarSpread = CalendarSpread
{ calSpread_expirationDateTwo :: Maybe AdjustableOrRelativeDate
}
deriving (Eq,Show)
instance SchemaType CalendarSpread where
parseSchemaType s = do
(pos,e) <- posnElement [s]
commit $ interior e $ return CalendarSpread
`apply` optional (parseSchemaType "expirationDateTwo")
schemaTypeToXML s x@CalendarSpread{} =
toXMLElement s []
[ maybe [] (schemaTypeToXML "expirationDateTwo") $ calSpread_expirationDateTwo x
]
data ClassifiedPayment = ClassifiedPayment
{ classPayment_ID :: Maybe Xsd.ID
, classPayment_payerPartyReference :: Maybe PartyReference
, classPayment_payerAccountReference :: Maybe AccountReference
, classPayment_receiverPartyReference :: Maybe PartyReference
, classPayment_receiverAccountReference :: Maybe AccountReference
, classPayment_paymentDate :: Maybe AdjustableOrRelativeDate
, classPayment_paymentAmount :: Maybe NonNegativeMoney
, classPayment_paymentType :: [PaymentType]
}
deriving (Eq,Show)
instance SchemaType ClassifiedPayment where
parseSchemaType s = do
(pos,e) <- posnElement [s]
a0 <- optional $ getAttribute "id" e pos
commit $ interior e $ return (ClassifiedPayment a0)
`apply` optional (parseSchemaType "payerPartyReference")
`apply` optional (parseSchemaType "payerAccountReference")
`apply` optional (parseSchemaType "receiverPartyReference")
`apply` optional (parseSchemaType "receiverAccountReference")
`apply` optional (parseSchemaType "paymentDate")
`apply` optional (parseSchemaType "paymentAmount")
`apply` many (parseSchemaType "paymentType")
schemaTypeToXML s x@ClassifiedPayment{} =
toXMLElement s [ maybe [] (toXMLAttribute "id") $ classPayment_ID x
]
[ maybe [] (schemaTypeToXML "payerPartyReference") $ classPayment_payerPartyReference x
, maybe [] (schemaTypeToXML "payerAccountReference") $ classPayment_payerAccountReference x
, maybe [] (schemaTypeToXML "receiverPartyReference") $ classPayment_receiverPartyReference x
, maybe [] (schemaTypeToXML "receiverAccountReference") $ classPayment_receiverAccountReference x
, maybe [] (schemaTypeToXML "paymentDate") $ classPayment_paymentDate x
, maybe [] (schemaTypeToXML "paymentAmount") $ classPayment_paymentAmount x
, concatMap (schemaTypeToXML "paymentType") $ classPayment_paymentType x
]
instance Extension ClassifiedPayment NonNegativePayment where
supertype (ClassifiedPayment a0 e0 e1 e2 e3 e4 e5 e6) =
NonNegativePayment a0 e0 e1 e2 e3 e4 e5
instance Extension ClassifiedPayment PaymentBaseExtended where
supertype = (supertype :: NonNegativePayment -> PaymentBaseExtended)
. (supertype :: ClassifiedPayment -> NonNegativePayment)
instance Extension ClassifiedPayment PaymentBase where
supertype = (supertype :: PaymentBaseExtended -> PaymentBase)
. (supertype :: NonNegativePayment -> PaymentBaseExtended)
. (supertype :: ClassifiedPayment -> NonNegativePayment)
data Composite = Composite
{ composite_determinationMethod :: Maybe DeterminationMethod
, composite_relativeDate :: Maybe RelativeDateOffset
, composite_fxSpotRateSource :: Maybe FxSpotRateSource
}
deriving (Eq,Show)
instance SchemaType Composite where
parseSchemaType s = do
(pos,e) <- posnElement [s]
commit $ interior e $ return Composite
`apply` optional (parseSchemaType "determinationMethod")
`apply` optional (parseSchemaType "relativeDate")
`apply` optional (parseSchemaType "fxSpotRateSource")
schemaTypeToXML s x@Composite{} =
toXMLElement s []
[ maybe [] (schemaTypeToXML "determinationMethod") $ composite_determinationMethod x
, maybe [] (schemaTypeToXML "relativeDate") $ composite_relativeDate x
, maybe [] (schemaTypeToXML "fxSpotRateSource") $ composite_fxSpotRateSource x
]
data CreditEventNotice = CreditEventNotice
{ creditEventNotice_notifyingParty :: Maybe NotifyingParty
, creditEventNotice_businessCenter :: Maybe BusinessCenter
, creditEventNotice_publiclyAvailableInformation :: Maybe PubliclyAvailableInformation
}
deriving (Eq,Show)
instance SchemaType CreditEventNotice where
parseSchemaType s = do
(pos,e) <- posnElement [s]
commit $ interior e $ return CreditEventNotice
`apply` optional (parseSchemaType "notifyingParty")
`apply` optional (parseSchemaType "businessCenter")
`apply` optional (parseSchemaType "publiclyAvailableInformation")
schemaTypeToXML s x@CreditEventNotice{} =
toXMLElement s []
[ maybe [] (schemaTypeToXML "notifyingParty") $ creditEventNotice_notifyingParty x
, maybe [] (schemaTypeToXML "businessCenter") $ creditEventNotice_businessCenter x
, maybe [] (schemaTypeToXML "publiclyAvailableInformation") $ creditEventNotice_publiclyAvailableInformation x
]
data CreditEvents = CreditEvents
{ creditEvents_ID :: Maybe Xsd.ID
, creditEvents_bankruptcy :: Maybe Xsd.Boolean
, creditEvents_failureToPay :: Maybe FailureToPay
, creditEvents_failureToPayPrincipal :: Maybe Xsd.Boolean
, creditEvents_failureToPayInterest :: Maybe Xsd.Boolean
, creditEvents_obligationDefault :: Maybe Xsd.Boolean
, creditEvents_obligationAcceleration :: Maybe Xsd.Boolean
, creditEvents_repudiationMoratorium :: Maybe Xsd.Boolean
, creditEvents_restructuring :: Maybe Restructuring
, creditEvents_distressedRatingsDowngrade :: Maybe Xsd.Boolean
, creditEvents_maturityExtension :: Maybe Xsd.Boolean
, creditEvents_writedown :: Maybe Xsd.Boolean
, creditEvents_impliedWritedown :: Maybe Xsd.Boolean
, creditEvents_defaultRequirement :: Maybe Money
, creditEvents_creditEventNotice :: Maybe CreditEventNotice
}
deriving (Eq,Show)
instance SchemaType CreditEvents where
parseSchemaType s = do
(pos,e) <- posnElement [s]
a0 <- optional $ getAttribute "id" e pos
commit $ interior e $ return (CreditEvents a0)
`apply` optional (parseSchemaType "bankruptcy")
`apply` optional (parseSchemaType "failureToPay")
`apply` optional (parseSchemaType "failureToPayPrincipal")
`apply` optional (parseSchemaType "failureToPayInterest")
`apply` optional (parseSchemaType "obligationDefault")
`apply` optional (parseSchemaType "obligationAcceleration")
`apply` optional (parseSchemaType "repudiationMoratorium")
`apply` optional (parseSchemaType "restructuring")
`apply` optional (parseSchemaType "distressedRatingsDowngrade")
`apply` optional (parseSchemaType "maturityExtension")
`apply` optional (parseSchemaType "writedown")
`apply` optional (parseSchemaType "impliedWritedown")
`apply` optional (parseSchemaType "defaultRequirement")
`apply` optional (parseSchemaType "creditEventNotice")
schemaTypeToXML s x@CreditEvents{} =
toXMLElement s [ maybe [] (toXMLAttribute "id") $ creditEvents_ID x
]
[ maybe [] (schemaTypeToXML "bankruptcy") $ creditEvents_bankruptcy x
, maybe [] (schemaTypeToXML "failureToPay") $ creditEvents_failureToPay x
, maybe [] (schemaTypeToXML "failureToPayPrincipal") $ creditEvents_failureToPayPrincipal x
, maybe [] (schemaTypeToXML "failureToPayInterest") $ creditEvents_failureToPayInterest x
, maybe [] (schemaTypeToXML "obligationDefault") $ creditEvents_obligationDefault x
, maybe [] (schemaTypeToXML "obligationAcceleration") $ creditEvents_obligationAcceleration x
, maybe [] (schemaTypeToXML "repudiationMoratorium") $ creditEvents_repudiationMoratorium x
, maybe [] (schemaTypeToXML "restructuring") $ creditEvents_restructuring x
, maybe [] (schemaTypeToXML "distressedRatingsDowngrade") $ creditEvents_distressedRatingsDowngrade x
, maybe [] (schemaTypeToXML "maturityExtension") $ creditEvents_maturityExtension x
, maybe [] (schemaTypeToXML "writedown") $ creditEvents_writedown x
, maybe [] (schemaTypeToXML "impliedWritedown") $ creditEvents_impliedWritedown x
, maybe [] (schemaTypeToXML "defaultRequirement") $ creditEvents_defaultRequirement x
, maybe [] (schemaTypeToXML "creditEventNotice") $ creditEvents_creditEventNotice x
]
data CreditEventsReference = CreditEventsReference
{ creditEventsRef_href :: Xsd.IDREF
}
deriving (Eq,Show)
instance SchemaType CreditEventsReference where
parseSchemaType s = do
(pos,e) <- posnElement [s]
a0 <- getAttribute "href" e pos
commit $ interior e $ return (CreditEventsReference a0)
schemaTypeToXML s x@CreditEventsReference{} =
toXMLElement s [ toXMLAttribute "href" $ creditEventsRef_href x
]
[]
instance Extension CreditEventsReference Reference where
supertype v = Reference_CreditEventsReference v
data FailureToPay = FailureToPay
{ failureToPay_applicable :: Maybe Xsd.Boolean
, failureToPay_gracePeriodExtension :: Maybe GracePeriodExtension
, failureToPay_paymentRequirement :: Maybe Money
}
deriving (Eq,Show)
instance SchemaType FailureToPay where
parseSchemaType s = do
(pos,e) <- posnElement [s]
commit $ interior e $ return FailureToPay
`apply` optional (parseSchemaType "applicable")
`apply` optional (parseSchemaType "gracePeriodExtension")
`apply` optional (parseSchemaType "paymentRequirement")
schemaTypeToXML s x@FailureToPay{} =
toXMLElement s []
[ maybe [] (schemaTypeToXML "applicable") $ failureToPay_applicable x
, maybe [] (schemaTypeToXML "gracePeriodExtension") $ failureToPay_gracePeriodExtension x
, maybe [] (schemaTypeToXML "paymentRequirement") $ failureToPay_paymentRequirement x
]
data FeaturePayment = FeaturePayment
{ featurePayment_ID :: Maybe Xsd.ID
, featurePayment_payerPartyReference :: Maybe PartyReference
, featurePayment_payerAccountReference :: Maybe AccountReference
, featurePayment_receiverPartyReference :: Maybe PartyReference
, featurePayment_receiverAccountReference :: Maybe AccountReference
, featurePayment_choice4 :: (Maybe (OneOf2 Xsd.Decimal NonNegativeDecimal))
, featurePayment_time :: Maybe TimeTypeEnum
, featurePayment_currency :: Maybe Currency
, featurePayment_date :: Maybe AdjustableOrRelativeDate
}
deriving (Eq,Show)
instance SchemaType FeaturePayment where
parseSchemaType s = do
(pos,e) <- posnElement [s]
a0 <- optional $ getAttribute "id" e pos
commit $ interior e $ return (FeaturePayment a0)
`apply` optional (parseSchemaType "payerPartyReference")
`apply` optional (parseSchemaType "payerAccountReference")
`apply` optional (parseSchemaType "receiverPartyReference")
`apply` optional (parseSchemaType "receiverAccountReference")
`apply` optional (oneOf' [ ("Xsd.Decimal", fmap OneOf2 (parseSchemaType "levelPercentage"))
, ("NonNegativeDecimal", fmap TwoOf2 (parseSchemaType "amount"))
])
`apply` optional (parseSchemaType "time")
`apply` optional (parseSchemaType "currency")
`apply` optional (parseSchemaType "featurePaymentDate")
schemaTypeToXML s x@FeaturePayment{} =
toXMLElement s [ maybe [] (toXMLAttribute "id") $ featurePayment_ID x
]
[ maybe [] (schemaTypeToXML "payerPartyReference") $ featurePayment_payerPartyReference x
, maybe [] (schemaTypeToXML "payerAccountReference") $ featurePayment_payerAccountReference x
, maybe [] (schemaTypeToXML "receiverPartyReference") $ featurePayment_receiverPartyReference x
, maybe [] (schemaTypeToXML "receiverAccountReference") $ featurePayment_receiverAccountReference x
, maybe [] (foldOneOf2 (schemaTypeToXML "levelPercentage")
(schemaTypeToXML "amount")
) $ featurePayment_choice4 x
, maybe [] (schemaTypeToXML "time") $ featurePayment_time x
, maybe [] (schemaTypeToXML "currency") $ featurePayment_currency x
, maybe [] (schemaTypeToXML "featurePaymentDate") $ featurePayment_date x
]
instance Extension FeaturePayment PaymentBase where
supertype v = PaymentBase_FeaturePayment v
data FrequencyType = FrequencyType Scheme FrequencyTypeAttributes deriving (Eq,Show)
data FrequencyTypeAttributes = FrequencyTypeAttributes
{ frequTypeAttrib_frequencyTypeScheme :: Maybe Xsd.AnyURI
}
deriving (Eq,Show)
instance SchemaType FrequencyType where
parseSchemaType s = do
(pos,e) <- posnElement [s]
commit $ do
a0 <- optional $ getAttribute "frequencyTypeScheme" e pos
reparse [CElem e pos]
v <- parseSchemaType s
return $ FrequencyType v (FrequencyTypeAttributes a0)
schemaTypeToXML s (FrequencyType bt at) =
addXMLAttributes [ maybe [] (toXMLAttribute "frequencyTypeScheme") $ frequTypeAttrib_frequencyTypeScheme at
]
$ schemaTypeToXML s bt
instance Extension FrequencyType Scheme where
supertype (FrequencyType s _) = s
data FxFeature = FxFeature
{ fxFeature_referenceCurrency :: Maybe IdentifiedCurrency
, fxFeature_choice1 :: (Maybe (OneOf3 Composite Quanto Composite))
}
deriving (Eq,Show)
instance SchemaType FxFeature where
parseSchemaType s = do
(pos,e) <- posnElement [s]
commit $ interior e $ return FxFeature
`apply` optional (parseSchemaType "referenceCurrency")
`apply` optional (oneOf' [ ("Composite", fmap OneOf3 (parseSchemaType "composite"))
, ("Quanto", fmap TwoOf3 (parseSchemaType "quanto"))
, ("Composite", fmap ThreeOf3 (parseSchemaType "crossCurrency"))
])
schemaTypeToXML s x@FxFeature{} =
toXMLElement s []
[ maybe [] (schemaTypeToXML "referenceCurrency") $ fxFeature_referenceCurrency x
, maybe [] (foldOneOf3 (schemaTypeToXML "composite")
(schemaTypeToXML "quanto")
(schemaTypeToXML "crossCurrency")
) $ fxFeature_choice1 x
]
data GracePeriodExtension = GracePeriodExtension
{ gracePeriodExtens_applicable :: Maybe Xsd.Boolean
, gracePeriodExtens_gracePeriod :: Maybe Offset
}
deriving (Eq,Show)
instance SchemaType GracePeriodExtension where
parseSchemaType s = do
(pos,e) <- posnElement [s]
commit $ interior e $ return GracePeriodExtension
`apply` optional (parseSchemaType "applicable")
`apply` optional (parseSchemaType "gracePeriod")
schemaTypeToXML s x@GracePeriodExtension{} =
toXMLElement s []
[ maybe [] (schemaTypeToXML "applicable") $ gracePeriodExtens_applicable x
, maybe [] (schemaTypeToXML "gracePeriod") $ gracePeriodExtens_gracePeriod x
]
data Knock = Knock
{ knock_in :: Maybe TriggerEvent
, knock_out :: Maybe TriggerEvent
}
deriving (Eq,Show)
instance SchemaType Knock where
parseSchemaType s = do
(pos,e) <- posnElement [s]
commit $ interior e $ return Knock
`apply` optional (parseSchemaType "knockIn")
`apply` optional (parseSchemaType "knockOut")
schemaTypeToXML s x@Knock{} =
toXMLElement s []
[ maybe [] (schemaTypeToXML "knockIn") $ knock_in x
, maybe [] (schemaTypeToXML "knockOut") $ knock_out x
]
data MarketDisruption = MarketDisruption Scheme MarketDisruptionAttributes deriving (Eq,Show)
data MarketDisruptionAttributes = MarketDisruptionAttributes
{ marketDisrupAttrib_marketDisruptionScheme :: Maybe Xsd.AnyURI
}
deriving (Eq,Show)
instance SchemaType MarketDisruption where
parseSchemaType s = do
(pos,e) <- posnElement [s]
commit $ do
a0 <- optional $ getAttribute "marketDisruptionScheme" e pos
reparse [CElem e pos]
v <- parseSchemaType s
return $ MarketDisruption v (MarketDisruptionAttributes a0)
schemaTypeToXML s (MarketDisruption bt at) =
addXMLAttributes [ maybe [] (toXMLAttribute "marketDisruptionScheme") $ marketDisrupAttrib_marketDisruptionScheme at
]
$ schemaTypeToXML s bt
instance Extension MarketDisruption Scheme where
supertype (MarketDisruption s _) = s
data NotifyingParty = NotifyingParty
{ notifParty_buyerPartyReference :: Maybe PartyReference
, notifParty_sellerPartyReference :: Maybe PartyReference
}
deriving (Eq,Show)
instance SchemaType NotifyingParty where
parseSchemaType s = do
(pos,e) <- posnElement [s]
commit $ interior e $ return NotifyingParty
`apply` optional (parseSchemaType "buyerPartyReference")
`apply` optional (parseSchemaType "sellerPartyReference")
schemaTypeToXML s x@NotifyingParty{} =
toXMLElement s []
[ maybe [] (schemaTypeToXML "buyerPartyReference") $ notifParty_buyerPartyReference x
, maybe [] (schemaTypeToXML "sellerPartyReference") $ notifParty_sellerPartyReference x
]
data Option
= Option_OptionBase OptionBase
| Option_FxOption FxOption
| Option_FxDigitalOption FxDigitalOption
deriving (Eq,Show)
instance SchemaType Option where
parseSchemaType s = do
(fmap Option_OptionBase $ parseSchemaType s)
`onFail`
(fmap Option_FxOption $ parseSchemaType s)
`onFail`
(fmap Option_FxDigitalOption $ parseSchemaType s)
`onFail` fail "Parse failed when expecting an extension type of Option,\n\
\ namely one of:\n\
\OptionBase,FxOption,FxDigitalOption"
schemaTypeToXML _s (Option_OptionBase x) = schemaTypeToXML "optionBase" x
schemaTypeToXML _s (Option_FxOption x) = schemaTypeToXML "fxOption" x
schemaTypeToXML _s (Option_FxDigitalOption x) = schemaTypeToXML "fxDigitalOption" x
instance Extension Option Product where
supertype v = Product_Option v
data OptionBase
= OptionBase_OptionBaseExtended OptionBaseExtended
| OptionBase_VarianceOptionTransactionSupplement VarianceOptionTransactionSupplement
deriving (Eq,Show)
instance SchemaType OptionBase where
parseSchemaType s = do
(fmap OptionBase_OptionBaseExtended $ parseSchemaType s)
`onFail`
(fmap OptionBase_VarianceOptionTransactionSupplement $ parseSchemaType s)
`onFail` fail "Parse failed when expecting an extension type of OptionBase,\n\
\ namely one of:\n\
\OptionBaseExtended,VarianceOptionTransactionSupplement"
schemaTypeToXML _s (OptionBase_OptionBaseExtended x) = schemaTypeToXML "optionBaseExtended" x
schemaTypeToXML _s (OptionBase_VarianceOptionTransactionSupplement x) = schemaTypeToXML "varianceOptionTransactionSupplement" x
instance Extension OptionBase Option where
supertype v = Option_OptionBase v
data OptionBaseExtended
= OptionBaseExtended_CreditDefaultSwapOption CreditDefaultSwapOption
| OptionBaseExtended_BondOption BondOption
deriving (Eq,Show)
instance SchemaType OptionBaseExtended where
parseSchemaType s = do
(fmap OptionBaseExtended_CreditDefaultSwapOption $ parseSchemaType s)
`onFail`
(fmap OptionBaseExtended_BondOption $ parseSchemaType s)
`onFail` fail "Parse failed when expecting an extension type of OptionBaseExtended,\n\
\ namely one of:\n\
\CreditDefaultSwapOption,BondOption"
schemaTypeToXML _s (OptionBaseExtended_CreditDefaultSwapOption x) = schemaTypeToXML "creditDefaultSwapOption" x
schemaTypeToXML _s (OptionBaseExtended_BondOption x) = schemaTypeToXML "bondOption" x
instance Extension OptionBaseExtended OptionBase where
supertype v = OptionBase_OptionBaseExtended v
data OptionFeature = OptionFeature
{ optionFeature_fxFeature :: Maybe FxFeature
, optionFeature_strategyFeature :: Maybe StrategyFeature
, optionFeature_asian :: Maybe Asian
, optionFeature_barrier :: Maybe Barrier
, optionFeature_knock :: Maybe Knock
, optionFeature_passThrough :: Maybe PassThrough
}
deriving (Eq,Show)
instance SchemaType OptionFeature where
parseSchemaType s = do
(pos,e) <- posnElement [s]
commit $ interior e $ return OptionFeature
`apply` optional (parseSchemaType "fxFeature")
`apply` optional (parseSchemaType "strategyFeature")
`apply` optional (parseSchemaType "asian")
`apply` optional (parseSchemaType "barrier")
`apply` optional (parseSchemaType "knock")
`apply` optional (parseSchemaType "passThrough")
schemaTypeToXML s x@OptionFeature{} =
toXMLElement s []
[ maybe [] (schemaTypeToXML "fxFeature") $ optionFeature_fxFeature x
, maybe [] (schemaTypeToXML "strategyFeature") $ optionFeature_strategyFeature x
, maybe [] (schemaTypeToXML "asian") $ optionFeature_asian x
, maybe [] (schemaTypeToXML "barrier") $ optionFeature_barrier x
, maybe [] (schemaTypeToXML "knock") $ optionFeature_knock x
, maybe [] (schemaTypeToXML "passThrough") $ optionFeature_passThrough x
]
data OptionNumericStrike = OptionNumericStrike
{ optionNumericStrike_choice0 :: (Maybe (OneOf2 Xsd.Decimal Xsd.Decimal))
}
deriving (Eq,Show)
instance SchemaType OptionNumericStrike where
parseSchemaType s = do
(pos,e) <- posnElement [s]
commit $ interior e $ return OptionNumericStrike
`apply` optional (oneOf' [ ("Xsd.Decimal", fmap OneOf2 (parseSchemaType "strikePrice"))
, ("Xsd.Decimal", fmap TwoOf2 (parseSchemaType "strikePercentage"))
])
schemaTypeToXML s x@OptionNumericStrike{} =
toXMLElement s []
[ maybe [] (foldOneOf2 (schemaTypeToXML "strikePrice")
(schemaTypeToXML "strikePercentage")
) $ optionNumericStrike_choice0 x
]
data OptionStrike = OptionStrike
{ optionStrike_choice0 :: (Maybe (OneOf2 Xsd.Decimal Xsd.Decimal))
, optionStrike_currency :: Maybe Currency
}
deriving (Eq,Show)
instance SchemaType OptionStrike where
parseSchemaType s = do
(pos,e) <- posnElement [s]
commit $ interior e $ return OptionStrike
`apply` optional (oneOf' [ ("Xsd.Decimal", fmap OneOf2 (parseSchemaType "strikePrice"))
, ("Xsd.Decimal", fmap TwoOf2 (parseSchemaType "strikePercentage"))
])
`apply` optional (parseSchemaType "currency")
schemaTypeToXML s x@OptionStrike{} =
toXMLElement s []
[ maybe [] (foldOneOf2 (schemaTypeToXML "strikePrice")
(schemaTypeToXML "strikePercentage")
) $ optionStrike_choice0 x
, maybe [] (schemaTypeToXML "currency") $ optionStrike_currency x
]
instance Extension OptionStrike OptionNumericStrike where
supertype (OptionStrike e0 e1) =
OptionNumericStrike e0
data PassThrough = PassThrough
{ passThrough_item :: [PassThroughItem]
}
deriving (Eq,Show)
instance SchemaType PassThrough where
parseSchemaType s = do
(pos,e) <- posnElement [s]
commit $ interior e $ return PassThrough
`apply` many (parseSchemaType "passThroughItem")
schemaTypeToXML s x@PassThrough{} =
toXMLElement s []
[ concatMap (schemaTypeToXML "passThroughItem") $ passThrough_item x
]
data PassThroughItem = PassThroughItem
{ passThroughItem_payerPartyReference :: Maybe PartyReference
, passThroughItem_payerAccountReference :: Maybe AccountReference
, passThroughItem_receiverPartyReference :: Maybe PartyReference
, passThroughItem_receiverAccountReference :: Maybe AccountReference
, passThroughItem_underlyerReference :: Maybe AssetReference
, passThroughItem_passThroughPercentage :: Maybe Xsd.Decimal
}
deriving (Eq,Show)
instance SchemaType PassThroughItem where
parseSchemaType s = do
(pos,e) <- posnElement [s]
commit $ interior e $ return PassThroughItem
`apply` optional (parseSchemaType "payerPartyReference")
`apply` optional (parseSchemaType "payerAccountReference")
`apply` optional (parseSchemaType "receiverPartyReference")
`apply` optional (parseSchemaType "receiverAccountReference")
`apply` optional (parseSchemaType "underlyerReference")
`apply` optional (parseSchemaType "passThroughPercentage")
schemaTypeToXML s x@PassThroughItem{} =
toXMLElement s []
[ maybe [] (schemaTypeToXML "payerPartyReference") $ passThroughItem_payerPartyReference x
, maybe [] (schemaTypeToXML "payerAccountReference") $ passThroughItem_payerAccountReference x
, maybe [] (schemaTypeToXML "receiverPartyReference") $ passThroughItem_receiverPartyReference x
, maybe [] (schemaTypeToXML "receiverAccountReference") $ passThroughItem_receiverAccountReference x
, maybe [] (schemaTypeToXML "underlyerReference") $ passThroughItem_underlyerReference x
, maybe [] (schemaTypeToXML "passThroughPercentage") $ passThroughItem_passThroughPercentage x
]
data Premium = Premium
{ premium_ID :: Maybe Xsd.ID
, premium_payerPartyReference :: Maybe PartyReference
, premium_payerAccountReference :: Maybe AccountReference
, premium_receiverPartyReference :: Maybe PartyReference
, premium_receiverAccountReference :: Maybe AccountReference
, premium_paymentAmount :: Maybe NonNegativeMoney
, premium_paymentDate :: Maybe AdjustableOrRelativeDate
, premium_type :: Maybe PremiumTypeEnum
, premium_pricePerOption :: Maybe Money
, premium_percentageOfNotional :: Maybe Xsd.Decimal
, premium_discountFactor :: Maybe Xsd.Decimal
, premium_presentValueAmount :: Maybe Money
}
deriving (Eq,Show)
instance SchemaType Premium where
parseSchemaType s = do
(pos,e) <- posnElement [s]
a0 <- optional $ getAttribute "id" e pos
commit $ interior e $ return (Premium a0)
`apply` optional (parseSchemaType "payerPartyReference")
`apply` optional (parseSchemaType "payerAccountReference")
`apply` optional (parseSchemaType "receiverPartyReference")
`apply` optional (parseSchemaType "receiverAccountReference")
`apply` optional (parseSchemaType "paymentAmount")
`apply` optional (parseSchemaType "paymentDate")
`apply` optional (parseSchemaType "premiumType")
`apply` optional (parseSchemaType "pricePerOption")
`apply` optional (parseSchemaType "percentageOfNotional")
`apply` optional (parseSchemaType "discountFactor")
`apply` optional (parseSchemaType "presentValueAmount")
schemaTypeToXML s x@Premium{} =
toXMLElement s [ maybe [] (toXMLAttribute "id") $ premium_ID x
]
[ maybe [] (schemaTypeToXML "payerPartyReference") $ premium_payerPartyReference x
, maybe [] (schemaTypeToXML "payerAccountReference") $ premium_payerAccountReference x
, maybe [] (schemaTypeToXML "receiverPartyReference") $ premium_receiverPartyReference x
, maybe [] (schemaTypeToXML "receiverAccountReference") $ premium_receiverAccountReference x
, maybe [] (schemaTypeToXML "paymentAmount") $ premium_paymentAmount x
, maybe [] (schemaTypeToXML "paymentDate") $ premium_paymentDate x
, maybe [] (schemaTypeToXML "premiumType") $ premium_type x
, maybe [] (schemaTypeToXML "pricePerOption") $ premium_pricePerOption x
, maybe [] (schemaTypeToXML "percentageOfNotional") $ premium_percentageOfNotional x
, maybe [] (schemaTypeToXML "discountFactor") $ premium_discountFactor x
, maybe [] (schemaTypeToXML "presentValueAmount") $ premium_presentValueAmount x
]
instance Extension Premium SimplePayment where
supertype (Premium a0 e0 e1 e2 e3 e4 e5 e6 e7 e8 e9 e10) =
SimplePayment a0 e0 e1 e2 e3 e4 e5
instance Extension Premium PaymentBase where
supertype = (supertype :: SimplePayment -> PaymentBase)
. (supertype :: Premium -> SimplePayment)
data PubliclyAvailableInformation = PubliclyAvailableInformation
{ publicAvailInfo_standardPublicSources :: Maybe Xsd.Boolean
, publicAvailInfo_publicSource :: [Xsd.XsdString]
, publicAvailInfo_specifiedNumber :: Maybe Xsd.PositiveInteger
}
deriving (Eq,Show)
instance SchemaType PubliclyAvailableInformation where
parseSchemaType s = do
(pos,e) <- posnElement [s]
commit $ interior e $ return PubliclyAvailableInformation
`apply` optional (parseSchemaType "standardPublicSources")
`apply` many (parseSchemaType "publicSource")
`apply` optional (parseSchemaType "specifiedNumber")
schemaTypeToXML s x@PubliclyAvailableInformation{} =
toXMLElement s []
[ maybe [] (schemaTypeToXML "standardPublicSources") $ publicAvailInfo_standardPublicSources x
, concatMap (schemaTypeToXML "publicSource") $ publicAvailInfo_publicSource x
, maybe [] (schemaTypeToXML "specifiedNumber") $ publicAvailInfo_specifiedNumber x
]
data Quanto = Quanto
{ quanto_fxRate :: [FxRate]
, quanto_fxSpotRateSource :: Maybe FxSpotRateSource
}
deriving (Eq,Show)
instance SchemaType Quanto where
parseSchemaType s = do
(pos,e) <- posnElement [s]
commit $ interior e $ return Quanto
`apply` many (parseSchemaType "fxRate")
`apply` optional (parseSchemaType "fxSpotRateSource")
schemaTypeToXML s x@Quanto{} =
toXMLElement s []
[ concatMap (schemaTypeToXML "fxRate") $ quanto_fxRate x
, maybe [] (schemaTypeToXML "fxSpotRateSource") $ quanto_fxSpotRateSource x
]
data Restructuring = Restructuring
{ restr_applicable :: Maybe Xsd.Boolean
, restructuring_type :: Maybe RestructuringType
, restr_multipleHolderObligation :: Maybe Xsd.Boolean
, restr_multipleCreditEventNotices :: Maybe Xsd.Boolean
}
deriving (Eq,Show)
instance SchemaType Restructuring where
parseSchemaType s = do
(pos,e) <- posnElement [s]
commit $ interior e $ return Restructuring
`apply` optional (parseSchemaType "applicable")
`apply` optional (parseSchemaType "restructuringType")
`apply` optional (parseSchemaType "multipleHolderObligation")
`apply` optional (parseSchemaType "multipleCreditEventNotices")
schemaTypeToXML s x@Restructuring{} =
toXMLElement s []
[ maybe [] (schemaTypeToXML "applicable") $ restr_applicable x
, maybe [] (schemaTypeToXML "restructuringType") $ restructuring_type x
, maybe [] (schemaTypeToXML "multipleHolderObligation") $ restr_multipleHolderObligation x
, maybe [] (schemaTypeToXML "multipleCreditEventNotices") $ restr_multipleCreditEventNotices x
]
data RestructuringType = RestructuringType Scheme RestructuringTypeAttributes deriving (Eq,Show)
data RestructuringTypeAttributes = RestructuringTypeAttributes
{ restrTypeAttrib_restructuringScheme :: Maybe Xsd.AnyURI
}
deriving (Eq,Show)
instance SchemaType RestructuringType where
parseSchemaType s = do
(pos,e) <- posnElement [s]
commit $ do
a0 <- optional $ getAttribute "restructuringScheme" e pos
reparse [CElem e pos]
v <- parseSchemaType s
return $ RestructuringType v (RestructuringTypeAttributes a0)
schemaTypeToXML s (RestructuringType bt at) =
addXMLAttributes [ maybe [] (toXMLAttribute "restructuringScheme") $ restrTypeAttrib_restructuringScheme at
]
$ schemaTypeToXML s bt
instance Extension RestructuringType Scheme where
supertype (RestructuringType s _) = s
data StrategyFeature = StrategyFeature
{ stratFeature_choice0 :: (Maybe (OneOf2 StrikeSpread CalendarSpread))
}
deriving (Eq,Show)
instance SchemaType StrategyFeature where
parseSchemaType s = do
(pos,e) <- posnElement [s]
commit $ interior e $ return StrategyFeature
`apply` optional (oneOf' [ ("StrikeSpread", fmap OneOf2 (parseSchemaType "strikeSpread"))
, ("CalendarSpread", fmap TwoOf2 (parseSchemaType "calendarSpread"))
])
schemaTypeToXML s x@StrategyFeature{} =
toXMLElement s []
[ maybe [] (foldOneOf2 (schemaTypeToXML "strikeSpread")
(schemaTypeToXML "calendarSpread")
) $ stratFeature_choice0 x
]
data StrikeSpread = StrikeSpread
{ strikeSpread_upperStrike :: Maybe OptionStrike
, strikeSpread_upperStrikeNumberOfOptions :: Maybe PositiveDecimal
}
deriving (Eq,Show)
instance SchemaType StrikeSpread where
parseSchemaType s = do
(pos,e) <- posnElement [s]
commit $ interior e $ return StrikeSpread
`apply` optional (parseSchemaType "upperStrike")
`apply` optional (parseSchemaType "upperStrikeNumberOfOptions")
schemaTypeToXML s x@StrikeSpread{} =
toXMLElement s []
[ maybe [] (schemaTypeToXML "upperStrike") $ strikeSpread_upperStrike x
, maybe [] (schemaTypeToXML "upperStrikeNumberOfOptions") $ strikeSpread_upperStrikeNumberOfOptions x
]
data Trigger = Trigger
{ trigger_choice0 :: OneOf3 Xsd.Decimal Xsd.Decimal ((Maybe (OneOf2 CreditEvents CreditEventsReference)))
, trigger_type :: Maybe TriggerTypeEnum
, trigger_timeType :: Maybe TriggerTimeTypeEnum
}
deriving (Eq,Show)
instance SchemaType Trigger where
parseSchemaType s = do
(pos,e) <- posnElement [s]
commit $ interior e $ return Trigger
`apply` oneOf' [ ("Xsd.Decimal", fmap OneOf3 (parseSchemaType "level"))
, ("Xsd.Decimal", fmap TwoOf3 (parseSchemaType "levelPercentage"))
, ("(Maybe (OneOf2 CreditEvents CreditEventsReference))", fmap ThreeOf3 (optional (oneOf' [ ("CreditEvents", fmap OneOf2 (parseSchemaType "creditEvents"))
, ("CreditEventsReference", fmap TwoOf2 (parseSchemaType "creditEventsReference"))
])))
]
`apply` optional (parseSchemaType "triggerType")
`apply` optional (parseSchemaType "triggerTimeType")
schemaTypeToXML s x@Trigger{} =
toXMLElement s []
[ foldOneOf3 (schemaTypeToXML "level")
(schemaTypeToXML "levelPercentage")
(maybe [] (foldOneOf2 (schemaTypeToXML "creditEvents")
(schemaTypeToXML "creditEventsReference")
))
$ trigger_choice0 x
, maybe [] (schemaTypeToXML "triggerType") $ trigger_type x
, maybe [] (schemaTypeToXML "triggerTimeType") $ trigger_timeType x
]
data TriggerEvent = TriggerEvent
{ triggerEvent_schedule :: [AveragingSchedule]
, triggerEvent_triggerDates :: Maybe DateList
, triggerEvent_trigger :: Maybe Trigger
, triggerEvent_featurePayment :: Maybe FeaturePayment
}
deriving (Eq,Show)
instance SchemaType TriggerEvent where
parseSchemaType s = do
(pos,e) <- posnElement [s]
commit $ interior e $ return TriggerEvent
`apply` many (parseSchemaType "schedule")
`apply` optional (parseSchemaType "triggerDates")
`apply` optional (parseSchemaType "trigger")
`apply` optional (parseSchemaType "featurePayment")
schemaTypeToXML s x@TriggerEvent{} =
toXMLElement s []
[ concatMap (schemaTypeToXML "schedule") $ triggerEvent_schedule x
, maybe [] (schemaTypeToXML "triggerDates") $ triggerEvent_triggerDates x
, maybe [] (schemaTypeToXML "trigger") $ triggerEvent_trigger x
, maybe [] (schemaTypeToXML "featurePayment") $ triggerEvent_featurePayment x
]
data WeightedAveragingObservation = WeightedAveragingObservation
{ weightAveragObserv_choice0 :: (Maybe (OneOf2 Xsd.DateTime Xsd.PositiveInteger))
, weightAveragObserv_weight :: Maybe NonNegativeDecimal
}
deriving (Eq,Show)
instance SchemaType WeightedAveragingObservation where
parseSchemaType s = do
(pos,e) <- posnElement [s]
commit $ interior e $ return WeightedAveragingObservation
`apply` optional (oneOf' [ ("Xsd.DateTime", fmap OneOf2 (parseSchemaType "dateTime"))
, ("Xsd.PositiveInteger", fmap TwoOf2 (parseSchemaType "observationNumber"))
])
`apply` optional (parseSchemaType "weight")
schemaTypeToXML s x@WeightedAveragingObservation{} =
toXMLElement s []
[ maybe [] (foldOneOf2 (schemaTypeToXML "dateTime")
(schemaTypeToXML "observationNumber")
) $ weightAveragObserv_choice0 x
, maybe [] (schemaTypeToXML "weight") $ weightAveragObserv_weight x
]