module Data.FpML.V53.Reporting.Valuation
( module Data.FpML.V53.Reporting.Valuation
, module Data.FpML.V53.Events.Business
, module Data.FpML.V53.Valuation
) 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.Events.Business
import Data.FpML.V53.Valuation
data ReportContents = ReportContents
{ reportConten_partyReference :: Maybe PartyReference
, reportConten_accountReference :: Maybe AccountReference
, reportConten_category :: [TradeCategory]
, reportConten_primaryAssetClass :: Maybe AssetClass
, reportConten_secondaryAssetClass :: [AssetClass]
, reportConten_productType :: [ProductType]
, reportConten_queryPortfolio :: Maybe QueryPortfolio
}
deriving (Eq,Show)
instance SchemaType ReportContents where
parseSchemaType s = do
(pos,e) <- posnElement [s]
commit $ interior e $ return ReportContents
`apply` optional (parseSchemaType "partyReference")
`apply` optional (parseSchemaType "accountReference")
`apply` many (parseSchemaType "category")
`apply` optional (parseSchemaType "primaryAssetClass")
`apply` many (parseSchemaType "secondaryAssetClass")
`apply` many (parseSchemaType "productType")
`apply` optional (parseSchemaType "queryPortfolio")
schemaTypeToXML s x@ReportContents{} =
toXMLElement s []
[ maybe [] (schemaTypeToXML "partyReference") $ reportConten_partyReference x
, maybe [] (schemaTypeToXML "accountReference") $ reportConten_accountReference x
, concatMap (schemaTypeToXML "category") $ reportConten_category x
, maybe [] (schemaTypeToXML "primaryAssetClass") $ reportConten_primaryAssetClass x
, concatMap (schemaTypeToXML "secondaryAssetClass") $ reportConten_secondaryAssetClass x
, concatMap (schemaTypeToXML "productType") $ reportConten_productType x
, maybe [] (schemaTypeToXML "queryPortfolio") $ reportConten_queryPortfolio x
]
data PortfolioValuationItem = PortfolioValuationItem
{ portfValItem_portfolio :: Maybe Portfolio
, portfValItem_tradeValuationItem :: [TradeValuationItem]
, portfValItem_valuationSet :: Maybe ValuationSet
}
deriving (Eq,Show)
instance SchemaType PortfolioValuationItem where
parseSchemaType s = do
(pos,e) <- posnElement [s]
commit $ interior e $ return PortfolioValuationItem
`apply` optional (elementPortfolio)
`apply` many (parseSchemaType "tradeValuationItem")
`apply` optional (elementValuationSet)
schemaTypeToXML s x@PortfolioValuationItem{} =
toXMLElement s []
[ maybe [] (elementToXMLPortfolio) $ portfValItem_portfolio x
, concatMap (schemaTypeToXML "tradeValuationItem") $ portfValItem_tradeValuationItem x
, maybe [] (elementToXMLValuationSet) $ portfValItem_valuationSet x
]
data RequestValuationReport = RequestValuationReport
{ reqValReport_fpmlVersion :: Xsd.XsdString
, reqValReport_expectedBuild :: Maybe Xsd.PositiveInteger
, reqValReport_actualBuild :: Maybe Xsd.PositiveInteger
, reqValReport_header :: Maybe RequestMessageHeader
, reqValReport_validation :: [Validation]
, reqValReport_isCorrection :: Maybe Xsd.Boolean
, reqValReport_parentCorrelationId :: Maybe CorrelationId
, reqValReport_correlationId :: [CorrelationId]
, reqValReport_sequenceNumber :: Maybe Xsd.PositiveInteger
, reqValReport_onBehalfOf :: [OnBehalfOf]
, reqValReport_reportContents :: Maybe ReportContents
, reqValReport_asOfDate :: Maybe IdentifiedDate
, reqValReport_party :: [Party]
, reqValReport_account :: [Account]
, reqValReport_market :: Maybe Market
, reqValReport_portfolioValuationItem :: [PortfolioValuationItem]
, reqValReport_tradeValuationItem :: [TradeValuationItem]
}
deriving (Eq,Show)
instance SchemaType RequestValuationReport where
parseSchemaType s = do
(pos,e) <- posnElement [s]
a0 <- getAttribute "fpmlVersion" e pos
a1 <- optional $ getAttribute "expectedBuild" e pos
a2 <- optional $ getAttribute "actualBuild" e pos
commit $ interior e $ return (RequestValuationReport a0 a1 a2)
`apply` optional (parseSchemaType "header")
`apply` many (parseSchemaType "validation")
`apply` optional (parseSchemaType "isCorrection")
`apply` optional (parseSchemaType "parentCorrelationId")
`apply` between (Occurs (Just 0) (Just 2))
(parseSchemaType "correlationId")
`apply` optional (parseSchemaType "sequenceNumber")
`apply` between (Occurs (Just 0) (Just 4))
(parseSchemaType "onBehalfOf")
`apply` optional (parseSchemaType "reportContents")
`apply` optional (parseSchemaType "asOfDate")
`apply` many (parseSchemaType "party")
`apply` many (parseSchemaType "account")
`apply` optional (elementMarket)
`apply` many (parseSchemaType "portfolioValuationItem")
`apply` many (parseSchemaType "tradeValuationItem")
schemaTypeToXML s x@RequestValuationReport{} =
toXMLElement s [ toXMLAttribute "fpmlVersion" $ reqValReport_fpmlVersion x
, maybe [] (toXMLAttribute "expectedBuild") $ reqValReport_expectedBuild x
, maybe [] (toXMLAttribute "actualBuild") $ reqValReport_actualBuild x
]
[ maybe [] (schemaTypeToXML "header") $ reqValReport_header x
, concatMap (schemaTypeToXML "validation") $ reqValReport_validation x
, maybe [] (schemaTypeToXML "isCorrection") $ reqValReport_isCorrection x
, maybe [] (schemaTypeToXML "parentCorrelationId") $ reqValReport_parentCorrelationId x
, concatMap (schemaTypeToXML "correlationId") $ reqValReport_correlationId x
, maybe [] (schemaTypeToXML "sequenceNumber") $ reqValReport_sequenceNumber x
, concatMap (schemaTypeToXML "onBehalfOf") $ reqValReport_onBehalfOf x
, maybe [] (schemaTypeToXML "reportContents") $ reqValReport_reportContents x
, maybe [] (schemaTypeToXML "asOfDate") $ reqValReport_asOfDate x
, concatMap (schemaTypeToXML "party") $ reqValReport_party x
, concatMap (schemaTypeToXML "account") $ reqValReport_account x
, maybe [] (elementToXMLMarket) $ reqValReport_market x
, concatMap (schemaTypeToXML "portfolioValuationItem") $ reqValReport_portfolioValuationItem x
, concatMap (schemaTypeToXML "tradeValuationItem") $ reqValReport_tradeValuationItem x
]
instance Extension RequestValuationReport CorrectableRequestMessage where
supertype v = CorrectableRequestMessage_RequestValuationReport v
instance Extension RequestValuationReport RequestMessage where
supertype = (supertype :: CorrectableRequestMessage -> RequestMessage)
. (supertype :: RequestValuationReport -> CorrectableRequestMessage)
instance Extension RequestValuationReport Message where
supertype = (supertype :: RequestMessage -> Message)
. (supertype :: CorrectableRequestMessage -> RequestMessage)
. (supertype :: RequestValuationReport -> CorrectableRequestMessage)
instance Extension RequestValuationReport Document where
supertype = (supertype :: Message -> Document)
. (supertype :: RequestMessage -> Message)
. (supertype :: CorrectableRequestMessage -> RequestMessage)
. (supertype :: RequestValuationReport -> CorrectableRequestMessage)
data TradeValuationItem = TradeValuationItem
{ tradeValItem_choice0 :: (Maybe (OneOf2 [PartyTradeIdentifier] Trade))
, tradeValItem_valuationSet :: Maybe ValuationSet
}
deriving (Eq,Show)
instance SchemaType TradeValuationItem where
parseSchemaType s = do
(pos,e) <- posnElement [s]
commit $ interior e $ return TradeValuationItem
`apply` optional (oneOf' [ ("[PartyTradeIdentifier]", fmap OneOf2 (many1 (parseSchemaType "partyTradeIdentifier")))
, ("Trade", fmap TwoOf2 (parseSchemaType "trade"))
])
`apply` optional (elementValuationSet)
schemaTypeToXML s x@TradeValuationItem{} =
toXMLElement s []
[ maybe [] (foldOneOf2 (concatMap (schemaTypeToXML "partyTradeIdentifier"))
(schemaTypeToXML "trade")
) $ tradeValItem_choice0 x
, maybe [] (elementToXMLValuationSet) $ tradeValItem_valuationSet x
]
data ValuationReport = ValuationReport
{ valReport_fpmlVersion :: Xsd.XsdString
, valReport_expectedBuild :: Maybe Xsd.PositiveInteger
, valReport_actualBuild :: Maybe Xsd.PositiveInteger
, valReport_header :: Maybe NotificationMessageHeader
, valReport_validation :: [Validation]
, valReport_parentCorrelationId :: Maybe CorrelationId
, valReport_correlationId :: [CorrelationId]
, valReport_sequenceNumber :: Maybe Xsd.PositiveInteger
, valReport_onBehalfOf :: [OnBehalfOf]
, valReport_reportIdentification :: Maybe ReportIdentification
, valReport_reportContents :: Maybe ReportContents
, valReport_asOfDate :: Maybe IdentifiedDate
, valReport_party :: [Party]
, valReport_account :: [Account]
, valReport_market :: Maybe Market
, valReport_portfolioValuationItem :: [PortfolioValuationItem]
, valReport_tradeValuationItem :: [TradeValuationItem]
}
deriving (Eq,Show)
instance SchemaType ValuationReport where
parseSchemaType s = do
(pos,e) <- posnElement [s]
a0 <- getAttribute "fpmlVersion" e pos
a1 <- optional $ getAttribute "expectedBuild" e pos
a2 <- optional $ getAttribute "actualBuild" e pos
commit $ interior e $ return (ValuationReport a0 a1 a2)
`apply` optional (parseSchemaType "header")
`apply` many (parseSchemaType "validation")
`apply` optional (parseSchemaType "parentCorrelationId")
`apply` between (Occurs (Just 0) (Just 2))
(parseSchemaType "correlationId")
`apply` optional (parseSchemaType "sequenceNumber")
`apply` between (Occurs (Just 0) (Just 4))
(parseSchemaType "onBehalfOf")
`apply` optional (parseSchemaType "reportIdentification")
`apply` optional (parseSchemaType "reportContents")
`apply` optional (parseSchemaType "asOfDate")
`apply` many (parseSchemaType "party")
`apply` many (parseSchemaType "account")
`apply` optional (elementMarket)
`apply` many (parseSchemaType "portfolioValuationItem")
`apply` many (parseSchemaType "tradeValuationItem")
schemaTypeToXML s x@ValuationReport{} =
toXMLElement s [ toXMLAttribute "fpmlVersion" $ valReport_fpmlVersion x
, maybe [] (toXMLAttribute "expectedBuild") $ valReport_expectedBuild x
, maybe [] (toXMLAttribute "actualBuild") $ valReport_actualBuild x
]
[ maybe [] (schemaTypeToXML "header") $ valReport_header x
, concatMap (schemaTypeToXML "validation") $ valReport_validation x
, maybe [] (schemaTypeToXML "parentCorrelationId") $ valReport_parentCorrelationId x
, concatMap (schemaTypeToXML "correlationId") $ valReport_correlationId x
, maybe [] (schemaTypeToXML "sequenceNumber") $ valReport_sequenceNumber x
, concatMap (schemaTypeToXML "onBehalfOf") $ valReport_onBehalfOf x
, maybe [] (schemaTypeToXML "reportIdentification") $ valReport_reportIdentification x
, maybe [] (schemaTypeToXML "reportContents") $ valReport_reportContents x
, maybe [] (schemaTypeToXML "asOfDate") $ valReport_asOfDate x
, concatMap (schemaTypeToXML "party") $ valReport_party x
, concatMap (schemaTypeToXML "account") $ valReport_account x
, maybe [] (elementToXMLMarket) $ valReport_market x
, concatMap (schemaTypeToXML "portfolioValuationItem") $ valReport_portfolioValuationItem x
, concatMap (schemaTypeToXML "tradeValuationItem") $ valReport_tradeValuationItem x
]
instance Extension ValuationReport NotificationMessage where
supertype v = NotificationMessage_ValuationReport v
instance Extension ValuationReport Message where
supertype = (supertype :: NotificationMessage -> Message)
. (supertype :: ValuationReport -> NotificationMessage)
instance Extension ValuationReport Document where
supertype = (supertype :: Message -> Document)
. (supertype :: NotificationMessage -> Message)
. (supertype :: ValuationReport -> NotificationMessage)
data ValuationReportRetracted = ValuationReportRetracted
{ valReportRetrac_fpmlVersion :: Xsd.XsdString
, valReportRetrac_expectedBuild :: Maybe Xsd.PositiveInteger
, valReportRetrac_actualBuild :: Maybe Xsd.PositiveInteger
, valReportRetrac_header :: Maybe NotificationMessageHeader
, valReportRetrac_validation :: [Validation]
, valReportRetrac_parentCorrelationId :: Maybe CorrelationId
, valReportRetrac_correlationId :: [CorrelationId]
, valReportRetrac_sequenceNumber :: Maybe Xsd.PositiveInteger
, valReportRetrac_onBehalfOf :: [OnBehalfOf]
, valReportRetrac_reportIdentification :: Maybe ReportIdentification
, valReportRetrac_reportContents :: Maybe ReportContents
, valReportRetrac_asOfDate :: Maybe IdentifiedDate
, valReportRetrac_partyTradeIdentifier :: [PartyTradeIdentifier]
, valReportRetrac_party :: [Party]
, valReportRetrac_account :: [Account]
}
deriving (Eq,Show)
instance SchemaType ValuationReportRetracted where
parseSchemaType s = do
(pos,e) <- posnElement [s]
a0 <- getAttribute "fpmlVersion" e pos
a1 <- optional $ getAttribute "expectedBuild" e pos
a2 <- optional $ getAttribute "actualBuild" e pos
commit $ interior e $ return (ValuationReportRetracted a0 a1 a2)
`apply` optional (parseSchemaType "header")
`apply` many (parseSchemaType "validation")
`apply` optional (parseSchemaType "parentCorrelationId")
`apply` between (Occurs (Just 0) (Just 2))
(parseSchemaType "correlationId")
`apply` optional (parseSchemaType "sequenceNumber")
`apply` between (Occurs (Just 0) (Just 4))
(parseSchemaType "onBehalfOf")
`apply` optional (parseSchemaType "reportIdentification")
`apply` optional (parseSchemaType "reportContents")
`apply` optional (parseSchemaType "asOfDate")
`apply` many (parseSchemaType "partyTradeIdentifier")
`apply` many (parseSchemaType "party")
`apply` many (parseSchemaType "account")
schemaTypeToXML s x@ValuationReportRetracted{} =
toXMLElement s [ toXMLAttribute "fpmlVersion" $ valReportRetrac_fpmlVersion x
, maybe [] (toXMLAttribute "expectedBuild") $ valReportRetrac_expectedBuild x
, maybe [] (toXMLAttribute "actualBuild") $ valReportRetrac_actualBuild x
]
[ maybe [] (schemaTypeToXML "header") $ valReportRetrac_header x
, concatMap (schemaTypeToXML "validation") $ valReportRetrac_validation x
, maybe [] (schemaTypeToXML "parentCorrelationId") $ valReportRetrac_parentCorrelationId x
, concatMap (schemaTypeToXML "correlationId") $ valReportRetrac_correlationId x
, maybe [] (schemaTypeToXML "sequenceNumber") $ valReportRetrac_sequenceNumber x
, concatMap (schemaTypeToXML "onBehalfOf") $ valReportRetrac_onBehalfOf x
, maybe [] (schemaTypeToXML "reportIdentification") $ valReportRetrac_reportIdentification x
, maybe [] (schemaTypeToXML "reportContents") $ valReportRetrac_reportContents x
, maybe [] (schemaTypeToXML "asOfDate") $ valReportRetrac_asOfDate x
, concatMap (schemaTypeToXML "partyTradeIdentifier") $ valReportRetrac_partyTradeIdentifier x
, concatMap (schemaTypeToXML "party") $ valReportRetrac_party x
, concatMap (schemaTypeToXML "account") $ valReportRetrac_account x
]
instance Extension ValuationReportRetracted NotificationMessage where
supertype v = NotificationMessage_ValuationReportRetracted v
instance Extension ValuationReportRetracted Message where
supertype = (supertype :: NotificationMessage -> Message)
. (supertype :: ValuationReportRetracted -> NotificationMessage)
instance Extension ValuationReportRetracted Document where
supertype = (supertype :: Message -> Document)
. (supertype :: NotificationMessage -> Message)
. (supertype :: ValuationReportRetracted -> NotificationMessage)
elementPortfolio :: XMLParser Portfolio
elementPortfolio = parseSchemaType "portfolio"
elementToXMLPortfolio :: Portfolio -> [Content ()]
elementToXMLPortfolio = schemaTypeToXML "portfolio"
elementQueryPortfolio :: XMLParser QueryPortfolio
elementQueryPortfolio = parseSchemaType "queryPortfolio"
elementToXMLQueryPortfolio :: QueryPortfolio -> [Content ()]
elementToXMLQueryPortfolio = schemaTypeToXML "queryPortfolio"
elementRequestValuationReport :: XMLParser RequestValuationReport
elementRequestValuationReport = parseSchemaType "requestValuationReport"
elementToXMLRequestValuationReport :: RequestValuationReport -> [Content ()]
elementToXMLRequestValuationReport = schemaTypeToXML "requestValuationReport"
elementValuationReport :: XMLParser ValuationReport
elementValuationReport = parseSchemaType "valuationReport"
elementToXMLValuationReport :: ValuationReport -> [Content ()]
elementToXMLValuationReport = schemaTypeToXML "valuationReport"
elementValuationReportRetracted :: XMLParser ValuationReportRetracted
elementValuationReportRetracted = parseSchemaType "valuationReportRetracted"
elementToXMLValuationReportRetracted :: ValuationReportRetracted -> [Content ()]
elementToXMLValuationReportRetracted = schemaTypeToXML "valuationReportRetracted"
elementValuationReportAcknowledgement :: XMLParser Acknowledgement
elementValuationReportAcknowledgement = parseSchemaType "valuationReportAcknowledgement"
elementToXMLValuationReportAcknowledgement :: Acknowledgement -> [Content ()]
elementToXMLValuationReportAcknowledgement = schemaTypeToXML "valuationReportAcknowledgement"
elementValuationReportException :: XMLParser Exception
elementValuationReportException = parseSchemaType "valuationReportException"
elementToXMLValuationReportException :: Exception -> [Content ()]
elementToXMLValuationReportException = schemaTypeToXML "valuationReportException"