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.TermStructure.Yield
    7   (
    8     -- * Types
    9     -- ** Curves and helpers
   10     GenYieldTermStructure
   11   , YieldTermStructure
   12   , RelinkableYieldTermStructure
   13   , FittedBondDiscountCurve
   14   , MultiCurve
   15   , GenRateHelper
   16   , RateHelper
   17   , BondHelper
   18   , SwapRateHelper
   19   , OISRateHelper
   20   , FuturesRateHelper
   21   , OvernightIndexFutureRateHelper
   22 
   23     -- ** Coordinates
   24   , Reference(..)
   25   , TermPoint(..)
   26   , RatePoint(..)
   27 
   28     -- ** Bootstrap and contract configuration
   29   , FittingMethod(..)
   30   , BootstrapTrait(..)
   31   , PillarChoice(..)
   32   , FuturesType(..)
   33   , DepositTerms(..)
   34   , FraTerms(..)
   35   , SwapRateTerms(..)
   36   , OisTerms(..)
   37   , FxSwapTerms(..)
   38   , FundingTerms(..)
   39   , FuturesTerms(..)
   40   , OISRateHelperOpts(..)
   41   , OvernightObservation(..)
   42   , IterativeBootstrapOpts(..)
   43   , BootstrapInitialGuess
   44   , Bootstrap(..)
   45   , LocalBootstrapTrait(..)
   46   , SpreadBootstrap(..)
   47 
   48   , StubIndexSelection(..)
   49 
   50     -- * Constructors
   51     -- ** Hierarchy and handles
   52   , asYieldTermStructure
   53   , asRateHelper
   54   , relinkableYieldTermStructure
   55     -- ** Flat, fitted and derived curves
   56   , fittedBondDiscountCurve
   57   , flatForward
   58   , forwardSpreadedTermStructure
   59   , zeroSpreadedTermStructure
   60   , withCompositeZeroYieldStructure
   61   , impliedTermStructureMoving
   62   , impliedTermStructure
   63   , piecewiseZeroSpreadedTermStructure
   64   , piecewiseForwardSpreadedTermStructure
   65   , quantoTermStructure
   66   , ultimateForwardTermStructure
   67     -- ** Rate helpers
   68   , depositRateHelper
   69   , fixedRateBondHelper
   70   , fraRateHelper
   71   , bondHelper
   72   , oisRateHelper
   73   , defaultOisRateHelperOpts
   74   , defaultOvernightObservation
   75   , oisRateHelperWithOptions
   76   , swapRateHelper
   77   , bmaSwapRateHelper
   78   , multipleResetsSwapRateHelper
   79   , futuresRateHelper
   80   , overnightIndexFutureRateHelper
   81   , sofrFutureRateHelper
   82     -- ** Bootstrapped and interpolated curves
   83   , piecewiseYieldCurve
   84   , piecewiseSpreadYieldCurve
   85   , defaultIterativeBootstrapOpts
   86   , interpolatedZeroCurve
   87   , interpolatedSimpleZeroCurve
   88   , interpolatedForwardCurve
   89   , interpolatedDiscountCurve
   90   , interpolatedSpreadDiscountCurve
   91     -- ** Multi-curve bootstrapping
   92   , multiCurve
   93     -- ** Basis and cross-currency helpers
   94   , iborIborBasisSwapRateHelper
   95   , overnightOvernightBasisSwapRateHelper
   96   , overnightIndexedFundingRateHelper
   97   , overnightIborBasisSwapRateHelper
   98   , constNotionalCrossCurrencyBasisSwapRateHelper
   99   , mtmCrossCurrencyBasisSwapRateHelper
  100   , constNotionalCrossCurrencySwapRateHelper
  101   , fxSwapRateHelper
  102 
  103     -- * Mutators
  104   , linkTo
  105   , addBootstrappedCurve
  106   , addNonBootstrappedCurve
  107 
  108     -- * Inspectors
  109   , HasHelperUnderlying(..)
  110   , rateHelperFixingDependencies
  111   , forwardRate
  112   , forwardRateBetweenTimes
  113   , zeroRate
  114   , discount
  115   , impliedQuote
  116   , impliedQuoteOn
  117   , futuresRateHelperConvexityAdjustment
  118   , overnightIndexFutureRateHelperConvexityAdjustment
  119   , minimumCostValue
  120   , numberOfIterations
  121   , fittingMethodSize
  122   , fittingMethodErrorCode
  123   , fittingMethodSolution
  124   , fittingMethodDiscount
  125   ) where
  126 import qualified Foreign.C.Types as C2HSImp
  127 import qualified Foreign.ForeignPtr as C2HSImp
  128 import qualified Foreign.Marshal.Utils as C2HSImp
  129 import qualified Foreign.Ptr as C2HSImp
  130 
  131 
  132 import QuantLib.Internal hiding(maxDate)
  133 import QuantLib.Internal.Common
  134 import QuantLib.Internal.Syntax(deriveOptionsRecord)
  135 import Language.Haskell.TH(mkName)
  136 import Language.Haskell.TH.Lib(varT)
  137 import QuantLib.Math(EndCriteriaType(..))
  138 import QuantLib.Quote hiding(linkTo)
  139 import QuantLib.TermStructure (Reference(..), TermPoint(..), RatePoint(..), setExtrapolation, HasHelperUnderlying(..))
  140 import Data.Maybe(fromMaybe)
  141 import Data.List.NonEmpty(NonEmpty, toList)
  142 import Foreign.Ptr(Ptr, nullPtr, castPtr)
  143 import Foreign.Marshal.Array(copyArray)
  144 import qualified QuantLib.Internal.Callback as Callback
  145 import qualified Data.Vector.Storable as V
  146 import Control.Exception(throwIO)
  147 import Control.Monad(when)
  148 import Foreign.Marshal.Alloc(alloca)
  149 import Foreign.Storable(peek)
  150 import Foreign.C.Types(CInt, CUInt)
  151 import qualified QuantLib.Instrument.Bond as Bond (BondPriceType)
  152 import QuantLib.InterestRate(Compounding)
  153 import QuantLib.CashFlow(RateAveragingType(..))
  154 import QuantLib.Time.Calendar(calendar, CalendarConstructor(..))
  155 import QuantLib.Internal.Type
  156 import QuantLib.Time.Schedule(Frequency(..), DateGenerationRule(..))
  157 import QuantLib.Time.Date(Month(..))
  158 
  159 
  160 
  161 
  162 
  163 
  164 
  165 
  166 
  167 -- These local pointer declarations break import cycles while allowing c2hs to attach finalizers.
  168 
  169 
  170 
  171 
  172 
  173 
  174 
  175 
  176 
  177 
  178 
  179 
  180 
  181 
  182 
  183 
  184 
  185 
  186 
  187 
  188 
  189 
  190 
  191 
  192 
  193 
  194 
  195 
  196 
  197 
  198 
  199 data BootstrapTrait = Discount
  200                     | ZeroYield
  201                     | ForwardRate
  202                     | SimpleZeroYield
  203   deriving (Enum,Show,Eq,Read)
  204 
  205 
  206 data PillarChoice = MaturityDate
  207                   | LastRelevantDate
  208                   | CustomDate
  209   deriving (Enum,Show,Eq,Read)
  210 
  211 
  212 data FuturesType = IMM
  213                  | ASX
  214                  | Custom
  215   deriving (Enum,Show,Eq,Read)
  216 
  217 
  218 
  219 -- The optional calendars use 'Nothing' for QuantLib's null calendar because a concrete
  220 -- 'Calendar' cannot occur in this pure default value. Keep this splice before every {#fun#}:
  221 -- c2hs appends foreign imports to the generated module, and an intervening top-level splice
  222 -- would split declarations from the imports their wrappers use.
  223 $(deriveOptionsRecord "OISRateHelperOpts" ["m", "p"]
  224   [ ("oisTelescopicValueDates", [t|Bool|], [|False|])
  225   , ("oisPaymentLag", [t|Int|], [|0|])
  226   , ("oisPaymentConvention", [t|BusinessDayConvention|], [|Following|])
  227   , ("oisPaymentFrequency", [t|Frequency|], [|Annual|])
  228   , ("oisPaymentCalendar", [t|Maybe Calendar|], [|Nothing|])
  229   , ("oisOvernightSpread", [t|Maybe (GenQuote $(varT (mkName "m")))|], [|Nothing|])
  230   , ("oisPillar", [t|PillarChoice|], [|LastRelevantDate|])
  231   , ("oisCustomPillarDate", [t|Maybe Day|], [|Nothing|])
  232   , ("oisAveragingMethod", [t|RateAveragingType|], [|AveragingCompound|])
  233   , ("oisEndOfMonth", [t|Maybe Bool|], [|Nothing|])
  234   , ("oisFixedPaymentFrequency", [t|Maybe Frequency|], [|Nothing|])
  235   , ("oisFixedCalendar", [t|Maybe Calendar|], [|Nothing|])
  236   , ("oisObservation", [t|OvernightObservation|], [|defaultOvernightObservation|])
  237   , ("oisPricer", [t|Maybe (GenFloatingRateCouponPricer $(varT (mkName "p")))|], [|Nothing|])
  238   , ("oisRule", [t|DateGenerationRule|], [|Backward|])
  239   , ("oisOvernightCalendar", [t|Maybe Calendar|], [|Nothing|])
  240   , ("oisConvention", [t|BusinessDayConvention|], [|ModifiedFollowing|])
  241   , ("oisFixedDayCount", [t|Maybe DayCounter|], [|Nothing|])
  242   ])
  243 
  244 -- Upstream defaults accuracy/minValue/maxValue to Null<Real>() rather than to a number, so
  245 -- those three are Maybe on the Haskell side; fromMaybeDouble supplies the sentinel, and the
  246 -- {#fun#} specs below take a plain Double, hence the realToFrac.
  247 nullableDouble :: Maybe Double -> Double
  248 nullableDouble = realToFrac . fromMaybeDouble
  249 
  250 -- |How a deposit's period and fixing conventions are given. 'DepositTenor' and 'DepositFromIndex'
  251 -- are relative to the evaluation date: the deposit starts at spot and its dates move when the
  252 -- evaluation date does. 'DepositFromIndex' takes the tenor and conventions from the ibor index;
  253 -- 'DepositTenor' states them and fixes on an index QuantLib names @\"no-fix\"@.
  254 -- 'DepositOnFixingDate' is the deposit the index fixes on the given date. Its dates never move, and
  255 -- once that date is before the evaluation date its implied quote is the stored fixing, so
  256 -- 'rateHelperFixingDependencies' reports it.
  257 data DepositTerms ibor
  258   = DepositTenor
  259       !(Int, TimeUnit) -- ^tenor
  260       !Word -- ^fixingDays
  261       !Calendar
  262       !BusinessDayConvention
  263       !Bool -- ^endOfMonth
  264       !DayCounter
  265   | DepositFromIndex
  266       !(GenIborIndex ibor)
  267   | DepositOnFixingDate
  268       !Day -- ^fixingDate
  269       !(GenIborIndex ibor)
  270 
  271 -- |Rate helper for bootstrapping over deposit rates.
  272 depositRateHelper :: GenQuote q -> DepositTerms ibor -> IO RateHelper
  273 depositRateHelper rate terms = case terms of
  274   DepositTenor t fd cal conv eom dc -> depositRateHelperRaw rate t fd cal conv eom dc
  275   DepositFromIndex idx -> depositRateHelperFromIndexRaw rate idx
  276   DepositOnFixingDate d idx -> depositRateHelperOnFixingDateRaw rate d idx
  277 
  278 -- Raw deposit bindings behind 'depositRateHelper'; one per 'DepositTerms' constructor.
  279 depositRateHelperFromIndexRaw :: (GenQuote q) -> (GenIborIndex ibor) -> IO ((RateHelper))
  280 depositRateHelperFromIndexRaw a1 a2 =
  281   withQuote a1 $ \a1' -> 
  282   withIborIndex a2 $ \a2' -> 
  283   preErrorCheck $ \a3' -> 
  284   depositRateHelperFromIndexRaw'_ a1' a2' a3' >>= \res ->
  285   peekRateHelper res >>= \res' ->
  286   errorCheck  a3'>>
  287   return (res')
  288 
  289 
  290 
  291 depositRateHelperOnFixingDateRaw :: (GenQuote q) -> (Day) -- ^fixingDate
  292  -> (GenIborIndex ibor) -> IO ((RateHelper))
  293 depositRateHelperOnFixingDateRaw a1 a2 a3 =
  294   withQuote a1 $ \a1' -> 
  295   withDay a2 $ \a2' -> 
  296   withIborIndex a3 $ \a3' -> 
  297   preErrorCheck $ \a4' -> 
  298   depositRateHelperOnFixingDateRaw'_ a1' a2' a3' a4' >>= \res ->
  299   peekRateHelper res >>= \res' ->
  300   errorCheck  a4'>>
  301   return (res')
  302 
  303 
  304 
  305 depositRateHelperRaw :: (GenQuote q) -- ^rate
  306  -> ((Int,TimeUnit)) -- ^tenor
  307  -> (Word) -- ^fixingDays
  308  -> (Calendar) -- ^calendar
  309  -> (BusinessDayConvention) -- ^convention
  310  -> (Bool) -- ^endOfMonth
  311  -> (DayCounter) -> IO ((RateHelper))
  312 depositRateHelperRaw a1 a2 a3 a4 a5 a6 a7 =
  313   withQuote a1 $ \a1' -> 
  314   let {(a2'1, a2'2) = fromEnumQuantity a2} in 
  315   let {a3' = fromIntegral a3} in 
  316   withCalendar a4 $ \a4' -> 
  317   let {a5' = fromEnumC a5} in 
  318   let {a6' = C2HSImp.fromBool a6} in 
  319   withDayCounter a7 $ \a7' -> 
  320   preErrorCheck $ \a8' -> 
  321   depositRateHelperRaw'_ a1' a2'1  a2'2 a3' a4' a5' a6' a7' a8' >>= \res ->
  322   peekRateHelper res >>= \res' ->
  323   errorCheck  a8'>>
  324   return (res')
  325 
  326 
  327 
  328 -- |Fixed-coupon bond helper for curve bootstrap: builds the underlying bond internally from a
  329 -- schedule and coupons (unlike 'bondHelper', which takes an existing 'Bond').
  330 fixedRateBondHelper :: (GenQuote q) -> (Word) -- ^settlementDays
  331  -> (Double) -- ^faceAmount
  332  -> (Schedule) -> (NonEmpty Double) -- ^coupons
  333  -> (DayCounter) -> (BusinessDayConvention) -- ^paymentConvention
  334  -> (Double) -- ^redemption
  335  -> (Maybe Day) -- ^issueDate
  336  -> IO ((BondHelper))
  337 fixedRateBondHelper a1 a2 a3 a4 a5 a6 a7 a8 a9 =
  338   withQuote a1 $ \a1' -> 
  339   let {a2' = fromIntegral a2} in 
  340   let {a3' = realToFrac a3} in 
  341   withSchedule a4 $ \a4' -> 
  342   withNonEmptyDoubleArray a5 $ \(a5'1, a5'2) -> 
  343   withDayCounter a6 $ \a6' -> 
  344   let {a7' = fromEnumC a7} in 
  345   let {a8' = realToFrac a8} in 
  346   withMaybeDay a9 $ \a9' -> 
  347   preErrorCheck $ \a10' -> 
  348   fixedRateBondHelper'_ a1' a2' a3' a4' a5'1  a5'2 a6' a7' a8' a9' a10' >>= \res ->
  349   peekBondHelper res >>= \res' ->
  350   errorCheck  a10'>>
  351   return (res')
  352 
  353 
  354 
  355 discountAtDateRaw :: (GenYieldTermStructure y) -> (Day) -- ^d
  356  -> (Bool) -- ^extrapolate
  357  -> IO ((Double))
  358 discountAtDateRaw a1 a2 a3 =
  359   withYieldTermStructure a1 $ \a1' -> 
  360   withDay a2 $ \a2' -> 
  361   let {a3' = C2HSImp.fromBool a3} in 
  362   preErrorCheck $ \a4' -> 
  363   discountAtDateRaw'_ a1' a2' a3' a4' >>= \res ->
  364   let {res' = realToFrac res} in
  365   errorCheck  a4'>>
  366   return (res')
  367 
  368 
  369 
  370 -- |How a swap helper's schedule and legs are given. 'SwapRateFromIndex' takes every convention
  371 -- from a swap index, 'SwapRateTenor' states them for a swap of the given tenor starting at spot
  372 -- plus @fwdStart@, and both are relative to the evaluation date: the swap's dates move when it
  373 -- does. 'SwapRateBetweenDates' is the swap between two fixed dates; once a coupon's fixing date is
  374 -- before the evaluation date that coupon reads the stored fixing, which
  375 -- 'rateHelperFixingDependencies' reports with the rest. @settlementDays@ ('Nothing' takes the
  376 -- index's fixing days) and @floatConvention@ ('Nothing' takes the index's convention) exist only
  377 -- in the forms that state their conventions.
  378 data SwapRateTerms sidx ibor
  379   = SwapRateFromIndex
  380       !(GenSwapIndex sidx)
  381       !(Int, TimeUnit) -- ^fwdStart
  382   | SwapRateTenor
  383       !(Int, TimeUnit) -- ^tenor
  384       !Calendar
  385       !Frequency -- ^fixedFrequency
  386       !BusinessDayConvention -- ^fixedConvention
  387       !DayCounter -- ^fixedDayCount
  388       !(GenIborIndex ibor)
  389       !(Int, TimeUnit) -- ^fwdStart
  390       !(Maybe Word) -- ^settlementDays
  391       !(Maybe BusinessDayConvention) -- ^floatConvention
  392   | SwapRateBetweenDates
  393       !Day -- ^startDate
  394       !Day -- ^endDate
  395       !Calendar
  396       !Frequency -- ^fixedFrequency
  397       !BusinessDayConvention -- ^fixedConvention
  398       !DayCounter -- ^fixedDayCount
  399       !(GenIborIndex ibor)
  400       !(Maybe BusinessDayConvention) -- ^floatConvention
  401 
  402 -- |Rate helper for bootstrapping over swap rates: a fixed-vs-ibor swap whose fair rate is the
  403 -- quote.
  404 swapRateHelper :: GenQuote q1 -- ^rate
  405   -> SwapRateTerms sidx ibor
  406   -> Maybe (GenQuote q2) -- ^spread
  407   -> Maybe (GenYieldTermStructure y) -- ^discountingCurve
  408   -> PillarChoice -- ^pillar
  409   -> Maybe Day -- ^customPillarDate
  410   -> Bool -- ^endOfMonth
  411   -> Maybe Bool -- ^useIndexedCoupons
  412   -> Maybe (GenFloatingRateCouponPricer frcp) -- ^couponPricer
  413   -> IO SwapRateHelper
  414 swapRateHelper rate terms spread disc pillar customPillarDate eom indexed pricer = case terms of
  415   SwapRateFromIndex idx fwd ->
  416     swapRateHelperFromIndexRaw rate idx spread fwd disc pillar customPillarDate eom indexed pricer
  417   SwapRateTenor t cal ff fc fdc ibor fwd sd fl ->
  418     swapRateHelperRaw rate t cal ff fc fdc ibor spread fwd disc sd pillar customPillarDate eom indexed fl pricer
  419   SwapRateBetweenDates s e cal ff fc fdc ibor fl ->
  420     swapRateHelperBetweenDatesRaw rate s e cal ff fc fdc ibor spread disc pillar customPillarDate eom indexed fl pricer
  421 
  422 -- Raw swap bindings behind 'swapRateHelper'; one per 'SwapRateTerms' constructor.
  423 swapRateHelperBetweenDatesRaw :: (GenQuote q1) -- ^rate
  424  -> (Day) -- ^startDate
  425  -> (Day) -- ^endDate
  426  -> (Calendar) -- ^calendar
  427  -> (Frequency) -- ^fixedFrequency
  428  -> (BusinessDayConvention) -- ^fixedConvention
  429  -> (DayCounter) -- ^fixedDayCount
  430  -> (GenIborIndex ibor) -- ^iborIndex
  431  -> (Maybe (GenQuote q2)) -- ^spread
  432  -> (Maybe (GenYieldTermStructure y)) -- ^discountingCurve
  433  -> (PillarChoice) -- ^pillar
  434  -> (Maybe Day) -- ^customPillarDate
  435  -> (Bool) -- ^endOfMonth
  436  -> (Maybe Bool) -- ^useIndexedCoupons
  437  -> (Maybe BusinessDayConvention) -- ^floatConvention
  438  -> (Maybe (GenFloatingRateCouponPricer frcp)) -- ^couponPricer
  439  -> IO ((SwapRateHelper))
  440 swapRateHelperBetweenDatesRaw a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 =
  441   withQuote a1 $ \a1' -> 
  442   withDay a2 $ \a2' -> 
  443   withDay a3 $ \a3' -> 
  444   withCalendar a4 $ \a4' -> 
  445   let {a5' = (fromIntegral . fromEnum) a5} in 
  446   let {a6' = fromEnumC a6} in 
  447   withDayCounter a7 $ \a7' -> 
  448   withIborIndex a8 $ \a8' -> 
  449   withMaybeQuote a9 $ \a9' -> 
  450   withMaybeYieldTermStructure a10 $ \a10' -> 
  451   let {a11' = (fromIntegral . fromEnum) a11} in 
  452   withMaybeDay a12 $ \a12' -> 
  453   let {a13' = C2HSImp.fromBool a13} in 
  454   let {a14' = fromMaybeBool a14} in 
  455   let {a15' = fromMaybeEnum a15} in 
  456   withMaybeFloatingRateCouponPricer a16 $ \a16' -> 
  457   preErrorCheck $ \a17' -> 
  458   swapRateHelperBetweenDatesRaw'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' a10' a11' a12' a13' a14' a15' a16' a17' >>= \res ->
  459   peekSwapRateHelper res >>= \res' ->
  460   errorCheck  a17'>>
  461   return (res')
  462 
  463 
  464 
  465 swapRateHelperRaw :: (GenQuote q1) -- ^rate
  466  -> ((Int,TimeUnit)) -- ^tenor
  467  -> (Calendar) -- ^calendar
  468  -> (Frequency) -- ^fixedFrequency
  469  -> (BusinessDayConvention) -- ^fixedConvention
  470  -> (DayCounter) -- ^fixedDayCount
  471  -> (GenIborIndex ibor) -- ^iborIndex
  472  -> (Maybe (GenQuote q2)) -- ^spread
  473  -> ((Int,TimeUnit)) -- ^fwdStart
  474  -> (Maybe (GenYieldTermStructure y)) -- ^discountingCurve
  475  -> (Maybe Word) -- ^settlementDays
  476  -> (PillarChoice) -- ^pillar
  477  -> (Maybe Day) -- ^customPillarDate
  478  -> (Bool) -- ^endOfMonth
  479  -> (Maybe Bool) -- ^useIndexedCoupons
  480  -> (Maybe BusinessDayConvention) -- ^floatConvention
  481  -> (Maybe (GenFloatingRateCouponPricer frcp)) -- ^couponPricer
  482  -> IO ((SwapRateHelper))
  483 swapRateHelperRaw a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 =
  484   withQuote a1 $ \a1' -> 
  485   let {(a2'1, a2'2) = fromEnumQuantity a2} in 
  486   withCalendar a3 $ \a3' -> 
  487   let {a4' = (fromIntegral . fromEnum) a4} in 
  488   let {a5' = fromEnumC a5} in 
  489   withDayCounter a6 $ \a6' -> 
  490   withIborIndex a7 $ \a7' -> 
  491   withMaybeQuote a8 $ \a8' -> 
  492   let {(a9'1, a9'2) = fromEnumQuantity a9} in 
  493   withMaybeYieldTermStructure a10 $ \a10' -> 
  494   let {a11' = fromMaybeInt a11} in 
  495   let {a12' = (fromIntegral . fromEnum) a12} in 
  496   withMaybeDay a13 $ \a13' -> 
  497   let {a14' = C2HSImp.fromBool a14} in 
  498   let {a15' = fromMaybeBool a15} in 
  499   let {a16' = fromMaybeEnum a16} in 
  500   withMaybeFloatingRateCouponPricer a17 $ \a17' -> 
  501   preErrorCheck $ \a18' -> 
  502   swapRateHelperRaw'_ a1' a2'1  a2'2 a3' a4' a5' a6' a7' a8' a9'1  a9'2 a10' a11' a12' a13' a14' a15' a16' a17' a18' >>= \res ->
  503   peekSwapRateHelper res >>= \res' ->
  504   errorCheck  a18'>>
  505   return (res')
  506 
  507 
  508 
  509 -- |Flat interest-rate curve with either a fixed or evaluation-date-relative reference point.
  510 flatForward :: Reference -> GenQuote q -> DayCounter -> Compounding -> Frequency
  511   -> IO YieldTermStructure
  512 flatForward (ReferenceDate d) = flatForwardFixed d
  513 flatForward (SettlementDays n cal) = flatForwardMovingRaw n cal
  514 flatForwardFixed :: (Day) -> (GenQuote q) -> (DayCounter) -> (Compounding) -> (Frequency) -> IO ((YieldTermStructure))
  515 flatForwardFixed a1 a2 a3 a4 a5 =
  516   withDay a1 $ \a1' -> 
  517   withQuote a2 $ \a2' -> 
  518   withDayCounter a3 $ \a3' -> 
  519   let {a4' = (fromIntegral . fromEnum) a4} in 
  520   let {a5' = (fromIntegral . fromEnum) a5} in 
  521   preErrorCheck $ \a6' -> 
  522   flatForwardFixed'_ a1' a2' a3' a4' a5' a6' >>= \res ->
  523   peekYieldTermStructure res >>= \res' ->
  524   errorCheck  a6'>>
  525   return (res')
  526 
  527 
  528 flatForwardMovingRaw :: (Word) -- ^settlementDays
  529  -> (Calendar) -> (GenQuote q) -> (DayCounter) -> (Compounding) -> (Frequency) -> IO ((YieldTermStructure))
  530 flatForwardMovingRaw a1 a2 a3 a4 a5 a6 =
  531   let {a1' = fromIntegral a1} in 
  532   withCalendar a2 $ \a2' -> 
  533   withQuote a3 $ \a3' -> 
  534   withDayCounter a4 $ \a4' -> 
  535   let {a5' = (fromIntegral . fromEnum) a5} in 
  536   let {a6' = (fromIntegral . fromEnum) a6} in 
  537   preErrorCheck $ \a7' -> 
  538   flatForwardMovingRaw'_ a1' a2' a3' a4' a5' a6' a7' >>= \res ->
  539   peekYieldTermStructure res >>= \res' ->
  540   errorCheck  a7'>>
  541   return (res')
  542 
  543 
  544 
  545 -- |The zero rate at a date or year-fraction coordinate.
  546 zeroRate :: GenYieldTermStructure y -> RatePoint -> Compounding -> Frequency -> Bool
  547   -> IO InterestRate
  548 zeroRate curve point = case point of
  549   RateAtDate d dc -> zeroRateAtDateRaw curve d dc
  550   RateAtTime t -> zeroRateAtTimeRaw curve t
  551 
  552 zeroRateAtDateRaw :: (GenYieldTermStructure y) -> (Day) -> (DayCounter) -> (Compounding) -> (Frequency) -> (Bool) -- ^extrapolate
  553  -> IO ((InterestRate))
  554 zeroRateAtDateRaw a1 a2 a3 a4 a5 a6 =
  555   withYieldTermStructure a1 $ \a1' -> 
  556   withDay a2 $ \a2' -> 
  557   withDayCounter a3 $ \a3' -> 
  558   let {a4' = (fromIntegral . fromEnum) a4} in 
  559   let {a5' = (fromIntegral . fromEnum) a5} in 
  560   let {a6' = C2HSImp.fromBool a6} in 
  561   preErrorCheck $ \a7' -> 
  562   zeroRateAtDateRaw'_ a1' a2' a3' a4' a5' a6' a7' >>= \res ->
  563   peekInterestRate res >>= \res' ->
  564   errorCheck  a7'>>
  565   return (res')
  566 
  567 
  568 
  569 -- |The forward rate between two dates, in the given day-counting rule.
  570 -- /Warning/ Dates are not adjusted for holidays.
  571 forwardRate :: (GenYieldTermStructure y) -> (Day) -> (Day) -> (DayCounter) -> (Compounding) -> (Frequency) -> (Bool) -- ^extrapolate
  572  -> IO ((InterestRate))
  573 forwardRate a1 a2 a3 a4 a5 a6 a7 =
  574   withYieldTermStructure a1 $ \a1' -> 
  575   withDay a2 $ \a2' -> 
  576   withDay a3 $ \a3' -> 
  577   withDayCounter a4 $ \a4' -> 
  578   let {a5' = (fromIntegral . fromEnum) a5} in 
  579   let {a6' = (fromIntegral . fromEnum) a6} in 
  580   let {a7' = C2HSImp.fromBool a7} in 
  581   preErrorCheck $ \a8' -> 
  582   forwardRate'_ a1' a2' a3' a4' a5' a6' a7' a8' >>= \res ->
  583   peekInterestRate res >>= \res' ->
  584   errorCheck  a8'>>
  585   return (res')
  586 
  587 
  588 
  589 -- |The resulting interest rate has the same day-counting rule used by the term structure. The same rule should be used for calculating the passed times t1 and t2.
  590 forwardRateBetweenTimes :: (GenYieldTermStructure y) -> (Double) -> (Double) -> (Compounding) -> (Frequency) -> (Bool) -- ^extrapolate
  591  -> IO ((InterestRate))
  592 forwardRateBetweenTimes a1 a2 a3 a4 a5 a6 =
  593   withYieldTermStructure a1 $ \a1' -> 
  594   let {a2' = realToFrac a2} in 
  595   let {a3' = realToFrac a3} in 
  596   let {a4' = (fromIntegral . fromEnum) a4} in 
  597   let {a5' = (fromIntegral . fromEnum) a5} in 
  598   let {a6' = C2HSImp.fromBool a6} in 
  599   preErrorCheck $ \a7' -> 
  600   forwardRateBetweenTimes'_ a1' a2' a3' a4' a5' a6' a7' >>= \res ->
  601   peekInterestRate res >>= \res' ->
  602   errorCheck  a7'>>
  603   return (res')
  604 
  605 
  606 
  607 -- |The resulting interest rate has the same day-counting rule used by the term structure. The same rule should be used for calculating the passed time t.
  608 zeroRateAtTimeRaw :: (GenYieldTermStructure y) -> (Double) -> (Compounding) -> (Frequency) -> (Bool) -- ^extrapolate
  609  -> IO ((InterestRate))
  610 zeroRateAtTimeRaw a1 a2 a3 a4 a5 =
  611   withYieldTermStructure a1 $ \a1' -> 
  612   let {a2' = realToFrac a2} in 
  613   let {a3' = (fromIntegral . fromEnum) a3} in 
  614   let {a4' = (fromIntegral . fromEnum) a4} in 
  615   let {a5' = C2HSImp.fromBool a5} in 
  616   preErrorCheck $ \a6' -> 
  617   zeroRateAtTimeRaw'_ a1' a2' a3' a4' a5' a6' >>= \res ->
  618   peekInterestRate res >>= \res' ->
  619   errorCheck  a6'>>
  620   return (res')
  621 
  622 
  623 
  624 -- |Returns a discount factor at a date or year-fraction coordinate.
  625 discount :: GenYieldTermStructure y -> TermPoint -> Bool -> IO Double
  626 discount curve point = case point of
  627   DatePoint d -> discountAtDateRaw curve d
  628   TimePoint t -> discountAtTimeRaw curve t
  629 
  630 -- |The same day-counting rule used by the term structure should be used for calculating the passed time t.
  631 discountAtTimeRaw :: (GenYieldTermStructure y) -> (Double) -> (Bool) -- ^extrapolate
  632  -> IO ((Double))
  633 discountAtTimeRaw a1 a2 a3 =
  634   withYieldTermStructure a1 $ \a1' -> 
  635   let {a2' = realToFrac a2} in 
  636   let {a3' = C2HSImp.fromBool a3} in 
  637   preErrorCheck $ \a4' -> 
  638   discountAtTimeRaw'_ a1' a2' a3' a4' >>= \res ->
  639   let {res' = realToFrac res} in
  640   errorCheck  a4'>>
  641   return (res')
  642 
  643 
  644 
  645 -- |How a FRA's period and fixing conventions are given. The @FromIndex@ variants take the
  646 -- FRA's length and its calendar\/convention\/day-count from the ibor index; the months and
  647 -- period variants without an index state them explicitly. 'FraImmOffsets' starts and ends the
  648 -- FRA on the given IMM dates after spot, counting the first as 1, and takes the rest from the
  649 -- index. All of these are relative to the evaluation date. 'FraBetweenDates' is not: it runs from
  650 -- the start date to the end date and fixes where the index fixes for the start date, and, with
  651 -- @useIndexedCoupon@, its implied quote is the stored fixing once that date is before the
  652 -- evaluation date, which 'rateHelperFixingDependencies' reports.
  653 data FraTerms ibor
  654   = FraMonths
  655       !Word -- ^monthsToStart
  656       !Word -- ^monthsToEnd
  657       !Word -- ^fixingDays
  658       !Calendar
  659       !BusinessDayConvention
  660       !Bool -- ^endOfMonth
  661       !DayCounter
  662   | FraMonthsFromIndex
  663       !Word -- ^monthsToStart
  664       !(GenIborIndex ibor)
  665   | FraPeriod
  666       !(Int, TimeUnit) -- ^periodToStart
  667       !Word -- ^lengthInMonths
  668       !Word -- ^fixingDays
  669       !Calendar
  670       !BusinessDayConvention
  671       !Bool -- ^endOfMonth
  672       !DayCounter
  673   | FraPeriodFromIndex
  674       !(Int, TimeUnit) -- ^periodToStart
  675       !(GenIborIndex ibor)
  676   | FraImmOffsets
  677       !Word -- ^immOffsetStart
  678       !Word -- ^immOffsetEnd
  679       !(GenIborIndex ibor)
  680   | FraBetweenDates
  681       !Day -- ^startDate
  682       !Day -- ^endDate
  683       !(GenIborIndex ibor)
  684 
  685 -- |Rate helper for bootstrapping over FRA rates.
  686 fraRateHelper :: GenQuote q
  687   -> FraTerms ibor
  688   -> PillarChoice -- ^pillar
  689   -> Maybe Day -- ^customPillarDate
  690   -> Bool -- ^useIndexedCoupon
  691   -> IO RateHelper
  692 fraRateHelper rate terms = case terms of
  693   FraMonths s e fd cal conv eom dc -> fraRateHelperRaw rate s e fd cal conv eom dc
  694   FraMonthsFromIndex s idx -> fraRateHelperFromIndexRaw rate s idx
  695   FraPeriod p n fd cal conv eom dc -> fraRateHelperFromPeriodRaw rate p n fd cal conv eom dc
  696   FraPeriodFromIndex p idx -> fraIborRateHelperRaw rate p idx
  697   FraImmOffsets s e idx -> fraImmOffsetsRateHelperRaw rate s e idx
  698   FraBetweenDates s e idx -> fraBetweenDatesRateHelperRaw rate s e idx
  699 
  700 fraRateHelperRaw :: (GenQuote q) -- ^rate
  701  -> (Word) -- ^monthsToStart
  702  -> (Word) -- ^monthsToEnd
  703  -> (Word) -- ^fixingDays
  704  -> (Calendar) -- ^calendar
  705  -> (BusinessDayConvention) -- ^convention
  706  -> (Bool) -- ^endOfMonth
  707  -> (DayCounter) -> (PillarChoice) -- ^pillar
  708  -> (Maybe Day) -- ^customPillarDate
  709  -> (Bool) -- ^useIndexedCoupon
  710  -> IO ((RateHelper))
  711 fraRateHelperRaw a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 =
  712   withQuote a1 $ \a1' -> 
  713   let {a2' = fromIntegral a2} in 
  714   let {a3' = fromIntegral a3} in 
  715   let {a4' = fromIntegral a4} in 
  716   withCalendar a5 $ \a5' -> 
  717   let {a6' = fromEnumC a6} in 
  718   let {a7' = C2HSImp.fromBool a7} in 
  719   withDayCounter a8 $ \a8' -> 
  720   let {a9' = (fromIntegral . fromEnum) a9} in 
  721   withMaybeDay a10 $ \a10' -> 
  722   let {a11' = C2HSImp.fromBool a11} in 
  723   preErrorCheck $ \a12' -> 
  724   fraRateHelperRaw'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' a10' a11' a12' >>= \res ->
  725   peekRateHelper res >>= \res' ->
  726   errorCheck  a12'>>
  727   return (res')
  728 
  729 
  730 
  731 -- |Bootstrapping helper for an ibor-ibor basis swap: pays @baseIndex + basis@, receives
  732 -- @otherIndex@. Pass @bootstrapBaseCurve = True@ (with 'otherIndex' carrying a forecast curve)
  733 -- to bootstrap the forecast curve for 'baseIndex', or 'False' (with 'baseIndex' carrying a
  734 -- forecast curve) to bootstrap the forecast curve for 'otherIndex'. An exogenous discount curve
  735 -- is always required.
  736 iborIborBasisSwapRateHelper :: (GenQuote q) -- ^basis
  737  -> ((Int,TimeUnit)) -- ^tenor
  738  -> (Word) -- ^settlementDays
  739  -> (Calendar) -- ^calendar
  740  -> (BusinessDayConvention) -- ^convention
  741  -> (Bool) -- ^endOfMonth
  742  -> (GenIborIndex ibor1) -- ^baseIndex
  743  -> (GenIborIndex ibor2) -- ^otherIndex
  744  -> (GenYieldTermStructure y) -- ^discountHandle
  745  -> (Bool) -- ^bootstrapBaseCurve
  746  -> (Maybe Bool) -- ^useIndexedCoupons (1.44; QuantLib 1.43 requires 'Nothing')
  747  -> (DateGenerationRule) -- ^rule (1.44; QuantLib 1.43 requires 'Backward')
  748  -> (Int) -- ^paymentLag (1.44; QuantLib 1.43 requires 0)
  749  -> (Maybe (StubIndexSelection ibor3)) -- ^baseStub (1.44; QuantLib 1.43 requires 'Nothing')
  750  -> (Maybe (StubIndexSelection ibor4)) -- ^otherStub (1.44; QuantLib 1.43 requires 'Nothing')
  751  -> IO ((RateHelper))
  752 iborIborBasisSwapRateHelper a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 =
  753   withQuote a1 $ \a1' -> 
  754   let {(a2'1, a2'2) = fromEnumQuantity a2} in 
  755   let {a3' = fromIntegral a3} in 
  756   withCalendar a4 $ \a4' -> 
  757   let {a5' = fromEnumC a5} in 
  758   let {a6' = C2HSImp.fromBool a6} in 
  759   withIborIndex a7 $ \a7' -> 
  760   withIborIndex a8 $ \a8' -> 
  761   withYieldTermStructure a9 $ \a9' -> 
  762   let {a10' = C2HSImp.fromBool a10} in 
  763   let {a11' = fromMaybeBool a11} in 
  764   let {a12' = (fromIntegral . fromEnum) a12} in 
  765   let {a13' = fromIntegral a13} in 
  766   withStubIndexSelection a14 $ \a14' -> 
  767   withStubIndexSelection a15 $ \a15' -> 
  768   preErrorCheck $ \a16' -> 
  769   iborIborBasisSwapRateHelper'_ a1' a2'1  a2'2 a3' a4' a5' a6' a7' a8' a9' a10' a11' a12' a13' a14' a15' a16' >>= \res ->
  770   peekRateHelper res >>= \res' ->
  771   errorCheck  a16'>>
  772   return (res')
  773 
  774 
  775 
  776 -- |Bootstrapping helper for an overnight-ibor basis swap: pays @baseIndex + basis@, receives
  777 -- @otherIndex@. Bootstraps the forecast curve for 'otherIndex'; 'baseIndex' needs an existing
  778 -- forecast curve on 1.43. On 1.44, @bootstrapBaseCurve@ chooses the projected leg; an empty
  779 -- discount handle uses the bootstrapped curve (1.43 uses the overnight curve).
  780 overnightIborBasisSwapRateHelper :: (GenQuote q) -- ^basis
  781  -> ((Int,TimeUnit)) -- ^tenor
  782  -> (Word) -- ^settlementDays
  783  -> (Calendar) -- ^calendar
  784  -> (BusinessDayConvention) -- ^convention
  785  -> (Bool) -- ^endOfMonth
  786  -> (OvernightIborIndex) -- ^baseIndex
  787  -> (GenIborIndex ibor) -- ^otherIndex
  788  -> (Maybe (GenYieldTermStructure y)) -- ^discountHandle
  789  -> (Bool) -- ^bootstrapBaseCurve (1.44; QuantLib 1.43 requires 'False')
  790  -> (Int) -- ^paymentLag (1.44; QuantLib 1.43 requires 0)
  791  -> (Maybe Frequency) -- ^overnightPaymentFrequency (1.44; QuantLib 1.43 requires 'Nothing')
  792  -> (Maybe Bool) -- ^useIndexedCoupons (1.44; QuantLib 1.43 requires 'Nothing')
  793  -> (DateGenerationRule) -- ^rule (1.44; QuantLib 1.43 requires 'Backward')
  794  -> (RateAveragingType) -- ^averagingMethod (1.44; QuantLib 1.43 requires 'AveragingCompound')
  795  -> (Bool) -- ^telescopicValueDates (1.44; QuantLib 1.43 requires 'False')
  796  -> (Bool) -- ^basisOnIborLeg (1.44; QuantLib 1.43 requires 'False')
  797  -> (Maybe (StubIndexSelection ibor2)) -- ^iborStub (1.44; QuantLib 1.43 requires 'Nothing')
  798  -> IO ((RateHelper))
  799 overnightIborBasisSwapRateHelper a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 =
  800   withQuote a1 $ \a1' -> 
  801   let {(a2'1, a2'2) = fromEnumQuantity a2} in 
  802   let {a3' = fromIntegral a3} in 
  803   withCalendar a4 $ \a4' -> 
  804   let {a5' = fromEnumC a5} in 
  805   let {a6' = C2HSImp.fromBool a6} in 
  806   withOvernightIborIndex a7 $ \a7' -> 
  807   withIborIndex a8 $ \a8' -> 
  808   withMaybeYieldTermStructure a9 $ \a9' -> 
  809   let {a10' = C2HSImp.fromBool a10} in 
  810   let {a11' = fromIntegral a11} in 
  811   let {a12' = fromMaybeEnum a12} in 
  812   let {a13' = fromMaybeBool a13} in 
  813   let {a14' = (fromIntegral . fromEnum) a14} in 
  814   let {a15' = fromEnumC a15} in 
  815   let {a16' = C2HSImp.fromBool a16} in 
  816   let {a17' = C2HSImp.fromBool a17} in 
  817   withStubIndexSelection a18 $ \a18' -> 
  818   preErrorCheck $ \a19' -> 
  819   overnightIborBasisSwapRateHelper'_ a1' a2'1  a2'2 a3' a4' a5' a6' a7' a8' a9' a10' a11' a12' a13' a14' a15' a16' a17' a18' a19' >>= \res ->
  820   peekRateHelper res >>= \res' ->
  821   errorCheck  a19'>>
  822   return (res')
  823 
  824 
  825 
  826 -- |Bootstrapping helper for a constant-notional cross-currency basis swap: the collateral is
  827 -- paid in the quote currency, the basis is given on the base-currency leg. 'Nothing' for either
  828 -- frequency parameter derives the corresponding leg's schedule from its index tenor (or, for the
  829 -- quote-currency leg, falls back to the base-currency frequency if that is given).
  830 constNotionalCrossCurrencyBasisSwapRateHelper :: (GenQuote q) -- ^basis
  831  -> ((Int,TimeUnit)) -- ^tenor
  832  -> (Word) -- ^fixingDays
  833  -> (Calendar) -- ^calendar
  834  -> (BusinessDayConvention) -- ^convention
  835  -> (Bool) -- ^endOfMonth
  836  -> (GenIborIndex ibor1) -- ^baseCurrencyIndex
  837  -> (GenIborIndex ibor2) -- ^quoteCurrencyIndex
  838  -> (GenYieldTermStructure y) -- ^collateralCurve
  839  -> (Bool) -- ^isFxBaseCurrencyCollateralCurrency
  840  -> (Bool) -- ^isBasisOnFxBaseCurrencyLeg
  841  -> (Maybe Frequency) -- ^paymentFrequency
  842  -> (Int) -- ^paymentLag
  843  -> (Maybe Frequency) -- ^quoteCurrencyPaymentFrequency
  844  -> (Maybe Bool) -- ^useIndexedCoupons (1.44; QuantLib 1.43 requires 'Nothing')
  845  -> (Bool) -- ^paymentLagOnNotionalExchanges (1.44; QuantLib 1.43 requires 'False')
  846  -> (Maybe (StubIndexSelection ibor3)) -- ^baseStub (1.44; QuantLib 1.43 requires 'Nothing')
  847  -> (Maybe (StubIndexSelection ibor4)) -- ^quoteStub (1.44; QuantLib 1.43 requires 'Nothing')
  848  -> IO ((RateHelper))
  849 constNotionalCrossCurrencyBasisSwapRateHelper a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 =
  850   withQuote a1 $ \a1' -> 
  851   let {(a2'1, a2'2) = fromEnumQuantity a2} in 
  852   let {a3' = fromIntegral a3} in 
  853   withCalendar a4 $ \a4' -> 
  854   let {a5' = fromEnumC a5} in 
  855   let {a6' = C2HSImp.fromBool a6} in 
  856   withIborIndex a7 $ \a7' -> 
  857   withIborIndex a8 $ \a8' -> 
  858   withYieldTermStructure a9 $ \a9' -> 
  859   let {a10' = C2HSImp.fromBool a10} in 
  860   let {a11' = C2HSImp.fromBool a11} in 
  861   let {a12' = fromMaybeEnum a12} in 
  862   let {a13' = fromIntegral a13} in 
  863   let {a14' = fromMaybeEnum a14} in 
  864   let {a15' = fromMaybeBool a15} in 
  865   let {a16' = C2HSImp.fromBool a16} in 
  866   withStubIndexSelection a17 $ \a17' -> 
  867   withStubIndexSelection a18 $ \a18' -> 
  868   preErrorCheck $ \a19' -> 
  869   constNotionalCrossCurrencyBasisSwapRateHelper'_ a1' a2'1  a2'2 a3' a4' a5' a6' a7' a8' a9' a10' a11' a12' a13' a14' a15' a16' a17' a18' a19' >>= \res ->
  870   peekRateHelper res >>= \res' ->
  871   errorCheck  a19'>>
  872   return (res')
  873 
  874 
  875 
  876 -- |Bootstrapping helper for a marked-to-market cross-currency basis swap: like
  877 -- 'constNotionalCrossCurrencyBasisSwapRateHelper', but the notional on the MtM leg resets at
  878 -- each payment to reflect the FX rate.
  879 mtmCrossCurrencyBasisSwapRateHelper :: (GenQuote q) -- ^basis
  880  -> ((Int,TimeUnit)) -- ^tenor
  881  -> (Word) -- ^fixingDays
  882  -> (Calendar) -- ^calendar
  883  -> (BusinessDayConvention) -- ^convention
  884  -> (Bool) -- ^endOfMonth
  885  -> (GenIborIndex ibor1) -- ^baseCurrencyIndex
  886  -> (GenIborIndex ibor2) -- ^quoteCurrencyIndex
  887  -> (GenYieldTermStructure y) -- ^collateralCurve
  888  -> (Bool) -- ^isFxBaseCurrencyCollateralCurrency
  889  -> (Bool) -- ^isBasisOnFxBaseCurrencyLeg
  890  -> (Bool) -- ^isFxBaseCurrencyLegResettable
  891  -> (Maybe Frequency) -- ^paymentFrequency
  892  -> (Int) -- ^paymentLag
  893  -> (Maybe Frequency) -- ^quoteCurrencyPaymentFrequency
  894  -> (Word) -- ^fxResetFixingDays (1.44; QuantLib 1.43 requires 0)
  895  -> (Maybe Calendar) -- ^fxResetFixingCalendar (1.44; QuantLib 1.43 requires 'Nothing')
  896  -> (Maybe Bool) -- ^useIndexedCoupons (1.44; QuantLib 1.43 requires 'Nothing')
  897  -> (Maybe (StubIndexSelection ibor3)) -- ^baseStub (1.44; QuantLib 1.43 requires 'Nothing')
  898  -> (Maybe (StubIndexSelection ibor4)) -- ^quoteStub (1.44; QuantLib 1.43 requires 'Nothing')
  899  -> IO ((RateHelper))
  900 mtmCrossCurrencyBasisSwapRateHelper a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 a19 a20 =
  901   withQuote a1 $ \a1' -> 
  902   let {(a2'1, a2'2) = fromEnumQuantity a2} in 
  903   let {a3' = fromIntegral a3} in 
  904   withCalendar a4 $ \a4' -> 
  905   let {a5' = fromEnumC a5} in 
  906   let {a6' = C2HSImp.fromBool a6} in 
  907   withIborIndex a7 $ \a7' -> 
  908   withIborIndex a8 $ \a8' -> 
  909   withYieldTermStructure a9 $ \a9' -> 
  910   let {a10' = C2HSImp.fromBool a10} in 
  911   let {a11' = C2HSImp.fromBool a11} in 
  912   let {a12' = C2HSImp.fromBool a12} in 
  913   let {a13' = fromMaybeEnum a13} in 
  914   let {a14' = fromIntegral a14} in 
  915   let {a15' = fromMaybeEnum a15} in 
  916   let {a16' = fromIntegral a16} in 
  917   withMaybeCalendar a17 $ \a17' -> 
  918   let {a18' = fromMaybeBool a18} in 
  919   withStubIndexSelection a19 $ \a19' -> 
  920   withStubIndexSelection a20 $ \a20' -> 
  921   preErrorCheck $ \a21' -> 
  922   mtmCrossCurrencyBasisSwapRateHelper'_ a1' a2'1  a2'2 a3' a4' a5' a6' a7' a8' a9' a10' a11' a12' a13' a14' a15' a16' a17' a18' a19' a20' a21' >>= \res ->
  923   peekRateHelper res >>= \res' ->
  924   errorCheck  a21'>>
  925   return (res')
  926 
  927 
  928 
  929 -- |Bootstrapping helper for a fixed-vs-floating cross-currency par swap: quoted at par, so the
  930 -- FX spot cancels out and isn't required. 'collateralOnFixedLeg' selects which leg is discounted
  931 -- with 'collateralCurve' -- the other leg's discount curve is the one being bootstrapped.
  932 constNotionalCrossCurrencySwapRateHelper :: (GenQuote q) -- ^fixedRate
  933  -> ((Int,TimeUnit)) -- ^tenor
  934  -> (Word) -- ^fixingDays
  935  -> (Calendar) -- ^calendar
  936  -> (BusinessDayConvention) -- ^convention
  937  -> (Bool) -- ^endOfMonth
  938  -> (Frequency) -- ^fixedFrequency
  939  -> (DayCounter) -- ^fixedDayCount
  940  -> (GenIborIndex ibor) -- ^floatIndex
  941  -> (GenYieldTermStructure y) -- ^collateralCurve
  942  -> (Bool) -- ^collateralOnFixedLeg
  943  -> (Int) -- ^paymentLag
  944  -> (Maybe Bool) -- ^useIndexedCoupons (1.44; QuantLib 1.43 requires 'Nothing')
  945  -> (Maybe Frequency) -- ^floatPaymentFrequency (1.44; QuantLib 1.43 requires 'Nothing')
  946  -> (Maybe (StubIndexSelection ibor2)) -- ^floatStub (1.44; QuantLib 1.43 requires 'Nothing')
  947  -> IO ((RateHelper))
  948 constNotionalCrossCurrencySwapRateHelper a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 =
  949   withQuote a1 $ \a1' -> 
  950   let {(a2'1, a2'2) = fromEnumQuantity a2} in 
  951   let {a3' = fromIntegral a3} in 
  952   withCalendar a4 $ \a4' -> 
  953   let {a5' = fromEnumC a5} in 
  954   let {a6' = C2HSImp.fromBool a6} in 
  955   let {a7' = (fromIntegral . fromEnum) a7} in 
  956   withDayCounter a8 $ \a8' -> 
  957   withIborIndex a9 $ \a9' -> 
  958   withYieldTermStructure a10 $ \a10' -> 
  959   let {a11' = C2HSImp.fromBool a11} in 
  960   let {a12' = fromIntegral a12} in 
  961   let {a13' = fromMaybeBool a13} in 
  962   let {a14' = fromMaybeEnum a14} in 
  963   withStubIndexSelection a15 $ \a15' -> 
  964   preErrorCheck $ \a16' -> 
  965   constNotionalCrossCurrencySwapRateHelper'_ a1' a2'1  a2'2 a3' a4' a5' a6' a7' a8' a9' a10' a11' a12' a13' a14' a15' a16' >>= \res ->
  966   peekRateHelper res >>= \res' ->
  967   errorCheck  a16'>>
  968   return (res')
  969 
  970 
  971 
  972 -- |How an FX swap helper's dates are given. 'FxSwapTenor' is relative to the evaluation date:
  973 -- the swap starts @fixingDays@ business days after it on @calendar@ and runs for @tenor@, and
  974 -- @tradingCalendar@ (QuantLib's null calendar for none) is joined with @calendar@ for the spot
  975 -- date. 'FxSwapBetweenDates' runs between two fixed dates.
  976 data FxSwapTerms
  977   = FxSwapTenor
  978       !(Int, TimeUnit) -- ^tenor
  979       !Word -- ^fixingDays
  980       !Calendar
  981       !BusinessDayConvention
  982       !Bool -- ^endOfMonth
  983       !Calendar -- ^tradingCalendar
  984   | FxSwapBetweenDates
  985       !Day -- ^startDate
  986       !Day -- ^endDate
  987 
  988 -- |Bootstrapping helper from FX swap points. 'collateralCurve' discounts the collateral
  989 -- currency; the curve being bootstrapped is for the other currency. 'fwdPoint' and 'spotFx' must
  990 -- be quoted in the same units (points already scaled to match the spot).
  991 fxSwapRateHelper :: GenQuote q1 -- ^fwdPoint
  992   -> GenQuote q2 -- ^spotFx
  993   -> FxSwapTerms
  994   -> Bool -- ^isFxBaseCurrencyCollateralCurrency
  995   -> GenYieldTermStructure y -- ^collateralCurve
  996   -> IO RateHelper
  997 fxSwapRateHelper fwdPoint spotFx terms isBase collateral = case terms of
  998   FxSwapTenor t fd cal conv eom trading -> fxSwapRateHelperRaw fwdPoint spotFx t fd cal conv eom isBase collateral trading
  999   FxSwapBetweenDates s e -> fxSwapRateHelperBetweenDatesRaw fwdPoint spotFx s e isBase collateral
 1000 
 1001 -- Raw FX swap bindings behind 'fxSwapRateHelper'; one per 'FxSwapTerms' constructor.
 1002 fxSwapRateHelperRaw :: (GenQuote q1) -- ^fwdPoint
 1003  -> (GenQuote q2) -- ^spotFx
 1004  -> ((Int,TimeUnit)) -- ^tenor
 1005  -> (Word) -- ^fixingDays
 1006  -> (Calendar) -- ^calendar
 1007  -> (BusinessDayConvention) -- ^convention
 1008  -> (Bool) -- ^endOfMonth
 1009  -> (Bool) -- ^isFxBaseCurrencyCollateralCurrency
 1010  -> (GenYieldTermStructure y) -- ^collateralCurve
 1011  -> (Calendar) -- ^tradingCalendar
 1012  -> IO ((RateHelper))
 1013 fxSwapRateHelperRaw a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 =
 1014   withQuote a1 $ \a1' -> 
 1015   withQuote a2 $ \a2' -> 
 1016   let {(a3'1, a3'2) = fromEnumQuantity a3} in 
 1017   let {a4' = fromIntegral a4} in 
 1018   withCalendar a5 $ \a5' -> 
 1019   let {a6' = fromEnumC a6} in 
 1020   let {a7' = C2HSImp.fromBool a7} in 
 1021   let {a8' = C2HSImp.fromBool a8} in 
 1022   withYieldTermStructure a9 $ \a9' -> 
 1023   withCalendar a10 $ \a10' -> 
 1024   preErrorCheck $ \a11' -> 
 1025   fxSwapRateHelperRaw'_ a1' a2' a3'1  a3'2 a4' a5' a6' a7' a8' a9' a10' a11' >>= \res ->
 1026   peekRateHelper res >>= \res' ->
 1027   errorCheck  a11'>>
 1028   return (res')
 1029 
 1030 
 1031 
 1032 fxSwapRateHelperBetweenDatesRaw :: (GenQuote q1) -- ^fwdPoint
 1033  -> (GenQuote q2) -- ^spotFx
 1034  -> (Day) -- ^startDate
 1035  -> (Day) -- ^endDate
 1036  -> (Bool) -- ^isFxBaseCurrencyCollateralCurrency
 1037  -> (GenYieldTermStructure y) -- ^collateralCurve
 1038  -> IO ((RateHelper))
 1039 fxSwapRateHelperBetweenDatesRaw a1 a2 a3 a4 a5 a6 =
 1040   withQuote a1 $ \a1' -> 
 1041   withQuote a2 $ \a2' -> 
 1042   withDay a3 $ \a3' -> 
 1043   withDay a4 $ \a4' -> 
 1044   let {a5' = C2HSImp.fromBool a5} in 
 1045   withYieldTermStructure a6 $ \a6' -> 
 1046   preErrorCheck $ \a7' -> 
 1047   fxSwapRateHelperBetweenDatesRaw'_ a1' a2' a3' a4' a5' a6' a7' >>= \res ->
 1048   peekRateHelper res >>= \res' ->
 1049   errorCheck  a7'>>
 1050   return (res')
 1051 
 1052 
 1053 
 1054 -- |/Warning/ Setting a pricing engine to the passed bond from external code will cause the bootstrap to fail or to give wrong results. It is advised to discard the bond after creating the helper, so that the helper has sole ownership of it.
 1055 -- 'BondPriceType' is marshalled as an 'Int' to avoid a c2hs cross-module enum-import cycle.
 1056 bondHelper :: GenQuote q -> GenBond b -> Bond.BondPriceType -> IO BondHelper
 1057 bondHelper cleanPrice bond priceType = bondHelper_ cleanPrice bond (fromEnum priceType)
 1058 
 1059 bondHelper_ :: (GenQuote q) -> (GenBond b) -> (Int) -- ^priceType
 1060  -> IO ((BondHelper))
 1061 bondHelper_ a1 a2 a3 =
 1062   withQuote a1 $ \a1' -> 
 1063   withBond a2 $ \a2' -> 
 1064   let {a3' = fromIntegral a3} in 
 1065   preErrorCheck $ \a4' -> 
 1066   bondHelper_'_ a1' a2' a3' a4' >>= \res ->
 1067   peekBondHelper res >>= \res' ->
 1068   errorCheck  a4'>>
 1069   return (res')
 1070 
 1071 
 1072 
 1073 -- |How an OIS helper's dates are given. 'OisTenor' is relative to the evaluation date: the swap
 1074 -- starts @settlementDays@ after it plus @forwardStart@ and runs for @tenor@. 'OisBetweenDates'
 1075 -- runs between two fixed dates; every overnight fixing it compounds over that is before the
 1076 -- evaluation date is read from the store. @forwardStart@ is a field of 'OisTenor' rather than
 1077 -- of 'OISRateHelperOpts' because QuantLib's dated constructor has none.
 1078 data OisTerms
 1079   = OisTenor
 1080       !Word -- ^settlementDays
 1081       !(Int, TimeUnit) -- ^tenor
 1082       !(Int, TimeUnit) -- ^forwardStart
 1083   | OisBetweenDates
 1084       !Day -- ^startDate
 1085       !Day -- ^endDate
 1086 
 1087 -- |Rate helper for bootstrapping over overnight-indexed swap rates, with QuantLib's defaults for
 1088 -- everything 'oisRateHelperWithOptions' can set. Both share the same full-arity bindings.
 1089 oisRateHelper :: OisTerms -> GenQuote q -> OvernightIborIndex
 1090   -> Maybe (GenYieldTermStructure y) -> IO OISRateHelper
 1091 oisRateHelper terms fixedRate idx discountingCurve = do
 1092   cal <- calendar Null
 1093   case terms of
 1094     OisTenor settlementDays tenor forwardStart ->
 1095       oisRateHelper_ settlementDays tenor fixedRate idx discountingCurve
 1096         False 0 Following Annual cal forwardStart Nothing LastRelevantDate Nothing AveragingCompound
 1097         Nothing Nothing cal Nothing 0 False Nothing Backward cal ModifiedFollowing Nothing
 1098     OisBetweenDates startDate endDate ->
 1099       oisRateHelper2_ startDate endDate fixedRate idx discountingCurve
 1100         False 0 Following Annual cal Nothing LastRelevantDate Nothing AveragingCompound
 1101         Nothing Nothing cal Nothing 0 False Nothing Backward cal ModifiedFollowing Nothing
 1102 
 1103 oisRateHelper_ :: (Word) -- ^settlementDays
 1104  -> ((Int,TimeUnit)) -- ^tenor
 1105  -> (GenQuote q1) -> (OvernightIborIndex) -> (Maybe (GenYieldTermStructure y)) -- ^discountingCurve
 1106  -> (Bool) -- ^telescopicValueDates
 1107  -> (Int) -- ^paymentLag
 1108  -> (BusinessDayConvention) -- ^paymentConvention
 1109  -> (Frequency) -- ^paymentFrequency
 1110  -> (Calendar) -- ^paymentCalendar
 1111  -> ((Int,TimeUnit)) -- ^forwardStart
 1112  -> (Maybe (GenQuote q2)) -- ^overnightSpread
 1113  -> (PillarChoice) -- ^pillar
 1114  -> (Maybe Day) -- ^customPillarDate
 1115  -> (RateAveragingType) -- ^averagingMethod
 1116  -> (Maybe Bool) -- ^endOfMonth
 1117  -> (Maybe Frequency) -- ^fixedPaymentFrequency
 1118  -> (Calendar) -- ^fixedCalendar
 1119  -> (Maybe Word) -- ^lookbackDays
 1120  -> (Word) -- ^lockoutDays
 1121  -> (Bool) -- ^applyObservationShift
 1122  -> (Maybe (GenFloatingRateCouponPricer frcp)) -- ^pricer
 1123  -> (DateGenerationRule) -- ^rule
 1124  -> (Calendar) -- ^overnightCalendar
 1125  -> (BusinessDayConvention) -- ^convention (q1.k.q1. overnightConvention)
 1126  -> (Maybe DayCounter) -- ^fixedDayCount (1.44; QuantLib 1.43 requires 'Nothing')
 1127  -> IO ((OISRateHelper))
 1128 oisRateHelper_ a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 a19 a20 a21 a22 a23 a24 a25 a26 =
 1129   let {a1' = fromIntegral a1} in 
 1130   let {(a2'1, a2'2) = fromEnumQuantity a2} in 
 1131   withQuote a3 $ \a3' -> 
 1132   withOvernightIborIndex a4 $ \a4' -> 
 1133   withMaybeYieldTermStructure a5 $ \a5' -> 
 1134   let {a6' = C2HSImp.fromBool a6} in 
 1135   let {a7' = fromIntegral a7} in 
 1136   let {a8' = fromEnumC a8} in 
 1137   let {a9' = (fromIntegral . fromEnum) a9} in 
 1138   withCalendar a10 $ \a10' -> 
 1139   let {(a11'1, a11'2) = fromEnumQuantity a11} in 
 1140   withMaybeQuote a12 $ \a12' -> 
 1141   let {a13' = (fromIntegral . fromEnum) a13} in 
 1142   withMaybeDay a14 $ \a14' -> 
 1143   let {a15' = (fromIntegral . fromEnum) a15} in 
 1144   let {a16' = fromMaybeBool a16} in 
 1145   let {a17' = fromMaybeEnum a17} in 
 1146   withCalendar a18 $ \a18' -> 
 1147   let {a19' = fromMaybeInt a19} in 
 1148   let {a20' = fromIntegral a20} in 
 1149   let {a21' = C2HSImp.fromBool a21} in 
 1150   withMaybeFloatingRateCouponPricer a22 $ \a22' -> 
 1151   let {a23' = (fromIntegral . fromEnum) a23} in 
 1152   withCalendar a24 $ \a24' -> 
 1153   let {a25' = fromEnumC a25} in 
 1154   withMaybeDayCounter a26 $ \a26' -> 
 1155   preErrorCheck $ \a27' -> 
 1156   oisRateHelper_'_ a1' a2'1  a2'2 a3' a4' a5' a6' a7' a8' a9' a10' a11'1  a11'2 a12' a13' a14' a15' a16' a17' a18' a19' a20' a21' a22' a23' a24' a25' a26' a27' >>= \res ->
 1157   peekOISRateHelper res >>= \res' ->
 1158   errorCheck  a27'>>
 1159   return (res')
 1160 
 1161 
 1162 oisRateHelper2_ :: (Day) -- ^startDate
 1163  -> (Day) -- ^endDate
 1164  -> (GenQuote q1) -> (OvernightIborIndex) -> (Maybe (GenYieldTermStructure y)) -- ^discountingCurve
 1165  -> (Bool) -- ^telescopicValueDates
 1166  -> (Int) -- ^paymentLag
 1167  -> (BusinessDayConvention) -- ^paymentConvention
 1168  -> (Frequency) -- ^paymentFrequency
 1169  -> (Calendar) -- ^paymentCalendar
 1170  -> (Maybe (GenQuote q2)) -- ^overnightSpread
 1171  -> (PillarChoice) -- ^pillar
 1172  -> (Maybe Day) -- ^customPillarDate
 1173  -> (RateAveragingType) -- ^averagingMethod
 1174  -> (Maybe Bool) -- ^endOfMonth
 1175  -> (Maybe Frequency) -- ^fixedPaymentFrequency
 1176  -> (Calendar) -- ^fixedCalendar
 1177  -> (Maybe Word) -- ^lookbackDays
 1178  -> (Word) -- ^lockoutDays
 1179  -> (Bool) -- ^applyObservationShift
 1180  -> (Maybe (GenFloatingRateCouponPricer frcp)) -- ^pricer
 1181  -> (DateGenerationRule) -- ^rule
 1182  -> (Calendar) -- ^overnightCalendar
 1183  -> (BusinessDayConvention) -- ^convention (q1.k.q1. overnightConvention)
 1184  -> (Maybe DayCounter) -- ^fixedDayCount (1.44; QuantLib 1.43 requires 'Nothing')
 1185  -> IO ((OISRateHelper))
 1186 oisRateHelper2_ a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 a19 a20 a21 a22 a23 a24 a25 =
 1187   withDay a1 $ \a1' -> 
 1188   withDay a2 $ \a2' -> 
 1189   withQuote a3 $ \a3' -> 
 1190   withOvernightIborIndex a4 $ \a4' -> 
 1191   withMaybeYieldTermStructure a5 $ \a5' -> 
 1192   let {a6' = C2HSImp.fromBool a6} in 
 1193   let {a7' = fromIntegral a7} in 
 1194   let {a8' = fromEnumC a8} in 
 1195   let {a9' = (fromIntegral . fromEnum) a9} in 
 1196   withCalendar a10 $ \a10' -> 
 1197   withMaybeQuote a11 $ \a11' -> 
 1198   let {a12' = (fromIntegral . fromEnum) a12} in 
 1199   withMaybeDay a13 $ \a13' -> 
 1200   let {a14' = (fromIntegral . fromEnum) a14} in 
 1201   let {a15' = fromMaybeBool a15} in 
 1202   let {a16' = fromMaybeEnum a16} in 
 1203   withCalendar a17 $ \a17' -> 
 1204   let {a18' = fromMaybeInt a18} in 
 1205   let {a19' = fromIntegral a19} in 
 1206   let {a20' = C2HSImp.fromBool a20} in 
 1207   withMaybeFloatingRateCouponPricer a21 $ \a21' -> 
 1208   let {a22' = (fromIntegral . fromEnum) a22} in 
 1209   withCalendar a23 $ \a23' -> 
 1210   let {a24' = fromEnumC a24} in 
 1211   withMaybeDayCounter a25 $ \a25' -> 
 1212   preErrorCheck $ \a26' -> 
 1213   oisRateHelper2_'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' a10' a11' a12' a13' a14' a15' a16' a17' a18' a19' a20' a21' a22' a23' a24' a25' a26' >>= \res ->
 1214   peekOISRateHelper res >>= \res' ->
 1215   errorCheck  a26'>>
 1216   return (res')
 1217 
 1218 
 1219 
 1220 -- |'oisRateHelper' with every trailing QuantLib parameter taken from an options record.
 1221 oisRateHelperWithOptions :: OisTerms -> GenQuote q -> OvernightIborIndex
 1222   -> Maybe (GenYieldTermStructure y) -> OISRateHelperOpts m p -> IO OISRateHelper
 1223 oisRateHelperWithOptions terms fixedRate idx discountingCurve opts = do
 1224   cal <- calendar Null
 1225   let obs = oisObservation opts
 1226       paymentCal = fromMaybe cal (oisPaymentCalendar opts)
 1227       fixedCal = fromMaybe cal (oisFixedCalendar opts)
 1228       overnightCal = fromMaybe cal (oisOvernightCalendar opts)
 1229   case terms of
 1230     OisTenor settlementDays tenor forwardStart ->
 1231       oisRateHelper_ settlementDays tenor fixedRate idx discountingCurve
 1232         (oisTelescopicValueDates opts) (oisPaymentLag opts) (oisPaymentConvention opts)
 1233         (oisPaymentFrequency opts) paymentCal
 1234         forwardStart (oisOvernightSpread opts) (oisPillar opts) (oisCustomPillarDate opts)
 1235         (oisAveragingMethod opts) (oisEndOfMonth opts) (oisFixedPaymentFrequency opts)
 1236         fixedCal (lookbackDays obs) (lockoutDays obs)
 1237         (applyObservationShift obs) (oisPricer opts) (oisRule opts)
 1238         overnightCal (oisConvention opts) (oisFixedDayCount opts)
 1239     OisBetweenDates startDate endDate ->
 1240       oisRateHelper2_ startDate endDate fixedRate idx discountingCurve
 1241         (oisTelescopicValueDates opts) (oisPaymentLag opts) (oisPaymentConvention opts)
 1242         (oisPaymentFrequency opts) paymentCal
 1243         (oisOvernightSpread opts) (oisPillar opts) (oisCustomPillarDate opts)
 1244         (oisAveragingMethod opts) (oisEndOfMonth opts) (oisFixedPaymentFrequency opts)
 1245         fixedCal (lookbackDays obs) (lockoutDays obs)
 1246         (applyObservationShift obs) (oisPricer opts) (oisRule opts)
 1247         overnightCal (oisConvention opts) (oisFixedDayCount opts)
 1248 
 1249 -- The 'SwapRateFromIndex' binding behind 'swapRateHelper'.
 1250 swapRateHelperFromIndexRaw :: (GenQuote q1) -- ^rate
 1251  -> (GenSwapIndex sidx) -> (Maybe (GenQuote q2)) -- ^spread
 1252  -> ((Int,TimeUnit)) -- ^fwdStart
 1253  -> (Maybe (GenYieldTermStructure y)) -- ^discountingCurve
 1254  -> (PillarChoice) -- ^pillar
 1255  -> (Maybe Day) -- ^customPillarDate
 1256  -> (Bool) -- ^endOfMonth
 1257  -> (Maybe Bool) -- ^useIndexedCoupons
 1258  -> (Maybe (GenFloatingRateCouponPricer frcp)) -- ^couponPricer
 1259  -> IO ((SwapRateHelper))
 1260 swapRateHelperFromIndexRaw a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 =
 1261   withQuote a1 $ \a1' -> 
 1262   withSwapIndex a2 $ \a2' -> 
 1263   withMaybeQuote a3 $ \a3' -> 
 1264   let {(a4'1, a4'2) = fromEnumQuantity a4} in 
 1265   withMaybeYieldTermStructure a5 $ \a5' -> 
 1266   let {a6' = (fromIntegral . fromEnum) a6} in 
 1267   withMaybeDay a7 $ \a7' -> 
 1268   let {a8' = C2HSImp.fromBool a8} in 
 1269   let {a9' = fromMaybeBool a9} in 
 1270   withMaybeFloatingRateCouponPricer a10 $ \a10' -> 
 1271   preErrorCheck $ \a11' -> 
 1272   swapRateHelperFromIndexRaw'_ a1' a2' a3' a4'1  a4'2 a5' a6' a7' a8' a9' a10' a11' >>= \res ->
 1273   peekSwapRateHelper res >>= \res' ->
 1274   errorCheck  a11'>>
 1275   return (res')
 1276 
 1277 
 1278 
 1279 -- |A yield curve offset from 'baseCurve' by a spread added to its instantaneous forward rate,
 1280 -- remaining linked to changes in either.
 1281 forwardSpreadedTermStructure :: (GenYieldTermStructure y) -> (GenQuote q) -> IO ((YieldTermStructure))
 1282 forwardSpreadedTermStructure a1 a2 =
 1283   withYieldTermStructure a1 $ \a1' -> 
 1284   withQuote a2 $ \a2' -> 
 1285   preErrorCheck $ \a3' -> 
 1286   forwardSpreadedTermStructure'_ a1' a2' a3' >>= \res ->
 1287   peekYieldTermStructure res >>= \res' ->
 1288   errorCheck  a3'>>
 1289   return (res')
 1290 
 1291 
 1292 
 1293 -- |A yield curve offset from 'baseCurve' by a spread added to its zero-yield rate, remaining
 1294 -- linked to changes in either.
 1295 zeroSpreadedTermStructure :: (GenYieldTermStructure y) -> (GenQuote q) -> (Compounding) -> (Frequency) -> IO ((YieldTermStructure))
 1296 zeroSpreadedTermStructure a1 a2 a3 a4 =
 1297   withYieldTermStructure a1 $ \a1' -> 
 1298   withQuote a2 $ \a2' -> 
 1299   let {a3' = (fromIntegral . fromEnum) a3} in 
 1300   let {a4' = (fromIntegral . fromEnum) a4} in 
 1301   preErrorCheck $ \a5' -> 
 1302   zeroSpreadedTermStructure'_ a1' a2' a3' a4' a5' >>= \res ->
 1303   peekYieldTermStructure res >>= \res' ->
 1304   errorCheck  a5'>>
 1305   return (res')
 1306 
 1307 
 1308 
 1309 -- |A yield curve whose zero rate is @f rate1 rate2@, where @rate1@ and @rate2@ are the
 1310 -- input curves' zero rates expressed with the given compounding and frequency. The result is
 1311 -- live in both inputs.
 1312 --
 1313 -- The curve and its native dependents retain @f@ after the continuation returns.
 1314 -- Callback exceptions are rethrown by the enclosing Haskell call.
 1315 withCompositeZeroYieldStructure :: (Double -> Double -> Double) -- ^f(rate1, rate2)
 1316   -> GenYieldTermStructure y1 -- ^curve1
 1317   -> GenYieldTermStructure y2 -- ^curve2
 1318   -> Compounding
 1319   -> Frequency
 1320   -> (YieldTermStructure -> IO a)
 1321   -> IO a
 1322 withCompositeZeroYieldStructure f c1 c2 comp freq k =
 1323   withQuoteBinaryFun f $ \fp -> qlCompositeZeroYieldStructure c1 c2 fp comp freq >>= k
 1324 qlCompositeZeroYieldStructure :: (GenYieldTermStructure y1) -> (GenYieldTermStructure y2) -> (Callback) -> (Compounding) -> (Frequency) -> IO ((YieldTermStructure))
 1325 qlCompositeZeroYieldStructure a1 a2 a3 a4 a5 =
 1326   withYieldTermStructure a1 $ \a1' -> 
 1327   withYieldTermStructure a2 $ \a2' -> 
 1328   withCallbackPtr a3 $ \a3' -> 
 1329   let {a4' = (fromIntegral . fromEnum) a4} in 
 1330   let {a5' = (fromIntegral . fromEnum) a5} in 
 1331   preErrorCheck $ \a6' -> 
 1332   qlCompositeZeroYieldStructure'_ a1' a2' a3' a4' a5' a6' >>= \res ->
 1333   peekYieldTermStructure res >>= \res' ->
 1334   errorCheck  a6'>>
 1335   return (res')
 1336 
 1337 
 1338 
 1339 -- |Rate helper for bootstrapping over BMA swap rates.
 1340 bmaSwapRateHelper :: (GenQuote q) -- ^liborFraction
 1341  -> ((Int,TimeUnit)) -- ^tenor
 1342  -> (Word) -- ^settlementDAys
 1343  -> (Calendar) -> ((Int,TimeUnit)) -- ^bmpPeriod
 1344  -> (BusinessDayConvention) -> (DayCounter) -> (BMAIndex) -> (GenIborIndex ibor) -> IO ((RateHelper))
 1345 bmaSwapRateHelper a1 a2 a3 a4 a5 a6 a7 a8 a9 =
 1346   withQuote a1 $ \a1' -> 
 1347   let {(a2'1, a2'2) = fromEnumQuantity a2} in 
 1348   let {a3' = fromIntegral a3} in 
 1349   withCalendar a4 $ \a4' -> 
 1350   let {(a5'1, a5'2) = fromEnumQuantity a5} in 
 1351   let {a6' = fromEnumC a6} in 
 1352   withDayCounter a7 $ \a7' -> 
 1353   withBMAIndex a8 $ \a8' -> 
 1354   withIborIndex a9 $ \a9' -> 
 1355   preErrorCheck $ \a10' -> 
 1356   bmaSwapRateHelper'_ a1' a2'1  a2'2 a3' a4' a5'1  a5'2 a6' a7' a8' a9' a10' >>= \res ->
 1357   peekRateHelper res >>= \res' ->
 1358   errorCheck  a10'>>
 1359   return (res')
 1360 
 1361 
 1362 
 1363 -- |Rate helper for bootstrapping from multiple-resets swap quotes (a floating leg that resets
 1364 -- several times per fixed-leg coupon period).
 1365 multipleResetsSwapRateHelper :: (Word) -- ^settlementDays
 1366  -> ((Int,TimeUnit)) -- ^tenor
 1367  -> (GenQuote q1) -- ^fixedRate
 1368  -> (GenIborIndex ibor) -> (Word) -- ^resetsPerCoupon
 1369  -> (Maybe (GenYieldTermStructure y)) -- ^discountingCurve
 1370  -> (RateAveragingType) -- ^averagingMethod
 1371  -> (Double) -- ^spread
 1372  -> (Frequency) -- ^fixedFrequency
 1373  -> (DayCounter) -- ^fixedDayCount
 1374  -> (BusinessDayConvention) -- ^fixedConvention
 1375  -> IO ((RateHelper))
 1376 multipleResetsSwapRateHelper a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 =
 1377   let {a1' = fromIntegral a1} in 
 1378   let {(a2'1, a2'2) = fromEnumQuantity a2} in 
 1379   withQuote a3 $ \a3' -> 
 1380   withIborIndex a4 $ \a4' -> 
 1381   let {a5' = fromIntegral a5} in 
 1382   withMaybeYieldTermStructure a6 $ \a6' -> 
 1383   let {a7' = (fromIntegral . fromEnum) a7} in 
 1384   let {a8' = realToFrac a8} in 
 1385   let {a9' = (fromIntegral . fromEnum) a9} in 
 1386   withDayCounter a10 $ \a10' -> 
 1387   let {a11' = fromEnumC a11} in 
 1388   preErrorCheck $ \a12' -> 
 1389   multipleResetsSwapRateHelper'_ a1' a2'1  a2'2 a3' a4' a5' a6' a7' a8' a9' a10' a11' a12' >>= \res ->
 1390   peekRateHelper res >>= \res' ->
 1391   errorCheck  a12'>>
 1392   return (res')
 1393 
 1394 
 1395 
 1396 -- Raw FRA bindings behind 'fraRateHelper'; one per 'FraTerms' constructor.
 1397 fraRateHelperFromIndexRaw :: (GenQuote q) -> (Word) -- ^monthsToStart
 1398  -> (GenIborIndex ibor) -> (PillarChoice) -- ^pillar
 1399  -> (Maybe Day) -- ^customPillarDate
 1400  -> (Bool) -- ^useIndexedCoupon
 1401  -> IO ((RateHelper))
 1402 fraRateHelperFromIndexRaw a1 a2 a3 a4 a5 a6 =
 1403   withQuote a1 $ \a1' -> 
 1404   let {a2' = fromIntegral a2} in 
 1405   withIborIndex a3 $ \a3' -> 
 1406   let {a4' = (fromIntegral . fromEnum) a4} in 
 1407   withMaybeDay a5 $ \a5' -> 
 1408   let {a6' = C2HSImp.fromBool a6} in 
 1409   preErrorCheck $ \a7' -> 
 1410   fraRateHelperFromIndexRaw'_ a1' a2' a3' a4' a5' a6' a7' >>= \res ->
 1411   peekRateHelper res >>= \res' ->
 1412   errorCheck  a7'>>
 1413   return (res')
 1414 
 1415 
 1416 
 1417 fraRateHelperFromPeriodRaw :: (GenQuote q) -> ((Int,TimeUnit)) -- ^periodToStart
 1418  -> (Word) -- ^lengthInMonths
 1419  -> (Word) -- ^fixingDays
 1420  -> (Calendar) -> (BusinessDayConvention) -> (Bool) -- ^endOfMonth
 1421  -> (DayCounter) -> (PillarChoice) -- ^pillar
 1422  -> (Maybe Day) -- ^customPillarDate
 1423  -> (Bool) -- ^useIndexedCoupon
 1424  -> IO ((RateHelper))
 1425 fraRateHelperFromPeriodRaw a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 =
 1426   withQuote a1 $ \a1' -> 
 1427   let {(a2'1, a2'2) = fromEnumQuantity a2} in 
 1428   let {a3' = fromIntegral a3} in 
 1429   let {a4' = fromIntegral a4} in 
 1430   withCalendar a5 $ \a5' -> 
 1431   let {a6' = fromEnumC a6} in 
 1432   let {a7' = C2HSImp.fromBool a7} in 
 1433   withDayCounter a8 $ \a8' -> 
 1434   let {a9' = (fromIntegral . fromEnum) a9} in 
 1435   withMaybeDay a10 $ \a10' -> 
 1436   let {a11' = C2HSImp.fromBool a11} in 
 1437   preErrorCheck $ \a12' -> 
 1438   fraRateHelperFromPeriodRaw'_ a1' a2'1  a2'2 a3' a4' a5' a6' a7' a8' a9' a10' a11' a12' >>= \res ->
 1439   peekRateHelper res >>= \res' ->
 1440   errorCheck  a12'>>
 1441   return (res')
 1442 
 1443 
 1444 
 1445 fraIborRateHelperRaw :: (GenQuote q) -> ((Int,TimeUnit)) -- ^periodToStart
 1446  -> (GenIborIndex ibor) -> (PillarChoice) -- ^pillar
 1447  -> (Maybe Day) -- ^customPillarDate
 1448  -> (Bool) -- ^useIndexedCoupon
 1449  -> IO ((RateHelper))
 1450 fraIborRateHelperRaw a1 a2 a3 a4 a5 a6 =
 1451   withQuote a1 $ \a1' -> 
 1452   let {(a2'1, a2'2) = fromEnumQuantity a2} in 
 1453   withIborIndex a3 $ \a3' -> 
 1454   let {a4' = (fromIntegral . fromEnum) a4} in 
 1455   withMaybeDay a5 $ \a5' -> 
 1456   let {a6' = C2HSImp.fromBool a6} in 
 1457   preErrorCheck $ \a7' -> 
 1458   fraIborRateHelperRaw'_ a1' a2'1  a2'2 a3' a4' a5' a6' a7' >>= \res ->
 1459   peekRateHelper res >>= \res' ->
 1460   errorCheck  a7'>>
 1461   return (res')
 1462 
 1463 
 1464 
 1465 fraImmOffsetsRateHelperRaw :: (GenQuote q) -> (Word) -- ^immOffsetStart
 1466  -> (Word) -- ^immOffsetEnd
 1467  -> (GenIborIndex ibor) -> (PillarChoice) -- ^pillar
 1468  -> (Maybe Day) -- ^customPillarDate
 1469  -> (Bool) -- ^useIndexedCoupon
 1470  -> IO ((RateHelper))
 1471 fraImmOffsetsRateHelperRaw a1 a2 a3 a4 a5 a6 a7 =
 1472   withQuote a1 $ \a1' -> 
 1473   let {a2' = fromIntegral a2} in 
 1474   let {a3' = fromIntegral a3} in 
 1475   withIborIndex a4 $ \a4' -> 
 1476   let {a5' = (fromIntegral . fromEnum) a5} in 
 1477   withMaybeDay a6 $ \a6' -> 
 1478   let {a7' = C2HSImp.fromBool a7} in 
 1479   preErrorCheck $ \a8' -> 
 1480   fraImmOffsetsRateHelperRaw'_ a1' a2' a3' a4' a5' a6' a7' a8' >>= \res ->
 1481   peekRateHelper res >>= \res' ->
 1482   errorCheck  a8'>>
 1483   return (res')
 1484 
 1485 
 1486 
 1487 fraBetweenDatesRateHelperRaw :: (GenQuote q) -> (Day) -- ^startDate
 1488  -> (Day) -- ^endDate
 1489  -> (GenIborIndex ibor) -> (PillarChoice) -- ^pillar
 1490  -> (Maybe Day) -- ^customPillarDate
 1491  -> (Bool) -- ^useIndexedCoupon
 1492  -> IO ((RateHelper))
 1493 fraBetweenDatesRateHelperRaw a1 a2 a3 a4 a5 a6 a7 =
 1494   withQuote a1 $ \a1' -> 
 1495   withDay a2 $ \a2' -> 
 1496   withDay a3 $ \a3' -> 
 1497   withIborIndex a4 $ \a4' -> 
 1498   let {a5' = (fromIntegral . fromEnum) a5} in 
 1499   withMaybeDay a6 $ \a6' -> 
 1500   let {a7' = C2HSImp.fromBool a7} in 
 1501   preErrorCheck $ \a8' -> 
 1502   fraBetweenDatesRateHelperRaw'_ a1' a2' a3' a4' a5' a6' a7' a8' >>= \res ->
 1503   peekRateHelper res >>= \res' ->
 1504   errorCheck  a8'>>
 1505   return (res')
 1506 
 1507 
 1508 
 1509 -- |How an IborIndex futures contract's underlying deposit is given. @FuturesFromIndex@ takes
 1510 -- the deposit's length and its calendar\/convention\/day-count from the ibor index; the others
 1511 -- state them explicitly.
 1512 data FuturesTerms ibor
 1513   = FuturesMonths
 1514       !Day -- ^iborStartDate
 1515       !Word -- ^lengthInMonths
 1516       !Calendar
 1517       !BusinessDayConvention
 1518       !Bool -- ^endOfMonth
 1519       !DayCounter
 1520   | FuturesBetweenDates
 1521       !Day -- ^iborStartDate
 1522       !Day -- ^iborEndDate
 1523       !DayCounter
 1524   | FuturesFromIndex
 1525       !Day -- ^iborStartDate
 1526       !(GenIborIndex ibor)
 1527 
 1528 -- |Rate helper for bootstrapping over IborIndex futures prices.
 1529 futuresRateHelper :: GenQuote q1 -- ^price
 1530   -> FuturesTerms ibor
 1531   -> Maybe (GenQuote q2) -- ^convexityAdjustment
 1532   -> FuturesType -- ^type
 1533   -> IO FuturesRateHelper
 1534 futuresRateHelper price terms = case terms of
 1535   FuturesMonths d n cal conv eom dc -> futuresRateHelperRaw price d n cal conv eom dc
 1536   FuturesBetweenDates s e dc -> futuresRateHelperBetweenDatesRaw price s e dc
 1537   FuturesFromIndex d idx -> futuresIborRateHelperRaw price d idx
 1538 
 1539 -- Raw futures bindings behind 'futuresRateHelper'; one per 'FuturesTerms' constructor.
 1540 futuresRateHelperBetweenDatesRaw :: (GenQuote q1) -> (Day) -- ^immStartDate
 1541  -> (Day) -- ^endDate
 1542  -> (DayCounter) -> (Maybe (GenQuote q2)) -- ^convexityAdjustment
 1543  -> (FuturesType) -- ^type
 1544  -> IO ((FuturesRateHelper))
 1545 futuresRateHelperBetweenDatesRaw a1 a2 a3 a4 a5 a6 =
 1546   withQuote a1 $ \a1' -> 
 1547   withDay a2 $ \a2' -> 
 1548   withDay a3 $ \a3' -> 
 1549   withDayCounter a4 $ \a4' -> 
 1550   withMaybeQuote a5 $ \a5' -> 
 1551   let {a6' = (fromIntegral . fromEnum) a6} in 
 1552   preErrorCheck $ \a7' -> 
 1553   futuresRateHelperBetweenDatesRaw'_ a1' a2' a3' a4' a5' a6' a7' >>= \res ->
 1554   peekFuturesRateHelper res >>= \res' ->
 1555   errorCheck  a7'>>
 1556   return (res')
 1557 
 1558 
 1559 
 1560 futuresIborRateHelperRaw :: (GenQuote q1) -> (Day) -- ^immDate
 1561  -> (GenIborIndex ibor) -> (Maybe (GenQuote q2)) -- ^convexityAdjustment
 1562  -> (FuturesType) -- ^type
 1563  -> IO ((FuturesRateHelper))
 1564 futuresIborRateHelperRaw a1 a2 a3 a4 a5 =
 1565   withQuote a1 $ \a1' -> 
 1566   withDay a2 $ \a2' -> 
 1567   withIborIndex a3 $ \a3' -> 
 1568   withMaybeQuote a4 $ \a4' -> 
 1569   let {a5' = (fromIntegral . fromEnum) a5} in 
 1570   preErrorCheck $ \a6' -> 
 1571   futuresIborRateHelperRaw'_ a1' a2' a3' a4' a5' a6' >>= \res ->
 1572   peekFuturesRateHelper res >>= \res' ->
 1573   errorCheck  a6'>>
 1574   return (res')
 1575 
 1576 
 1577 
 1578 futuresRateHelperRaw :: (GenQuote q1) -> (Day) -- ^immDate
 1579  -> (Word) -- ^lengthInMonths
 1580  -> (Calendar) -> (BusinessDayConvention) -> (Bool) -- ^endOfMonth
 1581  -> (DayCounter) -> (Maybe (GenQuote q2)) -- ^convexityAdjustment
 1582  -> (FuturesType) -- ^type
 1583  -> IO ((FuturesRateHelper))
 1584 futuresRateHelperRaw a1 a2 a3 a4 a5 a6 a7 a8 a9 =
 1585   withQuote a1 $ \a1' -> 
 1586   withDay a2 $ \a2' -> 
 1587   let {a3' = fromIntegral a3} in 
 1588   withCalendar a4 $ \a4' -> 
 1589   let {a5' = fromEnumC a5} in 
 1590   let {a6' = C2HSImp.fromBool a6} in 
 1591   withDayCounter a7 $ \a7' -> 
 1592   withMaybeQuote a8 $ \a8' -> 
 1593   let {a9' = (fromIntegral . fromEnum) a9} in 
 1594   preErrorCheck $ \a10' -> 
 1595   futuresRateHelperRaw'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' a10' >>= \res ->
 1596   peekFuturesRateHelper res >>= \res' ->
 1597   errorCheck  a10'>>
 1598   return (res')
 1599 
 1600 
 1601 
 1602 -- |The futures-vs-forward convexity adjustment this helper was built with (0 if none was given).
 1603 futuresRateHelperConvexityAdjustment :: (FuturesRateHelper) -> IO ((Double))
 1604 futuresRateHelperConvexityAdjustment a1 =
 1605   withGenRateHelper a1 $ \a1' -> 
 1606   preErrorCheck $ \a2' -> 
 1607   futuresRateHelperConvexityAdjustment'_ a1' a2' >>= \res ->
 1608   let {res' = realToFrac res} in
 1609   errorCheck  a2'>>
 1610   return (res')
 1611 
 1612 
 1613 
 1614 -- |Rate helper for bootstrapping over overnight-index compounding futures.
 1615 overnightIndexFutureRateHelper :: (GenQuote q1) -> (Day) -- ^valueDate
 1616  -> (Day) -- ^maturityDate
 1617  -> (OvernightIborIndex) -> (Maybe (GenQuote q2)) -- ^convexityAdjustment
 1618  -> (RateAveragingType) -- ^averagingMethod
 1619  -> (PillarChoice) -- ^pillar
 1620  -> (Maybe Day) -- ^customPillarDate
 1621  -> IO ((OvernightIndexFutureRateHelper))
 1622 overnightIndexFutureRateHelper a1 a2 a3 a4 a5 a6 a7 a8 =
 1623   withQuote a1 $ \a1' -> 
 1624   withDay a2 $ \a2' -> 
 1625   withDay a3 $ \a3' -> 
 1626   withOvernightIborIndex a4 $ \a4' -> 
 1627   withMaybeQuote a5 $ \a5' -> 
 1628   let {a6' = (fromIntegral . fromEnum) a6} in 
 1629   let {a7' = (fromIntegral . fromEnum) a7} in 
 1630   withMaybeDay a8 $ \a8' -> 
 1631   preErrorCheck $ \a9' -> 
 1632   overnightIndexFutureRateHelper'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' >>= \res ->
 1633   peekOvernightIndexFutureRateHelper res >>= \res' ->
 1634   errorCheck  a9'>>
 1635   return (res')
 1636 
 1637 
 1638 
 1639 -- |The futures-vs-forward convexity adjustment this helper was built with (0 if none was given).
 1640 overnightIndexFutureRateHelperConvexityAdjustment :: (OvernightIndexFutureRateHelper) -> IO ((Double))
 1641 overnightIndexFutureRateHelperConvexityAdjustment a1 =
 1642   withGenRateHelper a1 $ \a1' -> 
 1643   preErrorCheck $ \a2' -> 
 1644   overnightIndexFutureRateHelperConvexityAdjustment'_ a1' a2' >>= \res ->
 1645   let {res' = realToFrac res} in
 1646   errorCheck  a2'>>
 1647   return (res')
 1648 
 1649 
 1650 
 1651 -- |Every fixing this rate helper reads from the store, as @(index name, fixing date)@ pairs.  A
 1652 -- bootstrapped curve cannot be asked what it was built from -- @PiecewiseYieldCurve@ is a
 1653 -- template with no instruments accessor, and an @Observer@ does not expose the observables it
 1654 -- registered with -- so a curve's fixing dependencies are the union of its helpers', and this
 1655 -- answers for one helper.  It walks the helper's underlying instrument the way
 1656 -- 'QuantLib.CashFlow.fixingDependencies' walks a leg, and names each index by
 1657 -- 'QuantLib.Index.name', the key QuantLib\'s process-global fixing store uses.
 1658 --
 1659 -- A swap, OIS, basis-swap, BMA, multiple-resets, cross-currency or bond helper answers from its
 1660 -- underlying; an IBOR futures or FX swap helper, and a deposit or FRA relative to the evaluation
 1661 -- date, reads no stored fixing: @Just []@. A 'DepositOnFixingDate' deposit, or a 'FraBetweenDates'
 1662 -- FRA with an indexed coupon, reads its fixing once the fixing date is before the evaluation date,
 1663 -- and reports it from then on; on the fixing date itself it still forecasts.
 1664 -- An overnight-index or SOFR futures helper reports each business-day fixing from its period start
 1665 -- up to the evaluation date, that date's included because the future reads it when stored. On
 1666 -- QuantLib 1.43, which keeps the future private, it instead reports 'Nothing' from two weeks before
 1667 -- its period starts. Any helper type the walk has no case for reports 'Nothing' too: "cannot see
 1668 -- it", which is not the same as "needs nothing".
 1669 --
 1670 -- The dates follow the evaluation date, because a relative-date helper re-initialises its
 1671 -- schedule when that date moves: call this under the date whose fixings are being asked about.
 1672 -- Duplicates are not removed, the same as for a leg.
 1673 rateHelperFixingDependencies :: GenRateHelper rh -> IO (Maybe [(String, Day)])
 1674 rateHelperFixingDependencies h = do
 1675   (ns, ds, ok) <- qlRateHelperFixingDependencies h
 1676   pure $ if ok /= 0 then Just (zip ns ds) else Nothing
 1677 qlRateHelperFixingDependencies :: (GenRateHelper rh) -> IO (([String]), ([Day]), (CInt))
 1678 qlRateHelperFixingDependencies a1 =
 1679   withRateHelper a1 $ \a1' -> 
 1680   preCStringArray $ \(a2'1, a2'2) -> 
 1681   preIntArray $ \(a3'1, a3'2) -> 
 1682   alloca $ \a4' -> 
 1683   preErrorCheck $ \a5' -> 
 1684   qlRateHelperFixingDependencies'_ a1' a2'1  a2'2 a3'1  a3'2 a4' a5' >>
 1685   peekCStringArray  a2'1  a2'2>>= \a2'' -> 
 1686   peekDayArray  a3'1  a3'2>>= \a3'' -> 
 1687   peek  a4'>>= \a4'' -> 
 1688   errorCheck  a5'>>
 1689   return (a2'', a3'', a4'')
 1690 
 1691 
 1692 
 1693 -- |Rate helper for bootstrapping over CME SOFR futures. Compounds overnight SOFR from the third
 1694 -- Wednesday of 'referenceMonth'\/'referenceYear' (inclusive) to the third Wednesday of the
 1695 -- following month or quarter (exclusive), per 'referenceFreq'.
 1696 sofrFutureRateHelper :: (GenQuote q1) -> (Month) -- ^referenceMonth
 1697  -> (Int) -- ^referenceYear
 1698  -> (Frequency) -- ^referenceFreq
 1699  -> (Maybe (GenQuote q2)) -- ^convexityAdjustment
 1700  -> (PillarChoice) -- ^pillar
 1701  -> (Maybe Day) -- ^customPillarDate
 1702  -> IO ((RateHelper))
 1703 sofrFutureRateHelper a1 a2 a3 a4 a5 a6 a7 =
 1704   withQuote a1 $ \a1' -> 
 1705   let {a2' = (fromIntegral . fromEnum) a2} in 
 1706   let {a3' = fromIntegral a3} in 
 1707   let {a4' = (fromIntegral . fromEnum) a4} in 
 1708   withMaybeQuote a5 $ \a5' -> 
 1709   let {a6' = (fromIntegral . fromEnum) a6} in 
 1710   withMaybeDay a7 $ \a7' -> 
 1711   preErrorCheck $ \a8' -> 
 1712   sofrFutureRateHelper'_ a1' a2' a3' a4' a5' a6' a7' a8' >>= \res ->
 1713   peekRateHelper res >>= \res' ->
 1714   errorCheck  a8'>>
 1715   return (res')
 1716 
 1717 
 1718 
 1719 -- |The quote value implied by the current bootstrapped state of the curve the helper was
 1720 -- last used against, i.e. what the helper's own market quote would need to be to make it
 1721 -- reprice exactly.
 1722 impliedQuote :: (GenRateHelper rh) -> IO ((Double))
 1723 impliedQuote a1 =
 1724   withRateHelper a1 $ \a1' -> 
 1725   preErrorCheck $ \a2' -> 
 1726   impliedQuote'_ a1' a2' >>= \res ->
 1727   let {res' = realToFrac res} in
 1728   errorCheck  a2'>>
 1729   return (res')
 1730 
 1731 
 1732 
 1733 -- |The quote that would make the helper reprice exactly on the given curve: a par rate read with
 1734 -- the helper's own schedule and conventions on any curve, bootstrapped from it or not. The helper
 1735 -- keeps a non-owning reference to the curve until it is next used, so a bootstrap may still take
 1736 -- it afterwards.
 1737 impliedQuoteOn :: (GenRateHelper rh) -> (GenYieldTermStructure y) -> IO ((Double))
 1738 impliedQuoteOn a1 a2 =
 1739   withRateHelper a1 $ \a1' -> 
 1740   withYieldTermStructure a2 $ \a2' -> 
 1741   preErrorCheck $ \a3' -> 
 1742   impliedQuoteOn'_ a1' a2' a3' >>= \res ->
 1743   let {res' = realToFrac res} in
 1744   errorCheck  a3'>>
 1745   return (res')
 1746 
 1747 
 1748 
 1749 -- |A yield curve identical to 'baseCurve' but reporting a different reference date; observes
 1750 -- and stays linked to 'baseCurve'.
 1751 impliedTermStructure :: (GenYieldTermStructure y) -> (Day) -> IO ((YieldTermStructure))
 1752 impliedTermStructure a1 a2 =
 1753   withYieldTermStructure a1 $ \a1' -> 
 1754   withDay a2 $ \a2' -> 
 1755   preErrorCheck $ \a3' -> 
 1756   impliedTermStructure'_ a1' a2' a3' >>= \res ->
 1757   peekYieldTermStructure res >>= \res' ->
 1758   errorCheck  a3'>>
 1759   return (res')
 1760 
 1761 
 1762 
 1763 -- |A yield curve with a vector of zero-yield spreads added to 'baseCurve', interpolating
 1764 -- between the given dates with the given 'Interpolation'. Remains linked to changes in
 1765 -- 'baseCurve' or the spread quotes.
 1766 piecewiseZeroSpreadedTermStructure :: GenYieldTermStructure y
 1767   -> NonEmpty (Day, GenQuote q)  -- ^spreads
 1768   -> Compounding -> Frequency -> Interpolation -> IO YieldTermStructure
 1769 piecewiseZeroSpreadedTermStructure ts qd c f i = uncurryNested (qlPiecewiseZeroSpreadedTermStructure ts qs ds c f) (qlInterpolation i)
 1770   where (ds, qs) = unzip (toList qd)
 1771 qlPiecewiseZeroSpreadedTermStructure :: (GenYieldTermStructure y) -> ([GenQuote q]) -> ([Day]) -> (Compounding) -> (Frequency) -> (Int) -> (Int) -> (Int) -> IO ((YieldTermStructure))
 1772 qlPiecewiseZeroSpreadedTermStructure a1 a2 a3 a4 a5 a6 a7 a8 =
 1773   withYieldTermStructure a1 $ \a1' -> 
 1774   withQuoteArray a2 $ \(a2'1, a2'2) -> 
 1775   withDayArray a3 $ \(a3'1, a3'2) -> 
 1776   let {a4' = (fromIntegral . fromEnum) a4} in 
 1777   let {a5' = (fromIntegral . fromEnum) a5} in 
 1778   let {a6' = fromIntegral a6} in 
 1779   let {a7' = fromIntegral a7} in 
 1780   let {a8' = fromIntegral a8} in 
 1781   preErrorCheck $ \a9' -> 
 1782   qlPiecewiseZeroSpreadedTermStructure'_ a1' a2'1  a2'2 a3'1  a3'2 a4' a5' a6' a7' a8' a9' >>= \res ->
 1783   peekYieldTermStructure res >>= \res' ->
 1784   errorCheck  a9'>>
 1785   return (res')
 1786 
 1787 
 1788 
 1789 -- |A yield curve adding interpolated instantaneous-forward spreads to 'baseCurve', flat outside
 1790 -- the spread dates. Linked to the base curve and quotes; its max date is the earlier of the base
 1791 -- curve's and the last spread date. @LogLinear@ and @LogCubic@ throw: the spread is integrated.
 1792 piecewiseForwardSpreadedTermStructure :: GenYieldTermStructure y
 1793   -> NonEmpty (Day, GenQuote q)  -- ^spreads
 1794   -> Interpolation -> IO YieldTermStructure
 1795 piecewiseForwardSpreadedTermStructure ts qd i = uncurryNested (qlPiecewiseForwardSpreadedTermStructure ts qs ds) (qlInterpolation i)
 1796   where (ds, qs) = unzip (toList qd)
 1797 qlPiecewiseForwardSpreadedTermStructure :: (GenYieldTermStructure y) -> ([GenQuote q]) -> ([Day]) -> (Int) -> (Int) -> (Int) -> IO ((YieldTermStructure))
 1798 qlPiecewiseForwardSpreadedTermStructure a1 a2 a3 a4 a5 a6 =
 1799   withYieldTermStructure a1 $ \a1' -> 
 1800   withQuoteArray a2 $ \(a2'1, a2'2) -> 
 1801   withDayArray a3 $ \(a3'1, a3'2) -> 
 1802   let {a4' = fromIntegral a4} in 
 1803   let {a5' = fromIntegral a5} in 
 1804   let {a6' = fromIntegral a6} in 
 1805   preErrorCheck $ \a7' -> 
 1806   qlPiecewiseForwardSpreadedTermStructure'_ a1' a2'1  a2'2 a3'1  a3'2 a4' a5' a6' a7' >>= \res ->
 1807   peekYieldTermStructure res >>= \res' ->
 1808   errorCheck  a7'>>
 1809   return (res')
 1810 
 1811 
 1812 
 1813 -- |Quanto term structure, modelling the quanto effect in option pricing. Stays linked to all
 1814 -- four inputs.
 1815 quantoTermStructure :: (GenYieldTermStructure y1) -- ^underlyingDividendTS
 1816  -> (GenYieldTermStructure y2) -- ^riskFreeTS
 1817  -> (GenYieldTermStructure y3) -- ^foreignRsikFreeTS
 1818  -> (GenBlackVolTermStructure bv1) -- ^underlyingBlackVolTS
 1819  -> (Double) -- ^strike
 1820  -> (GenBlackVolTermStructure bv2) -- ^exchRateBlackVolTS
 1821  -> (Double) -- ^exchRateATMlevel
 1822  -> (Double) -- ^underlyingExchRateCorrelation
 1823  -> IO ((YieldTermStructure))
 1824 quantoTermStructure a1 a2 a3 a4 a5 a6 a7 a8 =
 1825   withYieldTermStructure a1 $ \a1' -> 
 1826   withYieldTermStructure a2 $ \a2' -> 
 1827   withYieldTermStructure a3 $ \a3' -> 
 1828   withBlackVolTermStructure a4 $ \a4' -> 
 1829   let {a5' = realToFrac a5} in 
 1830   withBlackVolTermStructure a6 $ \a6' -> 
 1831   let {a7' = realToFrac a7} in 
 1832   let {a8' = realToFrac a8} in 
 1833   preErrorCheck $ \a9' -> 
 1834   quantoTermStructure'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' >>= \res ->
 1835   peekYieldTermStructure res >>= \res' ->
 1836   errorCheck  a9'>>
 1837   return (res')
 1838 
 1839 
 1840 
 1841 -- |Blends 'originalCurve' with an ultimate forward rate beyond the last liquid point, per the
 1842 -- \"UFR\" methodology used for extrapolating long-dated (e.g. Solvency II) curves.
 1843 ultimateForwardTermStructure :: (GenYieldTermStructure y) -- ^originalCurve
 1844  -> (GenQuote q1) -- ^lastLiquidForwardRate
 1845  -> (GenQuote q2) -- ^ultimateForwardRate
 1846  -> ((Int,TimeUnit)) -- ^firstSmoothingPoint
 1847  -> (Double) -- ^alpha
 1848  -> (Maybe Int) -- ^roundingDigits
 1849  -> (Compounding) -> (Frequency) -> IO ((YieldTermStructure))
 1850 ultimateForwardTermStructure a1 a2 a3 a4 a5 a6 a7 a8 =
 1851   withYieldTermStructure a1 $ \a1' -> 
 1852   withQuote a2 $ \a2' -> 
 1853   withQuote a3 $ \a3' -> 
 1854   let {(a4'1, a4'2) = fromEnumQuantity a4} in 
 1855   let {a5' = realToFrac a5} in 
 1856   let {a6' = fromMaybeInt a6} in 
 1857   let {a7' = (fromIntegral . fromEnum) a7} in 
 1858   let {a8' = (fromIntegral . fromEnum) a8} in 
 1859   preErrorCheck $ \a9' -> 
 1860   ultimateForwardTermStructure'_ a1' a2' a3' a4'1  a4'2 a5' a6' a7' a8' a9' >>= \res ->
 1861   peekYieldTermStructure res >>= \res' ->
 1862   errorCheck  a9'>>
 1863   return (res')
 1864 
 1865 
 1866 
 1867 -- Raw iterative-bootstrap bindings used by 'piecewiseYieldCurve'.
 1868 -- Like the public iterative choice, this exposes every @IterativeBootstrap@ setting through
 1869 -- 'IterativeBootstrapOpts' instead of hardcoding upstream's defaults. Start from
 1870 -- 'defaultIterativeBootstrapOpts' and override with record-update syntax; passing it
 1871 -- unchanged is exactly 'piecewiseYieldCurve'. 'ibAccuracy'\/'ibMinValue'\/'ibMaxValue' are
 1872 -- 'Maybe' because upstream defaults them to @Null\<Real\>()@ (\"pick a sensible value per
 1873 -- pillar\"), not to a number. 'ibDontThrow' is the one to reach for when a curve fails to
 1874 -- bootstrap: it substitutes the best value found so far for a pillar that won't solve,
 1875 -- rather than throwing.
 1876 qlPiecewiseYieldCurveFull :: (Day) -> ([GenRateHelper rh]) -> (DayCounter) -> ([GenQuote q]) -> ([Day]) -> (BootstrapTrait) -> (Int) -> (Int) -> (Int) -> (Double) -> (Double) -> (Double) -> (Word) -> (Double) -> (Double) -> (Bool) -> (Word) -> (Word) -> IO ((YieldTermStructure))
 1877 qlPiecewiseYieldCurveFull a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 =
 1878   withDay a1 $ \a1' -> 
 1879   withRateHelperArray a2 $ \(a2'1, a2'2) -> 
 1880   withDayCounter a3 $ \a3' -> 
 1881   withQuoteArray a4 $ \(a4'1, a4'2) -> 
 1882   withDayArray a5 $ \(a5'1, a5'2) -> 
 1883   let {a6' = (fromIntegral . fromEnum) a6} in 
 1884   let {a7' = fromIntegral a7} in 
 1885   let {a8' = fromIntegral a8} in 
 1886   let {a9' = fromIntegral a9} in 
 1887   let {a10' = realToFrac a10} in 
 1888   let {a11' = realToFrac a11} in 
 1889   let {a12' = realToFrac a12} in 
 1890   let {a13' = fromIntegral a13} in 
 1891   let {a14' = realToFrac a14} in 
 1892   let {a15' = realToFrac a15} in 
 1893   let {a16' = C2HSImp.fromBool a16} in 
 1894   let {a17' = fromIntegral a17} in 
 1895   let {a18' = fromIntegral a18} in 
 1896   preErrorCheck $ \a19' -> 
 1897   qlPiecewiseYieldCurveFull'_ a1' a2'1  a2'2 a3' a4'1  a4'2 a5'1  a5'2 a6' a7' a8' a9' a10' a11' a12' a13' a14' a15' a16' a17' a18' a19' >>= \res ->
 1898   peekYieldTermStructure res >>= \res' ->
 1899   errorCheck  a19'>>
 1900   return (res')
 1901 
 1902 
 1903 
 1904 qlPiecewiseYieldCurveFull1 :: (Word) -> (Calendar) -> ([GenRateHelper rh]) -> (DayCounter) -> ([GenQuote q]) -> ([Day]) -> (BootstrapTrait) -> (Int) -> (Int) -> (Int) -> (Double) -> (Double) -> (Double) -> (Word) -> (Double) -> (Double) -> (Bool) -> (Word) -> (Word) -> (Bool) -> IO ((YieldTermStructure))
 1905 qlPiecewiseYieldCurveFull1 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 a19 a20 =
 1906   let {a1' = fromIntegral a1} in 
 1907   withCalendar a2 $ \a2' -> 
 1908   withRateHelperArray a3 $ \(a3'1, a3'2) -> 
 1909   withDayCounter a4 $ \a4' -> 
 1910   withQuoteArray a5 $ \(a5'1, a5'2) -> 
 1911   withDayArray a6 $ \(a6'1, a6'2) -> 
 1912   let {a7' = (fromIntegral . fromEnum) a7} in 
 1913   let {a8' = fromIntegral a8} in 
 1914   let {a9' = fromIntegral a9} in 
 1915   let {a10' = fromIntegral a10} in 
 1916   let {a11' = realToFrac a11} in 
 1917   let {a12' = realToFrac a12} in 
 1918   let {a13' = realToFrac a13} in 
 1919   let {a14' = fromIntegral a14} in 
 1920   let {a15' = realToFrac a15} in 
 1921   let {a16' = realToFrac a16} in 
 1922   let {a17' = C2HSImp.fromBool a17} in 
 1923   let {a18' = fromIntegral a18} in 
 1924   let {a19' = fromIntegral a19} in 
 1925   let {a20' = C2HSImp.fromBool a20} in 
 1926   preErrorCheck $ \a21' -> 
 1927   qlPiecewiseYieldCurveFull1'_ a1' a2' a3'1  a3'2 a4' a5'1  a5'2 a6'1  a6'2 a7' a8' a9' a10' a11' a12' a13' a14' a15' a16' a17' a18' a19' a20' a21' >>= \res ->
 1928   peekYieldTermStructure res >>= \res' ->
 1929   errorCheck  a21'>>
 1930   return (res')
 1931 
 1932 
 1933 
 1934 -- Raw moving-curve bindings used by 'piecewiseYieldCurve'.
 1935 qlPiecewiseYieldCurveGlobalBootstrap1 :: (Word) -> (Calendar) -> ([GenRateHelper rh]) -> (DayCounter) -> ([GenQuote q]) -> ([Day]) -> (Double) -> ([Double]) -> (Bool) -> (Maybe BootstrapInitialGuess) -> IO ((YieldTermStructure))
 1936 qlPiecewiseYieldCurveGlobalBootstrap1 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 =
 1937   let {a1' = fromIntegral a1} in 
 1938   withCalendar a2 $ \a2' -> 
 1939   withRateHelperArray a3 $ \(a3'1, a3'2) -> 
 1940   withDayCounter a4 $ \a4' -> 
 1941   withQuoteArray a5 $ \(a5'1, a5'2) -> 
 1942   withDayArray a6 $ \(a6'1, a6'2) -> 
 1943   let {a7' = realToFrac a7} in 
 1944   withDoubleArray a8 $ \(a8'1, a8'2) -> 
 1945   let {a9' = C2HSImp.fromBool a9} in 
 1946   withMaybeBootstrapInitialGuess a10 $ \a10' -> 
 1947   preErrorCheck $ \a11' -> 
 1948   qlPiecewiseYieldCurveGlobalBootstrap1'_ a1' a2' a3'1  a3'2 a4' a5'1  a5'2 a6'1  a6'2 a7' a8'1  a8'2 a9' a10' a11' >>= \res ->
 1949   peekYieldTermStructure res >>= \res' ->
 1950   errorCheck  a11'>>
 1951   return (res')
 1952 
 1953 
 1954 
 1955 qlPiecewiseYieldCurveGlobalBootstrap2 :: (Word) -> (Calendar) -> ([GenRateHelper rh]) -> (DayCounter) -> ([GenQuote q]) -> ([Day]) -> (Double) -> ([Double]) -> (Bool) -> (Maybe BootstrapInitialGuess) -> IO ((YieldTermStructure))
 1956 qlPiecewiseYieldCurveGlobalBootstrap2 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 =
 1957   let {a1' = fromIntegral a1} in 
 1958   withCalendar a2 $ \a2' -> 
 1959   withRateHelperArray a3 $ \(a3'1, a3'2) -> 
 1960   withDayCounter a4 $ \a4' -> 
 1961   withQuoteArray a5 $ \(a5'1, a5'2) -> 
 1962   withDayArray a6 $ \(a6'1, a6'2) -> 
 1963   let {a7' = realToFrac a7} in 
 1964   withDoubleArray a8 $ \(a8'1, a8'2) -> 
 1965   let {a9' = C2HSImp.fromBool a9} in 
 1966   withMaybeBootstrapInitialGuess a10 $ \a10' -> 
 1967   preErrorCheck $ \a11' -> 
 1968   qlPiecewiseYieldCurveGlobalBootstrap2'_ a1' a2' a3'1  a3'2 a4' a5'1  a5'2 a6'1  a6'2 a7' a8'1  a8'2 a9' a10' a11' >>= \res ->
 1969   peekYieldTermStructure res >>= \res' ->
 1970   errorCheck  a11'>>
 1971   return (res')
 1972 
 1973 
 1974 
 1975 qlPiecewiseYieldCurveGlobalBootstrap3 :: (Word) -> (Calendar) -> ([GenRateHelper rh1]) -> (DayCounter) -> ([GenQuote q]) -> ([Day]) -> ([GenRateHelper rh2]) -> ([Day]) -> (Double) -> (Bool) -> ([Double]) -> (Maybe BootstrapInitialGuess) -> IO ((YieldTermStructure))
 1976 qlPiecewiseYieldCurveGlobalBootstrap3 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 =
 1977   let {a1' = fromIntegral a1} in 
 1978   withCalendar a2 $ \a2' -> 
 1979   withRateHelperArray a3 $ \(a3'1, a3'2) -> 
 1980   withDayCounter a4 $ \a4' -> 
 1981   withQuoteArray a5 $ \(a5'1, a5'2) -> 
 1982   withDayArray a6 $ \(a6'1, a6'2) -> 
 1983   withRateHelperArray a7 $ \(a7'1, a7'2) -> 
 1984   withDayArray a8 $ \(a8'1, a8'2) -> 
 1985   let {a9' = realToFrac a9} in 
 1986   let {a10' = C2HSImp.fromBool a10} in 
 1987   withDoubleArray a11 $ \(a11'1, a11'2) -> 
 1988   withMaybeBootstrapInitialGuess a12 $ \a12' -> 
 1989   preErrorCheck $ \a13' -> 
 1990   qlPiecewiseYieldCurveGlobalBootstrap3'_ a1' a2' a3'1  a3'2 a4' a5'1  a5'2 a6'1  a6'2 a7'1  a7'2 a8'1  a8'2 a9' a10' a11'1  a11'2 a12' a13' >>= \res ->
 1991   peekYieldTermStructure res >>= \res' ->
 1992   errorCheck  a13'>>
 1993   return (res')
 1994 
 1995 
 1996 
 1997 qlPiecewiseYieldCurveGlobalBootstrap4 :: (Word) -> (Calendar) -> ([GenRateHelper rh]) -> (DayCounter) -> ([GenQuote q]) -> ([Day]) -> (Double) -> ([Double]) -> (Bool) -> (Maybe BootstrapInitialGuess) -> IO ((YieldTermStructure))
 1998 qlPiecewiseYieldCurveGlobalBootstrap4 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 =
 1999   let {a1' = fromIntegral a1} in 
 2000   withCalendar a2 $ \a2' -> 
 2001   withRateHelperArray a3 $ \(a3'1, a3'2) -> 
 2002   withDayCounter a4 $ \a4' -> 
 2003   withQuoteArray a5 $ \(a5'1, a5'2) -> 
 2004   withDayArray a6 $ \(a6'1, a6'2) -> 
 2005   let {a7' = realToFrac a7} in 
 2006   withDoubleArray a8 $ \(a8'1, a8'2) -> 
 2007   let {a9' = C2HSImp.fromBool a9} in 
 2008   withMaybeBootstrapInitialGuess a10 $ \a10' -> 
 2009   preErrorCheck $ \a11' -> 
 2010   qlPiecewiseYieldCurveGlobalBootstrap4'_ a1' a2' a3'1  a3'2 a4' a5'1  a5'2 a6'1  a6'2 a7' a8'1  a8'2 a9' a10' a11' >>= \res ->
 2011   peekYieldTermStructure res >>= \res' ->
 2012   errorCheck  a11'>>
 2013   return (res')
 2014 
 2015 
 2016 
 2017 qlPiecewiseYieldCurveGlobalBootstrap5 :: (Word) -> (Calendar) -> ([GenRateHelper rh]) -> (DayCounter) -> ([GenQuote q]) -> ([Day]) -> (Double) -> ([Double]) -> (Bool) -> (Maybe BootstrapInitialGuess) -> IO ((YieldTermStructure))
 2018 qlPiecewiseYieldCurveGlobalBootstrap5 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 =
 2019   let {a1' = fromIntegral a1} in 
 2020   withCalendar a2 $ \a2' -> 
 2021   withRateHelperArray a3 $ \(a3'1, a3'2) -> 
 2022   withDayCounter a4 $ \a4' -> 
 2023   withQuoteArray a5 $ \(a5'1, a5'2) -> 
 2024   withDayArray a6 $ \(a6'1, a6'2) -> 
 2025   let {a7' = realToFrac a7} in 
 2026   withDoubleArray a8 $ \(a8'1, a8'2) -> 
 2027   let {a9' = C2HSImp.fromBool a9} in 
 2028   withMaybeBootstrapInitialGuess a10 $ \a10' -> 
 2029   preErrorCheck $ \a11' -> 
 2030   qlPiecewiseYieldCurveGlobalBootstrap5'_ a1' a2' a3'1  a3'2 a4' a5'1  a5'2 a6'1  a6'2 a7' a8'1  a8'2 a9' a10' a11' >>= \res ->
 2031   peekYieldTermStructure res >>= \res' ->
 2032   errorCheck  a11'>>
 2033   return (res')
 2034 
 2035 
 2036 
 2037 qlPiecewiseYieldCurveLocalBootstrap1 :: (Word) -> (Calendar) -> ([GenRateHelper rh]) -> (DayCounter) -> ([GenQuote q]) -> ([Day]) -> (BootstrapTrait) -> (Word) -> (Bool) -> (Double) -> (Double) -> (Double) -> (Bool) -> (Bool) -> IO ((YieldTermStructure))
 2038 qlPiecewiseYieldCurveLocalBootstrap1 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 =
 2039   let {a1' = fromIntegral a1} in 
 2040   withCalendar a2 $ \a2' -> 
 2041   withRateHelperArray a3 $ \(a3'1, a3'2) -> 
 2042   withDayCounter a4 $ \a4' -> 
 2043   withQuoteArray a5 $ \(a5'1, a5'2) -> 
 2044   withDayArray a6 $ \(a6'1, a6'2) -> 
 2045   let {a7' = (fromIntegral . fromEnum) a7} in 
 2046   let {a8' = fromIntegral a8} in 
 2047   let {a9' = C2HSImp.fromBool a9} in 
 2048   let {a10' = realToFrac a10} in 
 2049   let {a11' = realToFrac a11} in 
 2050   let {a12' = realToFrac a12} in 
 2051   let {a13' = C2HSImp.fromBool a13} in 
 2052   let {a14' = C2HSImp.fromBool a14} in 
 2053   preErrorCheck $ \a15' -> 
 2054   qlPiecewiseYieldCurveLocalBootstrap1'_ a1' a2' a3'1  a3'2 a4' a5'1  a5'2 a6'1  a6'2 a7' a8' a9' a10' a11' a12' a13' a14' a15' >>= \res ->
 2055   peekYieldTermStructure res >>= \res' ->
 2056   errorCheck  a15'>>
 2057   return (res')
 2058 
 2059 
 2060 
 2061 -- Raw fixed-curve bindings for the non-iterative bootstrap choices.
 2062 qlPiecewiseYieldCurveGlobalBootstrapFixed1 :: (Day) -> ([GenRateHelper rh]) -> (DayCounter) -> ([GenQuote q]) -> ([Day]) -> (Double) -> ([Double]) -> (Bool) -> (Maybe BootstrapInitialGuess) -> IO ((YieldTermStructure))
 2063 qlPiecewiseYieldCurveGlobalBootstrapFixed1 a1 a2 a3 a4 a5 a6 a7 a8 a9 =
 2064   withDay a1 $ \a1' -> 
 2065   withRateHelperArray a2 $ \(a2'1, a2'2) -> 
 2066   withDayCounter a3 $ \a3' -> 
 2067   withQuoteArray a4 $ \(a4'1, a4'2) -> 
 2068   withDayArray a5 $ \(a5'1, a5'2) -> 
 2069   let {a6' = realToFrac a6} in 
 2070   withDoubleArray a7 $ \(a7'1, a7'2) -> 
 2071   let {a8' = C2HSImp.fromBool a8} in 
 2072   withMaybeBootstrapInitialGuess a9 $ \a9' -> 
 2073   preErrorCheck $ \a10' -> 
 2074   qlPiecewiseYieldCurveGlobalBootstrapFixed1'_ a1' a2'1  a2'2 a3' a4'1  a4'2 a5'1  a5'2 a6' a7'1  a7'2 a8' a9' a10' >>= \res ->
 2075   peekYieldTermStructure res >>= \res' ->
 2076   errorCheck  a10'>>
 2077   return (res')
 2078 
 2079 
 2080 qlPiecewiseYieldCurveGlobalBootstrapFixed2 :: (Day) -> ([GenRateHelper rh]) -> (DayCounter) -> ([GenQuote q]) -> ([Day]) -> (Double) -> ([Double]) -> (Bool) -> (Maybe BootstrapInitialGuess) -> IO ((YieldTermStructure))
 2081 qlPiecewiseYieldCurveGlobalBootstrapFixed2 a1 a2 a3 a4 a5 a6 a7 a8 a9 =
 2082   withDay a1 $ \a1' -> 
 2083   withRateHelperArray a2 $ \(a2'1, a2'2) -> 
 2084   withDayCounter a3 $ \a3' -> 
 2085   withQuoteArray a4 $ \(a4'1, a4'2) -> 
 2086   withDayArray a5 $ \(a5'1, a5'2) -> 
 2087   let {a6' = realToFrac a6} in 
 2088   withDoubleArray a7 $ \(a7'1, a7'2) -> 
 2089   let {a8' = C2HSImp.fromBool a8} in 
 2090   withMaybeBootstrapInitialGuess a9 $ \a9' -> 
 2091   preErrorCheck $ \a10' -> 
 2092   qlPiecewiseYieldCurveGlobalBootstrapFixed2'_ a1' a2'1  a2'2 a3' a4'1  a4'2 a5'1  a5'2 a6' a7'1  a7'2 a8' a9' a10' >>= \res ->
 2093   peekYieldTermStructure res >>= \res' ->
 2094   errorCheck  a10'>>
 2095   return (res')
 2096 
 2097 
 2098 qlPiecewiseYieldCurveGlobalBootstrapFixed3 :: (Day) -> ([GenRateHelper rh1]) -> (DayCounter) -> ([GenQuote q]) -> ([Day]) -> ([GenRateHelper rh2]) -> ([Day]) -> (Double) -> (Bool) -> ([Double]) -> (Maybe BootstrapInitialGuess) -> IO ((YieldTermStructure))
 2099 qlPiecewiseYieldCurveGlobalBootstrapFixed3 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 =
 2100   withDay a1 $ \a1' -> 
 2101   withRateHelperArray a2 $ \(a2'1, a2'2) -> 
 2102   withDayCounter a3 $ \a3' -> 
 2103   withQuoteArray a4 $ \(a4'1, a4'2) -> 
 2104   withDayArray a5 $ \(a5'1, a5'2) -> 
 2105   withRateHelperArray a6 $ \(a6'1, a6'2) -> 
 2106   withDayArray a7 $ \(a7'1, a7'2) -> 
 2107   let {a8' = realToFrac a8} in 
 2108   let {a9' = C2HSImp.fromBool a9} in 
 2109   withDoubleArray a10 $ \(a10'1, a10'2) -> 
 2110   withMaybeBootstrapInitialGuess a11 $ \a11' -> 
 2111   preErrorCheck $ \a12' -> 
 2112   qlPiecewiseYieldCurveGlobalBootstrapFixed3'_ a1' a2'1  a2'2 a3' a4'1  a4'2 a5'1  a5'2 a6'1  a6'2 a7'1  a7'2 a8' a9' a10'1  a10'2 a11' a12' >>= \res ->
 2113   peekYieldTermStructure res >>= \res' ->
 2114   errorCheck  a12'>>
 2115   return (res')
 2116 
 2117 
 2118 qlPiecewiseYieldCurveGlobalBootstrapFixed4 :: (Day) -> ([GenRateHelper rh]) -> (DayCounter) -> ([GenQuote q]) -> ([Day]) -> (Double) -> ([Double]) -> (Bool) -> (Maybe BootstrapInitialGuess) -> IO ((YieldTermStructure))
 2119 qlPiecewiseYieldCurveGlobalBootstrapFixed4 a1 a2 a3 a4 a5 a6 a7 a8 a9 =
 2120   withDay a1 $ \a1' -> 
 2121   withRateHelperArray a2 $ \(a2'1, a2'2) -> 
 2122   withDayCounter a3 $ \a3' -> 
 2123   withQuoteArray a4 $ \(a4'1, a4'2) -> 
 2124   withDayArray a5 $ \(a5'1, a5'2) -> 
 2125   let {a6' = realToFrac a6} in 
 2126   withDoubleArray a7 $ \(a7'1, a7'2) -> 
 2127   let {a8' = C2HSImp.fromBool a8} in 
 2128   withMaybeBootstrapInitialGuess a9 $ \a9' -> 
 2129   preErrorCheck $ \a10' -> 
 2130   qlPiecewiseYieldCurveGlobalBootstrapFixed4'_ a1' a2'1  a2'2 a3' a4'1  a4'2 a5'1  a5'2 a6' a7'1  a7'2 a8' a9' a10' >>= \res ->
 2131   peekYieldTermStructure res >>= \res' ->
 2132   errorCheck  a10'>>
 2133   return (res')
 2134 
 2135 
 2136 qlPiecewiseYieldCurveGlobalBootstrapFixed5 :: (Day) -> ([GenRateHelper rh]) -> (DayCounter) -> ([GenQuote q]) -> ([Day]) -> (Double) -> ([Double]) -> (Bool) -> (Maybe BootstrapInitialGuess) -> IO ((YieldTermStructure))
 2137 qlPiecewiseYieldCurveGlobalBootstrapFixed5 a1 a2 a3 a4 a5 a6 a7 a8 a9 =
 2138   withDay a1 $ \a1' -> 
 2139   withRateHelperArray a2 $ \(a2'1, a2'2) -> 
 2140   withDayCounter a3 $ \a3' -> 
 2141   withQuoteArray a4 $ \(a4'1, a4'2) -> 
 2142   withDayArray a5 $ \(a5'1, a5'2) -> 
 2143   let {a6' = realToFrac a6} in 
 2144   withDoubleArray a7 $ \(a7'1, a7'2) -> 
 2145   let {a8' = C2HSImp.fromBool a8} in 
 2146   withMaybeBootstrapInitialGuess a9 $ \a9' -> 
 2147   preErrorCheck $ \a10' -> 
 2148   qlPiecewiseYieldCurveGlobalBootstrapFixed5'_ a1' a2'1  a2'2 a3' a4'1  a4'2 a5'1  a5'2 a6' a7'1  a7'2 a8' a9' a10' >>= \res ->
 2149   peekYieldTermStructure res >>= \res' ->
 2150   errorCheck  a10'>>
 2151   return (res')
 2152 
 2153 
 2154 qlPiecewiseYieldCurveLocalBootstrapFixed :: (Day) -> ([GenRateHelper rh]) -> (DayCounter) -> ([GenQuote q]) -> ([Day]) -> (BootstrapTrait) -> (Word) -> (Bool) -> (Double) -> (Double) -> (Double) -> (Bool) -> (Bool) -> IO ((YieldTermStructure))
 2155 qlPiecewiseYieldCurveLocalBootstrapFixed a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 =
 2156   withDay a1 $ \a1' -> 
 2157   withRateHelperArray a2 $ \(a2'1, a2'2) -> 
 2158   withDayCounter a3 $ \a3' -> 
 2159   withQuoteArray a4 $ \(a4'1, a4'2) -> 
 2160   withDayArray a5 $ \(a5'1, a5'2) -> 
 2161   let {a6' = (fromIntegral . fromEnum) a6} in 
 2162   let {a7' = fromIntegral a7} in 
 2163   let {a8' = C2HSImp.fromBool a8} in 
 2164   let {a9' = realToFrac a9} in 
 2165   let {a10' = realToFrac a10} in 
 2166   let {a11' = realToFrac a11} in 
 2167   let {a12' = C2HSImp.fromBool a12} in 
 2168   let {a13' = C2HSImp.fromBool a13} in 
 2169   preErrorCheck $ \a14' -> 
 2170   qlPiecewiseYieldCurveLocalBootstrapFixed'_ a1' a2'1  a2'2 a3' a4'1  a4'2 a5'1  a5'2 a6' a7' a8' a9' a10' a11' a12' a13' a14' >>= \res ->
 2171   peekYieldTermStructure res >>= \res' ->
 2172   errorCheck  a14'>>
 2173   return (res')
 2174 
 2175 
 2176 
 2177 -- |Selects the bootstrapper used by 'piecewiseYieldCurve' and carries exactly the
 2178 -- parameters valid for that choice. 'Iterative' uses the selected trait, interpolation, and
 2179 -- full iterative settings. The @Global*@ constructors solve all instruments together; their
 2180 -- list field contains instrument weights, with an empty list selecting equal weights.
 2181 -- 'GlobalSimpleZeroLinearFull' additionally takes helper instruments, their interpolation
 2182 -- dates (exactly two fewer than the helpers), and accuracy. 'Local' uses @ConvexMonotone@
 2183 -- interpolation and restricts the trait to 'LocalBootstrapTrait', because @Discount@ produces
 2184 -- invalid results with QuantLib's local bootstrapper.
 2185 data Bootstrap rh2
 2186   = Iterative !BootstrapTrait !Interpolation !IterativeBootstrapOpts
 2187   | GlobalDiscountLogLinear !Double ![Double] !(Maybe BootstrapInitialGuess) -- ^accuracy, instrumentWeights (empty for equal weights), initialGuess
 2188   | GlobalSimpleZeroLinear !Double ![Double] !(Maybe BootstrapInitialGuess) -- ^accuracy, instrumentWeights (empty for equal weights), initialGuess
 2189   | GlobalSimpleZeroLinearFull !(NonEmpty (GenRateHelper rh2)) ![Day] !Double ![Double] !(Maybe BootstrapInitialGuess) -- ^additionalHelpers, additionalDates, accuracy, instrumentWeights, initialGuess
 2190   | GlobalForwardRateLinear !Double ![Double] !(Maybe BootstrapInitialGuess) -- ^accuracy, instrumentWeights (empty for equal weights), initialGuess
 2191   | GlobalZeroYieldLinear !Double ![Double] !(Maybe BootstrapInitialGuess) -- ^accuracy, instrumentWeights (empty for equal weights), initialGuess
 2192   | Local !LocalBootstrapTrait !Word !Bool !Double !Double !Double !Bool
 2193     -- ^trait, localisation, forcePositive (LocalBootstrap's), accuracy, quadraticity, monotonicity, convexForcePositive (ConvexMonotone's)
 2194 
 2195 -- |Bootstrap traits that are numerically usable with @LocalBootstrap@ and
 2196 -- @ConvexMonotone@. @Discount@ is intentionally unrepresentable.
 2197 data LocalBootstrapTrait = LForwardRate | LZeroYield | LSimpleZeroYield
 2198   deriving (Show, Eq, Read)
 2199 
 2200 fromBootstrapTrait :: LocalBootstrapTrait -> BootstrapTrait
 2201 fromBootstrapTrait LForwardRate = ForwardRate
 2202 fromBootstrapTrait LZeroYield = ZeroYield
 2203 fromBootstrapTrait LSimpleZeroYield = SimpleZeroYield
 2204 
 2205 -- |Bootstrapper for 'piecewiseSpreadYieldCurve', whose nodes are always discount-factor spreads.
 2206 -- @LogLinear@ interpolation gives piecewise-constant forward spreads, upstream's canonical choice.
 2207 data SpreadBootstrap
 2208   = SpreadIterative !Interpolation !IterativeBootstrapOpts
 2209   | SpreadGlobalLogLinear !Double ![Double] !(Maybe BootstrapInitialGuess) -- ^accuracy, instrumentWeights (empty for equal weights), initialGuess
 2210 
 2211 -- |Bootstraps a term structure with either a fixed or evaluation-date-relative reference point.
 2212 -- 'Bootstrap' selects iterative, global, or local construction; the final flag controls
 2213 -- extrapolation past the curve's maximum date.
 2214 piecewiseYieldCurve :: Reference
 2215   -> NonEmpty (GenRateHelper rh) -- ^instruments
 2216   -> DayCounter -- ^dayCounter
 2217   -> [(Day, GenQuote q)] -- ^jumps
 2218   -> Bootstrap rh2 -- ^bootstrapper choice
 2219   -> Bool -- ^extrapolate past the curve's max date
 2220   -> IO YieldTermStructure
 2221 piecewiseYieldCurve reference r dc qd bootstrap ex = case (reference, bootstrap) of
 2222   (ReferenceDate d, Iterative t i b) -> enable ex $ uncurryNested (qlPiecewiseYieldCurveFull d rs dc qs ds t) (qlInterpolation i)
 2223     (nullableDouble (ibAccuracy b)) (nullableDouble (ibMinValue b)) (nullableDouble (ibMaxValue b))
 2224     (ibMaxAttempts b) (ibMaxFactor b) (ibMinFactor b) (ibDontThrow b) (ibDontThrowSteps b) (ibMaxEvaluations b)
 2225   (SettlementDays s cal, Iterative t i b) -> uncurryNested (qlPiecewiseYieldCurveFull1 s cal rs dc qs ds t) (qlInterpolation i)
 2226     (nullableDouble (ibAccuracy b)) (nullableDouble (ibMinValue b)) (nullableDouble (ibMaxValue b))
 2227     (ibMaxAttempts b) (ibMaxFactor b) (ibMinFactor b) (ibDontThrow b) (ibDontThrowSteps b) (ibMaxEvaluations b) ex
 2228   (ReferenceDate d, GlobalDiscountLogLinear acc w guess) -> qlPiecewiseYieldCurveGlobalBootstrapFixed1 d rs dc qs ds acc w ex guess
 2229   (SettlementDays s cal, GlobalDiscountLogLinear acc w guess) -> qlPiecewiseYieldCurveGlobalBootstrap1 s cal rs dc qs ds acc w ex guess
 2230   (ReferenceDate d, GlobalSimpleZeroLinear acc w guess) -> qlPiecewiseYieldCurveGlobalBootstrapFixed2 d rs dc qs ds acc w ex guess
 2231   (SettlementDays s cal, GlobalSimpleZeroLinear acc w guess) -> qlPiecewiseYieldCurveGlobalBootstrap2 s cal rs dc qs ds acc w ex guess
 2232   (ReferenceDate d, GlobalSimpleZeroLinearFull ah ad acc w guess) -> qlPiecewiseYieldCurveGlobalBootstrapFixed3 d rs dc qs ds (toList ah) ad acc ex w guess
 2233   (SettlementDays s cal, GlobalSimpleZeroLinearFull ah ad acc w guess) -> qlPiecewiseYieldCurveGlobalBootstrap3 s cal rs dc qs ds (toList ah) ad acc ex w guess
 2234   (ReferenceDate d, GlobalForwardRateLinear acc w guess) -> qlPiecewiseYieldCurveGlobalBootstrapFixed4 d rs dc qs ds acc w ex guess
 2235   (SettlementDays s cal, GlobalForwardRateLinear acc w guess) -> qlPiecewiseYieldCurveGlobalBootstrap4 s cal rs dc qs ds acc w ex guess
 2236   (ReferenceDate d, GlobalZeroYieldLinear acc w guess) -> qlPiecewiseYieldCurveGlobalBootstrapFixed5 d rs dc qs ds acc w ex guess
 2237   (SettlementDays s cal, GlobalZeroYieldLinear acc w guess) -> qlPiecewiseYieldCurveGlobalBootstrap5 s cal rs dc qs ds acc w ex guess
 2238   (ReferenceDate d, Local t loc fp acc q m cfp) -> qlPiecewiseYieldCurveLocalBootstrapFixed d rs dc qs ds (fromBootstrapTrait t) loc fp acc q m cfp ex
 2239   (SettlementDays s cal, Local t loc fp acc q m cfp) -> qlPiecewiseYieldCurveLocalBootstrap1 s cal rs dc qs ds (fromBootstrapTrait t) loc fp acc q m cfp ex
 2240   where (ds, qs) = unzip qd
 2241         rs = toList r
 2242         enable False action = action
 2243         enable True action = do
 2244           curve <- action
 2245           setExtrapolation curve True
 2246           pure curve
 2247 
 2248 -- |Bootstraps multiplicative discount-factor spreads over 'baseCurve' so that each instrument
 2249 -- reprices on the combined curve. Reference date, calendar and day counter come from the linked
 2250 -- base curve; past the last node the forward spread stays flat.
 2251 piecewiseSpreadYieldCurve :: GenYieldTermStructure y -- ^baseCurve
 2252   -> NonEmpty (GenRateHelper rh) -- ^instruments
 2253   -> SpreadBootstrap -- ^bootstrapper choice
 2254   -> Bool -- ^extrapolate past the curve's max date
 2255   -> IO YieldTermStructure
 2256 piecewiseSpreadYieldCurve base r bootstrap ex = case bootstrap of
 2257   SpreadIterative i b -> uncurryNested (qlPiecewiseSpreadYieldCurve base rs) (qlInterpolation i)
 2258     (nullableDouble (ibAccuracy b)) (nullableDouble (ibMinValue b)) (nullableDouble (ibMaxValue b))
 2259     (ibMaxAttempts b) (ibMaxFactor b) (ibMinFactor b) (ibDontThrow b) (ibDontThrowSteps b) (ibMaxEvaluations b) ex
 2260   SpreadGlobalLogLinear acc w guess -> qlPiecewiseSpreadYieldCurveGlobalBootstrap base rs acc w ex guess
 2261   where rs = toList r
 2262 qlPiecewiseSpreadYieldCurve :: (GenYieldTermStructure y) -> ([GenRateHelper rh]) -> (Int) -> (Int) -> (Int) -> (Double) -> (Double) -> (Double) -> (Word) -> (Double) -> (Double) -> (Bool) -> (Word) -> (Word) -> (Bool) -> IO ((YieldTermStructure))
 2263 qlPiecewiseSpreadYieldCurve a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 =
 2264   withYieldTermStructure a1 $ \a1' -> 
 2265   withRateHelperArray a2 $ \(a2'1, a2'2) -> 
 2266   let {a3' = fromIntegral a3} in 
 2267   let {a4' = fromIntegral a4} in 
 2268   let {a5' = fromIntegral a5} in 
 2269   let {a6' = realToFrac a6} in 
 2270   let {a7' = realToFrac a7} in 
 2271   let {a8' = realToFrac a8} in 
 2272   let {a9' = fromIntegral a9} in 
 2273   let {a10' = realToFrac a10} in 
 2274   let {a11' = realToFrac a11} in 
 2275   let {a12' = C2HSImp.fromBool a12} in 
 2276   let {a13' = fromIntegral a13} in 
 2277   let {a14' = fromIntegral a14} in 
 2278   let {a15' = C2HSImp.fromBool a15} in 
 2279   preErrorCheck $ \a16' -> 
 2280   qlPiecewiseSpreadYieldCurve'_ a1' a2'1  a2'2 a3' a4' a5' a6' a7' a8' a9' a10' a11' a12' a13' a14' a15' a16' >>= \res ->
 2281   peekYieldTermStructure res >>= \res' ->
 2282   errorCheck  a16'>>
 2283   return (res')
 2284 
 2285 
 2286 
 2287 qlPiecewiseSpreadYieldCurveGlobalBootstrap :: (GenYieldTermStructure y) -> ([GenRateHelper rh]) -> (Double) -> ([Double]) -> (Bool) -> (Maybe BootstrapInitialGuess) -> IO ((YieldTermStructure))
 2288 qlPiecewiseSpreadYieldCurveGlobalBootstrap a1 a2 a3 a4 a5 a6 =
 2289   withYieldTermStructure a1 $ \a1' -> 
 2290   withRateHelperArray a2 $ \(a2'1, a2'2) -> 
 2291   let {a3' = realToFrac a3} in 
 2292   withDoubleArray a4 $ \(a4'1, a4'2) -> 
 2293   let {a5' = C2HSImp.fromBool a5} in 
 2294   withMaybeBootstrapInitialGuess a6 $ \a6' -> 
 2295   preErrorCheck $ \a7' -> 
 2296   qlPiecewiseSpreadYieldCurveGlobalBootstrap'_ a1' a2'1  a2'2 a3' a4'1  a4'2 a5' a6' a7' >>= \res ->
 2297   peekYieldTermStructure res >>= \res' ->
 2298   errorCheck  a7'>>
 2299   return (res')
 2300 
 2301 
 2302 
 2303 -- |Yield curve interpolating discount factors directly between the given dates.
 2304 interpolatedDiscountCurve :: NonEmpty (Day, Double) -- ^dates, dfs
 2305   -> DayCounter -- ^dayCounter
 2306   -> Calendar -- ^cal
 2307   -> [(Day, GenQuote q)] -- ^jumps
 2308   -> Interpolation -- ^interpolator
 2309   -> Bool -- ^extrapolate past the curve's max date
 2310   -> IO YieldTermStructure
 2311 interpolatedDiscountCurve r dc c qd i ex = uncurryNested (qlInterpolatedDiscountCurve rs rd dc c qs ds) (qlInterpolation i) ex
 2312   where (rd, rs) = unzip (toList r)
 2313         (ds, qs) = unzip qd
 2314 qlInterpolatedDiscountCurve :: ([Double]) -> ([Day]) -> (DayCounter) -> (Calendar) -> ([GenQuote q]) -> ([Day]) -> (Int) -> (Int) -> (Int) -> (Bool) -> IO ((YieldTermStructure))
 2315 qlInterpolatedDiscountCurve a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 =
 2316   withDoubleArray a1 $ \(a1'1, a1'2) -> 
 2317   withDayArray a2 $ \(a2'1, a2'2) -> 
 2318   withDayCounter a3 $ \a3' -> 
 2319   withCalendar a4 $ \a4' -> 
 2320   withQuoteArray a5 $ \(a5'1, a5'2) -> 
 2321   withDayArray a6 $ \(a6'1, a6'2) -> 
 2322   let {a7' = fromIntegral a7} in 
 2323   let {a8' = fromIntegral a8} in 
 2324   let {a9' = fromIntegral a9} in 
 2325   let {a10' = C2HSImp.fromBool a10} in 
 2326   preErrorCheck $ \a11' -> 
 2327   qlInterpolatedDiscountCurve'_ a1'1  a1'2 a2'1  a2'2 a3' a4' a5'1  a5'2 a6'1  a6'2 a7' a8' a9' a10' a11' >>= \res ->
 2328   peekYieldTermStructure res >>= \res' ->
 2329   errorCheck  a11'>>
 2330   return (res')
 2331 
 2332 
 2333 
 2334 -- |Yield curve interpolating instantaneous forward rates directly between the given dates.
 2335 interpolatedForwardCurve :: NonEmpty (Day, Double) -- ^dates, forwards
 2336   -> DayCounter -- ^dayCounter
 2337   -> Calendar -- ^cal
 2338   -> [(Day, GenQuote q)] -- ^jumps
 2339   -> Interpolation -- ^interpolator
 2340   -> IO YieldTermStructure
 2341 interpolatedForwardCurve r dc c qd i = uncurryNested (qlInterpolatedForwardCurve rs rd dc c qs ds) (qlInterpolation i) where {(rd, rs) = unzip (toList r); (ds, qs) = unzip qd}
 2342 qlInterpolatedForwardCurve :: ([Double]) -> ([Day]) -> (DayCounter) -> (Calendar) -> ([GenQuote q]) -> ([Day]) -> (Int) -> (Int) -> (Int) -> IO ((YieldTermStructure))
 2343 qlInterpolatedForwardCurve a1 a2 a3 a4 a5 a6 a7 a8 a9 =
 2344   withDoubleArray a1 $ \(a1'1, a1'2) -> 
 2345   withDayArray a2 $ \(a2'1, a2'2) -> 
 2346   withDayCounter a3 $ \a3' -> 
 2347   withCalendar a4 $ \a4' -> 
 2348   withQuoteArray a5 $ \(a5'1, a5'2) -> 
 2349   withDayArray a6 $ \(a6'1, a6'2) -> 
 2350   let {a7' = fromIntegral a7} in 
 2351   let {a8' = fromIntegral a8} in 
 2352   let {a9' = fromIntegral a9} in 
 2353   preErrorCheck $ \a10' -> 
 2354   qlInterpolatedForwardCurve'_ a1'1  a1'2 a2'1  a2'2 a3' a4' a5'1  a5'2 a6'1  a6'2 a7' a8' a9' a10' >>= \res ->
 2355   peekYieldTermStructure res >>= \res' ->
 2356   errorCheck  a10'>>
 2357   return (res')
 2358 
 2359 
 2360 
 2361 -- |Yield curve interpolating zero-yield rates directly between the given dates. Always uses
 2362 -- upstream's own default compounding (@Continuous@, @Annual@); use 'interpolatedSimpleZeroCurve'
 2363 -- for simple compounding.
 2364 interpolatedZeroCurve :: NonEmpty (Day, Double) -- ^dates, yields
 2365   -> DayCounter -- ^dayCounter
 2366   -> Calendar -- ^cal
 2367   -> [(Day, GenQuote q)] -- ^jumps, jumpDates
 2368   -> Interpolation -- ^interpolator
 2369   -> IO YieldTermStructure
 2370 interpolatedZeroCurve r dc c qd i = uncurryNested (qlInterpolatedZeroCurve rs rd dc c qs ds) (qlInterpolation i) where {(rd, rs) = unzip (toList r); (ds, qs) = unzip qd}
 2371 qlInterpolatedZeroCurve :: ([Double]) -> ([Day]) -> (DayCounter) -> (Calendar) -> ([GenQuote q]) -> ([Day]) -> (Int) -> (Int) -> (Int) -> IO ((YieldTermStructure))
 2372 qlInterpolatedZeroCurve a1 a2 a3 a4 a5 a6 a7 a8 a9 =
 2373   withDoubleArray a1 $ \(a1'1, a1'2) -> 
 2374   withDayArray a2 $ \(a2'1, a2'2) -> 
 2375   withDayCounter a3 $ \a3' -> 
 2376   withCalendar a4 $ \a4' -> 
 2377   withQuoteArray a5 $ \(a5'1, a5'2) -> 
 2378   withDayArray a6 $ \(a6'1, a6'2) -> 
 2379   let {a7' = fromIntegral a7} in 
 2380   let {a8' = fromIntegral a8} in 
 2381   let {a9' = fromIntegral a9} in 
 2382   preErrorCheck $ \a10' -> 
 2383   qlInterpolatedZeroCurve'_ a1'1  a1'2 a2'1  a2'2 a3' a4' a5'1  a5'2 a6'1  a6'2 a7' a8' a9' a10' >>= \res ->
 2384   peekYieldTermStructure res >>= \res' ->
 2385   errorCheck  a10'>>
 2386   return (res')
 2387 
 2388 
 2389 
 2390 -- |Yield curve interpolating simply-compounded zero rates directly between the given dates.
 2391 interpolatedSimpleZeroCurve :: NonEmpty (Day, Double) -- ^dates, yields
 2392   -> DayCounter -- ^dayCounter
 2393   -> Calendar -- ^cal
 2394   -> [(Day, GenQuote q)] -- ^jumps, jumpDates
 2395   -> Interpolation -- ^interpolator
 2396   -> IO YieldTermStructure
 2397 interpolatedSimpleZeroCurve r dc c qd i = uncurryNested (qlInterpolatedSimpleZeroCurve rs rd dc c qs ds) (qlInterpolation i) where {(rd, rs) = unzip (toList r); (ds, qs) = unzip qd}
 2398 qlInterpolatedSimpleZeroCurve :: ([Double]) -> ([Day]) -> (DayCounter) -> (Calendar) -> ([GenQuote q]) -> ([Day]) -> (Int) -> (Int) -> (Int) -> IO ((YieldTermStructure))
 2399 qlInterpolatedSimpleZeroCurve a1 a2 a3 a4 a5 a6 a7 a8 a9 =
 2400   withDoubleArray a1 $ \(a1'1, a1'2) -> 
 2401   withDayArray a2 $ \(a2'1, a2'2) -> 
 2402   withDayCounter a3 $ \a3' -> 
 2403   withCalendar a4 $ \a4' -> 
 2404   withQuoteArray a5 $ \(a5'1, a5'2) -> 
 2405   withDayArray a6 $ \(a6'1, a6'2) -> 
 2406   let {a7' = fromIntegral a7} in 
 2407   let {a8' = fromIntegral a8} in 
 2408   let {a9' = fromIntegral a9} in 
 2409   preErrorCheck $ \a10' -> 
 2410   qlInterpolatedSimpleZeroCurve'_ a1'1  a1'2 a2'1  a2'2 a3' a4' a5'1  a5'2 a6'1  a6'2 a7' a8' a9' a10' >>= \res ->
 2411   peekYieldTermStructure res >>= \res' ->
 2412   errorCheck  a10'>>
 2413   return (res')
 2414 
 2415 
 2416 
 2417 -- |Discount factors interpolated as a multiplicative spread applied on top of 'baseCurve'.
 2418 -- Upstream requires the first discount factor to be exactly @1.0@, flagging its date as the
 2419 -- curve's own reference date; a mismatched leading value throws a 'QuantLib.Context.Error'.
 2420 interpolatedSpreadDiscountCurve :: GenYieldTermStructure y
 2421   -> NonEmpty (Day, Double) -- ^dates, dfs
 2422   -> Interpolation -- ^interpolator
 2423   -> IO YieldTermStructure
 2424 interpolatedSpreadDiscountCurve ts r i = uncurryNested (qlInterpolatedSpreadDiscountCurve ts rs rd) (qlInterpolation i) where (rd, rs) = unzip (toList r)
 2425 qlInterpolatedSpreadDiscountCurve :: (GenYieldTermStructure y) -> ([Double]) -> ([Day]) -> (Int) -> (Int) -> (Int) -> IO ((YieldTermStructure))
 2426 qlInterpolatedSpreadDiscountCurve a1 a2 a3 a4 a5 a6 =
 2427   withYieldTermStructure a1 $ \a1' -> 
 2428   withDoubleArray a2 $ \(a2'1, a2'2) -> 
 2429   withDayArray a3 $ \(a3'1, a3'2) -> 
 2430   let {a4' = fromIntegral a4} in 
 2431   let {a5' = fromIntegral a5} in 
 2432   let {a6' = fromIntegral a6} in 
 2433   preErrorCheck $ \a7' -> 
 2434   qlInterpolatedSpreadDiscountCurve'_ a1' a2'1  a2'2 a3'1  a3'2 a4' a5' a6' a7' >>= \res ->
 2435   peekYieldTermStructure res >>= \res' ->
 2436   errorCheck  a7'>>
 2437   return (res')
 2438 
 2439 
 2440 
 2441 withNonEmptyBondHelperArray :: NonEmpty BondHelper -> ((CUInt, Ptr (Ptr CBondHelper')) -> IO a) -> IO a
 2442 withNonEmptyBondHelperArray = withBondHelperArray . toList
 2443 
 2444 -- |Construct a fitted bond discount curve with either a fixed or moving reference point.
 2445 fittedBondDiscountCurve :: Reference -> NonEmpty BondHelper -> DayCounter -> FittingMethod
 2446   -> Double -> Word -> [Double] -> Double -> Bool -> IO FittedBondDiscountCurve
 2447 fittedBondDiscountCurve reference hs dc method accuracy maxEvaluations guess simplexLambda ex = do
 2448   curve <- case reference of
 2449     ReferenceDate d -> fittedBondDiscountCurveFixed d hs dc method accuracy maxEvaluations guess simplexLambda
 2450     SettlementDays n cal -> fittedBondDiscountCurveMovingRaw n cal hs dc method accuracy maxEvaluations guess simplexLambda
 2451   setExtrapolation curve ex
 2452   pure curve
 2453 
 2454 fittedBondDiscountCurveMovingRaw :: (Word) -- ^settlementDays
 2455  -> (Calendar) -> (NonEmpty BondHelper) -> (DayCounter) -> (FittingMethod) -> (Double) -- ^accuracy
 2456  -> (Word) -- ^maxEvaluations
 2457  -> ([Double]) -- ^guess
 2458  -> (Double) -- ^simplexLambda
 2459  -> IO ((FittedBondDiscountCurve))
 2460 fittedBondDiscountCurveMovingRaw a1 a2 a3 a4 a5 a6 a7 a8 a9 =
 2461   let {a1' = fromIntegral a1} in 
 2462   withCalendar a2 $ \a2' -> 
 2463   withNonEmptyBondHelperArray a3 $ \(a3'1, a3'2) -> 
 2464   withDayCounter a4 $ \a4' -> 
 2465   withFittedBondDiscountCurveFittingMethod a5 $ \a5' -> 
 2466   let {a6' = realToFrac a6} in 
 2467   let {a7' = fromIntegral a7} in 
 2468   withDoubleArray a8 $ \(a8'1, a8'2) -> 
 2469   let {a9' = realToFrac a9} in 
 2470   preErrorCheck $ \a10' -> 
 2471   fittedBondDiscountCurveMovingRaw'_ a1' a2' a3'1  a3'2 a4' a5' a6' a7' a8'1  a8'2 a9' a10' >>= \res ->
 2472   peekFittedBondDiscountCurve res >>= \res' ->
 2473   errorCheck  a10'>>
 2474   return (res')
 2475 
 2476 
 2477 
 2478 -- |curve reference date fixed for life of curve
 2479 fittedBondDiscountCurveFixed :: (Day) -> (NonEmpty BondHelper) -> (DayCounter) -> (FittingMethod) -> (Double) -- ^accuracy
 2480  -> (Word) -- ^maxEvaluations
 2481  -> ([Double]) -- ^guess
 2482  -> (Double) -- ^simplexLambda
 2483  -> IO ((FittedBondDiscountCurve))
 2484 fittedBondDiscountCurveFixed a1 a2 a3 a4 a5 a6 a7 a8 =
 2485   withDay a1 $ \a1' -> 
 2486   withNonEmptyBondHelperArray a2 $ \(a2'1, a2'2) -> 
 2487   withDayCounter a3 $ \a3' -> 
 2488   withFittedBondDiscountCurveFittingMethod a4 $ \a4' -> 
 2489   let {a5' = realToFrac a5} in 
 2490   let {a6' = fromIntegral a6} in 
 2491   withDoubleArray a7 $ \(a7'1, a7'2) -> 
 2492   let {a8' = realToFrac a8} in 
 2493   preErrorCheck $ \a9' -> 
 2494   fittedBondDiscountCurveFixed'_ a1' a2'1  a2'2 a3' a4' a5' a6' a7'1  a7'2 a8' a9' >>= \res ->
 2495   peekFittedBondDiscountCurve res >>= \res' ->
 2496   errorCheck  a9'>>
 2497   return (res')
 2498 
 2499 
 2500 
 2501 -- |final value of cost function after optimization
 2502 minimumCostValue :: (FittedBondDiscountCurve) -> IO ((Double))
 2503 minimumCostValue a1 =
 2504   withFittedBondDiscountCurve a1 $ \a1' -> 
 2505   preErrorCheck $ \a2' -> 
 2506   minimumCostValue'_ a1' a2' >>= \res ->
 2507   let {res' = realToFrac res} in
 2508   errorCheck  a2'>>
 2509   return (res')
 2510 
 2511 
 2512 
 2513 -- |final number of iterations used in the optimization problem
 2514 numberOfIterations :: (FittedBondDiscountCurve) -> IO ((Int))
 2515 numberOfIterations a1 =
 2516   withFittedBondDiscountCurve a1 $ \a1' -> 
 2517   preErrorCheck $ \a2' -> 
 2518   numberOfIterations'_ a1' a2' >>= \res ->
 2519   let {res' = fromIntegral res} in
 2520   errorCheck  a2'>>
 2521   return (res')
 2522 
 2523 
 2524 
 2525 -- |number of unknown parameters found by the fit
 2526 fittingMethodSize :: (FittedBondDiscountCurve) -> IO ((Word))
 2527 fittingMethodSize a1 =
 2528   withFittedBondDiscountCurve a1 $ \a1' -> 
 2529   preErrorCheck $ \a2' -> 
 2530   fittingMethodSize'_ a1' a2' >>= \res ->
 2531   let {res' = fromIntegral res} in
 2532   errorCheck  a2'>>
 2533   return (res')
 2534 
 2535 
 2536 
 2537 -- |why the optimization stopped
 2538 fittingMethodErrorCode :: FittedBondDiscountCurve -> IO EndCriteriaType
 2539 fittingMethodErrorCode = fmap toEnum . fittingMethodErrorCodeRaw
 2540 fittingMethodErrorCodeRaw :: (FittedBondDiscountCurve) -> IO ((Int))
 2541 fittingMethodErrorCodeRaw a1 =
 2542   withFittedBondDiscountCurve a1 $ \a1' -> 
 2543   preErrorCheck $ \a2' -> 
 2544   fittingMethodErrorCodeRaw'_ a1' a2' >>= \res ->
 2545   let {res' = fromIntegral res} in
 2546   errorCheck  a2'>>
 2547   return (res')
 2548 
 2549 
 2550 
 2551 -- |the fitted parameters found by the optimization
 2552 fittingMethodSolution :: (FittedBondDiscountCurve) -> IO ((RealVector))
 2553 fittingMethodSolution a1 =
 2554   withFittedBondDiscountCurve a1 $ \a1' -> 
 2555   preDoubleArray $ \(a2'1, a2'2) -> 
 2556   preErrorCheck $ \a3' -> 
 2557   fittingMethodSolution'_ a1' a2'1  a2'2 a3' >>
 2558   peekRealVector  a2'1  a2'2>>= \a2'' -> 
 2559   errorCheck  a3'>>
 2560   return (a2'')
 2561 
 2562 
 2563 
 2564 -- |the discount factor at time @t@ implied by a given parameter vector, without rebuilding the curve
 2565 fittingMethodDiscount :: (FittedBondDiscountCurve) -> ([Double]) -> (Double) -> IO ((Double))
 2566 fittingMethodDiscount a1 a2 a3 =
 2567   withFittedBondDiscountCurve a1 $ \a1' -> 
 2568   withDoubleArray a2 $ \(a2'1, a2'2) -> 
 2569   let {a3' = realToFrac a3} in 
 2570   preErrorCheck $ \a4' -> 
 2571   fittingMethodDiscount'_ a1' a2'1  a2'2 a3' a4' >>= \res ->
 2572   let {res' = realToFrac res} in
 2573   errorCheck  a4'>>
 2574   return (res')
 2575 
 2576 
 2577 
 2578 -- |A curve behind a relinkable handle. The result /is/ a 'YieldTermStructure': pass it to
 2579 -- any curve-taking function and everything built on it keeps tracking whatever the handle
 2580 -- currently points at, so a later 'linkTo' reprices already-constructed instruments
 2581 -- without rebuilding them. 'Nothing' gives an empty handle -- meaningful rather than an
 2582 -- error, since that is what makes a rate helper discount off the curve being bootstrapped
 2583 -- -- but reading a curve value through one throws until it is linked.
 2584 relinkableYieldTermStructure :: (Maybe (GenYieldTermStructure y)) -> IO ((RelinkableYieldTermStructure))
 2585 relinkableYieldTermStructure a1 =
 2586   withMaybeYieldTermStructure a1 $ \a1' -> 
 2587   preErrorCheck $ \a2' -> 
 2588   relinkableYieldTermStructure'_ a1' a2' >>= \res ->
 2589   peekRelinkableYieldTermStructure res >>= \res' ->
 2590   errorCheck  a2'>>
 2591   return (res')
 2592 
 2593 
 2594 
 2595 -- |Point a relinkable handle at a different curve. Everything already built on the handle
 2596 -- reprices against the new curve, with no object rebuilt.
 2597 --
 2598 -- This is the one mutator in the module. The API rules here otherwise forbid new setters
 2599 -- and prefer constructing a fresh object, but relinking /is/ the capability being bound:
 2600 -- a forecast curve is cloned into every floating coupon of every instrument, so without
 2601 -- it a curve scenario means rebuilding the whole portfolio.
 2602 linkTo :: (RelinkableYieldTermStructure) -> (GenYieldTermStructure y) -> IO ()
 2603 linkTo a1 a2 =
 2604   withRelinkableYieldTermStructure a1 $ \a1' -> 
 2605   withYieldTermStructure a2 $ \a2' -> 
 2606   preErrorCheck $ \a3' -> 
 2607   linkTo'_ a1' a2' a3' >>
 2608   errorCheck  a3'>>
 2609   return ()
 2610 
 2611 
 2612 
 2613 -- |Builds a set of curves that form a genuine dependency cycle -- the scenario
 2614 -- 'RelinkableYieldTermStructure' exists for. Protocol (see the class's own upstream doc
 2615 -- comment): build each member curve's rate helpers off an empty 'relinkableYieldTermStructure'
 2616 -- (the /internal/ handle), construct the curves themselves (e.g. via
 2617 -- 'piecewiseYieldCurve'), then hand each pair of (internal handle, curve) to
 2618 -- 'addBootstrappedCurve' -- which returns an /external/ handle to reference the curve by from
 2619 -- then on, and links the internal handle to it (with ownership/observability stripped to avoid
 2620 -- shared_ptr and notification cycles) so the curves' own cross-references resolve.
 2621 --
 2622 -- Only the 'MultiCurve' value and the returned external handles keep the group alive, so
 2623 -- instruments outside the cycle must use indexes built on the external handles. An original
 2624 -- member handle keeps only its own curve, and internal handles keep nothing: once the group is
 2625 -- released, anything reached through either raises an error instead of pricing.
 2626 --
 2627 -- __Leak hazard:__ members must reference each other through internal handles. A member curve,
 2628 -- rate helper, or index inside the cycle built on an /external/ handle makes the group own
 2629 -- itself, so it is never freed. Original member handles do not create such a cycle.
 2630 multiCurve :: (Double) -- ^accuracy
 2631  -> IO ((MultiCurve))
 2632 multiCurve a1 =
 2633   let {a1' = realToFrac a1} in 
 2634   preErrorCheck $ \a2' -> 
 2635   multiCurve'_ a1' a2' >>= \res ->
 2636   peekMultiCurve res >>= \res' ->
 2637   errorCheck  a2'>>
 2638   return (res')
 2639 
 2640 
 2641 
 2642 -- |Add a curve built with a bootstrapper (e.g. 'piecewiseYieldCurve') to the
 2643 -- cycle. See 'multiCurve' for the protocol.
 2644 addBootstrappedCurve :: (MultiCurve) -> (RelinkableYieldTermStructure) -- ^internalHandle
 2645  -> (GenYieldTermStructure y) -- ^curve
 2646  -> IO ((YieldTermStructure))
 2647 addBootstrappedCurve a1 a2 a3 =
 2648   withMultiCurve a1 $ \a1' -> 
 2649   withRelinkableYieldTermStructure a2 $ \a2' -> 
 2650   withYieldTermStructure a3 $ \a3' -> 
 2651   preErrorCheck $ \a4' -> 
 2652   addBootstrappedCurve'_ a1' a2' a3' a4' >>= \res ->
 2653   peekYieldTermStructure res >>= \res' ->
 2654   errorCheck  a4'>>
 2655   return (res')
 2656 
 2657 
 2658 
 2659 -- |Add a curve that isn't built with a bootstrapper (e.g. a spreaded curve) to the cycle. See
 2660 -- 'multiCurve' for the protocol.
 2661 addNonBootstrappedCurve :: (MultiCurve) -> (RelinkableYieldTermStructure) -- ^internalHandle
 2662  -> (GenYieldTermStructure y) -- ^curve
 2663  -> IO ((YieldTermStructure))
 2664 addNonBootstrappedCurve a1 a2 a3 =
 2665   withMultiCurve a1 $ \a1' -> 
 2666   withRelinkableYieldTermStructure a2 $ \a2' -> 
 2667   withYieldTermStructure a3 $ \a3' -> 
 2668   preErrorCheck $ \a4' -> 
 2669   addNonBootstrappedCurve'_ a1' a2' a3' a4' >>= \res ->
 2670   peekYieldTermStructure res >>= \res' ->
 2671   errorCheck  a4'>>
 2672   return (res')
 2673 
 2674 
 2675 
 2676 -- vim: set ff=unix ts=8 sts=2 sw=2 et:
 2677 
 2678 -- |An implied curve whose reference date moves with the evaluation date by settlement days.
 2679 -- Shares the original curve's observable handle. Requires QuantLib 1.44.
 2680 impliedTermStructureMoving :: (GenYieldTermStructure y) -- ^curve
 2681  -> (Word) -- ^settlementDays
 2682  -> (Calendar) -- ^calendar
 2683  -> IO ((YieldTermStructure))
 2684 impliedTermStructureMoving a1 a2 a3 =
 2685   withYieldTermStructure a1 $ \a1' -> 
 2686   let {a2' = fromIntegral a2} in 
 2687   withCalendar a3 $ \a3' -> 
 2688   preErrorCheck $ \a4' -> 
 2689   impliedTermStructureMoving'_ a1' a2' a3' a4' >>= \res ->
 2690   peekYieldTermStructure res >>= \res' ->
 2691   errorCheck  a4'>>
 2692   return (res')
 2693 
 2694 
 2695 
 2696 -- |Basis helper paying base overnight plus basis and receiving the other overnight rate.
 2697 -- Empty discount handle uses the bootstrapped curve; averaging is independent per leg.
 2698 -- NoFrequency creates one coupon per leg. Requires QuantLib 1.44.
 2699 overnightOvernightBasisSwapRateHelper :: (GenQuote q) -- ^basis
 2700  -> ((Int,TimeUnit)) -- ^tenorLen
 2701  -> (Word) -- ^settlementDays
 2702  -> (Calendar) -- ^calendar
 2703  -> (BusinessDayConvention) -- ^convention
 2704  -> (Bool) -- ^endOfMonth
 2705  -> (OvernightIborIndex) -- ^baseIndex
 2706  -> (OvernightIborIndex) -- ^otherIndex
 2707  -> (Maybe (GenYieldTermStructure y)) -- ^discount
 2708  -> (Bool) -- ^bootstrapBaseCurve
 2709  -> (Int) -- ^paymentLag
 2710  -> (Frequency) -- ^paymentFrequency
 2711  -> (RateAveragingType) -- ^baseAveragingMethod
 2712  -> (RateAveragingType) -- ^otherAveragingMethod
 2713  -> (Bool) -- ^telescopicValueDates
 2714  -> (DateGenerationRule) -- ^rule
 2715  -> IO ((RateHelper))
 2716 overnightOvernightBasisSwapRateHelper a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 =
 2717   withQuote a1 $ \a1' -> 
 2718   let {(a2'1, a2'2) = fromEnumQuantity a2} in 
 2719   let {a3' = fromIntegral a3} in 
 2720   withCalendar a4 $ \a4' -> 
 2721   let {a5' = fromEnumC a5} in 
 2722   let {a6' = C2HSImp.fromBool a6} in 
 2723   withOvernightIborIndex a7 $ \a7' -> 
 2724   withOvernightIborIndex a8 $ \a8' -> 
 2725   withMaybeYieldTermStructure a9 $ \a9' -> 
 2726   let {a10' = C2HSImp.fromBool a10} in 
 2727   let {a11' = fromIntegral a11} in 
 2728   let {a12' = (fromIntegral . fromEnum) a12} in 
 2729   let {a13' = fromEnumC a13} in 
 2730   let {a14' = fromEnumC a14} in 
 2731   let {a15' = C2HSImp.fromBool a15} in 
 2732   let {a16' = (fromIntegral . fromEnum) a16} in 
 2733   preErrorCheck $ \a17' -> 
 2734   overnightOvernightBasisSwapRateHelper'_ a1' a2'1  a2'2 a3' a4' a5' a6' a7' a8' a9' a10' a11' a12' a13' a14' a15' a16' a17' >>= \res ->
 2735   peekRateHelper res >>= \res' ->
 2736   errorCheck  a17'>>
 2737   return (res')
 2738 
 2739 
 2740 
 2741 -- |Dates for a funding-margin helper: settlement days and tenor, or fixed endpoints.
 2742 data FundingTerms = FundingTenor !Word !(Int, TimeUnit) | FundingBetweenDates !Day !Day
 2743 
 2744 -- |Funding-margin helper with principal exchanges and compounded overnight coupons.
 2745 -- The index projects from an exogenous curve; the bootstrapped curve discounts every flow.
 2746 -- Payment lag also applies to principal exchanges. Requires QuantLib 1.44.
 2747 overnightIndexedFundingRateHelper :: FundingTerms -- ^contract dates
 2748   -> GenQuote q -- ^margin
 2749   -> Calendar -- ^calendar
 2750   -> BusinessDayConvention -- ^convention
 2751   -> Bool -- ^endOfMonth
 2752   -> OvernightIborIndex -- ^index
 2753   -> (Int, TimeUnit) -- ^paymentTenor
 2754   -> DayCounter -- ^paymentDayCounter
 2755   -> Int -- ^paymentLag
 2756   -> Bool -- ^telescopicValueDates
 2757   -> DateGenerationRule -- ^rule
 2758   -> PillarChoice -- ^pillar
 2759   -> Maybe Day -- ^customPillarDate
 2760   -> IO RateHelper
 2761 overnightIndexedFundingRateHelper terms margin cal convention eom idx tenor dc lag telescopic rule pillar custom =
 2762   case terms of
 2763     FundingTenor days (n, unit) -> overnightIndexedFundingRateHelperRaw False (fromIntegral days) n unit margin cal convention eom idx tenor dc lag telescopic rule pillar custom
 2764     FundingBetweenDates start end -> do
 2765       s <- toSerial start
 2766       e <- toSerial end
 2767       overnightIndexedFundingRateHelperRaw True (fromIntegral s) (fromIntegral e) Days margin cal convention eom idx tenor dc lag telescopic rule pillar custom
 2768 
 2769 overnightIndexedFundingRateHelperRaw :: (Bool) -- ^dated
 2770  -> (Int) -- ^start
 2771  -> (Int) -- ^end
 2772  -> (TimeUnit) -- ^tenorUnit
 2773  -> (GenQuote q) -- ^margin
 2774  -> (Calendar) -- ^calendar
 2775  -> (BusinessDayConvention) -- ^convention
 2776  -> (Bool) -- ^endOfMonth
 2777  -> (OvernightIborIndex) -- ^index
 2778  -> ((Int,TimeUnit)) -- ^paymentTenorLen
 2779  -> (DayCounter) -- ^paymentDayCounter
 2780  -> (Int) -- ^paymentLag
 2781  -> (Bool) -- ^telescopicValueDates
 2782  -> (DateGenerationRule) -- ^rule
 2783  -> (PillarChoice) -- ^pillar
 2784  -> (Maybe Day) -- ^customPillarDate
 2785  -> IO ((RateHelper))
 2786 overnightIndexedFundingRateHelperRaw a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 =
 2787   let {a1' = C2HSImp.fromBool a1} in 
 2788   let {a2' = fromIntegral a2} in 
 2789   let {a3' = fromIntegral a3} in 
 2790   let {a4' = fromEnumC a4} in 
 2791   withQuote a5 $ \a5' -> 
 2792   withCalendar a6 $ \a6' -> 
 2793   let {a7' = fromEnumC a7} in 
 2794   let {a8' = C2HSImp.fromBool a8} in 
 2795   withOvernightIborIndex a9 $ \a9' -> 
 2796   let {(a10'1, a10'2) = fromEnumQuantity a10} in 
 2797   withDayCounter a11 $ \a11' -> 
 2798   let {a12' = fromIntegral a12} in 
 2799   let {a13' = C2HSImp.fromBool a13} in 
 2800   let {a14' = (fromIntegral . fromEnum) a14} in 
 2801   let {a15' = (fromIntegral . fromEnum) a15} in 
 2802   withMaybeDay a16 $ \a16' -> 
 2803   preErrorCheck $ \a17' -> 
 2804   overnightIndexedFundingRateHelperRaw'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' a10'1  a10'2 a11' a12' a13' a14' a15' a16' a17' >>= \res ->
 2805   peekRateHelper res >>= \res' ->
 2806   errorCheck  a17'>>
 2807   return (res')
 2808 
 2809 
 2810 
 2811 -- |Whole-curve initial guess: node times (including time zero), previous data (empty on
 2812 -- first bootstrap), and one trait-specific guess per non-reference pillar. Inputs are borrowed:
 2813 -- copy them before retaining them past the callback. Ignored, without execution, on QuantLib 1.43.
 2814 type BootstrapInitialGuess = RealVector -> RealVector -> IO RealVector
 2815 
 2816 foreign import ccall unsafe "ql.h qlSupports144" supportsInitialGuess :: Bool
 2817 
 2818 withMaybeBootstrapInitialGuess :: Maybe BootstrapInitialGuess -> (Ptr () -> IO r) -> IO r
 2819 withMaybeBootstrapInitialGuess Nothing use = use nullPtr
 2820 withMaybeBootstrapInitialGuess (Just f) use
 2821   | not supportsInitialGuess = use nullPtr
 2822   | otherwise = Callback.withCallback call (`Callback.withCallbackPtr` use)
 2823   where
 2824     call args = do
 2825       times <- borrowRealVector (Callback.callbackInput args) (fromIntegral (Callback.callbackSize args))
 2826       previous <- borrowRealVector (Callback.callbackInput2 args) (fromIntegral (Callback.callbackSize2 args))
 2827       values <- f times previous
 2828       let expected = Callback.callbackOutputSize args
 2829       when (V.length values /= expected) $ throwIO $ CallbackResultLength expected (V.length values)
 2830       V.unsafeWith values $ \p -> copyArray (castPtr (Callback.callbackOutput args)) p expected
 2831 
 2832 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlDepositRateHelper1"
 2833   depositRateHelperFromIndexRaw'_ :: ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CIborIndex')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CRateHelper'))))))
 2834 
 2835 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlDepositRateHelper2"
 2836   depositRateHelperOnFixingDateRaw'_ :: ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CIborIndex')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CRateHelper')))))))
 2837 
 2838 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlDepositRateHelper"
 2839   depositRateHelperRaw'_ :: ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CDayCounter)) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CRateHelper'))))))))))))
 2840 
 2841 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlFixedRateBondHelper"
 2842   fixedRateBondHelper'_ :: ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CUInt -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (CSchedule)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CBondHelper'))))))))))))))
 2843 
 2844 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlYieldTSDiscount"
 2845   discountAtDateRaw'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))))
 2846 
 2847 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlSwapRateHelper2"
 2848   swapRateHelperBetweenDatesRaw'_ :: ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CDayCounter)) -> ((C2HSImp.Ptr (CIborIndex')) -> ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CFloatingRateCouponPricer')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CSwapRateHelper'))))))))))))))))))))
 2849 
 2850 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlSwapRateHelper1"
 2851   swapRateHelperRaw'_ :: ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CDayCounter)) -> ((C2HSImp.Ptr (CIborIndex')) -> ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CUInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CFloatingRateCouponPricer')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CSwapRateHelper')))))))))))))))))))))))
 2852 
 2853 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlFlatForward"
 2854   flatForwardFixed'_ :: (C2HSImp.CInt -> ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CYieldTermStructure')))))))))
 2855 
 2856 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlFlatForward1"
 2857   flatForwardMovingRaw'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr (CCalendar)) -> ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CYieldTermStructure'))))))))))
 2858 
 2859 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlYieldTermStructureZeroRate"
 2860   zeroRateAtDateRaw'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CInterestRate))))))))))
 2861 
 2862 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlYieldTermStructureForwardRate"
 2863   forwardRate'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CInterestRate)))))))))))
 2864 
 2865 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlYieldTermStructureForwardRate2"
 2866   forwardRateBetweenTimes'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CInterestRate))))))))))
 2867 
 2868 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlYieldTermStructureZeroRate1"
 2869   zeroRateAtTimeRaw'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CDouble -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CInterestRate)))))))))
 2870 
 2871 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlYieldTermStructureDiscount1"
 2872   discountAtTimeRaw'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CDouble -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))))
 2873 
 2874 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlFraRateHelper"
 2875   fraRateHelperRaw'_ :: ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CRateHelper')))))))))))))))
 2876 
 2877 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlIborIborBasisSwapRateHelper"
 2878   iborIborBasisSwapRateHelper'_ :: ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CIborIndex')) -> ((C2HSImp.Ptr (CIborIndex')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((QlStubIndexSelection) -> ((QlStubIndexSelection) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CRateHelper'))))))))))))))))))))
 2879 
 2880 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlOvernightIborBasisSwapRateHelper"
 2881   overnightIborBasisSwapRateHelper'_ :: ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (COvernightIndex')) -> ((C2HSImp.Ptr (CIborIndex')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((QlStubIndexSelection) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CRateHelper')))))))))))))))))))))))
 2882 
 2883 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlConstNotionalCrossCurrencyBasisSwapRateHelper"
 2884   constNotionalCrossCurrencyBasisSwapRateHelper'_ :: ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CIborIndex')) -> ((C2HSImp.Ptr (CIborIndex')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((QlStubIndexSelection) -> ((QlStubIndexSelection) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CRateHelper')))))))))))))))))))))))
 2885 
 2886 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlMtMCrossCurrencyBasisSwapRateHelper"
 2887   mtmCrossCurrencyBasisSwapRateHelper'_ :: ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CIborIndex')) -> ((C2HSImp.Ptr (CIborIndex')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CInt -> ((QlStubIndexSelection) -> ((QlStubIndexSelection) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CRateHelper')))))))))))))))))))))))))
 2888 
 2889 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlConstNotionalCrossCurrencySwapRateHelper"
 2890   constNotionalCrossCurrencySwapRateHelper'_ :: ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CDayCounter)) -> ((C2HSImp.Ptr (CIborIndex')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((QlStubIndexSelection) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CRateHelper'))))))))))))))))))))
 2891 
 2892 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlFxSwapRateHelper"
 2893   fxSwapRateHelperRaw'_ :: ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CCalendar)) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CRateHelper')))))))))))))))
 2894 
 2895 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlFxSwapRateHelper2"
 2896   fxSwapRateHelperBetweenDatesRaw'_ :: ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CRateHelper'))))))))))
 2897 
 2898 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlBondHelper"
 2899   bondHelper_'_ :: ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CBond')) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CBondHelper')))))))
 2900 
 2901 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlOISRateHelper"
 2902   oisRateHelper_'_ :: (C2HSImp.CUInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (COvernightIndex')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CFloatingRateCouponPricer')) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CDayCounter)) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (COISRateHelper'))))))))))))))))))))))))))))))))
 2903 
 2904 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlOISRateHelper2"
 2905   oisRateHelper2_'_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (COvernightIndex')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CCalendar)) -> ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CFloatingRateCouponPricer')) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CDayCounter)) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (COISRateHelper')))))))))))))))))))))))))))))
 2906 
 2907 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlSwapRateHelper"
 2908   swapRateHelperFromIndexRaw'_ :: ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CSwapIndex')) -> ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CFloatingRateCouponPricer')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CSwapRateHelper')))))))))))))))
 2909 
 2910 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlForwardSpreadedTermStructure"
 2911   forwardSpreadedTermStructure'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CYieldTermStructure'))))))
 2912 
 2913 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlZeroSpreadedTermStructure"
 2914   zeroSpreadedTermStructure'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CYieldTermStructure'))))))))
 2915 
 2916 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlCompositeZeroYieldStructure"
 2917   qlCompositeZeroYieldStructure'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr ()) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CYieldTermStructure')))))))))
 2918 
 2919 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlBMASwapRateHelper"
 2920   bmaSwapRateHelper'_ :: ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CDayCounter)) -> ((C2HSImp.Ptr (CBMAIndex')) -> ((C2HSImp.Ptr (CIborIndex')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CRateHelper')))))))))))))))
 2921 
 2922 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlMultipleResetsSwapRateHelper"
 2923   multipleResetsSwapRateHelper'_ :: (C2HSImp.CUInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CIborIndex')) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CRateHelper'))))))))))))))))
 2924 
 2925 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlFraRateHelper1"
 2926   fraRateHelperFromIndexRaw'_ :: ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (CIborIndex')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CRateHelper'))))))))))
 2927 
 2928 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlFraRateHelper2"
 2929   fraRateHelperFromPeriodRaw'_ :: ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CRateHelper'))))))))))))))))
 2930 
 2931 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlFraRateHelper3"
 2932   fraIborRateHelperRaw'_ :: ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CIborIndex')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CRateHelper')))))))))))
 2933 
 2934 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlFraRateHelper5"
 2935   fraImmOffsetsRateHelperRaw'_ :: ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (CIborIndex')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CRateHelper')))))))))))
 2936 
 2937 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlFraRateHelper4"
 2938   fraBetweenDatesRateHelperRaw'_ :: ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CIborIndex')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CRateHelper')))))))))))
 2939 
 2940 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlFuturesRateHelper1"
 2941   futuresRateHelperBetweenDatesRaw'_ :: ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CDayCounter)) -> ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CFuturesRateHelper'))))))))))
 2942 
 2943 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlFuturesRateHelper2"
 2944   futuresIborRateHelperRaw'_ :: ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CIborIndex')) -> ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CFuturesRateHelper')))))))))
 2945 
 2946 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlFuturesRateHelper"
 2947   futuresRateHelperRaw'_ :: ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CDayCounter)) -> ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CFuturesRateHelper')))))))))))))
 2948 
 2949 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlFuturesRateHelperConvexityAdjustment"
 2950   futuresRateHelperConvexityAdjustment'_ :: ((C2HSImp.Ptr (CFuturesRateHelper')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))
 2951 
 2952 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlOvernightIndexFutureRateHelper"
 2953   overnightIndexFutureRateHelper'_ :: ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (COvernightIndex')) -> ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (COvernightIndexFutureRateHelper'))))))))))))
 2954 
 2955 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlOvernightIndexFutureRateHelperConvexityAdjustment"
 2956   overnightIndexFutureRateHelperConvexityAdjustment'_ :: ((C2HSImp.Ptr (COvernightIndexFutureRateHelper')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))
 2957 
 2958 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlRateHelperFixingDependencies"
 2959   qlRateHelperFixingDependencies'_ :: ((C2HSImp.Ptr (CRateHelper')) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar))) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CInt)) -> ((C2HSImp.Ptr C2HSImp.CInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO ()))))))))
 2960 
 2961 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlSofrFutureRateHelper"
 2962   sofrFutureRateHelper'_ :: ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CRateHelper')))))))))))
 2963 
 2964 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlRateHelperImpliedQuote"
 2965   impliedQuote'_ :: ((C2HSImp.Ptr (CRateHelper')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))
 2966 
 2967 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlRateHelperImpliedQuoteOn"
 2968   impliedQuoteOn'_ :: ((C2HSImp.Ptr (CRateHelper')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble))))
 2969 
 2970 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlImpliedTermStructure"
 2971   impliedTermStructure'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CYieldTermStructure'))))))
 2972 
 2973 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlPiecewiseZeroSpreadedTermStructure"
 2974   qlPiecewiseZeroSpreadedTermStructure'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CQuote'))) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CYieldTermStructure'))))))))))))))
 2975 
 2976 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlPiecewiseForwardSpreadedTermStructure"
 2977   qlPiecewiseForwardSpreadedTermStructure'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CQuote'))) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CYieldTermStructure'))))))))))))
 2978 
 2979 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlQuantoTermStructure"
 2980   quantoTermStructure'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CBlackVolTermStructure')) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (CBlackVolTermStructure')) -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CYieldTermStructure'))))))))))))
 2981 
 2982 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlUltimateForwardTermStructure"
 2983   ultimateForwardTermStructure'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CYieldTermStructure')))))))))))))
 2984 
 2985 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlPiecewiseYieldCurveFull"
 2986   qlPiecewiseYieldCurveFull'_ :: (C2HSImp.CInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CRateHelper'))) -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CQuote'))) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CInt -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CYieldTermStructure')))))))))))))))))))))))))
 2987 
 2988 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlPiecewiseYieldCurveFull1"
 2989   qlPiecewiseYieldCurveFull1'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CRateHelper'))) -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CQuote'))) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CInt -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CYieldTermStructure')))))))))))))))))))))))))))
 2990 
 2991 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlPiecewiseYieldCurveGlobalBootstrap1"
 2992   qlPiecewiseYieldCurveGlobalBootstrap1'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CRateHelper'))) -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CQuote'))) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CInt -> ((C2HSImp.Ptr ()) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CYieldTermStructure'))))))))))))))))))
 2993 
 2994 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlPiecewiseYieldCurveGlobalBootstrap2"
 2995   qlPiecewiseYieldCurveGlobalBootstrap2'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CRateHelper'))) -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CQuote'))) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CInt -> ((C2HSImp.Ptr ()) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CYieldTermStructure'))))))))))))))))))
 2996 
 2997 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlPiecewiseYieldCurveGlobalBootstrap3"
 2998   qlPiecewiseYieldCurveGlobalBootstrap3'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CRateHelper'))) -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CQuote'))) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CRateHelper'))) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CDouble -> (C2HSImp.CInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((C2HSImp.Ptr ()) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CYieldTermStructure'))))))))))))))))))))))
 2999 
 3000 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlPiecewiseYieldCurveGlobalBootstrap4"
 3001   qlPiecewiseYieldCurveGlobalBootstrap4'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CRateHelper'))) -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CQuote'))) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CInt -> ((C2HSImp.Ptr ()) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CYieldTermStructure'))))))))))))))))))
 3002 
 3003 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlPiecewiseYieldCurveGlobalBootstrap5"
 3004   qlPiecewiseYieldCurveGlobalBootstrap5'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CRateHelper'))) -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CQuote'))) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CInt -> ((C2HSImp.Ptr ()) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CYieldTermStructure'))))))))))))))))))
 3005 
 3006 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlPiecewiseYieldCurveLocalBootstrap1"
 3007   qlPiecewiseYieldCurveLocalBootstrap1'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CRateHelper'))) -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CQuote'))) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CInt -> (C2HSImp.CUInt -> (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CYieldTermStructure')))))))))))))))))))))
 3008 
 3009 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlPiecewiseYieldCurveGlobalBootstrapFixed1"
 3010   qlPiecewiseYieldCurveGlobalBootstrapFixed1'_ :: (C2HSImp.CInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CRateHelper'))) -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CQuote'))) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CInt -> ((C2HSImp.Ptr ()) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CYieldTermStructure')))))))))))))))))
 3011 
 3012 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlPiecewiseYieldCurveGlobalBootstrapFixed2"
 3013   qlPiecewiseYieldCurveGlobalBootstrapFixed2'_ :: (C2HSImp.CInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CRateHelper'))) -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CQuote'))) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CInt -> ((C2HSImp.Ptr ()) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CYieldTermStructure')))))))))))))))))
 3014 
 3015 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlPiecewiseYieldCurveGlobalBootstrapFixed3"
 3016   qlPiecewiseYieldCurveGlobalBootstrapFixed3'_ :: (C2HSImp.CInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CRateHelper'))) -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CQuote'))) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CRateHelper'))) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CDouble -> (C2HSImp.CInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((C2HSImp.Ptr ()) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CYieldTermStructure')))))))))))))))))))))
 3017 
 3018 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlPiecewiseYieldCurveGlobalBootstrapFixed4"
 3019   qlPiecewiseYieldCurveGlobalBootstrapFixed4'_ :: (C2HSImp.CInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CRateHelper'))) -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CQuote'))) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CInt -> ((C2HSImp.Ptr ()) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CYieldTermStructure')))))))))))))))))
 3020 
 3021 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlPiecewiseYieldCurveGlobalBootstrapFixed5"
 3022   qlPiecewiseYieldCurveGlobalBootstrapFixed5'_ :: (C2HSImp.CInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CRateHelper'))) -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CQuote'))) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CInt -> ((C2HSImp.Ptr ()) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CYieldTermStructure')))))))))))))))))
 3023 
 3024 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlPiecewiseYieldCurveLocalBootstrapFixed"
 3025   qlPiecewiseYieldCurveLocalBootstrapFixed'_ :: (C2HSImp.CInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CRateHelper'))) -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CQuote'))) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CInt -> (C2HSImp.CUInt -> (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CYieldTermStructure'))))))))))))))))))))
 3026 
 3027 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlPiecewiseSpreadYieldCurve"
 3028   qlPiecewiseSpreadYieldCurve'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CRateHelper'))) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CInt -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CYieldTermStructure'))))))))))))))))))))
 3029 
 3030 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlPiecewiseSpreadYieldCurveGlobalBootstrap"
 3031   qlPiecewiseSpreadYieldCurveGlobalBootstrap'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CRateHelper'))) -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CInt -> ((C2HSImp.Ptr ()) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CYieldTermStructure'))))))))))))
 3032 
 3033 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlInterpolatedDiscountCurve"
 3034   qlInterpolatedDiscountCurve'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> ((C2HSImp.Ptr (CDayCounter)) -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CQuote'))) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CYieldTermStructure'))))))))))))))))))
 3035 
 3036 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlInterpolatedForwardCurve"
 3037   qlInterpolatedForwardCurve'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> ((C2HSImp.Ptr (CDayCounter)) -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CQuote'))) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CYieldTermStructure')))))))))))))))))
 3038 
 3039 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlInterpolatedZeroCurve"
 3040   qlInterpolatedZeroCurve'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> ((C2HSImp.Ptr (CDayCounter)) -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CQuote'))) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CYieldTermStructure')))))))))))))))))
 3041 
 3042 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlInterpolatedSimpleZeroCurve"
 3043   qlInterpolatedSimpleZeroCurve'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> ((C2HSImp.Ptr (CDayCounter)) -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CQuote'))) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CYieldTermStructure')))))))))))))))))
 3044 
 3045 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlInterpolatedSpreadDiscountCurve"
 3046   qlInterpolatedSpreadDiscountCurve'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CYieldTermStructure'))))))))))))
 3047 
 3048 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlFittedBondDiscountCurve"
 3049   fittedBondDiscountCurveMovingRaw'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CBondHelper'))) -> ((C2HSImp.Ptr (CDayCounter)) -> ((C2HSImp.Ptr (CFittedBondDiscountCurveFittingMethod)) -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CFittedBondDiscountCurve')))))))))))))))
 3050 
 3051 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlFittedBondDiscountCurve1"
 3052   fittedBondDiscountCurveFixed'_ :: (C2HSImp.CInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CBondHelper'))) -> ((C2HSImp.Ptr (CDayCounter)) -> ((C2HSImp.Ptr (CFittedBondDiscountCurveFittingMethod)) -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CFittedBondDiscountCurve'))))))))))))))
 3053 
 3054 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlFittedBondDiscountCurveFittingMethodMinimumCostValue"
 3055   minimumCostValue'_ :: ((C2HSImp.Ptr (CFittedBondDiscountCurve')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))
 3056 
 3057 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlFittedBondDiscountCurveFittingMethodNumberOfIterations"
 3058   numberOfIterations'_ :: ((C2HSImp.Ptr (CFittedBondDiscountCurve')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CInt)))
 3059 
 3060 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlFittedBondDiscountCurveFittingMethodSize"
 3061   fittingMethodSize'_ :: ((C2HSImp.Ptr (CFittedBondDiscountCurve')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CUInt)))
 3062 
 3063 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlFittedBondDiscountCurveFittingMethodErrorCode"
 3064   fittingMethodErrorCodeRaw'_ :: ((C2HSImp.Ptr (CFittedBondDiscountCurve')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CInt)))
 3065 
 3066 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlFittedBondDiscountCurveFittingMethodSolution"
 3067   fittingMethodSolution'_ :: ((C2HSImp.Ptr (CFittedBondDiscountCurve')) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CDouble)) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO ())))))
 3068 
 3069 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlFittedBondDiscountCurveFittingMethodDiscount"
 3070   fittingMethodDiscount'_ :: ((C2HSImp.Ptr (CFittedBondDiscountCurve')) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble))))))
 3071 
 3072 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlRelinkableYieldTermStructure"
 3073   relinkableYieldTermStructure'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CRelinkableYieldTermStructure')))))
 3074 
 3075 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlRelinkableYieldTermStructureLinkTo"
 3076   linkTo'_ :: ((C2HSImp.Ptr (CRelinkableYieldTermStructure')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO ()))))
 3077 
 3078 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlMultiCurve"
 3079   multiCurve'_ :: (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CMultiCurve)))))
 3080 
 3081 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlMultiCurveAddBootstrappedCurve"
 3082   addBootstrappedCurve'_ :: ((C2HSImp.Ptr (CMultiCurve)) -> ((C2HSImp.Ptr (CRelinkableYieldTermStructure')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CYieldTermStructure')))))))
 3083 
 3084 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlMultiCurveAddNonBootstrappedCurve"
 3085   addNonBootstrappedCurve'_ :: ((C2HSImp.Ptr (CMultiCurve)) -> ((C2HSImp.Ptr (CRelinkableYieldTermStructure')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CYieldTermStructure')))))))
 3086 
 3087 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlImpliedTermStructureMoving"
 3088   impliedTermStructureMoving'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (CCalendar)) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CYieldTermStructure')))))))
 3089 
 3090 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlOvernightOvernightBasisSwapRateHelper"
 3091   overnightOvernightBasisSwapRateHelper'_ :: ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (COvernightIndex')) -> ((C2HSImp.Ptr (COvernightIndex')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CRateHelper')))))))))))))))))))))
 3092 
 3093 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlOvernightIndexedFundingRateHelperRaw"
 3094   overnightIndexedFundingRateHelperRaw'_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (COvernightIndex')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CRateHelper')))))))))))))))))))))