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 {-# LANGUAGE TemplateHaskell #-}
    6 module QuantLib.Instrument.Bond
    7   (
    8     -- * Types
    9     -- ** Bond hierarchy
   10     GenBond
   11   , Bond
   12   , GenFixedRateBond
   13   , FixedRateBond
   14   , BTP
   15   , CPIBond
   16   , CallableBond
   17   , ConvertibleBond
   18   , RendistatoBasket
   19   , RendistatoCalculator
   20 
   21     -- ** Configuration
   22   , BondPriceType(..)
   23   , CPIInterpolationType(..)
   24   , Discounting(..)
   25   , BpsDiscounting(..)
   26   , AmortizingFloatingRateBondOpts(..)
   27   , defaultAmortizingFloatingRateBondOpts
   28 
   29     -- * Constructors
   30     -- ** Hierarchy conversion
   31   , asBond
   32 
   33     -- ** Bonds and baskets
   34   , bond
   35   , fixedRateBond
   36   , btp
   37   , btpWithRedemption
   38   , zeroCouponBond
   39   , floatingRateBond
   40   , cmsRateBond
   41   , cpiBond
   42   , amortizingFixedRateBond
   43   , amortizingCmsRateBond
   44   , amortizingFloatingRateBond
   45   , sinkingSchedule
   46   , sinkingNotionals
   47   , rendistatoBasket
   48   , rendistatoCalculator
   49 
   50     -- ** Callable and convertible bonds
   51   , callableFixedRateBond
   52   , callableZeroCouponBond
   53   , convertibleFixedCouponBond
   54   , convertibleFloatingRateBond
   55   , convertibleZeroCouponBond
   56 
   57     -- * Inspectors
   58     -- ** Bond state
   59   , maturityDate
   60   , yield
   61   , accruedAmount
   62   , dirtyPriceFromYield
   63   , nextCashFlowDate
   64   , nextCouponRate
   65   , notional
   66   , previousCashFlowDate
   67   , previousCouponRate
   68   , settlementValueFromCleanPrice
   69   , settlementValue
   70   , yieldFromPrice
   71   , isTradable
   72   , notionals
   73   , cashFlows
   74   , redemptions
   75   , settlementDate
   76   , startDate
   77 
   78     -- ** Bond analytics
   79   , accrualDays
   80   , accrualEndDate
   81   , accrualPeriod
   82   , accrualStartDate
   83   , accruedDays
   84   , accruedPeriod
   85   , atmRate
   86   , basisPointValue
   87   , bps
   88   , cleanPrice
   89   , convexity
   90   , duration
   91   , nextCashFlowAmount
   92   , previousCashFlowAmount
   93   , referencePeriodEnd
   94   , referencePeriodStart
   95   , yieldFromPriceWithGuess
   96   , yieldValueBasisPoint
   97   , zSpread
   98 
   99     -- ** Current prices
  100   , currentCleanPrice
  101   , currentDirtyPrice
  102 
  103     -- ** Rendistato basket analytics
  104   , rendistatoYield
  105   , rendistatoDuration
  106   , rendistatoYields
  107   , rendistatoDurations
  108   , rendistatoSwapLengths
  109   , rendistatoSwapRates
  110   , rendistatoSwapYields
  111   , rendistatoSwapDurations
  112   , rendistatoEquivalentSwap
  113   , rendistatoEquivalentSwapRate
  114   , rendistatoEquivalentSwapYield
  115   , rendistatoEquivalentSwapDuration
  116   , rendistatoEquivalentSwapLength
  117   , rendistatoEquivalentSwapSpread
  118   , rendistatoEquivalentSwapLengthQuote
  119   , rendistatoEquivalentSwapSpreadQuote
  120   ) where
  121 import qualified Foreign.C.Types as C2HSImp
  122 import qualified Foreign.ForeignPtr as C2HSImp
  123 import qualified Foreign.Marshal.Utils as C2HSImp
  124 import qualified Foreign.Ptr as C2HSImp
  125 
  126 
  127 import QuantLib.Internal
  128 import QuantLib.Internal.Type
  129 import QuantLib.Time.Schedule(Frequency)
  130 import QuantLib.CashFlow(DurationType)
  131 import QuantLib.InterestRate(Compounding)
  132 import QuantLib.Internal.Common
  133 import QuantLib.CashFlow(Discounting(..), BpsDiscounting(..))
  134 import QuantLib.Internal.Syntax(deriveOptionsRecord)
  135 import QuantLib.Time.Calendar(calendar, CalendarConstructor(..))
  136 import Data.Maybe(fromMaybe)
  137 import Data.List.NonEmpty(NonEmpty, toList)
  138 
  139 
  140 
  141 
  142 
  143 
  144 
  145 
  146 
  147 
  148 
  149 
  150 
  151 
  152 
  153 
  154 
  155 
  156 
  157 
  158 
  159 
  160 
  161 
  162 
  163 
  164 
  165 
  166 
  167 
  168 
  169 
  170 
  171 
  172 
  173 
  174 
  175 
  176 
  177 
  178 -- AmortizingFloatingRateBondOpts bundles every trailing param
  179 -- amortizingFloatingRateBond hardcodes, pre-populated with upstream's own
  180 -- defaults via defaultAmortizingFloatingRateBondOpts, overridden through
  181 -- record-update syntax at the call site -- see the add-quantlib-options-record
  182 -- skill. This splice must stay textually before every {#fun#}-generated
  183 -- binding in this file: c2hs always appends its raw foreign-import stubs at
  184 -- the physical end of the generated module regardless of where in the .chs a
  185 -- {#fun#} hook appears, and a top-level TH splice anywhere in between would
  186 -- otherwise split the file into declaration groups that can't see each
  187 -- other, breaking every earlier {#fun#} wrapper's reference to its own
  188 -- (always-last) foreign-import stub.
  189 $(deriveOptionsRecord "AmortizingFloatingRateBondOpts" []
  190   [ ("afrbPaymentConvention", [t|BusinessDayConvention|], [|Following|])
  191   , ("afrbFixingDays", [t|Maybe Word|], [|Nothing|])
  192   , ("afrbGearings", [t|[Double]|], [|[1.0]|])
  193   , ("afrbSpreads", [t|[Double]|], [|[0.0]|])
  194   , ("afrbCaps", [t|[Double]|], [|[]|])
  195   , ("afrbFloors", [t|[Double]|], [|[]|])
  196   , ("afrbInArrears", [t|Bool|], [|False|])
  197   , ("afrbIssueDate", [t|Maybe Day|], [|Nothing|])
  198   , ("afrbExCouponPeriod", [t|(Int, TimeUnit)|], [|(0, Days)|])
  199   , ("afrbExCouponCalendar", [t|Maybe Calendar|], [|Nothing|])
  200   , ("afrbExCouponConvention", [t|BusinessDayConvention|], [|Unadjusted|])
  201   , ("afrbExCouponEndOfMonth", [t|Bool|], [|False|])
  202   , ("afrbRedemptions", [t|[Double]|], [|[100.0]|])
  203   , ("afrbPaymentLag", [t|Int|], [|0|])
  204   ])
  205 
  206 -- |the bond's yield to maturity given a market price and discount curve
  207 atmRate :: (GenBond b) -> (GenYieldTermStructure y) -> (Day) -> (Double,BondPriceType) -> IO ((Double))
  208 atmRate a1 a2 a3 a4 =
  209   withBond a1 $ \a1' -> 
  210   withYieldTermStructure a2 $ \a2' -> 
  211   withDay a3 $ \a3' -> 
  212   let {(a4'1, a4'2) = fromEnumDouble a4} in 
  213   preErrorCheck $ \a5' -> 
  214   atmRate'_ a1' a2' a3' a4'1  a4'2 a5' >>= \res ->
  215   let {res' = realToFrac res} in
  216   errorCheck  a5'>>
  217   return (res')
  218 
  219 
  220 
  221 -- |constructor for amortizing or non-amortizing bonds.
  222 -- Redemptions and maturity are calculated from the coupon data, if available. Therefore, redemptions must not be included in the passed cash flows.
  223 bond :: (Word) -> (Calendar) -> (Maybe Day) -- ^issueDate
  224  -> (GenLeg l) -- ^coupons
  225  -> IO ((Bond))
  226 bond a1 a2 a3 a4 =
  227   let {a1' = fromIntegral a1} in 
  228   withCalendar a2 $ \a2' -> 
  229   withMaybeDay a3 $ \a3' -> 
  230   withLeg a4 $ \a4' -> 
  231   preErrorCheck $ \a5' -> 
  232   bond'_ a1' a2' a3' a4' a5' >>= \res ->
  233   peekBond res >>= \res' ->
  234   errorCheck  a5'>>
  235   return (res')
  236 
  237 
  238 
  239 -- |Returns the maturity date of the bond
  240 maturityDate :: (GenBond b) -> IO ((Maybe Day))
  241 maturityDate a1 =
  242   withBond a1 $ \a1' -> 
  243   preErrorCheck $ \a2' -> 
  244   maturityDate'_ a1' a2' >>= \res ->
  245   let {res' = toMaybeDay res} in
  246   errorCheck  a2'>>
  247   return (res')
  248 
  249 
  250 
  251 -- |generic compounding and frequency InterestRate coupons
  252 fixedRateBond :: (Word) -- ^settlementDays
  253  -> (Double) -- ^faceAmount
  254  -> (Schedule) -- ^schedule
  255  -> (NonEmpty Double) -- ^coupons
  256  -> (DayCounter) -- ^accrualDayCounter
  257  -> (BusinessDayConvention) -- ^paymentConvention
  258  -> (Double) -- ^redemption
  259  -> (Maybe Day) -- ^issueDate
  260  -> (Calendar) -- ^paymentCalendar
  261  -> ((Int,TimeUnit)) -- ^exCouponPeriod
  262  -> (Calendar) -- ^exCouponCalendar
  263  -> (BusinessDayConvention) -- ^exCouponConvention
  264  -> (Bool) -- ^exCouponEndOfMonth
  265  -> (DayCounter) -- ^firstPeriodDayCounter
  266  -> IO ((FixedRateBond))
  267 fixedRateBond a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 =
  268   let {a1' = fromIntegral a1} in 
  269   let {a2' = realToFrac a2} in 
  270   withSchedule a3 $ \a3' -> 
  271   withNonEmptyDoubleArray a4 $ \(a4'1, a4'2) -> 
  272   withDayCounter a5 $ \a5' -> 
  273   let {a6' = fromEnumC a6} in 
  274   let {a7' = realToFrac a7} in 
  275   withMaybeDay a8 $ \a8' -> 
  276   withCalendar a9 $ \a9' -> 
  277   let {(a10'1, a10'2) = fromEnumQuantity a10} in 
  278   withCalendar a11 $ \a11' -> 
  279   let {a12' = fromEnumC a12} in 
  280   let {a13' = C2HSImp.fromBool a13} in 
  281   withDayCounter a14 $ \a14' -> 
  282   preErrorCheck $ \a15' -> 
  283   fixedRateBond'_ a1' a2' a3' a4'1  a4'2 a5' a6' a7' a8' a9' a10'1  a10'2 a11' a12' a13' a14' a15' >>= \res ->
  284   peekFixedRateBond res >>= \res' ->
  285   errorCheck  a15'>>
  286   return (res')
  287 
  288 
  289 
  290 -- |Italian BTP (Buono Poliennali del Tesoro): a 'FixedRateBond' with the Italian Treasury's own
  291 -- hardcoded conventions baked in -- semiannual, Actual\/Actual (ISMA), ModifiedFollowing, TARGET
  292 -- payment calendar, par (100) redemption. 'accruedAmount' (generic, via 'GenBond') additionally
  293 -- rounds to 5 decimal places on a 'BTP', through the C++ override -- no separate binding needed.
  294 -- 'BTP.yield' upstream is a thin wrapper fixing 'yield''s day counter\/compounding\/frequency
  295 -- arguments to Actual\/Actual (ISMA)\/Compounded\/Annual and is not bound; call the generic
  296 -- 'yield' with those same arguments instead.
  297 btp :: (Day) -- ^maturityDate
  298  -> (Double) -- ^fixedRate
  299  -> (Maybe Day) -- ^startDate
  300  -> (Maybe Day) -- ^issueDate
  301  -> IO ((BTP))
  302 btp a1 a2 a3 a4 =
  303   withDay a1 $ \a1' -> 
  304   let {a2' = realToFrac a2} in 
  305   withMaybeDay a3 $ \a3' -> 
  306   withMaybeDay a4 $ \a4' -> 
  307   preErrorCheck $ \a5' -> 
  308   btp'_ a1' a2' a3' a4' a5' >>= \res ->
  309   peekBTP res >>= \res' ->
  310   errorCheck  a5'>>
  311   return (res')
  312 
  313 
  314 
  315 -- |As 'btp', but with an explicit (non-par) redemption amount -- needed only for one remaining
  316 -- legacy BTP (as of upstream's own documentation) that redeems below par.
  317 btpWithRedemption :: (Day) -- ^maturityDate
  318  -> (Double) -- ^fixedRate
  319  -> (Double) -- ^redemption
  320  -> (Maybe Day) -- ^startDate
  321  -> (Maybe Day) -- ^issueDate
  322  -> IO ((BTP))
  323 btpWithRedemption a1 a2 a3 a4 a5 =
  324   withDay a1 $ \a1' -> 
  325   let {a2' = realToFrac a2} in 
  326   let {a3' = realToFrac a3} in 
  327   withMaybeDay a4 $ \a4' -> 
  328   withMaybeDay a5 $ \a5' -> 
  329   preErrorCheck $ \a6' -> 
  330   btpWithRedemption'_ a1' a2' a3' a4' a5' a6' >>= \res ->
  331   peekBTP res >>= \res' ->
  332   errorCheck  a6'>>
  333   return (res')
  334 
  335 
  336 
  337 -- |amortizing fixed-rate bond: like 'fixedRateBond' but with a per-period notional schedule
  338 -- instead of a single face amount (see 'sinkingSchedule'\/'sinkingNotionals' for building one).
  339 amortizingFixedRateBond :: (Word) -- ^settlementDays
  340  -> (NonEmpty Double) -- ^notionals
  341  -> (Schedule) -- ^schedule
  342  -> (NonEmpty Double) -- ^coupons
  343  -> (DayCounter) -- ^accrualDayCounter
  344  -> (BusinessDayConvention) -- ^paymentConvention
  345  -> (Maybe Day) -- ^issueDate
  346  -> ((Int,TimeUnit)) -- ^exCouponPeriod
  347  -> (Calendar) -- ^exCouponCalendar
  348  -> (BusinessDayConvention) -- ^exCouponConvention
  349  -> (Bool) -- ^exCouponEndOfMonth
  350  -> ([Double]) -- ^redemptions
  351  -> (Int) -- ^paymentLag
  352  -> IO ((Bond))
  353 amortizingFixedRateBond a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 =
  354   let {a1' = fromIntegral a1} in 
  355   withNonEmptyDoubleArray a2 $ \(a2'1, a2'2) -> 
  356   withSchedule a3 $ \a3' -> 
  357   withNonEmptyDoubleArray a4 $ \(a4'1, a4'2) -> 
  358   withDayCounter a5 $ \a5' -> 
  359   let {a6' = fromEnumC a6} in 
  360   withMaybeDay a7 $ \a7' -> 
  361   let {(a8'1, a8'2) = fromEnumQuantity a8} in 
  362   withCalendar a9 $ \a9' -> 
  363   let {a10' = fromEnumC a10} in 
  364   let {a11' = C2HSImp.fromBool a11} in 
  365   withDoubleArray a12 $ \(a12'1, a12'2) -> 
  366   let {a13' = fromIntegral a13} in 
  367   preErrorCheck $ \a14' -> 
  368   amortizingFixedRateBond'_ a1' a2'1  a2'2 a3' a4'1  a4'2 a5' a6' a7' a8'1  a8'2 a9' a10' a11' a12'1  a12'2 a13' a14' >>= \res ->
  369   peekBond res >>= \res' ->
  370   errorCheck  a14'>>
  371   return (res')
  372 
  373 
  374 
  375 -- |returns a schedule for French amortization
  376 sinkingSchedule :: (Day) -- ^startDate
  377  -> ((Int,TimeUnit)) -- ^bondLength
  378  -> (Frequency) -> (Calendar) -- ^paymentCalendar
  379  -> IO ((Schedule))
  380 sinkingSchedule a1 a2 a3 a4 =
  381   withDay a1 $ \a1' -> 
  382   let {(a2'1, a2'2) = fromEnumQuantity a2} in 
  383   let {a3' = (fromIntegral . fromEnum) a3} in 
  384   withCalendar a4 $ \a4' -> 
  385   preErrorCheck $ \a5' -> 
  386   sinkingSchedule'_ a1' a2'1  a2'2 a3' a4' a5' >>= \res ->
  387   peekSchedule res >>= \res' ->
  388   errorCheck  a5'>>
  389   return (res')
  390 
  391 
  392 
  393 -- |returns a sequence of notionals for French amortization
  394 sinkingNotionals :: ((Int,TimeUnit)) -- ^bondLength
  395  -> (Frequency) -> (Double) -- ^couponRate
  396  -> (Double) -- ^initialNotional
  397  -> IO (([Double]))
  398 sinkingNotionals a1 a2 a3 a4 =
  399   let {(a1'1, a1'2) = fromEnumQuantity a1} in 
  400   let {a2' = (fromIntegral . fromEnum) a2} in 
  401   let {a3' = realToFrac a3} in 
  402   let {a4' = realToFrac a4} in 
  403   preDoubleArray $ \(a5'1, a5'2) -> 
  404   preErrorCheck $ \a6' -> 
  405   sinkingNotionals'_ a1'1  a1'2 a2' a3' a4' a5'1  a5'2 a6' >>
  406   peekDoubleArray  a5'1  a5'2>>= \a5'' -> 
  407   errorCheck  a6'>>
  408   return (a5'')
  409 
  410 
  411 
  412 -- |An inflation-linked bond whose redemption and coupons scale with a 'ZeroInflationIndex'
  413 -- fixing relative to /baseCPI/.
  414 cpiBond :: (Word) -- ^settlementDays
  415  -> (Double) -- ^faceAmount
  416  -> (Double) -- ^baseCPI
  417  -> ((Word,TimeUnit)) -- ^observationLag
  418  -> (GenZeroInflationIndex zidx) -> (CPIInterpolationType) -- ^observationInterpolation
  419  -> (Schedule) -> (NonEmpty Double) -- ^coupons
  420  -> (DayCounter) -- ^accrualDayCounter
  421  -> (BusinessDayConvention) -- ^paymentConvention
  422  -> (Maybe Day) -- ^issueDate
  423  -> (Calendar) -- ^paymentCalendar
  424  -> ((Int,TimeUnit)) -- ^exCouponPeriod
  425  -> (Calendar) -- ^exCouponCalendar
  426  -> (BusinessDayConvention) -- ^exCouponConvention
  427  -> (Bool) -- ^exCouponEndOfMonth
  428  -> IO ((CPIBond))
  429 cpiBond a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 =
  430   let {a1' = fromIntegral a1} in 
  431   let {a2' = realToFrac a2} in 
  432   let {a3' = realToFrac a3} in 
  433   let {(a4'1, a4'2) = fromEnumQuantity a4} in 
  434   withZeroInflationIndex a5 $ \a5' -> 
  435   let {a6' = fromEnumC a6} in 
  436   withSchedule a7 $ \a7' -> 
  437   withNonEmptyDoubleArray a8 $ \(a8'1, a8'2) -> 
  438   withDayCounter a9 $ \a9' -> 
  439   let {a10' = fromEnumC a10} in 
  440   withMaybeDay a11 $ \a11' -> 
  441   withCalendar a12 $ \a12' -> 
  442   let {(a13'1, a13'2) = fromEnumQuantity a13} in 
  443   withCalendar a14 $ \a14' -> 
  444   let {a15' = fromEnumC a15} in 
  445   let {a16' = C2HSImp.fromBool a16} in 
  446   preErrorCheck $ \a17' -> 
  447   cpiBond'_ a1' a2' a3' a4'1  a4'2 a5' a6' a7' a8'1  a8'2 a9' a10' a11' a12' a13'1  a13'2 a14' a15' a16' a17' >>= \res ->
  448   peekCPIBond res >>= \res' ->
  449   errorCheck  a17'>>
  450   return (res')
  451 
  452 
  453 
  454 -- |zero-coupon bond
  455 zeroCouponBond :: (Word) -- ^settlementDays
  456  -> (Calendar) -> (Double) -- ^faceAmount
  457  -> (Day) -- ^maturityDate
  458  -> (BusinessDayConvention) -> (Double) -- ^redemption
  459  -> (Maybe Day) -- ^issueDate
  460  -> IO ((Bond))
  461 zeroCouponBond a1 a2 a3 a4 a5 a6 a7 =
  462   let {a1' = fromIntegral a1} in 
  463   withCalendar a2 $ \a2' -> 
  464   let {a3' = realToFrac a3} in 
  465   withDay a4 $ \a4' -> 
  466   let {a5' = fromEnumC a5} in 
  467   let {a6' = realToFrac a6} in 
  468   withMaybeDay a7 $ \a7' -> 
  469   preErrorCheck $ \a8' -> 
  470   zeroCouponBond'_ a1' a2' a3' a4' a5' a6' a7' a8' >>= \res ->
  471   peekBond res >>= \res' ->
  472   errorCheck  a8'>>
  473   return (res')
  474 
  475 
  476 
  477 -- |floating-rate bond (possibly capped and/or floored)
  478 floatingRateBond :: (Word) -- ^settlementDays
  479  -> (Double) -- ^faceAmount
  480  -> (Schedule) -- ^schedule
  481  -> (GenIborIndex ibor) -> (DayCounter) -- ^accrualDayCounter
  482  -> (BusinessDayConvention) -> (Word) -- ^fixingDays
  483  -> ([Double]) -- ^gearings
  484  -> ([Double]) -- ^spreads
  485  -> ([Double]) -- ^caps
  486  -> ([Double]) -- ^floors
  487  -> (Bool) -- ^inArrears
  488  -> (Double) -- ^redemption
  489  -> (Maybe Day) -- ^issueDate
  490  -> ((Int,TimeUnit)) -- ^exCouponPeriod
  491  -> (Calendar) -- ^exCouponCalendar
  492  -> (BusinessDayConvention) -- ^exCouponConvention
  493  -> (Bool) -- ^exCouponEndOfMonth
  494  -> (BusinessDayConvention) -- ^fixingConvention
  495  -> IO ((Bond))
  496 floatingRateBond a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 a19 =
  497   let {a1' = fromIntegral a1} in 
  498   let {a2' = realToFrac a2} in 
  499   withSchedule a3 $ \a3' -> 
  500   withIborIndex a4 $ \a4' -> 
  501   withDayCounter a5 $ \a5' -> 
  502   let {a6' = fromEnumC a6} in 
  503   let {a7' = fromIntegral a7} in 
  504   withDoubleArray a8 $ \(a8'1, a8'2) -> 
  505   withDoubleArray a9 $ \(a9'1, a9'2) -> 
  506   withDoubleArray a10 $ \(a10'1, a10'2) -> 
  507   withDoubleArray a11 $ \(a11'1, a11'2) -> 
  508   let {a12' = C2HSImp.fromBool a12} in 
  509   let {a13' = realToFrac a13} in 
  510   withMaybeDay a14 $ \a14' -> 
  511   let {(a15'1, a15'2) = fromEnumQuantity a15} in 
  512   withCalendar a16 $ \a16' -> 
  513   let {a17' = fromEnumC a17} in 
  514   let {a18' = C2HSImp.fromBool a18} in 
  515   let {a19' = fromEnumC a19} in 
  516   preErrorCheck $ \a20' -> 
  517   floatingRateBond'_ a1' a2' a3' a4' a5' a6' a7' a8'1  a8'2 a9'1  a9'2 a10'1  a10'2 a11'1  a11'2 a12' a13' a14' a15'1  a15'2 a16' a17' a18' a19' a20' >>= \res ->
  518   peekBond res >>= \res' ->
  519   errorCheck  a20'>>
  520   return (res')
  521 
  522 
  523 
  524 -- |CMS-rate bond
  525 cmsRateBond :: (Word) -- ^settlementDays
  526  -> (Double) -- ^faceAmount
  527  -> (Schedule) -- ^schedule
  528  -> (GenSwapIndex sidx) -> (DayCounter) -- ^paymentDayCounter
  529  -> (BusinessDayConvention) -- ^paymentConvention
  530  -> (Word) -- ^fixingDays
  531  -> ([Double]) -- ^gearings
  532  -> ([Double]) -- ^spreads
  533  -> ([Double]) -- ^caps
  534  -> ([Double]) -- ^floors
  535  -> (Bool) -- ^inArrears
  536  -> (Double) -- ^redemption
  537  -> (Maybe Day) -- ^issueDate
  538  -> IO ((Bond))
  539 cmsRateBond a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 =
  540   let {a1' = fromIntegral a1} in 
  541   let {a2' = realToFrac a2} in 
  542   withSchedule a3 $ \a3' -> 
  543   withSwapIndex a4 $ \a4' -> 
  544   withDayCounter a5 $ \a5' -> 
  545   let {a6' = fromEnumC a6} in 
  546   let {a7' = fromIntegral a7} in 
  547   withDoubleArray a8 $ \(a8'1, a8'2) -> 
  548   withDoubleArray a9 $ \(a9'1, a9'2) -> 
  549   withDoubleArray a10 $ \(a10'1, a10'2) -> 
  550   withDoubleArray a11 $ \(a11'1, a11'2) -> 
  551   let {a12' = C2HSImp.fromBool a12} in 
  552   let {a13' = realToFrac a13} in 
  553   withMaybeDay a14 $ \a14' -> 
  554   preErrorCheck $ \a15' -> 
  555   cmsRateBond'_ a1' a2' a3' a4' a5' a6' a7' a8'1  a8'2 a9'1  a9'2 a10'1  a10'2 a11'1  a11'2 a12' a13' a14' a15' >>= \res ->
  556   peekBond res >>= \res' ->
  557   errorCheck  a15'>>
  558   return (res')
  559 
  560 
  561 
  562 -- |amortizing CMS-rate bond (possibly capped and\/or floored) with a per-period
  563 -- notional schedule instead of a single face amount, and a per-period redemption
  564 -- schedule instead of a single redemption value.
  565 amortizingCmsRateBond :: (Word) -- ^settlementDays
  566  -> (NonEmpty Double) -- ^notionals
  567  -> (Schedule) -- ^schedule
  568  -> (GenSwapIndex sidx) -> (DayCounter) -- ^paymentDayCounter
  569  -> (BusinessDayConvention) -- ^paymentConvention
  570  -> (Word) -- ^fixingDays
  571  -> ([Double]) -- ^gearings
  572  -> ([Double]) -- ^spreads
  573  -> ([Double]) -- ^caps
  574  -> ([Double]) -- ^floors
  575  -> (Bool) -- ^inArrears
  576  -> (Maybe Day) -- ^issueDate
  577  -> ([Double]) -- ^redemptions
  578  -> IO ((Bond))
  579 amortizingCmsRateBond a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 =
  580   let {a1' = fromIntegral a1} in 
  581   withNonEmptyDoubleArray a2 $ \(a2'1, a2'2) -> 
  582   withSchedule a3 $ \a3' -> 
  583   withSwapIndex a4 $ \a4' -> 
  584   withDayCounter a5 $ \a5' -> 
  585   let {a6' = fromEnumC a6} in 
  586   let {a7' = fromIntegral a7} in 
  587   withDoubleArray a8 $ \(a8'1, a8'2) -> 
  588   withDoubleArray a9 $ \(a9'1, a9'2) -> 
  589   withDoubleArray a10 $ \(a10'1, a10'2) -> 
  590   withDoubleArray a11 $ \(a11'1, a11'2) -> 
  591   let {a12' = C2HSImp.fromBool a12} in 
  592   withMaybeDay a13 $ \a13' -> 
  593   withDoubleArray a14 $ \(a14'1, a14'2) -> 
  594   preErrorCheck $ \a15' -> 
  595   amortizingCmsRateBond'_ a1' a2'1  a2'2 a3' a4' a5' a6' a7' a8'1  a8'2 a9'1  a9'2 a10'1  a10'2 a11'1  a11'2 a12' a13' a14'1  a14'2 a15' >>= \res ->
  596   peekBond res >>= \res' ->
  597   errorCheck  a15'>>
  598   return (res')
  599 
  600 
  601 
  602 -- |amortizing floating-rate bond (possibly capped and\/or floored) with a per-period
  603 -- notional schedule instead of a single face amount; see 'AmortizingFloatingRateBondOpts'
  604 -- for the trailing optional parameters (default via 'defaultAmortizingFloatingRateBondOpts',
  605 -- override with record-update syntax).
  606 amortizingFloatingRateBond :: Word -> NonEmpty Double -> Schedule -> GenIborIndex ibor -> DayCounter
  607   -> AmortizingFloatingRateBondOpts -> IO Bond
  608 amortizingFloatingRateBond settlementDays notionalsArg schedule idx accrualDayCounter opts = do
  609   cal <- calendar Null
  610   amortizingFloatingRateBond_ settlementDays notionalsArg schedule idx accrualDayCounter
  611     (afrbPaymentConvention opts) (fromMaybeInt (afrbFixingDays opts))
  612     (afrbGearings opts) (afrbSpreads opts) (afrbCaps opts) (afrbFloors opts)
  613     (afrbInArrears opts) (afrbIssueDate opts) (afrbExCouponPeriod opts)
  614     (fromMaybe cal (afrbExCouponCalendar opts)) (afrbExCouponConvention opts)
  615     (afrbExCouponEndOfMonth opts) (afrbRedemptions opts) (afrbPaymentLag opts)
  616 
  617 -- |raw entry point for 'amortizingFloatingRateBond', taking every trailing option as a
  618 -- separate flat argument; see 'AmortizingFloatingRateBondOpts' for the public wrapper.
  619 amortizingFloatingRateBond_ :: (Word) -- ^settlementDays
  620  -> (NonEmpty Double) -- ^notionals
  621  -> (Schedule) -- ^schedule
  622  -> (GenIborIndex ibor) -> (DayCounter) -- ^accrualDayCounter
  623  -> (BusinessDayConvention) -- ^paymentConvention
  624  -> (Word) -- ^fixingDays
  625  -> ([Double]) -- ^gearings
  626  -> ([Double]) -- ^spreads
  627  -> ([Double]) -- ^caps
  628  -> ([Double]) -- ^floors
  629  -> (Bool) -- ^inArrears
  630  -> (Maybe Day) -- ^issueDate
  631  -> ((Int,TimeUnit)) -- ^exCouponPeriod
  632  -> (Calendar) -- ^exCouponCalendar
  633  -> (BusinessDayConvention) -- ^exCouponConvention
  634  -> (Bool) -- ^exCouponEndOfMonth
  635  -> ([Double]) -- ^redemptions
  636  -> (Int) -- ^paymentLag
  637  -> IO ((Bond))
  638 amortizingFloatingRateBond_ a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 a19 =
  639   let {a1' = fromIntegral a1} in 
  640   withNonEmptyDoubleArray a2 $ \(a2'1, a2'2) -> 
  641   withSchedule a3 $ \a3' -> 
  642   withIborIndex a4 $ \a4' -> 
  643   withDayCounter a5 $ \a5' -> 
  644   let {a6' = fromEnumC a6} in 
  645   let {a7' = fromIntegral a7} in 
  646   withDoubleArray a8 $ \(a8'1, a8'2) -> 
  647   withDoubleArray a9 $ \(a9'1, a9'2) -> 
  648   withDoubleArray a10 $ \(a10'1, a10'2) -> 
  649   withDoubleArray a11 $ \(a11'1, a11'2) -> 
  650   let {a12' = C2HSImp.fromBool a12} in 
  651   withMaybeDay a13 $ \a13' -> 
  652   let {(a14'1, a14'2) = fromEnumQuantity a14} in 
  653   withCalendar a15 $ \a15' -> 
  654   let {a16' = fromEnumC a16} in 
  655   let {a17' = C2HSImp.fromBool a17} in 
  656   withDoubleArray a18 $ \(a18'1, a18'2) -> 
  657   let {a19' = fromIntegral a19} in 
  658   preErrorCheck $ \a20' -> 
  659   amortizingFloatingRateBond_'_ a1' a2'1  a2'2 a3' a4' a5' a6' a7' a8'1  a8'2 a9'1  a9'2 a10'1  a10'2 a11'1  a11'2 a12' a13' a14'1  a14'2 a15' a16' a17' a18'1  a18'2 a19' a20' >>= \res ->
  660   peekBond res >>= \res' ->
  661   errorCheck  a20'>>
  662   return (res')
  663 
  664 
  665 
  666 -- |theoretical bond yield
  667 yield :: (GenBond b) -> (DayCounter) -> (Compounding) -> (Frequency) -> (Double) -- ^accuracy
  668  -> (Word) -- ^maxEvaluations
  669  -> (Double,BondPriceType) -- ^guess, priceType
  670  -> IO ((Double))
  671 yield a1 a2 a3 a4 a5 a6 a7 =
  672   withBond a1 $ \a1' -> 
  673   withDayCounter a2 $ \a2' -> 
  674   let {a3' = (fromIntegral . fromEnum) a3} in 
  675   let {a4' = (fromIntegral . fromEnum) a4} in 
  676   let {a5' = realToFrac a5} in 
  677   let {a6' = fromIntegral a6} in 
  678   let {(a7'1, a7'2) = fromEnumDouble a7} in 
  679   preErrorCheck $ \a8' -> 
  680   yield'_ a1' a2' a3' a4' a5' a6' a7'1  a7'2 a8' >>= \res ->
  681   let {res' = realToFrac res} in
  682   errorCheck  a8'>>
  683   return (res')
  684 
  685 
  686 
  687 -- |accrued amount at a given date
  688 accruedAmount :: (GenBond b) -> (Day) -> IO ((Double))
  689 accruedAmount a1 a2 =
  690   withBond a1 $ \a1' -> 
  691   withDay a2 $ \a2' -> 
  692   preErrorCheck $ \a3' -> 
  693   accruedAmount'_ a1' a2' a3' >>= \res ->
  694   let {res' = realToFrac res} in
  695   errorCheck  a3'>>
  696   return (res')
  697 
  698 
  699 
  700 -- |dirty price given a yield and settlement date
  701 dirtyPriceFromYield :: (GenBond b) -> (Double) -> (DayCounter) -> (Compounding) -> (Frequency) -> (Day) -> IO ((Double))
  702 dirtyPriceFromYield a1 a2 a3 a4 a5 a6 =
  703   withBond a1 $ \a1' -> 
  704   let {a2' = realToFrac a2} in 
  705   withDayCounter a3 $ \a3' -> 
  706   let {a4' = (fromIntegral . fromEnum) a4} in 
  707   let {a5' = (fromIntegral . fromEnum) a5} in 
  708   withDay a6 $ \a6' -> 
  709   preErrorCheck $ \a7' -> 
  710   dirtyPriceFromYield'_ a1' a2' a3' a4' a5' a6' a7' >>= \res ->
  711   let {res' = realToFrac res} in
  712   errorCheck  a7'>>
  713   return (res')
  714 
  715 
  716 
  717 -- |date of the next cash flow after the given (or default settlement) date
  718 nextCashFlowDate :: (GenBond b) -> (Day) -> IO ((Maybe Day))
  719 nextCashFlowDate a1 a2 =
  720   withBond a1 $ \a1' -> 
  721   withDay a2 $ \a2' -> 
  722   preErrorCheck $ \a3' -> 
  723   nextCashFlowDate'_ a1' a2' a3' >>= \res ->
  724   let {res' = toMaybeDay res} in
  725   errorCheck  a3'>>
  726   return (res')
  727 
  728 
  729 
  730 -- |Expected next coupon: depending on (the bond and) the given date the coupon can be historic, deterministic or expected in a stochastic sense. When the bond settlement date is used the coupon is the already-fixed not-yet-paid one.The current bond settlement is used if no date is given.
  731 nextCouponRate :: (GenBond b) -> (Day) -> IO ((Double))
  732 nextCouponRate a1 a2 =
  733   withBond a1 $ \a1' -> 
  734   withDay a2 $ \a2' -> 
  735   preErrorCheck $ \a3' -> 
  736   nextCouponRate'_ a1' a2' a3' >>= \res ->
  737   let {res' = realToFrac res} in
  738   errorCheck  a3'>>
  739   return (res')
  740 
  741 
  742 
  743 -- |bond notional outstanding at the given date
  744 notional :: (GenBond b) -> (Day) -> IO ((Double))
  745 notional a1 a2 =
  746   withBond a1 $ \a1' -> 
  747   withDay a2 $ \a2' -> 
  748   preErrorCheck $ \a3' -> 
  749   notional'_ a1' a2' a3' >>= \res ->
  750   let {res' = realToFrac res} in
  751   errorCheck  a3'>>
  752   return (res')
  753 
  754 
  755 
  756 -- |date of the cash flow immediately before the given (or default settlement) date
  757 previousCashFlowDate :: (GenBond b) -> (Day) -> IO ((Maybe Day))
  758 previousCashFlowDate a1 a2 =
  759   withBond a1 $ \a1' -> 
  760   withDay a2 $ \a2' -> 
  761   preErrorCheck $ \a3' -> 
  762   previousCashFlowDate'_ a1' a2' a3' >>= \res ->
  763   let {res' = toMaybeDay res} in
  764   errorCheck  a3'>>
  765   return (res')
  766 
  767 
  768 
  769 -- |Previous coupon already paid at a given date.
  770 -- Expected previous coupon: depending on (the bond and) the given date the coupon can be historic, deterministic or expected in a stochastic sense. When the bond settlement date is used the coupon is the last paid one.The current bond settlement is used if no date is given.
  771 previousCouponRate :: (GenBond b) -> (Day) -> IO ((Double))
  772 previousCouponRate a1 a2 =
  773   withBond a1 $ \a1' -> 
  774   withDay a2 $ \a2' -> 
  775   preErrorCheck $ \a3' -> 
  776   previousCouponRate'_ a1' a2' a3' >>= \res ->
  777   let {res' = realToFrac res} in
  778   errorCheck  a3'>>
  779   return (res')
  780 
  781 
  782 
  783 -- |settlement value as a function of the clean price
  784 -- The default bond settlement date is used for calculation.
  785 settlementValueFromCleanPrice :: (GenBond b) -> (Double) -> IO ((Double))
  786 settlementValueFromCleanPrice a1 a2 =
  787   withBond a1 $ \a1' -> 
  788   let {a2' = realToFrac a2} in 
  789   preErrorCheck $ \a3' -> 
  790   settlementValueFromCleanPrice'_ a1' a2' a3' >>= \res ->
  791   let {res' = realToFrac res} in
  792   errorCheck  a3'>>
  793   return (res')
  794 
  795 
  796 
  797 -- |theoretical settlement value
  798 -- The default bond settlement date is used for calculation.
  799 settlementValue :: (GenBond b) -> IO ((Double))
  800 settlementValue a1 =
  801   withBond a1 $ \a1' -> 
  802   preErrorCheck $ \a2' -> 
  803   settlementValue'_ a1' a2' >>= \res ->
  804   let {res' = realToFrac res} in
  805   errorCheck  a2'>>
  806   return (res')
  807 
  808 
  809 
  810 -- |yield given a (clean) price and settlement date
  811 yieldFromPrice :: (GenBond b) -> (Double,BondPriceType) -> (DayCounter) -> (Compounding) -> (Frequency) -> (Day) -- settlementDate
  812  -> (Double) -- ^accuracy
  813  -> (Word) -- ^maxEvaluations
  814  -> IO ((Double))
  815 yieldFromPrice a1 a2 a3 a4 a5 a6 a7 a8 =
  816   withBond a1 $ \a1' -> 
  817   let {(a2'1, a2'2) = fromEnumDouble a2} in 
  818   withDayCounter a3 $ \a3' -> 
  819   let {a4' = (fromIntegral . fromEnum) a4} in 
  820   let {a5' = (fromIntegral . fromEnum) a5} in 
  821   withDay a6 $ \a6' -> 
  822   let {a7' = realToFrac a7} in 
  823   let {a8' = fromIntegral a8} in 
  824   preErrorCheck $ \a9' -> 
  825   yieldFromPrice'_ a1' a2'1  a2'2 a3' a4' a5' a6' a7' a8' a9' >>= \res ->
  826   let {res' = realToFrac res} in
  827   errorCheck  a9'>>
  828   return (res')
  829 
  830 
  831 
  832 -- |whether the bond can be traded (i.e. still has a positive notional) at the given date
  833 isTradable :: (GenBond b) -> (Day) -> IO ((Bool))
  834 isTradable a1 a2 =
  835   withBond a1 $ \a1' -> 
  836   withDay a2 $ \a2' -> 
  837   preErrorCheck $ \a3' -> 
  838   isTradable'_ a1' a2' a3' >>= \res ->
  839   let {res' = C2HSImp.toBool res} in
  840   errorCheck  a3'>>
  841   return (res')
  842 
  843 
  844 
  845 -- |notionals for each period of the bond's amortization schedule
  846 notionals :: (GenBond b) -> IO (([Double]))
  847 notionals a1 =
  848   withBond a1 $ \a1' -> 
  849   preDoubleArray $ \(a2'1, a2'2) -> 
  850   preErrorCheck $ \a3' -> 
  851   notionals'_ a1' a2'1  a2'2 a3' >>
  852   peekDoubleArray  a2'1  a2'2>>= \a2'' -> 
  853   errorCheck  a3'>>
  854   return (a2'')
  855 
  856 
  857 
  858 -- |returns all the cashflows, including the redemptions.
  859 cashFlows :: (GenBond b) -> IO ((Leg))
  860 cashFlows a1 =
  861   withBond a1 $ \a1' -> 
  862   preErrorCheck $ \a2' -> 
  863   cashFlows'_ a1' a2' >>= \res ->
  864   peekLeg res >>= \res' ->
  865   errorCheck  a2'>>
  866   return (res')
  867 
  868 
  869 
  870 -- |returns just the redemption flows (not interest payments)
  871 redemptions :: (GenBond b) -> IO ((Leg))
  872 redemptions a1 =
  873   withBond a1 $ \a1' -> 
  874   preErrorCheck $ \a2' -> 
  875   redemptions'_ a1' a2' >>= \res ->
  876   peekLeg res >>= \res' ->
  877   errorCheck  a2'>>
  878   return (res')
  879 
  880 
  881 
  882 -- |settlement date computed from the given date (or today's date if none is given)
  883 settlementDate :: (GenBond b) -> (Day) -> IO ((Day))
  884 settlementDate a1 a2 =
  885   withBond a1 $ \a1' -> 
  886   withDay a2 $ \a2' -> 
  887   preErrorCheck $ \a3' -> 
  888   settlementDate'_ a1' a2' a3' >>= \res ->
  889   let {res' = toDay res} in
  890   errorCheck  a3'>>
  891   return (res')
  892 
  893 
  894 
  895 -- |date the bond starts accruing
  896 startDate :: (GenBond b) -> IO ((Day))
  897 startDate a1 =
  898   withBond a1 $ \a1' -> 
  899   preErrorCheck $ \a2' -> 
  900   startDate'_ a1' a2' >>= \res ->
  901   let {res' = toDay res} in
  902   errorCheck  a2'>>
  903   return (res')
  904 
  905 
  906 
  907 -- |number of days in the current accrual period up to the given (or default settlement) date
  908 accrualDays :: (GenBond b) -> (Day) -> IO ((Int))
  909 accrualDays a1 a2 =
  910   withBond a1 $ \a1' -> 
  911   withDay a2 $ \a2' -> 
  912   preErrorCheck $ \a3' -> 
  913   accrualDays'_ a1' a2' a3' >>= \res ->
  914   let {res' = fromIntegral res} in
  915   errorCheck  a3'>>
  916   return (res')
  917 
  918 
  919 
  920 -- |end date of the accrual period containing the given (or default settlement) date
  921 accrualEndDate :: (GenBond b) -> (Day) -> IO ((Maybe Day))
  922 accrualEndDate a1 a2 =
  923   withBond a1 $ \a1' -> 
  924   withDay a2 $ \a2' -> 
  925   preErrorCheck $ \a3' -> 
  926   accrualEndDate'_ a1' a2' a3' >>= \res ->
  927   let {res' = toMaybeDay res} in
  928   errorCheck  a3'>>
  929   return (res')
  930 
  931 
  932 
  933 -- |length in time of the accrual period containing the given (or default settlement) date
  934 accrualPeriod :: (GenBond b) -> (Day) -> IO ((Double))
  935 accrualPeriod a1 a2 =
  936   withBond a1 $ \a1' -> 
  937   withDay a2 $ \a2' -> 
  938   preErrorCheck $ \a3' -> 
  939   accrualPeriod'_ a1' a2' a3' >>= \res ->
  940   let {res' = realToFrac res} in
  941   errorCheck  a3'>>
  942   return (res')
  943 
  944 
  945 
  946 -- |start date of the accrual period containing the given (or default settlement) date
  947 accrualStartDate :: (GenBond b) -> (Day) -> IO ((Maybe Day))
  948 accrualStartDate a1 a2 =
  949   withBond a1 $ \a1' -> 
  950   withDay a2 $ \a2' -> 
  951   preErrorCheck $ \a3' -> 
  952   accrualStartDate'_ a1' a2' a3' >>= \res ->
  953   let {res' = toMaybeDay res} in
  954   errorCheck  a3'>>
  955   return (res')
  956 
  957 
  958 
  959 -- |number of days accrued up to the given (or default settlement) date
  960 accruedDays :: (GenBond b) -> (Day) -> IO ((Int))
  961 accruedDays a1 a2 =
  962   withBond a1 $ \a1' -> 
  963   withDay a2 $ \a2' -> 
  964   preErrorCheck $ \a3' -> 
  965   accruedDays'_ a1' a2' a3' >>= \res ->
  966   let {res' = fromIntegral res} in
  967   errorCheck  a3'>>
  968   return (res')
  969 
  970 
  971 
  972 -- |length in time accrued up to the given (or default settlement) date
  973 accruedPeriod :: (GenBond b) -> (Day) -> IO ((Double))
  974 accruedPeriod a1 a2 =
  975   withBond a1 $ \a1' -> 
  976   withDay a2 $ \a2' -> 
  977   preErrorCheck $ \a3' -> 
  978   accruedPeriod'_ a1' a2' a3' >>= \res ->
  979   let {res' = realToFrac res} in
  980   errorCheck  a3'>>
  981   return (res')
  982 
  983 
  984 
  985 -- |basis-point value given an 'InterestRate' yield
  986 basisPointValue :: (GenBond b) -> (InterestRate) -> (Day) -> IO ((Double))
  987 basisPointValue a1 a2 a3 =
  988   withBond a1 $ \a1' -> 
  989   withInterestRate a2 $ \a2' -> 
  990   withDay a3 $ \a3' -> 
  991   preErrorCheck $ \a4' -> 
  992   basisPointValue'_ a1' a2' a3' a4' >>= \res ->
  993   let {res' = realToFrac res} in
  994   errorCheck  a4'>>
  995   return (res')
  996 
  997 
  998 
  999 -- |bps (Basis Point Sensitivity) given an 'InterestRate' yield
 1000 bpsFromYieldRaw :: (GenBond b) -> (InterestRate) -> (Day) -> IO ((Double))
 1001 bpsFromYieldRaw a1 a2 a3 =
 1002   withBond a1 $ \a1' -> 
 1003   withInterestRate a2 $ \a2' -> 
 1004   withDay a3 $ \a3' -> 
 1005   preErrorCheck $ \a4' -> 
 1006   bpsFromYieldRaw'_ a1' a2' a3' a4' >>= \res ->
 1007   let {res' = realToFrac res} in
 1008   errorCheck  a4'>>
 1009   return (res')
 1010 
 1011 
 1012 
 1013 -- |bps (Basis Point Sensitivity) given a discount curve
 1014 bpsFromCurveRaw :: (GenBond b) -> (GenYieldTermStructure y) -> (Day) -> IO ((Double))
 1015 bpsFromCurveRaw a1 a2 a3 =
 1016   withBond a1 $ \a1' -> 
 1017   withYieldTermStructure a2 $ \a2' -> 
 1018   withDay a3 $ \a3' -> 
 1019   preErrorCheck $ \a4' -> 
 1020   bpsFromCurveRaw'_ a1' a2' a3' a4' >>= \res ->
 1021   let {res' = realToFrac res} in
 1022   errorCheck  a4'>>
 1023   return (res')
 1024 
 1025 
 1026 
 1027 -- |clean price given a discount curve and settlement date
 1028 cleanPriceFromCurveRaw :: (GenBond b) -> (GenYieldTermStructure y) -> (Day) -> IO ((Double))
 1029 cleanPriceFromCurveRaw a1 a2 a3 =
 1030   withBond a1 $ \a1' -> 
 1031   withYieldTermStructure a2 $ \a2' -> 
 1032   withDay a3 $ \a3' -> 
 1033   preErrorCheck $ \a4' -> 
 1034   cleanPriceFromCurveRaw'_ a1' a2' a3' a4' >>= \res ->
 1035   let {res' = realToFrac res} in
 1036   errorCheck  a4'>>
 1037   return (res')
 1038 
 1039 
 1040 
 1041 -- |clean price given a discount curve, a Z-spread over it, compounding and frequency
 1042 cleanPriceWithZSpreadRaw :: (GenBond b) -> (GenYieldTermStructure y) -- ^discount
 1043  -> (Double) -- ^zSpread
 1044  -> (Compounding) -> (Frequency) -> (Day) -- ^settlementDate
 1045  -> IO ((Double))
 1046 cleanPriceWithZSpreadRaw a1 a2 a3 a4 a5 a6 =
 1047   withBond a1 $ \a1' -> 
 1048   withYieldTermStructure a2 $ \a2' -> 
 1049   let {a3' = realToFrac a3} in 
 1050   let {a4' = (fromIntegral . fromEnum) a4} in 
 1051   let {a5' = (fromIntegral . fromEnum) a5} in 
 1052   withDay a6 $ \a6' -> 
 1053   preErrorCheck $ \a7' -> 
 1054   cleanPriceWithZSpreadRaw'_ a1' a2' a3' a4' a5' a6' a7' >>= \res ->
 1055   let {res' = realToFrac res} in
 1056   errorCheck  a7'>>
 1057   return (res')
 1058 
 1059 
 1060 
 1061 -- |clean price given an 'InterestRate' yield
 1062 cleanPriceFromYieldRaw :: (GenBond b) -> (InterestRate) -> (Day) -> IO ((Double))
 1063 cleanPriceFromYieldRaw a1 a2 a3 =
 1064   withBond a1 $ \a1' -> 
 1065   withInterestRate a2 $ \a2' -> 
 1066   withDay a3 $ \a3' -> 
 1067   preErrorCheck $ \a4' -> 
 1068   cleanPriceFromYieldRaw'_ a1' a2' a3' a4' >>= \res ->
 1069   let {res' = realToFrac res} in
 1070   errorCheck  a4'>>
 1071   return (res')
 1072 
 1073 
 1074 
 1075 -- |Clean price under the given discounting, at a settlement date.
 1076 cleanPrice :: GenBond b -> Discounting y -> Day -> IO Double
 1077 cleanPrice instr discounting = case discounting of
 1078   DiscountingCurve curve -> cleanPriceFromCurveRaw instr curve
 1079   DiscountingZSpread curve z comp freq -> cleanPriceWithZSpreadRaw instr curve z comp freq
 1080   DiscountingYield y -> cleanPriceFromYieldRaw instr y
 1081 
 1082 -- |Basis-point sensitivity under the given discounting, at a settlement date.
 1083 bps :: GenBond b -> BpsDiscounting y -> Day -> IO Double
 1084 bps instr discounting = case discounting of
 1085   BpsDiscountingCurve curve -> bpsFromCurveRaw instr curve
 1086   BpsDiscountingYield y -> bpsFromYieldRaw instr y
 1087 
 1088 -- |convexity given an 'InterestRate' yield
 1089 convexity :: (GenBond b) -> (InterestRate) -- ^yield
 1090  -> (Day) -- ^settlementDate
 1091  -> IO ((Double))
 1092 convexity a1 a2 a3 =
 1093   withBond a1 $ \a1' -> 
 1094   withInterestRate a2 $ \a2' -> 
 1095   withDay a3 $ \a3' -> 
 1096   preErrorCheck $ \a4' -> 
 1097   convexity'_ a1' a2' a3' a4' >>= \res ->
 1098   let {res' = realToFrac res} in
 1099   errorCheck  a4'>>
 1100   return (res')
 1101 
 1102 
 1103 
 1104 -- |duration given an 'InterestRate' yield and duration type
 1105 duration :: (GenBond b) -> (InterestRate) -- ^yield
 1106  -> (DurationType) -> (Day) -> IO ((Double))
 1107 duration a1 a2 a3 a4 =
 1108   withBond a1 $ \a1' -> 
 1109   withInterestRate a2 $ \a2' -> 
 1110   let {a3' = (fromIntegral . fromEnum) a3} in 
 1111   withDay a4 $ \a4' -> 
 1112   preErrorCheck $ \a5' -> 
 1113   duration'_ a1' a2' a3' a4' a5' >>= \res ->
 1114   let {res' = realToFrac res} in
 1115   errorCheck  a5'>>
 1116   return (res')
 1117 
 1118 
 1119 
 1120 -- |amount of the cash flow immediately after the given (or default settlement) date
 1121 nextCashFlowAmount :: (GenBond b) -> (Day) -> IO ((Double))
 1122 nextCashFlowAmount a1 a2 =
 1123   withBond a1 $ \a1' -> 
 1124   withDay a2 $ \a2' -> 
 1125   preErrorCheck $ \a3' -> 
 1126   nextCashFlowAmount'_ a1' a2' a3' >>= \res ->
 1127   let {res' = realToFrac res} in
 1128   errorCheck  a3'>>
 1129   return (res')
 1130 
 1131 
 1132 
 1133 -- |amount of the cash flow immediately before the given (or default settlement) date
 1134 previousCashFlowAmount :: (GenBond b) -> (Day) -> IO ((Double))
 1135 previousCashFlowAmount a1 a2 =
 1136   withBond a1 $ \a1' -> 
 1137   withDay a2 $ \a2' -> 
 1138   preErrorCheck $ \a3' -> 
 1139   previousCashFlowAmount'_ a1' a2' a3' >>= \res ->
 1140   let {res' = realToFrac res} in
 1141   errorCheck  a3'>>
 1142   return (res')
 1143 
 1144 
 1145 
 1146 -- |end date of the reference period containing the given (or default settlement) date
 1147 referencePeriodEnd :: (GenBond b) -> (Day) -> IO ((Maybe Day))
 1148 referencePeriodEnd a1 a2 =
 1149   withBond a1 $ \a1' -> 
 1150   withDay a2 $ \a2' -> 
 1151   preErrorCheck $ \a3' -> 
 1152   referencePeriodEnd'_ a1' a2' a3' >>= \res ->
 1153   let {res' = toMaybeDay res} in
 1154   errorCheck  a3'>>
 1155   return (res')
 1156 
 1157 
 1158 
 1159 -- |start date of the reference period containing the given (or default settlement) date
 1160 referencePeriodStart :: (GenBond b) -> (Day) -> IO ((Maybe Day))
 1161 referencePeriodStart a1 a2 =
 1162   withBond a1 $ \a1' -> 
 1163   withDay a2 $ \a2' -> 
 1164   preErrorCheck $ \a3' -> 
 1165   referencePeriodStart'_ a1' a2' a3' >>= \res ->
 1166   let {res' = toMaybeDay res} in
 1167   errorCheck  a3'>>
 1168   return (res')
 1169 
 1170 
 1171 
 1172 -- |yield given a (clean) price and settlement date, solved to the given accuracy
 1173 yieldFromPriceWithGuess :: (GenBond b) -> (Double,BondPriceType) -> (DayCounter) -> (Compounding) -> (Frequency) -> (Day) -- ^settlementDate
 1174  -> (Double) --  ^accuracy
 1175  -> (Word) -- ^maxIterations
 1176  -> (Double) -- ^guess
 1177  -> IO ((Double))
 1178 yieldFromPriceWithGuess a1 a2 a3 a4 a5 a6 a7 a8 a9 =
 1179   withBond a1 $ \a1' -> 
 1180   let {(a2'1, a2'2) = fromEnumDouble a2} in 
 1181   withDayCounter a3 $ \a3' -> 
 1182   let {a4' = (fromIntegral . fromEnum) a4} in 
 1183   let {a5' = (fromIntegral . fromEnum) a5} in 
 1184   withDay a6 $ \a6' -> 
 1185   let {a7' = realToFrac a7} in 
 1186   let {a8' = fromIntegral a8} in 
 1187   let {a9' = realToFrac a9} in 
 1188   preErrorCheck $ \a10' -> 
 1189   yieldFromPriceWithGuess'_ a1' a2'1  a2'2 a3' a4' a5' a6' a7' a8' a9' a10' >>= \res ->
 1190   let {res' = realToFrac res} in
 1191   errorCheck  a10'>>
 1192   return (res')
 1193 
 1194 
 1195 
 1196 -- |yield value of a basis point given an 'InterestRate' yield
 1197 yieldValueBasisPoint :: (GenBond b) -> (InterestRate) -- ^yield
 1198  -> (Day) -> IO ((Double))
 1199 yieldValueBasisPoint a1 a2 a3 =
 1200   withBond a1 $ \a1' -> 
 1201   withInterestRate a2 $ \a2' -> 
 1202   withDay a3 $ \a3' -> 
 1203   preErrorCheck $ \a4' -> 
 1204   yieldValueBasisPoint'_ a1' a2' a3' a4' >>= \res ->
 1205   let {res' = realToFrac res} in
 1206   errorCheck  a4'>>
 1207   return (res')
 1208 
 1209 
 1210 
 1211 -- |Z-spread over a discount curve implied by a (clean) price, solved to the given accuracy
 1212 zSpread :: (GenBond b) -> (Double,BondPriceType) -> (GenYieldTermStructure y) -> (Compounding) -> (Frequency) -> (Day) -- ^settlementDate
 1213  -> (Double) -- ^accuracy
 1214  -> (Word) -- ^maxIterations
 1215  -> (Double) -- ^guess
 1216  -> IO ((Double))
 1217 zSpread a1 a2 a3 a4 a5 a6 a7 a8 a9 =
 1218   withBond a1 $ \a1' -> 
 1219   let {(a2'1, a2'2) = fromEnumDouble a2} in 
 1220   withYieldTermStructure a3 $ \a3' -> 
 1221   let {a4' = (fromIntegral . fromEnum) a4} in 
 1222   let {a5' = (fromIntegral . fromEnum) a5} in 
 1223   withDay a6 $ \a6' -> 
 1224   let {a7' = realToFrac a7} in 
 1225   let {a8' = fromIntegral a8} in 
 1226   let {a9' = realToFrac a9} in 
 1227   preErrorCheck $ \a10' -> 
 1228   zSpread'_ a1' a2'1  a2'2 a3' a4' a5' a6' a7' a8' a9' a10' >>= \res ->
 1229   let {res' = realToFrac res} in
 1230   errorCheck  a10'>>
 1231   return (res')
 1232 
 1233 
 1234 
 1235 -- |theoretical clean price for the current evaluation date and term structure
 1236 currentCleanPrice :: (GenBond b) -> IO ((Double))
 1237 currentCleanPrice a1 =
 1238   withBond a1 $ \a1' -> 
 1239   preErrorCheck $ \a2' -> 
 1240   currentCleanPrice'_ a1' a2' >>= \res ->
 1241   let {res' = realToFrac res} in
 1242   errorCheck  a2'>>
 1243   return (res')
 1244 
 1245 
 1246 
 1247 -- |theoretical dirty price
 1248 -- The default bond settlement is used for calculation. /Warning/ the theoretical price calculated from a flat term structure might differ slightly from the price calculated from the corresponding yield by means of the other overload of this function. If the price from a constant yield is desired, it is advisable to use such other overload.
 1249 currentDirtyPrice :: (GenBond b) -> IO ((Double))
 1250 currentDirtyPrice a1 =
 1251   withBond a1 $ \a1' -> 
 1252   preErrorCheck $ \a2' -> 
 1253   currentDirtyPrice'_ a1' a2' >>= \res ->
 1254   let {res' = realToFrac res} in
 1255   errorCheck  a2'>>
 1256   return (res')
 1257 
 1258 
 1259 
 1260 -- |fixed-rate bond with an embedded call\/put schedule
 1261 callableFixedRateBond :: (Word) -- ^settlementDays
 1262  -> (Double) -- ^faceAmount
 1263  -> (Schedule) -> (NonEmpty Double) -- ^coupons
 1264  -> (DayCounter) -> (BusinessDayConvention) -> (Double) -- ^redemption
 1265  -> (Maybe Day) -- ^issueDate
 1266  -> ([Callability]) -> ((Int,TimeUnit)) -- ^exCouponPeriod
 1267  -> (Calendar) -- ^exCouponCalendar
 1268  -> (BusinessDayConvention) -- ^exCouponConvention
 1269  -> (Bool) -- ^exCouponEndOfMonth
 1270  -> IO ((CallableBond))
 1271 callableFixedRateBond a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 =
 1272   let {a1' = fromIntegral a1} in 
 1273   let {a2' = realToFrac a2} in 
 1274   withSchedule a3 $ \a3' -> 
 1275   withNonEmptyDoubleArray a4 $ \(a4'1, a4'2) -> 
 1276   withDayCounter a5 $ \a5' -> 
 1277   let {a6' = fromEnumC a6} in 
 1278   let {a7' = realToFrac a7} in 
 1279   withMaybeDay a8 $ \a8' -> 
 1280   withCallabilityArray a9 $ \(a9'1, a9'2) -> 
 1281   let {(a10'1, a10'2) = fromEnumQuantity a10} in 
 1282   withCalendar a11 $ \a11' -> 
 1283   let {a12' = fromEnumC a12} in 
 1284   let {a13' = C2HSImp.fromBool a13} in 
 1285   preErrorCheck $ \a14' -> 
 1286   callableFixedRateBond'_ a1' a2' a3' a4'1  a4'2 a5' a6' a7' a8' a9'1  a9'2 a10'1  a10'2 a11' a12' a13' a14' >>= \res ->
 1287   peekCallableBond res >>= \res' ->
 1288   errorCheck  a14'>>
 1289   return (res')
 1290 
 1291 
 1292 
 1293 -- |zero-coupon bond with an embedded call\/put schedule
 1294 callableZeroCouponBond :: (Word) -- ^settlementDays
 1295  -> (Double) -- ^faceAmount
 1296  -> (Calendar) -> (Day) -- ^maturityDate
 1297  -> (DayCounter) -> (BusinessDayConvention) -> (Double) -- ^redemption
 1298  -> (Maybe Day) -- ^issueDate
 1299  -> ([Callability]) -> IO ((CallableBond))
 1300 callableZeroCouponBond a1 a2 a3 a4 a5 a6 a7 a8 a9 =
 1301   let {a1' = fromIntegral a1} in 
 1302   let {a2' = realToFrac a2} in 
 1303   withCalendar a3 $ \a3' -> 
 1304   withDay a4 $ \a4' -> 
 1305   withDayCounter a5 $ \a5' -> 
 1306   let {a6' = fromEnumC a6} in 
 1307   let {a7' = realToFrac a7} in 
 1308   withMaybeDay a8 $ \a8' -> 
 1309   withCallabilityArray a9 $ \(a9'1, a9'2) -> 
 1310   preErrorCheck $ \a10' -> 
 1311   callableZeroCouponBond'_ a1' a2' a3' a4' a5' a6' a7' a8' a9'1  a9'2 a10' >>= \res ->
 1312   peekCallableBond res >>= \res' ->
 1313   errorCheck  a10'>>
 1314   return (res')
 1315 
 1316 
 1317 
 1318 -- |convertible bond with a fixed-rate coupon leg
 1319 convertibleFixedCouponBond :: (Exercise) -> (Double) -- ^conversionRatio
 1320  -> ([Callability]) -> (Day) -- ^issueDate
 1321  -> (Word) -- ^settlementDays
 1322  -> (NonEmpty Double) -- ^coupons
 1323  -> (DayCounter) -> (Schedule) -> (Double) -- ^redemption
 1324  -> ((Int,TimeUnit)) -- ^exCouponPeriod
 1325  -> (Calendar) -- ^exCouponCalendar
 1326  -> (BusinessDayConvention) -- ^exCouponConvention
 1327  -> (Bool) -- ^exCouponEndOfMonth
 1328  -> IO ((ConvertibleBond))
 1329 convertibleFixedCouponBond a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 =
 1330   withExercise a1 $ \a1' -> 
 1331   let {a2' = realToFrac a2} in 
 1332   withCallabilityArray a3 $ \(a3'1, a3'2) -> 
 1333   withDay a4 $ \a4' -> 
 1334   let {a5' = fromIntegral a5} in 
 1335   withNonEmptyDoubleArray a6 $ \(a6'1, a6'2) -> 
 1336   withDayCounter a7 $ \a7' -> 
 1337   withSchedule a8 $ \a8' -> 
 1338   let {a9' = realToFrac a9} in 
 1339   let {(a10'1, a10'2) = fromEnumQuantity a10} in 
 1340   withCalendar a11 $ \a11' -> 
 1341   let {a12' = fromEnumC a12} in 
 1342   let {a13' = C2HSImp.fromBool a13} in 
 1343   preErrorCheck $ \a14' -> 
 1344   convertibleFixedCouponBond'_ a1' a2' a3'1  a3'2 a4' a5' a6'1  a6'2 a7' a8' a9' a10'1  a10'2 a11' a12' a13' a14' >>= \res ->
 1345   peekConvertibleBond res >>= \res' ->
 1346   errorCheck  a14'>>
 1347   return (res')
 1348 
 1349 
 1350 
 1351 -- |convertible bond with a floating-rate coupon leg
 1352 convertibleFloatingRateBond :: (Exercise) -> (Double) -- ^conversionRatio
 1353  -> ([Callability]) -> (Day) -- ^issueDate
 1354  -> (Word) -- ^settlementDays
 1355  -> (GenIborIndex ibor) -> (Word) -- ^fixingDays
 1356  -> ([Double]) -- ^spreads
 1357  -> (DayCounter) -> (Schedule) -> (Double) -- ^redemption
 1358  -> ((Int,TimeUnit)) -- ^exCouponPeriod
 1359  -> (Calendar) -- ^exCouponCalendar
 1360  -> (BusinessDayConvention) -- ^exCouponConvention
 1361  -> (Bool) -- ^exCouponEndOfMonth
 1362  -> IO ((ConvertibleBond))
 1363 convertibleFloatingRateBond a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 =
 1364   withExercise a1 $ \a1' -> 
 1365   let {a2' = realToFrac a2} in 
 1366   withCallabilityArray a3 $ \(a3'1, a3'2) -> 
 1367   withDay a4 $ \a4' -> 
 1368   let {a5' = fromIntegral a5} in 
 1369   withIborIndex a6 $ \a6' -> 
 1370   let {a7' = fromIntegral a7} in 
 1371   withDoubleArray a8 $ \(a8'1, a8'2) -> 
 1372   withDayCounter a9 $ \a9' -> 
 1373   withSchedule a10 $ \a10' -> 
 1374   let {a11' = realToFrac a11} in 
 1375   let {(a12'1, a12'2) = fromEnumQuantity a12} in 
 1376   withCalendar a13 $ \a13' -> 
 1377   let {a14' = fromEnumC a14} in 
 1378   let {a15' = C2HSImp.fromBool a15} in 
 1379   preErrorCheck $ \a16' -> 
 1380   convertibleFloatingRateBond'_ a1' a2' a3'1  a3'2 a4' a5' a6' a7' a8'1  a8'2 a9' a10' a11' a12'1  a12'2 a13' a14' a15' a16' >>= \res ->
 1381   peekConvertibleBond res >>= \res' ->
 1382   errorCheck  a16'>>
 1383   return (res')
 1384 
 1385 
 1386 
 1387 -- |convertible zero-coupon bond
 1388 convertibleZeroCouponBond :: (Exercise) -> (Double) -- ^conversionRatio
 1389  -> ([Callability]) -> (Day) -- ^issueDate
 1390  -> (Word) -- ^settlementDays
 1391  -> (DayCounter) -> (Schedule) -> (Double) -- redemption
 1392  -> IO ((ConvertibleBond))
 1393 convertibleZeroCouponBond a1 a2 a3 a4 a5 a6 a7 a8 =
 1394   withExercise a1 $ \a1' -> 
 1395   let {a2' = realToFrac a2} in 
 1396   withCallabilityArray a3 $ \(a3'1, a3'2) -> 
 1397   withDay a4 $ \a4' -> 
 1398   let {a5' = fromIntegral a5} in 
 1399   withDayCounter a6 $ \a6' -> 
 1400   withSchedule a7 $ \a7' -> 
 1401   let {a8' = realToFrac a8} in 
 1402   preErrorCheck $ \a9' -> 
 1403   convertibleZeroCouponBond'_ a1' a2' a3'1  a3'2 a4' a5' a6' a7' a8' a9' >>= \res ->
 1404   peekConvertibleBond res >>= \res' ->
 1405   errorCheck  a9'>>
 1406   return (res')
 1407 
 1408 
 1409 
 1410 -- |A weighted collection of BTPs with their outstanding amounts and live clean-price quotes,
 1411 -- used by 'rendistatoCalculator'. size\/btps\/cleanPriceQuotes\/outstandings\/weights\/outstanding
 1412 -- are all constructor echoes and are not bound.
 1413 rendistatoBasket :: NonEmpty (BTP, Double, GenQuote q) -> IO RendistatoBasket
 1414 rendistatoBasket xs = qlRendistatoBasket btps outstandings quotes
 1415   where (btps, outstandings, quotes) = unzip3 (toList xs)
 1416 qlRendistatoBasket :: ([BTP]) -> ([Double]) -> ([GenQuote q]) -> IO ((RendistatoBasket))
 1417 qlRendistatoBasket a1 a2 a3 =
 1418   withBTPArray a1 $ \(a1'1, a1'2) -> 
 1419   withDoubleArray a2 $ \(a2'1, a2'2) -> 
 1420   withQuoteArray a3 $ \(a3'1, a3'2) -> 
 1421   preErrorCheck $ \a4' -> 
 1422   qlRendistatoBasket'_ a1'1  a1'2 a2'1  a2'2 a3'1  a3'2 a4' >>= \res ->
 1423   peekRendistatoBasket res >>= \res' ->
 1424   errorCheck  a4'>>
 1425   return (res')
 1426 
 1427 
 1428 
 1429 -- |QuantLib's own BTP-vs-EUR-swap-curve relative-value tool
 1430 -- (@ql\/instruments\/bonds\/btp.hpp@'s @RendistatoCalculator@): aggregates a 'RendistatoBasket'
 1431 -- into a weighted BTP yield\/duration, prices a fixed ladder of 1..15Y EUR swaps against a
 1432 -- discount curve, and reports the swap whose duration is closest to (without exceeding) the
 1433 -- basket's own duration as the \"equivalent swap\". @euriborForwardCurve@ forwards the internally
 1434 -- constructed Euribor index used for those comparison swaps' floating leg -- matching upstream's
 1435 -- own @Euribor@ default when @Nothing@, but the calculator immediately prices those swaps
 1436 -- (@fairRate@), which needs a real forwarding curve to project floating cashflows, so a
 1437 -- @Nothing@ here throws rather than degrading gracefully; pass the same curve as
 1438 -- @discountCurve@ unless a genuinely different forward curve is wanted. @discountCurve@ is
 1439 -- required, with no upstream default.
 1440 rendistatoCalculator :: (RendistatoBasket) -- ^basket
 1441  -> ((Int,TimeUnit)) -- ^euriborTenor
 1442  -> (Maybe (GenYieldTermStructure y1)) -- ^euriborForwardCurve
 1443  -> (GenYieldTermStructure y2) -- ^discountCurve
 1444  -> IO ((RendistatoCalculator))
 1445 rendistatoCalculator a1 a2 a3 a4 =
 1446   withRendistatoBasket a1 $ \a1' -> 
 1447   let {(a2'1, a2'2) = fromEnumQuantity a2} in 
 1448   withMaybeYieldTermStructure a3 $ \a3' -> 
 1449   withYieldTermStructure a4 $ \a4' -> 
 1450   preErrorCheck $ \a5' -> 
 1451   rendistatoCalculator'_ a1' a2'1  a2'2 a3' a4' a5' >>= \res ->
 1452   peekRendistatoCalculator res >>= \res' ->
 1453   errorCheck  a5'>>
 1454   return (res')
 1455 
 1456 
 1457 
 1458 -- |the basket's outstanding-weighted BTP yield: @sum (weights * yields)@ -- a near-tautology
 1459 -- over 'rendistatoYields', kept because it is upstream's own published aggregate.
 1460 rendistatoYield :: (RendistatoCalculator) -> IO ((Double))
 1461 rendistatoYield a1 =
 1462   withRendistatoCalculator a1 $ \a1' -> 
 1463   preErrorCheck $ \a2' -> 
 1464   rendistatoYield'_ a1' a2' >>= \res ->
 1465   let {res' = realToFrac res} in
 1466   errorCheck  a2'>>
 1467   return (res')
 1468 
 1469 
 1470 
 1471 -- |the basket's outstanding-weighted BTP (modified) duration.
 1472 rendistatoDuration :: (RendistatoCalculator) -> IO ((Double))
 1473 rendistatoDuration a1 =
 1474   withRendistatoCalculator a1 $ \a1' -> 
 1475   preErrorCheck $ \a2' -> 
 1476   rendistatoDuration'_ a1' a2' >>= \res ->
 1477   let {res' = realToFrac res} in
 1478   errorCheck  a2'>>
 1479   return (res')
 1480 
 1481 
 1482 
 1483 -- |per-bond yields, in basket order.
 1484 rendistatoYields :: (RendistatoCalculator) -> IO (([Double]))
 1485 rendistatoYields a1 =
 1486   withRendistatoCalculator a1 $ \a1' -> 
 1487   preDoubleArray $ \(a2'1, a2'2) -> 
 1488   preErrorCheck $ \a3' -> 
 1489   rendistatoYields'_ a1' a2'1  a2'2 a3' >>
 1490   peekDoubleArray  a2'1  a2'2>>= \a2'' -> 
 1491   errorCheck  a3'>>
 1492   return (a2'')
 1493 
 1494 
 1495 
 1496 -- |per-bond (modified) durations, in basket order.
 1497 rendistatoDurations :: (RendistatoCalculator) -> IO (([Double]))
 1498 rendistatoDurations a1 =
 1499   withRendistatoCalculator a1 $ \a1' -> 
 1500   preDoubleArray $ \(a2'1, a2'2) -> 
 1501   preErrorCheck $ \a3' -> 
 1502   rendistatoDurations'_ a1' a2'1  a2'2 a3' >>
 1503   peekDoubleArray  a2'1  a2'2>>= \a2'' -> 
 1504   errorCheck  a3'>>
 1505   return (a2'')
 1506 
 1507 
 1508 
 1509 -- |the fixed 1..15Y comparison-swap ladder's lengths, in years -- pairs positionally with
 1510 -- 'rendistatoSwapRates'\/'rendistatoSwapYields'\/'rendistatoSwapDurations'.
 1511 rendistatoSwapLengths :: (RendistatoCalculator) -> IO (([Double]))
 1512 rendistatoSwapLengths a1 =
 1513   withRendistatoCalculator a1 $ \a1' -> 
 1514   preDoubleArray $ \(a2'1, a2'2) -> 
 1515   preErrorCheck $ \a3' -> 
 1516   rendistatoSwapLengths'_ a1' a2'1  a2'2 a3' >>
 1517   peekDoubleArray  a2'1  a2'2>>= \a2'' -> 
 1518   errorCheck  a3'>>
 1519   return (a2'')
 1520 
 1521 
 1522 
 1523 -- |each ladder swap's fair (par) rate.
 1524 rendistatoSwapRates :: (RendistatoCalculator) -> IO (([Double]))
 1525 rendistatoSwapRates a1 =
 1526   withRendistatoCalculator a1 $ \a1' -> 
 1527   preDoubleArray $ \(a2'1, a2'2) -> 
 1528   preErrorCheck $ \a3' -> 
 1529   rendistatoSwapRates'_ a1' a2'1  a2'2 a3' >>
 1530   peekDoubleArray  a2'1  a2'2>>= \a2'' -> 
 1531   errorCheck  a3'>>
 1532   return (a2'')
 1533 
 1534 
 1535 
 1536 -- |each ladder swap's fixed leg, repriced as a par bond and re-expressed as a BTP-convention yield.
 1537 rendistatoSwapYields :: (RendistatoCalculator) -> IO (([Double]))
 1538 rendistatoSwapYields a1 =
 1539   withRendistatoCalculator a1 $ \a1' -> 
 1540   preDoubleArray $ \(a2'1, a2'2) -> 
 1541   preErrorCheck $ \a3' -> 
 1542   rendistatoSwapYields'_ a1' a2'1  a2'2 a3' >>
 1543   peekDoubleArray  a2'1  a2'2>>= \a2'' -> 
 1544   errorCheck  a3'>>
 1545   return (a2'')
 1546 
 1547 
 1548 
 1549 -- |each ladder swap's fixed leg (modified) duration, on the same par-bond proxy.
 1550 rendistatoSwapDurations :: (RendistatoCalculator) -> IO (([Double]))
 1551 rendistatoSwapDurations a1 =
 1552   withRendistatoCalculator a1 $ \a1' -> 
 1553   preDoubleArray $ \(a2'1, a2'2) -> 
 1554   preErrorCheck $ \a3' -> 
 1555   rendistatoSwapDurations'_ a1' a2'1  a2'2 a3' >>
 1556   peekDoubleArray  a2'1  a2'2>>= \a2'' -> 
 1557   errorCheck  a3'>>
 1558   return (a2'')
 1559 
 1560 
 1561 
 1562 -- |the ladder swap whose duration is closest to (without exceeding) the basket's own duration.
 1563 rendistatoEquivalentSwap :: (RendistatoCalculator) -> IO ((VanillaSwap))
 1564 rendistatoEquivalentSwap a1 =
 1565   withRendistatoCalculator a1 $ \a1' -> 
 1566   preErrorCheck $ \a2' -> 
 1567   rendistatoEquivalentSwap'_ a1' a2' >>= \res ->
 1568   peekVanillaSwap res >>= \res' ->
 1569   errorCheck  a2'>>
 1570   return (res')
 1571 
 1572 
 1573 
 1574 -- |the equivalent swap's fair rate.
 1575 rendistatoEquivalentSwapRate :: (RendistatoCalculator) -> IO ((Double))
 1576 rendistatoEquivalentSwapRate a1 =
 1577   withRendistatoCalculator a1 $ \a1' -> 
 1578   preErrorCheck $ \a2' -> 
 1579   rendistatoEquivalentSwapRate'_ a1' a2' >>= \res ->
 1580   let {res' = realToFrac res} in
 1581   errorCheck  a2'>>
 1582   return (res')
 1583 
 1584 
 1585 
 1586 -- |the equivalent swap's par-bond-proxy yield.
 1587 rendistatoEquivalentSwapYield :: (RendistatoCalculator) -> IO ((Double))
 1588 rendistatoEquivalentSwapYield a1 =
 1589   withRendistatoCalculator a1 $ \a1' -> 
 1590   preErrorCheck $ \a2' -> 
 1591   rendistatoEquivalentSwapYield'_ a1' a2' >>= \res ->
 1592   let {res' = realToFrac res} in
 1593   errorCheck  a2'>>
 1594   return (res')
 1595 
 1596 
 1597 
 1598 -- |the equivalent swap's par-bond-proxy duration.
 1599 rendistatoEquivalentSwapDuration :: (RendistatoCalculator) -> IO ((Double))
 1600 rendistatoEquivalentSwapDuration a1 =
 1601   withRendistatoCalculator a1 $ \a1' -> 
 1602   preErrorCheck $ \a2' -> 
 1603   rendistatoEquivalentSwapDuration'_ a1' a2' >>= \res ->
 1604   let {res' = realToFrac res} in
 1605   errorCheck  a2'>>
 1606   return (res')
 1607 
 1608 
 1609 
 1610 -- |the equivalent swap's length, in years.
 1611 rendistatoEquivalentSwapLength :: (RendistatoCalculator) -> IO ((Double))
 1612 rendistatoEquivalentSwapLength a1 =
 1613   withRendistatoCalculator a1 $ \a1' -> 
 1614   preErrorCheck $ \a2' -> 
 1615   rendistatoEquivalentSwapLength'_ a1' a2' >>= \res ->
 1616   let {res' = realToFrac res} in
 1617   errorCheck  a2'>>
 1618   return (res')
 1619 
 1620 
 1621 
 1622 -- |@rendistatoYield - rendistatoEquivalentSwapRate@: the basket's spread over
 1623 -- its equivalent swap.
 1624 rendistatoEquivalentSwapSpread :: (RendistatoCalculator) -> IO ((Double))
 1625 rendistatoEquivalentSwapSpread a1 =
 1626   withRendistatoCalculator a1 $ \a1' -> 
 1627   preErrorCheck $ \a2' -> 
 1628   rendistatoEquivalentSwapSpread'_ a1' a2' >>= \res ->
 1629   let {res' = realToFrac res} in
 1630   errorCheck  a2'>>
 1631   return (res')
 1632 
 1633 
 1634 
 1635 -- |A live 'Quote' tracking 'rendistatoEquivalentSwapLength' -- re-evaluates on every
 1636 -- access rather than snapshotting it, so it can be wired into curve bootstrapping like any other
 1637 -- quote.
 1638 rendistatoEquivalentSwapLengthQuote :: (RendistatoCalculator) -> IO ((Quote))
 1639 rendistatoEquivalentSwapLengthQuote a1 =
 1640   withRendistatoCalculator a1 $ \a1' -> 
 1641   preErrorCheck $ \a2' -> 
 1642   rendistatoEquivalentSwapLengthQuote'_ a1' a2' >>= \res ->
 1643   peekQuote res >>= \res' ->
 1644   errorCheck  a2'>>
 1645   return (res')
 1646 
 1647 
 1648 
 1649 -- |A live 'Quote' tracking 'rendistatoEquivalentSwapSpread'.
 1650 rendistatoEquivalentSwapSpreadQuote :: (RendistatoCalculator) -> IO ((Quote))
 1651 rendistatoEquivalentSwapSpreadQuote a1 =
 1652   withRendistatoCalculator a1 $ \a1' -> 
 1653   preErrorCheck $ \a2' -> 
 1654   rendistatoEquivalentSwapSpreadQuote'_ a1' a2' >>= \res ->
 1655   peekQuote res >>= \res' ->
 1656   errorCheck  a2'>>
 1657   return (res')
 1658 
 1659 
 1660 
 1661 -- vim: set ff=unix ts=8 sts=2 sw=2 et:
 1662 
 1663 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlBondFunctionsAtmRate"
 1664   atmRate'_ :: ((C2HSImp.Ptr (CBond')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))))))
 1665 
 1666 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlBond"
 1667   bond'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CLeg')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CBond'))))))))
 1668 
 1669 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlBondMaturityDate"
 1670   maturityDate'_ :: ((C2HSImp.Ptr (CBond')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CInt)))
 1671 
 1672 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlFixedRateBond"
 1673   fixedRateBond'_ :: (C2HSImp.CUInt -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (CSchedule)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CDayCounter)) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CFixedRateBond'))))))))))))))))))))
 1674 
 1675 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlBtp"
 1676   btp'_ :: (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CBTP'))))))))
 1677 
 1678 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlBtpWithRedemption"
 1679   btpWithRedemption'_ :: (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CBTP')))))))))
 1680 
 1681 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlAmortizingFixedRateBond"
 1682   amortizingFixedRateBond'_ :: (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((C2HSImp.Ptr (CSchedule)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CBond')))))))))))))))))))))
 1683 
 1684 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlSinkingSchedule"
 1685   sinkingSchedule'_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CCalendar)) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CSchedule)))))))))
 1686 
 1687 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlSinkingNotionals"
 1688   sinkingNotionals'_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CDouble)) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO ())))))))))
 1689 
 1690 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlCPIBond"
 1691   cpiBond'_ :: (C2HSImp.CUInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CZeroInflationIndex')) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CSchedule)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CCPIBond')))))))))))))))))))))))
 1692 
 1693 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlZeroCouponBond"
 1694   zeroCouponBond'_ :: (C2HSImp.CInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CDouble -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CBond')))))))))))
 1695 
 1696 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlFloatingRateBond"
 1697   floatingRateBond'_ :: (C2HSImp.CUInt -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (CSchedule)) -> ((C2HSImp.Ptr (CIborIndex')) -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CInt -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CBond'))))))))))))))))))))))))))))
 1698 
 1699 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlCmsRateBond"
 1700   cmsRateBond'_ :: (C2HSImp.CUInt -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (CSchedule)) -> ((C2HSImp.Ptr (CSwapIndex')) -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CInt -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CBond'))))))))))))))))))))))
 1701 
 1702 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlAmortizingCmsRateBond"
 1703   amortizingCmsRateBond'_ :: (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((C2HSImp.Ptr (CSchedule)) -> ((C2HSImp.Ptr (CSwapIndex')) -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CInt -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CBond'))))))))))))))))))))))))
 1704 
 1705 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlAmortizingFloatingRateBond"
 1706   amortizingFloatingRateBond_'_ :: (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((C2HSImp.Ptr (CSchedule)) -> ((C2HSImp.Ptr (CIborIndex')) -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CInt -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CBond'))))))))))))))))))))))))))))))
 1707 
 1708 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlBondYield"
 1709   yield'_ :: ((C2HSImp.Ptr (CBond')) -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> (C2HSImp.CDouble -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble))))))))))
 1710 
 1711 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlBondAccruedAmount"
 1712   accruedAmount'_ :: ((C2HSImp.Ptr (CBond')) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble))))
 1713 
 1714 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlBondDirtyPrice1"
 1715   dirtyPriceFromYield'_ :: ((C2HSImp.Ptr (CBond')) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble))))))))
 1716 
 1717 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlBondNextCashFlowDate"
 1718   nextCashFlowDate'_ :: ((C2HSImp.Ptr (CBond')) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CInt))))
 1719 
 1720 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlBondNextCouponRate"
 1721   nextCouponRate'_ :: ((C2HSImp.Ptr (CBond')) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble))))
 1722 
 1723 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlBondNotional"
 1724   notional'_ :: ((C2HSImp.Ptr (CBond')) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble))))
 1725 
 1726 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlBondPreviousCashFlowDate"
 1727   previousCashFlowDate'_ :: ((C2HSImp.Ptr (CBond')) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CInt))))
 1728 
 1729 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlBondPreviousCouponRate"
 1730   previousCouponRate'_ :: ((C2HSImp.Ptr (CBond')) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble))))
 1731 
 1732 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlBondSettlementValue1"
 1733   settlementValueFromCleanPrice'_ :: ((C2HSImp.Ptr (CBond')) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble))))
 1734 
 1735 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlBondSettlementValue"
 1736   settlementValue'_ :: ((C2HSImp.Ptr (CBond')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))
 1737 
 1738 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlBondYield1"
 1739   yieldFromPrice'_ :: ((C2HSImp.Ptr (CBond')) -> (C2HSImp.CDouble -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))))))))))
 1740 
 1741 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlBondIsTradable"
 1742   isTradable'_ :: ((C2HSImp.Ptr (CBond')) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CInt))))
 1743 
 1744 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlBondNotionals"
 1745   notionals'_ :: ((C2HSImp.Ptr (CBond')) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CDouble)) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO ())))))
 1746 
 1747 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlBondCashflows"
 1748   cashFlows'_ :: ((C2HSImp.Ptr (CBond')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CLeg')))))
 1749 
 1750 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlBondRedemptions"
 1751   redemptions'_ :: ((C2HSImp.Ptr (CBond')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CLeg')))))
 1752 
 1753 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlBondSettlementDate"
 1754   settlementDate'_ :: ((C2HSImp.Ptr (CBond')) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CInt))))
 1755 
 1756 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlBondStartDate"
 1757   startDate'_ :: ((C2HSImp.Ptr (CBond')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CInt)))
 1758 
 1759 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlBondFunctionsAccrualDays"
 1760   accrualDays'_ :: ((C2HSImp.Ptr (CBond')) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CInt))))
 1761 
 1762 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlBondFunctionsAccrualEndDate"
 1763   accrualEndDate'_ :: ((C2HSImp.Ptr (CBond')) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CInt))))
 1764 
 1765 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlBondFunctionsAccrualPeriod"
 1766   accrualPeriod'_ :: ((C2HSImp.Ptr (CBond')) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble))))
 1767 
 1768 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlBondFunctionsAccrualStartDate"
 1769   accrualStartDate'_ :: ((C2HSImp.Ptr (CBond')) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CInt))))
 1770 
 1771 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlBondFunctionsAccruedDays"
 1772   accruedDays'_ :: ((C2HSImp.Ptr (CBond')) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CInt))))
 1773 
 1774 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlBondFunctionsAccruedPeriod"
 1775   accruedPeriod'_ :: ((C2HSImp.Ptr (CBond')) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble))))
 1776 
 1777 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlBondFunctionsBasisPointValue"
 1778   basisPointValue'_ :: ((C2HSImp.Ptr (CBond')) -> ((C2HSImp.Ptr (CInterestRate)) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))))
 1779 
 1780 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlBondFunctionsBps1"
 1781   bpsFromYieldRaw'_ :: ((C2HSImp.Ptr (CBond')) -> ((C2HSImp.Ptr (CInterestRate)) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))))
 1782 
 1783 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlBondFunctionsBps"
 1784   bpsFromCurveRaw'_ :: ((C2HSImp.Ptr (CBond')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))))
 1785 
 1786 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlBondFunctionsCleanPrice2"
 1787   cleanPriceFromCurveRaw'_ :: ((C2HSImp.Ptr (CBond')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))))
 1788 
 1789 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlBondFunctionsCleanPrice3"
 1790   cleanPriceWithZSpreadRaw'_ :: ((C2HSImp.Ptr (CBond')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CDouble -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble))))))))
 1791 
 1792 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlBondFunctionsCleanPrice4"
 1793   cleanPriceFromYieldRaw'_ :: ((C2HSImp.Ptr (CBond')) -> ((C2HSImp.Ptr (CInterestRate)) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))))
 1794 
 1795 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlBondFunctionsConvexity"
 1796   convexity'_ :: ((C2HSImp.Ptr (CBond')) -> ((C2HSImp.Ptr (CInterestRate)) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))))
 1797 
 1798 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlBondFunctionsDuration"
 1799   duration'_ :: ((C2HSImp.Ptr (CBond')) -> ((C2HSImp.Ptr (CInterestRate)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble))))))
 1800 
 1801 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlBondFunctionsNextCashFlowAmount"
 1802   nextCashFlowAmount'_ :: ((C2HSImp.Ptr (CBond')) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble))))
 1803 
 1804 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlBondFunctionsPreviousCashFlowAmount"
 1805   previousCashFlowAmount'_ :: ((C2HSImp.Ptr (CBond')) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble))))
 1806 
 1807 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlBondFunctionsReferencePeriodEnd"
 1808   referencePeriodEnd'_ :: ((C2HSImp.Ptr (CBond')) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CInt))))
 1809 
 1810 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlBondFunctionsReferencePeriodStart"
 1811   referencePeriodStart'_ :: ((C2HSImp.Ptr (CBond')) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CInt))))
 1812 
 1813 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlBondFunctionsYield2"
 1814   yieldFromPriceWithGuess'_ :: ((C2HSImp.Ptr (CBond')) -> (C2HSImp.CDouble -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble))))))))))))
 1815 
 1816 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlBondFunctionsYieldValueBasisPoint"
 1817   yieldValueBasisPoint'_ :: ((C2HSImp.Ptr (CBond')) -> ((C2HSImp.Ptr (CInterestRate)) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))))
 1818 
 1819 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlBondFunctionsZSpread"
 1820   zSpread'_ :: ((C2HSImp.Ptr (CBond')) -> (C2HSImp.CDouble -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble))))))))))))
 1821 
 1822 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlBondCleanPrice"
 1823   currentCleanPrice'_ :: ((C2HSImp.Ptr (CBond')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))
 1824 
 1825 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlBondDirtyPrice"
 1826   currentDirtyPrice'_ :: ((C2HSImp.Ptr (CBond')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))
 1827 
 1828 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlCallableFixedRateBond"
 1829   callableFixedRateBond'_ :: (C2HSImp.CUInt -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (CSchedule)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CQlCallability))) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CCallableBond'))))))))))))))))))))
 1830 
 1831 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlCallableZeroCouponBond"
 1832   callableZeroCouponBond'_ :: (C2HSImp.CUInt -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CQlCallability))) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CCallableBond'))))))))))))))
 1833 
 1834 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlConvertibleFixedCouponBond"
 1835   convertibleFixedCouponBond'_ :: ((QlExercise) -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CQlCallability))) -> (C2HSImp.CInt -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((C2HSImp.Ptr (CDayCounter)) -> ((C2HSImp.Ptr (CSchedule)) -> (C2HSImp.CDouble -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CConvertibleBond'))))))))))))))))))))
 1836 
 1837 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlConvertibleFloatingRateBond"
 1838   convertibleFloatingRateBond'_ :: ((QlExercise) -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CQlCallability))) -> (C2HSImp.CInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (CIborIndex')) -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((C2HSImp.Ptr (CDayCounter)) -> ((C2HSImp.Ptr (CSchedule)) -> (C2HSImp.CDouble -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CConvertibleBond'))))))))))))))))))))))
 1839 
 1840 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlConvertibleZeroCouponBond"
 1841   convertibleZeroCouponBond'_ :: ((QlExercise) -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CQlCallability))) -> (C2HSImp.CInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (CDayCounter)) -> ((C2HSImp.Ptr (CSchedule)) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CConvertibleBond')))))))))))))
 1842 
 1843 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlRendistatoBasket"
 1844   qlRendistatoBasket'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CBTP'))) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CQuote'))) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CRendistatoBasket))))))))))
 1845 
 1846 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlRendistatoCalculator"
 1847   rendistatoCalculator'_ :: ((C2HSImp.Ptr (CRendistatoBasket)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CRendistatoCalculator)))))))))
 1848 
 1849 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlRendistatoCalculatorYield"
 1850   rendistatoYield'_ :: ((C2HSImp.Ptr (CRendistatoCalculator)) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))
 1851 
 1852 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlRendistatoCalculatorDuration"
 1853   rendistatoDuration'_ :: ((C2HSImp.Ptr (CRendistatoCalculator)) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))
 1854 
 1855 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlRendistatoCalculatorYields"
 1856   rendistatoYields'_ :: ((C2HSImp.Ptr (CRendistatoCalculator)) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CDouble)) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO ())))))
 1857 
 1858 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlRendistatoCalculatorDurations"
 1859   rendistatoDurations'_ :: ((C2HSImp.Ptr (CRendistatoCalculator)) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CDouble)) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO ())))))
 1860 
 1861 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlRendistatoCalculatorSwapLengths"
 1862   rendistatoSwapLengths'_ :: ((C2HSImp.Ptr (CRendistatoCalculator)) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CDouble)) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO ())))))
 1863 
 1864 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlRendistatoCalculatorSwapRates"
 1865   rendistatoSwapRates'_ :: ((C2HSImp.Ptr (CRendistatoCalculator)) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CDouble)) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO ())))))
 1866 
 1867 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlRendistatoCalculatorSwapYields"
 1868   rendistatoSwapYields'_ :: ((C2HSImp.Ptr (CRendistatoCalculator)) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CDouble)) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO ())))))
 1869 
 1870 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlRendistatoCalculatorSwapDurations"
 1871   rendistatoSwapDurations'_ :: ((C2HSImp.Ptr (CRendistatoCalculator)) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CDouble)) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO ())))))
 1872 
 1873 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlRendistatoCalculatorEquivalentSwap"
 1874   rendistatoEquivalentSwap'_ :: ((C2HSImp.Ptr (CRendistatoCalculator)) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CVanillaSwap')))))
 1875 
 1876 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlRendistatoCalculatorEquivalentSwapRate"
 1877   rendistatoEquivalentSwapRate'_ :: ((C2HSImp.Ptr (CRendistatoCalculator)) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))
 1878 
 1879 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlRendistatoCalculatorEquivalentSwapYield"
 1880   rendistatoEquivalentSwapYield'_ :: ((C2HSImp.Ptr (CRendistatoCalculator)) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))
 1881 
 1882 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlRendistatoCalculatorEquivalentSwapDuration"
 1883   rendistatoEquivalentSwapDuration'_ :: ((C2HSImp.Ptr (CRendistatoCalculator)) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))
 1884 
 1885 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlRendistatoCalculatorEquivalentSwapLength"
 1886   rendistatoEquivalentSwapLength'_ :: ((C2HSImp.Ptr (CRendistatoCalculator)) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))
 1887 
 1888 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlRendistatoCalculatorEquivalentSwapSpread"
 1889   rendistatoEquivalentSwapSpread'_ :: ((C2HSImp.Ptr (CRendistatoCalculator)) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))
 1890 
 1891 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlRendistatoEquivalentSwapLengthQuote"
 1892   rendistatoEquivalentSwapLengthQuote'_ :: ((C2HSImp.Ptr (CRendistatoCalculator)) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CQuote')))))
 1893 
 1894 foreign import ccall safe "QuantLib/Instrument/Bond.chs.h qlRendistatoEquivalentSwapSpreadQuote"
 1895   rendistatoEquivalentSwapSpreadQuote'_ :: ((C2HSImp.Ptr (CRendistatoCalculator)) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CQuote')))))