-- GENERATED by C->Haskell Compiler, version 0.28.8 Switcheroo, 25 November 2017 (Haskell)
-- Edit the ORIGNAL .chs file instead!


{-# LINE 1 "./QuantLib/TermStructure/Yield.chs" #-}
{-# LANGUAGE TemplateHaskell #-}
module QuantLib.TermStructure.Yield
  (
    -- * Types
    -- ** Curves and helpers
    GenYieldTermStructure
  , YieldTermStructure
  , RelinkableYieldTermStructure
  , FittedBondDiscountCurve
  , MultiCurve
  , GenRateHelper
  , RateHelper
  , BondHelper
  , SwapRateHelper
  , OISRateHelper
  , FuturesRateHelper
  , OvernightIndexFutureRateHelper

    -- ** Coordinates
  , Reference(..)
  , TermPoint(..)
  , RatePoint(..)

    -- ** Bootstrap and contract configuration
  , FittingMethod(..)
  , BootstrapTrait(..)
  , PillarChoice(..)
  , FuturesType(..)
  , FraTerms(..)
  , FuturesTerms(..)
  , OISRateHelperOpts(..)
  , OvernightObservation(..)
  , IterativeBootstrapOpts(..)
  , Bootstrap(..)
  , LocalBootstrapTrait(..)
  , SpreadBootstrap(..)

    -- * Constructors
    -- ** Hierarchy and handles
  , asYieldTermStructure
  , asRateHelper
  , relinkableYieldTermStructure
    -- ** Flat, fitted and derived curves
  , fittedBondDiscountCurve
  , flatForward
  , forwardSpreadedTermStructure
  , zeroSpreadedTermStructure
  , withCompositeZeroYieldStructure
  , impliedTermStructure
  , piecewiseZeroSpreadedTermStructure
  , piecewiseForwardSpreadedTermStructure
  , quantoTermStructure
  , ultimateForwardTermStructure
    -- ** Rate helpers
  , depositRateHelperFromIndex
  , depositRateHelper
  , fixedRateBondHelper
  , swapRateHelperFromConventions
  , fraRateHelper
  , bondHelper
  , oisRateHelper
  , oisRateHelperBetweenDates
  , defaultOisRateHelperOpts
  , defaultOvernightObservation
  , oisRateHelperWithOptions
  , oisRateHelperBetweenDatesWithOptions
  , swapRateHelper
  , bmaSwapRateHelper
  , multipleResetsSwapRateHelper
  , futuresRateHelper
  , overnightIndexFutureRateHelper
  , sofrFutureRateHelper
    -- ** Bootstrapped and interpolated curves
  , piecewiseYieldCurve
  , piecewiseSpreadYieldCurve
  , defaultIterativeBootstrapOpts
  , interpolatedZeroCurve
  , interpolatedSimpleZeroCurve
  , interpolatedForwardCurve
  , interpolatedDiscountCurve
  , interpolatedSpreadDiscountCurve
    -- ** Multi-curve bootstrapping
  , multiCurve
    -- ** Basis and cross-currency helpers
  , iborIborBasisSwapRateHelper
  , overnightIborBasisSwapRateHelper
  , constNotionalCrossCurrencyBasisSwapRateHelper
  , mtmCrossCurrencyBasisSwapRateHelper
  , constNotionalCrossCurrencySwapRateHelper
  , fxSwapRateHelper
  , fxSwapRateHelperBetweenDates

    -- * Mutators
  , linkTo
  , addBootstrappedCurve
  , addNonBootstrappedCurve

    -- * Inspectors
  , HasHelperUnderlying(..)
  , rateHelperFixingDependencies
  , forwardRate
  , forwardRateBetweenTimes
  , zeroRate
  , discount
  , impliedQuote
  , futuresRateHelperConvexityAdjustment
  , overnightIndexFutureRateHelperConvexityAdjustment
  , minimumCostValue
  , numberOfIterations
  , fittingMethodSize
  , fittingMethodErrorCode
  , fittingMethodSolution
  , fittingMethodDiscount
  ) where
import qualified Foreign.C.Types as C2HSImp
import qualified Foreign.ForeignPtr as C2HSImp
import qualified Foreign.Marshal.Utils as C2HSImp
import qualified Foreign.Ptr as C2HSImp


import QuantLib.Internal hiding(maxDate)
import QuantLib.Internal.Common
import QuantLib.Internal.Syntax(deriveOptionsRecord)
import Language.Haskell.TH(mkName)
import Language.Haskell.TH.Lib(varT)
import QuantLib.Math(EndCriteriaType(..))
import QuantLib.Quote hiding(linkTo)
import QuantLib.TermStructure (Reference(..), TermPoint(..), RatePoint(..), setExtrapolation, HasHelperUnderlying(..))
import Data.Maybe(fromMaybe)
import Data.List.NonEmpty(NonEmpty, toList)
import Foreign.Ptr(FunPtr, Ptr)
import Foreign.Marshal.Alloc(alloca)
import Foreign.Storable(peek)
import Foreign.C.Types(CInt, CUInt)
import qualified QuantLib.Instrument.Bond as Bond (BondPriceType)
import QuantLib.InterestRate(Compounding)
import QuantLib.CashFlow(RateAveragingType(..))
import QuantLib.Time.Calendar(calendar, CalendarConstructor(..))
import QuantLib.Internal.Type
import QuantLib.Time.Schedule(Frequency(..), DateGenerationRule(..))
import QuantLib.Time.Date(Month(..))







-- These local pointer declarations break import cycles while allowing c2hs to attach finalizers.

{-# LINE 144 "./QuantLib/TermStructure/Yield.chs" #-}


{-# LINE 145 "./QuantLib/TermStructure/Yield.chs" #-}


{-# LINE 146 "./QuantLib/TermStructure/Yield.chs" #-}


{-# LINE 147 "./QuantLib/TermStructure/Yield.chs" #-}


{-# LINE 148 "./QuantLib/TermStructure/Yield.chs" #-}


{-# LINE 149 "./QuantLib/TermStructure/Yield.chs" #-}


{-# LINE 150 "./QuantLib/TermStructure/Yield.chs" #-}


{-# LINE 151 "./QuantLib/TermStructure/Yield.chs" #-}


{-# LINE 152 "./QuantLib/TermStructure/Yield.chs" #-}


{-# LINE 153 "./QuantLib/TermStructure/Yield.chs" #-}


{-# LINE 154 "./QuantLib/TermStructure/Yield.chs" #-}


{-# LINE 155 "./QuantLib/TermStructure/Yield.chs" #-}


{-# LINE 156 "./QuantLib/TermStructure/Yield.chs" #-}


{-# LINE 157 "./QuantLib/TermStructure/Yield.chs" #-}


{-# LINE 158 "./QuantLib/TermStructure/Yield.chs" #-}


data BootstrapTrait = Discount
                    | ZeroYield
                    | ForwardRate
                    | SimpleZeroYield
  deriving (Enum,Show,Eq,Read)

{-# LINE 160 "./QuantLib/TermStructure/Yield.chs" #-}

data PillarChoice = MaturityDate
                  | LastRelevantDate
                  | CustomDate
  deriving (Enum,Show,Eq,Read)

{-# LINE 161 "./QuantLib/TermStructure/Yield.chs" #-}

data FuturesType = IMM
                 | ASX
                 | Custom
  deriving (Enum,Show,Eq,Read)

{-# LINE 162 "./QuantLib/TermStructure/Yield.chs" #-}


-- The optional calendars use 'Nothing' for QuantLib's null calendar because a concrete
-- 'Calendar' cannot occur in this pure default value. Keep this splice before every {#fun#}:
-- c2hs appends foreign imports to the generated module, and an intervening top-level splice
-- would split declarations from the imports their wrappers use.
$(deriveOptionsRecord "OISRateHelperOpts" ["m"]
  [ ("oisTelescopicValueDates", [t|Bool|], [|False|])
  , ("oisPaymentLag", [t|Int|], [|0|])
  , ("oisPaymentConvention", [t|BusinessDayConvention|], [|Following|])
  , ("oisPaymentFrequency", [t|Frequency|], [|Annual|])
  , ("oisPaymentCalendar", [t|Maybe Calendar|], [|Nothing|])
  , ("oisOvernightSpread", [t|Maybe (GenQuote $(varT (mkName "m")))|], [|Nothing|])
  , ("oisPillar", [t|PillarChoice|], [|LastRelevantDate|])
  , ("oisCustomPillarDate", [t|Maybe Day|], [|Nothing|])
  , ("oisAveragingMethod", [t|RateAveragingType|], [|AveragingCompound|])
  , ("oisEndOfMonth", [t|Maybe Bool|], [|Nothing|])
  , ("oisFixedPaymentFrequency", [t|Maybe Frequency|], [|Nothing|])
  , ("oisFixedCalendar", [t|Maybe Calendar|], [|Nothing|])
  , ("oisObservation", [t|OvernightObservation|], [|defaultOvernightObservation|])
  , ("oisPricer", [t|Maybe FloatingRateCouponPricer|], [|Nothing|])
  , ("oisRule", [t|DateGenerationRule|], [|Backward|])
  , ("oisOvernightCalendar", [t|Maybe Calendar|], [|Nothing|])
  , ("oisConvention", [t|BusinessDayConvention|], [|ModifiedFollowing|])
  ])

-- Upstream defaults accuracy/minValue/maxValue to Null<Real>() rather than to a number, so
-- those three are Maybe on the Haskell side; fromMaybeDouble supplies the sentinel, and the
-- {#fun#} specs below take a plain Double, hence the realToFrac.
nullableDouble :: Maybe Double -> Double
nullableDouble :: Maybe Double -> Double
nullableDouble = CDouble -> Double
forall a b. (Real a, Fractional b) => a -> b
realToFrac (CDouble -> Double)
-> (Maybe Double -> CDouble) -> Maybe Double -> Double
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Maybe Double -> CDouble
fromMaybeDouble

-- |Rate helper for bootstrapping over deposit rates, taking its conventions from an ibor index.
depositRateHelperFromIndex :: (GenQuote q) -> (GenIborIndex ibor) -> IO ((RateHelper))
depositRateHelperFromIndex :: forall q ibor. GenQuote q -> GenIborIndex ibor -> IO RateHelper
depositRateHelperFromIndex GenQuote q
a1 GenIborIndex ibor
a2 =
  GenQuote q -> (Ptr CQuote' -> IO RateHelper) -> IO RateHelper
forall q b. GenQuote q -> (Ptr CQuote' -> IO b) -> IO b
withQuote GenQuote q
a1 ((Ptr CQuote' -> IO RateHelper) -> IO RateHelper)
-> (Ptr CQuote' -> IO RateHelper) -> IO RateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr CQuote'
a1' -> 
  GenIborIndex ibor
-> (Ptr CIborIndex' -> IO RateHelper) -> IO RateHelper
forall ibor b.
GenIborIndex ibor -> (Ptr CIborIndex' -> IO b) -> IO b
withIborIndex GenIborIndex ibor
a2 ((Ptr CIborIndex' -> IO RateHelper) -> IO RateHelper)
-> (Ptr CIborIndex' -> IO RateHelper) -> IO RateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr CIborIndex'
a2' -> 
  (Ptr (Ptr CChar) -> IO RateHelper) -> IO RateHelper
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr CChar) -> IO RateHelper) -> IO RateHelper)
-> (Ptr (Ptr CChar) -> IO RateHelper) -> IO RateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr CChar)
a3' -> 
  Ptr CQuote'
-> Ptr CIborIndex' -> Ptr (Ptr CChar) -> IO (Ptr CRateHelper')
depositRateHelperFromIndex'_ Ptr CQuote'
a1' Ptr CIborIndex'
a2' Ptr (Ptr CChar)
a3' IO (Ptr CRateHelper')
-> (Ptr CRateHelper' -> IO RateHelper) -> IO RateHelper
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Ptr CRateHelper'
res ->
  Ptr CRateHelper' -> IO RateHelper
peekRateHelper Ptr CRateHelper'
res IO RateHelper -> (RateHelper -> IO RateHelper) -> IO RateHelper
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \RateHelper
res' ->
  Ptr (Ptr CChar) -> IO ()
errorCheck  Ptr (Ptr CChar)
a3'IO () -> IO RateHelper -> IO RateHelper
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
  RateHelper -> IO RateHelper
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (RateHelper
res')

{-# LINE 195 "./QuantLib/TermStructure/Yield.chs" #-}


-- |Rate helper for bootstrapping over deposit rates.
depositRateHelper :: (GenQuote q) -- ^rate
 -> ((Int,TimeUnit)) -- ^tenor
 -> (Word) -- ^fixingDays
 -> (Calendar) -- ^calendar
 -> (BusinessDayConvention) -- ^convention
 -> (Bool) -- ^endOfMonth
 -> (DayCounter) -> IO ((RateHelper))
depositRateHelper :: forall q.
GenQuote q
-> (Int, TimeUnit)
-> Word
-> Calendar
-> BusinessDayConvention
-> Bool
-> DayCounter
-> IO RateHelper
depositRateHelper GenQuote q
a1 (Int, TimeUnit)
a2 Word
a3 Calendar
a4 BusinessDayConvention
a5 Bool
a6 DayCounter
a7 =
  GenQuote q -> (Ptr CQuote' -> IO RateHelper) -> IO RateHelper
forall q b. GenQuote q -> (Ptr CQuote' -> IO b) -> IO b
withQuote GenQuote q
a1 ((Ptr CQuote' -> IO RateHelper) -> IO RateHelper)
-> (Ptr CQuote' -> IO RateHelper) -> IO RateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr CQuote'
a1' -> 
  let {(CInt
a2'1, CInt
a2'2) = (Int, TimeUnit) -> (CInt, CInt)
forall a b c.
(Enum a, Integral b, Integral c) =>
(b, a) -> (CInt, c)
fromEnumQuantity (Int, TimeUnit)
a2} in 
  let {a3' :: CUInt
a3' = Word -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word
a3} in 
  Calendar -> (Ptr CCalendar -> IO RateHelper) -> IO RateHelper
forall b. Calendar -> (Ptr CCalendar -> IO b) -> IO b
withCalendar Calendar
a4 ((Ptr CCalendar -> IO RateHelper) -> IO RateHelper)
-> (Ptr CCalendar -> IO RateHelper) -> IO RateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr CCalendar
a4' -> 
  let {a5' :: CInt
a5' = BusinessDayConvention -> CInt
forall a b. (Enum a, Integral b) => a -> b
fromEnumC BusinessDayConvention
a5} in 
  let {a6' :: CInt
a6' = Bool -> CInt
forall a. Num a => Bool -> a
C2HSImp.fromBool Bool
a6} in 
  DayCounter -> (Ptr CDayCounter -> IO RateHelper) -> IO RateHelper
forall b. DayCounter -> (Ptr CDayCounter -> IO b) -> IO b
withDayCounter DayCounter
a7 ((Ptr CDayCounter -> IO RateHelper) -> IO RateHelper)
-> (Ptr CDayCounter -> IO RateHelper) -> IO RateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr CDayCounter
a7' -> 
  (Ptr (Ptr CChar) -> IO RateHelper) -> IO RateHelper
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr CChar) -> IO RateHelper) -> IO RateHelper)
-> (Ptr (Ptr CChar) -> IO RateHelper) -> IO RateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr CChar)
a8' -> 
  Ptr CQuote'
-> CInt
-> CInt
-> CUInt
-> Ptr CCalendar
-> CInt
-> CInt
-> Ptr CDayCounter
-> Ptr (Ptr CChar)
-> IO (Ptr CRateHelper')
depositRateHelper'_ Ptr CQuote'
a1' CInt
a2'1  CInt
a2'2 CUInt
a3' Ptr CCalendar
a4' CInt
a5' CInt
a6' Ptr CDayCounter
a7' Ptr (Ptr CChar)
a8' IO (Ptr CRateHelper')
-> (Ptr CRateHelper' -> IO RateHelper) -> IO RateHelper
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Ptr CRateHelper'
res ->
  Ptr CRateHelper' -> IO RateHelper
peekRateHelper Ptr CRateHelper'
res IO RateHelper -> (RateHelper -> IO RateHelper) -> IO RateHelper
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \RateHelper
res' ->
  Ptr (Ptr CChar) -> IO ()
errorCheck  Ptr (Ptr CChar)
a8'IO () -> IO RateHelper -> IO RateHelper
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
  RateHelper -> IO RateHelper
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (RateHelper
res')

{-# LINE 204 "./QuantLib/TermStructure/Yield.chs" #-}


-- |Fixed-coupon bond helper for curve bootstrap: builds the underlying bond internally from a
-- schedule and coupons (unlike 'bondHelper', which takes an existing 'Bond').
fixedRateBondHelper :: (GenQuote q) -> (Word) -- ^settlementDays
 -> (Double) -- ^faceAmount
 -> (Schedule) -> (NonEmpty Double) -- ^coupons
 -> (DayCounter) -> (BusinessDayConvention) -- ^paymentConvention
 -> (Double) -- ^redemption
 -> (Maybe Day) -- ^issueDate
 -> IO ((BondHelper))
fixedRateBondHelper a1 a2 a3 a4 a5 a6 a7 a8 a9 =
  withQuote a1 $ \a1' -> 
  let {a2' = fromIntegral a2} in 
  let {a3' = realToFrac a3} in 
  withSchedule a4 $ \a4' -> 
  withNonEmptyDoubleArray a5 $ \(a5'1, a5'2) -> 
  withDayCounter a6 $ \a6' -> 
  let {a7' = fromEnumC a7} in 
  let {a8' = realToFrac a8} in 
  withMaybeDay a9 $ \a9' -> 
  preErrorCheck $ \a10' -> 
  fixedRateBondHelper'_ a1' a2' a3' a4' a5'1  a5'2 a6' a7' a8' a9' a10' >>= \res ->
  peekBondHelper res >>= \res' ->
  errorCheck  a10'>>
  return (res')

{-# LINE 214 "./QuantLib/TermStructure/Yield.chs" #-}


discountAtDateRaw :: (GenYieldTermStructure y) -> (Day) -- ^d
 -> (Bool) -- ^extrapolate
 -> IO ((Double))
discountAtDateRaw a1 a2 a3 =
  withYieldTermStructure a1 $ \a1' -> 
  withDay a2 $ \a2' -> 
  let {a3' = C2HSImp.fromBool a3} in 
  preErrorCheck $ \a4' -> 
  discountAtDateRaw'_ a1' a2' a3' a4' >>= \res ->
  let {res' = realToFrac res} in
  errorCheck  a4'>>
  return (res')

{-# LINE 219 "./QuantLib/TermStructure/Yield.chs" #-}


-- |Rate helper for bootstrapping over swap rates, built from explicit tenor\/calendar\/
-- frequency\/day-count\/index conventions rather than a 'GenSwapIndex' bundling them
-- (as 'swapRateHelper' does).
swapRateHelperFromConventions :: (GenQuote q1) -- ^rate
 -> ((Int,TimeUnit)) -- ^tenor
 -> (Calendar) -- ^calendar
 -> (Frequency) -- ^fixedFrequency
 -> (BusinessDayConvention) -- ^fixedConvention
 -> (DayCounter) -- ^fixedDayCount
 -> (GenIborIndex ibor) -- ^iborIndex
 -> (Maybe (GenQuote q2)) -- ^spread
 -> ((Int,TimeUnit)) -- ^fwdStart
 -> (Maybe (GenYieldTermStructure y)) -- ^discountingCurve
 -> (Maybe Word) -- ^settlementDays
 -> (PillarChoice) -- ^pillar
 -> (Maybe Day) -- ^customPillarDate
 -> (Bool) -- ^endOfMonth
 -> (Maybe Bool) -- ^useIndexedCoupons
 -> (Maybe BusinessDayConvention) -- ^floatConvention
 -> (Maybe FloatingRateCouponPricer) -- ^couponPricer
 -> IO ((SwapRateHelper))
swapRateHelperFromConventions :: forall q1 ibor q2 y.
GenQuote q1
-> (Int, TimeUnit)
-> Calendar
-> Frequency
-> BusinessDayConvention
-> DayCounter
-> GenIborIndex ibor
-> Maybe (GenQuote q2)
-> (Int, TimeUnit)
-> Maybe (GenYieldTermStructure y)
-> Maybe Word
-> PillarChoice
-> Maybe Day
-> Bool
-> Maybe Bool
-> Maybe BusinessDayConvention
-> Maybe FloatingRateCouponPricer
-> IO SwapRateHelper
swapRateHelperFromConventions GenQuote q1
a1 (Int, TimeUnit)
a2 Calendar
a3 Frequency
a4 BusinessDayConvention
a5 DayCounter
a6 GenIborIndex ibor
a7 Maybe (GenQuote q2)
a8 (Int, TimeUnit)
a9 Maybe (GenYieldTermStructure y)
a10 Maybe Word
a11 PillarChoice
a12 Maybe Day
a13 Bool
a14 Maybe Bool
a15 Maybe BusinessDayConvention
a16 Maybe FloatingRateCouponPricer
a17 =
  GenQuote q1
-> (Ptr CQuote' -> IO SwapRateHelper) -> IO SwapRateHelper
forall q b. GenQuote q -> (Ptr CQuote' -> IO b) -> IO b
withQuote GenQuote q1
a1 ((Ptr CQuote' -> IO SwapRateHelper) -> IO SwapRateHelper)
-> (Ptr CQuote' -> IO SwapRateHelper) -> IO SwapRateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr CQuote'
a1' -> 
  let {(CInt
a2'1, CInt
a2'2) = (Int, TimeUnit) -> (CInt, CInt)
forall a b c.
(Enum a, Integral b, Integral c) =>
(b, a) -> (CInt, c)
fromEnumQuantity (Int, TimeUnit)
a2} in 
  Calendar
-> (Ptr CCalendar -> IO SwapRateHelper) -> IO SwapRateHelper
forall b. Calendar -> (Ptr CCalendar -> IO b) -> IO b
withCalendar Calendar
a3 ((Ptr CCalendar -> IO SwapRateHelper) -> IO SwapRateHelper)
-> (Ptr CCalendar -> IO SwapRateHelper) -> IO SwapRateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr CCalendar
a3' -> 
  let {a4' :: CInt
a4' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Frequency -> Int) -> Frequency -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Frequency -> Int
forall a. Enum a => a -> Int
fromEnum) Frequency
a4} in 
  let {a5' :: CInt
a5' = BusinessDayConvention -> CInt
forall a b. (Enum a, Integral b) => a -> b
fromEnumC BusinessDayConvention
a5} in 
  DayCounter
-> (Ptr CDayCounter -> IO SwapRateHelper) -> IO SwapRateHelper
forall b. DayCounter -> (Ptr CDayCounter -> IO b) -> IO b
withDayCounter DayCounter
a6 ((Ptr CDayCounter -> IO SwapRateHelper) -> IO SwapRateHelper)
-> (Ptr CDayCounter -> IO SwapRateHelper) -> IO SwapRateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr CDayCounter
a6' -> 
  GenIborIndex ibor
-> (Ptr CIborIndex' -> IO SwapRateHelper) -> IO SwapRateHelper
forall ibor b.
GenIborIndex ibor -> (Ptr CIborIndex' -> IO b) -> IO b
withIborIndex GenIborIndex ibor
a7 ((Ptr CIborIndex' -> IO SwapRateHelper) -> IO SwapRateHelper)
-> (Ptr CIborIndex' -> IO SwapRateHelper) -> IO SwapRateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr CIborIndex'
a7' -> 
  Maybe (GenQuote q2)
-> (Ptr CQuote' -> IO SwapRateHelper) -> IO SwapRateHelper
forall q b. Maybe (GenQuote q) -> (Ptr CQuote' -> IO b) -> IO b
withMaybeQuote Maybe (GenQuote q2)
a8 ((Ptr CQuote' -> IO SwapRateHelper) -> IO SwapRateHelper)
-> (Ptr CQuote' -> IO SwapRateHelper) -> IO SwapRateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr CQuote'
a8' -> 
  let {(CInt
a9'1, CInt
a9'2) = (Int, TimeUnit) -> (CInt, CInt)
forall a b c.
(Enum a, Integral b, Integral c) =>
(b, a) -> (CInt, c)
fromEnumQuantity (Int, TimeUnit)
a9} in 
  Maybe (GenYieldTermStructure y)
-> (Ptr CYieldTermStructure' -> IO SwapRateHelper)
-> IO SwapRateHelper
forall y b.
Maybe (GenYieldTermStructure y)
-> (Ptr CYieldTermStructure' -> IO b) -> IO b
withMaybeYieldTermStructure Maybe (GenYieldTermStructure y)
a10 ((Ptr CYieldTermStructure' -> IO SwapRateHelper)
 -> IO SwapRateHelper)
-> (Ptr CYieldTermStructure' -> IO SwapRateHelper)
-> IO SwapRateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr CYieldTermStructure'
a10' -> 
  let {a11' :: CUInt
a11' = Maybe Word -> CUInt
forall a b. (Integral a, Integral b) => Maybe a -> b
fromMaybeInt Maybe Word
a11} in 
  let {a12' :: CInt
a12' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (PillarChoice -> Int) -> PillarChoice -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. PillarChoice -> Int
forall a. Enum a => a -> Int
fromEnum) PillarChoice
a12} in 
  withMaybeDay a13 $ \a13' -> 
  let {a14' = C2HSImp.fromBool a14} in 
  let {a15' = fromMaybeBool a15} in 
  let {a16' = fromMaybeEnum a16} in 
  withMaybeFloatingRateCouponPricer a17 $ \a17' -> 
  preErrorCheck $ \a18' -> 
  swapRateHelperFromConventions'_ 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 ->
  peekSwapRateHelper res >>= \res' ->
  errorCheck  a18'>>
  return (res')

{-# LINE 241 "./QuantLib/TermStructure/Yield.chs" #-}


-- |Flat interest-rate curve with either a fixed or evaluation-date-relative reference point.
flatForward :: Reference -> GenQuote q -> DayCounter -> Compounding -> Frequency
  -> IO YieldTermStructure
flatForward (ReferenceDate d) = flatForwardFixed d
flatForward (SettlementDays n cal) = flatForwardMovingRaw n cal
flatForwardFixed :: (Day) -> (GenQuote q) -> (DayCounter) -> (Compounding) -> (Frequency) -> IO ((YieldTermStructure))
flatForwardFixed a1 a2 a3 a4 a5 =
  withDay a1 $ \a1' -> 
  withQuote a2 $ \a2' -> 
  withDayCounter a3 $ \a3' -> 
  let {a4' = (fromIntegral . fromEnum) a4} in 
  let {a5' = (fromIntegral . fromEnum) a5} in 
  preErrorCheck $ \a6' -> 
  flatForwardFixed'_ a1' a2' a3' a4' a5' a6' >>= \res ->
  peekYieldTermStructure res >>= \res' ->
  errorCheck  a6'>>
  return (res')

{-# LINE 248 "./QuantLib/TermStructure/Yield.chs" #-}

flatForwardMovingRaw :: (Word) -- ^settlementDays
 -> (Calendar) -> (GenQuote q) -> (DayCounter) -> (Compounding) -> (Frequency) -> IO ((YieldTermStructure))
flatForwardMovingRaw a1 a2 a3 a4 a5 a6 =
  let {a1' = fromIntegral a1} in 
  withCalendar a2 $ \a2' -> 
  withQuote a3 $ \a3' -> 
  withDayCounter a4 $ \a4' -> 
  let {a5' = (fromIntegral . fromEnum) a5} in 
  let {a6' = (fromIntegral . fromEnum) a6} in 
  preErrorCheck $ \a7' -> 
  flatForwardMovingRaw'_ a1' a2' a3' a4' a5' a6' a7' >>= \res ->
  peekYieldTermStructure res >>= \res' ->
  errorCheck  a7'>>
  return (res')

{-# LINE 250 "./QuantLib/TermStructure/Yield.chs" #-}


-- |The zero rate at a date or year-fraction coordinate.
zeroRate :: GenYieldTermStructure y -> RatePoint -> Compounding -> Frequency -> Bool
  -> IO InterestRate
zeroRate curve point = case point of
  RateAtDate d dc -> zeroRateAtDateRaw curve d dc
  RateAtTime t -> zeroRateAtTimeRaw curve t

zeroRateAtDateRaw :: (GenYieldTermStructure y) -> (Day) -> (DayCounter) -> (Compounding) -> (Frequency) -> (Bool) -- ^extrapolate
 -> IO ((InterestRate))
zeroRateAtDateRaw a1 a2 a3 a4 a5 a6 =
  withYieldTermStructure a1 $ \a1' -> 
  withDay a2 $ \a2' -> 
  withDayCounter a3 $ \a3' -> 
  let {a4' = (fromIntegral . fromEnum) a4} in 
  let {a5' = (fromIntegral . fromEnum) a5} in 
  let {a6' = C2HSImp.fromBool a6} in 
  preErrorCheck $ \a7' -> 
  zeroRateAtDateRaw'_ a1' a2' a3' a4' a5' a6' a7' >>= \res ->
  peekInterestRate res >>= \res' ->
  errorCheck  a7'>>
  return (res')

{-# LINE 261 "./QuantLib/TermStructure/Yield.chs" #-}


-- |The forward rate between two dates, in the given day-counting rule.
-- /Warning/ Dates are not adjusted for holidays.
forwardRate :: (GenYieldTermStructure y) -> (Day) -> (Day) -> (DayCounter) -> (Compounding) -> (Frequency) -> (Bool) -- ^extrapolate
 -> IO ((InterestRate))
forwardRate a1 a2 a3 a4 a5 a6 a7 =
  withYieldTermStructure a1 $ \a1' -> 
  withDay a2 $ \a2' -> 
  withDay a3 $ \a3' -> 
  withDayCounter a4 $ \a4' -> 
  let {a5' = (fromIntegral . fromEnum) a5} in 
  let {a6' = (fromIntegral . fromEnum) a6} in 
  let {a7' = C2HSImp.fromBool a7} in 
  preErrorCheck $ \a8' -> 
  forwardRate'_ a1' a2' a3' a4' a5' a6' a7' a8' >>= \res ->
  peekInterestRate res >>= \res' ->
  errorCheck  a8'>>
  return (res')

{-# LINE 267 "./QuantLib/TermStructure/Yield.chs" #-}


-- |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.
forwardRateBetweenTimes :: (GenYieldTermStructure y) -> (Double) -> (Double) -> (Compounding) -> (Frequency) -> (Bool) -- ^extrapolate
 -> IO ((InterestRate))
forwardRateBetweenTimes a1 a2 a3 a4 a5 a6 =
  withYieldTermStructure a1 $ \a1' -> 
  let {a2' = realToFrac a2} in 
  let {a3' = realToFrac a3} in 
  let {a4' = (fromIntegral . fromEnum) a4} in 
  let {a5' = (fromIntegral . fromEnum) a5} in 
  let {a6' = C2HSImp.fromBool a6} in 
  preErrorCheck $ \a7' -> 
  forwardRateBetweenTimes'_ a1' a2' a3' a4' a5' a6' a7' >>= \res ->
  peekInterestRate res >>= \res' ->
  errorCheck  a7'>>
  return (res')

{-# LINE 272 "./QuantLib/TermStructure/Yield.chs" #-}


-- |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.
zeroRateAtTimeRaw :: (GenYieldTermStructure y) -> (Double) -> (Compounding) -> (Frequency) -> (Bool) -- ^extrapolate
 -> IO ((InterestRate))
zeroRateAtTimeRaw a1 a2 a3 a4 a5 =
  withYieldTermStructure a1 $ \a1' -> 
  let {a2' = realToFrac a2} in 
  let {a3' = (fromIntegral . fromEnum) a3} in 
  let {a4' = (fromIntegral . fromEnum) a4} in 
  let {a5' = C2HSImp.fromBool a5} in 
  preErrorCheck $ \a6' -> 
  zeroRateAtTimeRaw'_ a1' a2' a3' a4' a5' a6' >>= \res ->
  peekInterestRate res >>= \res' ->
  errorCheck  a6'>>
  return (res')

{-# LINE 276 "./QuantLib/TermStructure/Yield.chs" #-}


-- |Returns a discount factor at a date or year-fraction coordinate.
discount :: GenYieldTermStructure y -> TermPoint -> Bool -> IO Double
discount curve point = case point of
  DatePoint d -> discountAtDateRaw curve d
  TimePoint t -> discountAtTimeRaw curve t

-- |The same day-counting rule used by the term structure should be used for calculating the passed time t.
discountAtTimeRaw :: (GenYieldTermStructure y) -> (Double) -> (Bool) -- ^extrapolate
 -> IO ((Double))
discountAtTimeRaw a1 a2 a3 =
  withYieldTermStructure a1 $ \a1' -> 
  let {a2' = realToFrac a2} in 
  let {a3' = C2HSImp.fromBool a3} in 
  preErrorCheck $ \a4' -> 
  discountAtTimeRaw'_ a1' a2' a3' a4' >>= \res ->
  let {res' = realToFrac res} in
  errorCheck  a4'>>
  return (res')

{-# LINE 286 "./QuantLib/TermStructure/Yield.chs" #-}


-- |How a FRA's period and fixing conventions are given. The @FromIndex@ variants take the
-- FRA's length and its calendar\/convention\/day-count from the ibor index; the others state
-- them explicitly.
data FraTerms ibor
  = FraMonths
      !Word -- ^monthsToStart
      !Word -- ^monthsToEnd
      !Word -- ^fixingDays
      !Calendar
      !BusinessDayConvention
      !Bool -- ^endOfMonth
      !DayCounter
  | FraMonthsFromIndex
      !Word -- ^monthsToStart
      !(GenIborIndex ibor)
  | FraPeriod
      !(Int, TimeUnit) -- ^periodToStart
      !Word -- ^lengthInMonths
      !Word -- ^fixingDays
      !Calendar
      !BusinessDayConvention
      !Bool -- ^endOfMonth
      !DayCounter
  | FraPeriodFromIndex
      !(Int, TimeUnit) -- ^periodToStart
      !(GenIborIndex ibor)

-- |Rate helper for bootstrapping over FRA rates.
fraRateHelper :: GenQuote q
  -> FraTerms ibor
  -> PillarChoice -- ^pillar
  -> Maybe Day -- ^customPillarDate
  -> Bool -- ^useIndexedCoupon
  -> IO RateHelper
fraRateHelper :: forall q ibor.
GenQuote q
-> FraTerms ibor
-> PillarChoice
-> Maybe Day
-> Bool
-> IO RateHelper
fraRateHelper GenQuote q
rate FraTerms ibor
terms = case FraTerms ibor
terms of
  FraMonths Word
s Word
e Word
fd Calendar
cal BusinessDayConvention
conv Bool
eom DayCounter
dc -> GenQuote q
-> Word
-> Word
-> Word
-> Calendar
-> BusinessDayConvention
-> Bool
-> DayCounter
-> PillarChoice
-> Maybe Day
-> Bool
-> IO RateHelper
forall q.
GenQuote q
-> Word
-> Word
-> Word
-> Calendar
-> BusinessDayConvention
-> Bool
-> DayCounter
-> PillarChoice
-> Maybe Day
-> Bool
-> IO RateHelper
fraRateHelperRaw GenQuote q
rate Word
s Word
e Word
fd Calendar
cal BusinessDayConvention
conv Bool
eom DayCounter
dc
  FraMonthsFromIndex Word
s GenIborIndex ibor
idx -> GenQuote q
-> Word
-> GenIborIndex ibor
-> PillarChoice
-> Maybe Day
-> Bool
-> IO RateHelper
forall q ibor.
GenQuote q
-> Word
-> GenIborIndex ibor
-> PillarChoice
-> Maybe Day
-> Bool
-> IO RateHelper
fraRateHelperFromIndexRaw GenQuote q
rate Word
s GenIborIndex ibor
idx
  FraPeriod (Int, TimeUnit)
p Word
n Word
fd Calendar
cal BusinessDayConvention
conv Bool
eom DayCounter
dc -> GenQuote q
-> (Int, TimeUnit)
-> Word
-> Word
-> Calendar
-> BusinessDayConvention
-> Bool
-> DayCounter
-> PillarChoice
-> Maybe Day
-> Bool
-> IO RateHelper
forall q.
GenQuote q
-> (Int, TimeUnit)
-> Word
-> Word
-> Calendar
-> BusinessDayConvention
-> Bool
-> DayCounter
-> PillarChoice
-> Maybe Day
-> Bool
-> IO RateHelper
fraRateHelperFromPeriodRaw GenQuote q
rate (Int, TimeUnit)
p Word
n Word
fd Calendar
cal BusinessDayConvention
conv Bool
eom DayCounter
dc
  FraPeriodFromIndex (Int, TimeUnit)
p GenIborIndex ibor
idx -> GenQuote q
-> (Int, TimeUnit)
-> GenIborIndex ibor
-> PillarChoice
-> Maybe Day
-> Bool
-> IO RateHelper
forall q ibor.
GenQuote q
-> (Int, TimeUnit)
-> GenIborIndex ibor
-> PillarChoice
-> Maybe Day
-> Bool
-> IO RateHelper
fraIborRateHelperRaw GenQuote q
rate (Int, TimeUnit)
p GenIborIndex ibor
idx

fraRateHelperRaw :: (GenQuote q) -- ^rate
 -> (Word) -- ^monthsToStart
 -> (Word) -- ^monthsToEnd
 -> (Word) -- ^fixingDays
 -> (Calendar) -- ^calendar
 -> (BusinessDayConvention) -- ^convention
 -> (Bool) -- ^endOfMonth
 -> (DayCounter) -> (PillarChoice) -- ^pillar
 -> (Maybe Day) -- ^customPillarDate
 -> (Bool) -- ^useIndexedCoupon
 -> IO ((RateHelper))
fraRateHelperRaw :: forall q.
GenQuote q
-> Word
-> Word
-> Word
-> Calendar
-> BusinessDayConvention
-> Bool
-> DayCounter
-> PillarChoice
-> Maybe Day
-> Bool
-> IO RateHelper
fraRateHelperRaw GenQuote q
a1 Word
a2 Word
a3 Word
a4 Calendar
a5 BusinessDayConvention
a6 Bool
a7 DayCounter
a8 PillarChoice
a9 Maybe Day
a10 Bool
a11 =
  GenQuote q -> (Ptr CQuote' -> IO RateHelper) -> IO RateHelper
forall q b. GenQuote q -> (Ptr CQuote' -> IO b) -> IO b
withQuote GenQuote q
a1 ((Ptr CQuote' -> IO RateHelper) -> IO RateHelper)
-> (Ptr CQuote' -> IO RateHelper) -> IO RateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr CQuote'
a1' -> 
  let {a2' :: CUInt
a2' = Word -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word
a2} in 
  let {a3' :: CUInt
a3' = Word -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word
a3} in 
  let {a4' :: CUInt
a4' = Word -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word
a4} in 
  Calendar -> (Ptr CCalendar -> IO RateHelper) -> IO RateHelper
forall b. Calendar -> (Ptr CCalendar -> IO b) -> IO b
withCalendar Calendar
a5 ((Ptr CCalendar -> IO RateHelper) -> IO RateHelper)
-> (Ptr CCalendar -> IO RateHelper) -> IO RateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr CCalendar
a5' -> 
  let {a6' :: CInt
a6' = BusinessDayConvention -> CInt
forall a b. (Enum a, Integral b) => a -> b
fromEnumC BusinessDayConvention
a6} in 
  let {a7' :: CInt
a7' = Bool -> CInt
forall a. Num a => Bool -> a
C2HSImp.fromBool Bool
a7} in 
  DayCounter -> (Ptr CDayCounter -> IO RateHelper) -> IO RateHelper
forall b. DayCounter -> (Ptr CDayCounter -> IO b) -> IO b
withDayCounter DayCounter
a8 ((Ptr CDayCounter -> IO RateHelper) -> IO RateHelper)
-> (Ptr CDayCounter -> IO RateHelper) -> IO RateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr CDayCounter
a8' -> 
  let {a9' :: CInt
a9' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (PillarChoice -> Int) -> PillarChoice -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. PillarChoice -> Int
forall a. Enum a => a -> Int
fromEnum) PillarChoice
a9} in 
  Maybe Day -> (CInt -> IO RateHelper) -> IO RateHelper
forall a. Maybe Day -> (CInt -> IO a) -> IO a
withMaybeDay Maybe Day
a10 ((CInt -> IO RateHelper) -> IO RateHelper)
-> (CInt -> IO RateHelper) -> IO RateHelper
forall a b. (a -> b) -> a -> b
$ \CInt
a10' -> 
  let {a11' :: CInt
a11' = Bool -> CInt
forall a. Num a => Bool -> a
C2HSImp.fromBool Bool
a11} in 
  (Ptr (Ptr CChar) -> IO RateHelper) -> IO RateHelper
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr CChar) -> IO RateHelper) -> IO RateHelper)
-> (Ptr (Ptr CChar) -> IO RateHelper) -> IO RateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr CChar)
a12' -> 
  Ptr CQuote'
-> CUInt
-> CUInt
-> CUInt
-> Ptr CCalendar
-> CInt
-> CInt
-> Ptr CDayCounter
-> CInt
-> CInt
-> CInt
-> Ptr (Ptr CChar)
-> IO (Ptr CRateHelper')
fraRateHelperRaw'_ Ptr CQuote'
a1' CUInt
a2' CUInt
a3' CUInt
a4' Ptr CCalendar
a5' CInt
a6' CInt
a7' Ptr CDayCounter
a8' CInt
a9' CInt
a10' CInt
a11' Ptr (Ptr CChar)
a12' IO (Ptr CRateHelper')
-> (Ptr CRateHelper' -> IO RateHelper) -> IO RateHelper
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Ptr CRateHelper'
res ->
  Ptr CRateHelper' -> IO RateHelper
peekRateHelper Ptr CRateHelper'
res IO RateHelper -> (RateHelper -> IO RateHelper) -> IO RateHelper
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \RateHelper
res' ->
  Ptr (Ptr CChar) -> IO ()
errorCheck  Ptr (Ptr CChar)
a12'IO () -> IO RateHelper -> IO RateHelper
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
  RateHelper -> IO RateHelper
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (RateHelper
res')

{-# LINE 339 "./QuantLib/TermStructure/Yield.chs" #-}


-- |Bootstrapping helper for an ibor-ibor basis swap: pays @baseIndex + basis@, receives
-- @otherIndex@. Pass @bootstrapBaseCurve = True@ (with 'otherIndex' carrying a forecast curve)
-- to bootstrap the forecast curve for 'baseIndex', or 'False' (with 'baseIndex' carrying a
-- forecast curve) to bootstrap the forecast curve for 'otherIndex'. An exogenous discount curve
-- is always required.
iborIborBasisSwapRateHelper :: (GenQuote q) -- ^basis
 -> ((Int,TimeUnit)) -- ^tenor
 -> (Word) -- ^settlementDays
 -> (Calendar) -- ^calendar
 -> (BusinessDayConvention) -- ^convention
 -> (Bool) -- ^endOfMonth
 -> (GenIborIndex ibor1) -- ^baseIndex
 -> (GenIborIndex ibor2) -- ^otherIndex
 -> (GenYieldTermStructure y) -- ^discountHandle
 -> (Bool) -- ^bootstrapBaseCurve
 -> IO ((RateHelper))
iborIborBasisSwapRateHelper :: forall q ibor1 ibor2 y.
GenQuote q
-> (Int, TimeUnit)
-> Word
-> Calendar
-> BusinessDayConvention
-> Bool
-> GenIborIndex ibor1
-> GenIborIndex ibor2
-> GenYieldTermStructure y
-> Bool
-> IO RateHelper
iborIborBasisSwapRateHelper GenQuote q
a1 (Int, TimeUnit)
a2 Word
a3 Calendar
a4 BusinessDayConvention
a5 Bool
a6 GenIborIndex ibor1
a7 GenIborIndex ibor2
a8 GenYieldTermStructure y
a9 Bool
a10 =
  GenQuote q -> (Ptr CQuote' -> IO RateHelper) -> IO RateHelper
forall q b. GenQuote q -> (Ptr CQuote' -> IO b) -> IO b
withQuote GenQuote q
a1 ((Ptr CQuote' -> IO RateHelper) -> IO RateHelper)
-> (Ptr CQuote' -> IO RateHelper) -> IO RateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr CQuote'
a1' -> 
  let {(CInt
a2'1, CInt
a2'2) = (Int, TimeUnit) -> (CInt, CInt)
forall a b c.
(Enum a, Integral b, Integral c) =>
(b, a) -> (CInt, c)
fromEnumQuantity (Int, TimeUnit)
a2} in 
  let {a3' :: CUInt
a3' = Word -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word
a3} in 
  Calendar -> (Ptr CCalendar -> IO RateHelper) -> IO RateHelper
forall b. Calendar -> (Ptr CCalendar -> IO b) -> IO b
withCalendar Calendar
a4 ((Ptr CCalendar -> IO RateHelper) -> IO RateHelper)
-> (Ptr CCalendar -> IO RateHelper) -> IO RateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr CCalendar
a4' -> 
  let {a5' :: CInt
a5' = BusinessDayConvention -> CInt
forall a b. (Enum a, Integral b) => a -> b
fromEnumC BusinessDayConvention
a5} in 
  let {a6' :: CInt
a6' = Bool -> CInt
forall a. Num a => Bool -> a
C2HSImp.fromBool Bool
a6} in 
  GenIborIndex ibor1
-> (Ptr CIborIndex' -> IO RateHelper) -> IO RateHelper
forall ibor b.
GenIborIndex ibor -> (Ptr CIborIndex' -> IO b) -> IO b
withIborIndex GenIborIndex ibor1
a7 ((Ptr CIborIndex' -> IO RateHelper) -> IO RateHelper)
-> (Ptr CIborIndex' -> IO RateHelper) -> IO RateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr CIborIndex'
a7' -> 
  GenIborIndex ibor2
-> (Ptr CIborIndex' -> IO RateHelper) -> IO RateHelper
forall ibor b.
GenIborIndex ibor -> (Ptr CIborIndex' -> IO b) -> IO b
withIborIndex GenIborIndex ibor2
a8 ((Ptr CIborIndex' -> IO RateHelper) -> IO RateHelper)
-> (Ptr CIborIndex' -> IO RateHelper) -> IO RateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr CIborIndex'
a8' -> 
  GenYieldTermStructure y
-> (Ptr CYieldTermStructure' -> IO RateHelper) -> IO RateHelper
forall y b.
GenYieldTermStructure y
-> (Ptr CYieldTermStructure' -> IO b) -> IO b
withYieldTermStructure GenYieldTermStructure y
a9 ((Ptr CYieldTermStructure' -> IO RateHelper) -> IO RateHelper)
-> (Ptr CYieldTermStructure' -> IO RateHelper) -> IO RateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr CYieldTermStructure'
a9' -> 
  let {a10' :: CInt
a10' = Bool -> CInt
forall a. Num a => Bool -> a
C2HSImp.fromBool Bool
a10} in 
  (Ptr (Ptr CChar) -> IO RateHelper) -> IO RateHelper
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr CChar) -> IO RateHelper) -> IO RateHelper)
-> (Ptr (Ptr CChar) -> IO RateHelper) -> IO RateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr CChar)
a11' -> 
  Ptr CQuote'
-> CInt
-> CInt
-> CUInt
-> Ptr CCalendar
-> CInt
-> CInt
-> Ptr CIborIndex'
-> Ptr CIborIndex'
-> Ptr CYieldTermStructure'
-> CInt
-> Ptr (Ptr CChar)
-> IO (Ptr CRateHelper')
iborIborBasisSwapRateHelper'_ Ptr CQuote'
a1' CInt
a2'1  CInt
a2'2 CUInt
a3' Ptr CCalendar
a4' CInt
a5' CInt
a6' Ptr CIborIndex'
a7' Ptr CIborIndex'
a8' Ptr CYieldTermStructure'
a9' CInt
a10' Ptr (Ptr CChar)
a11' IO (Ptr CRateHelper')
-> (Ptr CRateHelper' -> IO RateHelper) -> IO RateHelper
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Ptr CRateHelper'
res ->
  Ptr CRateHelper' -> IO RateHelper
peekRateHelper Ptr CRateHelper'
res IO RateHelper -> (RateHelper -> IO RateHelper) -> IO RateHelper
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \RateHelper
res' ->
  Ptr (Ptr CChar) -> IO ()
errorCheck  Ptr (Ptr CChar)
a11'IO () -> IO RateHelper -> IO RateHelper
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
  RateHelper -> IO RateHelper
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (RateHelper
res')

{-# LINE 356 "./QuantLib/TermStructure/Yield.chs" #-}


-- |Bootstrapping helper for an overnight-ibor basis swap: pays @baseIndex + basis@, receives
-- @otherIndex@. Bootstraps the forecast curve for 'otherIndex'; 'baseIndex' needs an existing
-- forecast curve. If 'Nothing', the overnight index's own curve is used as the discount curve.
overnightIborBasisSwapRateHelper :: (GenQuote q) -- ^basis
 -> ((Int,TimeUnit)) -- ^tenor
 -> (Word) -- ^settlementDays
 -> (Calendar) -- ^calendar
 -> (BusinessDayConvention) -- ^convention
 -> (Bool) -- ^endOfMonth
 -> (OvernightIborIndex) -- ^baseIndex
 -> (GenIborIndex ibor) -- ^otherIndex
 -> (Maybe (GenYieldTermStructure y)) -- ^discountHandle
 -> IO ((RateHelper))
overnightIborBasisSwapRateHelper a1 a2 a3 a4 a5 a6 a7 a8 a9 =
  withQuote a1 $ \a1' -> 
  let {(a2'1, a2'2) = fromEnumQuantity a2} in 
  let {a3' = fromIntegral a3} in 
  withCalendar a4 $ \a4' -> 
  let {a5' = fromEnumC a5} in 
  let {a6' = C2HSImp.fromBool a6} in 
  withOvernightIborIndex a7 $ \a7' -> 
  withIborIndex a8 $ \a8' -> 
  withMaybeYieldTermStructure a9 $ \a9' -> 
  preErrorCheck $ \a10' -> 
  overnightIborBasisSwapRateHelper'_ a1' a2'1  a2'2 a3' a4' a5' a6' a7' a8' a9' a10' >>= \res ->
  peekRateHelper res >>= \res' ->
  errorCheck  a10'>>
  return (res')

{-# LINE 370 "./QuantLib/TermStructure/Yield.chs" #-}


-- |Bootstrapping helper for a constant-notional cross-currency basis swap: the collateral is
-- paid in the quote currency, the basis is given on the base-currency leg. 'Nothing' for either
-- frequency parameter derives the corresponding leg's schedule from its index tenor (or, for the
-- quote-currency leg, falls back to the base-currency frequency if that is given).
constNotionalCrossCurrencyBasisSwapRateHelper :: (GenQuote q) -- ^basis
 -> ((Int,TimeUnit)) -- ^tenor
 -> (Word) -- ^fixingDays
 -> (Calendar) -- ^calendar
 -> (BusinessDayConvention) -- ^convention
 -> (Bool) -- ^endOfMonth
 -> (GenIborIndex ibor1) -- ^baseCurrencyIndex
 -> (GenIborIndex ibor2) -- ^quoteCurrencyIndex
 -> (GenYieldTermStructure y) -- ^collateralCurve
 -> (Bool) -- ^isFxBaseCurrencyCollateralCurrency
 -> (Bool) -- ^isBasisOnFxBaseCurrencyLeg
 -> (Maybe Frequency) -- ^paymentFrequency
 -> (Int) -- ^paymentLag
 -> (Maybe Frequency) -- ^quoteCurrencyPaymentFrequency
 -> IO ((RateHelper))
constNotionalCrossCurrencyBasisSwapRateHelper :: forall q ibor1 ibor2 y.
GenQuote q
-> (Int, TimeUnit)
-> Word
-> Calendar
-> BusinessDayConvention
-> Bool
-> GenIborIndex ibor1
-> GenIborIndex ibor2
-> GenYieldTermStructure y
-> Bool
-> Bool
-> Maybe Frequency
-> Int
-> Maybe Frequency
-> IO RateHelper
constNotionalCrossCurrencyBasisSwapRateHelper GenQuote q
a1 (Int, TimeUnit)
a2 Word
a3 Calendar
a4 BusinessDayConvention
a5 Bool
a6 GenIborIndex ibor1
a7 GenIborIndex ibor2
a8 GenYieldTermStructure y
a9 Bool
a10 Bool
a11 Maybe Frequency
a12 Int
a13 Maybe Frequency
a14 =
  GenQuote q -> (Ptr CQuote' -> IO RateHelper) -> IO RateHelper
forall q b. GenQuote q -> (Ptr CQuote' -> IO b) -> IO b
withQuote GenQuote q
a1 ((Ptr CQuote' -> IO RateHelper) -> IO RateHelper)
-> (Ptr CQuote' -> IO RateHelper) -> IO RateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr CQuote'
a1' -> 
  let {(CInt
a2'1, CInt
a2'2) = (Int, TimeUnit) -> (CInt, CInt)
forall a b c.
(Enum a, Integral b, Integral c) =>
(b, a) -> (CInt, c)
fromEnumQuantity (Int, TimeUnit)
a2} in 
  let {a3' :: CUInt
a3' = Word -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word
a3} in 
  Calendar -> (Ptr CCalendar -> IO RateHelper) -> IO RateHelper
forall b. Calendar -> (Ptr CCalendar -> IO b) -> IO b
withCalendar Calendar
a4 ((Ptr CCalendar -> IO RateHelper) -> IO RateHelper)
-> (Ptr CCalendar -> IO RateHelper) -> IO RateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr CCalendar
a4' -> 
  let {a5' :: CInt
a5' = BusinessDayConvention -> CInt
forall a b. (Enum a, Integral b) => a -> b
fromEnumC BusinessDayConvention
a5} in 
  let {a6' :: CInt
a6' = Bool -> CInt
forall a. Num a => Bool -> a
C2HSImp.fromBool Bool
a6} in 
  GenIborIndex ibor1
-> (Ptr CIborIndex' -> IO RateHelper) -> IO RateHelper
forall ibor b.
GenIborIndex ibor -> (Ptr CIborIndex' -> IO b) -> IO b
withIborIndex GenIborIndex ibor1
a7 ((Ptr CIborIndex' -> IO RateHelper) -> IO RateHelper)
-> (Ptr CIborIndex' -> IO RateHelper) -> IO RateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr CIborIndex'
a7' -> 
  GenIborIndex ibor2
-> (Ptr CIborIndex' -> IO RateHelper) -> IO RateHelper
forall ibor b.
GenIborIndex ibor -> (Ptr CIborIndex' -> IO b) -> IO b
withIborIndex GenIborIndex ibor2
a8 ((Ptr CIborIndex' -> IO RateHelper) -> IO RateHelper)
-> (Ptr CIborIndex' -> IO RateHelper) -> IO RateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr CIborIndex'
a8' -> 
  GenYieldTermStructure y
-> (Ptr CYieldTermStructure' -> IO RateHelper) -> IO RateHelper
forall y b.
GenYieldTermStructure y
-> (Ptr CYieldTermStructure' -> IO b) -> IO b
withYieldTermStructure GenYieldTermStructure y
a9 ((Ptr CYieldTermStructure' -> IO RateHelper) -> IO RateHelper)
-> (Ptr CYieldTermStructure' -> IO RateHelper) -> IO RateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr CYieldTermStructure'
a9' -> 
  let {a10' :: CInt
a10' = Bool -> CInt
forall a. Num a => Bool -> a
C2HSImp.fromBool Bool
a10} in 
  let {a11' :: CInt
a11' = Bool -> CInt
forall a. Num a => Bool -> a
C2HSImp.fromBool Bool
a11} in 
  let {a12' :: CInt
a12' = Maybe Frequency -> CInt
forall a. Enum a => Maybe a -> CInt
fromMaybeEnum Maybe Frequency
a12} in 
  let {a13' :: CInt
a13' = Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
a13} in 
  let {a14' :: CInt
a14' = Maybe Frequency -> CInt
forall a. Enum a => Maybe a -> CInt
fromMaybeEnum Maybe Frequency
a14} in 
  (Ptr (Ptr CChar) -> IO RateHelper) -> IO RateHelper
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr CChar) -> IO RateHelper) -> IO RateHelper)
-> (Ptr (Ptr CChar) -> IO RateHelper) -> IO RateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr CChar)
a15' -> 
  Ptr CQuote'
-> CInt
-> CInt
-> CUInt
-> Ptr CCalendar
-> CInt
-> CInt
-> Ptr CIborIndex'
-> Ptr CIborIndex'
-> Ptr CYieldTermStructure'
-> CInt
-> CInt
-> CInt
-> CInt
-> CInt
-> Ptr (Ptr CChar)
-> IO (Ptr CRateHelper')
constNotionalCrossCurrencyBasisSwapRateHelper'_ Ptr CQuote'
a1' CInt
a2'1  CInt
a2'2 CUInt
a3' Ptr CCalendar
a4' CInt
a5' CInt
a6' Ptr CIborIndex'
a7' Ptr CIborIndex'
a8' Ptr CYieldTermStructure'
a9' CInt
a10' CInt
a11' CInt
a12' CInt
a13' CInt
a14' Ptr (Ptr CChar)
a15' IO (Ptr CRateHelper')
-> (Ptr CRateHelper' -> IO RateHelper) -> IO RateHelper
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Ptr CRateHelper'
res ->
  Ptr CRateHelper' -> IO RateHelper
peekRateHelper Ptr CRateHelper'
res IO RateHelper -> (RateHelper -> IO RateHelper) -> IO RateHelper
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \RateHelper
res' ->
  Ptr (Ptr CChar) -> IO ()
errorCheck  Ptr (Ptr CChar)
a15'IO () -> IO RateHelper -> IO RateHelper
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
  RateHelper -> IO RateHelper
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (RateHelper
res')

{-# LINE 390 "./QuantLib/TermStructure/Yield.chs" #-}


-- |Bootstrapping helper for a marked-to-market cross-currency basis swap: like
-- 'constNotionalCrossCurrencyBasisSwapRateHelper', but the notional on the MtM leg resets at
-- each payment to reflect the FX rate.
mtmCrossCurrencyBasisSwapRateHelper :: (GenQuote q) -- ^basis
 -> ((Int,TimeUnit)) -- ^tenor
 -> (Word) -- ^fixingDays
 -> (Calendar) -- ^calendar
 -> (BusinessDayConvention) -- ^convention
 -> (Bool) -- ^endOfMonth
 -> (GenIborIndex ibor1) -- ^baseCurrencyIndex
 -> (GenIborIndex ibor2) -- ^quoteCurrencyIndex
 -> (GenYieldTermStructure y) -- ^collateralCurve
 -> (Bool) -- ^isFxBaseCurrencyCollateralCurrency
 -> (Bool) -- ^isBasisOnFxBaseCurrencyLeg
 -> (Bool) -- ^isFxBaseCurrencyLegResettable
 -> (Maybe Frequency) -- ^paymentFrequency
 -> (Int) -- ^paymentLag
 -> (Maybe Frequency) -- ^quoteCurrencyPaymentFrequency
 -> IO ((RateHelper))
mtmCrossCurrencyBasisSwapRateHelper a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 =
  withQuote a1 $ \a1' -> 
  let {(a2'1, a2'2) = fromEnumQuantity a2} in 
  let {a3' = fromIntegral a3} in 
  withCalendar a4 $ \a4' -> 
  let {a5' = fromEnumC a5} in 
  let {a6' = C2HSImp.fromBool a6} in 
  withIborIndex a7 $ \a7' -> 
  withIborIndex a8 $ \a8' -> 
  withYieldTermStructure a9 $ \a9' -> 
  let {a10' = C2HSImp.fromBool a10} in 
  let {a11' = C2HSImp.fromBool a11} in 
  let {a12' = C2HSImp.fromBool a12} in 
  let {a13' = fromMaybeEnum a13} in 
  let {a14' = fromIntegral a14} in 
  let {a15' = fromMaybeEnum a15} in 
  preErrorCheck $ \a16' -> 
  mtmCrossCurrencyBasisSwapRateHelper'_ a1' a2'1  a2'2 a3' a4' a5' a6' a7' a8' a9' a10' a11' a12' a13' a14' a15' a16' >>= \res ->
  peekRateHelper res >>= \res' ->
  errorCheck  a16'>>
  return (res')

{-# LINE 410 "./QuantLib/TermStructure/Yield.chs" #-}


-- |Bootstrapping helper for a fixed-vs-floating cross-currency par swap: quoted at par, so the
-- FX spot cancels out and isn't required. 'collateralOnFixedLeg' selects which leg is discounted
-- with 'collateralCurve' -- the other leg's discount curve is the one being bootstrapped.
constNotionalCrossCurrencySwapRateHelper :: (GenQuote q) -- ^fixedRate
 -> ((Int,TimeUnit)) -- ^tenor
 -> (Word) -- ^fixingDays
 -> (Calendar) -- ^calendar
 -> (BusinessDayConvention) -- ^convention
 -> (Bool) -- ^endOfMonth
 -> (Frequency) -- ^fixedFrequency
 -> (DayCounter) -- ^fixedDayCount
 -> (GenIborIndex ibor) -- ^floatIndex
 -> (GenYieldTermStructure y) -- ^collateralCurve
 -> (Bool) -- ^collateralOnFixedLeg
 -> (Int) -- ^paymentLag
 -> IO ((RateHelper))
constNotionalCrossCurrencySwapRateHelper a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 =
  withQuote a1 $ \a1' -> 
  let {(a2'1, a2'2) = fromEnumQuantity a2} in 
  let {a3' = fromIntegral a3} in 
  withCalendar a4 $ \a4' -> 
  let {a5' = fromEnumC a5} in 
  let {a6' = C2HSImp.fromBool a6} in 
  let {a7' = (fromIntegral . fromEnum) a7} in 
  withDayCounter a8 $ \a8' -> 
  withIborIndex a9 $ \a9' -> 
  withYieldTermStructure a10 $ \a10' -> 
  let {a11' = C2HSImp.fromBool a11} in 
  let {a12' = fromIntegral a12} in 
  preErrorCheck $ \a13' -> 
  constNotionalCrossCurrencySwapRateHelper'_ a1' a2'1  a2'2 a3' a4' a5' a6' a7' a8' a9' a10' a11' a12' a13' >>= \res ->
  peekRateHelper res >>= \res' ->
  errorCheck  a13'>>
  return (res')

{-# LINE 427 "./QuantLib/TermStructure/Yield.chs" #-}


-- |Bootstrapping helper from FX swap points, tenor-relative. 'collateralCurve' discounts the
-- collateral currency; the curve being bootstrapped is for the other currency. 'fwdPoint' and
-- 'spotFx' must be quoted in the same units (points already scaled to match the spot).
fxSwapRateHelper :: (GenQuote q1) -- ^fwdPoint
 -> (GenQuote q2) -- ^spotFx
 -> ((Int,TimeUnit)) -- ^tenor
 -> (Word) -- ^fixingDays
 -> (Calendar) -- ^calendar
 -> (BusinessDayConvention) -- ^convention
 -> (Bool) -- ^endOfMonth
 -> (Bool) -- ^isFxBaseCurrencyCollateralCurrency
 -> (GenYieldTermStructure y) -- ^collateralCurve
 -> (Calendar) -- ^tradingCalendar
 -> IO ((RateHelper))
fxSwapRateHelper a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 =
  withQuote a1 $ \a1' -> 
  withQuote a2 $ \a2' -> 
  let {(a3'1, a3'2) = fromEnumQuantity a3} in 
  let {a4' = fromIntegral a4} in 
  withCalendar a5 $ \a5' -> 
  let {a6' = fromEnumC a6} in 
  let {a7' = C2HSImp.fromBool a7} in 
  let {a8' = C2HSImp.fromBool a8} in 
  withYieldTermStructure a9 $ \a9' -> 
  withCalendar a10 $ \a10' -> 
  preErrorCheck $ \a11' -> 
  fxSwapRateHelper'_ a1' a2' a3'1  a3'2 a4' a5' a6' a7' a8' a9' a10' a11' >>= \res ->
  peekRateHelper res >>= \res' ->
  errorCheck  a11'>>
  return (res')

{-# LINE 442 "./QuantLib/TermStructure/Yield.chs" #-}


-- |Bootstrapping helper from FX swap points, explicit start\/end date.
fxSwapRateHelperBetweenDates :: (GenQuote q1) -- ^fwdPoint
 -> (GenQuote q2) -- ^spotFx
 -> (Day) -- ^startDate
 -> (Day) -- ^endDate
 -> (Bool) -- ^isFxBaseCurrencyCollateralCurrency
 -> (GenYieldTermStructure y) -- ^collateralCurve
 -> IO ((RateHelper))
fxSwapRateHelperBetweenDates a1 a2 a3 a4 a5 a6 =
  withQuote a1 $ \a1' -> 
  withQuote a2 $ \a2' -> 
  withDay a3 $ \a3' -> 
  withDay a4 $ \a4' -> 
  let {a5' = C2HSImp.fromBool a5} in 
  withYieldTermStructure a6 $ \a6' -> 
  preErrorCheck $ \a7' -> 
  fxSwapRateHelperBetweenDates'_ a1' a2' a3' a4' a5' a6' a7' >>= \res ->
  peekRateHelper res >>= \res' ->
  errorCheck  a7'>>
  return (res')

{-# LINE 451 "./QuantLib/TermStructure/Yield.chs" #-}


-- |/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.
-- 'BondPriceType' is marshalled as an 'Int' to avoid a c2hs cross-module enum-import cycle.
bondHelper :: GenQuote q -> Bond -> Bond.BondPriceType -> IO BondHelper
bondHelper cleanPrice bond priceType = bondHelper_ cleanPrice bond (fromEnum priceType)

bondHelper_ :: (GenQuote q) -> (Bond) -> (Int) -- ^priceType
 -> IO ((BondHelper))
bondHelper_ a1 a2 a3 =
  withQuote a1 $ \a1' -> 
  withBond a2 $ \a2' -> 
  let {a3' = fromIntegral a3} in 
  preErrorCheck $ \a4' -> 
  bondHelper_'_ a1' a2' a3' a4' >>= \res ->
  peekBondHelper res >>= \res' ->
  errorCheck  a4'>>
  return (res')

{-# LINE 459 "./QuantLib/TermStructure/Yield.chs" #-}

-- The narrow and options-record wrappers share the same full-arity bindings; the narrow forms
-- supply QuantLib's defaults.
-- forwardStart is explicit rather than an OISRateHelperOpts field because upstream's
-- ctor2 has none: only the tenor-relative entry points below can honour it.
oisRateHelper :: Word -> (Int, TimeUnit)
  -> (Int, TimeUnit) -- ^forwardStart
  -> GenQuote q -> OvernightIborIndex
  -> Maybe (GenYieldTermStructure y) -> IO OISRateHelper
oisRateHelper settlementDays tenor forwardStart fixedRate idx discountingCurve = do
  cal <- calendar Null
  oisRateHelper_ settlementDays tenor fixedRate idx discountingCurve
    False 0 Following Annual cal forwardStart Nothing LastRelevantDate Nothing AveragingCompound
    Nothing Nothing cal Nothing 0 False Nothing Backward cal ModifiedFollowing

oisRateHelperBetweenDates :: Day -> Day -> GenQuote q -> OvernightIborIndex
  -> Maybe (GenYieldTermStructure y) -> IO OISRateHelper
oisRateHelperBetweenDates :: forall q y.
Day
-> Day
-> GenQuote q
-> OvernightIborIndex
-> Maybe (GenYieldTermStructure y)
-> IO OISRateHelper
oisRateHelperBetweenDates Day
startDate Day
endDate GenQuote q
fixedRate OvernightIborIndex
idx Maybe (GenYieldTermStructure y)
discountingCurve = do
  cal <- CalendarConstructor -> IO Calendar
calendar CalendarConstructor
Null
  oisRateHelper2_ startDate endDate fixedRate idx discountingCurve
    False 0 Following Annual cal Nothing LastRelevantDate Nothing AveragingCompound
    Nothing Nothing cal Nothing 0 False Nothing Backward cal ModifiedFollowing

oisRateHelper_ :: (Word) -- ^settlementDays
 -> ((Int,TimeUnit)) -- ^tenor
 -> (GenQuote q1) -> (OvernightIborIndex) -> (Maybe (GenYieldTermStructure y)) -- ^discountingCurve
 -> (Bool) -- ^telescopicValueDates
 -> (Int) -- ^paymentLag
 -> (BusinessDayConvention) -- ^paymentConvention
 -> (Frequency) -- ^paymentFrequency
 -> (Calendar) -- ^paymentCalendar
 -> ((Int,TimeUnit)) -- ^forwardStart
 -> (Maybe (GenQuote q2)) -- ^overnightSpread
 -> (PillarChoice) -- ^pillar
 -> (Maybe Day) -- ^customPillarDate
 -> (RateAveragingType) -- ^averagingMethod
 -> (Maybe Bool) -- ^endOfMonth
 -> (Maybe Frequency) -- ^fixedPaymentFrequency
 -> (Calendar) -- ^fixedCalendar
 -> (Maybe Word) -- ^lookbackDays
 -> (Word) -- ^lockoutDays
 -> (Bool) -- ^applyObservationShift
 -> (Maybe FloatingRateCouponPricer) -- ^pricer
 -> (DateGenerationRule) -- ^rule
 -> (Calendar) -- ^overnightCalendar
 -> (BusinessDayConvention) -- ^convention (q1.k.q1. overnightConvention)
 -> IO ((OISRateHelper))
oisRateHelper_ :: forall q1 y q2.
Word
-> (Int, TimeUnit)
-> GenQuote q1
-> OvernightIborIndex
-> Maybe (GenYieldTermStructure y)
-> Bool
-> Int
-> BusinessDayConvention
-> Frequency
-> Calendar
-> (Int, TimeUnit)
-> Maybe (GenQuote q2)
-> PillarChoice
-> Maybe Day
-> RateAveragingType
-> Maybe Bool
-> Maybe Frequency
-> Calendar
-> Maybe Word
-> Word
-> Bool
-> Maybe FloatingRateCouponPricer
-> DateGenerationRule
-> Calendar
-> BusinessDayConvention
-> IO OISRateHelper
oisRateHelper_ Word
a1 (Int, TimeUnit)
a2 GenQuote q1
a3 OvernightIborIndex
a4 Maybe (GenYieldTermStructure y)
a5 Bool
a6 Int
a7 BusinessDayConvention
a8 Frequency
a9 Calendar
a10 (Int, TimeUnit)
a11 Maybe (GenQuote q2)
a12 PillarChoice
a13 Maybe Day
a14 RateAveragingType
a15 Maybe Bool
a16 Maybe Frequency
a17 Calendar
a18 Maybe Word
a19 Word
a20 Bool
a21 Maybe FloatingRateCouponPricer
a22 DateGenerationRule
a23 Calendar
a24 BusinessDayConvention
a25 =
  let {a1' :: CUInt
a1' = Word -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word
a1} in 
  let {(CInt
a2'1, CInt
a2'2) = (Int, TimeUnit) -> (CInt, CInt)
forall a b c.
(Enum a, Integral b, Integral c) =>
(b, a) -> (CInt, c)
fromEnumQuantity (Int, TimeUnit)
a2} in 
  GenQuote q1
-> (Ptr CQuote' -> IO OISRateHelper) -> IO OISRateHelper
forall q b. GenQuote q -> (Ptr CQuote' -> IO b) -> IO b
withQuote GenQuote q1
a3 ((Ptr CQuote' -> IO OISRateHelper) -> IO OISRateHelper)
-> (Ptr CQuote' -> IO OISRateHelper) -> IO OISRateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr CQuote'
a3' -> 
  OvernightIborIndex
-> (Ptr COvernightIndex' -> IO OISRateHelper) -> IO OISRateHelper
forall b.
OvernightIborIndex -> (Ptr COvernightIndex' -> IO b) -> IO b
withOvernightIborIndex OvernightIborIndex
a4 ((Ptr COvernightIndex' -> IO OISRateHelper) -> IO OISRateHelper)
-> (Ptr COvernightIndex' -> IO OISRateHelper) -> IO OISRateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr COvernightIndex'
a4' -> 
  Maybe (GenYieldTermStructure y)
-> (Ptr CYieldTermStructure' -> IO OISRateHelper)
-> IO OISRateHelper
forall y b.
Maybe (GenYieldTermStructure y)
-> (Ptr CYieldTermStructure' -> IO b) -> IO b
withMaybeYieldTermStructure Maybe (GenYieldTermStructure y)
a5 ((Ptr CYieldTermStructure' -> IO OISRateHelper)
 -> IO OISRateHelper)
-> (Ptr CYieldTermStructure' -> IO OISRateHelper)
-> IO OISRateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr CYieldTermStructure'
a5' -> 
  let {a6' :: CInt
a6' = Bool -> CInt
forall a. Num a => Bool -> a
C2HSImp.fromBool Bool
a6} in 
  let {a7' :: CInt
a7' = Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
a7} in 
  let {a8' :: CInt
a8' = BusinessDayConvention -> CInt
forall a b. (Enum a, Integral b) => a -> b
fromEnumC BusinessDayConvention
a8} in 
  let {a9' :: CInt
a9' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Frequency -> Int) -> Frequency -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Frequency -> Int
forall a. Enum a => a -> Int
fromEnum) Frequency
a9} in 
  Calendar -> (Ptr CCalendar -> IO OISRateHelper) -> IO OISRateHelper
forall b. Calendar -> (Ptr CCalendar -> IO b) -> IO b
withCalendar Calendar
a10 ((Ptr CCalendar -> IO OISRateHelper) -> IO OISRateHelper)
-> (Ptr CCalendar -> IO OISRateHelper) -> IO OISRateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr CCalendar
a10' -> 
  let {(CInt
a11'1, CInt
a11'2) = (Int, TimeUnit) -> (CInt, CInt)
forall a b c.
(Enum a, Integral b, Integral c) =>
(b, a) -> (CInt, c)
fromEnumQuantity (Int, TimeUnit)
a11} in 
  Maybe (GenQuote q2)
-> (Ptr CQuote' -> IO OISRateHelper) -> IO OISRateHelper
forall q b. Maybe (GenQuote q) -> (Ptr CQuote' -> IO b) -> IO b
withMaybeQuote Maybe (GenQuote q2)
a12 ((Ptr CQuote' -> IO OISRateHelper) -> IO OISRateHelper)
-> (Ptr CQuote' -> IO OISRateHelper) -> IO OISRateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr CQuote'
a12' -> 
  let {a13' :: CInt
a13' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (PillarChoice -> Int) -> PillarChoice -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. PillarChoice -> Int
forall a. Enum a => a -> Int
fromEnum) PillarChoice
a13} in 
  Maybe Day -> (CInt -> IO OISRateHelper) -> IO OISRateHelper
forall a. Maybe Day -> (CInt -> IO a) -> IO a
withMaybeDay Maybe Day
a14 ((CInt -> IO OISRateHelper) -> IO OISRateHelper)
-> (CInt -> IO OISRateHelper) -> IO OISRateHelper
forall a b. (a -> b) -> a -> b
$ \CInt
a14' -> 
  let {a15' :: CInt
a15' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt)
-> (RateAveragingType -> Int) -> RateAveragingType -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. RateAveragingType -> Int
forall a. Enum a => a -> Int
fromEnum) RateAveragingType
a15} in 
  let {a16' :: CInt
a16' = Maybe Bool -> CInt
fromMaybeBool Maybe Bool
a16} in 
  let {a17' :: CInt
a17' = Maybe Frequency -> CInt
forall a. Enum a => Maybe a -> CInt
fromMaybeEnum Maybe Frequency
a17} in 
  Calendar -> (Ptr CCalendar -> IO OISRateHelper) -> IO OISRateHelper
forall b. Calendar -> (Ptr CCalendar -> IO b) -> IO b
withCalendar Calendar
a18 ((Ptr CCalendar -> IO OISRateHelper) -> IO OISRateHelper)
-> (Ptr CCalendar -> IO OISRateHelper) -> IO OISRateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr CCalendar
a18' -> 
  let {a19' :: CUInt
a19' = Maybe Word -> CUInt
forall a b. (Integral a, Integral b) => Maybe a -> b
fromMaybeInt Maybe Word
a19} in 
  let {a20' :: CUInt
a20' = Word -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word
a20} in 
  let {a21' :: CInt
a21' = Bool -> CInt
forall a. Num a => Bool -> a
C2HSImp.fromBool Bool
a21} in 
  Maybe FloatingRateCouponPricer
-> (Ptr CFloatingRateCouponPricer' -> IO OISRateHelper)
-> IO OISRateHelper
forall b.
Maybe FloatingRateCouponPricer
-> (Ptr CFloatingRateCouponPricer' -> IO b) -> IO b
withMaybeFloatingRateCouponPricer Maybe FloatingRateCouponPricer
a22 ((Ptr CFloatingRateCouponPricer' -> IO OISRateHelper)
 -> IO OISRateHelper)
-> (Ptr CFloatingRateCouponPricer' -> IO OISRateHelper)
-> IO OISRateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr CFloatingRateCouponPricer'
a22' -> 
  let {a23' :: CInt
a23' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt)
-> (DateGenerationRule -> Int) -> DateGenerationRule -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. DateGenerationRule -> Int
forall a. Enum a => a -> Int
fromEnum) DateGenerationRule
a23} in 
  Calendar -> (Ptr CCalendar -> IO OISRateHelper) -> IO OISRateHelper
forall b. Calendar -> (Ptr CCalendar -> IO b) -> IO b
withCalendar Calendar
a24 ((Ptr CCalendar -> IO OISRateHelper) -> IO OISRateHelper)
-> (Ptr CCalendar -> IO OISRateHelper) -> IO OISRateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr CCalendar
a24' -> 
  let {a25' :: CInt
a25' = BusinessDayConvention -> CInt
forall a b. (Enum a, Integral b) => a -> b
fromEnumC BusinessDayConvention
a25} in 
  (Ptr (Ptr CChar) -> IO OISRateHelper) -> IO OISRateHelper
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr CChar) -> IO OISRateHelper) -> IO OISRateHelper)
-> (Ptr (Ptr CChar) -> IO OISRateHelper) -> IO OISRateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr CChar)
a26' -> 
  CUInt
-> CInt
-> CInt
-> Ptr CQuote'
-> Ptr COvernightIndex'
-> Ptr CYieldTermStructure'
-> CInt
-> CInt
-> CInt
-> CInt
-> Ptr CCalendar
-> CInt
-> CInt
-> Ptr CQuote'
-> CInt
-> CInt
-> CInt
-> CInt
-> CInt
-> Ptr CCalendar
-> CUInt
-> CUInt
-> CInt
-> Ptr CFloatingRateCouponPricer'
-> CInt
-> Ptr CCalendar
-> CInt
-> Ptr (Ptr CChar)
-> IO (Ptr COISRateHelper')
oisRateHelper_'_ CUInt
a1' CInt
a2'1  CInt
a2'2 Ptr CQuote'
a3' Ptr COvernightIndex'
a4' Ptr CYieldTermStructure'
a5' CInt
a6' CInt
a7' CInt
a8' CInt
a9' Ptr CCalendar
a10' CInt
a11'1  CInt
a11'2 Ptr CQuote'
a12' CInt
a13' CInt
a14' CInt
a15' CInt
a16' CInt
a17' Ptr CCalendar
a18' CUInt
a19' CUInt
a20' CInt
a21' Ptr CFloatingRateCouponPricer'
a22' CInt
a23' Ptr CCalendar
a24' CInt
a25' Ptr (Ptr CChar)
a26' IO (Ptr COISRateHelper')
-> (Ptr COISRateHelper' -> IO OISRateHelper) -> IO OISRateHelper
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Ptr COISRateHelper'
res ->
  Ptr COISRateHelper' -> IO OISRateHelper
peekOISRateHelper Ptr COISRateHelper'
res IO OISRateHelper
-> (OISRateHelper -> IO OISRateHelper) -> IO OISRateHelper
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \OISRateHelper
res' ->
  Ptr (Ptr CChar) -> IO ()
errorCheck  Ptr (Ptr CChar)
a26'IO () -> IO OISRateHelper -> IO OISRateHelper
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
  OISRateHelper -> IO OISRateHelper
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (OISRateHelper
res')

{-# LINE 507 "./QuantLib/TermStructure/Yield.chs" #-}

oisRateHelper2_ :: (Day) -- ^startDate
 -> (Day) -- ^endDate
 -> (GenQuote q1) -> (OvernightIborIndex) -> (Maybe (GenYieldTermStructure y)) -- ^discountingCurve
 -> (Bool) -- ^telescopicValueDates
 -> (Int) -- ^paymentLag
 -> (BusinessDayConvention) -- ^paymentConvention
 -> (Frequency) -- ^paymentFrequency
 -> (Calendar) -- ^paymentCalendar
 -> (Maybe (GenQuote q2)) -- ^overnightSpread
 -> (PillarChoice) -- ^pillar
 -> (Maybe Day) -- ^customPillarDate
 -> (RateAveragingType) -- ^averagingMethod
 -> (Maybe Bool) -- ^endOfMonth
 -> (Maybe Frequency) -- ^fixedPaymentFrequency
 -> (Calendar) -- ^fixedCalendar
 -> (Maybe Word) -- ^lookbackDays
 -> (Word) -- ^lockoutDays
 -> (Bool) -- ^applyObservationShift
 -> (Maybe FloatingRateCouponPricer) -- ^pricer
 -> (DateGenerationRule) -- ^rule
 -> (Calendar) -- ^overnightCalendar
 -> (BusinessDayConvention) -- ^convention (q1.k.q1. overnightConvention)
 -> IO ((OISRateHelper))
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 =
  withDay a1 $ \a1' -> 
  withDay a2 $ \a2' -> 
  withQuote a3 $ \a3' -> 
  withOvernightIborIndex a4 $ \a4' -> 
  withMaybeYieldTermStructure a5 $ \a5' -> 
  let {a6' = C2HSImp.fromBool a6} in 
  let {a7' = fromIntegral a7} in 
  let {a8' = fromEnumC a8} in 
  let {a9' = (fromIntegral . fromEnum) a9} in 
  withCalendar a10 $ \a10' -> 
  withMaybeQuote a11 $ \a11' -> 
  let {a12' = (fromIntegral . fromEnum) a12} in 
  withMaybeDay a13 $ \a13' -> 
  let {a14' = (fromIntegral . fromEnum) a14} in 
  let {a15' = fromMaybeBool a15} in 
  let {a16' = fromMaybeEnum a16} in 
  withCalendar a17 $ \a17' -> 
  let {a18' = fromMaybeInt a18} in 
  let {a19' = fromIntegral a19} in 
  let {a20' = C2HSImp.fromBool a20} in 
  withMaybeFloatingRateCouponPricer a21 $ \a21' -> 
  let {a22' = (fromIntegral . fromEnum) a22} in 
  withCalendar a23 $ \a23' -> 
  let {a24' = fromEnumC a24} in 
  preErrorCheck $ \a25' -> 
  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' >>= \res ->
  peekOISRateHelper res >>= \res' ->
  errorCheck  a25'>>
  return (res')

{-# LINE 532 "./QuantLib/TermStructure/Yield.chs" #-}


oisRateHelperWithOptions :: Word -> (Int, TimeUnit)
  -> (Int, TimeUnit) -- ^forwardStart
  -> GenQuote q -> OvernightIborIndex
  -> Maybe (GenYieldTermStructure y) -> OISRateHelperOpts m -> IO OISRateHelper
oisRateHelperWithOptions settlementDays tenor forwardStart fixedRate idx discountingCurve opts = do
  cal <- calendar Null
  oisRateHelper_ settlementDays tenor fixedRate idx discountingCurve
    (oisTelescopicValueDates opts) (oisPaymentLag opts) (oisPaymentConvention opts)
    (oisPaymentFrequency opts) (fromMaybe cal (oisPaymentCalendar opts))
    forwardStart (oisOvernightSpread opts) (oisPillar opts) (oisCustomPillarDate opts)
    (oisAveragingMethod opts) (oisEndOfMonth opts) (oisFixedPaymentFrequency opts)
    (fromMaybe cal (oisFixedCalendar opts)) (lookbackDays obs) (lockoutDays obs)
    (applyObservationShift obs) (oisPricer opts) (oisRule opts)
    (fromMaybe cal (oisOvernightCalendar opts)) (oisConvention opts)
  where obs = oisObservation opts

oisRateHelperBetweenDatesWithOptions :: Day -> Day -> GenQuote q -> OvernightIborIndex
  -> Maybe (GenYieldTermStructure y) -> OISRateHelperOpts m -> IO OISRateHelper
oisRateHelperBetweenDatesWithOptions startDate endDate fixedRate idx discountingCurve opts = do
  cal <- calendar Null
  oisRateHelper2_ startDate endDate fixedRate idx discountingCurve
    (oisTelescopicValueDates opts) (oisPaymentLag opts) (oisPaymentConvention opts)
    (oisPaymentFrequency opts) (fromMaybe cal (oisPaymentCalendar opts))
    (oisOvernightSpread opts) (oisPillar opts) (oisCustomPillarDate opts)
    (oisAveragingMethod opts) (oisEndOfMonth opts) (oisFixedPaymentFrequency opts)
    (fromMaybe cal (oisFixedCalendar opts)) (lookbackDays obs) (lockoutDays obs)
    (applyObservationShift obs) (oisPricer opts) (oisRule opts)
    (fromMaybe cal (oisOvernightCalendar opts)) (oisConvention opts)
  where obs = oisObservation opts

-- |Rate helper for bootstrapping over swap rates, built from a 'GenSwapIndex' bundling the
-- swap's conventions.
swapRateHelper :: (GenQuote q1) -- ^rate
 -> (GenSwapIndex sidx) -> (Maybe (GenQuote q2)) -- ^spread
 -> ((Int,TimeUnit)) -- ^fwdStart
 -> (Maybe (GenYieldTermStructure y)) -- ^discountingCurve
 -> (PillarChoice) -- ^pillar
 -> (Maybe Day) -- ^customPillarDate
 -> (Bool) -- ^endOfMonth
 -> (Maybe Bool) -- ^useIndexedCoupons
 -> (Maybe FloatingRateCouponPricer) -- ^couponPricer
 -> IO ((SwapRateHelper))
swapRateHelper :: forall q1 sidx q2 y.
GenQuote q1
-> GenSwapIndex sidx
-> Maybe (GenQuote q2)
-> (Int, TimeUnit)
-> Maybe (GenYieldTermStructure y)
-> PillarChoice
-> Maybe Day
-> Bool
-> Maybe Bool
-> Maybe FloatingRateCouponPricer
-> IO SwapRateHelper
swapRateHelper GenQuote q1
a1 GenSwapIndex sidx
a2 Maybe (GenQuote q2)
a3 (Int, TimeUnit)
a4 Maybe (GenYieldTermStructure y)
a5 PillarChoice
a6 Maybe Day
a7 Bool
a8 Maybe Bool
a9 Maybe FloatingRateCouponPricer
a10 =
  GenQuote q1
-> (Ptr CQuote' -> IO SwapRateHelper) -> IO SwapRateHelper
forall q b. GenQuote q -> (Ptr CQuote' -> IO b) -> IO b
withQuote GenQuote q1
a1 ((Ptr CQuote' -> IO SwapRateHelper) -> IO SwapRateHelper)
-> (Ptr CQuote' -> IO SwapRateHelper) -> IO SwapRateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr CQuote'
a1' -> 
  GenSwapIndex sidx
-> (Ptr CSwapIndex' -> IO SwapRateHelper) -> IO SwapRateHelper
forall sidx b.
GenSwapIndex sidx -> (Ptr CSwapIndex' -> IO b) -> IO b
withSwapIndex GenSwapIndex sidx
a2 ((Ptr CSwapIndex' -> IO SwapRateHelper) -> IO SwapRateHelper)
-> (Ptr CSwapIndex' -> IO SwapRateHelper) -> IO SwapRateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr CSwapIndex'
a2' -> 
  Maybe (GenQuote q2)
-> (Ptr CQuote' -> IO SwapRateHelper) -> IO SwapRateHelper
forall q b. Maybe (GenQuote q) -> (Ptr CQuote' -> IO b) -> IO b
withMaybeQuote Maybe (GenQuote q2)
a3 ((Ptr CQuote' -> IO SwapRateHelper) -> IO SwapRateHelper)
-> (Ptr CQuote' -> IO SwapRateHelper) -> IO SwapRateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr CQuote'
a3' -> 
  let {(CInt
a4'1, CInt
a4'2) = (Int, TimeUnit) -> (CInt, CInt)
forall a b c.
(Enum a, Integral b, Integral c) =>
(b, a) -> (CInt, c)
fromEnumQuantity (Int, TimeUnit)
a4} in 
  Maybe (GenYieldTermStructure y)
-> (Ptr CYieldTermStructure' -> IO SwapRateHelper)
-> IO SwapRateHelper
forall y b.
Maybe (GenYieldTermStructure y)
-> (Ptr CYieldTermStructure' -> IO b) -> IO b
withMaybeYieldTermStructure Maybe (GenYieldTermStructure y)
a5 ((Ptr CYieldTermStructure' -> IO SwapRateHelper)
 -> IO SwapRateHelper)
-> (Ptr CYieldTermStructure' -> IO SwapRateHelper)
-> IO SwapRateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr CYieldTermStructure'
a5' -> 
  let {a6' :: CInt
a6' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (PillarChoice -> Int) -> PillarChoice -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. PillarChoice -> Int
forall a. Enum a => a -> Int
fromEnum) PillarChoice
a6} in 
  Maybe Day -> (CInt -> IO SwapRateHelper) -> IO SwapRateHelper
forall a. Maybe Day -> (CInt -> IO a) -> IO a
withMaybeDay Maybe Day
a7 ((CInt -> IO SwapRateHelper) -> IO SwapRateHelper)
-> (CInt -> IO SwapRateHelper) -> IO SwapRateHelper
forall a b. (a -> b) -> a -> b
$ \CInt
a7' -> 
  let {a8' :: CInt
a8' = Bool -> CInt
forall a. Num a => Bool -> a
C2HSImp.fromBool Bool
a8} in 
  let {a9' = fromMaybeBool a9} in 
  withMaybeFloatingRateCouponPricer a10 $ \a10' -> 
  preErrorCheck $ \a11' -> 
  swapRateHelper'_ a1' a2' a3' a4'1  a4'2 a5' a6' a7' a8' a9' a10' a11' >>= \res ->
  peekSwapRateHelper res >>= \res' ->
  errorCheck  a11'>>
  return (res')

{-# LINE 575 "./QuantLib/TermStructure/Yield.chs" #-}


-- |A yield curve offset from 'baseCurve' by a spread added to its instantaneous forward rate,
-- remaining linked to changes in either.
forwardSpreadedTermStructure :: (GenYieldTermStructure y) -> (GenQuote q) -> IO ((YieldTermStructure))
forwardSpreadedTermStructure a1 a2 =
  withYieldTermStructure a1 $ \a1' -> 
  withQuote a2 $ \a2' -> 
  preErrorCheck $ \a3' -> 
  forwardSpreadedTermStructure'_ a1' a2' a3' >>= \res ->
  peekYieldTermStructure res >>= \res' ->
  errorCheck  a3'>>
  return (res')

{-# LINE 579 "./QuantLib/TermStructure/Yield.chs" #-}


-- |A yield curve offset from 'baseCurve' by a spread added to its zero-yield rate, remaining
-- linked to changes in either.
zeroSpreadedTermStructure :: (GenYieldTermStructure y) -> (GenQuote q) -> (Compounding) -> (Frequency) -> IO ((YieldTermStructure))
zeroSpreadedTermStructure a1 a2 a3 a4 =
  withYieldTermStructure a1 $ \a1' -> 
  withQuote a2 $ \a2' -> 
  let {a3' = (fromIntegral . fromEnum) a3} in 
  let {a4' = (fromIntegral . fromEnum) a4} in 
  preErrorCheck $ \a5' -> 
  zeroSpreadedTermStructure'_ a1' a2' a3' a4' a5' >>= \res ->
  peekYieldTermStructure res >>= \res' ->
  errorCheck  a5'>>
  return (res')

{-# LINE 583 "./QuantLib/TermStructure/Yield.chs" #-}


-- |A yield curve whose zero rate is @f rate1 rate2@, where @rate1@ and @rate2@ are the
-- input curves' zero rates expressed with the given compounding and frequency. The result is
-- live in both inputs.
--
-- __The resulting curve is valid only inside the continuation, which must span its whole use.__
-- QuantLib stores @f@ and calls it whenever the curve is queried, including from any object that
-- stores the curve. Leaving the continuation frees its function pointer; a later query crashes
-- the process. @f@ must be total: an exception escaping it crosses C++ unsafely.
withCompositeZeroYieldStructure :: (Double -> Double -> Double) -- ^f(rate1, rate2)
  -> GenYieldTermStructure y1 -- ^curve1
  -> GenYieldTermStructure y2 -- ^curve2
  -> Compounding
  -> Frequency
  -> (YieldTermStructure -> IO a)
  -> IO a
withCompositeZeroYieldStructure :: forall y1 y2 a.
(Double -> Double -> Double)
-> GenYieldTermStructure y1
-> GenYieldTermStructure y2
-> Compounding
-> Frequency
-> (YieldTermStructure -> IO a)
-> IO a
withCompositeZeroYieldStructure Double -> Double -> Double
f GenYieldTermStructure y1
c1 GenYieldTermStructure y2
c2 Compounding
comp Frequency
freq YieldTermStructure -> IO a
k =
  (Double -> Double -> Double)
-> (FunPtr QuoteBinaryFun -> IO a) -> IO a
forall b.
(Double -> Double -> Double)
-> (FunPtr QuoteBinaryFun -> IO b) -> IO b
withQuoteBinaryFun Double -> Double -> Double
f ((FunPtr QuoteBinaryFun -> IO a) -> IO a)
-> (FunPtr QuoteBinaryFun -> IO a) -> IO a
forall a b. (a -> b) -> a -> b
$ \FunPtr QuoteBinaryFun
fp -> GenYieldTermStructure y1
-> GenYieldTermStructure y2
-> FunPtr QuoteBinaryFun
-> Compounding
-> Frequency
-> IO YieldTermStructure
forall y1 y2.
GenYieldTermStructure y1
-> GenYieldTermStructure y2
-> FunPtr QuoteBinaryFun
-> Compounding
-> Frequency
-> IO YieldTermStructure
qlCompositeZeroYieldStructure GenYieldTermStructure y1
c1 GenYieldTermStructure y2
c2 FunPtr QuoteBinaryFun
fp Compounding
comp Frequency
freq IO YieldTermStructure -> (YieldTermStructure -> IO a) -> IO a
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= YieldTermStructure -> IO a
k
qlCompositeZeroYieldStructure :: (GenYieldTermStructure y1) -> (GenYieldTermStructure y2) -> (FunPtr QuoteBinaryFun) -> (Compounding) -> (Frequency) -> IO ((YieldTermStructure))
qlCompositeZeroYieldStructure :: forall y1 y2.
GenYieldTermStructure y1
-> GenYieldTermStructure y2
-> FunPtr QuoteBinaryFun
-> Compounding
-> Frequency
-> IO YieldTermStructure
qlCompositeZeroYieldStructure GenYieldTermStructure y1
a1 GenYieldTermStructure y2
a2 FunPtr QuoteBinaryFun
a3 Compounding
a4 Frequency
a5 =
  GenYieldTermStructure y1
-> (Ptr CYieldTermStructure' -> IO YieldTermStructure)
-> IO YieldTermStructure
forall y b.
GenYieldTermStructure y
-> (Ptr CYieldTermStructure' -> IO b) -> IO b
withYieldTermStructure GenYieldTermStructure y1
a1 ((Ptr CYieldTermStructure' -> IO YieldTermStructure)
 -> IO YieldTermStructure)
-> (Ptr CYieldTermStructure' -> IO YieldTermStructure)
-> IO YieldTermStructure
forall a b. (a -> b) -> a -> b
$ \Ptr CYieldTermStructure'
a1' -> 
  GenYieldTermStructure y2
-> (Ptr CYieldTermStructure' -> IO YieldTermStructure)
-> IO YieldTermStructure
forall y b.
GenYieldTermStructure y
-> (Ptr CYieldTermStructure' -> IO b) -> IO b
withYieldTermStructure GenYieldTermStructure y2
a2 ((Ptr CYieldTermStructure' -> IO YieldTermStructure)
 -> IO YieldTermStructure)
-> (Ptr CYieldTermStructure' -> IO YieldTermStructure)
-> IO YieldTermStructure
forall a b. (a -> b) -> a -> b
$ \Ptr CYieldTermStructure'
a2' -> 
  let {a3' :: FunPtr QuoteBinaryFun
a3' = FunPtr QuoteBinaryFun -> FunPtr QuoteBinaryFun
forall a. a -> a
id FunPtr QuoteBinaryFun
a3} in 
  let {a4' :: CInt
a4' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Compounding -> Int) -> Compounding -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Compounding -> Int
forall a. Enum a => a -> Int
fromEnum) Compounding
a4} in 
  let {a5' :: CInt
a5' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Frequency -> Int) -> Frequency -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Frequency -> Int
forall a. Enum a => a -> Int
fromEnum) Frequency
a5} in 
  (Ptr (Ptr CChar) -> IO YieldTermStructure) -> IO YieldTermStructure
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr CChar) -> IO YieldTermStructure)
 -> IO YieldTermStructure)
-> (Ptr (Ptr CChar) -> IO YieldTermStructure)
-> IO YieldTermStructure
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr CChar)
a6' -> 
  Ptr CYieldTermStructure'
-> Ptr CYieldTermStructure'
-> FunPtr QuoteBinaryFun
-> CInt
-> CInt
-> Ptr (Ptr CChar)
-> IO (Ptr CYieldTermStructure')
qlCompositeZeroYieldStructure'_ Ptr CYieldTermStructure'
a1' Ptr CYieldTermStructure'
a2' FunPtr QuoteBinaryFun
a3' CInt
a4' CInt
a5' Ptr (Ptr CChar)
a6' IO (Ptr CYieldTermStructure')
-> (Ptr CYieldTermStructure' -> IO YieldTermStructure)
-> IO YieldTermStructure
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Ptr CYieldTermStructure'
res ->
  Ptr CYieldTermStructure' -> IO YieldTermStructure
peekYieldTermStructure Ptr CYieldTermStructure'
res IO YieldTermStructure
-> (YieldTermStructure -> IO YieldTermStructure)
-> IO YieldTermStructure
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \YieldTermStructure
res' ->
  Ptr (Ptr CChar) -> IO ()
errorCheck  Ptr (Ptr CChar)
a6'IO () -> IO YieldTermStructure -> IO YieldTermStructure
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
  YieldTermStructure -> IO YieldTermStructure
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (YieldTermStructure
res')

{-# LINE 603 "./QuantLib/TermStructure/Yield.chs" #-}


-- |Rate helper for bootstrapping over BMA swap rates.
bmaSwapRateHelper :: (GenQuote q) -- ^liborFraction
 -> ((Int,TimeUnit)) -- ^tenor
 -> (Word) -- ^settlementDAys
 -> (Calendar) -> ((Int,TimeUnit)) -- ^bmpPeriod
 -> (BusinessDayConvention) -> (DayCounter) -> (BMAIndex) -> (GenIborIndex ibor) -> IO ((RateHelper))
bmaSwapRateHelper a1 a2 a3 a4 a5 a6 a7 a8 a9 =
  withQuote a1 $ \a1' -> 
  let {(a2'1, a2'2) = fromEnumQuantity a2} in 
  let {a3' = fromIntegral a3} in 
  withCalendar a4 $ \a4' -> 
  let {(a5'1, a5'2) = fromEnumQuantity a5} in 
  let {a6' = fromEnumC a6} in 
  withDayCounter a7 $ \a7' -> 
  withBMAIndex a8 $ \a8' -> 
  withIborIndex a9 $ \a9' -> 
  preErrorCheck $ \a10' -> 
  bmaSwapRateHelper'_ a1' a2'1  a2'2 a3' a4' a5'1  a5'2 a6' a7' a8' a9' a10' >>= \res ->
  peekRateHelper res >>= \res' ->
  errorCheck  a10'>>
  return (res')

{-# LINE 610 "./QuantLib/TermStructure/Yield.chs" #-}


-- |Rate helper for bootstrapping from multiple-resets swap quotes (a floating leg that resets
-- several times per fixed-leg coupon period).
multipleResetsSwapRateHelper :: (Word) -- ^settlementDays
 -> ((Int,TimeUnit)) -- ^tenor
 -> (GenQuote q1) -- ^fixedRate
 -> (GenIborIndex ibor) -> (Word) -- ^resetsPerCoupon
 -> (Maybe (GenYieldTermStructure y)) -- ^discountingCurve
 -> (RateAveragingType) -- ^averagingMethod
 -> (Double) -- ^spread
 -> (Frequency) -- ^fixedFrequency
 -> (DayCounter) -- ^fixedDayCount
 -> (BusinessDayConvention) -- ^fixedConvention
 -> IO ((RateHelper))
multipleResetsSwapRateHelper a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 =
  let {a1' = fromIntegral a1} in 
  let {(a2'1, a2'2) = fromEnumQuantity a2} in 
  withQuote a3 $ \a3' -> 
  withIborIndex a4 $ \a4' -> 
  let {a5' = fromIntegral a5} in 
  withMaybeYieldTermStructure a6 $ \a6' -> 
  let {a7' = (fromIntegral . fromEnum) a7} in 
  let {a8' = realToFrac a8} in 
  let {a9' = (fromIntegral . fromEnum) a9} in 
  withDayCounter a10 $ \a10' -> 
  let {a11' = fromEnumC a11} in 
  preErrorCheck $ \a12' -> 
  multipleResetsSwapRateHelper'_ a1' a2'1  a2'2 a3' a4' a5' a6' a7' a8' a9' a10' a11' a12' >>= \res ->
  peekRateHelper res >>= \res' ->
  errorCheck  a12'>>
  return (res')

{-# LINE 625 "./QuantLib/TermStructure/Yield.chs" #-}


-- Raw FRA bindings behind 'fraRateHelper'; one per 'FraTerms' constructor.
fraRateHelperFromIndexRaw :: (GenQuote q) -> (Word) -- ^monthsToStart
 -> (GenIborIndex ibor) -> (PillarChoice) -- ^pillar
 -> (Maybe Day) -- ^customPillarDate
 -> (Bool) -- ^useIndexedCoupon
 -> IO ((RateHelper))
fraRateHelperFromIndexRaw a1 a2 a3 a4 a5 a6 =
  withQuote a1 $ \a1' -> 
  let {a2' = fromIntegral a2} in 
  withIborIndex a3 $ \a3' -> 
  let {a4' = (fromIntegral . fromEnum) a4} in 
  withMaybeDay a5 $ \a5' -> 
  let {a6' = C2HSImp.fromBool a6} in 
  preErrorCheck $ \a7' -> 
  fraRateHelperFromIndexRaw'_ a1' a2' a3' a4' a5' a6' a7' >>= \res ->
  peekRateHelper res >>= \res' ->
  errorCheck  a7'>>
  return (res')

{-# LINE 633 "./QuantLib/TermStructure/Yield.chs" #-}


fraRateHelperFromPeriodRaw :: (GenQuote q) -> ((Int,TimeUnit)) -- ^periodToStart
 -> (Word) -- ^lengthInMonths
 -> (Word) -- ^fixingDays
 -> (Calendar) -> (BusinessDayConvention) -> (Bool) -- ^endOfMonth
 -> (DayCounter) -> (PillarChoice) -- ^pillar
 -> (Maybe Day) -- ^customPillarDate
 -> (Bool) -- ^useIndexedCoupon
 -> IO ((RateHelper))
fraRateHelperFromPeriodRaw a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 =
  withQuote a1 $ \a1' -> 
  let {(a2'1, a2'2) = fromEnumQuantity a2} in 
  let {a3' = fromIntegral a3} in 
  let {a4' = fromIntegral a4} in 
  withCalendar a5 $ \a5' -> 
  let {a6' = fromEnumC a6} in 
  let {a7' = C2HSImp.fromBool a7} in 
  withDayCounter a8 $ \a8' -> 
  let {a9' = (fromIntegral . fromEnum) a9} in 
  withMaybeDay a10 $ \a10' -> 
  let {a11' = C2HSImp.fromBool a11} in 
  preErrorCheck $ \a12' -> 
  fraRateHelperFromPeriodRaw'_ a1' a2'1  a2'2 a3' a4' a5' a6' a7' a8' a9' a10' a11' a12' >>= \res ->
  peekRateHelper res >>= \res' ->
  errorCheck  a12'>>
  return (res')

{-# LINE 643 "./QuantLib/TermStructure/Yield.chs" #-}


fraIborRateHelperRaw :: (GenQuote q) -> ((Int,TimeUnit)) -- ^periodToStart
 -> (GenIborIndex ibor) -> (PillarChoice) -- ^pillar
 -> (Maybe Day) -- ^customPillarDate
 -> (Bool) -- ^useIndexedCoupon
 -> IO ((RateHelper))
fraIborRateHelperRaw a1 a2 a3 a4 a5 a6 =
  withQuote a1 $ \a1' -> 
  let {(a2'1, a2'2) = fromEnumQuantity a2} in 
  withIborIndex a3 $ \a3' -> 
  let {a4' = (fromIntegral . fromEnum) a4} in 
  withMaybeDay a5 $ \a5' -> 
  let {a6' = C2HSImp.fromBool a6} in 
  preErrorCheck $ \a7' -> 
  fraIborRateHelperRaw'_ a1' a2'1  a2'2 a3' a4' a5' a6' a7' >>= \res ->
  peekRateHelper res >>= \res' ->
  errorCheck  a7'>>
  return (res')

{-# LINE 650 "./QuantLib/TermStructure/Yield.chs" #-}


-- |How an IborIndex futures contract's underlying deposit is given. @FuturesFromIndex@ takes
-- the deposit's length and its calendar\/convention\/day-count from the ibor index; the others
-- state them explicitly.
data FuturesTerms ibor
  = FuturesMonths
      !Day -- ^iborStartDate
      !Word -- ^lengthInMonths
      !Calendar
      !BusinessDayConvention
      !Bool -- ^endOfMonth
      !DayCounter
  | FuturesBetweenDates
      !Day -- ^iborStartDate
      !Day -- ^iborEndDate
      !DayCounter
  | FuturesFromIndex
      !Day -- ^iborStartDate
      !(GenIborIndex ibor)

-- |Rate helper for bootstrapping over IborIndex futures prices.
futuresRateHelper :: GenQuote q1 -- ^price
  -> FuturesTerms ibor
  -> Maybe (GenQuote q2) -- ^convexityAdjustment
  -> FuturesType -- ^type
  -> IO FuturesRateHelper
futuresRateHelper :: forall q1 ibor q2.
GenQuote q1
-> FuturesTerms ibor
-> Maybe (GenQuote q2)
-> FuturesType
-> IO FuturesRateHelper
futuresRateHelper GenQuote q1
price FuturesTerms ibor
terms = case FuturesTerms ibor
terms of
  FuturesMonths Day
d Word
n Calendar
cal BusinessDayConvention
conv Bool
eom DayCounter
dc -> GenQuote q1
-> Day
-> Word
-> Calendar
-> BusinessDayConvention
-> Bool
-> DayCounter
-> Maybe (GenQuote q2)
-> FuturesType
-> IO FuturesRateHelper
forall q1 q2.
GenQuote q1
-> Day
-> Word
-> Calendar
-> BusinessDayConvention
-> Bool
-> DayCounter
-> Maybe (GenQuote q2)
-> FuturesType
-> IO FuturesRateHelper
futuresRateHelperRaw GenQuote q1
price Day
d Word
n Calendar
cal BusinessDayConvention
conv Bool
eom DayCounter
dc
  FuturesBetweenDates Day
s Day
e DayCounter
dc -> GenQuote q1
-> Day
-> Day
-> DayCounter
-> Maybe (GenQuote q2)
-> FuturesType
-> IO FuturesRateHelper
forall q1 q2.
GenQuote q1
-> Day
-> Day
-> DayCounter
-> Maybe (GenQuote q2)
-> FuturesType
-> IO FuturesRateHelper
futuresRateHelperBetweenDatesRaw GenQuote q1
price Day
s Day
e DayCounter
dc
  FuturesFromIndex Day
d GenIborIndex ibor
idx -> GenQuote q1
-> Day
-> GenIborIndex ibor
-> Maybe (GenQuote q2)
-> FuturesType
-> IO FuturesRateHelper
forall q1 ibor q2.
GenQuote q1
-> Day
-> GenIborIndex ibor
-> Maybe (GenQuote q2)
-> FuturesType
-> IO FuturesRateHelper
futuresIborRateHelperRaw GenQuote q1
price Day
d GenIborIndex ibor
idx

-- Raw futures bindings behind 'futuresRateHelper'; one per 'FuturesTerms' constructor.
futuresRateHelperBetweenDatesRaw :: (GenQuote q1) -> (Day) -- ^immStartDate
 -> (Day) -- ^endDate
 -> (DayCounter) -> (Maybe (GenQuote q2)) -- ^convexityAdjustment
 -> (FuturesType) -- ^type
 -> IO ((FuturesRateHelper))
futuresRateHelperBetweenDatesRaw :: forall q1 q2.
GenQuote q1
-> Day
-> Day
-> DayCounter
-> Maybe (GenQuote q2)
-> FuturesType
-> IO FuturesRateHelper
futuresRateHelperBetweenDatesRaw GenQuote q1
a1 Day
a2 Day
a3 DayCounter
a4 Maybe (GenQuote q2)
a5 FuturesType
a6 =
  GenQuote q1
-> (Ptr CQuote' -> IO FuturesRateHelper) -> IO FuturesRateHelper
forall q b. GenQuote q -> (Ptr CQuote' -> IO b) -> IO b
withQuote GenQuote q1
a1 ((Ptr CQuote' -> IO FuturesRateHelper) -> IO FuturesRateHelper)
-> (Ptr CQuote' -> IO FuturesRateHelper) -> IO FuturesRateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr CQuote'
a1' -> 
  Day -> (CInt -> IO FuturesRateHelper) -> IO FuturesRateHelper
forall a. Day -> (CInt -> IO a) -> IO a
withDay Day
a2 ((CInt -> IO FuturesRateHelper) -> IO FuturesRateHelper)
-> (CInt -> IO FuturesRateHelper) -> IO FuturesRateHelper
forall a b. (a -> b) -> a -> b
$ \CInt
a2' -> 
  Day -> (CInt -> IO FuturesRateHelper) -> IO FuturesRateHelper
forall a. Day -> (CInt -> IO a) -> IO a
withDay Day
a3 ((CInt -> IO FuturesRateHelper) -> IO FuturesRateHelper)
-> (CInt -> IO FuturesRateHelper) -> IO FuturesRateHelper
forall a b. (a -> b) -> a -> b
$ \CInt
a3' -> 
  DayCounter
-> (Ptr CDayCounter -> IO FuturesRateHelper)
-> IO FuturesRateHelper
forall b. DayCounter -> (Ptr CDayCounter -> IO b) -> IO b
withDayCounter DayCounter
a4 ((Ptr CDayCounter -> IO FuturesRateHelper) -> IO FuturesRateHelper)
-> (Ptr CDayCounter -> IO FuturesRateHelper)
-> IO FuturesRateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr CDayCounter
a4' -> 
  Maybe (GenQuote q2)
-> (Ptr CQuote' -> IO FuturesRateHelper) -> IO FuturesRateHelper
forall q b. Maybe (GenQuote q) -> (Ptr CQuote' -> IO b) -> IO b
withMaybeQuote Maybe (GenQuote q2)
a5 ((Ptr CQuote' -> IO FuturesRateHelper) -> IO FuturesRateHelper)
-> (Ptr CQuote' -> IO FuturesRateHelper) -> IO FuturesRateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr CQuote'
a5' -> 
  let {a6' :: CInt
a6' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (FuturesType -> Int) -> FuturesType -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FuturesType -> Int
forall a. Enum a => a -> Int
fromEnum) FuturesType
a6} in 
  (Ptr (Ptr CChar) -> IO FuturesRateHelper) -> IO FuturesRateHelper
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr CChar) -> IO FuturesRateHelper) -> IO FuturesRateHelper)
-> (Ptr (Ptr CChar) -> IO FuturesRateHelper)
-> IO FuturesRateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr CChar)
a7' -> 
  Ptr CQuote'
-> CInt
-> CInt
-> Ptr CDayCounter
-> Ptr CQuote'
-> CInt
-> Ptr (Ptr CChar)
-> IO (Ptr CFuturesRateHelper')
futuresRateHelperBetweenDatesRaw'_ Ptr CQuote'
a1' CInt
a2' CInt
a3' Ptr CDayCounter
a4' Ptr CQuote'
a5' CInt
a6' Ptr (Ptr CChar)
a7' IO (Ptr CFuturesRateHelper')
-> (Ptr CFuturesRateHelper' -> IO FuturesRateHelper)
-> IO FuturesRateHelper
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Ptr CFuturesRateHelper'
res ->
  Ptr CFuturesRateHelper' -> IO FuturesRateHelper
peekFuturesRateHelper Ptr CFuturesRateHelper'
res IO FuturesRateHelper
-> (FuturesRateHelper -> IO FuturesRateHelper)
-> IO FuturesRateHelper
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \FuturesRateHelper
res' ->
  Ptr (Ptr CChar) -> IO ()
errorCheck  Ptr (Ptr CChar)
a7'IO () -> IO FuturesRateHelper -> IO FuturesRateHelper
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
  FuturesRateHelper -> IO FuturesRateHelper
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (FuturesRateHelper
res')

{-# LINE 687 "./QuantLib/TermStructure/Yield.chs" #-}


futuresIborRateHelperRaw :: (GenQuote q1) -> (Day) -- ^immDate
 -> (GenIborIndex ibor) -> (Maybe (GenQuote q2)) -- ^convexityAdjustment
 -> (FuturesType) -- ^type
 -> IO ((FuturesRateHelper))
futuresIborRateHelperRaw a1 a2 a3 a4 a5 =
  withQuote a1 $ \a1' -> 
  withDay a2 $ \a2' -> 
  withIborIndex a3 $ \a3' -> 
  withMaybeQuote a4 $ \a4' -> 
  let {a5' = (fromIntegral . fromEnum) a5} in 
  preErrorCheck $ \a6' -> 
  futuresIborRateHelperRaw'_ a1' a2' a3' a4' a5' a6' >>= \res ->
  peekFuturesRateHelper res >>= \res' ->
  errorCheck  a6'>>
  return (res')

{-# LINE 692 "./QuantLib/TermStructure/Yield.chs" #-}


futuresRateHelperRaw :: (GenQuote q1) -> (Day) -- ^immDate
 -> (Word) -- ^lengthInMonths
 -> (Calendar) -> (BusinessDayConvention) -> (Bool) -- ^endOfMonth
 -> (DayCounter) -> (Maybe (GenQuote q2)) -- ^convexityAdjustment
 -> (FuturesType) -- ^type
 -> IO ((FuturesRateHelper))
futuresRateHelperRaw a1 a2 a3 a4 a5 a6 a7 a8 a9 =
  withQuote a1 $ \a1' -> 
  withDay a2 $ \a2' -> 
  let {a3' = fromIntegral a3} in 
  withCalendar a4 $ \a4' -> 
  let {a5' = fromEnumC a5} in 
  let {a6' = C2HSImp.fromBool a6} in 
  withDayCounter a7 $ \a7' -> 
  withMaybeQuote a8 $ \a8' -> 
  let {a9' = (fromIntegral . fromEnum) a9} in 
  preErrorCheck $ \a10' -> 
  futuresRateHelperRaw'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' a10' >>= \res ->
  peekFuturesRateHelper res >>= \res' ->
  errorCheck  a10'>>
  return (res')

{-# LINE 699 "./QuantLib/TermStructure/Yield.chs" #-}


-- |The futures-vs-forward convexity adjustment this helper was built with (0 if none was given).
futuresRateHelperConvexityAdjustment :: (FuturesRateHelper) -> IO ((Double))
futuresRateHelperConvexityAdjustment a1 =
  withGenRateHelper a1 $ \a1' -> 
  preErrorCheck $ \a2' -> 
  futuresRateHelperConvexityAdjustment'_ a1' a2' >>= \res ->
  let {res' = realToFrac res} in
  errorCheck  a2'>>
  return (res')

{-# LINE 702 "./QuantLib/TermStructure/Yield.chs" #-}


-- |Rate helper for bootstrapping over overnight-index compounding futures.
overnightIndexFutureRateHelper :: (GenQuote q1) -> (Day) -- ^valueDate
 -> (Day) -- ^maturityDate
 -> (OvernightIborIndex) -> (Maybe (GenQuote q2)) -- ^convexityAdjustment
 -> (RateAveragingType) -- ^averagingMethod
 -> (PillarChoice) -- ^pillar
 -> (Maybe Day) -- ^customPillarDate
 -> IO ((OvernightIndexFutureRateHelper))
overnightIndexFutureRateHelper a1 a2 a3 a4 a5 a6 a7 a8 =
  withQuote a1 $ \a1' -> 
  withDay a2 $ \a2' -> 
  withDay a3 $ \a3' -> 
  withOvernightIborIndex a4 $ \a4' -> 
  withMaybeQuote a5 $ \a5' -> 
  let {a6' = (fromIntegral . fromEnum) a6} in 
  let {a7' = (fromIntegral . fromEnum) a7} in 
  withMaybeDay a8 $ \a8' -> 
  preErrorCheck $ \a9' -> 
  overnightIndexFutureRateHelper'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' >>= \res ->
  peekOvernightIndexFutureRateHelper res >>= \res' ->
  errorCheck  a9'>>
  return (res')

{-# LINE 712 "./QuantLib/TermStructure/Yield.chs" #-}


-- |The futures-vs-forward convexity adjustment this helper was built with (0 if none was given).
overnightIndexFutureRateHelperConvexityAdjustment :: (OvernightIndexFutureRateHelper) -> IO ((Double))
overnightIndexFutureRateHelperConvexityAdjustment a1 =
  withGenRateHelper a1 $ \a1' -> 
  preErrorCheck $ \a2' -> 
  overnightIndexFutureRateHelperConvexityAdjustment'_ a1' a2' >>= \res ->
  let {res' = realToFrac res} in
  errorCheck  a2'>>
  return (res')

{-# LINE 715 "./QuantLib/TermStructure/Yield.chs" #-}


-- |Every fixing this rate helper reads from the store, as @(index name, fixing date)@ pairs.  A
-- bootstrapped curve cannot be asked what it was built from -- @PiecewiseYieldCurve@ is a
-- template with no instruments accessor, and an @Observer@ does not expose the observables it
-- registered with -- so a curve's fixing dependencies are the union of its helpers', and this
-- answers for one helper.  It walks the helper's underlying instrument the way
-- 'QuantLib.CashFlow.fixingDependencies' walks a leg, and names each index by
-- 'QuantLib.Index.name', the key QuantLib\'s process-global fixing store uses.
--
-- A swap, OIS, basis-swap, BMA, multiple-resets or bond helper answers from its underlying.  A
-- deposit, FRA or futures helper reads no stored fixing and correctly reports @Just []@.  A
-- cross-currency helper keeps no legs for QuantLib to hand back, so it reports 'Nothing':
-- "cannot see it", which is not the same as "needs nothing".
--
-- The dates follow the evaluation date, because a relative-date helper re-initialises its
-- schedule when that date moves: call this under the date whose fixings are being asked about.
-- Duplicates are not removed, the same as for a leg.
rateHelperFixingDependencies :: GenRateHelper rh -> IO (Maybe [(String, Day)])
rateHelperFixingDependencies :: forall rh. GenRateHelper rh -> IO (Maybe [(String, Day)])
rateHelperFixingDependencies GenRateHelper rh
h = do
  (ns, ds, ok) <- GenRateHelper rh -> IO ([String], [Day], CInt)
forall rh. GenRateHelper rh -> IO ([String], [Day], CInt)
qlRateHelperFixingDependencies GenRateHelper rh
h
  pure $ if ok /= 0 then Just (zip ns ds) else Nothing
qlRateHelperFixingDependencies :: (GenRateHelper rh) -> IO (([String]), ([Day]), (CInt))
qlRateHelperFixingDependencies :: forall rh. GenRateHelper rh -> IO ([String], [Day], CInt)
qlRateHelperFixingDependencies GenRateHelper rh
a1 =
  GenRateHelper rh
-> (Ptr CRateHelper' -> IO ([String], [Day], CInt))
-> IO ([String], [Day], CInt)
forall rh b. GenRateHelper rh -> (Ptr CRateHelper' -> IO b) -> IO b
withRateHelper GenRateHelper rh
a1 ((Ptr CRateHelper' -> IO ([String], [Day], CInt))
 -> IO ([String], [Day], CInt))
-> (Ptr CRateHelper' -> IO ([String], [Day], CInt))
-> IO ([String], [Day], CInt)
forall a b. (a -> b) -> a -> b
$ \Ptr CRateHelper'
a1' -> 
  ((Ptr CUInt, Ptr (Ptr (Ptr CChar))) -> IO ([String], [Day], CInt))
-> IO ([String], [Day], CInt)
forall a b. ((Ptr CUInt, Ptr (Ptr a)) -> IO b) -> IO b
preArray (((Ptr CUInt, Ptr (Ptr (Ptr CChar))) -> IO ([String], [Day], CInt))
 -> IO ([String], [Day], CInt))
-> ((Ptr CUInt, Ptr (Ptr (Ptr CChar)))
    -> IO ([String], [Day], CInt))
-> IO ([String], [Day], CInt)
forall a b. (a -> b) -> a -> b
$ \(Ptr CUInt
a2'1, Ptr (Ptr (Ptr CChar))
a2'2) -> 
  ((Ptr CUInt, Ptr (Ptr CInt)) -> IO ([String], [Day], CInt))
-> IO ([String], [Day], CInt)
forall a b. ((Ptr CUInt, Ptr (Ptr a)) -> IO b) -> IO b
preArray (((Ptr CUInt, Ptr (Ptr CInt)) -> IO ([String], [Day], CInt))
 -> IO ([String], [Day], CInt))
-> ((Ptr CUInt, Ptr (Ptr CInt)) -> IO ([String], [Day], CInt))
-> IO ([String], [Day], CInt)
forall a b. (a -> b) -> a -> b
$ \(Ptr CUInt
a3'1, Ptr (Ptr CInt)
a3'2) -> 
  (Ptr CInt -> IO ([String], [Day], CInt))
-> IO ([String], [Day], CInt)
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr CInt -> IO ([String], [Day], CInt))
 -> IO ([String], [Day], CInt))
-> (Ptr CInt -> IO ([String], [Day], CInt))
-> IO ([String], [Day], CInt)
forall a b. (a -> b) -> a -> b
$ \Ptr CInt
a4' -> 
  (Ptr (Ptr CChar) -> IO ([String], [Day], CInt))
-> IO ([String], [Day], CInt)
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr CChar) -> IO ([String], [Day], CInt))
 -> IO ([String], [Day], CInt))
-> (Ptr (Ptr CChar) -> IO ([String], [Day], CInt))
-> IO ([String], [Day], CInt)
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr CChar)
a5' -> 
  Ptr CRateHelper'
-> Ptr CUInt
-> Ptr (Ptr (Ptr CChar))
-> Ptr CUInt
-> Ptr (Ptr CInt)
-> Ptr CInt
-> Ptr (Ptr CChar)
-> IO ()
qlRateHelperFixingDependencies'_ Ptr CRateHelper'
a1' Ptr CUInt
a2'1  Ptr (Ptr (Ptr CChar))
a2'2 Ptr CUInt
a3'1  Ptr (Ptr CInt)
a3'2 Ptr CInt
a4' Ptr (Ptr CChar)
a5' IO () -> IO [String] -> IO [String]
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
  Ptr CUInt -> Ptr (Ptr (Ptr CChar)) -> IO [String]
peekCStringArray  Ptr CUInt
a2'1  Ptr (Ptr (Ptr CChar))
a2'2IO [String]
-> ([String] -> IO ([String], [Day], CInt))
-> IO ([String], [Day], CInt)
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \[String]
a2'' -> 
  Ptr CUInt -> Ptr (Ptr CInt) -> IO [Day]
peekDayArray  Ptr CUInt
a3'1  Ptr (Ptr CInt)
a3'2IO [Day]
-> ([Day] -> IO ([String], [Day], CInt))
-> IO ([String], [Day], CInt)
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \[Day]
a3'' -> 
  Ptr CInt -> IO CInt
forall a. Storable a => Ptr a -> IO a
peek  Ptr CInt
a4'IO CInt
-> (CInt -> IO ([String], [Day], CInt))
-> IO ([String], [Day], CInt)
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \CInt
a4'' -> 
  Ptr (Ptr CChar) -> IO ()
errorCheck  Ptr (Ptr CChar)
a5'IO () -> IO ([String], [Day], CInt) -> IO ([String], [Day], CInt)
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
  ([String], [Day], CInt) -> IO ([String], [Day], CInt)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ([String]
a2'', [Day]
a3'', CInt
a4'')

{-# LINE 739 "./QuantLib/TermStructure/Yield.chs" #-}


-- |Rate helper for bootstrapping over CME SOFR futures. Compounds overnight SOFR from the third
-- Wednesday of 'referenceMonth'\/'referenceYear' (inclusive) to the third Wednesday of the
-- following month or quarter (exclusive), per 'referenceFreq'.
sofrFutureRateHelper :: (GenQuote q1) -> (Month) -- ^referenceMonth
 -> (Int) -- ^referenceYear
 -> (Frequency) -- ^referenceFreq
 -> (Maybe (GenQuote q2)) -- ^convexityAdjustment
 -> (PillarChoice) -- ^pillar
 -> (Maybe Day) -- ^customPillarDate
 -> IO ((RateHelper))
sofrFutureRateHelper :: forall q1 q2.
GenQuote q1
-> Month
-> Int
-> Frequency
-> Maybe (GenQuote q2)
-> PillarChoice
-> Maybe Day
-> IO RateHelper
sofrFutureRateHelper GenQuote q1
a1 Month
a2 Int
a3 Frequency
a4 Maybe (GenQuote q2)
a5 PillarChoice
a6 Maybe Day
a7 =
  GenQuote q1 -> (Ptr CQuote' -> IO RateHelper) -> IO RateHelper
forall q b. GenQuote q -> (Ptr CQuote' -> IO b) -> IO b
withQuote GenQuote q1
a1 ((Ptr CQuote' -> IO RateHelper) -> IO RateHelper)
-> (Ptr CQuote' -> IO RateHelper) -> IO RateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr CQuote'
a1' -> 
  let {a2' :: CInt
a2' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Month -> Int) -> Month -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Month -> Int
forall a. Enum a => a -> Int
fromEnum) Month
a2} in 
  let {a3' :: CInt
a3' = Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
a3} in 
  let {a4' :: CInt
a4' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Frequency -> Int) -> Frequency -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Frequency -> Int
forall a. Enum a => a -> Int
fromEnum) Frequency
a4} in 
  Maybe (GenQuote q2)
-> (Ptr CQuote' -> IO RateHelper) -> IO RateHelper
forall q b. Maybe (GenQuote q) -> (Ptr CQuote' -> IO b) -> IO b
withMaybeQuote Maybe (GenQuote q2)
a5 ((Ptr CQuote' -> IO RateHelper) -> IO RateHelper)
-> (Ptr CQuote' -> IO RateHelper) -> IO RateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr CQuote'
a5' -> 
  let {a6' :: CInt
a6' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (PillarChoice -> Int) -> PillarChoice -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. PillarChoice -> Int
forall a. Enum a => a -> Int
fromEnum) PillarChoice
a6} in 
  Maybe Day -> (CInt -> IO RateHelper) -> IO RateHelper
forall a. Maybe Day -> (CInt -> IO a) -> IO a
withMaybeDay Maybe Day
a7 ((CInt -> IO RateHelper) -> IO RateHelper)
-> (CInt -> IO RateHelper) -> IO RateHelper
forall a b. (a -> b) -> a -> b
$ \CInt
a7' -> 
  (Ptr (Ptr CChar) -> IO RateHelper) -> IO RateHelper
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr CChar) -> IO RateHelper) -> IO RateHelper)
-> (Ptr (Ptr CChar) -> IO RateHelper) -> IO RateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr CChar)
a8' -> 
  Ptr CQuote'
-> CInt
-> CInt
-> CInt
-> Ptr CQuote'
-> CInt
-> CInt
-> Ptr (Ptr CChar)
-> IO (Ptr CRateHelper')
sofrFutureRateHelper'_ Ptr CQuote'
a1' CInt
a2' CInt
a3' CInt
a4' Ptr CQuote'
a5' CInt
a6' CInt
a7' Ptr (Ptr CChar)
a8' IO (Ptr CRateHelper')
-> (Ptr CRateHelper' -> IO RateHelper) -> IO RateHelper
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Ptr CRateHelper'
res ->
  Ptr CRateHelper' -> IO RateHelper
peekRateHelper Ptr CRateHelper'
res IO RateHelper -> (RateHelper -> IO RateHelper) -> IO RateHelper
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \RateHelper
res' ->
  Ptr (Ptr CChar) -> IO ()
errorCheck  Ptr (Ptr CChar)
a8'IO () -> IO RateHelper -> IO RateHelper
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
  RateHelper -> IO RateHelper
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (RateHelper
res')

{-# LINE 750 "./QuantLib/TermStructure/Yield.chs" #-}


-- |The quote value implied by the current bootstrapped state of the curve the helper was
-- last used against, i.e. what the helper's own market quote would need to be to make it
-- reprice exactly.
impliedQuote :: (GenRateHelper rh) -> IO ((Double))
impliedQuote a1 =
  withRateHelper a1 $ \a1' -> 
  preErrorCheck $ \a2' -> 
  impliedQuote'_ a1' a2' >>= \res ->
  let {res' = realToFrac res} in
  errorCheck  a2'>>
  return (res')

{-# LINE 755 "./QuantLib/TermStructure/Yield.chs" #-}


-- |A yield curve identical to 'baseCurve' but reporting a different reference date; observes
-- and stays linked to 'baseCurve'.
impliedTermStructure :: (GenYieldTermStructure y) -> (Day) -> IO ((YieldTermStructure))
impliedTermStructure a1 a2 =
  withYieldTermStructure a1 $ \a1' -> 
  withDay a2 $ \a2' -> 
  preErrorCheck $ \a3' -> 
  impliedTermStructure'_ a1' a2' a3' >>= \res ->
  peekYieldTermStructure res >>= \res' ->
  errorCheck  a3'>>
  return (res')

{-# LINE 759 "./QuantLib/TermStructure/Yield.chs" #-}


-- |A yield curve with a vector of zero-yield spreads added to 'baseCurve', interpolating
-- between the given dates with the given 'Interpolation'. Remains linked to changes in
-- 'baseCurve' or the spread quotes.
piecewiseZeroSpreadedTermStructure :: GenYieldTermStructure y
  -> NonEmpty (Day, GenQuote q)  -- ^spreads
  -> Compounding -> Frequency -> Interpolation -> IO YieldTermStructure
piecewiseZeroSpreadedTermStructure ts qd c f i = uncurryNested (qlPiecewiseZeroSpreadedTermStructure ts qs ds c f) (qlInterpolation i)
  where (ds, qs) = unzip (toList qd)
qlPiecewiseZeroSpreadedTermStructure :: (GenYieldTermStructure y) -> ([GenQuote q]) -> ([Day]) -> (Compounding) -> (Frequency) -> (Int) -> (Int) -> (Int) -> IO ((YieldTermStructure))
qlPiecewiseZeroSpreadedTermStructure :: forall y q.
GenYieldTermStructure y
-> [GenQuote q]
-> [Day]
-> Compounding
-> Frequency
-> Int
-> Int
-> Int
-> IO YieldTermStructure
qlPiecewiseZeroSpreadedTermStructure GenYieldTermStructure y
a1 [GenQuote q]
a2 [Day]
a3 Compounding
a4 Frequency
a5 Int
a6 Int
a7 Int
a8 =
  GenYieldTermStructure y
-> (Ptr CYieldTermStructure' -> IO YieldTermStructure)
-> IO YieldTermStructure
forall y b.
GenYieldTermStructure y
-> (Ptr CYieldTermStructure' -> IO b) -> IO b
withYieldTermStructure GenYieldTermStructure y
a1 ((Ptr CYieldTermStructure' -> IO YieldTermStructure)
 -> IO YieldTermStructure)
-> (Ptr CYieldTermStructure' -> IO YieldTermStructure)
-> IO YieldTermStructure
forall a b. (a -> b) -> a -> b
$ \Ptr CYieldTermStructure'
a1' -> 
  [GenQuote q]
-> ((CUInt, Ptr (Ptr CQuote')) -> IO YieldTermStructure)
-> IO YieldTermStructure
forall q b.
[GenQuote q] -> ((CUInt, Ptr (Ptr CQuote')) -> IO b) -> IO b
withQuoteArray [GenQuote q]
a2 (((CUInt, Ptr (Ptr CQuote')) -> IO YieldTermStructure)
 -> IO YieldTermStructure)
-> ((CUInt, Ptr (Ptr CQuote')) -> IO YieldTermStructure)
-> IO YieldTermStructure
forall a b. (a -> b) -> a -> b
$ \(CUInt
a2'1, Ptr (Ptr CQuote')
a2'2) -> 
  [Day]
-> ((CUInt, Ptr CInt) -> IO YieldTermStructure)
-> IO YieldTermStructure
forall b. [Day] -> ((CUInt, Ptr CInt) -> IO b) -> IO b
withDayArray [Day]
a3 (((CUInt, Ptr CInt) -> IO YieldTermStructure)
 -> IO YieldTermStructure)
-> ((CUInt, Ptr CInt) -> IO YieldTermStructure)
-> IO YieldTermStructure
forall a b. (a -> b) -> a -> b
$ \(CUInt
a3'1, Ptr CInt
a3'2) -> 
  let {a4' :: CInt
a4' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Compounding -> Int) -> Compounding -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Compounding -> Int
forall a. Enum a => a -> Int
fromEnum) Compounding
a4} in 
  let {a5' :: CInt
a5' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Frequency -> Int) -> Frequency -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Frequency -> Int
forall a. Enum a => a -> Int
fromEnum) Frequency
a5} in 
  let {a6' :: CInt
a6' = Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
a6} in 
  let {a7' :: CInt
a7' = Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
a7} in 
  let {a8' :: CInt
a8' = Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
a8} in 
  (Ptr (Ptr CChar) -> IO YieldTermStructure) -> IO YieldTermStructure
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr CChar) -> IO YieldTermStructure)
 -> IO YieldTermStructure)
-> (Ptr (Ptr CChar) -> IO YieldTermStructure)
-> IO YieldTermStructure
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr CChar)
a9' -> 
  Ptr CYieldTermStructure'
-> CUInt
-> Ptr (Ptr CQuote')
-> CUInt
-> Ptr CInt
-> CInt
-> CInt
-> CInt
-> CInt
-> CInt
-> Ptr (Ptr CChar)
-> IO (Ptr CYieldTermStructure')
qlPiecewiseZeroSpreadedTermStructure'_ Ptr CYieldTermStructure'
a1' CUInt
a2'1  Ptr (Ptr CQuote')
a2'2 CUInt
a3'1  Ptr CInt
a3'2 CInt
a4' CInt
a5' CInt
a6' CInt
a7' CInt
a8' Ptr (Ptr CChar)
a9' IO (Ptr CYieldTermStructure')
-> (Ptr CYieldTermStructure' -> IO YieldTermStructure)
-> IO YieldTermStructure
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Ptr CYieldTermStructure'
res ->
  Ptr CYieldTermStructure' -> IO YieldTermStructure
peekYieldTermStructure Ptr CYieldTermStructure'
res IO YieldTermStructure
-> (YieldTermStructure -> IO YieldTermStructure)
-> IO YieldTermStructure
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \YieldTermStructure
res' ->
  Ptr (Ptr CChar) -> IO ()
errorCheck  Ptr (Ptr CChar)
a9'IO () -> IO YieldTermStructure -> IO YieldTermStructure
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
  YieldTermStructure -> IO YieldTermStructure
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (YieldTermStructure
res')

{-# LINE 770 "./QuantLib/TermStructure/Yield.chs" #-}


-- |A yield curve adding interpolated instantaneous-forward spreads to 'baseCurve', flat outside
-- the spread dates. Linked to the base curve and quotes; its max date is the earlier of the base
-- curve's and the last spread date. @LogLinear@ and @LogCubic@ throw: the spread is integrated.
piecewiseForwardSpreadedTermStructure :: GenYieldTermStructure y
  -> NonEmpty (Day, GenQuote q)  -- ^spreads
  -> Interpolation -> IO YieldTermStructure
piecewiseForwardSpreadedTermStructure ts qd i = uncurryNested (qlPiecewiseForwardSpreadedTermStructure ts qs ds) (qlInterpolation i)
  where (ds, qs) = unzip (toList qd)
qlPiecewiseForwardSpreadedTermStructure :: (GenYieldTermStructure y) -> ([GenQuote q]) -> ([Day]) -> (Int) -> (Int) -> (Int) -> IO ((YieldTermStructure))
qlPiecewiseForwardSpreadedTermStructure a1 a2 a3 a4 a5 a6 =
  withYieldTermStructure a1 $ \a1' -> 
  withQuoteArray a2 $ \(a2'1, a2'2) -> 
  withDayArray a3 $ \(a3'1, a3'2) -> 
  let {a4' = fromIntegral a4} in 
  let {a5' = fromIntegral a5} in 
  let {a6' = fromIntegral a6} in 
  preErrorCheck $ \a7' -> 
  qlPiecewiseForwardSpreadedTermStructure'_ a1' a2'1  a2'2 a3'1  a3'2 a4' a5' a6' a7' >>= \res ->
  peekYieldTermStructure res >>= \res' ->
  errorCheck  a7'>>
  return (res')

{-# LINE 781 "./QuantLib/TermStructure/Yield.chs" #-}


-- |Quanto term structure, modelling the quanto effect in option pricing. Stays linked to all
-- four inputs.
quantoTermStructure :: (GenYieldTermStructure y1) -- ^underlyingDividendTS
 -> (GenYieldTermStructure y2) -- ^riskFreeTS
 -> (GenYieldTermStructure y3) -- ^foreignRsikFreeTS
 -> (GenBlackVolTermStructure bv1) -- ^underlyingBlackVolTS
 -> (Double) -- ^strike
 -> (GenBlackVolTermStructure bv2) -- ^exchRateBlackVolTS
 -> (Double) -- ^exchRateATMlevel
 -> (Double) -- ^underlyingExchRateCorrelation
 -> IO ((YieldTermStructure))
quantoTermStructure :: forall y1 y2 y3 bv1 bv2.
GenYieldTermStructure y1
-> GenYieldTermStructure y2
-> GenYieldTermStructure y3
-> GenBlackVolTermStructure bv1
-> Double
-> GenBlackVolTermStructure bv2
-> Double
-> Double
-> IO YieldTermStructure
quantoTermStructure GenYieldTermStructure y1
a1 GenYieldTermStructure y2
a2 GenYieldTermStructure y3
a3 GenBlackVolTermStructure bv1
a4 Double
a5 GenBlackVolTermStructure bv2
a6 Double
a7 Double
a8 =
  GenYieldTermStructure y1
-> (Ptr CYieldTermStructure' -> IO YieldTermStructure)
-> IO YieldTermStructure
forall y b.
GenYieldTermStructure y
-> (Ptr CYieldTermStructure' -> IO b) -> IO b
withYieldTermStructure GenYieldTermStructure y1
a1 ((Ptr CYieldTermStructure' -> IO YieldTermStructure)
 -> IO YieldTermStructure)
-> (Ptr CYieldTermStructure' -> IO YieldTermStructure)
-> IO YieldTermStructure
forall a b. (a -> b) -> a -> b
$ \Ptr CYieldTermStructure'
a1' -> 
  GenYieldTermStructure y2
-> (Ptr CYieldTermStructure' -> IO YieldTermStructure)
-> IO YieldTermStructure
forall y b.
GenYieldTermStructure y
-> (Ptr CYieldTermStructure' -> IO b) -> IO b
withYieldTermStructure GenYieldTermStructure y2
a2 ((Ptr CYieldTermStructure' -> IO YieldTermStructure)
 -> IO YieldTermStructure)
-> (Ptr CYieldTermStructure' -> IO YieldTermStructure)
-> IO YieldTermStructure
forall a b. (a -> b) -> a -> b
$ \Ptr CYieldTermStructure'
a2' -> 
  GenYieldTermStructure y3
-> (Ptr CYieldTermStructure' -> IO YieldTermStructure)
-> IO YieldTermStructure
forall y b.
GenYieldTermStructure y
-> (Ptr CYieldTermStructure' -> IO b) -> IO b
withYieldTermStructure GenYieldTermStructure y3
a3 ((Ptr CYieldTermStructure' -> IO YieldTermStructure)
 -> IO YieldTermStructure)
-> (Ptr CYieldTermStructure' -> IO YieldTermStructure)
-> IO YieldTermStructure
forall a b. (a -> b) -> a -> b
$ \Ptr CYieldTermStructure'
a3' -> 
  GenBlackVolTermStructure bv1
-> (Ptr CBlackVolTermStructure' -> IO YieldTermStructure)
-> IO YieldTermStructure
forall bv b.
GenBlackVolTermStructure bv
-> (Ptr CBlackVolTermStructure' -> IO b) -> IO b
withBlackVolTermStructure GenBlackVolTermStructure bv1
a4 ((Ptr CBlackVolTermStructure' -> IO YieldTermStructure)
 -> IO YieldTermStructure)
-> (Ptr CBlackVolTermStructure' -> IO YieldTermStructure)
-> IO YieldTermStructure
forall a b. (a -> b) -> a -> b
$ \Ptr CBlackVolTermStructure'
a4' -> 
  let {a5' :: CDouble
a5' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a5} in 
  GenBlackVolTermStructure bv2
-> (Ptr CBlackVolTermStructure' -> IO YieldTermStructure)
-> IO YieldTermStructure
forall bv b.
GenBlackVolTermStructure bv
-> (Ptr CBlackVolTermStructure' -> IO b) -> IO b
withBlackVolTermStructure GenBlackVolTermStructure bv2
a6 ((Ptr CBlackVolTermStructure' -> IO YieldTermStructure)
 -> IO YieldTermStructure)
-> (Ptr CBlackVolTermStructure' -> IO YieldTermStructure)
-> IO YieldTermStructure
forall a b. (a -> b) -> a -> b
$ \Ptr CBlackVolTermStructure'
a6' -> 
  let {a7' :: CDouble
a7' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a7} in 
  let {a8' :: CDouble
a8' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a8} in 
  (Ptr (Ptr CChar) -> IO YieldTermStructure) -> IO YieldTermStructure
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr CChar) -> IO YieldTermStructure)
 -> IO YieldTermStructure)
-> (Ptr (Ptr CChar) -> IO YieldTermStructure)
-> IO YieldTermStructure
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr CChar)
a9' -> 
  Ptr CYieldTermStructure'
-> Ptr CYieldTermStructure'
-> Ptr CYieldTermStructure'
-> Ptr CBlackVolTermStructure'
-> CDouble
-> Ptr CBlackVolTermStructure'
-> CDouble
-> CDouble
-> Ptr (Ptr CChar)
-> IO (Ptr CYieldTermStructure')
quantoTermStructure'_ Ptr CYieldTermStructure'
a1' Ptr CYieldTermStructure'
a2' Ptr CYieldTermStructure'
a3' Ptr CBlackVolTermStructure'
a4' CDouble
a5' Ptr CBlackVolTermStructure'
a6' CDouble
a7' CDouble
a8' Ptr (Ptr CChar)
a9' IO (Ptr CYieldTermStructure')
-> (Ptr CYieldTermStructure' -> IO YieldTermStructure)
-> IO YieldTermStructure
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Ptr CYieldTermStructure'
res ->
  Ptr CYieldTermStructure' -> IO YieldTermStructure
peekYieldTermStructure Ptr CYieldTermStructure'
res IO YieldTermStructure
-> (YieldTermStructure -> IO YieldTermStructure)
-> IO YieldTermStructure
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \YieldTermStructure
res' ->
  Ptr (Ptr CChar) -> IO ()
errorCheck  Ptr (Ptr CChar)
a9'IO () -> IO YieldTermStructure -> IO YieldTermStructure
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
  YieldTermStructure -> IO YieldTermStructure
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (YieldTermStructure
res')

{-# LINE 793 "./QuantLib/TermStructure/Yield.chs" #-}


-- |Blends 'originalCurve' with an ultimate forward rate beyond the last liquid point, per the
-- \"UFR\" methodology used for extrapolating long-dated (e.g. Solvency II) curves.
ultimateForwardTermStructure :: (GenYieldTermStructure y) -- ^originalCurve
 -> (GenQuote q1) -- ^lastLiquidForwardRate
 -> (GenQuote q2) -- ^ultimateForwardRate
 -> ((Int,TimeUnit)) -- ^firstSmoothingPoint
 -> (Double) -- ^alpha
 -> (Maybe Int) -- ^roundingDigits
 -> (Compounding) -> (Frequency) -> IO ((YieldTermStructure))
ultimateForwardTermStructure a1 a2 a3 a4 a5 a6 a7 a8 =
  withYieldTermStructure a1 $ \a1' -> 
  withQuote a2 $ \a2' -> 
  withQuote a3 $ \a3' -> 
  let {(a4'1, a4'2) = fromEnumQuantity a4} in 
  let {a5' = realToFrac a5} in 
  let {a6' = fromMaybeInt a6} in 
  let {a7' = (fromIntegral . fromEnum) a7} in 
  let {a8' = (fromIntegral . fromEnum) a8} in 
  preErrorCheck $ \a9' -> 
  ultimateForwardTermStructure'_ a1' a2' a3' a4'1  a4'2 a5' a6' a7' a8' a9' >>= \res ->
  peekYieldTermStructure res >>= \res' ->
  errorCheck  a9'>>
  return (res')

{-# LINE 805 "./QuantLib/TermStructure/Yield.chs" #-}


-- Raw iterative-bootstrap bindings used by 'piecewiseYieldCurve'.
-- Like the public iterative choice, this exposes every @IterativeBootstrap@ setting through
-- 'IterativeBootstrapOpts' instead of hardcoding upstream's defaults. Start from
-- 'defaultIterativeBootstrapOpts' and override with record-update syntax; passing it
-- unchanged is exactly 'piecewiseYieldCurve'. 'ibAccuracy'\/'ibMinValue'\/'ibMaxValue' are
-- 'Maybe' because upstream defaults them to @Null\<Real\>()@ (\"pick a sensible value per
-- pillar\"), not to a number. 'ibDontThrow' is the one to reach for when a curve fails to
-- bootstrap: it substitutes the best value found so far for a pillar that won't solve,
-- rather than throwing.
qlPiecewiseYieldCurveFull :: (Day) -> ([GenRateHelper rh]) -> (DayCounter) -> ([GenQuote q]) -> ([Day]) -> (BootstrapTrait) -> (Int) -> (Int) -> (Int) -> (Double) -> (Double) -> (Double) -> (Word) -> (Double) -> (Double) -> (Bool) -> (Word) -> (Word) -> IO ((YieldTermStructure))
qlPiecewiseYieldCurveFull a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 =
  withDay a1 $ \a1' -> 
  withRateHelperArray a2 $ \(a2'1, a2'2) -> 
  withDayCounter a3 $ \a3' -> 
  withQuoteArray a4 $ \(a4'1, a4'2) -> 
  withDayArray a5 $ \(a5'1, a5'2) -> 
  let {a6' = (fromIntegral . fromEnum) a6} in 
  let {a7' = fromIntegral a7} in 
  let {a8' = fromIntegral a8} in 
  let {a9' = fromIntegral a9} in 
  let {a10' = realToFrac a10} in 
  let {a11' = realToFrac a11} in 
  let {a12' = realToFrac a12} in 
  let {a13' = fromIntegral a13} in 
  let {a14' = realToFrac a14} in 
  let {a15' = realToFrac a15} in 
  let {a16' = C2HSImp.fromBool a16} in 
  let {a17' = fromIntegral a17} in 
  let {a18' = fromIntegral a18} in 
  preErrorCheck $ \a19' -> 
  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 ->
  peekYieldTermStructure res >>= \res' ->
  errorCheck  a19'>>
  return (res')

{-# LINE 816 "./QuantLib/TermStructure/Yield.chs" #-}


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))
qlPiecewiseYieldCurveFull1 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 a19 a20 =
  let {a1' = fromIntegral a1} in 
  withCalendar a2 $ \a2' -> 
  withRateHelperArray a3 $ \(a3'1, a3'2) -> 
  withDayCounter a4 $ \a4' -> 
  withQuoteArray a5 $ \(a5'1, a5'2) -> 
  withDayArray a6 $ \(a6'1, a6'2) -> 
  let {a7' = (fromIntegral . fromEnum) a7} in 
  let {a8' = fromIntegral a8} in 
  let {a9' = fromIntegral a9} in 
  let {a10' = fromIntegral a10} in 
  let {a11' = realToFrac a11} in 
  let {a12' = realToFrac a12} in 
  let {a13' = realToFrac a13} in 
  let {a14' = fromIntegral a14} in 
  let {a15' = realToFrac a15} in 
  let {a16' = realToFrac a16} in 
  let {a17' = C2HSImp.fromBool a17} in 
  let {a18' = fromIntegral a18} in 
  let {a19' = fromIntegral a19} in 
  let {a20' = C2HSImp.fromBool a20} in 
  preErrorCheck $ \a21' -> 
  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 ->
  peekYieldTermStructure res >>= \res' ->
  errorCheck  a21'>>
  return (res')

{-# LINE 818 "./QuantLib/TermStructure/Yield.chs" #-}


-- Raw moving-curve bindings used by 'piecewiseYieldCurve'.
qlPiecewiseYieldCurveGlobalBootstrap1 :: (Word) -> (Calendar) -> ([GenRateHelper rh]) -> (DayCounter) -> ([GenQuote q]) -> ([Day]) -> (Double) -> ([Double]) -> (Bool) -> IO ((YieldTermStructure))
qlPiecewiseYieldCurveGlobalBootstrap1 a1 a2 a3 a4 a5 a6 a7 a8 a9 =
  let {a1' = fromIntegral a1} in 
  withCalendar a2 $ \a2' -> 
  withRateHelperArray a3 $ \(a3'1, a3'2) -> 
  withDayCounter a4 $ \a4' -> 
  withQuoteArray a5 $ \(a5'1, a5'2) -> 
  withDayArray a6 $ \(a6'1, a6'2) -> 
  let {a7' = realToFrac a7} in 
  withDoubleArray a8 $ \(a8'1, a8'2) -> 
  let {a9' = C2HSImp.fromBool a9} in 
  preErrorCheck $ \a10' -> 
  qlPiecewiseYieldCurveGlobalBootstrap1'_ a1' a2' a3'1  a3'2 a4' a5'1  a5'2 a6'1  a6'2 a7' a8'1  a8'2 a9' a10' >>= \res ->
  peekYieldTermStructure res >>= \res' ->
  errorCheck  a10'>>
  return (res')

{-# LINE 821 "./QuantLib/TermStructure/Yield.chs" #-}


qlPiecewiseYieldCurveGlobalBootstrap2 :: (Word) -> (Calendar) -> ([GenRateHelper rh]) -> (DayCounter) -> ([GenQuote q]) -> ([Day]) -> (Double) -> ([Double]) -> (Bool) -> IO ((YieldTermStructure))
qlPiecewiseYieldCurveGlobalBootstrap2 a1 a2 a3 a4 a5 a6 a7 a8 a9 =
  let {a1' = fromIntegral a1} in 
  withCalendar a2 $ \a2' -> 
  withRateHelperArray a3 $ \(a3'1, a3'2) -> 
  withDayCounter a4 $ \a4' -> 
  withQuoteArray a5 $ \(a5'1, a5'2) -> 
  withDayArray a6 $ \(a6'1, a6'2) -> 
  let {a7' = realToFrac a7} in 
  withDoubleArray a8 $ \(a8'1, a8'2) -> 
  let {a9' = C2HSImp.fromBool a9} in 
  preErrorCheck $ \a10' -> 
  qlPiecewiseYieldCurveGlobalBootstrap2'_ a1' a2' a3'1  a3'2 a4' a5'1  a5'2 a6'1  a6'2 a7' a8'1  a8'2 a9' a10' >>= \res ->
  peekYieldTermStructure res >>= \res' ->
  errorCheck  a10'>>
  return (res')

{-# LINE 823 "./QuantLib/TermStructure/Yield.chs" #-}


qlPiecewiseYieldCurveGlobalBootstrap3 :: (Word) -> (Calendar) -> ([GenRateHelper rh1]) -> (DayCounter) -> ([GenQuote q]) -> ([Day]) -> ([GenRateHelper rh2]) -> ([Day]) -> (Double) -> (Bool) -> IO ((YieldTermStructure))
qlPiecewiseYieldCurveGlobalBootstrap3 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 =
  let {a1' = fromIntegral a1} in 
  withCalendar a2 $ \a2' -> 
  withRateHelperArray a3 $ \(a3'1, a3'2) -> 
  withDayCounter a4 $ \a4' -> 
  withQuoteArray a5 $ \(a5'1, a5'2) -> 
  withDayArray a6 $ \(a6'1, a6'2) -> 
  withRateHelperArray a7 $ \(a7'1, a7'2) -> 
  withDayArray a8 $ \(a8'1, a8'2) -> 
  let {a9' = realToFrac a9} in 
  let {a10' = C2HSImp.fromBool a10} in 
  preErrorCheck $ \a11' -> 
  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' >>= \res ->
  peekYieldTermStructure res >>= \res' ->
  errorCheck  a11'>>
  return (res')

{-# LINE 825 "./QuantLib/TermStructure/Yield.chs" #-}


qlPiecewiseYieldCurveGlobalBootstrap4 :: (Word) -> (Calendar) -> ([GenRateHelper rh]) -> (DayCounter) -> ([GenQuote q]) -> ([Day]) -> (Double) -> ([Double]) -> (Bool) -> IO ((YieldTermStructure))
qlPiecewiseYieldCurveGlobalBootstrap4 a1 a2 a3 a4 a5 a6 a7 a8 a9 =
  let {a1' = fromIntegral a1} in 
  withCalendar a2 $ \a2' -> 
  withRateHelperArray a3 $ \(a3'1, a3'2) -> 
  withDayCounter a4 $ \a4' -> 
  withQuoteArray a5 $ \(a5'1, a5'2) -> 
  withDayArray a6 $ \(a6'1, a6'2) -> 
  let {a7' = realToFrac a7} in 
  withDoubleArray a8 $ \(a8'1, a8'2) -> 
  let {a9' = C2HSImp.fromBool a9} in 
  preErrorCheck $ \a10' -> 
  qlPiecewiseYieldCurveGlobalBootstrap4'_ a1' a2' a3'1  a3'2 a4' a5'1  a5'2 a6'1  a6'2 a7' a8'1  a8'2 a9' a10' >>= \res ->
  peekYieldTermStructure res >>= \res' ->
  errorCheck  a10'>>
  return (res')

{-# LINE 827 "./QuantLib/TermStructure/Yield.chs" #-}


qlPiecewiseYieldCurveGlobalBootstrap5 :: (Word) -> (Calendar) -> ([GenRateHelper rh]) -> (DayCounter) -> ([GenQuote q]) -> ([Day]) -> (Double) -> ([Double]) -> (Bool) -> IO ((YieldTermStructure))
qlPiecewiseYieldCurveGlobalBootstrap5 a1 a2 a3 a4 a5 a6 a7 a8 a9 =
  let {a1' = fromIntegral a1} in 
  withCalendar a2 $ \a2' -> 
  withRateHelperArray a3 $ \(a3'1, a3'2) -> 
  withDayCounter a4 $ \a4' -> 
  withQuoteArray a5 $ \(a5'1, a5'2) -> 
  withDayArray a6 $ \(a6'1, a6'2) -> 
  let {a7' = realToFrac a7} in 
  withDoubleArray a8 $ \(a8'1, a8'2) -> 
  let {a9' = C2HSImp.fromBool a9} in 
  preErrorCheck $ \a10' -> 
  qlPiecewiseYieldCurveGlobalBootstrap5'_ a1' a2' a3'1  a3'2 a4' a5'1  a5'2 a6'1  a6'2 a7' a8'1  a8'2 a9' a10' >>= \res ->
  peekYieldTermStructure res >>= \res' ->
  errorCheck  a10'>>
  return (res')

{-# LINE 829 "./QuantLib/TermStructure/Yield.chs" #-}


qlPiecewiseYieldCurveLocalBootstrap1 :: (Word) -> (Calendar) -> ([GenRateHelper rh]) -> (DayCounter) -> ([GenQuote q]) -> ([Day]) -> (BootstrapTrait) -> (Word) -> (Bool) -> (Double) -> (Double) -> (Double) -> (Bool) -> (Bool) -> IO ((YieldTermStructure))
qlPiecewiseYieldCurveLocalBootstrap1 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 =
  let {a1' = fromIntegral a1} in 
  withCalendar a2 $ \a2' -> 
  withRateHelperArray a3 $ \(a3'1, a3'2) -> 
  withDayCounter a4 $ \a4' -> 
  withQuoteArray a5 $ \(a5'1, a5'2) -> 
  withDayArray a6 $ \(a6'1, a6'2) -> 
  let {a7' = (fromIntegral . fromEnum) a7} in 
  let {a8' = fromIntegral a8} in 
  let {a9' = C2HSImp.fromBool a9} in 
  let {a10' = realToFrac a10} in 
  let {a11' = realToFrac a11} in 
  let {a12' = realToFrac a12} in 
  let {a13' = C2HSImp.fromBool a13} in 
  let {a14' = C2HSImp.fromBool a14} in 
  preErrorCheck $ \a15' -> 
  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 ->
  peekYieldTermStructure res >>= \res' ->
  errorCheck  a15'>>
  return (res')

{-# LINE 831 "./QuantLib/TermStructure/Yield.chs" #-}


-- Raw fixed-curve bindings for the non-iterative bootstrap choices.
qlPiecewiseYieldCurveGlobalBootstrapFixed1 :: (Day) -> ([GenRateHelper rh]) -> (DayCounter) -> ([GenQuote q]) -> ([Day]) -> (Double) -> ([Double]) -> (Bool) -> IO ((YieldTermStructure))
qlPiecewiseYieldCurveGlobalBootstrapFixed1 a1 a2 a3 a4 a5 a6 a7 a8 =
  withDay a1 $ \a1' -> 
  withRateHelperArray a2 $ \(a2'1, a2'2) -> 
  withDayCounter a3 $ \a3' -> 
  withQuoteArray a4 $ \(a4'1, a4'2) -> 
  withDayArray a5 $ \(a5'1, a5'2) -> 
  let {a6' = realToFrac a6} in 
  withDoubleArray a7 $ \(a7'1, a7'2) -> 
  let {a8' = C2HSImp.fromBool a8} in 
  preErrorCheck $ \a9' -> 
  qlPiecewiseYieldCurveGlobalBootstrapFixed1'_ a1' a2'1  a2'2 a3' a4'1  a4'2 a5'1  a5'2 a6' a7'1  a7'2 a8' a9' >>= \res ->
  peekYieldTermStructure res >>= \res' ->
  errorCheck  a9'>>
  return (res')

{-# LINE 834 "./QuantLib/TermStructure/Yield.chs" #-}

qlPiecewiseYieldCurveGlobalBootstrapFixed2 :: (Day) -> ([GenRateHelper rh]) -> (DayCounter) -> ([GenQuote q]) -> ([Day]) -> (Double) -> ([Double]) -> (Bool) -> IO ((YieldTermStructure))
qlPiecewiseYieldCurveGlobalBootstrapFixed2 a1 a2 a3 a4 a5 a6 a7 a8 =
  withDay a1 $ \a1' -> 
  withRateHelperArray a2 $ \(a2'1, a2'2) -> 
  withDayCounter a3 $ \a3' -> 
  withQuoteArray a4 $ \(a4'1, a4'2) -> 
  withDayArray a5 $ \(a5'1, a5'2) -> 
  let {a6' = realToFrac a6} in 
  withDoubleArray a7 $ \(a7'1, a7'2) -> 
  let {a8' = C2HSImp.fromBool a8} in 
  preErrorCheck $ \a9' -> 
  qlPiecewiseYieldCurveGlobalBootstrapFixed2'_ a1' a2'1  a2'2 a3' a4'1  a4'2 a5'1  a5'2 a6' a7'1  a7'2 a8' a9' >>= \res ->
  peekYieldTermStructure res >>= \res' ->
  errorCheck  a9'>>
  return (res')

{-# LINE 835 "./QuantLib/TermStructure/Yield.chs" #-}

qlPiecewiseYieldCurveGlobalBootstrapFixed3 :: (Day) -> ([GenRateHelper rh1]) -> (DayCounter) -> ([GenQuote q]) -> ([Day]) -> ([GenRateHelper rh2]) -> ([Day]) -> (Double) -> (Bool) -> IO ((YieldTermStructure))
qlPiecewiseYieldCurveGlobalBootstrapFixed3 a1 a2 a3 a4 a5 a6 a7 a8 a9 =
  withDay a1 $ \a1' -> 
  withRateHelperArray a2 $ \(a2'1, a2'2) -> 
  withDayCounter a3 $ \a3' -> 
  withQuoteArray a4 $ \(a4'1, a4'2) -> 
  withDayArray a5 $ \(a5'1, a5'2) -> 
  withRateHelperArray a6 $ \(a6'1, a6'2) -> 
  withDayArray a7 $ \(a7'1, a7'2) -> 
  let {a8' = realToFrac a8} in 
  let {a9' = C2HSImp.fromBool a9} in 
  preErrorCheck $ \a10' -> 
  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' >>= \res ->
  peekYieldTermStructure res >>= \res' ->
  errorCheck  a10'>>
  return (res')

{-# LINE 836 "./QuantLib/TermStructure/Yield.chs" #-}

qlPiecewiseYieldCurveGlobalBootstrapFixed4 :: (Day) -> ([GenRateHelper rh]) -> (DayCounter) -> ([GenQuote q]) -> ([Day]) -> (Double) -> ([Double]) -> (Bool) -> IO ((YieldTermStructure))
qlPiecewiseYieldCurveGlobalBootstrapFixed4 a1 a2 a3 a4 a5 a6 a7 a8 =
  withDay a1 $ \a1' -> 
  withRateHelperArray a2 $ \(a2'1, a2'2) -> 
  withDayCounter a3 $ \a3' -> 
  withQuoteArray a4 $ \(a4'1, a4'2) -> 
  withDayArray a5 $ \(a5'1, a5'2) -> 
  let {a6' = realToFrac a6} in 
  withDoubleArray a7 $ \(a7'1, a7'2) -> 
  let {a8' = C2HSImp.fromBool a8} in 
  preErrorCheck $ \a9' -> 
  qlPiecewiseYieldCurveGlobalBootstrapFixed4'_ a1' a2'1  a2'2 a3' a4'1  a4'2 a5'1  a5'2 a6' a7'1  a7'2 a8' a9' >>= \res ->
  peekYieldTermStructure res >>= \res' ->
  errorCheck  a9'>>
  return (res')

{-# LINE 837 "./QuantLib/TermStructure/Yield.chs" #-}

qlPiecewiseYieldCurveGlobalBootstrapFixed5 :: (Day) -> ([GenRateHelper rh]) -> (DayCounter) -> ([GenQuote q]) -> ([Day]) -> (Double) -> ([Double]) -> (Bool) -> IO ((YieldTermStructure))
qlPiecewiseYieldCurveGlobalBootstrapFixed5 a1 a2 a3 a4 a5 a6 a7 a8 =
  withDay a1 $ \a1' -> 
  withRateHelperArray a2 $ \(a2'1, a2'2) -> 
  withDayCounter a3 $ \a3' -> 
  withQuoteArray a4 $ \(a4'1, a4'2) -> 
  withDayArray a5 $ \(a5'1, a5'2) -> 
  let {a6' = realToFrac a6} in 
  withDoubleArray a7 $ \(a7'1, a7'2) -> 
  let {a8' = C2HSImp.fromBool a8} in 
  preErrorCheck $ \a9' -> 
  qlPiecewiseYieldCurveGlobalBootstrapFixed5'_ a1' a2'1  a2'2 a3' a4'1  a4'2 a5'1  a5'2 a6' a7'1  a7'2 a8' a9' >>= \res ->
  peekYieldTermStructure res >>= \res' ->
  errorCheck  a9'>>
  return (res')

{-# LINE 838 "./QuantLib/TermStructure/Yield.chs" #-}

qlPiecewiseYieldCurveLocalBootstrapFixed :: (Day) -> ([GenRateHelper rh]) -> (DayCounter) -> ([GenQuote q]) -> ([Day]) -> (BootstrapTrait) -> (Word) -> (Bool) -> (Double) -> (Double) -> (Double) -> (Bool) -> (Bool) -> IO ((YieldTermStructure))
qlPiecewiseYieldCurveLocalBootstrapFixed a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 =
  withDay a1 $ \a1' -> 
  withRateHelperArray a2 $ \(a2'1, a2'2) -> 
  withDayCounter a3 $ \a3' -> 
  withQuoteArray a4 $ \(a4'1, a4'2) -> 
  withDayArray a5 $ \(a5'1, a5'2) -> 
  let {a6' = (fromIntegral . fromEnum) a6} in 
  let {a7' = fromIntegral a7} in 
  let {a8' = C2HSImp.fromBool a8} in 
  let {a9' = realToFrac a9} in 
  let {a10' = realToFrac a10} in 
  let {a11' = realToFrac a11} in 
  let {a12' = C2HSImp.fromBool a12} in 
  let {a13' = C2HSImp.fromBool a13} in 
  preErrorCheck $ \a14' -> 
  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 ->
  peekYieldTermStructure res >>= \res' ->
  errorCheck  a14'>>
  return (res')

{-# LINE 839 "./QuantLib/TermStructure/Yield.chs" #-}


-- |Selects the bootstrapper used by 'piecewiseYieldCurve' and carries exactly the
-- parameters valid for that choice. 'Iterative' uses the selected trait, interpolation, and
-- full iterative settings. The @Global*@ constructors solve all instruments together; their
-- list field contains instrument weights, with an empty list selecting equal weights.
-- 'GlobalSimpleZeroLinearFull' additionally takes helper instruments, their interpolation
-- dates (exactly two fewer than the helpers), and accuracy. 'Local' uses @ConvexMonotone@
-- interpolation and restricts the trait to 'LocalBootstrapTrait', because @Discount@ produces
-- invalid results with QuantLib's local bootstrapper.
data Bootstrap rh2
  = Iterative !BootstrapTrait !Interpolation !IterativeBootstrapOpts
  | GlobalDiscountLogLinear !Double ![Double] -- ^accuracy, instrumentWeights
  | GlobalSimpleZeroLinear !Double ![Double] -- ^accuracy, instrumentWeights
  | GlobalSimpleZeroLinearFull !(NonEmpty (GenRateHelper rh2)) ![Day] !Double -- ^additionalHelpers, additionalDates, accuracy
  | GlobalForwardRateLinear !Double ![Double] -- ^accuracy, instrumentWeights
  | GlobalZeroYieldLinear !Double ![Double] -- ^accuracy, instrumentWeights
  | Local !LocalBootstrapTrait !Word !Bool !Double !Double !Double !Bool
    -- ^trait, localisation, forcePositive (LocalBootstrap's), accuracy, quadraticity, monotonicity, convexForcePositive (ConvexMonotone's)

-- |Bootstrap traits that are numerically usable with @LocalBootstrap@ and
-- @ConvexMonotone@. @Discount@ is intentionally unrepresentable.
data LocalBootstrapTrait = LForwardRate | LZeroYield | LSimpleZeroYield
  deriving (Int -> LocalBootstrapTrait -> ShowS
[LocalBootstrapTrait] -> ShowS
LocalBootstrapTrait -> String
(Int -> LocalBootstrapTrait -> ShowS)
-> (LocalBootstrapTrait -> String)
-> ([LocalBootstrapTrait] -> ShowS)
-> Show LocalBootstrapTrait
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> LocalBootstrapTrait -> ShowS
showsPrec :: Int -> LocalBootstrapTrait -> ShowS
$cshow :: LocalBootstrapTrait -> String
show :: LocalBootstrapTrait -> String
$cshowList :: [LocalBootstrapTrait] -> ShowS
showList :: [LocalBootstrapTrait] -> ShowS
Show, LocalBootstrapTrait -> LocalBootstrapTrait -> Bool
(LocalBootstrapTrait -> LocalBootstrapTrait -> Bool)
-> (LocalBootstrapTrait -> LocalBootstrapTrait -> Bool)
-> Eq LocalBootstrapTrait
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: LocalBootstrapTrait -> LocalBootstrapTrait -> Bool
== :: LocalBootstrapTrait -> LocalBootstrapTrait -> Bool
$c/= :: LocalBootstrapTrait -> LocalBootstrapTrait -> Bool
/= :: LocalBootstrapTrait -> LocalBootstrapTrait -> Bool
Eq, ReadPrec [LocalBootstrapTrait]
ReadPrec LocalBootstrapTrait
Int -> ReadS LocalBootstrapTrait
ReadS [LocalBootstrapTrait]
(Int -> ReadS LocalBootstrapTrait)
-> ReadS [LocalBootstrapTrait]
-> ReadPrec LocalBootstrapTrait
-> ReadPrec [LocalBootstrapTrait]
-> Read LocalBootstrapTrait
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS LocalBootstrapTrait
readsPrec :: Int -> ReadS LocalBootstrapTrait
$creadList :: ReadS [LocalBootstrapTrait]
readList :: ReadS [LocalBootstrapTrait]
$creadPrec :: ReadPrec LocalBootstrapTrait
readPrec :: ReadPrec LocalBootstrapTrait
$creadListPrec :: ReadPrec [LocalBootstrapTrait]
readListPrec :: ReadPrec [LocalBootstrapTrait]
Read)

fromBootstrapTrait :: LocalBootstrapTrait -> BootstrapTrait
fromBootstrapTrait :: LocalBootstrapTrait -> BootstrapTrait
fromBootstrapTrait LocalBootstrapTrait
LForwardRate = BootstrapTrait
ForwardRate
fromBootstrapTrait LocalBootstrapTrait
LZeroYield = BootstrapTrait
ZeroYield
fromBootstrapTrait LocalBootstrapTrait
LSimpleZeroYield = BootstrapTrait
SimpleZeroYield

-- |Bootstrapper for 'piecewiseSpreadYieldCurve', whose nodes are always discount-factor spreads.
-- @LogLinear@ interpolation gives piecewise-constant forward spreads, upstream's canonical choice.
data SpreadBootstrap
  = SpreadIterative !Interpolation !IterativeBootstrapOpts
  | SpreadGlobalLogLinear !Double ![Double] -- ^accuracy, instrumentWeights (empty for equal weights)

-- |Bootstraps a term structure with either a fixed or evaluation-date-relative reference point.
-- 'Bootstrap' selects iterative, global, or local construction; the final flag controls
-- extrapolation past the curve's maximum date.
piecewiseYieldCurve :: Reference
  -> NonEmpty (GenRateHelper rh) -- ^instruments
  -> DayCounter -- ^dayCounter
  -> [(Day, GenQuote q)] -- ^jumps
  -> Bootstrap rh2 -- ^bootstrapper choice
  -> Bool -- ^extrapolate past the curve's max date
  -> IO YieldTermStructure
piecewiseYieldCurve :: forall rh q rh2.
Reference
-> NonEmpty (GenRateHelper rh)
-> DayCounter
-> [(Day, GenQuote q)]
-> Bootstrap rh2
-> Bool
-> IO YieldTermStructure
piecewiseYieldCurve Reference
reference NonEmpty (GenRateHelper rh)
r DayCounter
dc [(Day, GenQuote q)]
qd Bootstrap rh2
bootstrap Bool
ex = case (Reference
reference, Bootstrap rh2
bootstrap) of
  (ReferenceDate Day
d, Iterative BootstrapTrait
t Interpolation
i IterativeBootstrapOpts
b) -> Bool -> IO YieldTermStructure -> IO YieldTermStructure
forall {t}.
Bool -> IO (GenTermStructure t) -> IO (GenTermStructure t)
enable Bool
ex (IO YieldTermStructure -> IO YieldTermStructure)
-> IO YieldTermStructure -> IO YieldTermStructure
forall a b. (a -> b) -> a -> b
$ (Int
 -> Int
 -> Int
 -> Double
 -> Double
 -> Double
 -> Word
 -> Double
 -> Double
 -> Bool
 -> Word
 -> Word
 -> IO YieldTermStructure)
-> (Int, (Int, Int))
-> Double
-> Double
-> Double
-> Word
-> Double
-> Double
-> Bool
-> Word
-> Word
-> IO YieldTermStructure
forall a b c d. (a -> b -> c -> d) -> (a, (b, c)) -> d
uncurryNested (Day
-> [GenRateHelper rh]
-> DayCounter
-> [GenQuote q]
-> [Day]
-> BootstrapTrait
-> Int
-> Int
-> Int
-> Double
-> Double
-> Double
-> Word
-> Double
-> Double
-> Bool
-> Word
-> Word
-> IO YieldTermStructure
forall rh q.
Day
-> [GenRateHelper rh]
-> DayCounter
-> [GenQuote q]
-> [Day]
-> BootstrapTrait
-> Int
-> Int
-> Int
-> Double
-> Double
-> Double
-> Word
-> Double
-> Double
-> Bool
-> Word
-> Word
-> IO YieldTermStructure
qlPiecewiseYieldCurveFull Day
d [GenRateHelper rh]
rs DayCounter
dc [GenQuote q]
qs [Day]
ds BootstrapTrait
t) (Interpolation -> (Int, (Int, Int))
qlInterpolation Interpolation
i)
    (Maybe Double -> Double
nullableDouble (IterativeBootstrapOpts -> Maybe Double
ibAccuracy IterativeBootstrapOpts
b)) (Maybe Double -> Double
nullableDouble (IterativeBootstrapOpts -> Maybe Double
ibMinValue IterativeBootstrapOpts
b)) (Maybe Double -> Double
nullableDouble (IterativeBootstrapOpts -> Maybe Double
ibMaxValue IterativeBootstrapOpts
b))
    (IterativeBootstrapOpts -> Word
ibMaxAttempts IterativeBootstrapOpts
b) (IterativeBootstrapOpts -> Double
ibMaxFactor IterativeBootstrapOpts
b) (IterativeBootstrapOpts -> Double
ibMinFactor IterativeBootstrapOpts
b) (IterativeBootstrapOpts -> Bool
ibDontThrow IterativeBootstrapOpts
b) (IterativeBootstrapOpts -> Word
ibDontThrowSteps IterativeBootstrapOpts
b) (IterativeBootstrapOpts -> Word
ibMaxEvaluations IterativeBootstrapOpts
b)
  (SettlementDays Word
s Calendar
cal, Iterative BootstrapTrait
t Interpolation
i IterativeBootstrapOpts
b) -> (Int
 -> Int
 -> Int
 -> Double
 -> Double
 -> Double
 -> Word
 -> Double
 -> Double
 -> Bool
 -> Word
 -> Word
 -> Bool
 -> IO YieldTermStructure)
-> (Int, (Int, Int))
-> Double
-> Double
-> Double
-> Word
-> Double
-> Double
-> Bool
-> Word
-> Word
-> Bool
-> IO YieldTermStructure
forall a b c d. (a -> b -> c -> d) -> (a, (b, c)) -> d
uncurryNested (Word
-> Calendar
-> [GenRateHelper rh]
-> DayCounter
-> [GenQuote q]
-> [Day]
-> BootstrapTrait
-> Int
-> Int
-> Int
-> Double
-> Double
-> Double
-> Word
-> Double
-> Double
-> Bool
-> Word
-> Word
-> Bool
-> IO YieldTermStructure
forall rh q.
Word
-> Calendar
-> [GenRateHelper rh]
-> DayCounter
-> [GenQuote q]
-> [Day]
-> BootstrapTrait
-> Int
-> Int
-> Int
-> Double
-> Double
-> Double
-> Word
-> Double
-> Double
-> Bool
-> Word
-> Word
-> Bool
-> IO YieldTermStructure
qlPiecewiseYieldCurveFull1 Word
s Calendar
cal [GenRateHelper rh]
rs DayCounter
dc [GenQuote q]
qs [Day]
ds BootstrapTrait
t) (Interpolation -> (Int, (Int, Int))
qlInterpolation Interpolation
i)
    (Maybe Double -> Double
nullableDouble (IterativeBootstrapOpts -> Maybe Double
ibAccuracy IterativeBootstrapOpts
b)) (Maybe Double -> Double
nullableDouble (IterativeBootstrapOpts -> Maybe Double
ibMinValue IterativeBootstrapOpts
b)) (Maybe Double -> Double
nullableDouble (IterativeBootstrapOpts -> Maybe Double
ibMaxValue IterativeBootstrapOpts
b))
    (IterativeBootstrapOpts -> Word
ibMaxAttempts IterativeBootstrapOpts
b) (IterativeBootstrapOpts -> Double
ibMaxFactor IterativeBootstrapOpts
b) (IterativeBootstrapOpts -> Double
ibMinFactor IterativeBootstrapOpts
b) (IterativeBootstrapOpts -> Bool
ibDontThrow IterativeBootstrapOpts
b) (IterativeBootstrapOpts -> Word
ibDontThrowSteps IterativeBootstrapOpts
b) (IterativeBootstrapOpts -> Word
ibMaxEvaluations IterativeBootstrapOpts
b) Bool
ex
  (ReferenceDate Day
d, GlobalDiscountLogLinear Double
acc [Double]
w) -> Day
-> [GenRateHelper rh]
-> DayCounter
-> [GenQuote q]
-> [Day]
-> Double
-> [Double]
-> Bool
-> IO YieldTermStructure
forall rh q.
Day
-> [GenRateHelper rh]
-> DayCounter
-> [GenQuote q]
-> [Day]
-> Double
-> [Double]
-> Bool
-> IO YieldTermStructure
qlPiecewiseYieldCurveGlobalBootstrapFixed1 Day
d [GenRateHelper rh]
rs DayCounter
dc [GenQuote q]
qs [Day]
ds Double
acc [Double]
w Bool
ex
  (SettlementDays Word
s Calendar
cal, GlobalDiscountLogLinear Double
acc [Double]
w) -> Word
-> Calendar
-> [GenRateHelper rh]
-> DayCounter
-> [GenQuote q]
-> [Day]
-> Double
-> [Double]
-> Bool
-> IO YieldTermStructure
forall rh q.
Word
-> Calendar
-> [GenRateHelper rh]
-> DayCounter
-> [GenQuote q]
-> [Day]
-> Double
-> [Double]
-> Bool
-> IO YieldTermStructure
qlPiecewiseYieldCurveGlobalBootstrap1 Word
s Calendar
cal [GenRateHelper rh]
rs DayCounter
dc [GenQuote q]
qs [Day]
ds Double
acc [Double]
w Bool
ex
  (ReferenceDate Day
d, GlobalSimpleZeroLinear Double
acc [Double]
w) -> Day
-> [GenRateHelper rh]
-> DayCounter
-> [GenQuote q]
-> [Day]
-> Double
-> [Double]
-> Bool
-> IO YieldTermStructure
forall rh q.
Day
-> [GenRateHelper rh]
-> DayCounter
-> [GenQuote q]
-> [Day]
-> Double
-> [Double]
-> Bool
-> IO YieldTermStructure
qlPiecewiseYieldCurveGlobalBootstrapFixed2 Day
d [GenRateHelper rh]
rs DayCounter
dc [GenQuote q]
qs [Day]
ds Double
acc [Double]
w Bool
ex
  (SettlementDays Word
s Calendar
cal, GlobalSimpleZeroLinear Double
acc [Double]
w) -> Word
-> Calendar
-> [GenRateHelper rh]
-> DayCounter
-> [GenQuote q]
-> [Day]
-> Double
-> [Double]
-> Bool
-> IO YieldTermStructure
forall rh q.
Word
-> Calendar
-> [GenRateHelper rh]
-> DayCounter
-> [GenQuote q]
-> [Day]
-> Double
-> [Double]
-> Bool
-> IO YieldTermStructure
qlPiecewiseYieldCurveGlobalBootstrap2 Word
s Calendar
cal [GenRateHelper rh]
rs DayCounter
dc [GenQuote q]
qs [Day]
ds Double
acc [Double]
w Bool
ex
  (ReferenceDate Day
d, GlobalSimpleZeroLinearFull NonEmpty (GenRateHelper rh2)
ah [Day]
ad Double
acc) -> Day
-> [GenRateHelper rh]
-> DayCounter
-> [GenQuote q]
-> [Day]
-> [GenRateHelper rh2]
-> [Day]
-> Double
-> Bool
-> IO YieldTermStructure
forall rh1 q rh2.
Day
-> [GenRateHelper rh1]
-> DayCounter
-> [GenQuote q]
-> [Day]
-> [GenRateHelper rh2]
-> [Day]
-> Double
-> Bool
-> IO YieldTermStructure
qlPiecewiseYieldCurveGlobalBootstrapFixed3 Day
d [GenRateHelper rh]
rs DayCounter
dc [GenQuote q]
qs [Day]
ds (NonEmpty (GenRateHelper rh2) -> [GenRateHelper rh2]
forall a. NonEmpty a -> [a]
toList NonEmpty (GenRateHelper rh2)
ah) [Day]
ad Double
acc Bool
ex
  (SettlementDays Word
s Calendar
cal, GlobalSimpleZeroLinearFull NonEmpty (GenRateHelper rh2)
ah [Day]
ad Double
acc) -> Word
-> Calendar
-> [GenRateHelper rh]
-> DayCounter
-> [GenQuote q]
-> [Day]
-> [GenRateHelper rh2]
-> [Day]
-> Double
-> Bool
-> IO YieldTermStructure
forall rh1 q rh2.
Word
-> Calendar
-> [GenRateHelper rh1]
-> DayCounter
-> [GenQuote q]
-> [Day]
-> [GenRateHelper rh2]
-> [Day]
-> Double
-> Bool
-> IO YieldTermStructure
qlPiecewiseYieldCurveGlobalBootstrap3 Word
s Calendar
cal [GenRateHelper rh]
rs DayCounter
dc [GenQuote q]
qs [Day]
ds (NonEmpty (GenRateHelper rh2) -> [GenRateHelper rh2]
forall a. NonEmpty a -> [a]
toList NonEmpty (GenRateHelper rh2)
ah) [Day]
ad Double
acc Bool
ex
  (ReferenceDate Day
d, GlobalForwardRateLinear Double
acc [Double]
w) -> Day
-> [GenRateHelper rh]
-> DayCounter
-> [GenQuote q]
-> [Day]
-> Double
-> [Double]
-> Bool
-> IO YieldTermStructure
forall rh q.
Day
-> [GenRateHelper rh]
-> DayCounter
-> [GenQuote q]
-> [Day]
-> Double
-> [Double]
-> Bool
-> IO YieldTermStructure
qlPiecewiseYieldCurveGlobalBootstrapFixed4 Day
d [GenRateHelper rh]
rs DayCounter
dc [GenQuote q]
qs [Day]
ds Double
acc [Double]
w Bool
ex
  (SettlementDays Word
s Calendar
cal, GlobalForwardRateLinear Double
acc [Double]
w) -> Word
-> Calendar
-> [GenRateHelper rh]
-> DayCounter
-> [GenQuote q]
-> [Day]
-> Double
-> [Double]
-> Bool
-> IO YieldTermStructure
forall rh q.
Word
-> Calendar
-> [GenRateHelper rh]
-> DayCounter
-> [GenQuote q]
-> [Day]
-> Double
-> [Double]
-> Bool
-> IO YieldTermStructure
qlPiecewiseYieldCurveGlobalBootstrap4 Word
s Calendar
cal [GenRateHelper rh]
rs DayCounter
dc [GenQuote q]
qs [Day]
ds Double
acc [Double]
w Bool
ex
  (ReferenceDate Day
d, GlobalZeroYieldLinear Double
acc [Double]
w) -> Day
-> [GenRateHelper rh]
-> DayCounter
-> [GenQuote q]
-> [Day]
-> Double
-> [Double]
-> Bool
-> IO YieldTermStructure
forall rh q.
Day
-> [GenRateHelper rh]
-> DayCounter
-> [GenQuote q]
-> [Day]
-> Double
-> [Double]
-> Bool
-> IO YieldTermStructure
qlPiecewiseYieldCurveGlobalBootstrapFixed5 Day
d [GenRateHelper rh]
rs DayCounter
dc [GenQuote q]
qs [Day]
ds Double
acc [Double]
w Bool
ex
  (SettlementDays Word
s Calendar
cal, GlobalZeroYieldLinear Double
acc [Double]
w) -> Word
-> Calendar
-> [GenRateHelper rh]
-> DayCounter
-> [GenQuote q]
-> [Day]
-> Double
-> [Double]
-> Bool
-> IO YieldTermStructure
forall rh q.
Word
-> Calendar
-> [GenRateHelper rh]
-> DayCounter
-> [GenQuote q]
-> [Day]
-> Double
-> [Double]
-> Bool
-> IO YieldTermStructure
qlPiecewiseYieldCurveGlobalBootstrap5 Word
s Calendar
cal [GenRateHelper rh]
rs DayCounter
dc [GenQuote q]
qs [Day]
ds Double
acc [Double]
w Bool
ex
  (ReferenceDate Day
d, Local LocalBootstrapTrait
t Word
loc Bool
fp Double
acc Double
q Double
m Bool
cfp) -> Day
-> [GenRateHelper rh]
-> DayCounter
-> [GenQuote q]
-> [Day]
-> BootstrapTrait
-> Word
-> Bool
-> Double
-> Double
-> Double
-> Bool
-> Bool
-> IO YieldTermStructure
forall rh q.
Day
-> [GenRateHelper rh]
-> DayCounter
-> [GenQuote q]
-> [Day]
-> BootstrapTrait
-> Word
-> Bool
-> Double
-> Double
-> Double
-> Bool
-> Bool
-> IO YieldTermStructure
qlPiecewiseYieldCurveLocalBootstrapFixed Day
d [GenRateHelper rh]
rs DayCounter
dc [GenQuote q]
qs [Day]
ds (LocalBootstrapTrait -> BootstrapTrait
fromBootstrapTrait LocalBootstrapTrait
t) Word
loc Bool
fp Double
acc Double
q Double
m Bool
cfp Bool
ex
  (SettlementDays Word
s Calendar
cal, Local LocalBootstrapTrait
t Word
loc Bool
fp Double
acc Double
q Double
m Bool
cfp) -> Word
-> Calendar
-> [GenRateHelper rh]
-> DayCounter
-> [GenQuote q]
-> [Day]
-> BootstrapTrait
-> Word
-> Bool
-> Double
-> Double
-> Double
-> Bool
-> Bool
-> IO YieldTermStructure
forall rh q.
Word
-> Calendar
-> [GenRateHelper rh]
-> DayCounter
-> [GenQuote q]
-> [Day]
-> BootstrapTrait
-> Word
-> Bool
-> Double
-> Double
-> Double
-> Bool
-> Bool
-> IO YieldTermStructure
qlPiecewiseYieldCurveLocalBootstrap1 Word
s Calendar
cal [GenRateHelper rh]
rs DayCounter
dc [GenQuote q]
qs [Day]
ds (LocalBootstrapTrait -> BootstrapTrait
fromBootstrapTrait LocalBootstrapTrait
t) Word
loc Bool
fp Double
acc Double
q Double
m Bool
cfp Bool
ex
  where ([Day]
ds, [GenQuote q]
qs) = [(Day, GenQuote q)] -> ([Day], [GenQuote q])
forall a b. [(a, b)] -> ([a], [b])
unzip [(Day, GenQuote q)]
qd
        rs :: [GenRateHelper rh]
rs = NonEmpty (GenRateHelper rh) -> [GenRateHelper rh]
forall a. NonEmpty a -> [a]
toList NonEmpty (GenRateHelper rh)
r
        enable :: Bool -> IO (GenTermStructure t) -> IO (GenTermStructure t)
enable Bool
False IO (GenTermStructure t)
action = IO (GenTermStructure t)
action
        enable Bool
True IO (GenTermStructure t)
action = do
          curve <- IO (GenTermStructure t)
action
          setExtrapolation curve True
          pure curve

-- |Bootstraps multiplicative discount-factor spreads over 'baseCurve' so that each instrument
-- reprices on the combined curve. Reference date, calendar and day counter come from the linked
-- base curve; past the last node the forward spread stays flat.
piecewiseSpreadYieldCurve :: GenYieldTermStructure y -- ^baseCurve
  -> NonEmpty (GenRateHelper rh) -- ^instruments
  -> SpreadBootstrap -- ^bootstrapper choice
  -> Bool -- ^extrapolate past the curve's max date
  -> IO YieldTermStructure
piecewiseSpreadYieldCurve :: forall y rh.
GenYieldTermStructure y
-> NonEmpty (GenRateHelper rh)
-> SpreadBootstrap
-> Bool
-> IO YieldTermStructure
piecewiseSpreadYieldCurve GenYieldTermStructure y
base NonEmpty (GenRateHelper rh)
r SpreadBootstrap
bootstrap Bool
ex = case SpreadBootstrap
bootstrap of
  SpreadIterative Interpolation
i IterativeBootstrapOpts
b -> (Int
 -> Int
 -> Int
 -> Double
 -> Double
 -> Double
 -> Word
 -> Double
 -> Double
 -> Bool
 -> Word
 -> Word
 -> Bool
 -> IO YieldTermStructure)
-> (Int, (Int, Int))
-> Double
-> Double
-> Double
-> Word
-> Double
-> Double
-> Bool
-> Word
-> Word
-> Bool
-> IO YieldTermStructure
forall a b c d. (a -> b -> c -> d) -> (a, (b, c)) -> d
uncurryNested (GenYieldTermStructure y
-> [GenRateHelper rh]
-> Int
-> Int
-> Int
-> Double
-> Double
-> Double
-> Word
-> Double
-> Double
-> Bool
-> Word
-> Word
-> Bool
-> IO YieldTermStructure
forall y rh.
GenYieldTermStructure y
-> [GenRateHelper rh]
-> Int
-> Int
-> Int
-> Double
-> Double
-> Double
-> Word
-> Double
-> Double
-> Bool
-> Word
-> Word
-> Bool
-> IO YieldTermStructure
qlPiecewiseSpreadYieldCurve GenYieldTermStructure y
base [GenRateHelper rh]
rs) (Interpolation -> (Int, (Int, Int))
qlInterpolation Interpolation
i)
    (Maybe Double -> Double
nullableDouble (IterativeBootstrapOpts -> Maybe Double
ibAccuracy IterativeBootstrapOpts
b)) (Maybe Double -> Double
nullableDouble (IterativeBootstrapOpts -> Maybe Double
ibMinValue IterativeBootstrapOpts
b)) (Maybe Double -> Double
nullableDouble (IterativeBootstrapOpts -> Maybe Double
ibMaxValue IterativeBootstrapOpts
b))
    (IterativeBootstrapOpts -> Word
ibMaxAttempts IterativeBootstrapOpts
b) (IterativeBootstrapOpts -> Double
ibMaxFactor IterativeBootstrapOpts
b) (IterativeBootstrapOpts -> Double
ibMinFactor IterativeBootstrapOpts
b) (IterativeBootstrapOpts -> Bool
ibDontThrow IterativeBootstrapOpts
b) (IterativeBootstrapOpts -> Word
ibDontThrowSteps IterativeBootstrapOpts
b) (IterativeBootstrapOpts -> Word
ibMaxEvaluations IterativeBootstrapOpts
b) Bool
ex
  SpreadGlobalLogLinear Double
acc [Double]
w -> GenYieldTermStructure y
-> [GenRateHelper rh]
-> Double
-> [Double]
-> Bool
-> IO YieldTermStructure
forall y rh.
GenYieldTermStructure y
-> [GenRateHelper rh]
-> Double
-> [Double]
-> Bool
-> IO YieldTermStructure
qlPiecewiseSpreadYieldCurveGlobalBootstrap GenYieldTermStructure y
base [GenRateHelper rh]
rs Double
acc [Double]
w Bool
ex
  where rs :: [GenRateHelper rh]
rs = NonEmpty (GenRateHelper rh) -> [GenRateHelper rh]
forall a. NonEmpty a -> [a]
toList NonEmpty (GenRateHelper rh)
r
qlPiecewiseSpreadYieldCurve :: (GenYieldTermStructure y) -> ([GenRateHelper rh]) -> (Int) -> (Int) -> (Int) -> (Double) -> (Double) -> (Double) -> (Word) -> (Double) -> (Double) -> (Bool) -> (Word) -> (Word) -> (Bool) -> IO ((YieldTermStructure))
qlPiecewiseSpreadYieldCurve :: forall y rh.
GenYieldTermStructure y
-> [GenRateHelper rh]
-> Int
-> Int
-> Int
-> Double
-> Double
-> Double
-> Word
-> Double
-> Double
-> Bool
-> Word
-> Word
-> Bool
-> IO YieldTermStructure
qlPiecewiseSpreadYieldCurve GenYieldTermStructure y
a1 [GenRateHelper rh]
a2 Int
a3 Int
a4 Int
a5 Double
a6 Double
a7 Double
a8 Word
a9 Double
a10 Double
a11 Bool
a12 Word
a13 Word
a14 Bool
a15 =
  GenYieldTermStructure y
-> (Ptr CYieldTermStructure' -> IO YieldTermStructure)
-> IO YieldTermStructure
forall y b.
GenYieldTermStructure y
-> (Ptr CYieldTermStructure' -> IO b) -> IO b
withYieldTermStructure GenYieldTermStructure y
a1 ((Ptr CYieldTermStructure' -> IO YieldTermStructure)
 -> IO YieldTermStructure)
-> (Ptr CYieldTermStructure' -> IO YieldTermStructure)
-> IO YieldTermStructure
forall a b. (a -> b) -> a -> b
$ \Ptr CYieldTermStructure'
a1' -> 
  [GenRateHelper rh]
-> ((CUInt, Ptr (Ptr CRateHelper')) -> IO YieldTermStructure)
-> IO YieldTermStructure
forall rh b.
[GenRateHelper rh]
-> ((CUInt, Ptr (Ptr CRateHelper')) -> IO b) -> IO b
withRateHelperArray [GenRateHelper rh]
a2 (((CUInt, Ptr (Ptr CRateHelper')) -> IO YieldTermStructure)
 -> IO YieldTermStructure)
-> ((CUInt, Ptr (Ptr CRateHelper')) -> IO YieldTermStructure)
-> IO YieldTermStructure
forall a b. (a -> b) -> a -> b
$ \(CUInt
a2'1, Ptr (Ptr CRateHelper')
a2'2) -> 
  let {a3' :: CInt
a3' = Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral a3} in 
  let {a4' = fromIntegral a4} in 
  let {a5' = fromIntegral a5} in 
  let {a6' = realToFrac a6} in 
  let {a7' = realToFrac a7} in 
  let {a8' = realToFrac a8} in 
  let {a9' = fromIntegral a9} in 
  let {a10' = realToFrac a10} in 
  let {a11' = realToFrac a11} in 
  let {a12' = C2HSImp.fromBool a12} in 
  let {a13' = fromIntegral a13} in 
  let {a14' = fromIntegral a14} in 
  let {a15' = Bool -> CInt
forall a. Num a => Bool -> a
C2HSImp.fromBool Bool
a15} in 
  preErrorCheck $ \a16' -> 
  qlPiecewiseSpreadYieldCurve'_ a1' a2'1  a2'2 a3' a4' a5' a6' a7' a8' a9' a10' a11' a12' a13' a14' a15' a16' >>= \res ->
  peekYieldTermStructure res >>= \res' ->
  errorCheck  a16'>>
  return (res')

{-# LINE 926 "./QuantLib/TermStructure/Yield.chs" #-}


qlPiecewiseSpreadYieldCurveGlobalBootstrap :: (GenYieldTermStructure y) -> ([GenRateHelper rh]) -> (Double) -> ([Double]) -> (Bool) -> IO ((YieldTermStructure))
qlPiecewiseSpreadYieldCurveGlobalBootstrap a1 a2 a3 a4 a5 =
  withYieldTermStructure a1 $ \a1' -> 
  withRateHelperArray a2 $ \(a2'1, a2'2) -> 
  let {a3' = realToFrac a3} in 
  withDoubleArray a4 $ \(a4'1, a4'2) -> 
  let {a5' = C2HSImp.fromBool a5} in 
  preErrorCheck $ \a6' -> 
  qlPiecewiseSpreadYieldCurveGlobalBootstrap'_ a1' a2'1  a2'2 a3' a4'1  a4'2 a5' a6' >>= \res ->
  peekYieldTermStructure res >>= \res' ->
  errorCheck  a6'>>
  return (res')

{-# LINE 928 "./QuantLib/TermStructure/Yield.chs" #-}


-- |Yield curve interpolating discount factors directly between the given dates.
interpolatedDiscountCurve :: NonEmpty (Day, Double) -- ^dates, dfs
  -> DayCounter -- ^dayCounter
  -> Calendar -- ^cal
  -> [(Day, GenQuote q)] -- ^jumps
  -> Interpolation -- ^interpolator
  -> Bool -- ^extrapolate past the curve's max date
  -> IO YieldTermStructure
interpolatedDiscountCurve r dc c qd i ex = uncurryNested (qlInterpolatedDiscountCurve rs rd dc c qs ds) (qlInterpolation i) ex
  where (rd, rs) = unzip (toList r)
        (ds, qs) = unzip qd
qlInterpolatedDiscountCurve :: ([Double]) -> ([Day]) -> (DayCounter) -> (Calendar) -> ([GenQuote q]) -> ([Day]) -> (Int) -> (Int) -> (Int) -> (Bool) -> IO ((YieldTermStructure))
qlInterpolatedDiscountCurve a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 =
  withDoubleArray a1 $ \(a1'1, a1'2) -> 
  withDayArray a2 $ \(a2'1, a2'2) -> 
  withDayCounter a3 $ \a3' -> 
  withCalendar a4 $ \a4' -> 
  withQuoteArray a5 $ \(a5'1, a5'2) -> 
  withDayArray a6 $ \(a6'1, a6'2) -> 
  let {a7' = fromIntegral a7} in 
  let {a8' = fromIntegral a8} in 
  let {a9' = fromIntegral a9} in 
  let {a10' = C2HSImp.fromBool a10} in 
  preErrorCheck $ \a11' -> 
  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 ->
  peekYieldTermStructure res >>= \res' ->
  errorCheck  a11'>>
  return (res')

{-# LINE 941 "./QuantLib/TermStructure/Yield.chs" #-}


-- |Yield curve interpolating instantaneous forward rates directly between the given dates.
interpolatedForwardCurve :: NonEmpty (Day, Double) -- ^dates, forwards
  -> DayCounter -- ^dayCounter
  -> Calendar -- ^cal
  -> [(Day, GenQuote q)] -- ^jumps
  -> Interpolation -- ^interpolator
  -> IO YieldTermStructure
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}
qlInterpolatedForwardCurve :: ([Double]) -> ([Day]) -> (DayCounter) -> (Calendar) -> ([GenQuote q]) -> ([Day]) -> (Int) -> (Int) -> (Int) -> IO ((YieldTermStructure))
qlInterpolatedForwardCurve a1 a2 a3 a4 a5 a6 a7 a8 a9 =
  withDoubleArray a1 $ \(a1'1, a1'2) -> 
  withDayArray a2 $ \(a2'1, a2'2) -> 
  withDayCounter a3 $ \a3' -> 
  withCalendar a4 $ \a4' -> 
  withQuoteArray a5 $ \(a5'1, a5'2) -> 
  withDayArray a6 $ \(a6'1, a6'2) -> 
  let {a7' = fromIntegral a7} in 
  let {a8' = fromIntegral a8} in 
  let {a9' = fromIntegral a9} in 
  preErrorCheck $ \a10' -> 
  qlInterpolatedForwardCurve'_ a1'1  a1'2 a2'1  a2'2 a3' a4' a5'1  a5'2 a6'1  a6'2 a7' a8' a9' a10' >>= \res ->
  peekYieldTermStructure res >>= \res' ->
  errorCheck  a10'>>
  return (res')

{-# LINE 951 "./QuantLib/TermStructure/Yield.chs" #-}


-- |Yield curve interpolating zero-yield rates directly between the given dates. Always uses
-- upstream's own default compounding (@Continuous@, @Annual@); use 'interpolatedSimpleZeroCurve'
-- for simple compounding.
interpolatedZeroCurve :: NonEmpty (Day, Double) -- ^dates, yields
  -> DayCounter -- ^dayCounter
  -> Calendar -- ^cal
  -> [(Day, GenQuote q)] -- ^jumps, jumpDates
  -> Interpolation -- ^interpolator
  -> IO YieldTermStructure
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}
qlInterpolatedZeroCurve :: ([Double]) -> ([Day]) -> (DayCounter) -> (Calendar) -> ([GenQuote q]) -> ([Day]) -> (Int) -> (Int) -> (Int) -> IO ((YieldTermStructure))
qlInterpolatedZeroCurve a1 a2 a3 a4 a5 a6 a7 a8 a9 =
  withDoubleArray a1 $ \(a1'1, a1'2) -> 
  withDayArray a2 $ \(a2'1, a2'2) -> 
  withDayCounter a3 $ \a3' -> 
  withCalendar a4 $ \a4' -> 
  withQuoteArray a5 $ \(a5'1, a5'2) -> 
  withDayArray a6 $ \(a6'1, a6'2) -> 
  let {a7' = fromIntegral a7} in 
  let {a8' = fromIntegral a8} in 
  let {a9' = fromIntegral a9} in 
  preErrorCheck $ \a10' -> 
  qlInterpolatedZeroCurve'_ a1'1  a1'2 a2'1  a2'2 a3' a4' a5'1  a5'2 a6'1  a6'2 a7' a8' a9' a10' >>= \res ->
  peekYieldTermStructure res >>= \res' ->
  errorCheck  a10'>>
  return (res')

{-# LINE 963 "./QuantLib/TermStructure/Yield.chs" #-}


-- |Yield curve interpolating simply-compounded zero rates directly between the given dates.
interpolatedSimpleZeroCurve :: NonEmpty (Day, Double) -- ^dates, yields
  -> DayCounter -- ^dayCounter
  -> Calendar -- ^cal
  -> [(Day, GenQuote q)] -- ^jumps, jumpDates
  -> Interpolation -- ^interpolator
  -> IO YieldTermStructure
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}
qlInterpolatedSimpleZeroCurve :: ([Double]) -> ([Day]) -> (DayCounter) -> (Calendar) -> ([GenQuote q]) -> ([Day]) -> (Int) -> (Int) -> (Int) -> IO ((YieldTermStructure))
qlInterpolatedSimpleZeroCurve a1 a2 a3 a4 a5 a6 a7 a8 a9 =
  withDoubleArray a1 $ \(a1'1, a1'2) -> 
  withDayArray a2 $ \(a2'1, a2'2) -> 
  withDayCounter a3 $ \a3' -> 
  withCalendar a4 $ \a4' -> 
  withQuoteArray a5 $ \(a5'1, a5'2) -> 
  withDayArray a6 $ \(a6'1, a6'2) -> 
  let {a7' = fromIntegral a7} in 
  let {a8' = fromIntegral a8} in 
  let {a9' = fromIntegral a9} in 
  preErrorCheck $ \a10' -> 
  qlInterpolatedSimpleZeroCurve'_ a1'1  a1'2 a2'1  a2'2 a3' a4' a5'1  a5'2 a6'1  a6'2 a7' a8' a9' a10' >>= \res ->
  peekYieldTermStructure res >>= \res' ->
  errorCheck  a10'>>
  return (res')

{-# LINE 973 "./QuantLib/TermStructure/Yield.chs" #-}


-- |Discount factors interpolated as a multiplicative spread applied on top of 'baseCurve'.
-- Upstream requires the first discount factor to be exactly @1.0@, flagging its date as the
-- curve's own reference date; a mismatched leading value throws a 'QuantLib.Context.Error'.
interpolatedSpreadDiscountCurve :: GenYieldTermStructure y
  -> NonEmpty (Day, Double) -- ^dates, dfs
  -> Interpolation -- ^interpolator
  -> IO YieldTermStructure
interpolatedSpreadDiscountCurve ts r i = uncurryNested (qlInterpolatedSpreadDiscountCurve ts rs rd) (qlInterpolation i) where (rd, rs) = unzip (toList r)
qlInterpolatedSpreadDiscountCurve :: (GenYieldTermStructure y) -> ([Double]) -> ([Day]) -> (Int) -> (Int) -> (Int) -> IO ((YieldTermStructure))
qlInterpolatedSpreadDiscountCurve a1 a2 a3 a4 a5 a6 =
  withYieldTermStructure a1 $ \a1' -> 
  withDoubleArray a2 $ \(a2'1, a2'2) -> 
  withDayArray a3 $ \(a3'1, a3'2) -> 
  let {a4' = fromIntegral a4} in 
  let {a5' = fromIntegral a5} in 
  let {a6' = fromIntegral a6} in 
  preErrorCheck $ \a7' -> 
  qlInterpolatedSpreadDiscountCurve'_ a1' a2'1  a2'2 a3'1  a3'2 a4' a5' a6' a7' >>= \res ->
  peekYieldTermStructure res >>= \res' ->
  errorCheck  a7'>>
  return (res')

{-# LINE 983 "./QuantLib/TermStructure/Yield.chs" #-}


withNonEmptyBondHelperArray :: NonEmpty BondHelper -> ((CUInt, Ptr (Ptr CBondHelper')) -> IO a) -> IO a
withNonEmptyBondHelperArray = withBondHelperArray . toList

-- |Construct a fitted bond discount curve with either a fixed or moving reference point.
fittedBondDiscountCurve :: Reference -> NonEmpty BondHelper -> DayCounter -> FittingMethod
  -> Double -> Word -> [Double] -> Double -> Bool -> IO FittedBondDiscountCurve
fittedBondDiscountCurve reference hs dc method accuracy maxEvaluations guess simplexLambda ex = do
  curve <- case reference of
    ReferenceDate d -> fittedBondDiscountCurveFixed d hs dc method accuracy maxEvaluations guess simplexLambda
    SettlementDays n cal -> fittedBondDiscountCurveMovingRaw n cal hs dc method accuracy maxEvaluations guess simplexLambda
  setExtrapolation curve ex
  pure curve

fittedBondDiscountCurveMovingRaw :: (Word) -- ^settlementDays
 -> (Calendar) -> (NonEmpty BondHelper) -> (DayCounter) -> (FittingMethod) -> (Double) -- ^accuracy
 -> (Word) -- ^maxEvaluations
 -> ([Double]) -- ^guess
 -> (Double) -- ^simplexLambda
 -> IO ((FittedBondDiscountCurve))
fittedBondDiscountCurveMovingRaw :: Word
-> Calendar
-> NonEmpty BondHelper
-> DayCounter
-> FittingMethod
-> Double
-> Word
-> [Double]
-> Double
-> IO FittedBondDiscountCurve
fittedBondDiscountCurveMovingRaw Word
a1 Calendar
a2 NonEmpty BondHelper
a3 DayCounter
a4 FittingMethod
a5 Double
a6 Word
a7 [Double]
a8 Double
a9 =
  let {a1' :: CUInt
a1' = Word -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word
a1} in 
  Calendar
-> (Ptr CCalendar -> IO FittedBondDiscountCurve)
-> IO FittedBondDiscountCurve
forall b. Calendar -> (Ptr CCalendar -> IO b) -> IO b
withCalendar Calendar
a2 ((Ptr CCalendar -> IO FittedBondDiscountCurve)
 -> IO FittedBondDiscountCurve)
-> (Ptr CCalendar -> IO FittedBondDiscountCurve)
-> IO FittedBondDiscountCurve
forall a b. (a -> b) -> a -> b
$ \Ptr CCalendar
a2' -> 
  NonEmpty BondHelper
-> ((CUInt, Ptr (Ptr CBondHelper')) -> IO FittedBondDiscountCurve)
-> IO FittedBondDiscountCurve
forall a.
NonEmpty BondHelper
-> ((CUInt, Ptr (Ptr CBondHelper')) -> IO a) -> IO a
withNonEmptyBondHelperArray NonEmpty BondHelper
a3 (((CUInt, Ptr (Ptr CBondHelper')) -> IO FittedBondDiscountCurve)
 -> IO FittedBondDiscountCurve)
-> ((CUInt, Ptr (Ptr CBondHelper')) -> IO FittedBondDiscountCurve)
-> IO FittedBondDiscountCurve
forall a b. (a -> b) -> a -> b
$ \(CUInt
a3'1, Ptr (Ptr CBondHelper')
a3'2) -> 
  DayCounter
-> (Ptr CDayCounter -> IO FittedBondDiscountCurve)
-> IO FittedBondDiscountCurve
forall b. DayCounter -> (Ptr CDayCounter -> IO b) -> IO b
withDayCounter DayCounter
a4 ((Ptr CDayCounter -> IO FittedBondDiscountCurve)
 -> IO FittedBondDiscountCurve)
-> (Ptr CDayCounter -> IO FittedBondDiscountCurve)
-> IO FittedBondDiscountCurve
forall a b. (a -> b) -> a -> b
$ \Ptr CDayCounter
a4' -> 
  FittingMethod
-> (Ptr CFittedBondDiscountCurveFittingMethod
    -> IO FittedBondDiscountCurve)
-> IO FittedBondDiscountCurve
forall a.
FittingMethod
-> (Ptr CFittedBondDiscountCurveFittingMethod -> IO a) -> IO a
withFittedBondDiscountCurveFittingMethod FittingMethod
a5 ((Ptr CFittedBondDiscountCurveFittingMethod
  -> IO FittedBondDiscountCurve)
 -> IO FittedBondDiscountCurve)
-> (Ptr CFittedBondDiscountCurveFittingMethod
    -> IO FittedBondDiscountCurve)
-> IO FittedBondDiscountCurve
forall a b. (a -> b) -> a -> b
$ \Ptr CFittedBondDiscountCurveFittingMethod
a5' -> 
  let {a6' :: CDouble
a6' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a6} in 
  let {a7' :: CUInt
a7' = Word -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word
a7} in 
  withDoubleArray a8 $ \(a8'1, a8'2) -> 
  let {a9' = realToFrac a9} in 
  preErrorCheck $ \a10' -> 
  fittedBondDiscountCurveMovingRaw'_ a1' a2' a3'1  a3'2 a4' a5' a6' a7' a8'1  a8'2 a9' a10' >>= \res ->
  peekFittedBondDiscountCurve res >>= \res' ->
  errorCheck  a10'>>
  return (res')

{-# LINE 1004 "./QuantLib/TermStructure/Yield.chs" #-}


-- |curve reference date fixed for life of curve
fittedBondDiscountCurveFixed :: (Day) -> (NonEmpty BondHelper) -> (DayCounter) -> (FittingMethod) -> (Double) -- ^accuracy
 -> (Word) -- ^maxEvaluations
 -> ([Double]) -- ^guess
 -> (Double) -- ^simplexLambda
 -> IO ((FittedBondDiscountCurve))
fittedBondDiscountCurveFixed a1 a2 a3 a4 a5 a6 a7 a8 =
  withDay a1 $ \a1' -> 
  withNonEmptyBondHelperArray a2 $ \(a2'1, a2'2) -> 
  withDayCounter a3 $ \a3' -> 
  withFittedBondDiscountCurveFittingMethod a4 $ \a4' -> 
  let {a5' = realToFrac a5} in 
  let {a6' = fromIntegral a6} in 
  withDoubleArray a7 $ \(a7'1, a7'2) -> 
  let {a8' = realToFrac a8} in 
  preErrorCheck $ \a9' -> 
  fittedBondDiscountCurveFixed'_ a1' a2'1  a2'2 a3' a4' a5' a6' a7'1  a7'2 a8' a9' >>= \res ->
  peekFittedBondDiscountCurve res >>= \res' ->
  errorCheck  a9'>>
  return (res')

{-# LINE 1012 "./QuantLib/TermStructure/Yield.chs" #-}


-- |final value of cost function after optimization
minimumCostValue :: (FittedBondDiscountCurve) -> IO ((Double))
minimumCostValue a1 =
  withFittedBondDiscountCurve a1 $ \a1' -> 
  preErrorCheck $ \a2' -> 
  minimumCostValue'_ a1' a2' >>= \res ->
  let {res' = realToFrac res} in
  errorCheck  a2'>>
  return (res')

{-# LINE 1015 "./QuantLib/TermStructure/Yield.chs" #-}


-- |final number of iterations used in the optimization problem
numberOfIterations :: (FittedBondDiscountCurve) -> IO ((Int))
numberOfIterations a1 =
  withFittedBondDiscountCurve a1 $ \a1' -> 
  preErrorCheck $ \a2' -> 
  numberOfIterations'_ a1' a2' >>= \res ->
  let {res' = fromIntegral res} in
  errorCheck  a2'>>
  return (res')

{-# LINE 1018 "./QuantLib/TermStructure/Yield.chs" #-}


-- |number of unknown parameters found by the fit
fittingMethodSize :: (FittedBondDiscountCurve) -> IO ((Word))
fittingMethodSize a1 =
  withFittedBondDiscountCurve a1 $ \a1' -> 
  preErrorCheck $ \a2' -> 
  fittingMethodSize'_ a1' a2' >>= \res ->
  let {res' = fromIntegral res} in
  errorCheck  a2'>>
  return (res')

{-# LINE 1021 "./QuantLib/TermStructure/Yield.chs" #-}


-- |why the optimization stopped
fittingMethodErrorCode :: FittedBondDiscountCurve -> IO EndCriteriaType
fittingMethodErrorCode = fmap toEnum . fittingMethodErrorCodeRaw
fittingMethodErrorCodeRaw :: (FittedBondDiscountCurve) -> IO ((Int))
fittingMethodErrorCodeRaw a1 =
  withFittedBondDiscountCurve a1 $ \a1' -> 
  preErrorCheck $ \a2' -> 
  fittingMethodErrorCodeRaw'_ a1' a2' >>= \res ->
  let {res' = fromIntegral res} in
  errorCheck  a2'>>
  return (res')

{-# LINE 1026 "./QuantLib/TermStructure/Yield.chs" #-}


-- |the fitted parameters found by the optimization
fittingMethodSolution :: (FittedBondDiscountCurve) -> IO ((RealVector))
fittingMethodSolution a1 =
  withFittedBondDiscountCurve a1 $ \a1' -> 
  preArray $ \(a2'1, a2'2) -> 
  preErrorCheck $ \a3' -> 
  fittingMethodSolution'_ a1' a2'1  a2'2 a3' >>
  peekRealVector  a2'1  a2'2>>= \a2'' -> 
  errorCheck  a3'>>
  return (a2'')

{-# LINE 1029 "./QuantLib/TermStructure/Yield.chs" #-}


-- |the discount factor at time @t@ implied by a given parameter vector, without rebuilding the curve
fittingMethodDiscount :: (FittedBondDiscountCurve) -> ([Double]) -> (Double) -> IO ((Double))
fittingMethodDiscount a1 a2 a3 =
  withFittedBondDiscountCurve a1 $ \a1' -> 
  withDoubleArray a2 $ \(a2'1, a2'2) -> 
  let {a3' = realToFrac a3} in 
  preErrorCheck $ \a4' -> 
  fittingMethodDiscount'_ a1' a2'1  a2'2 a3' a4' >>= \res ->
  let {res' = realToFrac res} in
  errorCheck  a4'>>
  return (res')

{-# LINE 1032 "./QuantLib/TermStructure/Yield.chs" #-}


-- |A curve behind a relinkable handle. The result /is/ a 'YieldTermStructure': pass it to
-- any curve-taking function and everything built on it keeps tracking whatever the handle
-- currently points at, so a later 'linkTo' reprices already-constructed instruments
-- without rebuilding them. 'Nothing' gives an empty handle -- meaningful rather than an
-- error, since that is what makes a rate helper discount off the curve being bootstrapped
-- -- but reading a curve value through one throws until it is linked.
relinkableYieldTermStructure :: (Maybe (GenYieldTermStructure y)) -> IO ((RelinkableYieldTermStructure))
relinkableYieldTermStructure a1 =
  withMaybeYieldTermStructure a1 $ \a1' -> 
  preErrorCheck $ \a2' -> 
  relinkableYieldTermStructure'_ a1' a2' >>= \res ->
  peekRelinkableYieldTermStructure res >>= \res' ->
  errorCheck  a2'>>
  return (res')

{-# LINE 1041 "./QuantLib/TermStructure/Yield.chs" #-}


-- |Point a relinkable handle at a different curve. Everything already built on the handle
-- reprices against the new curve, with no object rebuilt.
--
-- This is the one mutator in the module. The API rules here otherwise forbid new setters
-- and prefer constructing a fresh object, but relinking /is/ the capability being bound:
-- a forecast curve is cloned into every floating coupon of every instrument, so without
-- it a curve scenario means rebuilding the whole portfolio.
linkTo :: (RelinkableYieldTermStructure) -> (GenYieldTermStructure y) -> IO ()
linkTo :: forall y.
RelinkableYieldTermStructure -> GenYieldTermStructure y -> IO ()
linkTo RelinkableYieldTermStructure
a1 GenYieldTermStructure y
a2 =
  RelinkableYieldTermStructure
-> (Ptr CRelinkableYieldTermStructure' -> IO ()) -> IO ()
forall b.
RelinkableYieldTermStructure
-> (Ptr CRelinkableYieldTermStructure' -> IO b) -> IO b
withRelinkableYieldTermStructure RelinkableYieldTermStructure
a1 ((Ptr CRelinkableYieldTermStructure' -> IO ()) -> IO ())
-> (Ptr CRelinkableYieldTermStructure' -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr CRelinkableYieldTermStructure'
a1' -> 
  GenYieldTermStructure y
-> (Ptr CYieldTermStructure' -> IO ()) -> IO ()
forall y b.
GenYieldTermStructure y
-> (Ptr CYieldTermStructure' -> IO b) -> IO b
withYieldTermStructure GenYieldTermStructure y
a2 ((Ptr CYieldTermStructure' -> IO ()) -> IO ())
-> (Ptr CYieldTermStructure' -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr CYieldTermStructure'
a2' -> 
  (Ptr (Ptr CChar) -> IO ()) -> IO ()
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr CChar) -> IO ()) -> IO ())
-> (Ptr (Ptr CChar) -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr CChar)
a3' -> 
  Ptr CRelinkableYieldTermStructure'
-> Ptr CYieldTermStructure' -> Ptr (Ptr CChar) -> IO ()
linkTo'_ Ptr CRelinkableYieldTermStructure'
a1' Ptr CYieldTermStructure'
a2' Ptr (Ptr CChar)
a3' IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
  Ptr (Ptr CChar) -> IO ()
errorCheck  Ptr (Ptr CChar)
a3'IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
  () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()

{-# LINE 1051 "./QuantLib/TermStructure/Yield.chs" #-}


-- |Builds a set of curves that form a genuine dependency cycle -- the scenario
-- 'RelinkableYieldTermStructure' exists for. Protocol (see the class's own upstream doc
-- comment): build each member curve's rate helpers off an empty 'relinkableYieldTermStructure'
-- (the /internal/ handle), construct the curves themselves (e.g. via
-- 'piecewiseYieldCurve'), then hand each pair of (internal handle, curve) to
-- 'addBootstrappedCurve' -- which returns an /external/ handle to reference the curve by from
-- then on, and links the internal handle to it (with ownership/observability stripped to avoid
-- shared_ptr and notification cycles) so the curves' own cross-references resolve.
multiCurve :: (Double) -- ^accuracy
 -> IO ((MultiCurve))
multiCurve :: Double -> IO MultiCurve
multiCurve Double
a1 =
  let {a1' :: CDouble
a1' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a1} in 
  (Ptr (Ptr CChar) -> IO MultiCurve) -> IO MultiCurve
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr CChar) -> IO MultiCurve) -> IO MultiCurve)
-> (Ptr (Ptr CChar) -> IO MultiCurve) -> IO MultiCurve
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr CChar)
a2' -> 
  CDouble -> Ptr (Ptr CChar) -> IO (Ptr CMultiCurve)
multiCurve'_ CDouble
a1' Ptr (Ptr CChar)
a2' IO (Ptr CMultiCurve)
-> (Ptr CMultiCurve -> IO MultiCurve) -> IO MultiCurve
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Ptr CMultiCurve
res ->
  Ptr CMultiCurve -> IO MultiCurve
peekMultiCurve Ptr CMultiCurve
res IO MultiCurve -> (MultiCurve -> IO MultiCurve) -> IO MultiCurve
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \MultiCurve
res' ->
  Ptr (Ptr CChar) -> IO ()
errorCheck  Ptr (Ptr CChar)
a2'IO () -> IO MultiCurve -> IO MultiCurve
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
  MultiCurve -> IO MultiCurve
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (MultiCurve
res')

{-# LINE 1062 "./QuantLib/TermStructure/Yield.chs" #-}


-- |Add a curve built with a bootstrapper (e.g. 'piecewiseYieldCurve') to the
-- cycle. See 'multiCurve' for the protocol.
addBootstrappedCurve :: (MultiCurve) -> (RelinkableYieldTermStructure) -- ^internalHandle
 -> (GenYieldTermStructure y) -- ^curve
 -> IO ((YieldTermStructure))
addBootstrappedCurve a1 a2 a3 =
  withMultiCurve a1 $ \a1' -> 
  withRelinkableYieldTermStructure a2 $ \a2' -> 
  withYieldTermStructure a3 $ \a3' -> 
  preErrorCheck $ \a4' -> 
  addBootstrappedCurve'_ a1' a2' a3' a4' >>= \res ->
  peekYieldTermStructure res >>= \res' ->
  errorCheck  a4'>>
  return (res')

{-# LINE 1069 "./QuantLib/TermStructure/Yield.chs" #-}


-- |Add a curve that isn't built with a bootstrapper (e.g. a spreaded curve) to the cycle. See
-- 'multiCurve' for the protocol.
addNonBootstrappedCurve :: (MultiCurve) -> (RelinkableYieldTermStructure) -- ^internalHandle
 -> (GenYieldTermStructure y) -- ^curve
 -> IO ((YieldTermStructure))
addNonBootstrappedCurve a1 a2 a3 =
  withMultiCurve a1 $ \a1' -> 
  withRelinkableYieldTermStructure a2 $ \a2' -> 
  withYieldTermStructure a3 $ \a3' -> 
  preErrorCheck $ \a4' -> 
  addNonBootstrappedCurve'_ a1' a2' a3' a4' >>= \res ->
  peekYieldTermStructure res >>= \res' ->
  errorCheck  a4'>>
  return (res')

{-# LINE 1076 "./QuantLib/TermStructure/Yield.chs" #-}


-- vim: set ff=unix ts=8 sts=2 sw=2 et:

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlDepositRateHelper1"
  depositRateHelperFromIndex'_ :: ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CIborIndex')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CRateHelper'))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlDepositRateHelper"
  depositRateHelper'_ :: ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CDayCounter)) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CRateHelper'))))))))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlFixedRateBondHelper"
  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 C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CBondHelper'))))))))))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlYieldTSDiscount"
  discountAtDateRaw'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlSwapRateHelper1"
  swapRateHelperFromConventions'_ :: ((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 C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CSwapRateHelper')))))))))))))))))))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlFlatForward"
  flatForwardFixed'_ :: (C2HSImp.CInt -> ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CYieldTermStructure')))))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlFlatForward1"
  flatForwardMovingRaw'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr (CCalendar)) -> ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CYieldTermStructure'))))))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlYieldTermStructureZeroRate"
  zeroRateAtDateRaw'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CInterestRate))))))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlYieldTermStructureForwardRate"
  forwardRate'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CInterestRate)))))))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlYieldTermStructureForwardRate2"
  forwardRateBetweenTimes'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CInterestRate))))))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlYieldTermStructureZeroRate1"
  zeroRateAtTimeRaw'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CDouble -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CInterestRate)))))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlYieldTermStructureDiscount1"
  discountAtTimeRaw'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CDouble -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlFraRateHelper"
  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 C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CRateHelper')))))))))))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlIborIborBasisSwapRateHelper"
  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.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CRateHelper')))))))))))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlOvernightIborBasisSwapRateHelper"
  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.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CRateHelper'))))))))))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlConstNotionalCrossCurrencyBasisSwapRateHelper"
  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.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CRateHelper')))))))))))))))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlMtMCrossCurrencyBasisSwapRateHelper"
  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.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CRateHelper'))))))))))))))))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlConstNotionalCrossCurrencySwapRateHelper"
  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.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CRateHelper')))))))))))))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlFxSwapRateHelper"
  fxSwapRateHelper'_ :: ((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 C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CRateHelper')))))))))))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlFxSwapRateHelper2"
  fxSwapRateHelperBetweenDates'_ :: ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CRateHelper'))))))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlBondHelper"
  bondHelper_'_ :: ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CBond')) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CBondHelper')))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlOISRateHelper"
  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 (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (COISRateHelper')))))))))))))))))))))))))))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlOISRateHelper2"
  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 (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (COISRateHelper'))))))))))))))))))))))))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlSwapRateHelper"
  swapRateHelper'_ :: ((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 C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CSwapRateHelper')))))))))))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlForwardSpreadedTermStructure"
  forwardSpreadedTermStructure'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CYieldTermStructure'))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlZeroSpreadedTermStructure"
  zeroSpreadedTermStructure'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CYieldTermStructure'))))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlCompositeZeroYieldStructure"
  qlCompositeZeroYieldStructure'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.FunPtr (C2HSImp.CDouble -> (C2HSImp.CDouble -> (IO C2HSImp.CDouble)))) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CYieldTermStructure')))))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlBMASwapRateHelper"
  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 C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CRateHelper')))))))))))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlMultipleResetsSwapRateHelper"
  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 C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CRateHelper'))))))))))))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlFraRateHelper1"
  fraRateHelperFromIndexRaw'_ :: ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (CIborIndex')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CRateHelper'))))))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlFraRateHelper2"
  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 C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CRateHelper'))))))))))))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlFraRateHelper3"
  fraIborRateHelperRaw'_ :: ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CIborIndex')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CRateHelper')))))))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlFuturesRateHelper1"
  futuresRateHelperBetweenDatesRaw'_ :: ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CDayCounter)) -> ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CFuturesRateHelper'))))))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlFuturesRateHelper2"
  futuresIborRateHelperRaw'_ :: ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CIborIndex')) -> ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CFuturesRateHelper')))))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlFuturesRateHelper"
  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 C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CFuturesRateHelper')))))))))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlFuturesRateHelperConvexityAdjustment"
  futuresRateHelperConvexityAdjustment'_ :: ((C2HSImp.Ptr (CFuturesRateHelper')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlOvernightIndexFutureRateHelper"
  overnightIndexFutureRateHelper'_ :: ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (COvernightIndex')) -> ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (COvernightIndexFutureRateHelper'))))))))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlOvernightIndexFutureRateHelperConvexityAdjustment"
  overnightIndexFutureRateHelperConvexityAdjustment'_ :: ((C2HSImp.Ptr (COvernightIndexFutureRateHelper')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlRateHelperFixingDependencies"
  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 C2HSImp.CChar)) -> (IO ()))))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlSofrFutureRateHelper"
  sofrFutureRateHelper'_ :: ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CRateHelper')))))))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlRateHelperImpliedQuote"
  impliedQuote'_ :: ((C2HSImp.Ptr (CRateHelper')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlImpliedTermStructure"
  impliedTermStructure'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CYieldTermStructure'))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlPiecewiseZeroSpreadedTermStructure"
  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 C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CYieldTermStructure'))))))))))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlPiecewiseForwardSpreadedTermStructure"
  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 C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CYieldTermStructure'))))))))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlQuantoTermStructure"
  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 C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CYieldTermStructure'))))))))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlUltimateForwardTermStructure"
  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 C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CYieldTermStructure')))))))))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlPiecewiseYieldCurveFull"
  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 C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CYieldTermStructure')))))))))))))))))))))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlPiecewiseYieldCurveFull1"
  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 C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CYieldTermStructure')))))))))))))))))))))))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlPiecewiseYieldCurveGlobalBootstrap1"
  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.CChar)) -> (IO (C2HSImp.Ptr (CYieldTermStructure')))))))))))))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlPiecewiseYieldCurveGlobalBootstrap2"
  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.CChar)) -> (IO (C2HSImp.Ptr (CYieldTermStructure')))))))))))))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlPiecewiseYieldCurveGlobalBootstrap3"
  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.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CYieldTermStructure')))))))))))))))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlPiecewiseYieldCurveGlobalBootstrap4"
  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.CChar)) -> (IO (C2HSImp.Ptr (CYieldTermStructure')))))))))))))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlPiecewiseYieldCurveGlobalBootstrap5"
  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.CChar)) -> (IO (C2HSImp.Ptr (CYieldTermStructure')))))))))))))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlPiecewiseYieldCurveLocalBootstrap1"
  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 C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CYieldTermStructure')))))))))))))))))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlPiecewiseYieldCurveGlobalBootstrapFixed1"
  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.CChar)) -> (IO (C2HSImp.Ptr (CYieldTermStructure'))))))))))))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlPiecewiseYieldCurveGlobalBootstrapFixed2"
  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.CChar)) -> (IO (C2HSImp.Ptr (CYieldTermStructure'))))))))))))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlPiecewiseYieldCurveGlobalBootstrapFixed3"
  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.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CYieldTermStructure'))))))))))))))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlPiecewiseYieldCurveGlobalBootstrapFixed4"
  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.CChar)) -> (IO (C2HSImp.Ptr (CYieldTermStructure'))))))))))))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlPiecewiseYieldCurveGlobalBootstrapFixed5"
  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.CChar)) -> (IO (C2HSImp.Ptr (CYieldTermStructure'))))))))))))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlPiecewiseYieldCurveLocalBootstrapFixed"
  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 C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CYieldTermStructure'))))))))))))))))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlPiecewiseSpreadYieldCurve"
  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 C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CYieldTermStructure'))))))))))))))))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlPiecewiseSpreadYieldCurveGlobalBootstrap"
  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.CChar)) -> (IO (C2HSImp.Ptr (CYieldTermStructure')))))))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlInterpolatedDiscountCurve"
  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 C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CYieldTermStructure'))))))))))))))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlInterpolatedForwardCurve"
  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 C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CYieldTermStructure')))))))))))))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlInterpolatedZeroCurve"
  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 C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CYieldTermStructure')))))))))))))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlInterpolatedSimpleZeroCurve"
  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 C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CYieldTermStructure')))))))))))))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlInterpolatedSpreadDiscountCurve"
  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 C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CYieldTermStructure'))))))))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlFittedBondDiscountCurve"
  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 C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CFittedBondDiscountCurve')))))))))))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlFittedBondDiscountCurve1"
  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 C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CFittedBondDiscountCurve'))))))))))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlFittedBondDiscountCurveFittingMethodMinimumCostValue"
  minimumCostValue'_ :: ((C2HSImp.Ptr (CFittedBondDiscountCurve')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlFittedBondDiscountCurveFittingMethodNumberOfIterations"
  numberOfIterations'_ :: ((C2HSImp.Ptr (CFittedBondDiscountCurve')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CInt)))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlFittedBondDiscountCurveFittingMethodSize"
  fittingMethodSize'_ :: ((C2HSImp.Ptr (CFittedBondDiscountCurve')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CUInt)))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlFittedBondDiscountCurveFittingMethodErrorCode"
  fittingMethodErrorCodeRaw'_ :: ((C2HSImp.Ptr (CFittedBondDiscountCurve')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CInt)))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlFittedBondDiscountCurveFittingMethodSolution"
  fittingMethodSolution'_ :: ((C2HSImp.Ptr (CFittedBondDiscountCurve')) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CDouble)) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO ())))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlFittedBondDiscountCurveFittingMethodDiscount"
  fittingMethodDiscount'_ :: ((C2HSImp.Ptr (CFittedBondDiscountCurve')) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlRelinkableYieldTermStructure"
  relinkableYieldTermStructure'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CRelinkableYieldTermStructure')))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlRelinkableYieldTermStructureLinkTo"
  linkTo'_ :: ((C2HSImp.Ptr (CRelinkableYieldTermStructure')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO ()))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlMultiCurve"
  multiCurve'_ :: (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CMultiCurve)))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlMultiCurveAddBootstrappedCurve"
  addBootstrappedCurve'_ :: ((C2HSImp.Ptr (CMultiCurve)) -> ((C2HSImp.Ptr (CRelinkableYieldTermStructure')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CYieldTermStructure')))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlMultiCurveAddNonBootstrappedCurve"
  addNonBootstrappedCurve'_ :: ((C2HSImp.Ptr (CMultiCurve)) -> ((C2HSImp.Ptr (CRelinkableYieldTermStructure')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CYieldTermStructure')))))))