never executed always true always false
    1 -- GENERATED by C->Haskell Compiler, version 0.28.8 Switcheroo, 25 November 2017 (Haskell)
    2 -- Edit the ORIGNAL .chs file instead!
    3 
    4 
    5 -- |Portfolio-credit types, baskets, and loss models.
    6 module QuantLib.Credit
    7   (
    8     -- * Types
    9     -- ** Issuers, pools and baskets
   10     DefaultProbKey
   11   , Issuer
   12   , Pool
   13   , Basket
   14   , TrancheBasket
   15   , DigitalBasket
   16     -- ** Loss models
   17   , DefaultLossModel
   18   , DigitalLossModel
   19     -- ** Configuration
   20   , Seniority(..)
   21   , RestructuringType(..)
   22   , LatentModelIntegrationType(..)
   23 
   24     -- * Constructors
   25   , northAmericaCorpDefaultKey
   26   , issuer
   27   , pool
   28   , basket
   29   , trancheBasketAsBasket
   30   , digitalBasket
   31   , digitalBasketAsBasket
   32   , gaussianLhpLossModel
   33   , constantLossModel
   34 
   35     -- * Inspectors
   36   , basketExpectedTrancheLoss
   37   , basketProbOverLoss
   38   , basketPercentile
   39   , basketExpectedShortfall
   40   , basketDefaultCorrelation
   41   , basketProbAtLeastNEvents
   42   , basketNotional
   43   , basketRemainingNotional
   44   , basketRecoveryRate
   45   ) where
   46 import qualified Foreign.C.Types as C2HSImp
   47 import qualified Foreign.ForeignPtr as C2HSImp
   48 import qualified Foreign.Ptr as C2HSImp
   49 
   50 
   51 import Data.List.NonEmpty(NonEmpty, toList)
   52 
   53 import QuantLib.Internal
   54 import QuantLib.Internal.Common
   55 import QuantLib.Internal.Type
   56 
   57 
   58 
   59 
   60 
   61 
   62 
   63 -- |Seniority of a bond; also used as the ISDA tier\/seniority for CDS conventional spreads.
   64 data Seniority = SecDom
   65                | SeniorSec
   66                | SnrFor
   67                | SeniorUnSec
   68                | SubLT2
   69                | SubLoweTier2
   70                | JrSubT2
   71                | SubUpperTier2
   72                | PrefT1
   73                | SubTier1
   74                | NoSeniority
   75   deriving (Show,Eq,Read,Bounded)
   76 instance Enum Seniority where
   77   succ SecDom = SnrFor
   78   succ SeniorSec = SnrFor
   79   succ SnrFor = SubLT2
   80   succ SeniorUnSec = SubLT2
   81   succ SubLT2 = JrSubT2
   82   succ SubLoweTier2 = JrSubT2
   83   succ JrSubT2 = PrefT1
   84   succ SubUpperTier2 = PrefT1
   85   succ PrefT1 = NoSeniority
   86   succ SubTier1 = NoSeniority
   87   succ NoSeniority = error "Seniority.succ: NoSeniority has no successor"
   88 
   89   pred SnrFor = SecDom
   90   pred SeniorUnSec = SecDom
   91   pred SubLT2 = SnrFor
   92   pred SubLoweTier2 = SnrFor
   93   pred JrSubT2 = SubLT2
   94   pred SubUpperTier2 = SubLT2
   95   pred PrefT1 = JrSubT2
   96   pred SubTier1 = JrSubT2
   97   pred NoSeniority = PrefT1
   98   pred SecDom = error "Seniority.pred: SecDom has no predecessor"
   99   pred SeniorSec = error "Seniority.pred: SeniorSec has no predecessor"
  100 
  101   enumFromTo from to = go from
  102     where
  103       end = fromEnum to
  104       go v = case compare (fromEnum v) end of
  105                  LT -> v : go (succ v)
  106                  EQ -> [v]
  107                  GT -> []
  108 
  109   enumFrom from = enumFromTo from NoSeniority
  110 
  111   fromEnum SecDom = 0
  112   fromEnum SeniorSec = 0
  113   fromEnum SnrFor = 1
  114   fromEnum SeniorUnSec = 1
  115   fromEnum SubLT2 = 2
  116   fromEnum SubLoweTier2 = 2
  117   fromEnum JrSubT2 = 3
  118   fromEnum SubUpperTier2 = 3
  119   fromEnum PrefT1 = 4
  120   fromEnum SubTier1 = 4
  121   fromEnum NoSeniority = 5
  122 
  123   toEnum 0 = SecDom
  124   toEnum 1 = SnrFor
  125   toEnum 2 = SubLT2
  126   toEnum 3 = JrSubT2
  127   toEnum 4 = PrefT1
  128   toEnum 5 = NoSeniority
  129   toEnum unmatched = error ("Seniority.toEnum: Cannot match " ++ show unmatched)
  130 
  131 
  132 
  133 -- |Restructuring clause of a default-probability key (ISDA @XR@\/@MR@\/@MM@\/@CR@).
  134 data RestructuringType = NoRestructuring
  135                        | XR
  136                        | ModifiedRestructuring
  137                        | MR
  138                        | ModifiedModifiedRestructuring
  139                        | MM
  140                        | FullRestructuring
  141                        | CR
  142                        | AnyRestructuring
  143   deriving (Show,Eq,Read,Bounded)
  144 instance Enum RestructuringType where
  145   succ NoRestructuring = ModifiedRestructuring
  146   succ XR = ModifiedRestructuring
  147   succ ModifiedRestructuring = ModifiedModifiedRestructuring
  148   succ MR = ModifiedModifiedRestructuring
  149   succ ModifiedModifiedRestructuring = FullRestructuring
  150   succ MM = FullRestructuring
  151   succ FullRestructuring = AnyRestructuring
  152   succ CR = AnyRestructuring
  153   succ AnyRestructuring = error "RestructuringType.succ: AnyRestructuring has no successor"
  154 
  155   pred ModifiedRestructuring = NoRestructuring
  156   pred MR = NoRestructuring
  157   pred ModifiedModifiedRestructuring = ModifiedRestructuring
  158   pred MM = ModifiedRestructuring
  159   pred FullRestructuring = ModifiedModifiedRestructuring
  160   pred CR = ModifiedModifiedRestructuring
  161   pred AnyRestructuring = FullRestructuring
  162   pred NoRestructuring = error "RestructuringType.pred: NoRestructuring has no predecessor"
  163   pred XR = error "RestructuringType.pred: XR has no predecessor"
  164 
  165   enumFromTo from to = go from
  166     where
  167       end = fromEnum to
  168       go v = case compare (fromEnum v) end of
  169                  LT -> v : go (succ v)
  170                  EQ -> [v]
  171                  GT -> []
  172 
  173   enumFrom from = enumFromTo from AnyRestructuring
  174 
  175   fromEnum NoRestructuring = 0
  176   fromEnum XR = 0
  177   fromEnum ModifiedRestructuring = 1
  178   fromEnum MR = 1
  179   fromEnum ModifiedModifiedRestructuring = 2
  180   fromEnum MM = 2
  181   fromEnum FullRestructuring = 3
  182   fromEnum CR = 3
  183   fromEnum AnyRestructuring = 4
  184 
  185   toEnum 0 = NoRestructuring
  186   toEnum 1 = ModifiedRestructuring
  187   toEnum 2 = ModifiedModifiedRestructuring
  188   toEnum 3 = FullRestructuring
  189   toEnum 4 = AnyRestructuring
  190   toEnum unmatched = error ("RestructuringType.toEnum: Cannot match " ++ show unmatched)
  191 
  192 
  193 
  194 -- |Numerical-integration scheme used by a 'QuantLib.Credit.LatentModel'-based copula loss
  195 -- model (e.g. the gaussian\/student constant-loss dispatcher bound alongside 'NthToDefault').
  196 data LatentModelIntegrationType = GaussianQuadrature
  197                                 | Trapezoid
  198   deriving (Enum,Show,Eq,Read,Bounded)
  199 
  200 
  201 
  202 
  203 
  204 
  205 
  206 
  207 
  208 
  209 
  210 
  211 
  212 
  213 
  214 
  215 
  216 
  217 
  218 
  219 
  220 
  221 
  222 
  223 
  224 
  225 
  226 
  227 -- |ISDA standard default contractual key for corporate US debt. @restructuringType@ may be
  228 -- 'NoRestructuring' to disable restructuring as a trigger.
  229 northAmericaCorpDefaultKey :: (Currency) -- ^currency
  230  -> (Seniority) -- ^seniority
  231  -> ((Int,TimeUnit)) -- ^graceFailureToPay
  232  -> (Double) -- ^amountFailure
  233  -> (RestructuringType) -- ^restructuringType
  234  -> IO ((DefaultProbKey))
  235 northAmericaCorpDefaultKey a1 a2 a3 a4 a5 =
  236   withCurrency a1 $ \a1' -> 
  237   let {a2' = (fromIntegral . fromEnum) a2} in 
  238   let {(a3'1, a3'2) = fromEnumQuantity a3} in 
  239   let {a4' = realToFrac a4} in 
  240   let {a5' = (fromIntegral . fromEnum) a5} in 
  241   preErrorCheck $ \a6' -> 
  242   northAmericaCorpDefaultKey'_ a1' a2' a3'1  a3'2 a4' a5' a6' >>= \res ->
  243   peekDefaultProbKey res >>= \res' ->
  244   errorCheck  a6'>>
  245   return (res')
  246 
  247 
  248 
  249 -- |An issuer's default-probability term structures, keyed by contract terms.
  250 issuer :: NonEmpty (DefaultProbKey, GenDefaultProbabilityTermStructure d) -> IO Issuer
  251 issuer probs = qlIssuer keys curves
  252   where (keys, curves) = unzip (toList probs)
  253 qlIssuer :: ([DefaultProbKey]) -> ([GenDefaultProbabilityTermStructure d]) -> IO ((Issuer))
  254 qlIssuer a1 a2 =
  255   withDefaultProbKeyArray a1 $ \(a1'1, a1'2) -> 
  256   withDefaultProbabilityTermStructureArrayRaw a2 $ \a2' -> 
  257   preErrorCheck $ \a3' -> 
  258   qlIssuer'_ a1'1  a1'2 a2' a3' >>= \res ->
  259   peekIssuer res >>= \res' ->
  260   errorCheck  a3'>>
  261   return (res')
  262 
  263 
  264 
  265 -- |A named collection of issuers and their default-probability keys.
  266 pool :: NonEmpty (String, Issuer, DefaultProbKey) -> IO Pool
  267 pool entries = qlPool names issuers keys
  268   where (names, issuers, keys) = unzip3 (toList entries)
  269 qlPool :: ([String]) -> ([Issuer]) -> ([DefaultProbKey]) -> IO ((Pool))
  270 qlPool a1 a2 a3 =
  271   withStringArray a1 $ \(a1'1, a1'2) -> 
  272   withIssuerArrayRaw a2 $ \a2' -> 
  273   withDefaultProbKeyArrayRaw a3 $ \a3' -> 
  274   preErrorCheck $ \a4' -> 
  275   qlPool'_ a1'1  a1'2 a2' a3' a4' >>= \res ->
  276   peekPool res >>= \res' ->
  277   errorCheck  a4'>>
  278   return (res')
  279 
  280 
  281 
  282 -- |A tranched basket with a tranche-loss model; usable for CDO pricing.
  283 basket :: Day -> NonEmpty (String, Double) -> Pool -> Double -> Double -> Claim -> DefaultLossModel -> IO TrancheBasket
  284 basket refDate positions p attachmentRatio detachmentRatio cl lm =
  285   qlBasket refDate names notionals p attachmentRatio detachmentRatio cl lm
  286   where (names, notionals) = unzip (toList positions)
  287 qlBasket :: (Day) -- ^refDate
  288  -> ([String]) -> ([Double]) -> (Pool) -> (Double) -- ^attachmentRatio
  289  -> (Double) -- ^detachmentRatio
  290  -> (Claim) -> (DefaultLossModel) -> IO ((TrancheBasket))
  291 qlBasket a1 a2 a3 a4 a5 a6 a7 a8 =
  292   withDay a1 $ \a1' -> 
  293   withStringArray a2 $ \(a2'1, a2'2) -> 
  294   withDoubleArrayRaw a3 $ \a3' -> 
  295   withPool a4 $ \a4' -> 
  296   let {a5' = realToFrac a5} in 
  297   let {a6' = realToFrac a6} in 
  298   withClaim a7 $ \a7' -> 
  299   withDefaultLossModel a8 $ \a8' -> 
  300   preErrorCheck $ \a9' -> 
  301   qlBasket'_ a1' a2'1  a2'2 a3' a4' a5' a6' a7' a8' a9' >>= \res ->
  302   peekTrancheBasket res >>= \res' ->
  303   errorCheck  a9'>>
  304   return (res')
  305 
  306 
  307 
  308 -- |Basket total notional at inception, before losses.
  309 basketNotional :: (Basket) -> IO ((Double))
  310 basketNotional a1 =
  311   withBasket a1 $ \a1' -> 
  312   preErrorCheck $ \a2' -> 
  313   basketNotional'_ a1' a2' >>= \res ->
  314   let {res' = realToFrac res} in
  315   errorCheck  a2'>>
  316   return (res')
  317 
  318 
  319 
  320 -- |Live (undefaulted) notional remaining at date @d@. Loss-model-agnostic.
  321 basketRemainingNotional :: (Basket) -> (Day) -- ^d
  322  -> IO ((Double))
  323 basketRemainingNotional a1 a2 =
  324   withBasket a1 $ \a1' -> 
  325   withDay a2 $ \a2' -> 
  326   preErrorCheck $ \a3' -> 
  327   basketRemainingNotional'_ a1' a2' a3' >>= \res ->
  328   let {res' = realToFrac res} in
  329   errorCheck  a3'>>
  330   return (res')
  331 
  332 
  333 
  334 -- |Expected recovery rate of the @iName@-th pool name (0-based, in basket-construction order),
  335 -- conditional on default by date @d@. Loss-model-agnostic.
  336 basketRecoveryRate :: (Basket) -> (Day) -- ^d
  337  -> (Word) -- ^iName
  338  -> IO ((Double))
  339 basketRecoveryRate a1 a2 a3 =
  340   withBasket a1 $ \a1' -> 
  341   withDay a2 $ \a2' -> 
  342   let {a3' = fromIntegral a3} in 
  343   preErrorCheck $ \a4' -> 
  344   basketRecoveryRate'_ a1' a2' a3' a4' >>= \res ->
  345   let {res' = realToFrac res} in
  346   errorCheck  a4'>>
  347   return (res')
  348 
  349 
  350 
  351 -- |Expected tranche loss on date @d@; requires a tranche-loss model.
  352 basketExpectedTrancheLoss :: (TrancheBasket) -> (Day) -- ^d
  353  -> IO ((Double))
  354 basketExpectedTrancheLoss a1 a2 =
  355   withTrancheBasket a1 $ \a1' -> 
  356   withDay a2 $ \a2' -> 
  357   preErrorCheck $ \a3' -> 
  358   basketExpectedTrancheLoss'_ a1' a2' a3' >>= \res ->
  359   let {res' = realToFrac res} in
  360   errorCheck  a3'>>
  361   return (res')
  362 
  363 
  364 
  365 -- |Probability the tranche loses at least @lossFraction@ of the tranche notional by date @d@.
  366 basketProbOverLoss :: (TrancheBasket) -> (Day) -- ^d
  367  -> (Double) -- ^lossFraction
  368  -> IO ((Double))
  369 basketProbOverLoss a1 a2 a3 =
  370   withTrancheBasket a1 $ \a1' -> 
  371   withDay a2 $ \a2' -> 
  372   let {a3' = realToFrac a3} in 
  373   preErrorCheck $ \a4' -> 
  374   basketProbOverLoss'_ a1' a2' a3' a4' >>= \res ->
  375   let {res' = realToFrac res} in
  376   errorCheck  a4'>>
  377   return (res')
  378 
  379 
  380 
  381 -- |Tranche loss fraction at the given percentile of the loss distribution on date @d@ (VaR).
  382 basketPercentile :: (TrancheBasket) -> (Day) -- ^d
  383  -> (Double) -- ^prob
  384  -> IO ((Double))
  385 basketPercentile a1 a2 a3 =
  386   withTrancheBasket a1 $ \a1' -> 
  387   withDay a2 $ \a2' -> 
  388   let {a3' = realToFrac a3} in 
  389   preErrorCheck $ \a4' -> 
  390   basketPercentile'_ a1' a2' a3' a4' >>= \res ->
  391   let {res' = realToFrac res} in
  392   errorCheck  a4'>>
  393   return (res')
  394 
  395 
  396 
  397 -- |Expected tranche loss given loss exceeds the given percentile on date @d@.
  398 basketExpectedShortfall :: (TrancheBasket) -> (Day) -- ^d
  399  -> (Double) -- ^prob
  400  -> IO ((Double))
  401 basketExpectedShortfall a1 a2 a3 =
  402   withTrancheBasket a1 $ \a1' -> 
  403   withDay a2 $ \a2' -> 
  404   let {a3' = realToFrac a3} in 
  405   preErrorCheck $ \a4' -> 
  406   basketExpectedShortfall'_ a1' a2' a3' a4' >>= \res ->
  407   let {res' = realToFrac res} in
  408   errorCheck  a4'>>
  409   return (res')
  410 
  411 
  412 
  413 -- |Pearson default-probability correlation between pool names @iName@ and @jName@ (0-based) by
  414 -- date @d@.
  415 basketDefaultCorrelation :: (DigitalBasket) -> (Day) -- ^d
  416  -> (Word) -- ^iName
  417  -> (Word) -- ^jName
  418  -> IO ((Double))
  419 basketDefaultCorrelation a1 a2 a3 a4 =
  420   withDigitalBasket a1 $ \a1' -> 
  421   withDay a2 $ \a2' -> 
  422   let {a3' = fromIntegral a3} in 
  423   let {a4' = fromIntegral a4} in 
  424   preErrorCheck $ \a5' -> 
  425   basketDefaultCorrelation'_ a1' a2' a3' a4' a5' >>= \res ->
  426   let {res' = realToFrac res} in
  427   errorCheck  a5'>>
  428   return (res')
  429 
  430 
  431 
  432 -- |Probability of at least @n@ defaults in the basket by date @d@.
  433 basketProbAtLeastNEvents :: (DigitalBasket) -> (Word) -- ^n
  434  -> (Day) -- ^d
  435  -> IO ((Double))
  436 basketProbAtLeastNEvents a1 a2 a3 =
  437   withDigitalBasket a1 $ \a1' -> 
  438   let {a2' = fromIntegral a2} in 
  439   withDay a3 $ \a3' -> 
  440   preErrorCheck $ \a4' -> 
  441   basketProbAtLeastNEvents'_ a1' a2' a3' a4' >>= \res ->
  442   let {res' = realToFrac res} in
  443   errorCheck  a4'>>
  444   return (res')
  445 
  446 
  447 
  448 -- |A digital-loss basket for nth-to-default pricing.
  449 digitalBasket :: Day -> NonEmpty (String, Double) -> Pool -> Double -> Double -> Claim -> DigitalLossModel -> IO DigitalBasket
  450 digitalBasket refDate positions p attachmentRatio detachmentRatio cl lm =
  451   qlDigitalBasket refDate names notionals p attachmentRatio detachmentRatio cl lm
  452   where (names, notionals) = unzip (toList positions)
  453 qlDigitalBasket :: (Day) -- ^refDate
  454  -> ([String]) -> ([Double]) -> (Pool) -> (Double) -- ^attachmentRatio
  455  -> (Double) -- ^detachmentRatio
  456  -> (Claim) -> (DigitalLossModel) -> IO ((DigitalBasket))
  457 qlDigitalBasket a1 a2 a3 a4 a5 a6 a7 a8 =
  458   withDay a1 $ \a1' -> 
  459   withStringArray a2 $ \(a2'1, a2'2) -> 
  460   withDoubleArrayRaw a3 $ \a3' -> 
  461   withPool a4 $ \a4' -> 
  462   let {a5' = realToFrac a5} in 
  463   let {a6' = realToFrac a6} in 
  464   withClaim a7 $ \a7' -> 
  465   withDigitalLossModel a8 $ \a8' -> 
  466   preErrorCheck $ \a9' -> 
  467   qlDigitalBasket'_ a1' a2'1  a2'2 a3' a4' a5' a6' a7' a8' a9' >>= \res ->
  468   peekDigitalBasket res >>= \res' ->
  469   errorCheck  a9'>>
  470   return (res')
  471 
  472 
  473 
  474 -- |One-factor Gaussian-copula LHP loss model. @recoveries@ follow basket-name order.
  475 gaussianLhpLossModel :: GenQuote q -> NonEmpty Double -> IO DefaultLossModel
  476 gaussianLhpLossModel correlQuote recoveries = qlGaussianLHPLossModel correlQuote (toList recoveries)
  477 qlGaussianLHPLossModel :: (GenQuote q) -- ^correlQuote
  478  -> ([Double]) -> IO ((DefaultLossModel))
  479 qlGaussianLHPLossModel a1 a2 =
  480   withQuote a1 $ \a1' -> 
  481   withDoubleArray a2 $ \(a2'1, a2'2) -> 
  482   preErrorCheck $ \a3' -> 
  483   qlGaussianLHPLossModel'_ a1' a2'1  a2'2 a3' >>= \res ->
  484   peekDefaultLossModel res >>= \res' ->
  485   errorCheck  a3'>>
  486   return (res')
  487 
  488 
  489 
  490 -- |One-factor Gaussian- or Student-T-copula model for digital-loss baskets.
  491 -- @[]@ selects Gaussian; @tOrders@ selects Student-T degrees of freedom.
  492 constantLossModel :: GenQuote q -> NonEmpty Double -> LatentModelIntegrationType -> [Int] -> IO DigitalLossModel
  493 constantLossModel correlQuote recoveries integralType tOrders =
  494   qlConstantLossModel correlQuote (toList recoveries) integralType tOrders
  495 qlConstantLossModel :: (GenQuote q) -> ([Double]) -> (LatentModelIntegrationType) -> ([Int]) -> IO ((DigitalLossModel))
  496 qlConstantLossModel a1 a2 a3 a4 =
  497   withQuote a1 $ \a1' -> 
  498   withDoubleArray a2 $ \(a2'1, a2'2) -> 
  499   let {a3' = (fromIntegral . fromEnum) a3} in 
  500   withIntArray a4 $ \(a4'1, a4'2) -> 
  501   preErrorCheck $ \a5' -> 
  502   qlConstantLossModel'_ a1' a2'1  a2'2 a3' a4'1  a4'2 a5' >>= \res ->
  503   peekDigitalLossModel res >>= \res' ->
  504   errorCheck  a5'>>
  505   return (res')
  506 
  507 
  508 
  509 -- vim: set ff=unix ts=8 sts=2 sw=2 et:
  510 
  511 foreign import ccall safe "QuantLib/Credit.chs.h qlNorthAmericaCorpDefaultKey"
  512   northAmericaCorpDefaultKey'_ :: ((C2HSImp.Ptr (CCurrency)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CDefaultProbKey))))))))))
  513 
  514 foreign import ccall safe "QuantLib/Credit.chs.h qlIssuer"
  515   qlIssuer'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CDefaultProbKey))) -> ((C2HSImp.Ptr (C2HSImp.Ptr (CDefaultProbabilityTermStructure'))) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CIssuer)))))))
  516 
  517 foreign import ccall safe "QuantLib/Credit.chs.h qlPool"
  518   qlPool'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> ((C2HSImp.Ptr (C2HSImp.Ptr (CIssuer))) -> ((C2HSImp.Ptr (C2HSImp.Ptr (CDefaultProbKey))) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPool))))))))
  519 
  520 foreign import ccall safe "QuantLib/Credit.chs.h qlBasket"
  521   qlBasket'_ :: (C2HSImp.CInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((C2HSImp.Ptr (CPool)) -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (CQlClaim)) -> ((C2HSImp.Ptr (CDefaultLossModel)) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CBasket)))))))))))))
  522 
  523 foreign import ccall safe "QuantLib/Credit.chs.h qlBasketNotional"
  524   basketNotional'_ :: ((C2HSImp.Ptr (CBasket)) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))
  525 
  526 foreign import ccall safe "QuantLib/Credit.chs.h qlBasketRemainingNotional"
  527   basketRemainingNotional'_ :: ((C2HSImp.Ptr (CBasket)) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble))))
  528 
  529 foreign import ccall safe "QuantLib/Credit.chs.h qlBasketRecoveryRate"
  530   basketRecoveryRate'_ :: ((C2HSImp.Ptr (CBasket)) -> (C2HSImp.CInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))))
  531 
  532 foreign import ccall safe "QuantLib/Credit.chs.h qlBasketExpectedTrancheLoss"
  533   basketExpectedTrancheLoss'_ :: ((C2HSImp.Ptr (CBasket)) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble))))
  534 
  535 foreign import ccall safe "QuantLib/Credit.chs.h qlBasketProbOverLoss"
  536   basketProbOverLoss'_ :: ((C2HSImp.Ptr (CBasket)) -> (C2HSImp.CInt -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))))
  537 
  538 foreign import ccall safe "QuantLib/Credit.chs.h qlBasketPercentile"
  539   basketPercentile'_ :: ((C2HSImp.Ptr (CBasket)) -> (C2HSImp.CInt -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))))
  540 
  541 foreign import ccall safe "QuantLib/Credit.chs.h qlBasketExpectedShortfall"
  542   basketExpectedShortfall'_ :: ((C2HSImp.Ptr (CBasket)) -> (C2HSImp.CInt -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))))
  543 
  544 foreign import ccall safe "QuantLib/Credit.chs.h qlBasketDefaultCorrelation"
  545   basketDefaultCorrelation'_ :: ((C2HSImp.Ptr (CBasket)) -> (C2HSImp.CInt -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble))))))
  546 
  547 foreign import ccall safe "QuantLib/Credit.chs.h qlBasketProbAtLeastNEvents"
  548   basketProbAtLeastNEvents'_ :: ((C2HSImp.Ptr (CBasket)) -> (C2HSImp.CUInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))))
  549 
  550 foreign import ccall safe "QuantLib/Credit.chs.h qlDigitalBasket"
  551   qlDigitalBasket'_ :: (C2HSImp.CInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((C2HSImp.Ptr (CPool)) -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (CQlClaim)) -> ((C2HSImp.Ptr (CDefaultLossModel)) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CBasket)))))))))))))
  552 
  553 foreign import ccall safe "QuantLib/Credit.chs.h qlGaussianLHPLossModel"
  554   qlGaussianLHPLossModel'_ :: ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CDefaultLossModel)))))))
  555 
  556 foreign import ccall safe "QuantLib/Credit.chs.h qlConstantLossModel"
  557   qlConstantLossModel'_ :: ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CDefaultLossModel))))))))))