module Data.FpML.V53.Riskdef
( module Data.FpML.V53.Riskdef
, module Data.FpML.V53.Doc
, module Data.FpML.V53.Asset
, module Data.FpML.V53.Mktenv
) 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.Doc
import Data.FpML.V53.Asset
import Data.FpML.V53.Mktenv ( elementYieldCurve, elementToXMLYieldCurve )
import Data.FpML.V53.Mktenv ( elementVolatilityRepresentation, elementToXMLVolatilityRepresentation )
import Data.FpML.V53.Mktenv ( elementFxCurve, elementToXMLFxCurve )
import Data.FpML.V53.Mktenv ( elementCreditCurve, elementToXMLCreditCurve )
import Data.FpML.V53.Mktenv ( elementYieldCurveValuation, elementToXMLYieldCurveValuation )
import Data.FpML.V53.Mktenv ( elementVolatilityMatrixValuation, elementToXMLVolatilityMatrixValuation )
import Data.FpML.V53.Mktenv ( elementFxCurveValuation, elementToXMLFxCurveValuation )
import Data.FpML.V53.Mktenv ( elementCreditCurveValuation, elementToXMLCreditCurveValuation )
data AssetOrTermPointOrPricingStructureReference = AssetOrTermPointOrPricingStructureReference
{ aotpopsr_href :: Xsd.IDREF
}
deriving (Eq,Show)
instance SchemaType AssetOrTermPointOrPricingStructureReference where
parseSchemaType s = do
(pos,e) <- posnElement [s]
a0 <- getAttribute "href" e pos
commit $ interior e $ return (AssetOrTermPointOrPricingStructureReference a0)
schemaTypeToXML s x@AssetOrTermPointOrPricingStructureReference{} =
toXMLElement s [ toXMLAttribute "href" $ aotpopsr_href x
]
[]
instance Extension AssetOrTermPointOrPricingStructureReference Reference where
supertype v = Reference_AssetOrTermPointOrPricingStructureReference v
data BasicAssetValuation = BasicAssetValuation
{ basicAssetVal_ID :: Maybe Xsd.ID
, basicAssetVal_definitionRef :: Maybe Xsd.IDREF
, basicAssetVal_objectReference :: Maybe AnyAssetReference
, basicAssetVal_valuationScenarioReference :: Maybe ValuationScenarioReference
, basicAssetVal_quote :: [BasicQuotation]
}
deriving (Eq,Show)
instance SchemaType BasicAssetValuation where
parseSchemaType s = do
(pos,e) <- posnElement [s]
a0 <- optional $ getAttribute "id" e pos
a1 <- optional $ getAttribute "definitionRef" e pos
commit $ interior e $ return (BasicAssetValuation a0 a1)
`apply` optional (parseSchemaType "objectReference")
`apply` optional (parseSchemaType "valuationScenarioReference")
`apply` many (parseSchemaType "quote")
schemaTypeToXML s x@BasicAssetValuation{} =
toXMLElement s [ maybe [] (toXMLAttribute "id") $ basicAssetVal_ID x
, maybe [] (toXMLAttribute "definitionRef") $ basicAssetVal_definitionRef x
]
[ maybe [] (schemaTypeToXML "objectReference") $ basicAssetVal_objectReference x
, maybe [] (schemaTypeToXML "valuationScenarioReference") $ basicAssetVal_valuationScenarioReference x
, concatMap (schemaTypeToXML "quote") $ basicAssetVal_quote x
]
instance Extension BasicAssetValuation Valuation where
supertype (BasicAssetValuation a0 a1 e0 e1 e2) =
Valuation a0 a1 e0 e1
data DenominatorTerm = DenominatorTerm
{ denomTerm_weightedPartial :: Maybe WeightedPartialDerivative
, denomTerm_power :: Maybe Xsd.PositiveInteger
}
deriving (Eq,Show)
instance SchemaType DenominatorTerm where
parseSchemaType s = do
(pos,e) <- posnElement [s]
commit $ interior e $ return DenominatorTerm
`apply` optional (parseSchemaType "weightedPartial")
`apply` optional (parseSchemaType "power")
schemaTypeToXML s x@DenominatorTerm{} =
toXMLElement s []
[ maybe [] (schemaTypeToXML "weightedPartial") $ denomTerm_weightedPartial x
, maybe [] (schemaTypeToXML "power") $ denomTerm_power x
]
data DerivativeCalculationMethod = DerivativeCalculationMethod Scheme DerivativeCalculationMethodAttributes deriving (Eq,Show)
data DerivativeCalculationMethodAttributes = DerivativeCalculationMethodAttributes
{ dcma_derivativeCalculationMethodScheme :: Maybe Xsd.AnyURI
}
deriving (Eq,Show)
instance SchemaType DerivativeCalculationMethod where
parseSchemaType s = do
(pos,e) <- posnElement [s]
commit $ do
a0 <- optional $ getAttribute "derivativeCalculationMethodScheme" e pos
reparse [CElem e pos]
v <- parseSchemaType s
return $ DerivativeCalculationMethod v (DerivativeCalculationMethodAttributes a0)
schemaTypeToXML s (DerivativeCalculationMethod bt at) =
addXMLAttributes [ maybe [] (toXMLAttribute "derivativeCalculationMethodScheme") $ dcma_derivativeCalculationMethodScheme at
]
$ schemaTypeToXML s bt
instance Extension DerivativeCalculationMethod Scheme where
supertype (DerivativeCalculationMethod s _) = s
data DerivativeCalculationProcedure = DerivativeCalculationProcedure
{ derivCalcProced_method :: Maybe DerivativeCalculationMethod
, derivCalcProced_choice1 :: (Maybe (OneOf3 ((Maybe (Xsd.Decimal)),(Maybe (Xsd.Boolean)),(Maybe (PerturbationType))) Xsd.XsdString PricingStructureReference))
}
deriving (Eq,Show)
instance SchemaType DerivativeCalculationProcedure where
parseSchemaType s = do
(pos,e) <- posnElement [s]
commit $ interior e $ return DerivativeCalculationProcedure
`apply` optional (parseSchemaType "method")
`apply` optional (oneOf' [ ("Maybe Xsd.Decimal Maybe Xsd.Boolean Maybe PerturbationType", fmap OneOf3 (return (,,) `apply` optional (parseSchemaType "perturbationAmount")
`apply` optional (parseSchemaType "averaged")
`apply` optional (parseSchemaType "perturbationType")))
, ("Xsd.XsdString", fmap TwoOf3 (parseSchemaType "derivativeFormula"))
, ("PricingStructureReference", fmap ThreeOf3 (parseSchemaType "replacementMarketInput"))
])
schemaTypeToXML s x@DerivativeCalculationProcedure{} =
toXMLElement s []
[ maybe [] (schemaTypeToXML "method") $ derivCalcProced_method x
, maybe [] (foldOneOf3 (\ (a,b,c) -> concat [ maybe [] (schemaTypeToXML "perturbationAmount") a
, maybe [] (schemaTypeToXML "averaged") b
, maybe [] (schemaTypeToXML "perturbationType") c
])
(schemaTypeToXML "derivativeFormula")
(schemaTypeToXML "replacementMarketInput")
) $ derivCalcProced_choice1 x
]
data DerivativeFormula = DerivativeFormula
{ derivFormula_term :: Maybe FormulaTerm
, derivFormula_denominatorTerm :: Maybe DenominatorTerm
}
deriving (Eq,Show)
instance SchemaType DerivativeFormula where
parseSchemaType s = do
(pos,e) <- posnElement [s]
commit $ interior e $ return DerivativeFormula
`apply` optional (parseSchemaType "term")
`apply` optional (parseSchemaType "denominatorTerm")
schemaTypeToXML s x@DerivativeFormula{} =
toXMLElement s []
[ maybe [] (schemaTypeToXML "term") $ derivFormula_term x
, maybe [] (schemaTypeToXML "denominatorTerm") $ derivFormula_denominatorTerm x
]
data FormulaTerm = FormulaTerm
{ formulaTerm_coefficient :: Maybe Xsd.Decimal
, formulaTerm_partialDerivativeReference :: [PricingParameterDerivativeReference]
}
deriving (Eq,Show)
instance SchemaType FormulaTerm where
parseSchemaType s = do
(pos,e) <- posnElement [s]
commit $ interior e $ return FormulaTerm
`apply` optional (parseSchemaType "coefficient")
`apply` many (parseSchemaType "partialDerivativeReference")
schemaTypeToXML s x@FormulaTerm{} =
toXMLElement s []
[ maybe [] (schemaTypeToXML "coefficient") $ formulaTerm_coefficient x
, concatMap (schemaTypeToXML "partialDerivativeReference") $ formulaTerm_partialDerivativeReference x
]
data GenericDimension = GenericDimension Xsd.XsdString GenericDimensionAttributes deriving (Eq,Show)
data GenericDimensionAttributes = GenericDimensionAttributes
{ genericDimensAttrib_name :: Xsd.NormalizedString
, genericDimensAttrib_href :: Maybe Xsd.IDREF
}
deriving (Eq,Show)
instance SchemaType GenericDimension where
parseSchemaType s = do
(pos,e) <- posnElement [s]
commit $ do
a0 <- getAttribute "name" e pos
a1 <- optional $ getAttribute "href" e pos
reparse [CElem e pos]
v <- parseSchemaType s
return $ GenericDimension v (GenericDimensionAttributes a0 a1)
schemaTypeToXML s (GenericDimension bt at) =
addXMLAttributes [ toXMLAttribute "name" $ genericDimensAttrib_name at
, maybe [] (toXMLAttribute "href") $ genericDimensAttrib_href at
]
$ schemaTypeToXML s bt
instance Extension GenericDimension Xsd.XsdString where
supertype (GenericDimension s _) = s
data InstrumentSet = InstrumentSet
{ instrSet_choice0 :: (Maybe (OneOf2 Asset Asset))
}
deriving (Eq,Show)
instance SchemaType InstrumentSet where
parseSchemaType s = do
(pos,e) <- posnElement [s]
commit $ interior e $ return InstrumentSet
`apply` optional (oneOf' [ ("Asset", fmap OneOf2 (elementUnderlyingAsset))
, ("Asset", fmap TwoOf2 (elementCurveInstrument))
])
schemaTypeToXML s x@InstrumentSet{} =
toXMLElement s []
[ maybe [] (foldOneOf2 (elementToXMLUnderlyingAsset)
(elementToXMLCurveInstrument)
) $ instrSet_choice0 x
]
data Market = Market
{ market_ID :: Maybe Xsd.ID
, market_name :: Maybe Xsd.XsdString
, market_benchmarkQuotes :: Maybe QuotedAssetSet
, market_pricingStructure :: [PricingStructure]
, market_pricingStructureValuation :: [PricingStructureValuation]
, market_benchmarkPricingMethod :: [PricingMethod]
}
deriving (Eq,Show)
instance SchemaType Market where
parseSchemaType s = do
(pos,e) <- posnElement [s]
a0 <- optional $ getAttribute "id" e pos
commit $ interior e $ return (Market a0)
`apply` optional (parseSchemaType "name")
`apply` optional (parseSchemaType "benchmarkQuotes")
`apply` many (elementPricingStructure)
`apply` many (elementPricingStructureValuation)
`apply` many (parseSchemaType "benchmarkPricingMethod")
schemaTypeToXML s x@Market{} =
toXMLElement s [ maybe [] (toXMLAttribute "id") $ market_ID x
]
[ maybe [] (schemaTypeToXML "name") $ market_name x
, maybe [] (schemaTypeToXML "benchmarkQuotes") $ market_benchmarkQuotes x
, concatMap (elementToXMLPricingStructure) $ market_pricingStructure x
, concatMap (elementToXMLPricingStructureValuation) $ market_pricingStructureValuation x
, concatMap (schemaTypeToXML "benchmarkPricingMethod") $ market_benchmarkPricingMethod x
]
data MarketReference = MarketReference
{ marketRef_href :: Xsd.IDREF
}
deriving (Eq,Show)
instance SchemaType MarketReference where
parseSchemaType s = do
(pos,e) <- posnElement [s]
a0 <- getAttribute "href" e pos
commit $ interior e $ return (MarketReference a0)
schemaTypeToXML s x@MarketReference{} =
toXMLElement s [ toXMLAttribute "href" $ marketRef_href x
]
[]
instance Extension MarketReference Reference where
supertype v = Reference_MarketReference v
data PerturbationType = PerturbationType Scheme PerturbationTypeAttributes deriving (Eq,Show)
data PerturbationTypeAttributes = PerturbationTypeAttributes
{ perturTypeAttrib_perturbationTypeScheme :: Maybe Xsd.AnyURI
}
deriving (Eq,Show)
instance SchemaType PerturbationType where
parseSchemaType s = do
(pos,e) <- posnElement [s]
commit $ do
a0 <- optional $ getAttribute "perturbationTypeScheme" e pos
reparse [CElem e pos]
v <- parseSchemaType s
return $ PerturbationType v (PerturbationTypeAttributes a0)
schemaTypeToXML s (PerturbationType bt at) =
addXMLAttributes [ maybe [] (toXMLAttribute "perturbationTypeScheme") $ perturTypeAttrib_perturbationTypeScheme at
]
$ schemaTypeToXML s bt
instance Extension PerturbationType Scheme where
supertype (PerturbationType s _) = s
data PositionId = PositionId Scheme PositionIdAttributes deriving (Eq,Show)
data PositionIdAttributes = PositionIdAttributes
{ positIdAttrib_positionIdScheme :: Maybe Xsd.AnyURI
, positIdAttrib_ID :: Maybe Xsd.ID
}
deriving (Eq,Show)
instance SchemaType PositionId where
parseSchemaType s = do
(pos,e) <- posnElement [s]
commit $ do
a0 <- optional $ getAttribute "positionIdScheme" e pos
a1 <- optional $ getAttribute "id" e pos
reparse [CElem e pos]
v <- parseSchemaType s
return $ PositionId v (PositionIdAttributes a0 a1)
schemaTypeToXML s (PositionId bt at) =
addXMLAttributes [ maybe [] (toXMLAttribute "positionIdScheme") $ positIdAttrib_positionIdScheme at
, maybe [] (toXMLAttribute "id") $ positIdAttrib_ID at
]
$ schemaTypeToXML s bt
instance Extension PositionId Scheme where
supertype (PositionId s _) = s
data PricingInputReplacement = PricingInputReplacement
{ pricingInputReplac_originalInputReference :: Maybe PricingStructureReference
, pricingInputReplac_replacementInputReference :: Maybe PricingStructureReference
}
deriving (Eq,Show)
instance SchemaType PricingInputReplacement where
parseSchemaType s = do
(pos,e) <- posnElement [s]
commit $ interior e $ return PricingInputReplacement
`apply` optional (parseSchemaType "originalInputReference")
`apply` optional (parseSchemaType "replacementInputReference")
schemaTypeToXML s x@PricingInputReplacement{} =
toXMLElement s []
[ maybe [] (schemaTypeToXML "originalInputReference") $ pricingInputReplac_originalInputReference x
, maybe [] (schemaTypeToXML "replacementInputReference") $ pricingInputReplac_replacementInputReference x
]
data PricingInputType = PricingInputType Scheme PricingInputTypeAttributes deriving (Eq,Show)
data PricingInputTypeAttributes = PricingInputTypeAttributes
{ pricingInputTypeAttrib_pricingInputTypeScheme :: Maybe Xsd.AnyURI
}
deriving (Eq,Show)
instance SchemaType PricingInputType where
parseSchemaType s = do
(pos,e) <- posnElement [s]
commit $ do
a0 <- optional $ getAttribute "pricingInputTypeScheme" e pos
reparse [CElem e pos]
v <- parseSchemaType s
return $ PricingInputType v (PricingInputTypeAttributes a0)
schemaTypeToXML s (PricingInputType bt at) =
addXMLAttributes [ maybe [] (toXMLAttribute "pricingInputTypeScheme") $ pricingInputTypeAttrib_pricingInputTypeScheme at
]
$ schemaTypeToXML s bt
instance Extension PricingInputType Scheme where
supertype (PricingInputType s _) = s
data PricingDataPointCoordinate = PricingDataPointCoordinate
{ pricingDataPointCoord_ID :: Maybe Xsd.ID
, pricingDataPointCoord_choice0 :: (Maybe (OneOf4 TimeDimension TimeDimension Xsd.Decimal GenericDimension))
}
deriving (Eq,Show)
instance SchemaType PricingDataPointCoordinate where
parseSchemaType s = do
(pos,e) <- posnElement [s]
a0 <- optional $ getAttribute "id" e pos
commit $ interior e $ return (PricingDataPointCoordinate a0)
`apply` optional (oneOf' [ ("TimeDimension", fmap OneOf4 (parseSchemaType "term"))
, ("TimeDimension", fmap TwoOf4 (parseSchemaType "expiration"))
, ("Xsd.Decimal", fmap ThreeOf4 (parseSchemaType "strike"))
, ("GenericDimension", fmap FourOf4 (parseSchemaType "generic"))
])
schemaTypeToXML s x@PricingDataPointCoordinate{} =
toXMLElement s [ maybe [] (toXMLAttribute "id") $ pricingDataPointCoord_ID x
]
[ maybe [] (foldOneOf4 (schemaTypeToXML "term")
(schemaTypeToXML "expiration")
(schemaTypeToXML "strike")
(schemaTypeToXML "generic")
) $ pricingDataPointCoord_choice0 x
]
data PricingDataPointCoordinateReference = PricingDataPointCoordinateReference
{ pdpcr_href :: Xsd.IDREF
}
deriving (Eq,Show)
instance SchemaType PricingDataPointCoordinateReference where
parseSchemaType s = do
(pos,e) <- posnElement [s]
a0 <- getAttribute "href" e pos
commit $ interior e $ return (PricingDataPointCoordinateReference a0)
schemaTypeToXML s x@PricingDataPointCoordinateReference{} =
toXMLElement s [ toXMLAttribute "href" $ pdpcr_href x
]
[]
instance Extension PricingDataPointCoordinateReference Reference where
supertype v = Reference_PricingDataPointCoordinateReference v
data PricingMethod = PricingMethod
{ pricingMethod_assetReference :: Maybe AnyAssetReference
, pricingMethod_pricingInputReference :: Maybe PricingStructureReference
}
deriving (Eq,Show)
instance SchemaType PricingMethod where
parseSchemaType s = do
(pos,e) <- posnElement [s]
commit $ interior e $ return PricingMethod
`apply` optional (parseSchemaType "assetReference")
`apply` optional (parseSchemaType "pricingInputReference")
schemaTypeToXML s x@PricingMethod{} =
toXMLElement s []
[ maybe [] (schemaTypeToXML "assetReference") $ pricingMethod_assetReference x
, maybe [] (schemaTypeToXML "pricingInputReference") $ pricingMethod_pricingInputReference x
]
data PricingParameterDerivative = PricingParameterDerivative
{ pricingParamDeriv_ID :: Maybe Xsd.ID
, pricingParamDeriv_description :: Maybe Xsd.XsdString
, pricingParamDeriv_choice1 :: (Maybe (OneOf2 AssetOrTermPointOrPricingStructureReference [ValuationReference]))
, pricingParamDeriv_calculationProcedure :: Maybe DerivativeCalculationProcedure
}
deriving (Eq,Show)
instance SchemaType PricingParameterDerivative where
parseSchemaType s = do
(pos,e) <- posnElement [s]
a0 <- optional $ getAttribute "id" e pos
commit $ interior e $ return (PricingParameterDerivative a0)
`apply` optional (parseSchemaType "description")
`apply` optional (oneOf' [ ("AssetOrTermPointOrPricingStructureReference", fmap OneOf2 (parseSchemaType "parameterReference"))
, ("[ValuationReference]", fmap TwoOf2 (many1 (parseSchemaType "inputDateReference")))
])
`apply` optional (parseSchemaType "calculationProcedure")
schemaTypeToXML s x@PricingParameterDerivative{} =
toXMLElement s [ maybe [] (toXMLAttribute "id") $ pricingParamDeriv_ID x
]
[ maybe [] (schemaTypeToXML "description") $ pricingParamDeriv_description x
, maybe [] (foldOneOf2 (schemaTypeToXML "parameterReference")
(concatMap (schemaTypeToXML "inputDateReference"))
) $ pricingParamDeriv_choice1 x
, maybe [] (schemaTypeToXML "calculationProcedure") $ pricingParamDeriv_calculationProcedure x
]
data PricingParameterDerivativeReference = PricingParameterDerivativeReference
{ ppdr_href :: Xsd.IDREF
}
deriving (Eq,Show)
instance SchemaType PricingParameterDerivativeReference where
parseSchemaType s = do
(pos,e) <- posnElement [s]
a0 <- getAttribute "href" e pos
commit $ interior e $ return (PricingParameterDerivativeReference a0)
schemaTypeToXML s x@PricingParameterDerivativeReference{} =
toXMLElement s [ toXMLAttribute "href" $ ppdr_href x
]
[]
instance Extension PricingParameterDerivativeReference Reference where
supertype v = Reference_PricingParameterDerivativeReference v
data PricingParameterShift = PricingParameterShift
{ pricingParamShift_ID :: Maybe Xsd.ID
, pricingParamShift_parameterReference :: Maybe AssetOrTermPointOrPricingStructureReference
, pricingParamShift_shift :: Maybe Xsd.Decimal
, pricingParamShift_shiftUnits :: Maybe PriceQuoteUnits
}
deriving (Eq,Show)
instance SchemaType PricingParameterShift where
parseSchemaType s = do
(pos,e) <- posnElement [s]
a0 <- optional $ getAttribute "id" e pos
commit $ interior e $ return (PricingParameterShift a0)
`apply` optional (parseSchemaType "parameterReference")
`apply` optional (parseSchemaType "shift")
`apply` optional (parseSchemaType "shiftUnits")
schemaTypeToXML s x@PricingParameterShift{} =
toXMLElement s [ maybe [] (toXMLAttribute "id") $ pricingParamShift_ID x
]
[ maybe [] (schemaTypeToXML "parameterReference") $ pricingParamShift_parameterReference x
, maybe [] (schemaTypeToXML "shift") $ pricingParamShift_shift x
, maybe [] (schemaTypeToXML "shiftUnits") $ pricingParamShift_shiftUnits x
]
data PricingStructureValuation = PricingStructureValuation
{ pricingStructVal_ID :: Maybe Xsd.ID
, pricingStructVal_definitionRef :: Maybe Xsd.IDREF
, pricingStructVal_objectReference :: Maybe AnyAssetReference
, pricingStructVal_valuationScenarioReference :: Maybe ValuationScenarioReference
, pricingStructVal_baseDate :: Maybe IdentifiedDate
, pricingStructVal_spotDate :: Maybe IdentifiedDate
, pricingStructVal_inputDataDate :: Maybe IdentifiedDate
, pricingStructVal_endDate :: Maybe IdentifiedDate
, pricingStructVal_buildDateTime :: Maybe Xsd.DateTime
}
deriving (Eq,Show)
instance SchemaType PricingStructureValuation where
parseSchemaType s = do
(pos,e) <- posnElement [s]
a0 <- optional $ getAttribute "id" e pos
a1 <- optional $ getAttribute "definitionRef" e pos
commit $ interior e $ return (PricingStructureValuation a0 a1)
`apply` optional (parseSchemaType "objectReference")
`apply` optional (parseSchemaType "valuationScenarioReference")
`apply` optional (parseSchemaType "baseDate")
`apply` optional (parseSchemaType "spotDate")
`apply` optional (parseSchemaType "inputDataDate")
`apply` optional (parseSchemaType "endDate")
`apply` optional (parseSchemaType "buildDateTime")
schemaTypeToXML s x@PricingStructureValuation{} =
toXMLElement s [ maybe [] (toXMLAttribute "id") $ pricingStructVal_ID x
, maybe [] (toXMLAttribute "definitionRef") $ pricingStructVal_definitionRef x
]
[ maybe [] (schemaTypeToXML "objectReference") $ pricingStructVal_objectReference x
, maybe [] (schemaTypeToXML "valuationScenarioReference") $ pricingStructVal_valuationScenarioReference x
, maybe [] (schemaTypeToXML "baseDate") $ pricingStructVal_baseDate x
, maybe [] (schemaTypeToXML "spotDate") $ pricingStructVal_spotDate x
, maybe [] (schemaTypeToXML "inputDataDate") $ pricingStructVal_inputDataDate x
, maybe [] (schemaTypeToXML "endDate") $ pricingStructVal_endDate x
, maybe [] (schemaTypeToXML "buildDateTime") $ pricingStructVal_buildDateTime x
]
instance Extension PricingStructureValuation Valuation where
supertype (PricingStructureValuation a0 a1 e0 e1 e2 e3 e4 e5 e6) =
Valuation a0 a1 e0 e1
data QuotedAssetSet = QuotedAssetSet
{ quotedAssetSet_instrumentSet :: Maybe InstrumentSet
, quotedAssetSet_assetQuote :: [BasicAssetValuation]
}
deriving (Eq,Show)
instance SchemaType QuotedAssetSet where
parseSchemaType s = do
(pos,e) <- posnElement [s]
commit $ interior e $ return QuotedAssetSet
`apply` optional (parseSchemaType "instrumentSet")
`apply` many (parseSchemaType "assetQuote")
schemaTypeToXML s x@QuotedAssetSet{} =
toXMLElement s []
[ maybe [] (schemaTypeToXML "instrumentSet") $ quotedAssetSet_instrumentSet x
, concatMap (schemaTypeToXML "assetQuote") $ quotedAssetSet_assetQuote x
]
data SensitivityDefinition = SensitivityDefinition
{ sensitDefin_ID :: Maybe Xsd.ID
, sensitDefin_name :: Maybe Xsd.XsdString
, sensitDefin_valuationScenarioReference :: Maybe ValuationScenarioReference
, sensitDefin_choice2 :: OneOf2 ([PricingParameterDerivative],(Maybe (DerivativeFormula))) (OneOf2 TimeDimension ((Maybe (OneOf2 PricingDataPointCoordinate PricingDataPointCoordinateReference))))
}
deriving (Eq,Show)
instance SchemaType SensitivityDefinition where
parseSchemaType s = do
(pos,e) <- posnElement [s]
a0 <- optional $ getAttribute "id" e pos
commit $ interior e $ return (SensitivityDefinition a0)
`apply` optional (parseSchemaType "name")
`apply` optional (parseSchemaType "valuationScenarioReference")
`apply` oneOf' [ ("[PricingParameterDerivative] Maybe DerivativeFormula", fmap OneOf2 (return (,) `apply` many (parseSchemaType "partialDerivative")
`apply` optional (parseSchemaType "formula")))
, ("OneOf2 TimeDimension ((Maybe (OneOf2 PricingDataPointCoordinate PricingDataPointCoordinateReference)))", fmap TwoOf2 (oneOf' [ ("TimeDimension", fmap OneOf2 (parseSchemaType "term"))
, ("(Maybe (OneOf2 PricingDataPointCoordinate PricingDataPointCoordinateReference))", fmap TwoOf2 (optional (oneOf' [ ("PricingDataPointCoordinate", fmap OneOf2 (parseSchemaType "coordinate"))
, ("PricingDataPointCoordinateReference", fmap TwoOf2 (parseSchemaType "coordinateReference"))
])))
]))
]
schemaTypeToXML s x@SensitivityDefinition{} =
toXMLElement s [ maybe [] (toXMLAttribute "id") $ sensitDefin_ID x
]
[ maybe [] (schemaTypeToXML "name") $ sensitDefin_name x
, maybe [] (schemaTypeToXML "valuationScenarioReference") $ sensitDefin_valuationScenarioReference x
, foldOneOf2 (\ (a,b) -> concat [ concatMap (schemaTypeToXML "partialDerivative") a
, maybe [] (schemaTypeToXML "formula") b
])
(foldOneOf2 (schemaTypeToXML "term")
(maybe [] (foldOneOf2 (schemaTypeToXML "coordinate")
(schemaTypeToXML "coordinateReference")
))
)
$ sensitDefin_choice2 x
]
data SensitivitySetDefinition = SensitivitySetDefinition
{ sensitSetDefin_ID :: Maybe Xsd.ID
, sensitSetDefin_name :: Maybe Xsd.XsdString
, sensitSetDefin_sensitivityCharacteristics :: Maybe QuotationCharacteristics
, sensitSetDefin_valuationScenarioReference :: Maybe ValuationScenarioReference
, sensitSetDefin_pricingInputType :: Maybe PricingInputType
, sensitSetDefin_pricingInputReference :: Maybe PricingStructureReference
, sensitSetDefin_scale :: Maybe Xsd.Decimal
, sensitSetDefin_sensitivityDefinition :: [SensitivityDefinition]
, sensitSetDefin_calculationProcedure :: Maybe DerivativeCalculationProcedure
}
deriving (Eq,Show)
instance SchemaType SensitivitySetDefinition where
parseSchemaType s = do
(pos,e) <- posnElement [s]
a0 <- optional $ getAttribute "id" e pos
commit $ interior e $ return (SensitivitySetDefinition a0)
`apply` optional (parseSchemaType "name")
`apply` optional (parseSchemaType "sensitivityCharacteristics")
`apply` optional (parseSchemaType "valuationScenarioReference")
`apply` optional (parseSchemaType "pricingInputType")
`apply` optional (parseSchemaType "pricingInputReference")
`apply` optional (parseSchemaType "scale")
`apply` many (parseSchemaType "sensitivityDefinition")
`apply` optional (parseSchemaType "calculationProcedure")
schemaTypeToXML s x@SensitivitySetDefinition{} =
toXMLElement s [ maybe [] (toXMLAttribute "id") $ sensitSetDefin_ID x
]
[ maybe [] (schemaTypeToXML "name") $ sensitSetDefin_name x
, maybe [] (schemaTypeToXML "sensitivityCharacteristics") $ sensitSetDefin_sensitivityCharacteristics x
, maybe [] (schemaTypeToXML "valuationScenarioReference") $ sensitSetDefin_valuationScenarioReference x
, maybe [] (schemaTypeToXML "pricingInputType") $ sensitSetDefin_pricingInputType x
, maybe [] (schemaTypeToXML "pricingInputReference") $ sensitSetDefin_pricingInputReference x
, maybe [] (schemaTypeToXML "scale") $ sensitSetDefin_scale x
, concatMap (schemaTypeToXML "sensitivityDefinition") $ sensitSetDefin_sensitivityDefinition x
, maybe [] (schemaTypeToXML "calculationProcedure") $ sensitSetDefin_calculationProcedure x
]
data SensitivitySetDefinitionReference = SensitivitySetDefinitionReference
{ sensitSetDefinRef_href :: Xsd.IDREF
}
deriving (Eq,Show)
instance SchemaType SensitivitySetDefinitionReference where
parseSchemaType s = do
(pos,e) <- posnElement [s]
a0 <- getAttribute "href" e pos
commit $ interior e $ return (SensitivitySetDefinitionReference a0)
schemaTypeToXML s x@SensitivitySetDefinitionReference{} =
toXMLElement s [ toXMLAttribute "href" $ sensitSetDefinRef_href x
]
[]
instance Extension SensitivitySetDefinitionReference Reference where
supertype v = Reference_SensitivitySetDefinitionReference v
data TimeDimension = TimeDimension
{ timeDimens_choice0 :: (Maybe (OneOf1 ((Maybe (Xsd.Date)),(Maybe (Period)))))
}
deriving (Eq,Show)
instance SchemaType TimeDimension where
parseSchemaType s = do
(pos,e) <- posnElement [s]
commit $ interior e $ return TimeDimension
`apply` optional (oneOf' [ ("Maybe Xsd.Date Maybe Period", fmap OneOf1 (return (,) `apply` optional (parseSchemaType "date")
`apply` optional (parseSchemaType "tenor")))
])
schemaTypeToXML s x@TimeDimension{} =
toXMLElement s []
[ maybe [] (foldOneOf1 (\ (a,b) -> concat [ maybe [] (schemaTypeToXML "date") a
, maybe [] (schemaTypeToXML "tenor") b
])
) $ timeDimens_choice0 x
]
data Valuation = Valuation
{ valuation_ID :: Maybe Xsd.ID
, valuation_definitionRef :: Maybe Xsd.IDREF
, valuation_objectReference :: Maybe AnyAssetReference
, valuation_scenarioReference :: Maybe ValuationScenarioReference
}
deriving (Eq,Show)
instance SchemaType Valuation where
parseSchemaType s = do
(pos,e) <- posnElement [s]
a0 <- optional $ getAttribute "id" e pos
a1 <- optional $ getAttribute "definitionRef" e pos
commit $ interior e $ return (Valuation a0 a1)
`apply` optional (parseSchemaType "objectReference")
`apply` optional (parseSchemaType "valuationScenarioReference")
schemaTypeToXML s x@Valuation{} =
toXMLElement s [ maybe [] (toXMLAttribute "id") $ valuation_ID x
, maybe [] (toXMLAttribute "definitionRef") $ valuation_definitionRef x
]
[ maybe [] (schemaTypeToXML "objectReference") $ valuation_objectReference x
, maybe [] (schemaTypeToXML "valuationScenarioReference") $ valuation_scenarioReference x
]
data ValuationReference = ValuationReference
{ valRef_href :: Xsd.IDREF
}
deriving (Eq,Show)
instance SchemaType ValuationReference where
parseSchemaType s = do
(pos,e) <- posnElement [s]
a0 <- getAttribute "href" e pos
commit $ interior e $ return (ValuationReference a0)
schemaTypeToXML s x@ValuationReference{} =
toXMLElement s [ toXMLAttribute "href" $ valRef_href x
]
[]
instance Extension ValuationReference Reference where
supertype v = Reference_ValuationReference v
data ValuationScenario = ValuationScenario
{ valScenar_ID :: Maybe Xsd.ID
, valScenar_name :: Maybe Xsd.XsdString
, valScenar_valuationDate :: Maybe IdentifiedDate
, valScenar_marketReference :: Maybe MarketReference
, valScenar_shift :: [PricingParameterShift]
, valScenar_replacement :: [PricingInputReplacement]
}
deriving (Eq,Show)
instance SchemaType ValuationScenario where
parseSchemaType s = do
(pos,e) <- posnElement [s]
a0 <- optional $ getAttribute "id" e pos
commit $ interior e $ return (ValuationScenario a0)
`apply` optional (parseSchemaType "name")
`apply` optional (parseSchemaType "valuationDate")
`apply` optional (parseSchemaType "marketReference")
`apply` many (parseSchemaType "shift")
`apply` many (parseSchemaType "replacement")
schemaTypeToXML s x@ValuationScenario{} =
toXMLElement s [ maybe [] (toXMLAttribute "id") $ valScenar_ID x
]
[ maybe [] (schemaTypeToXML "name") $ valScenar_name x
, maybe [] (schemaTypeToXML "valuationDate") $ valScenar_valuationDate x
, maybe [] (schemaTypeToXML "marketReference") $ valScenar_marketReference x
, concatMap (schemaTypeToXML "shift") $ valScenar_shift x
, concatMap (schemaTypeToXML "replacement") $ valScenar_replacement x
]
data ValuationScenarioReference = ValuationScenarioReference
{ valScenarRef_href :: Xsd.IDREF
}
deriving (Eq,Show)
instance SchemaType ValuationScenarioReference where
parseSchemaType s = do
(pos,e) <- posnElement [s]
a0 <- getAttribute "href" e pos
commit $ interior e $ return (ValuationScenarioReference a0)
schemaTypeToXML s x@ValuationScenarioReference{} =
toXMLElement s [ toXMLAttribute "href" $ valScenarRef_href x
]
[]
instance Extension ValuationScenarioReference Reference where
supertype v = Reference_ValuationScenarioReference v
data WeightedPartialDerivative = WeightedPartialDerivative
{ weightPartialDeriv_partialDerivativeReference :: Maybe PricingParameterDerivativeReference
, weightPartialDeriv_weight :: Maybe Xsd.Decimal
}
deriving (Eq,Show)
instance SchemaType WeightedPartialDerivative where
parseSchemaType s = do
(pos,e) <- posnElement [s]
commit $ interior e $ return WeightedPartialDerivative
`apply` optional (parseSchemaType "partialDerivativeReference")
`apply` optional (parseSchemaType "weight")
schemaTypeToXML s x@WeightedPartialDerivative{} =
toXMLElement s []
[ maybe [] (schemaTypeToXML "partialDerivativeReference") $ weightPartialDeriv_partialDerivativeReference x
, maybe [] (schemaTypeToXML "weight") $ weightPartialDeriv_weight x
]
elementMarket :: XMLParser Market
elementMarket = parseSchemaType "market"
elementToXMLMarket :: Market -> [Content ()]
elementToXMLMarket = schemaTypeToXML "market"
elementPricingStructure :: XMLParser PricingStructure
elementPricingStructure = fmap supertype elementYieldCurve
`onFail`
fmap supertype elementVolatilityRepresentation
`onFail`
fmap supertype elementFxCurve
`onFail`
fmap supertype elementCreditCurve
`onFail` fail "Parse failed when expecting an element in the substitution group for\n\
\ <pricingStructure>,\n\
\ namely one of:\n\
\<yieldCurve>, <volatilityRepresentation>, <fxCurve>, <creditCurve>"
elementToXMLPricingStructure :: PricingStructure -> [Content ()]
elementToXMLPricingStructure = schemaTypeToXML "pricingStructure"
elementPricingStructureValuation :: XMLParser PricingStructureValuation
elementPricingStructureValuation = fmap supertype elementYieldCurveValuation
`onFail`
fmap supertype elementVolatilityMatrixValuation
`onFail`
fmap supertype elementFxCurveValuation
`onFail`
fmap supertype elementCreditCurveValuation
`onFail` fail "Parse failed when expecting an element in the substitution group for\n\
\ <pricingStructureValuation>,\n\
\ namely one of:\n\
\<yieldCurveValuation>, <volatilityMatrixValuation>, <fxCurveValuation>, <creditCurveValuation>"
elementToXMLPricingStructureValuation :: PricingStructureValuation -> [Content ()]
elementToXMLPricingStructureValuation = schemaTypeToXML "pricingStructureValuation"