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