-- 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, FlexibleInstances #-}
module QuantLib.TermStructure.Yield
  (
    -- * Types
    -- ** Curves and helpers
    GenYieldTermStructure
  , YieldTermStructure
  , PiecewiseYieldCurve
  , RelinkableYieldTermStructure
  , FittedBondDiscountCurve
  , MultiCurve
  , GenRateHelper
  , RateHelper
  , BondHelper
  , SwapRateHelper
  , OISRateHelper
  , FuturesRateHelper
  , OvernightIndexFutureRateHelper

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

    -- ** Bootstrap and contract configuration
  , FittingMethod(..)
  , BootstrapTrait(..)
  , PillarChoice(..)
  , FuturesType(..)
  , DepositTerms(..)
  , FraTerms(..)
  , SwapRateTerms(..)
  , OisTerms(..)
  , FxSwapTerms(..)
  , FundingTerms(..)
  , FuturesTerms(..)
  , OISRateHelperOpts(..)
  , OvernightObservation(..)
  , IterativeBootstrapOpts(..)
  , BootstrapInitialGuess
  , Bootstrap(..)
  , LocalBootstrapTrait(..)
  , SpreadBootstrap(..)

  , StubIndexSelection(..)

    -- * Constructors
    -- ** Hierarchy and handles
  , asYieldTermStructure
  , asRateHelper
  , relinkableYieldTermStructure
    -- ** Flat, fitted and derived curves
  , fittedBondDiscountCurve
  , flatForward
  , forwardSpreadedTermStructure
  , zeroSpreadedTermStructure
  , withCompositeZeroYieldStructure
  , impliedTermStructureMoving
  , impliedTermStructure
  , piecewiseZeroSpreadedTermStructure
  , piecewiseForwardSpreadedTermStructure
  , quantoTermStructure
  , ultimateForwardTermStructure
    -- ** Rate helpers
  , depositRateHelper
  , fixedRateBondHelper
  , fraRateHelper
  , bondHelper
  , oisRateHelper
  , defaultOisRateHelperOpts
  , defaultOvernightObservation
  , oisRateHelperWithOptions
  , 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
  , overnightOvernightBasisSwapRateHelper
  , overnightIndexedFundingRateHelper
  , overnightIborBasisSwapRateHelper
  , constNotionalCrossCurrencyBasisSwapRateHelper
  , mtmCrossCurrencyBasisSwapRateHelper
  , constNotionalCrossCurrencySwapRateHelper
  , fxSwapRateHelper

    -- * Mutators
  , linkTo
  , addBootstrappedCurve
  , addNonBootstrappedCurve

    -- * Inspectors
  , HasHelperUnderlying(..)
  , HasNodes(..)
  , rateHelperFixingDependencies
  , forwardRate
  , zeroRate
  , discount
  , rateHelperPillarDate
  , impliedQuote
  , impliedQuoteOn
  , HasConvexityAdjustment(..)
  , 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(..), RateInterval(..), setExtrapolation, HasHelperUnderlying(..), HasNodes(..))
import Data.Maybe(fromMaybe)
import Data.List.NonEmpty(NonEmpty, toList)
import Foreign.Ptr(Ptr, nullPtr, castPtr)
import Foreign.Marshal.Array(copyArray)
import qualified QuantLib.Internal.Callback as Callback
import qualified Data.Vector.Storable as V
import Control.Exception(throwIO)
import Control.Monad(when)
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(..))







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


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

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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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

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

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

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

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

{-# LINE 178 "./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", "p"]
  [ ("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 (GenFloatingRateCouponPricer $(varT (mkName "p")))|], [|Nothing|])
  , ("oisRule", [t|DateGenerationRule|], [|Backward|])
  , ("oisOvernightCalendar", [t|Maybe Calendar|], [|Nothing|])
  , ("oisConvention", [t|BusinessDayConvention|], [|ModifiedFollowing|])
  , ("oisFixedDayCount", [t|Maybe DayCounter|], [|Nothing|])
  ])

-- 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

-- |How a deposit's period and fixing conventions are given. 'DepositTenor' and 'DepositFromIndex'
-- are relative to the evaluation date: the deposit starts at spot and its dates move when the
-- evaluation date does. 'DepositFromIndex' takes the tenor and conventions from the ibor index;
-- 'DepositTenor' states them and fixes on an index QuantLib names @\"no-fix\"@.
-- 'DepositOnFixingDate' is the deposit the index fixes on the given date. Its dates never move, and
-- once that date is before the evaluation date its implied quote is the stored fixing, so
-- 'rateHelperFixingDependencies' reports it.
data DepositTerms ibor
  = DepositTenor
      !(Int, TimeUnit) -- ^tenor
      !Word -- ^fixingDays
      !Calendar
      !BusinessDayConvention
      !Bool -- ^endOfMonth
      !DayCounter
  | DepositFromIndex
      !(GenIborIndex ibor)
  | DepositOnFixingDate
      !Day -- ^fixingDate
      !(GenIborIndex ibor)

-- |Rate helper for bootstrapping over deposit rates.
depositRateHelper :: GenQuote q -> DepositTerms ibor -> IO RateHelper
depositRateHelper :: forall q ibor. GenQuote q -> DepositTerms ibor -> IO RateHelper
depositRateHelper GenQuote q
rate DepositTerms ibor
terms = case DepositTerms ibor
terms of
  DepositTenor (Int, TimeUnit)
t Word
fd Calendar
cal BusinessDayConvention
conv Bool
eom DayCounter
dc -> GenQuote q
-> (Int, TimeUnit)
-> Word
-> Calendar
-> BusinessDayConvention
-> Bool
-> DayCounter
-> IO RateHelper
forall q.
GenQuote q
-> (Int, TimeUnit)
-> Word
-> Calendar
-> BusinessDayConvention
-> Bool
-> DayCounter
-> IO RateHelper
depositRateHelperRaw GenQuote q
rate (Int, TimeUnit)
t Word
fd Calendar
cal BusinessDayConvention
conv Bool
eom DayCounter
dc
  DepositFromIndex GenIborIndex ibor
idx -> GenQuote q -> GenIborIndex ibor -> IO RateHelper
forall q ibor. GenQuote q -> GenIborIndex ibor -> IO RateHelper
depositRateHelperFromIndexRaw GenQuote q
rate GenIborIndex ibor
idx
  DepositOnFixingDate Day
d GenIborIndex ibor
idx -> GenQuote q -> Day -> GenIborIndex ibor -> IO RateHelper
forall q ibor.
GenQuote q -> Day -> GenIborIndex ibor -> IO RateHelper
depositRateHelperOnFixingDateRaw GenQuote q
rate Day
d GenIborIndex ibor
idx

-- Raw deposit bindings behind 'depositRateHelper'; one per 'DepositTerms' constructor.
depositRateHelperFromIndexRaw :: (GenQuote q) -> (GenIborIndex ibor) -> IO ((RateHelper))
depositRateHelperFromIndexRaw :: forall q ibor. GenQuote q -> GenIborIndex ibor -> IO RateHelper
depositRateHelperFromIndexRaw 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 ()) -> IO RateHelper) -> IO RateHelper
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr ()) -> IO RateHelper) -> IO RateHelper)
-> (Ptr (Ptr ()) -> IO RateHelper) -> IO RateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr ())
a3' -> 
  Ptr CQuote'
-> Ptr CIborIndex' -> Ptr (Ptr ()) -> IO (Ptr CRateHelper')
depositRateHelperFromIndexRaw'_ Ptr CQuote'
a1' Ptr CIborIndex'
a2' Ptr (Ptr ())
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 ()) -> IO ()
forall a. Ptr (Ptr a) -> IO ()
errorCheck  Ptr (Ptr ())
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 240 "./QuantLib/TermStructure/Yield.chs" #-}


depositRateHelperOnFixingDateRaw :: (GenQuote q) -> (Day) -- ^fixingDate
 -> (GenIborIndex ibor) -> IO ((RateHelper))
depositRateHelperOnFixingDateRaw a1 a2 a3 =
  withQuote a1 $ \a1' -> 
  withDay a2 $ \a2' -> 
  withIborIndex a3 $ \a3' -> 
  preErrorCheck $ \a4' -> 
  depositRateHelperOnFixingDateRaw'_ a1' a2' a3' a4' >>= \res ->
  peekRateHelper res >>= \res' ->
  errorCheck  a4'>>
  return (res')

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


depositRateHelperRaw :: (GenQuote q) -- ^rate
 -> ((Int,TimeUnit)) -- ^tenor
 -> (Word) -- ^fixingDays
 -> (Calendar) -- ^calendar
 -> (BusinessDayConvention) -- ^convention
 -> (Bool) -- ^endOfMonth
 -> (DayCounter) -> IO ((RateHelper))
depositRateHelperRaw a1 a2 a3 a4 a5 a6 a7 =
  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 
  withDayCounter a7 $ \a7' -> 
  preErrorCheck $ \a8' -> 
  depositRateHelperRaw'_ a1' a2'1  a2'2 a3' a4' a5' a6' a7' a8' >>= \res ->
  peekRateHelper res >>= \res' ->
  errorCheck  a8'>>
  return (res')

{-# LINE 251 "./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 261 "./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 266 "./QuantLib/TermStructure/Yield.chs" #-}


-- |How a swap helper's schedule and legs are given. 'SwapRateFromIndex' takes every convention
-- from a swap index, 'SwapRateTenor' states them for a swap of the given tenor starting at spot
-- plus @fwdStart@, and both are relative to the evaluation date: the swap's dates move when it
-- does. 'SwapRateBetweenDates' is the swap between two fixed dates; once a coupon's fixing date is
-- before the evaluation date that coupon reads the stored fixing, which
-- 'rateHelperFixingDependencies' reports with the rest. @settlementDays@ ('Nothing' takes the
-- index's fixing days) and @floatConvention@ ('Nothing' takes the index's convention) exist only
-- in the forms that state their conventions.
data SwapRateTerms sidx ibor
  = SwapRateFromIndex
      !(GenSwapIndex sidx)
      !(Int, TimeUnit) -- ^fwdStart
  | SwapRateTenor
      !(Int, TimeUnit) -- ^tenor
      !Calendar
      !Frequency -- ^fixedFrequency
      !BusinessDayConvention -- ^fixedConvention
      !DayCounter -- ^fixedDayCount
      !(GenIborIndex ibor)
      !(Int, TimeUnit) -- ^fwdStart
      !(Maybe Word) -- ^settlementDays
      !(Maybe BusinessDayConvention) -- ^floatConvention
  | SwapRateBetweenDates
      !Day -- ^startDate
      !Day -- ^endDate
      !Calendar
      !Frequency -- ^fixedFrequency
      !BusinessDayConvention -- ^fixedConvention
      !DayCounter -- ^fixedDayCount
      !(GenIborIndex ibor)
      !(Maybe BusinessDayConvention) -- ^floatConvention

-- |Rate helper for bootstrapping over swap rates: a fixed-vs-ibor swap whose fair rate is the
-- quote.
swapRateHelper :: GenQuote q1 -- ^rate
  -> SwapRateTerms sidx ibor
  -> Maybe (GenQuote q2) -- ^spread
  -> Maybe (GenYieldTermStructure y) -- ^discountingCurve
  -> PillarChoice -- ^pillar
  -> Maybe Day -- ^customPillarDate
  -> Bool -- ^endOfMonth
  -> Maybe Bool -- ^useIndexedCoupons
  -> Maybe (GenFloatingRateCouponPricer frcp) -- ^couponPricer
  -> IO SwapRateHelper
swapRateHelper :: forall q1 sidx ibor q2 y frcp.
GenQuote q1
-> SwapRateTerms sidx ibor
-> Maybe (GenQuote q2)
-> Maybe (GenYieldTermStructure y)
-> PillarChoice
-> Maybe Day
-> Bool
-> Maybe Bool
-> Maybe (GenFloatingRateCouponPricer frcp)
-> IO SwapRateHelper
swapRateHelper GenQuote q1
rate SwapRateTerms sidx ibor
terms Maybe (GenQuote q2)
spread Maybe (GenYieldTermStructure y)
disc PillarChoice
pillar Maybe Day
customPillarDate Bool
eom Maybe Bool
indexed Maybe (GenFloatingRateCouponPricer frcp)
pricer = case SwapRateTerms sidx ibor
terms of
  SwapRateFromIndex GenSwapIndex sidx
idx (Int, TimeUnit)
fwd ->
    GenQuote q1
-> GenSwapIndex sidx
-> Maybe (GenQuote q2)
-> (Int, TimeUnit)
-> Maybe (GenYieldTermStructure y)
-> PillarChoice
-> Maybe Day
-> Bool
-> Maybe Bool
-> Maybe (GenFloatingRateCouponPricer frcp)
-> IO SwapRateHelper
forall q1 sidx q2 y frcp.
GenQuote q1
-> GenSwapIndex sidx
-> Maybe (GenQuote q2)
-> (Int, TimeUnit)
-> Maybe (GenYieldTermStructure y)
-> PillarChoice
-> Maybe Day
-> Bool
-> Maybe Bool
-> Maybe (GenFloatingRateCouponPricer frcp)
-> IO SwapRateHelper
swapRateHelperFromIndexRaw GenQuote q1
rate GenSwapIndex sidx
idx Maybe (GenQuote q2)
spread (Int, TimeUnit)
fwd Maybe (GenYieldTermStructure y)
disc PillarChoice
pillar Maybe Day
customPillarDate Bool
eom Maybe Bool
indexed Maybe (GenFloatingRateCouponPricer frcp)
pricer
  SwapRateTenor (Int, TimeUnit)
t Calendar
cal Frequency
ff BusinessDayConvention
fc DayCounter
fdc GenIborIndex ibor
ibor (Int, TimeUnit)
fwd Maybe Word
sd Maybe BusinessDayConvention
fl ->
    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 (GenFloatingRateCouponPricer frcp)
-> IO SwapRateHelper
forall q1 ibor q2 y frcp.
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 (GenFloatingRateCouponPricer frcp)
-> IO SwapRateHelper
swapRateHelperRaw GenQuote q1
rate (Int, TimeUnit)
t Calendar
cal Frequency
ff BusinessDayConvention
fc DayCounter
fdc GenIborIndex ibor
ibor Maybe (GenQuote q2)
spread (Int, TimeUnit)
fwd Maybe (GenYieldTermStructure y)
disc Maybe Word
sd PillarChoice
pillar Maybe Day
customPillarDate Bool
eom Maybe Bool
indexed Maybe BusinessDayConvention
fl Maybe (GenFloatingRateCouponPricer frcp)
pricer
  SwapRateBetweenDates Day
s Day
e Calendar
cal Frequency
ff BusinessDayConvention
fc DayCounter
fdc GenIborIndex ibor
ibor Maybe BusinessDayConvention
fl ->
    GenQuote q1
-> Day
-> Day
-> Calendar
-> Frequency
-> BusinessDayConvention
-> DayCounter
-> GenIborIndex ibor
-> Maybe (GenQuote q2)
-> Maybe (GenYieldTermStructure y)
-> PillarChoice
-> Maybe Day
-> Bool
-> Maybe Bool
-> Maybe BusinessDayConvention
-> Maybe (GenFloatingRateCouponPricer frcp)
-> IO SwapRateHelper
forall q1 ibor q2 y frcp.
GenQuote q1
-> Day
-> Day
-> Calendar
-> Frequency
-> BusinessDayConvention
-> DayCounter
-> GenIborIndex ibor
-> Maybe (GenQuote q2)
-> Maybe (GenYieldTermStructure y)
-> PillarChoice
-> Maybe Day
-> Bool
-> Maybe Bool
-> Maybe BusinessDayConvention
-> Maybe (GenFloatingRateCouponPricer frcp)
-> IO SwapRateHelper
swapRateHelperBetweenDatesRaw GenQuote q1
rate Day
s Day
e Calendar
cal Frequency
ff BusinessDayConvention
fc DayCounter
fdc GenIborIndex ibor
ibor Maybe (GenQuote q2)
spread Maybe (GenYieldTermStructure y)
disc PillarChoice
pillar Maybe Day
customPillarDate Bool
eom Maybe Bool
indexed Maybe BusinessDayConvention
fl Maybe (GenFloatingRateCouponPricer frcp)
pricer

-- Raw swap bindings behind 'swapRateHelper'; one per 'SwapRateTerms' constructor.
swapRateHelperBetweenDatesRaw :: (GenQuote q1) -- ^rate
 -> (Day) -- ^startDate
 -> (Day) -- ^endDate
 -> (Calendar) -- ^calendar
 -> (Frequency) -- ^fixedFrequency
 -> (BusinessDayConvention) -- ^fixedConvention
 -> (DayCounter) -- ^fixedDayCount
 -> (GenIborIndex ibor) -- ^iborIndex
 -> (Maybe (GenQuote q2)) -- ^spread
 -> (Maybe (GenYieldTermStructure y)) -- ^discountingCurve
 -> (PillarChoice) -- ^pillar
 -> (Maybe Day) -- ^customPillarDate
 -> (Bool) -- ^endOfMonth
 -> (Maybe Bool) -- ^useIndexedCoupons
 -> (Maybe BusinessDayConvention) -- ^floatConvention
 -> (Maybe (GenFloatingRateCouponPricer frcp)) -- ^couponPricer
 -> IO ((SwapRateHelper))
swapRateHelperBetweenDatesRaw :: forall q1 ibor q2 y frcp.
GenQuote q1
-> Day
-> Day
-> Calendar
-> Frequency
-> BusinessDayConvention
-> DayCounter
-> GenIborIndex ibor
-> Maybe (GenQuote q2)
-> Maybe (GenYieldTermStructure y)
-> PillarChoice
-> Maybe Day
-> Bool
-> Maybe Bool
-> Maybe BusinessDayConvention
-> Maybe (GenFloatingRateCouponPricer frcp)
-> IO SwapRateHelper
swapRateHelperBetweenDatesRaw GenQuote q1
a1 Day
a2 Day
a3 Calendar
a4 Frequency
a5 BusinessDayConvention
a6 DayCounter
a7 GenIborIndex ibor
a8 Maybe (GenQuote q2)
a9 Maybe (GenYieldTermStructure y)
a10 PillarChoice
a11 Maybe Day
a12 Bool
a13 Maybe Bool
a14 Maybe BusinessDayConvention
a15 Maybe (GenFloatingRateCouponPricer frcp)
a16 =
  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' -> 
  Day -> (CInt -> IO SwapRateHelper) -> IO SwapRateHelper
forall a. Day -> (CInt -> IO a) -> IO a
withDay Day
a2 ((CInt -> IO SwapRateHelper) -> IO SwapRateHelper)
-> (CInt -> IO SwapRateHelper) -> IO SwapRateHelper
forall a b. (a -> b) -> a -> b
$ \CInt
a2' -> 
  Day -> (CInt -> IO SwapRateHelper) -> IO SwapRateHelper
forall a. Day -> (CInt -> IO a) -> IO a
withDay Day
a3 ((CInt -> IO SwapRateHelper) -> IO SwapRateHelper)
-> (CInt -> IO SwapRateHelper) -> IO SwapRateHelper
forall a b. (a -> b) -> a -> b
$ \CInt
a3' -> 
  Calendar
-> (Ptr CCalendar -> IO SwapRateHelper) -> IO SwapRateHelper
forall b. Calendar -> (Ptr CCalendar -> IO b) -> IO b
withCalendar Calendar
a4 ((Ptr CCalendar -> IO SwapRateHelper) -> IO SwapRateHelper)
-> (Ptr CCalendar -> IO SwapRateHelper) -> IO SwapRateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr CCalendar
a4' -> 
  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' = BusinessDayConvention -> CInt
forall a b. (Enum a, Integral b) => a -> b
fromEnumC BusinessDayConvention
a6} in 
  DayCounter
-> (Ptr CDayCounter -> IO SwapRateHelper) -> IO SwapRateHelper
forall b. DayCounter -> (Ptr CDayCounter -> IO b) -> IO b
withDayCounter DayCounter
a7 ((Ptr CDayCounter -> IO SwapRateHelper) -> IO SwapRateHelper)
-> (Ptr CDayCounter -> IO SwapRateHelper) -> IO SwapRateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr CDayCounter
a7' -> 
  GenIborIndex ibor
-> (Ptr CIborIndex' -> IO SwapRateHelper) -> IO SwapRateHelper
forall ibor b.
GenIborIndex ibor -> (Ptr CIborIndex' -> IO b) -> IO b
withIborIndex GenIborIndex ibor
a8 ((Ptr CIborIndex' -> IO SwapRateHelper) -> IO SwapRateHelper)
-> (Ptr CIborIndex' -> IO SwapRateHelper) -> IO SwapRateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr CIborIndex'
a8' -> 
  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)
a9 ((Ptr CQuote' -> IO SwapRateHelper) -> IO SwapRateHelper)
-> (Ptr CQuote' -> IO SwapRateHelper) -> IO SwapRateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr CQuote'
a9' -> 
  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' :: CInt
a11' = (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
a11} in 
  Maybe Day -> (CInt -> IO SwapRateHelper) -> IO SwapRateHelper
forall a. Maybe Day -> (CInt -> IO a) -> IO a
withMaybeDay Maybe Day
a12 ((CInt -> IO SwapRateHelper) -> IO SwapRateHelper)
-> (CInt -> IO SwapRateHelper) -> IO SwapRateHelper
forall a b. (a -> b) -> a -> b
$ \CInt
a12' -> 
  let {a13' :: CInt
a13' = Bool -> CInt
forall a. Num a => Bool -> a
C2HSImp.fromBool Bool
a13} in 
  let {a14' :: CInt
a14' = Maybe Bool -> CInt
fromMaybeBool Maybe Bool
a14} in 
  let {a15' :: CInt
a15' = Maybe BusinessDayConvention -> CInt
forall a. Enum a => Maybe a -> CInt
fromMaybeEnum Maybe BusinessDayConvention
a15} in 
  Maybe (GenFloatingRateCouponPricer frcp)
-> (Ptr CFloatingRateCouponPricer' -> IO SwapRateHelper)
-> IO SwapRateHelper
forall frcp b.
Maybe (GenFloatingRateCouponPricer frcp)
-> (Ptr CFloatingRateCouponPricer' -> IO b) -> IO b
withMaybeFloatingRateCouponPricer Maybe (GenFloatingRateCouponPricer frcp)
a16 ((Ptr CFloatingRateCouponPricer' -> IO SwapRateHelper)
 -> IO SwapRateHelper)
-> (Ptr CFloatingRateCouponPricer' -> IO SwapRateHelper)
-> IO SwapRateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr CFloatingRateCouponPricer'
a16' -> 
  (Ptr (Ptr ()) -> IO SwapRateHelper) -> IO SwapRateHelper
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr ()) -> IO SwapRateHelper) -> IO SwapRateHelper)
-> (Ptr (Ptr ()) -> IO SwapRateHelper) -> IO SwapRateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr ())
a17' -> 
  Ptr CQuote'
-> CInt
-> CInt
-> Ptr CCalendar
-> CInt
-> CInt
-> Ptr CDayCounter
-> Ptr CIborIndex'
-> Ptr CQuote'
-> Ptr CYieldTermStructure'
-> CInt
-> CInt
-> CInt
-> CInt
-> CInt
-> Ptr CFloatingRateCouponPricer'
-> Ptr (Ptr ())
-> IO (Ptr CSwapRateHelper')
swapRateHelperBetweenDatesRaw'_ Ptr CQuote'
a1' CInt
a2' CInt
a3' Ptr CCalendar
a4' CInt
a5' CInt
a6' Ptr CDayCounter
a7' Ptr CIborIndex'
a8' Ptr CQuote'
a9' Ptr CYieldTermStructure'
a10' CInt
a11' CInt
a12' CInt
a13' CInt
a14' CInt
a15' Ptr CFloatingRateCouponPricer'
a16' Ptr (Ptr ())
a17' IO (Ptr CSwapRateHelper')
-> (Ptr CSwapRateHelper' -> IO SwapRateHelper) -> IO SwapRateHelper
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Ptr CSwapRateHelper'
res ->
  Ptr CSwapRateHelper' -> IO SwapRateHelper
peekSwapRateHelper Ptr CSwapRateHelper'
res IO SwapRateHelper
-> (SwapRateHelper -> IO SwapRateHelper) -> IO SwapRateHelper
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \SwapRateHelper
res' ->
  Ptr (Ptr ()) -> IO ()
forall a. Ptr (Ptr a) -> IO ()
errorCheck  Ptr (Ptr ())
a17'IO () -> IO SwapRateHelper -> IO SwapRateHelper
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
  SwapRateHelper -> IO SwapRateHelper
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (SwapRateHelper
res')

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


swapRateHelperRaw :: (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 (GenFloatingRateCouponPricer frcp)) -- ^couponPricer
 -> IO ((SwapRateHelper))
swapRateHelperRaw a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 =
  withQuote a1 $ \a1' -> 
  let {(a2'1, a2'2) = fromEnumQuantity a2} in 
  withCalendar a3 $ \a3' -> 
  let {a4' = (fromIntegral . fromEnum) a4} in 
  let {a5' = fromEnumC a5} in 
  withDayCounter a6 $ \a6' -> 
  withIborIndex a7 $ \a7' -> 
  withMaybeQuote a8 $ \a8' -> 
  let {(a9'1, a9'2) = fromEnumQuantity a9} in 
  withMaybeYieldTermStructure a10 $ \a10' -> 
  let {a11' = fromMaybeInt a11} in 
  let {a12' = (fromIntegral . fromEnum) 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' -> 
  swapRateHelperRaw'_ a1' a2'1  a2'2 a3' a4' a5' a6' a7' a8' a9'1  a9'2 a10' a11' a12' a13' a14' a15' a16' a17' a18' >>= \res ->
  peekSwapRateHelper res >>= \res' ->
  errorCheck  a18'>>
  return (res')

{-# LINE 356 "./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 363 "./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 365 "./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 376 "./QuantLib/TermStructure/Yield.chs" #-}


-- |The forward rate over a date or year-fraction interval. Dates are not adjusted for
-- holidays; a time interval's rate carries the curve's own day-counting rule.
forwardRate :: GenYieldTermStructure y -> RateInterval -> Compounding -> Frequency -> Bool
  -> IO InterestRate
forwardRate curve interval = case interval of
  RateBetweenDates d1 d2 dc -> forwardRateBetweenDatesRaw curve d1 d2 dc
  RateBetweenTimes t1 t2 -> forwardRateBetweenTimesRaw curve t1 t2

forwardRateBetweenDatesRaw :: (GenYieldTermStructure y) -> (Day) -> (Day) -> (DayCounter) -> (Compounding) -> (Frequency) -> (Bool) -- ^extrapolate
 -> IO ((InterestRate))
forwardRateBetweenDatesRaw 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' -> 
  forwardRateBetweenDatesRaw'_ a1' a2' a3' a4' a5' a6' a7' a8' >>= \res ->
  peekInterestRate res >>= \res' ->
  errorCheck  a8'>>
  return (res')

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


forwardRateBetweenTimesRaw :: (GenYieldTermStructure y) -> (Double) -> (Double) -> (Compounding) -> (Frequency) -> (Bool) -- ^extrapolate
 -> IO ((InterestRate))
forwardRateBetweenTimesRaw 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' -> 
  forwardRateBetweenTimesRaw'_ a1' a2' a3' a4' a5' a6' a7' >>= \res ->
  peekInterestRate res >>= \res' ->
  errorCheck  a7'>>
  return (res')

{-# LINE 392 "./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 396 "./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 406 "./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 months and
-- period variants without an index state them explicitly. 'FraImmOffsets' starts and ends the
-- FRA on the given IMM dates after spot, counting the first as 1, and takes the rest from the
-- index. All of these are relative to the evaluation date. 'FraBetweenDates' is not: it runs from
-- the start date to the end date and fixes where the index fixes for the start date, and, with
-- @useIndexedCoupon@, its implied quote is the stored fixing once that date is before the
-- evaluation date, which 'rateHelperFixingDependencies' reports.
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)
  | FraImmOffsets
      !Word -- ^immOffsetStart
      !Word -- ^immOffsetEnd
      !(GenIborIndex ibor)
  | FraBetweenDates
      !Day -- ^startDate
      !Day -- ^endDate
      !(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
  FraImmOffsets Word
s Word
e GenIborIndex ibor
idx -> GenQuote q
-> Word
-> Word
-> GenIborIndex ibor
-> PillarChoice
-> Maybe Day
-> Bool
-> IO RateHelper
forall q ibor.
GenQuote q
-> Word
-> Word
-> GenIborIndex ibor
-> PillarChoice
-> Maybe Day
-> Bool
-> IO RateHelper
fraImmOffsetsRateHelperRaw GenQuote q
rate Word
s Word
e GenIborIndex ibor
idx
  FraBetweenDates Day
s Day
e GenIborIndex ibor
idx -> GenQuote q
-> Day
-> Day
-> GenIborIndex ibor
-> PillarChoice
-> Maybe Day
-> Bool
-> IO RateHelper
forall q ibor.
GenQuote q
-> Day
-> Day
-> GenIborIndex ibor
-> PillarChoice
-> Maybe Day
-> Bool
-> IO RateHelper
fraBetweenDatesRateHelperRaw GenQuote q
rate Day
s Day
e 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 ()) -> IO RateHelper) -> IO RateHelper
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr ()) -> IO RateHelper) -> IO RateHelper)
-> (Ptr (Ptr ()) -> IO RateHelper) -> IO RateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr ())
a12' -> 
  Ptr CQuote'
-> CUInt
-> CUInt
-> CUInt
-> Ptr CCalendar
-> CInt
-> CInt
-> Ptr CDayCounter
-> CInt
-> CInt
-> CInt
-> Ptr (Ptr ())
-> 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 ())
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 ()) -> IO ()
forall a. Ptr (Ptr a) -> IO ()
errorCheck  Ptr (Ptr ())
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 474 "./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
 -> (Maybe Bool) -- ^useIndexedCoupons (1.44; QuantLib 1.43 requires 'Nothing')
 -> (DateGenerationRule) -- ^rule (1.44; QuantLib 1.43 requires 'Backward')
 -> (Int) -- ^paymentLag (1.44; QuantLib 1.43 requires 0)
 -> (Maybe (StubIndexSelection ibor3)) -- ^baseStub (1.44; QuantLib 1.43 requires 'Nothing')
 -> (Maybe (StubIndexSelection ibor4)) -- ^otherStub (1.44; QuantLib 1.43 requires 'Nothing')
 -> IO ((RateHelper))
iborIborBasisSwapRateHelper :: forall q ibor1 ibor2 y ibor3 ibor4.
GenQuote q
-> (Int, TimeUnit)
-> Word
-> Calendar
-> BusinessDayConvention
-> Bool
-> GenIborIndex ibor1
-> GenIborIndex ibor2
-> GenYieldTermStructure y
-> Bool
-> Maybe Bool
-> DateGenerationRule
-> Int
-> Maybe (StubIndexSelection ibor3)
-> Maybe (StubIndexSelection ibor4)
-> 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 Maybe Bool
a11 DateGenerationRule
a12 Int
a13 Maybe (StubIndexSelection ibor3)
a14 Maybe (StubIndexSelection ibor4)
a15 =
  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' = Maybe Bool -> CInt
fromMaybeBool Maybe Bool
a11} in 
  let {a12' :: CInt
a12' = (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
a12} in 
  let {a13' :: CInt
a13' = Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
a13} in 
  Maybe (StubIndexSelection ibor3)
-> (Ptr CStubIndexSelection' -> IO RateHelper) -> IO RateHelper
forall ibor r.
Maybe (StubIndexSelection ibor)
-> (Ptr CStubIndexSelection' -> IO r) -> IO r
withStubIndexSelection Maybe (StubIndexSelection ibor3)
a14 ((Ptr CStubIndexSelection' -> IO RateHelper) -> IO RateHelper)
-> (Ptr CStubIndexSelection' -> IO RateHelper) -> IO RateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr CStubIndexSelection'
a14' -> 
  Maybe (StubIndexSelection ibor4)
-> (Ptr CStubIndexSelection' -> IO RateHelper) -> IO RateHelper
forall ibor r.
Maybe (StubIndexSelection ibor)
-> (Ptr CStubIndexSelection' -> IO r) -> IO r
withStubIndexSelection Maybe (StubIndexSelection ibor4)
a15 ((Ptr CStubIndexSelection' -> IO RateHelper) -> IO RateHelper)
-> (Ptr CStubIndexSelection' -> IO RateHelper) -> IO RateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr CStubIndexSelection'
a15' -> 
  (Ptr (Ptr ()) -> IO RateHelper) -> IO RateHelper
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr ()) -> IO RateHelper) -> IO RateHelper)
-> (Ptr (Ptr ()) -> IO RateHelper) -> IO RateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr ())
a16' -> 
  Ptr CQuote'
-> CInt
-> CInt
-> CUInt
-> Ptr CCalendar
-> CInt
-> CInt
-> Ptr CIborIndex'
-> Ptr CIborIndex'
-> Ptr CYieldTermStructure'
-> CInt
-> CInt
-> CInt
-> CInt
-> Ptr CStubIndexSelection'
-> Ptr CStubIndexSelection'
-> Ptr (Ptr ())
-> 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' CInt
a11' CInt
a12' CInt
a13' Ptr CStubIndexSelection'
a14' Ptr CStubIndexSelection'
a15' Ptr (Ptr ())
a16' 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 ()) -> IO ()
forall a. Ptr (Ptr a) -> IO ()
errorCheck  Ptr (Ptr ())
a16'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 496 "./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 on 1.43. On 1.44, @bootstrapBaseCurve@ chooses the projected leg; an empty
-- discount handle uses the bootstrapped curve (1.43 uses the overnight 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
 -> (Bool) -- ^bootstrapBaseCurve (1.44; QuantLib 1.43 requires 'False')
 -> (Int) -- ^paymentLag (1.44; QuantLib 1.43 requires 0)
 -> (Maybe Frequency) -- ^overnightPaymentFrequency (1.44; QuantLib 1.43 requires 'Nothing')
 -> (Maybe Bool) -- ^useIndexedCoupons (1.44; QuantLib 1.43 requires 'Nothing')
 -> (DateGenerationRule) -- ^rule (1.44; QuantLib 1.43 requires 'Backward')
 -> (RateAveragingType) -- ^averagingMethod (1.44; QuantLib 1.43 requires 'AveragingCompound')
 -> (Bool) -- ^telescopicValueDates (1.44; QuantLib 1.43 requires 'False')
 -> (Bool) -- ^basisOnIborLeg (1.44; QuantLib 1.43 requires 'False')
 -> (Maybe (StubIndexSelection ibor2)) -- ^iborStub (1.44; QuantLib 1.43 requires 'Nothing')
 -> IO ((RateHelper))
overnightIborBasisSwapRateHelper :: forall q ibor y ibor2.
GenQuote q
-> (Int, TimeUnit)
-> Word
-> Calendar
-> BusinessDayConvention
-> Bool
-> OvernightIborIndex
-> GenIborIndex ibor
-> Maybe (GenYieldTermStructure y)
-> Bool
-> Int
-> Maybe Frequency
-> Maybe Bool
-> DateGenerationRule
-> RateAveragingType
-> Bool
-> Bool
-> Maybe (StubIndexSelection ibor2)
-> IO RateHelper
overnightIborBasisSwapRateHelper GenQuote q
a1 (Int, TimeUnit)
a2 Word
a3 Calendar
a4 BusinessDayConvention
a5 Bool
a6 OvernightIborIndex
a7 GenIborIndex ibor
a8 Maybe (GenYieldTermStructure y)
a9 Bool
a10 Int
a11 Maybe Frequency
a12 Maybe Bool
a13 DateGenerationRule
a14 RateAveragingType
a15 Bool
a16 Bool
a17 Maybe (StubIndexSelection ibor2)
a18 =
  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 
  OvernightIborIndex
-> (Ptr COvernightIndex' -> IO RateHelper) -> IO RateHelper
forall b.
OvernightIborIndex -> (Ptr COvernightIndex' -> IO b) -> IO b
withOvernightIborIndex OvernightIborIndex
a7 ((Ptr COvernightIndex' -> IO RateHelper) -> IO RateHelper)
-> (Ptr COvernightIndex' -> IO RateHelper) -> IO RateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr COvernightIndex'
a7' -> 
  GenIborIndex ibor
-> (Ptr CIborIndex' -> IO RateHelper) -> IO RateHelper
forall ibor b.
GenIborIndex ibor -> (Ptr CIborIndex' -> IO b) -> IO b
withIborIndex GenIborIndex ibor
a8 ((Ptr CIborIndex' -> IO RateHelper) -> IO RateHelper)
-> (Ptr CIborIndex' -> IO RateHelper) -> IO RateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr CIborIndex'
a8' -> 
  Maybe (GenYieldTermStructure y)
-> (Ptr CYieldTermStructure' -> IO RateHelper) -> IO RateHelper
forall y b.
Maybe (GenYieldTermStructure y)
-> (Ptr CYieldTermStructure' -> IO b) -> IO b
withMaybeYieldTermStructure Maybe (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' = Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
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' = Maybe Bool -> CInt
fromMaybeBool Maybe Bool
a13} in 
  let {a14' :: CInt
a14' = (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
a14} in 
  let {a15' :: CInt
a15' = RateAveragingType -> CInt
forall a b. (Enum a, Integral b) => a -> b
fromEnumC RateAveragingType
a15} in 
  let {a16' :: CInt
a16' = Bool -> CInt
forall a. Num a => Bool -> a
C2HSImp.fromBool Bool
a16} in 
  let {a17' :: CInt
a17' = Bool -> CInt
forall a. Num a => Bool -> a
C2HSImp.fromBool Bool
a17} in 
  Maybe (StubIndexSelection ibor2)
-> (Ptr CStubIndexSelection' -> IO RateHelper) -> IO RateHelper
forall ibor r.
Maybe (StubIndexSelection ibor)
-> (Ptr CStubIndexSelection' -> IO r) -> IO r
withStubIndexSelection Maybe (StubIndexSelection ibor2)
a18 ((Ptr CStubIndexSelection' -> IO RateHelper) -> IO RateHelper)
-> (Ptr CStubIndexSelection' -> IO RateHelper) -> IO RateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr CStubIndexSelection'
a18' -> 
  (Ptr (Ptr ()) -> IO RateHelper) -> IO RateHelper
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr ()) -> IO RateHelper) -> IO RateHelper)
-> (Ptr (Ptr ()) -> IO RateHelper) -> IO RateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr ())
a19' -> 
  Ptr CQuote'
-> CInt
-> CInt
-> CUInt
-> Ptr CCalendar
-> CInt
-> CInt
-> Ptr COvernightIndex'
-> Ptr CIborIndex'
-> Ptr CYieldTermStructure'
-> CInt
-> CInt
-> CInt
-> CInt
-> CInt
-> CInt
-> CInt
-> CInt
-> Ptr CStubIndexSelection'
-> Ptr (Ptr ())
-> IO (Ptr CRateHelper')
overnightIborBasisSwapRateHelper'_ Ptr CQuote'
a1' CInt
a2'1  CInt
a2'2 CUInt
a3' Ptr CCalendar
a4' CInt
a5' CInt
a6' Ptr COvernightIndex'
a7' Ptr CIborIndex'
a8' Ptr CYieldTermStructure'
a9' CInt
a10' CInt
a11' CInt
a12' CInt
a13' CInt
a14' CInt
a15' CInt
a16' CInt
a17' Ptr CStubIndexSelection'
a18' Ptr (Ptr ())
a19' 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 ()) -> IO ()
forall a. Ptr (Ptr a) -> IO ()
errorCheck  Ptr (Ptr ())
a19'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 520 "./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
 -> (Maybe Bool) -- ^useIndexedCoupons (1.44; QuantLib 1.43 requires 'Nothing')
 -> (Bool) -- ^paymentLagOnNotionalExchanges (1.44; QuantLib 1.43 requires 'False')
 -> (Maybe (StubIndexSelection ibor3)) -- ^baseStub (1.44; QuantLib 1.43 requires 'Nothing')
 -> (Maybe (StubIndexSelection ibor4)) -- ^quoteStub (1.44; QuantLib 1.43 requires 'Nothing')
 -> IO ((RateHelper))
constNotionalCrossCurrencyBasisSwapRateHelper a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 =
  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' = fromMaybeEnum a12} in 
  let {a13' = fromIntegral a13} in 
  let {a14' = fromMaybeEnum a14} in 
  let {a15' = fromMaybeBool a15} in 
  let {a16' = C2HSImp.fromBool a16} in 
  withStubIndexSelection a17 $ \a17' -> 
  withStubIndexSelection a18 $ \a18' -> 
  preErrorCheck $ \a19' -> 
  constNotionalCrossCurrencyBasisSwapRateHelper'_ a1' a2'1  a2'2 a3' a4' a5' a6' a7' a8' a9' a10' a11' a12' a13' a14' a15' a16' a17' a18' a19' >>= \res ->
  peekRateHelper res >>= \res' ->
  errorCheck  a19'>>
  return (res')

{-# LINE 544 "./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
 -> (Word) -- ^fxResetFixingDays (1.44; QuantLib 1.43 requires 0)
 -> (Maybe Calendar) -- ^fxResetFixingCalendar (1.44; QuantLib 1.43 requires 'Nothing')
 -> (Maybe Bool) -- ^useIndexedCoupons (1.44; QuantLib 1.43 requires 'Nothing')
 -> (Maybe (StubIndexSelection ibor3)) -- ^baseStub (1.44; QuantLib 1.43 requires 'Nothing')
 -> (Maybe (StubIndexSelection ibor4)) -- ^quoteStub (1.44; QuantLib 1.43 requires 'Nothing')
 -> IO ((RateHelper))
mtmCrossCurrencyBasisSwapRateHelper :: forall q ibor1 ibor2 y ibor3 ibor4.
GenQuote q
-> (Int, TimeUnit)
-> Word
-> Calendar
-> BusinessDayConvention
-> Bool
-> GenIborIndex ibor1
-> GenIborIndex ibor2
-> GenYieldTermStructure y
-> Bool
-> Bool
-> Bool
-> Maybe Frequency
-> Int
-> Maybe Frequency
-> Word
-> Maybe Calendar
-> Maybe Bool
-> Maybe (StubIndexSelection ibor3)
-> Maybe (StubIndexSelection ibor4)
-> IO RateHelper
mtmCrossCurrencyBasisSwapRateHelper 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 Bool
a12 Maybe Frequency
a13 Int
a14 Maybe Frequency
a15 Word
a16 Maybe Calendar
a17 Maybe Bool
a18 Maybe (StubIndexSelection ibor3)
a19 Maybe (StubIndexSelection ibor4)
a20 =
  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' = Bool -> CInt
forall a. Num a => Bool -> a
C2HSImp.fromBool Bool
a12} in 
  let {a13' :: CInt
a13' = Maybe Frequency -> CInt
forall a. Enum a => Maybe a -> CInt
fromMaybeEnum Maybe Frequency
a13} in 
  let {a14' :: CInt
a14' = Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
a14} in 
  let {a15' :: CInt
a15' = Maybe Frequency -> CInt
forall a. Enum a => Maybe a -> CInt
fromMaybeEnum Maybe Frequency
a15} in 
  let {a16' :: CUInt
a16' = Word -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word
a16} in 
  Maybe Calendar -> (Ptr CCalendar -> IO RateHelper) -> IO RateHelper
forall r. Maybe Calendar -> (Ptr CCalendar -> IO r) -> IO r
withMaybeCalendar Maybe Calendar
a17 ((Ptr CCalendar -> IO RateHelper) -> IO RateHelper)
-> (Ptr CCalendar -> IO RateHelper) -> IO RateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr CCalendar
a17' -> 
  let {a18' :: CInt
a18' = Maybe Bool -> CInt
fromMaybeBool Maybe Bool
a18} in 
  Maybe (StubIndexSelection ibor3)
-> (Ptr CStubIndexSelection' -> IO RateHelper) -> IO RateHelper
forall ibor r.
Maybe (StubIndexSelection ibor)
-> (Ptr CStubIndexSelection' -> IO r) -> IO r
withStubIndexSelection Maybe (StubIndexSelection ibor3)
a19 ((Ptr CStubIndexSelection' -> IO RateHelper) -> IO RateHelper)
-> (Ptr CStubIndexSelection' -> IO RateHelper) -> IO RateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr CStubIndexSelection'
a19' -> 
  Maybe (StubIndexSelection ibor4)
-> (Ptr CStubIndexSelection' -> IO RateHelper) -> IO RateHelper
forall ibor r.
Maybe (StubIndexSelection ibor)
-> (Ptr CStubIndexSelection' -> IO r) -> IO r
withStubIndexSelection Maybe (StubIndexSelection ibor4)
a20 ((Ptr CStubIndexSelection' -> IO RateHelper) -> IO RateHelper)
-> (Ptr CStubIndexSelection' -> IO RateHelper) -> IO RateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr CStubIndexSelection'
a20' -> 
  (Ptr (Ptr ()) -> IO RateHelper) -> IO RateHelper
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr ()) -> IO RateHelper) -> IO RateHelper)
-> (Ptr (Ptr ()) -> IO RateHelper) -> IO RateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr ())
a21' -> 
  Ptr CQuote'
-> CInt
-> CInt
-> CUInt
-> Ptr CCalendar
-> CInt
-> CInt
-> Ptr CIborIndex'
-> Ptr CIborIndex'
-> Ptr CYieldTermStructure'
-> CInt
-> CInt
-> CInt
-> CInt
-> CInt
-> CInt
-> CUInt
-> Ptr CCalendar
-> CInt
-> Ptr CStubIndexSelection'
-> Ptr CStubIndexSelection'
-> Ptr (Ptr ())
-> IO (Ptr CRateHelper')
mtmCrossCurrencyBasisSwapRateHelper'_ 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' CInt
a15' CUInt
a16' Ptr CCalendar
a17' CInt
a18' Ptr CStubIndexSelection'
a19' Ptr CStubIndexSelection'
a20' Ptr (Ptr ())
a21' 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 ()) -> IO ()
forall a. Ptr (Ptr a) -> IO ()
errorCheck  Ptr (Ptr ())
a21'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 569 "./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
 -> (Maybe Bool) -- ^useIndexedCoupons (1.44; QuantLib 1.43 requires 'Nothing')
 -> (Maybe Frequency) -- ^floatPaymentFrequency (1.44; QuantLib 1.43 requires 'Nothing')
 -> (Maybe (StubIndexSelection ibor2)) -- ^floatStub (1.44; QuantLib 1.43 requires 'Nothing')
 -> IO ((RateHelper))
constNotionalCrossCurrencySwapRateHelper 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 
  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 
  let {a13' = fromMaybeBool a13} in 
  let {a14' = fromMaybeEnum a14} in 
  withStubIndexSelection a15 $ \a15' -> 
  preErrorCheck $ \a16' -> 
  constNotionalCrossCurrencySwapRateHelper'_ 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 589 "./QuantLib/TermStructure/Yield.chs" #-}


-- |How an FX swap helper's dates are given. 'FxSwapTenor' is relative to the evaluation date:
-- the swap starts @fixingDays@ business days after it on @calendar@ and runs for @tenor@, and
-- @tradingCalendar@ (QuantLib's null calendar for none) is joined with @calendar@ for the spot
-- date. 'FxSwapBetweenDates' runs between two fixed dates.
data FxSwapTerms
  = FxSwapTenor
      !(Int, TimeUnit) -- ^tenor
      !Word -- ^fixingDays
      !Calendar
      !BusinessDayConvention
      !Bool -- ^endOfMonth
      !Calendar -- ^tradingCalendar
  | FxSwapBetweenDates
      !Day -- ^startDate
      !Day -- ^endDate

-- |Bootstrapping helper from FX swap points. '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
  -> FxSwapTerms
  -> Bool -- ^isFxBaseCurrencyCollateralCurrency
  -> GenYieldTermStructure y -- ^collateralCurve
  -> IO RateHelper
fxSwapRateHelper :: forall q1 q2 y.
GenQuote q1
-> GenQuote q2
-> FxSwapTerms
-> Bool
-> GenYieldTermStructure y
-> IO RateHelper
fxSwapRateHelper GenQuote q1
fwdPoint GenQuote q2
spotFx FxSwapTerms
terms Bool
isBase GenYieldTermStructure y
collateral = case FxSwapTerms
terms of
  FxSwapTenor (Int, TimeUnit)
t Word
fd Calendar
cal BusinessDayConvention
conv Bool
eom Calendar
trading -> GenQuote q1
-> GenQuote q2
-> (Int, TimeUnit)
-> Word
-> Calendar
-> BusinessDayConvention
-> Bool
-> Bool
-> GenYieldTermStructure y
-> Calendar
-> IO RateHelper
forall q1 q2 y.
GenQuote q1
-> GenQuote q2
-> (Int, TimeUnit)
-> Word
-> Calendar
-> BusinessDayConvention
-> Bool
-> Bool
-> GenYieldTermStructure y
-> Calendar
-> IO RateHelper
fxSwapRateHelperRaw GenQuote q1
fwdPoint GenQuote q2
spotFx (Int, TimeUnit)
t Word
fd Calendar
cal BusinessDayConvention
conv Bool
eom Bool
isBase GenYieldTermStructure y
collateral Calendar
trading
  FxSwapBetweenDates Day
s Day
e -> GenQuote q1
-> GenQuote q2
-> Day
-> Day
-> Bool
-> GenYieldTermStructure y
-> IO RateHelper
forall q1 q2 y.
GenQuote q1
-> GenQuote q2
-> Day
-> Day
-> Bool
-> GenYieldTermStructure y
-> IO RateHelper
fxSwapRateHelperBetweenDatesRaw GenQuote q1
fwdPoint GenQuote q2
spotFx Day
s Day
e Bool
isBase GenYieldTermStructure y
collateral

-- Raw FX swap bindings behind 'fxSwapRateHelper'; one per 'FxSwapTerms' constructor.
fxSwapRateHelperRaw :: (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))
fxSwapRateHelperRaw :: forall q1 q2 y.
GenQuote q1
-> GenQuote q2
-> (Int, TimeUnit)
-> Word
-> Calendar
-> BusinessDayConvention
-> Bool
-> Bool
-> GenYieldTermStructure y
-> Calendar
-> IO RateHelper
fxSwapRateHelperRaw GenQuote q1
a1 GenQuote q2
a2 (Int, TimeUnit)
a3 Word
a4 Calendar
a5 BusinessDayConvention
a6 Bool
a7 Bool
a8 GenYieldTermStructure y
a9 Calendar
a10 =
  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' -> 
  GenQuote q2 -> (Ptr CQuote' -> IO RateHelper) -> IO RateHelper
forall q b. GenQuote q -> (Ptr CQuote' -> IO b) -> IO b
withQuote GenQuote q2
a2 ((Ptr CQuote' -> IO RateHelper) -> IO RateHelper)
-> (Ptr CQuote' -> IO RateHelper) -> IO RateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr CQuote'
a2' -> 
  let {(CInt
a3'1, CInt
a3'2) = (Int, TimeUnit) -> (CInt, CInt)
forall a b c.
(Enum a, Integral b, Integral c) =>
(b, a) -> (CInt, c)
fromEnumQuantity (Int, TimeUnit)
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 
  let {a8' :: CInt
a8' = Bool -> CInt
forall a. Num a => Bool -> a
C2HSImp.fromBool Bool
a8} in 
  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' -> 
  Calendar -> (Ptr CCalendar -> IO RateHelper) -> IO RateHelper
forall b. Calendar -> (Ptr CCalendar -> IO b) -> IO b
withCalendar Calendar
a10 ((Ptr CCalendar -> IO RateHelper) -> IO RateHelper)
-> (Ptr CCalendar -> IO RateHelper) -> IO RateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr CCalendar
a10' -> 
  (Ptr (Ptr ()) -> IO RateHelper) -> IO RateHelper
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr ()) -> IO RateHelper) -> IO RateHelper)
-> (Ptr (Ptr ()) -> IO RateHelper) -> IO RateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr ())
a11' -> 
  Ptr CQuote'
-> Ptr CQuote'
-> CInt
-> CInt
-> CUInt
-> Ptr CCalendar
-> CInt
-> CInt
-> CInt
-> Ptr CYieldTermStructure'
-> Ptr CCalendar
-> Ptr (Ptr ())
-> IO (Ptr CRateHelper')
fxSwapRateHelperRaw'_ Ptr CQuote'
a1' Ptr CQuote'
a2' CInt
a3'1  CInt
a3'2 CUInt
a4' Ptr CCalendar
a5' CInt
a6' CInt
a7' CInt
a8' Ptr CYieldTermStructure'
a9' Ptr CCalendar
a10' Ptr (Ptr ())
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 ()) -> IO ()
forall a. Ptr (Ptr a) -> IO ()
errorCheck  Ptr (Ptr ())
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 631 "./QuantLib/TermStructure/Yield.chs" #-}


fxSwapRateHelperBetweenDatesRaw :: (GenQuote q1) -- ^fwdPoint
 -> (GenQuote q2) -- ^spotFx
 -> (Day) -- ^startDate
 -> (Day) -- ^endDate
 -> (Bool) -- ^isFxBaseCurrencyCollateralCurrency
 -> (GenYieldTermStructure y) -- ^collateralCurve
 -> IO ((RateHelper))
fxSwapRateHelperBetweenDatesRaw 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' -> 
  fxSwapRateHelperBetweenDatesRaw'_ a1' a2' a3' a4' a5' a6' a7' >>= \res ->
  peekRateHelper res >>= \res' ->
  errorCheck  a7'>>
  return (res')

{-# LINE 639 "./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 -> GenBond b -> Bond.BondPriceType -> IO BondHelper
bondHelper cleanPrice bond priceType = bondHelper_ cleanPrice bond (fromEnum priceType)

bondHelper_ :: (GenQuote q) -> (GenBond b) -> (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 647 "./QuantLib/TermStructure/Yield.chs" #-}


-- |How an OIS helper's dates are given. 'OisTenor' is relative to the evaluation date: the swap
-- starts @settlementDays@ after it plus @forwardStart@ and runs for @tenor@. 'OisBetweenDates'
-- runs between two fixed dates; every overnight fixing it compounds over that is before the
-- evaluation date is read from the store. @forwardStart@ is a field of 'OisTenor' rather than
-- of 'OISRateHelperOpts' because QuantLib's dated constructor has none.
data OisTerms
  = OisTenor
      !Word -- ^settlementDays
      !(Int, TimeUnit) -- ^tenor
      !(Int, TimeUnit) -- ^forwardStart
  | OisBetweenDates
      !Day -- ^startDate
      !Day -- ^endDate

-- |Rate helper for bootstrapping over overnight-indexed swap rates, with QuantLib's defaults for
-- everything 'oisRateHelperWithOptions' can set. Both share the same full-arity bindings.
oisRateHelper :: OisTerms -> GenQuote q -> OvernightIborIndex
  -> Maybe (GenYieldTermStructure y) -> IO OISRateHelper
oisRateHelper :: forall q y.
OisTerms
-> GenQuote q
-> OvernightIborIndex
-> Maybe (GenYieldTermStructure y)
-> IO OISRateHelper
oisRateHelper OisTerms
terms GenQuote q
fixedRate OvernightIborIndex
idx Maybe (GenYieldTermStructure y)
discountingCurve = do
  cal <- CalendarConstructor -> IO Calendar
calendar CalendarConstructor
Null
  case terms of
    OisTenor Word
settlementDays (Int, TimeUnit)
tenor (Int, TimeUnit)
forwardStart ->
      Word
-> (Int, TimeUnit)
-> GenQuote q
-> OvernightIborIndex
-> Maybe (GenYieldTermStructure y)
-> Bool
-> Int
-> BusinessDayConvention
-> Frequency
-> Calendar
-> (Int, TimeUnit)
-> Maybe (GenQuote (ZonkAny 1))
-> PillarChoice
-> Maybe Day
-> RateAveragingType
-> Maybe Bool
-> Maybe Frequency
-> Calendar
-> Maybe Word
-> Word
-> Bool
-> Maybe (GenFloatingRateCouponPricer (ZonkAny 0))
-> DateGenerationRule
-> Calendar
-> BusinessDayConvention
-> Maybe DayCounter
-> IO OISRateHelper
forall q1 y q2 frcp.
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 (GenFloatingRateCouponPricer frcp)
-> DateGenerationRule
-> Calendar
-> BusinessDayConvention
-> Maybe DayCounter
-> IO OISRateHelper
oisRateHelper_ Word
settlementDays (Int, TimeUnit)
tenor GenQuote q
fixedRate OvernightIborIndex
idx Maybe (GenYieldTermStructure y)
discountingCurve
        Bool
False Int
0 BusinessDayConvention
Following Frequency
Annual Calendar
cal (Int, TimeUnit)
forwardStart Maybe (GenQuote (ZonkAny 1))
forall a. Maybe a
Nothing PillarChoice
LastRelevantDate Maybe Day
forall a. Maybe a
Nothing RateAveragingType
AveragingCompound
        Maybe Bool
forall a. Maybe a
Nothing Maybe Frequency
forall a. Maybe a
Nothing Calendar
cal Maybe Word
forall a. Maybe a
Nothing Word
0 Bool
False Maybe (GenFloatingRateCouponPricer (ZonkAny 0))
forall a. Maybe a
Nothing DateGenerationRule
Backward Calendar
cal BusinessDayConvention
ModifiedFollowing Maybe DayCounter
forall a. Maybe a
Nothing
    OisBetweenDates Day
startDate Day
endDate ->
      Day
-> Day
-> GenQuote q
-> OvernightIborIndex
-> Maybe (GenYieldTermStructure y)
-> Bool
-> Int
-> BusinessDayConvention
-> Frequency
-> Calendar
-> Maybe (GenQuote (ZonkAny 3))
-> PillarChoice
-> Maybe Day
-> RateAveragingType
-> Maybe Bool
-> Maybe Frequency
-> Calendar
-> Maybe Word
-> Word
-> Bool
-> Maybe (GenFloatingRateCouponPricer (ZonkAny 2))
-> DateGenerationRule
-> Calendar
-> BusinessDayConvention
-> Maybe DayCounter
-> IO OISRateHelper
forall q1 y q2 frcp.
Day
-> Day
-> GenQuote q1
-> OvernightIborIndex
-> Maybe (GenYieldTermStructure y)
-> Bool
-> Int
-> BusinessDayConvention
-> Frequency
-> Calendar
-> Maybe (GenQuote q2)
-> PillarChoice
-> Maybe Day
-> RateAveragingType
-> Maybe Bool
-> Maybe Frequency
-> Calendar
-> Maybe Word
-> Word
-> Bool
-> Maybe (GenFloatingRateCouponPricer frcp)
-> DateGenerationRule
-> Calendar
-> BusinessDayConvention
-> Maybe DayCounter
-> IO OISRateHelper
oisRateHelper2_ Day
startDate Day
endDate GenQuote q
fixedRate OvernightIborIndex
idx Maybe (GenYieldTermStructure y)
discountingCurve
        Bool
False Int
0 BusinessDayConvention
Following Frequency
Annual Calendar
cal Maybe (GenQuote (ZonkAny 3))
forall a. Maybe a
Nothing PillarChoice
LastRelevantDate Maybe Day
forall a. Maybe a
Nothing RateAveragingType
AveragingCompound
        Maybe Bool
forall a. Maybe a
Nothing Maybe Frequency
forall a. Maybe a
Nothing Calendar
cal Maybe Word
forall a. Maybe a
Nothing Word
0 Bool
False Maybe (GenFloatingRateCouponPricer (ZonkAny 2))
forall a. Maybe a
Nothing DateGenerationRule
Backward Calendar
cal BusinessDayConvention
ModifiedFollowing Maybe DayCounter
forall a. Maybe a
Nothing

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 (GenFloatingRateCouponPricer frcp)) -- ^pricer
 -> (DateGenerationRule) -- ^rule
 -> (Calendar) -- ^overnightCalendar
 -> (BusinessDayConvention) -- ^convention (q1.k.q1. overnightConvention)
 -> (Maybe DayCounter) -- ^fixedDayCount (1.44; QuantLib 1.43 requires 'Nothing')
 -> IO ((OISRateHelper))
oisRateHelper_ :: forall q1 y q2 frcp.
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 (GenFloatingRateCouponPricer frcp)
-> DateGenerationRule
-> Calendar
-> BusinessDayConvention
-> Maybe DayCounter
-> 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 (GenFloatingRateCouponPricer frcp)
a22 DateGenerationRule
a23 Calendar
a24 BusinessDayConvention
a25 Maybe DayCounter
a26 =
  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 (GenFloatingRateCouponPricer frcp)
-> (Ptr CFloatingRateCouponPricer' -> IO OISRateHelper)
-> IO OISRateHelper
forall frcp b.
Maybe (GenFloatingRateCouponPricer frcp)
-> (Ptr CFloatingRateCouponPricer' -> IO b) -> IO b
withMaybeFloatingRateCouponPricer Maybe (GenFloatingRateCouponPricer frcp)
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 
  Maybe DayCounter
-> (Ptr CDayCounter -> IO OISRateHelper) -> IO OISRateHelper
forall r. Maybe DayCounter -> (Ptr CDayCounter -> IO r) -> IO r
withMaybeDayCounter Maybe DayCounter
a26 ((Ptr CDayCounter -> IO OISRateHelper) -> IO OISRateHelper)
-> (Ptr CDayCounter -> IO OISRateHelper) -> IO OISRateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr CDayCounter
a26' -> 
  (Ptr (Ptr ()) -> IO OISRateHelper) -> IO OISRateHelper
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr ()) -> IO OISRateHelper) -> IO OISRateHelper)
-> (Ptr (Ptr ()) -> IO OISRateHelper) -> IO OISRateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr ())
a27' -> 
  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 CDayCounter
-> Ptr (Ptr ())
-> 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 CDayCounter
a26' Ptr (Ptr ())
a27' 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 ()) -> IO ()
forall a. Ptr (Ptr a) -> IO ()
errorCheck  Ptr (Ptr ())
a27'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 705 "./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 (GenFloatingRateCouponPricer frcp)) -- ^pricer
 -> (DateGenerationRule) -- ^rule
 -> (Calendar) -- ^overnightCalendar
 -> (BusinessDayConvention) -- ^convention (q1.k.q1. overnightConvention)
 -> (Maybe DayCounter) -- ^fixedDayCount (1.44; QuantLib 1.43 requires 'Nothing')
 -> 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 a25 =
  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 
  withMaybeDayCounter a25 $ \a25' -> 
  preErrorCheck $ \a26' -> 
  oisRateHelper2_'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' a10' a11' a12' a13' a14' a15' a16' a17' a18' a19' a20' a21' a22' a23' a24' a25' a26' >>= \res ->
  peekOISRateHelper res >>= \res' ->
  errorCheck  a26'>>
  return (res')

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


-- |'oisRateHelper' with every trailing QuantLib parameter taken from an options record.
oisRateHelperWithOptions :: OisTerms -> GenQuote q -> OvernightIborIndex
  -> Maybe (GenYieldTermStructure y) -> OISRateHelperOpts m p -> IO OISRateHelper
oisRateHelperWithOptions terms fixedRate idx discountingCurve opts = do
  cal <- calendar Null
  let obs = oisObservation opts
      paymentCal = fromMaybe cal (oisPaymentCalendar opts)
      fixedCal = fromMaybe cal (oisFixedCalendar opts)
      overnightCal = fromMaybe cal (oisOvernightCalendar opts)
  case terms of
    OisTenor settlementDays tenor forwardStart ->
      oisRateHelper_ settlementDays tenor fixedRate idx discountingCurve
        (oisTelescopicValueDates opts) (oisPaymentLag opts) (oisPaymentConvention opts)
        (oisPaymentFrequency opts) paymentCal
        forwardStart (oisOvernightSpread opts) (oisPillar opts) (oisCustomPillarDate opts)
        (oisAveragingMethod opts) (oisEndOfMonth opts) (oisFixedPaymentFrequency opts)
        fixedCal (lookbackDays obs) (lockoutDays obs)
        (applyObservationShift obs) (oisPricer opts) (oisRule opts)
        overnightCal (oisConvention opts) (oisFixedDayCount opts)
    OisBetweenDates startDate endDate ->
      oisRateHelper2_ startDate endDate fixedRate idx discountingCurve
        (oisTelescopicValueDates opts) (oisPaymentLag opts) (oisPaymentConvention opts)
        (oisPaymentFrequency opts) paymentCal
        (oisOvernightSpread opts) (oisPillar opts) (oisCustomPillarDate opts)
        (oisAveragingMethod opts) (oisEndOfMonth opts) (oisFixedPaymentFrequency opts)
        fixedCal (lookbackDays obs) (lockoutDays obs)
        (applyObservationShift obs) (oisPricer opts) (oisRule opts)
        overnightCal (oisConvention opts) (oisFixedDayCount opts)

-- The 'SwapRateFromIndex' binding behind 'swapRateHelper'.
swapRateHelperFromIndexRaw :: (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 (GenFloatingRateCouponPricer frcp)) -- ^couponPricer
 -> IO ((SwapRateHelper))
swapRateHelperFromIndexRaw :: forall q1 sidx q2 y frcp.
GenQuote q1
-> GenSwapIndex sidx
-> Maybe (GenQuote q2)
-> (Int, TimeUnit)
-> Maybe (GenYieldTermStructure y)
-> PillarChoice
-> Maybe Day
-> Bool
-> Maybe Bool
-> Maybe (GenFloatingRateCouponPricer frcp)
-> IO SwapRateHelper
swapRateHelperFromIndexRaw 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 (GenFloatingRateCouponPricer frcp)
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 
  withMaybeYieldTermStructure a5 $ \a5' -> 
  let {a6' = (fromIntegral . fromEnum) a6} in 
  withMaybeDay a7 $ \a7' -> 
  let {a8' = C2HSImp.fromBool a8} in 
  let {a9' = fromMaybeBool a9} in 
  withMaybeFloatingRateCouponPricer a10 $ \a10' -> 
  preErrorCheck $ \a11' -> 
  swapRateHelperFromIndexRaw'_ a1' a2' a3' a4'1  a4'2 a5' a6' a7' a8' a9' a10' a11' >>= \res ->
  peekSwapRateHelper res >>= \res' ->
  errorCheck  a11'>>
  return (res')

{-# LINE 772 "./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 776 "./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 780 "./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 curve and its native dependents retain @f@ after the continuation returns.
-- Callback exceptions are rethrown by the enclosing Haskell call.
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) -> (Callback -> IO a) -> IO a
forall b.
(Double -> Double -> Double) -> (Callback -> IO b) -> IO b
withQuoteBinaryFun Double -> Double -> Double
f ((Callback -> IO a) -> IO a) -> (Callback -> IO a) -> IO a
forall a b. (a -> b) -> a -> b
$ \Callback
fp -> GenYieldTermStructure y1
-> GenYieldTermStructure y2
-> Callback
-> Compounding
-> Frequency
-> IO YieldTermStructure
forall y1 y2.
GenYieldTermStructure y1
-> GenYieldTermStructure y2
-> Callback
-> Compounding
-> Frequency
-> IO YieldTermStructure
qlCompositeZeroYieldStructure GenYieldTermStructure y1
c1 GenYieldTermStructure y2
c2 Callback
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) -> (Callback) -> (Compounding) -> (Frequency) -> IO ((YieldTermStructure))
qlCompositeZeroYieldStructure :: forall y1 y2.
GenYieldTermStructure y1
-> GenYieldTermStructure y2
-> Callback
-> Compounding
-> Frequency
-> IO YieldTermStructure
qlCompositeZeroYieldStructure GenYieldTermStructure y1
a1 GenYieldTermStructure y2
a2 Callback
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' -> 
  Callback
-> (Ptr () -> IO YieldTermStructure) -> IO YieldTermStructure
forall b. Callback -> (Ptr () -> IO b) -> IO b
withCallbackPtr Callback
a3 ((Ptr () -> IO YieldTermStructure) -> IO YieldTermStructure)
-> (Ptr () -> IO YieldTermStructure) -> IO YieldTermStructure
forall a b. (a -> b) -> a -> b
$ \Ptr ()
a3' -> 
  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 ()) -> IO YieldTermStructure) -> IO YieldTermStructure
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr ()) -> IO YieldTermStructure) -> IO YieldTermStructure)
-> (Ptr (Ptr ()) -> IO YieldTermStructure) -> IO YieldTermStructure
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr ())
a6' -> 
  Ptr CYieldTermStructure'
-> Ptr CYieldTermStructure'
-> Ptr ()
-> CInt
-> CInt
-> Ptr (Ptr ())
-> IO (Ptr CYieldTermStructure')
qlCompositeZeroYieldStructure'_ Ptr CYieldTermStructure'
a1' Ptr CYieldTermStructure'
a2' Ptr ()
a3' CInt
a4' CInt
a5' Ptr (Ptr ())
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 ()) -> IO ()
forall a. Ptr (Ptr a) -> IO ()
errorCheck  Ptr (Ptr ())
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 798 "./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 805 "./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 820 "./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 828 "./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 838 "./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 845 "./QuantLib/TermStructure/Yield.chs" #-}


fraImmOffsetsRateHelperRaw :: (GenQuote q) -> (Word) -- ^immOffsetStart
 -> (Word) -- ^immOffsetEnd
 -> (GenIborIndex ibor) -> (PillarChoice) -- ^pillar
 -> (Maybe Day) -- ^customPillarDate
 -> (Bool) -- ^useIndexedCoupon
 -> IO ((RateHelper))
fraImmOffsetsRateHelperRaw a1 a2 a3 a4 a5 a6 a7 =
  withQuote a1 $ \a1' -> 
  let {a2' = fromIntegral a2} in 
  let {a3' = fromIntegral a3} in 
  withIborIndex a4 $ \a4' -> 
  let {a5' = (fromIntegral . fromEnum) a5} in 
  withMaybeDay a6 $ \a6' -> 
  let {a7' = C2HSImp.fromBool a7} in 
  preErrorCheck $ \a8' -> 
  fraImmOffsetsRateHelperRaw'_ a1' a2' a3' a4' a5' a6' a7' a8' >>= \res ->
  peekRateHelper res >>= \res' ->
  errorCheck  a8'>>
  return (res')

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


fraBetweenDatesRateHelperRaw :: (GenQuote q) -> (Day) -- ^startDate
 -> (Day) -- ^endDate
 -> (GenIborIndex ibor) -> (PillarChoice) -- ^pillar
 -> (Maybe Day) -- ^customPillarDate
 -> (Bool) -- ^useIndexedCoupon
 -> IO ((RateHelper))
fraBetweenDatesRateHelperRaw a1 a2 a3 a4 a5 a6 a7 =
  withQuote a1 $ \a1' -> 
  withDay a2 $ \a2' -> 
  withDay a3 $ \a3' -> 
  withIborIndex a4 $ \a4' -> 
  let {a5' = (fromIntegral . fromEnum) a5} in 
  withMaybeDay a6 $ \a6' -> 
  let {a7' = C2HSImp.fromBool a7} in 
  preErrorCheck $ \a8' -> 
  fraBetweenDatesRateHelperRaw'_ a1' a2' a3' a4' a5' a6' a7' a8' >>= \res ->
  peekRateHelper res >>= \res' ->
  errorCheck  a8'>>
  return (res')

{-# LINE 861 "./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 ()) -> IO FuturesRateHelper) -> IO FuturesRateHelper
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr ()) -> IO FuturesRateHelper) -> IO FuturesRateHelper)
-> (Ptr (Ptr ()) -> IO FuturesRateHelper) -> IO FuturesRateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr ())
a7' -> 
  Ptr CQuote'
-> CInt
-> CInt
-> Ptr CDayCounter
-> Ptr CQuote'
-> CInt
-> Ptr (Ptr ())
-> IO (Ptr CFuturesRateHelper')
futuresRateHelperBetweenDatesRaw'_ Ptr CQuote'
a1' CInt
a2' CInt
a3' Ptr CDayCounter
a4' Ptr CQuote'
a5' CInt
a6' Ptr (Ptr ())
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 ()) -> IO ()
forall a. Ptr (Ptr a) -> IO ()
errorCheck  Ptr (Ptr ())
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 898 "./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 903 "./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 910 "./QuantLib/TermStructure/Yield.chs" #-}


-- |Futures rate helpers built with an optional futures-vs-forward convexity adjustment.
class HasConvexityAdjustment h where
  -- |The convexity adjustment this helper was built with (0 if none was given).
  convexityAdjustment :: h -> IO Double
instance HasConvexityAdjustment FuturesRateHelper where
  convexityAdjustment = qlFuturesRateHelperConvexityAdjustment
instance HasConvexityAdjustment OvernightIndexFutureRateHelper where
  convexityAdjustment = qlOvernightIndexFutureRateHelperConvexityAdjustment

qlFuturesRateHelperConvexityAdjustment :: (FuturesRateHelper) -> IO ((Double))
qlFuturesRateHelperConvexityAdjustment a1 =
  withGenRateHelper a1 $ \a1' -> 
  preErrorCheck $ \a2' -> 
  qlFuturesRateHelperConvexityAdjustment'_ a1' a2' >>= \res ->
  let {res' = realToFrac res} in
  errorCheck  a2'>>
  return (res')

{-# LINE 921 "./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 :: forall q1 q2.
GenQuote q1
-> Day
-> Day
-> OvernightIborIndex
-> Maybe (GenQuote q2)
-> RateAveragingType
-> PillarChoice
-> Maybe Day
-> IO OvernightIndexFutureRateHelper
overnightIndexFutureRateHelper GenQuote q1
a1 Day
a2 Day
a3 OvernightIborIndex
a4 Maybe (GenQuote q2)
a5 RateAveragingType
a6 PillarChoice
a7 Maybe Day
a8 =
  GenQuote q1
-> (Ptr CQuote' -> IO OvernightIndexFutureRateHelper)
-> IO OvernightIndexFutureRateHelper
forall q b. GenQuote q -> (Ptr CQuote' -> IO b) -> IO b
withQuote GenQuote q1
a1 ((Ptr CQuote' -> IO OvernightIndexFutureRateHelper)
 -> IO OvernightIndexFutureRateHelper)
-> (Ptr CQuote' -> IO OvernightIndexFutureRateHelper)
-> IO OvernightIndexFutureRateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr CQuote'
a1' -> 
  Day
-> (CInt -> IO OvernightIndexFutureRateHelper)
-> IO OvernightIndexFutureRateHelper
forall a. Day -> (CInt -> IO a) -> IO a
withDay Day
a2 ((CInt -> IO OvernightIndexFutureRateHelper)
 -> IO OvernightIndexFutureRateHelper)
-> (CInt -> IO OvernightIndexFutureRateHelper)
-> IO OvernightIndexFutureRateHelper
forall a b. (a -> b) -> a -> b
$ \CInt
a2' -> 
  Day
-> (CInt -> IO OvernightIndexFutureRateHelper)
-> IO OvernightIndexFutureRateHelper
forall a. Day -> (CInt -> IO a) -> IO a
withDay Day
a3 ((CInt -> IO OvernightIndexFutureRateHelper)
 -> IO OvernightIndexFutureRateHelper)
-> (CInt -> IO OvernightIndexFutureRateHelper)
-> IO OvernightIndexFutureRateHelper
forall a b. (a -> b) -> a -> b
$ \CInt
a3' -> 
  OvernightIborIndex
-> (Ptr COvernightIndex' -> IO OvernightIndexFutureRateHelper)
-> IO OvernightIndexFutureRateHelper
forall b.
OvernightIborIndex -> (Ptr COvernightIndex' -> IO b) -> IO b
withOvernightIborIndex OvernightIborIndex
a4 ((Ptr COvernightIndex' -> IO OvernightIndexFutureRateHelper)
 -> IO OvernightIndexFutureRateHelper)
-> (Ptr COvernightIndex' -> IO OvernightIndexFutureRateHelper)
-> IO OvernightIndexFutureRateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr COvernightIndex'
a4' -> 
  Maybe (GenQuote q2)
-> (Ptr CQuote' -> IO OvernightIndexFutureRateHelper)
-> IO OvernightIndexFutureRateHelper
forall q b. Maybe (GenQuote q) -> (Ptr CQuote' -> IO b) -> IO b
withMaybeQuote Maybe (GenQuote q2)
a5 ((Ptr CQuote' -> IO OvernightIndexFutureRateHelper)
 -> IO OvernightIndexFutureRateHelper)
-> (Ptr CQuote' -> IO OvernightIndexFutureRateHelper)
-> IO OvernightIndexFutureRateHelper
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)
-> (RateAveragingType -> Int) -> RateAveragingType -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. RateAveragingType -> Int
forall a. Enum a => a -> Int
fromEnum) RateAveragingType
a6} in 
  let {a7' :: CInt
a7' = (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
a7} in 
  Maybe Day
-> (CInt -> IO OvernightIndexFutureRateHelper)
-> IO OvernightIndexFutureRateHelper
forall a. Maybe Day -> (CInt -> IO a) -> IO a
withMaybeDay Maybe Day
a8 ((CInt -> IO OvernightIndexFutureRateHelper)
 -> IO OvernightIndexFutureRateHelper)
-> (CInt -> IO OvernightIndexFutureRateHelper)
-> IO OvernightIndexFutureRateHelper
forall a b. (a -> b) -> a -> b
$ \CInt
a8' -> 
  (Ptr (Ptr ()) -> IO OvernightIndexFutureRateHelper)
-> IO OvernightIndexFutureRateHelper
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr ()) -> IO OvernightIndexFutureRateHelper)
 -> IO OvernightIndexFutureRateHelper)
-> (Ptr (Ptr ()) -> IO OvernightIndexFutureRateHelper)
-> IO OvernightIndexFutureRateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr ())
a9' -> 
  Ptr CQuote'
-> CInt
-> CInt
-> Ptr COvernightIndex'
-> Ptr CQuote'
-> CInt
-> CInt
-> CInt
-> Ptr (Ptr ())
-> IO (Ptr COvernightIndexFutureRateHelper')
overnightIndexFutureRateHelper'_ Ptr CQuote'
a1' CInt
a2' CInt
a3' Ptr COvernightIndex'
a4' Ptr CQuote'
a5' CInt
a6' CInt
a7' CInt
a8' Ptr (Ptr ())
a9' IO (Ptr COvernightIndexFutureRateHelper')
-> (Ptr COvernightIndexFutureRateHelper'
    -> IO OvernightIndexFutureRateHelper)
-> IO OvernightIndexFutureRateHelper
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Ptr COvernightIndexFutureRateHelper'
res ->
  Ptr COvernightIndexFutureRateHelper'
-> IO OvernightIndexFutureRateHelper
peekOvernightIndexFutureRateHelper Ptr COvernightIndexFutureRateHelper'
res IO OvernightIndexFutureRateHelper
-> (OvernightIndexFutureRateHelper
    -> IO OvernightIndexFutureRateHelper)
-> IO OvernightIndexFutureRateHelper
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \OvernightIndexFutureRateHelper
res' ->
  Ptr (Ptr ()) -> IO ()
forall a. Ptr (Ptr a) -> IO ()
errorCheck  Ptr (Ptr ())
a9'IO ()
-> IO OvernightIndexFutureRateHelper
-> IO OvernightIndexFutureRateHelper
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
  OvernightIndexFutureRateHelper -> IO OvernightIndexFutureRateHelper
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (OvernightIndexFutureRateHelper
res')

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


qlOvernightIndexFutureRateHelperConvexityAdjustment :: (OvernightIndexFutureRateHelper) -> IO ((Double))
qlOvernightIndexFutureRateHelperConvexityAdjustment a1 =
  withGenRateHelper a1 $ \a1' -> 
  preErrorCheck $ \a2' -> 
  qlOvernightIndexFutureRateHelperConvexityAdjustment'_ a1' a2' >>= \res ->
  let {res' = realToFrac res} in
  errorCheck  a2'>>
  return (res')

{-# LINE 933 "./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, cross-currency or bond helper answers from its
-- underlying; an IBOR futures or FX swap helper, and a deposit or FRA relative to the evaluation
-- date, reads no stored fixing: @Just []@. A 'DepositOnFixingDate' deposit, or a 'FraBetweenDates'
-- FRA with an indexed coupon, reads its fixing once the fixing date is before the evaluation date,
-- and reports it from then on; on the fixing date itself it still forecasts.
-- An overnight-index or SOFR futures helper reports each business-day fixing from its period start
-- up to the evaluation date, that date's included because the future reads it when stored. On
-- QuantLib 1.43, which keeps the future private, it instead reports 'Nothing' from two weeks before
-- its period starts. Any helper type the walk has no case for reports 'Nothing' too: "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 CString)) -> IO ([String], [Day], CInt))
-> IO ([String], [Day], CInt)
forall b. ((Ptr CUInt, Ptr (Ptr CString)) -> IO b) -> IO b
preCStringArray (((Ptr CUInt, Ptr (Ptr CString)) -> IO ([String], [Day], CInt))
 -> IO ([String], [Day], CInt))
-> ((Ptr CUInt, Ptr (Ptr CString)) -> IO ([String], [Day], CInt))
-> IO ([String], [Day], CInt)
forall a b. (a -> b) -> a -> b
$ \(Ptr CUInt
a2'1, Ptr (Ptr CString)
a2'2) -> 
  ((Ptr CUInt, Ptr (Ptr CInt)) -> IO ([String], [Day], CInt))
-> IO ([String], [Day], CInt)
forall b. ((Ptr CUInt, Ptr (Ptr CInt)) -> IO b) -> IO b
preIntArray (((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 ()) -> IO ([String], [Day], CInt))
-> IO ([String], [Day], CInt)
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr ()) -> IO ([String], [Day], CInt))
 -> IO ([String], [Day], CInt))
-> (Ptr (Ptr ()) -> IO ([String], [Day], CInt))
-> IO ([String], [Day], CInt)
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr ())
a5' -> 
  Ptr CRateHelper'
-> Ptr CUInt
-> Ptr (Ptr CString)
-> Ptr CUInt
-> Ptr (Ptr CInt)
-> Ptr CInt
-> Ptr (Ptr ())
-> IO ()
qlRateHelperFixingDependencies'_ Ptr CRateHelper'
a1' Ptr CUInt
a2'1  Ptr (Ptr CString)
a2'2 Ptr CUInt
a3'1  Ptr (Ptr CInt)
a3'2 Ptr CInt
a4' Ptr (Ptr ())
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 CString) -> IO [String]
peekCStringArray  Ptr CUInt
a2'1  Ptr (Ptr CString)
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 ()) -> IO ()
forall a. Ptr (Ptr a) -> IO ()
errorCheck  Ptr (Ptr ())
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 963 "./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' = (fromIntegral . fromEnum) a6} in 
  withMaybeDay a7 $ \a7' -> 
  preErrorCheck $ \a8' -> 
  sofrFutureRateHelper'_ a1' a2' a3' a4' a5' a6' a7' a8' >>= \res ->
  peekRateHelper res >>= \res' ->
  errorCheck  a8'>>
  return (res')

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


-- |The date of this helper's bootstrap pillar, computed from its instrument's conventions.
-- This can differ from contractual maturity. Relative-date helpers update it when the
-- evaluation date changes; no curve needs to be attached to inspect the date.
rateHelperPillarDate :: (GenRateHelper rh) -- ^helper
 -> IO ((Day))
rateHelperPillarDate a1 =
  withRateHelper a1 $ \a1' -> 
  preErrorCheck $ \a2' -> 
  rateHelperPillarDate'_ a1' a2' >>= \res ->
  let {res' = toDay res} in
  errorCheck  a2'>>
  return (res')

{-# LINE 980 "./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 985 "./QuantLib/TermStructure/Yield.chs" #-}


-- |The quote that would make the helper reprice exactly on the given curve: a par rate read with
-- the helper's own schedule and conventions on any curve, bootstrapped from it or not. The helper
-- keeps a non-owning reference to the curve until it is next used, so a bootstrap may still take
-- it afterwards.
impliedQuoteOn :: (GenRateHelper rh) -> (GenYieldTermStructure y) -> IO ((Double))
impliedQuoteOn a1 a2 =
  withRateHelper a1 $ \a1' -> 
  withYieldTermStructure a2 $ \a2' -> 
  preErrorCheck $ \a3' -> 
  impliedQuoteOn'_ a1' a2' a3' >>= \res ->
  let {res' = realToFrac res} in
  errorCheck  a3'>>
  return (res')

{-# LINE 991 "./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 995 "./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 ()) -> IO YieldTermStructure) -> IO YieldTermStructure
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr ()) -> IO YieldTermStructure) -> IO YieldTermStructure)
-> (Ptr (Ptr ()) -> IO YieldTermStructure) -> IO YieldTermStructure
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr ())
a9' -> 
  Ptr CYieldTermStructure'
-> CUInt
-> Ptr (Ptr CQuote')
-> CUInt
-> Ptr CInt
-> CInt
-> CInt
-> CInt
-> CInt
-> CInt
-> Ptr (Ptr ())
-> 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 ())
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 ()) -> IO ()
forall a. Ptr (Ptr a) -> IO ()
errorCheck  Ptr (Ptr ())
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 1006 "./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 1017 "./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 ()) -> IO YieldTermStructure) -> IO YieldTermStructure
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr ()) -> IO YieldTermStructure) -> IO YieldTermStructure)
-> (Ptr (Ptr ()) -> IO YieldTermStructure) -> IO YieldTermStructure
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr ())
a9' -> 
  Ptr CYieldTermStructure'
-> Ptr CYieldTermStructure'
-> Ptr CYieldTermStructure'
-> Ptr CBlackVolTermStructure'
-> CDouble
-> Ptr CBlackVolTermStructure'
-> CDouble
-> CDouble
-> Ptr (Ptr ())
-> 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 ())
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 ()) -> IO ()
forall a. Ptr (Ptr a) -> IO ()
errorCheck  Ptr (Ptr ())
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 1029 "./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 1041 "./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 ((PiecewiseYieldCurve))
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 ->
  peekPiecewiseYieldCurve res >>= \res' ->
  errorCheck  a19'>>
  return (res')

{-# LINE 1052 "./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 ((PiecewiseYieldCurve))
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 ->
  peekPiecewiseYieldCurve res >>= \res' ->
  errorCheck  a21'>>
  return (res')

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


-- Raw moving-curve bindings used by 'piecewiseYieldCurve'.
qlPiecewiseYieldCurveGlobalBootstrap1 :: (Word) -> (Calendar) -> ([GenRateHelper rh]) -> (DayCounter) -> ([GenQuote q]) -> ([Day]) -> (Double) -> ([Double]) -> (Bool) -> (Maybe BootstrapInitialGuess) -> IO ((PiecewiseYieldCurve))
qlPiecewiseYieldCurveGlobalBootstrap1 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) -> 
  let {a7' = realToFrac a7} in 
  withDoubleArray a8 $ \(a8'1, a8'2) -> 
  let {a9' = C2HSImp.fromBool a9} in 
  withMaybeBootstrapInitialGuess a10 $ \a10' -> 
  preErrorCheck $ \a11' -> 
  qlPiecewiseYieldCurveGlobalBootstrap1'_ a1' a2' a3'1  a3'2 a4' a5'1  a5'2 a6'1  a6'2 a7' a8'1  a8'2 a9' a10' a11' >>= \res ->
  peekPiecewiseYieldCurve res >>= \res' ->
  errorCheck  a11'>>
  return (res')

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


qlPiecewiseYieldCurveGlobalBootstrap2 :: (Word) -> (Calendar) -> ([GenRateHelper rh]) -> (DayCounter) -> ([GenQuote q]) -> ([Day]) -> (Double) -> ([Double]) -> (Bool) -> (Maybe BootstrapInitialGuess) -> IO ((PiecewiseYieldCurve))
qlPiecewiseYieldCurveGlobalBootstrap2 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) -> 
  let {a7' = realToFrac a7} in 
  withDoubleArray a8 $ \(a8'1, a8'2) -> 
  let {a9' = C2HSImp.fromBool a9} in 
  withMaybeBootstrapInitialGuess a10 $ \a10' -> 
  preErrorCheck $ \a11' -> 
  qlPiecewiseYieldCurveGlobalBootstrap2'_ a1' a2' a3'1  a3'2 a4' a5'1  a5'2 a6'1  a6'2 a7' a8'1  a8'2 a9' a10' a11' >>= \res ->
  peekPiecewiseYieldCurve res >>= \res' ->
  errorCheck  a11'>>
  return (res')

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


qlPiecewiseYieldCurveGlobalBootstrap3 :: (Word) -> (Calendar) -> ([GenRateHelper rh1]) -> (DayCounter) -> ([GenQuote q]) -> ([Day]) -> ([GenRateHelper rh2]) -> ([Day]) -> (Double) -> (Bool) -> ([Double]) -> (Maybe BootstrapInitialGuess) -> IO ((PiecewiseYieldCurve))
qlPiecewiseYieldCurveGlobalBootstrap3 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 =
  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 
  withDoubleArray a11 $ \(a11'1, a11'2) -> 
  withMaybeBootstrapInitialGuess a12 $ \a12' -> 
  preErrorCheck $ \a13' -> 
  qlPiecewiseYieldCurveGlobalBootstrap3'_ a1' a2' a3'1  a3'2 a4' a5'1  a5'2 a6'1  a6'2 a7'1  a7'2 a8'1  a8'2 a9' a10' a11'1  a11'2 a12' a13' >>= \res ->
  peekPiecewiseYieldCurve res >>= \res' ->
  errorCheck  a13'>>
  return (res')

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


qlPiecewiseYieldCurveGlobalBootstrap4 :: (Word) -> (Calendar) -> ([GenRateHelper rh]) -> (DayCounter) -> ([GenQuote q]) -> ([Day]) -> (Double) -> ([Double]) -> (Bool) -> (Maybe BootstrapInitialGuess) -> IO ((PiecewiseYieldCurve))
qlPiecewiseYieldCurveGlobalBootstrap4 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) -> 
  let {a7' = realToFrac a7} in 
  withDoubleArray a8 $ \(a8'1, a8'2) -> 
  let {a9' = C2HSImp.fromBool a9} in 
  withMaybeBootstrapInitialGuess a10 $ \a10' -> 
  preErrorCheck $ \a11' -> 
  qlPiecewiseYieldCurveGlobalBootstrap4'_ a1' a2' a3'1  a3'2 a4' a5'1  a5'2 a6'1  a6'2 a7' a8'1  a8'2 a9' a10' a11' >>= \res ->
  peekPiecewiseYieldCurve res >>= \res' ->
  errorCheck  a11'>>
  return (res')

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


qlPiecewiseYieldCurveGlobalBootstrap5 :: (Word) -> (Calendar) -> ([GenRateHelper rh]) -> (DayCounter) -> ([GenQuote q]) -> ([Day]) -> (Double) -> ([Double]) -> (Bool) -> (Maybe BootstrapInitialGuess) -> IO ((PiecewiseYieldCurve))
qlPiecewiseYieldCurveGlobalBootstrap5 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) -> 
  let {a7' = realToFrac a7} in 
  withDoubleArray a8 $ \(a8'1, a8'2) -> 
  let {a9' = C2HSImp.fromBool a9} in 
  withMaybeBootstrapInitialGuess a10 $ \a10' -> 
  preErrorCheck $ \a11' -> 
  qlPiecewiseYieldCurveGlobalBootstrap5'_ a1' a2' a3'1  a3'2 a4' a5'1  a5'2 a6'1  a6'2 a7' a8'1  a8'2 a9' a10' a11' >>= \res ->
  peekPiecewiseYieldCurve res >>= \res' ->
  errorCheck  a11'>>
  return (res')

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


qlPiecewiseYieldCurveLocalBootstrap1 :: (Word) -> (Calendar) -> ([GenRateHelper rh]) -> (DayCounter) -> ([GenQuote q]) -> ([Day]) -> (BootstrapTrait) -> (Word) -> (Bool) -> (Double) -> (Double) -> (Double) -> (Bool) -> (Bool) -> IO ((PiecewiseYieldCurve))
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 ->
  peekPiecewiseYieldCurve res >>= \res' ->
  errorCheck  a15'>>
  return (res')

{-# LINE 1072 "./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) -> (Maybe BootstrapInitialGuess) -> IO ((PiecewiseYieldCurve))
qlPiecewiseYieldCurveGlobalBootstrapFixed1 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) -> 
  let {a6' = realToFrac a6} in 
  withDoubleArray a7 $ \(a7'1, a7'2) -> 
  let {a8' = C2HSImp.fromBool a8} in 
  withMaybeBootstrapInitialGuess a9 $ \a9' -> 
  preErrorCheck $ \a10' -> 
  qlPiecewiseYieldCurveGlobalBootstrapFixed1'_ a1' a2'1  a2'2 a3' a4'1  a4'2 a5'1  a5'2 a6' a7'1  a7'2 a8' a9' a10' >>= \res ->
  peekPiecewiseYieldCurve res >>= \res' ->
  errorCheck  a10'>>
  return (res')

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

qlPiecewiseYieldCurveGlobalBootstrapFixed2 :: (Day) -> ([GenRateHelper rh]) -> (DayCounter) -> ([GenQuote q]) -> ([Day]) -> (Double) -> ([Double]) -> (Bool) -> (Maybe BootstrapInitialGuess) -> IO ((PiecewiseYieldCurve))
qlPiecewiseYieldCurveGlobalBootstrapFixed2 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) -> 
  let {a6' = realToFrac a6} in 
  withDoubleArray a7 $ \(a7'1, a7'2) -> 
  let {a8' = C2HSImp.fromBool a8} in 
  withMaybeBootstrapInitialGuess a9 $ \a9' -> 
  preErrorCheck $ \a10' -> 
  qlPiecewiseYieldCurveGlobalBootstrapFixed2'_ a1' a2'1  a2'2 a3' a4'1  a4'2 a5'1  a5'2 a6' a7'1  a7'2 a8' a9' a10' >>= \res ->
  peekPiecewiseYieldCurve res >>= \res' ->
  errorCheck  a10'>>
  return (res')

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

qlPiecewiseYieldCurveGlobalBootstrapFixed3 :: (Day) -> ([GenRateHelper rh1]) -> (DayCounter) -> ([GenQuote q]) -> ([Day]) -> ([GenRateHelper rh2]) -> ([Day]) -> (Double) -> (Bool) -> ([Double]) -> (Maybe BootstrapInitialGuess) -> IO ((PiecewiseYieldCurve))
qlPiecewiseYieldCurveGlobalBootstrapFixed3 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 =
  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 
  withDoubleArray a10 $ \(a10'1, a10'2) -> 
  withMaybeBootstrapInitialGuess a11 $ \a11' -> 
  preErrorCheck $ \a12' -> 
  qlPiecewiseYieldCurveGlobalBootstrapFixed3'_ a1' a2'1  a2'2 a3' a4'1  a4'2 a5'1  a5'2 a6'1  a6'2 a7'1  a7'2 a8' a9' a10'1  a10'2 a11' a12' >>= \res ->
  peekPiecewiseYieldCurve res >>= \res' ->
  errorCheck  a12'>>
  return (res')

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

qlPiecewiseYieldCurveGlobalBootstrapFixed4 :: (Day) -> ([GenRateHelper rh]) -> (DayCounter) -> ([GenQuote q]) -> ([Day]) -> (Double) -> ([Double]) -> (Bool) -> (Maybe BootstrapInitialGuess) -> IO ((PiecewiseYieldCurve))
qlPiecewiseYieldCurveGlobalBootstrapFixed4 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) -> 
  let {a6' = realToFrac a6} in 
  withDoubleArray a7 $ \(a7'1, a7'2) -> 
  let {a8' = C2HSImp.fromBool a8} in 
  withMaybeBootstrapInitialGuess a9 $ \a9' -> 
  preErrorCheck $ \a10' -> 
  qlPiecewiseYieldCurveGlobalBootstrapFixed4'_ a1' a2'1  a2'2 a3' a4'1  a4'2 a5'1  a5'2 a6' a7'1  a7'2 a8' a9' a10' >>= \res ->
  peekPiecewiseYieldCurve res >>= \res' ->
  errorCheck  a10'>>
  return (res')

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

qlPiecewiseYieldCurveGlobalBootstrapFixed5 :: (Day) -> ([GenRateHelper rh]) -> (DayCounter) -> ([GenQuote q]) -> ([Day]) -> (Double) -> ([Double]) -> (Bool) -> (Maybe BootstrapInitialGuess) -> IO ((PiecewiseYieldCurve))
qlPiecewiseYieldCurveGlobalBootstrapFixed5 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) -> 
  let {a6' = realToFrac a6} in 
  withDoubleArray a7 $ \(a7'1, a7'2) -> 
  let {a8' = C2HSImp.fromBool a8} in 
  withMaybeBootstrapInitialGuess a9 $ \a9' -> 
  preErrorCheck $ \a10' -> 
  qlPiecewiseYieldCurveGlobalBootstrapFixed5'_ a1' a2'1  a2'2 a3' a4'1  a4'2 a5'1  a5'2 a6' a7'1  a7'2 a8' a9' a10' >>= \res ->
  peekPiecewiseYieldCurve res >>= \res' ->
  errorCheck  a10'>>
  return (res')

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

qlPiecewiseYieldCurveLocalBootstrapFixed :: (Day) -> ([GenRateHelper rh]) -> (DayCounter) -> ([GenQuote q]) -> ([Day]) -> (BootstrapTrait) -> (Word) -> (Bool) -> (Double) -> (Double) -> (Double) -> (Bool) -> (Bool) -> IO ((PiecewiseYieldCurve))
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 ->
  peekPiecewiseYieldCurve res >>= \res' ->
  errorCheck  a14'>>
  return (res')

{-# LINE 1085 "./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] !(Maybe BootstrapInitialGuess) -- ^accuracy, instrumentWeights (empty for equal weights), initialGuess
  | GlobalSimpleZeroLinear !Double ![Double] !(Maybe BootstrapInitialGuess) -- ^accuracy, instrumentWeights (empty for equal weights), initialGuess
  | GlobalSimpleZeroLinearFull !(NonEmpty (GenRateHelper rh2)) ![Day] !Double ![Double] !(Maybe BootstrapInitialGuess) -- ^additionalHelpers, additionalDates, accuracy, instrumentWeights, initialGuess
  | GlobalForwardRateLinear !Double ![Double] !(Maybe BootstrapInitialGuess) -- ^accuracy, instrumentWeights (empty for equal weights), initialGuess
  | GlobalZeroYieldLinear !Double ![Double] !(Maybe BootstrapInitialGuess) -- ^accuracy, instrumentWeights (empty for equal weights), initialGuess
  | 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] !(Maybe BootstrapInitialGuess) -- ^accuracy, instrumentWeights (empty for equal weights), initialGuess

-- |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 PiecewiseYieldCurve
piecewiseYieldCurve :: forall rh q rh2.
Reference
-> NonEmpty (GenRateHelper rh)
-> DayCounter
-> [(Day, GenQuote q)]
-> Bootstrap rh2
-> Bool
-> IO PiecewiseYieldCurve
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 PiecewiseYieldCurve -> IO PiecewiseYieldCurve
forall {t}.
Bool -> IO (GenTermStructure t) -> IO (GenTermStructure t)
enable Bool
ex (IO PiecewiseYieldCurve -> IO PiecewiseYieldCurve)
-> IO PiecewiseYieldCurve -> IO PiecewiseYieldCurve
forall a b. (a -> b) -> a -> b
$ (Int
 -> Int
 -> Int
 -> Double
 -> Double
 -> Double
 -> Word
 -> Double
 -> Double
 -> Bool
 -> Word
 -> Word
 -> IO PiecewiseYieldCurve)
-> (Int, (Int, Int))
-> Double
-> Double
-> Double
-> Word
-> Double
-> Double
-> Bool
-> Word
-> Word
-> IO PiecewiseYieldCurve
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 PiecewiseYieldCurve
forall rh q.
Day
-> [GenRateHelper rh]
-> DayCounter
-> [GenQuote q]
-> [Day]
-> BootstrapTrait
-> Int
-> Int
-> Int
-> Double
-> Double
-> Double
-> Word
-> Double
-> Double
-> Bool
-> Word
-> Word
-> IO PiecewiseYieldCurve
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 PiecewiseYieldCurve)
-> (Int, (Int, Int))
-> Double
-> Double
-> Double
-> Word
-> Double
-> Double
-> Bool
-> Word
-> Word
-> Bool
-> IO PiecewiseYieldCurve
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 PiecewiseYieldCurve
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 PiecewiseYieldCurve
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 Maybe BootstrapInitialGuess
guess) -> Day
-> [GenRateHelper rh]
-> DayCounter
-> [GenQuote q]
-> [Day]
-> Double
-> [Double]
-> Bool
-> Maybe BootstrapInitialGuess
-> IO PiecewiseYieldCurve
forall rh q.
Day
-> [GenRateHelper rh]
-> DayCounter
-> [GenQuote q]
-> [Day]
-> Double
-> [Double]
-> Bool
-> Maybe BootstrapInitialGuess
-> IO PiecewiseYieldCurve
qlPiecewiseYieldCurveGlobalBootstrapFixed1 Day
d [GenRateHelper rh]
rs DayCounter
dc [GenQuote q]
qs [Day]
ds Double
acc [Double]
w Bool
ex Maybe BootstrapInitialGuess
guess
  (SettlementDays Word
s Calendar
cal, GlobalDiscountLogLinear Double
acc [Double]
w Maybe BootstrapInitialGuess
guess) -> Word
-> Calendar
-> [GenRateHelper rh]
-> DayCounter
-> [GenQuote q]
-> [Day]
-> Double
-> [Double]
-> Bool
-> Maybe BootstrapInitialGuess
-> IO PiecewiseYieldCurve
forall rh q.
Word
-> Calendar
-> [GenRateHelper rh]
-> DayCounter
-> [GenQuote q]
-> [Day]
-> Double
-> [Double]
-> Bool
-> Maybe BootstrapInitialGuess
-> IO PiecewiseYieldCurve
qlPiecewiseYieldCurveGlobalBootstrap1 Word
s Calendar
cal [GenRateHelper rh]
rs DayCounter
dc [GenQuote q]
qs [Day]
ds Double
acc [Double]
w Bool
ex Maybe BootstrapInitialGuess
guess
  (ReferenceDate Day
d, GlobalSimpleZeroLinear Double
acc [Double]
w Maybe BootstrapInitialGuess
guess) -> Day
-> [GenRateHelper rh]
-> DayCounter
-> [GenQuote q]
-> [Day]
-> Double
-> [Double]
-> Bool
-> Maybe BootstrapInitialGuess
-> IO PiecewiseYieldCurve
forall rh q.
Day
-> [GenRateHelper rh]
-> DayCounter
-> [GenQuote q]
-> [Day]
-> Double
-> [Double]
-> Bool
-> Maybe BootstrapInitialGuess
-> IO PiecewiseYieldCurve
qlPiecewiseYieldCurveGlobalBootstrapFixed2 Day
d [GenRateHelper rh]
rs DayCounter
dc [GenQuote q]
qs [Day]
ds Double
acc [Double]
w Bool
ex Maybe BootstrapInitialGuess
guess
  (SettlementDays Word
s Calendar
cal, GlobalSimpleZeroLinear Double
acc [Double]
w Maybe BootstrapInitialGuess
guess) -> Word
-> Calendar
-> [GenRateHelper rh]
-> DayCounter
-> [GenQuote q]
-> [Day]
-> Double
-> [Double]
-> Bool
-> Maybe BootstrapInitialGuess
-> IO PiecewiseYieldCurve
forall rh q.
Word
-> Calendar
-> [GenRateHelper rh]
-> DayCounter
-> [GenQuote q]
-> [Day]
-> Double
-> [Double]
-> Bool
-> Maybe BootstrapInitialGuess
-> IO PiecewiseYieldCurve
qlPiecewiseYieldCurveGlobalBootstrap2 Word
s Calendar
cal [GenRateHelper rh]
rs DayCounter
dc [GenQuote q]
qs [Day]
ds Double
acc [Double]
w Bool
ex Maybe BootstrapInitialGuess
guess
  (ReferenceDate Day
d, GlobalSimpleZeroLinearFull NonEmpty (GenRateHelper rh2)
ah [Day]
ad Double
acc [Double]
w Maybe BootstrapInitialGuess
guess) -> Day
-> [GenRateHelper rh]
-> DayCounter
-> [GenQuote q]
-> [Day]
-> [GenRateHelper rh2]
-> [Day]
-> Double
-> Bool
-> [Double]
-> Maybe BootstrapInitialGuess
-> IO PiecewiseYieldCurve
forall rh1 q rh2.
Day
-> [GenRateHelper rh1]
-> DayCounter
-> [GenQuote q]
-> [Day]
-> [GenRateHelper rh2]
-> [Day]
-> Double
-> Bool
-> [Double]
-> Maybe BootstrapInitialGuess
-> IO PiecewiseYieldCurve
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 [Double]
w Maybe BootstrapInitialGuess
guess
  (SettlementDays Word
s Calendar
cal, GlobalSimpleZeroLinearFull NonEmpty (GenRateHelper rh2)
ah [Day]
ad Double
acc [Double]
w Maybe BootstrapInitialGuess
guess) -> Word
-> Calendar
-> [GenRateHelper rh]
-> DayCounter
-> [GenQuote q]
-> [Day]
-> [GenRateHelper rh2]
-> [Day]
-> Double
-> Bool
-> [Double]
-> Maybe BootstrapInitialGuess
-> IO PiecewiseYieldCurve
forall rh1 q rh2.
Word
-> Calendar
-> [GenRateHelper rh1]
-> DayCounter
-> [GenQuote q]
-> [Day]
-> [GenRateHelper rh2]
-> [Day]
-> Double
-> Bool
-> [Double]
-> Maybe BootstrapInitialGuess
-> IO PiecewiseYieldCurve
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 [Double]
w Maybe BootstrapInitialGuess
guess
  (ReferenceDate Day
d, GlobalForwardRateLinear Double
acc [Double]
w Maybe BootstrapInitialGuess
guess) -> Day
-> [GenRateHelper rh]
-> DayCounter
-> [GenQuote q]
-> [Day]
-> Double
-> [Double]
-> Bool
-> Maybe BootstrapInitialGuess
-> IO PiecewiseYieldCurve
forall rh q.
Day
-> [GenRateHelper rh]
-> DayCounter
-> [GenQuote q]
-> [Day]
-> Double
-> [Double]
-> Bool
-> Maybe BootstrapInitialGuess
-> IO PiecewiseYieldCurve
qlPiecewiseYieldCurveGlobalBootstrapFixed4 Day
d [GenRateHelper rh]
rs DayCounter
dc [GenQuote q]
qs [Day]
ds Double
acc [Double]
w Bool
ex Maybe BootstrapInitialGuess
guess
  (SettlementDays Word
s Calendar
cal, GlobalForwardRateLinear Double
acc [Double]
w Maybe BootstrapInitialGuess
guess) -> Word
-> Calendar
-> [GenRateHelper rh]
-> DayCounter
-> [GenQuote q]
-> [Day]
-> Double
-> [Double]
-> Bool
-> Maybe BootstrapInitialGuess
-> IO PiecewiseYieldCurve
forall rh q.
Word
-> Calendar
-> [GenRateHelper rh]
-> DayCounter
-> [GenQuote q]
-> [Day]
-> Double
-> [Double]
-> Bool
-> Maybe BootstrapInitialGuess
-> IO PiecewiseYieldCurve
qlPiecewiseYieldCurveGlobalBootstrap4 Word
s Calendar
cal [GenRateHelper rh]
rs DayCounter
dc [GenQuote q]
qs [Day]
ds Double
acc [Double]
w Bool
ex Maybe BootstrapInitialGuess
guess
  (ReferenceDate Day
d, GlobalZeroYieldLinear Double
acc [Double]
w Maybe BootstrapInitialGuess
guess) -> Day
-> [GenRateHelper rh]
-> DayCounter
-> [GenQuote q]
-> [Day]
-> Double
-> [Double]
-> Bool
-> Maybe BootstrapInitialGuess
-> IO PiecewiseYieldCurve
forall rh q.
Day
-> [GenRateHelper rh]
-> DayCounter
-> [GenQuote q]
-> [Day]
-> Double
-> [Double]
-> Bool
-> Maybe BootstrapInitialGuess
-> IO PiecewiseYieldCurve
qlPiecewiseYieldCurveGlobalBootstrapFixed5 Day
d [GenRateHelper rh]
rs DayCounter
dc [GenQuote q]
qs [Day]
ds Double
acc [Double]
w Bool
ex Maybe BootstrapInitialGuess
guess
  (SettlementDays Word
s Calendar
cal, GlobalZeroYieldLinear Double
acc [Double]
w Maybe BootstrapInitialGuess
guess) -> Word
-> Calendar
-> [GenRateHelper rh]
-> DayCounter
-> [GenQuote q]
-> [Day]
-> Double
-> [Double]
-> Bool
-> Maybe BootstrapInitialGuess
-> IO PiecewiseYieldCurve
forall rh q.
Word
-> Calendar
-> [GenRateHelper rh]
-> DayCounter
-> [GenQuote q]
-> [Day]
-> Double
-> [Double]
-> Bool
-> Maybe BootstrapInitialGuess
-> IO PiecewiseYieldCurve
qlPiecewiseYieldCurveGlobalBootstrap5 Word
s Calendar
cal [GenRateHelper rh]
rs DayCounter
dc [GenQuote q]
qs [Day]
ds Double
acc [Double]
w Bool
ex Maybe BootstrapInitialGuess
guess
  (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 PiecewiseYieldCurve
forall rh q.
Day
-> [GenRateHelper rh]
-> DayCounter
-> [GenQuote q]
-> [Day]
-> BootstrapTrait
-> Word
-> Bool
-> Double
-> Double
-> Double
-> Bool
-> Bool
-> IO PiecewiseYieldCurve
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 PiecewiseYieldCurve
forall rh q.
Word
-> Calendar
-> [GenRateHelper rh]
-> DayCounter
-> [GenQuote q]
-> [Day]
-> BootstrapTrait
-> Word
-> Bool
-> Double
-> Double
-> Double
-> Bool
-> Bool
-> IO PiecewiseYieldCurve
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. 'bootstrappedNodes'
-- reads the calibrated spread geometry for both bootstrap choices. Upcast explicitly with
-- 'asYieldTermStructure' when a concrete parent type is required.
piecewiseSpreadYieldCurve :: GenYieldTermStructure y -- ^baseCurve
  -> NonEmpty (GenRateHelper rh) -- ^instruments
  -> SpreadBootstrap -- ^bootstrapper choice
  -> Bool -- ^extrapolate past the curve's max date
  -> IO PiecewiseYieldCurve
piecewiseSpreadYieldCurve :: forall y rh.
GenYieldTermStructure y
-> NonEmpty (GenRateHelper rh)
-> SpreadBootstrap
-> Bool
-> IO PiecewiseYieldCurve
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 PiecewiseYieldCurve)
-> (Int, (Int, Int))
-> Double
-> Double
-> Double
-> Word
-> Double
-> Double
-> Bool
-> Word
-> Word
-> Bool
-> IO PiecewiseYieldCurve
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 PiecewiseYieldCurve
forall y rh.
GenYieldTermStructure y
-> [GenRateHelper rh]
-> Int
-> Int
-> Int
-> Double
-> Double
-> Double
-> Word
-> Double
-> Double
-> Bool
-> Word
-> Word
-> Bool
-> IO PiecewiseYieldCurve
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 Maybe BootstrapInitialGuess
guess -> GenYieldTermStructure y
-> [GenRateHelper rh]
-> Double
-> [Double]
-> Bool
-> Maybe BootstrapInitialGuess
-> IO PiecewiseYieldCurve
forall y rh.
GenYieldTermStructure y
-> [GenRateHelper rh]
-> Double
-> [Double]
-> Bool
-> Maybe BootstrapInitialGuess
-> IO PiecewiseYieldCurve
qlPiecewiseSpreadYieldCurveGlobalBootstrap GenYieldTermStructure y
base [GenRateHelper rh]
rs Double
acc [Double]
w Bool
ex Maybe BootstrapInitialGuess
guess
  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 ((PiecewiseYieldCurve))
qlPiecewiseSpreadYieldCurve :: forall y rh.
GenYieldTermStructure y
-> [GenRateHelper rh]
-> Int
-> Int
-> Int
-> Double
-> Double
-> Double
-> Word
-> Double
-> Double
-> Bool
-> Word
-> Word
-> Bool
-> IO PiecewiseYieldCurve
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 PiecewiseYieldCurve)
-> IO PiecewiseYieldCurve
forall y b.
GenYieldTermStructure y
-> (Ptr CYieldTermStructure' -> IO b) -> IO b
withYieldTermStructure GenYieldTermStructure y
a1 ((Ptr CYieldTermStructure' -> IO PiecewiseYieldCurve)
 -> IO PiecewiseYieldCurve)
-> (Ptr CYieldTermStructure' -> IO PiecewiseYieldCurve)
-> IO PiecewiseYieldCurve
forall a b. (a -> b) -> a -> b
$ \Ptr CYieldTermStructure'
a1' -> 
  [GenRateHelper rh]
-> ((CUInt, Ptr (Ptr CRateHelper')) -> IO PiecewiseYieldCurve)
-> IO PiecewiseYieldCurve
forall rh b.
[GenRateHelper rh]
-> ((CUInt, Ptr (Ptr CRateHelper')) -> IO b) -> IO b
withRateHelperArray [GenRateHelper rh]
a2 (((CUInt, Ptr (Ptr CRateHelper')) -> IO PiecewiseYieldCurve)
 -> IO PiecewiseYieldCurve)
-> ((CUInt, Ptr (Ptr CRateHelper')) -> IO PiecewiseYieldCurve)
-> IO PiecewiseYieldCurve
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 Int
a3} in 
  let {a4' :: CInt
a4' = Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
a4} in 
  let {a5' :: CInt
a5' = Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
a5} in 
  let {a6' :: CDouble
a6' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a6} in 
  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 
  let {a9' :: CUInt
a9' = Word -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word
a9} in 
  let {a10' :: CDouble
a10' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a10} in 
  let {a11' :: CDouble
a11' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a11} in 
  let {a12' :: CInt
a12' = Bool -> CInt
forall a. Num a => Bool -> a
C2HSImp.fromBool Bool
a12} in 
  let {a13' :: CUInt
a13' = Word -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral a13} in 
  let {a14' :: CUInt
a14' = Word -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word
a14} in 
  let {a15' :: CInt
a15' = Bool -> CInt
forall a. Num a => Bool -> a
C2HSImp.fromBool Bool
a15} in 
  (Ptr (Ptr ()) -> IO PiecewiseYieldCurve) -> IO PiecewiseYieldCurve
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr ()) -> IO PiecewiseYieldCurve)
 -> IO PiecewiseYieldCurve)
-> (Ptr (Ptr ()) -> IO PiecewiseYieldCurve)
-> IO PiecewiseYieldCurve
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr ())
a16' -> 
  Ptr CYieldTermStructure'
-> CUInt
-> Ptr (Ptr CRateHelper')
-> CInt
-> CInt
-> CInt
-> CDouble
-> CDouble
-> CDouble
-> CUInt
-> CDouble
-> CDouble
-> CInt
-> CUInt
-> CUInt
-> CInt
-> Ptr (Ptr ())
-> IO (Ptr CPiecewiseYieldCurve')
qlPiecewiseSpreadYieldCurve'_ Ptr CYieldTermStructure'
a1' CUInt
a2'1  Ptr (Ptr CRateHelper')
a2'2 CInt
a3' CInt
a4' CInt
a5' CDouble
a6' CDouble
a7' CDouble
a8' CUInt
a9' CDouble
a10' CDouble
a11' CInt
a12' CUInt
a13' CUInt
a14' CInt
a15' Ptr (Ptr ())
a16' IO (Ptr CPiecewiseYieldCurve')
-> (Ptr CPiecewiseYieldCurve' -> IO PiecewiseYieldCurve)
-> IO PiecewiseYieldCurve
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Ptr CPiecewiseYieldCurve'
res ->
  Ptr CPiecewiseYieldCurve' -> IO PiecewiseYieldCurve
peekPiecewiseYieldCurve Ptr CPiecewiseYieldCurve'
res IO PiecewiseYieldCurve
-> (PiecewiseYieldCurve -> IO PiecewiseYieldCurve)
-> IO PiecewiseYieldCurve
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \PiecewiseYieldCurve
res' ->
  Ptr (Ptr ()) -> IO ()
forall a. Ptr (Ptr a) -> IO ()
errorCheck  Ptr (Ptr ())
a16'IO () -> IO PiecewiseYieldCurve -> IO PiecewiseYieldCurve
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
  PiecewiseYieldCurve -> IO PiecewiseYieldCurve
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (PiecewiseYieldCurve
res')

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


qlPiecewiseSpreadYieldCurveGlobalBootstrap :: (GenYieldTermStructure y) -> ([GenRateHelper rh]) -> (Double) -> ([Double]) -> (Bool) -> (Maybe BootstrapInitialGuess) -> IO ((PiecewiseYieldCurve))
qlPiecewiseSpreadYieldCurveGlobalBootstrap a1 a2 a3 a4 a5 a6 =
  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 
  withMaybeBootstrapInitialGuess a6 $ \a6' -> 
  preErrorCheck $ \a7' -> 
  qlPiecewiseSpreadYieldCurveGlobalBootstrap'_ a1' a2'1  a2'2 a3' a4'1  a4'2 a5' a6' a7' >>= \res ->
  peekPiecewiseYieldCurve res >>= \res' ->
  errorCheck  a7'>>
  return (res')

{-# LINE 1177 "./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 1190 "./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 1200 "./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 1212 "./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 1222 "./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 1232 "./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 
  [Double]
-> ((CUInt, Ptr CDouble) -> IO FittedBondDiscountCurve)
-> IO FittedBondDiscountCurve
forall b. [Double] -> ((CUInt, Ptr CDouble) -> IO b) -> IO b
withDoubleArray [Double]
a8 (((CUInt, Ptr CDouble) -> IO FittedBondDiscountCurve)
 -> IO FittedBondDiscountCurve)
-> ((CUInt, Ptr CDouble) -> IO FittedBondDiscountCurve)
-> IO FittedBondDiscountCurve
forall a b. (a -> b) -> a -> b
$ \(CUInt
a8'1, Ptr CDouble
a8'2) -> 
  let {a9' :: CDouble
a9' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a9} in 
  (Ptr (Ptr ()) -> IO FittedBondDiscountCurve)
-> IO FittedBondDiscountCurve
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr ()) -> IO FittedBondDiscountCurve)
 -> IO FittedBondDiscountCurve)
-> (Ptr (Ptr ()) -> IO FittedBondDiscountCurve)
-> IO FittedBondDiscountCurve
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr ())
a10' -> 
  CUInt
-> Ptr CCalendar
-> CUInt
-> Ptr (Ptr CBondHelper')
-> Ptr CDayCounter
-> Ptr CFittedBondDiscountCurveFittingMethod
-> CDouble
-> CUInt
-> CUInt
-> Ptr CDouble
-> CDouble
-> Ptr (Ptr ())
-> IO (Ptr CFittedBondDiscountCurve')
fittedBondDiscountCurveMovingRaw'_ CUInt
a1' Ptr CCalendar
a2' CUInt
a3'1  Ptr (Ptr CBondHelper')
a3'2 Ptr CDayCounter
a4' Ptr CFittedBondDiscountCurveFittingMethod
a5' CDouble
a6' CUInt
a7' CUInt
a8'1  Ptr CDouble
a8'2 CDouble
a9' Ptr (Ptr ())
a10' IO (Ptr CFittedBondDiscountCurve')
-> (Ptr CFittedBondDiscountCurve' -> IO FittedBondDiscountCurve)
-> IO FittedBondDiscountCurve
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \res ->
  peekFittedBondDiscountCurve res >>= \res' ->
  errorCheck  a10'>>
  return (res')

{-# LINE 1253 "./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 1261 "./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 1264 "./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 1267 "./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 1270 "./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 1275 "./QuantLib/TermStructure/Yield.chs" #-}


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

{-# LINE 1278 "./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 1281 "./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 1290 "./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 ()) -> IO ()) -> IO ()
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr ()) -> IO ()) -> IO ())
-> (Ptr (Ptr ()) -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr ())
a3' -> 
  Ptr CRelinkableYieldTermStructure'
-> Ptr CYieldTermStructure' -> Ptr (Ptr ()) -> IO ()
linkTo'_ Ptr CRelinkableYieldTermStructure'
a1' Ptr CYieldTermStructure'
a2' Ptr (Ptr ())
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 ()) -> IO ()
forall a. Ptr (Ptr a) -> IO ()
errorCheck  Ptr (Ptr ())
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 1300 "./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.
--
-- Only the 'MultiCurve' value and the returned external handles keep the group alive, so
-- instruments outside the cycle must use indexes built on the external handles. An original
-- member handle keeps only its own curve, and internal handles keep nothing: once the group is
-- released, anything reached through either raises an error instead of pricing.
--
-- __Leak hazard:__ members must reference each other through internal handles. A member curve,
-- rate helper, or index inside the cycle built on an /external/ handle makes the group own
-- itself, so it is never freed. Original member handles do not create such a cycle.
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 ()) -> IO MultiCurve) -> IO MultiCurve
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr ()) -> IO MultiCurve) -> IO MultiCurve)
-> (Ptr (Ptr ()) -> IO MultiCurve) -> IO MultiCurve
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr ())
a2' -> 
  CDouble -> Ptr (Ptr ()) -> IO (Ptr CMultiCurve)
multiCurve'_ CDouble
a1' Ptr (Ptr ())
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 ()) -> IO ()
forall a. Ptr (Ptr a) -> IO ()
errorCheck  Ptr (Ptr ())
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 1320 "./QuantLib/TermStructure/Yield.chs" #-}


-- |Add a curve built by 'piecewiseYieldCurve' to the cycle; QuantLib accepts only its global
-- bootstrappers here. See 'multiCurve' for the protocol.
addBootstrappedCurve :: (MultiCurve) -> (RelinkableYieldTermStructure) -- ^internalHandle
 -> (PiecewiseYieldCurve) -- ^curve
 -> IO ((YieldTermStructure))
addBootstrappedCurve a1 a2 a3 =
  withMultiCurve a1 $ \a1' -> 
  withRelinkableYieldTermStructure a2 $ \a2' -> 
  withPiecewiseYieldCurve a3 $ \a3' -> 
  preErrorCheck $ \a4' -> 
  addBootstrappedCurve'_ a1' a2' a3' a4' >>= \res ->
  peekYieldTermStructure res >>= \res' ->
  errorCheck  a4'>>
  return (res')

{-# LINE 1327 "./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 1334 "./QuantLib/TermStructure/Yield.chs" #-}


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

-- |An implied curve whose reference date moves with the evaluation date by settlement days.
-- Shares the original curve's observable handle. Requires QuantLib 1.44.
impliedTermStructureMoving :: (GenYieldTermStructure y) -- ^curve
 -> (Word) -- ^settlementDays
 -> (Calendar) -- ^calendar
 -> IO ((YieldTermStructure))
impliedTermStructureMoving a1 a2 a3 =
  withYieldTermStructure a1 $ \a1' -> 
  let {a2' = fromIntegral a2} in 
  withCalendar a3 $ \a3' -> 
  preErrorCheck $ \a4' -> 
  impliedTermStructureMoving'_ a1' a2' a3' a4' >>= \res ->
  peekYieldTermStructure res >>= \res' ->
  errorCheck  a4'>>
  return (res')

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


-- |Basis helper paying base overnight plus basis and receiving the other overnight rate.
-- Empty discount handle uses the bootstrapped curve; averaging is independent per leg.
-- NoFrequency creates one coupon per leg. Requires QuantLib 1.44.
overnightOvernightBasisSwapRateHelper :: (GenQuote q) -- ^basis
 -> ((Int,TimeUnit)) -- ^tenorLen
 -> (Word) -- ^settlementDays
 -> (Calendar) -- ^calendar
 -> (BusinessDayConvention) -- ^convention
 -> (Bool) -- ^endOfMonth
 -> (OvernightIborIndex) -- ^baseIndex
 -> (OvernightIborIndex) -- ^otherIndex
 -> (Maybe (GenYieldTermStructure y)) -- ^discount
 -> (Bool) -- ^bootstrapBaseCurve
 -> (Int) -- ^paymentLag
 -> (Frequency) -- ^paymentFrequency
 -> (RateAveragingType) -- ^baseAveragingMethod
 -> (RateAveragingType) -- ^otherAveragingMethod
 -> (Bool) -- ^telescopicValueDates
 -> (DateGenerationRule) -- ^rule
 -> IO ((RateHelper))
overnightOvernightBasisSwapRateHelper :: forall q y.
GenQuote q
-> (Int, TimeUnit)
-> Word
-> Calendar
-> BusinessDayConvention
-> Bool
-> OvernightIborIndex
-> OvernightIborIndex
-> Maybe (GenYieldTermStructure y)
-> Bool
-> Int
-> Frequency
-> RateAveragingType
-> RateAveragingType
-> Bool
-> DateGenerationRule
-> IO RateHelper
overnightOvernightBasisSwapRateHelper GenQuote q
a1 (Int, TimeUnit)
a2 Word
a3 Calendar
a4 BusinessDayConvention
a5 Bool
a6 OvernightIborIndex
a7 OvernightIborIndex
a8 Maybe (GenYieldTermStructure y)
a9 Bool
a10 Int
a11 Frequency
a12 RateAveragingType
a13 RateAveragingType
a14 Bool
a15 DateGenerationRule
a16 =
  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 
  OvernightIborIndex
-> (Ptr COvernightIndex' -> IO RateHelper) -> IO RateHelper
forall b.
OvernightIborIndex -> (Ptr COvernightIndex' -> IO b) -> IO b
withOvernightIborIndex OvernightIborIndex
a7 ((Ptr COvernightIndex' -> IO RateHelper) -> IO RateHelper)
-> (Ptr COvernightIndex' -> IO RateHelper) -> IO RateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr COvernightIndex'
a7' -> 
  OvernightIborIndex
-> (Ptr COvernightIndex' -> IO RateHelper) -> IO RateHelper
forall b.
OvernightIborIndex -> (Ptr COvernightIndex' -> IO b) -> IO b
withOvernightIborIndex OvernightIborIndex
a8 ((Ptr COvernightIndex' -> IO RateHelper) -> IO RateHelper)
-> (Ptr COvernightIndex' -> IO RateHelper) -> IO RateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr COvernightIndex'
a8' -> 
  Maybe (GenYieldTermStructure y)
-> (Ptr CYieldTermStructure' -> IO RateHelper) -> IO RateHelper
forall y b.
Maybe (GenYieldTermStructure y)
-> (Ptr CYieldTermStructure' -> IO b) -> IO b
withMaybeYieldTermStructure Maybe (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' = Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
a11} in 
  let {a12' :: CInt
a12' = (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
a12} in 
  let {a13' :: CInt
a13' = RateAveragingType -> CInt
forall a b. (Enum a, Integral b) => a -> b
fromEnumC RateAveragingType
a13} in 
  let {a14' :: CInt
a14' = RateAveragingType -> CInt
forall a b. (Enum a, Integral b) => a -> b
fromEnumC RateAveragingType
a14} in 
  let {a15' :: CInt
a15' = Bool -> CInt
forall a. Num a => Bool -> a
C2HSImp.fromBool Bool
a15} in 
  let {a16' :: CInt
a16' = (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
a16} in 
  (Ptr (Ptr ()) -> IO RateHelper) -> IO RateHelper
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr ()) -> IO RateHelper) -> IO RateHelper)
-> (Ptr (Ptr ()) -> IO RateHelper) -> IO RateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr ())
a17' -> 
  Ptr CQuote'
-> CInt
-> CInt
-> CUInt
-> Ptr CCalendar
-> CInt
-> CInt
-> Ptr COvernightIndex'
-> Ptr COvernightIndex'
-> Ptr CYieldTermStructure'
-> CInt
-> CInt
-> CInt
-> CInt
-> CInt
-> CInt
-> CInt
-> Ptr (Ptr ())
-> IO (Ptr CRateHelper')
overnightOvernightBasisSwapRateHelper'_ Ptr CQuote'
a1' CInt
a2'1  CInt
a2'2 CUInt
a3' Ptr CCalendar
a4' CInt
a5' CInt
a6' Ptr COvernightIndex'
a7' Ptr COvernightIndex'
a8' Ptr CYieldTermStructure'
a9' CInt
a10' CInt
a11' CInt
a12' CInt
a13' CInt
a14' CInt
a15' CInt
a16' Ptr (Ptr ())
a17' 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 ()) -> IO ()
forall a. Ptr (Ptr a) -> IO ()
errorCheck  Ptr (Ptr ())
a17'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 1364 "./QuantLib/TermStructure/Yield.chs" #-}


-- |Dates for a funding-margin helper: settlement days and tenor, or fixed endpoints.
data FundingTerms = FundingTenor !Word !(Int, TimeUnit) | FundingBetweenDates !Day !Day

-- |Funding-margin helper with principal exchanges and compounded overnight coupons.
-- The index projects from an exogenous curve; the bootstrapped curve discounts every flow.
-- Payment lag also applies to principal exchanges. Requires QuantLib 1.44.
overnightIndexedFundingRateHelper :: FundingTerms -- ^contract dates
  -> GenQuote q -- ^margin
  -> Calendar -- ^calendar
  -> BusinessDayConvention -- ^convention
  -> Bool -- ^endOfMonth
  -> OvernightIborIndex -- ^index
  -> (Int, TimeUnit) -- ^paymentTenor
  -> DayCounter -- ^paymentDayCounter
  -> Int -- ^paymentLag
  -> Bool -- ^telescopicValueDates
  -> DateGenerationRule -- ^rule
  -> PillarChoice -- ^pillar
  -> Maybe Day -- ^customPillarDate
  -> IO RateHelper
overnightIndexedFundingRateHelper terms margin cal convention eom idx tenor dc lag telescopic rule pillar custom =
  case terms of
    FundingTenor days (n, unit) -> overnightIndexedFundingRateHelperRaw False (fromIntegral days) n unit margin cal convention eom idx tenor dc lag telescopic rule pillar custom
    FundingBetweenDates start end -> do
      s <- toSerial start
      e <- toSerial end
      overnightIndexedFundingRateHelperRaw True (fromIntegral s) (fromIntegral e) Days margin cal convention eom idx tenor dc lag telescopic rule pillar custom

overnightIndexedFundingRateHelperRaw :: (Bool) -- ^dated
 -> (Int) -- ^start
 -> (Int) -- ^end
 -> (TimeUnit) -- ^tenorUnit
 -> (GenQuote q) -- ^margin
 -> (Calendar) -- ^calendar
 -> (BusinessDayConvention) -- ^convention
 -> (Bool) -- ^endOfMonth
 -> (OvernightIborIndex) -- ^index
 -> ((Int,TimeUnit)) -- ^paymentTenorLen
 -> (DayCounter) -- ^paymentDayCounter
 -> (Int) -- ^paymentLag
 -> (Bool) -- ^telescopicValueDates
 -> (DateGenerationRule) -- ^rule
 -> (PillarChoice) -- ^pillar
 -> (Maybe Day) -- ^customPillarDate
 -> IO ((RateHelper))
overnightIndexedFundingRateHelperRaw :: forall q.
Bool
-> Int
-> Int
-> TimeUnit
-> GenQuote q
-> Calendar
-> BusinessDayConvention
-> Bool
-> OvernightIborIndex
-> (Int, TimeUnit)
-> DayCounter
-> Int
-> Bool
-> DateGenerationRule
-> PillarChoice
-> Maybe Day
-> IO RateHelper
overnightIndexedFundingRateHelperRaw Bool
a1 Int
a2 Int
a3 TimeUnit
a4 GenQuote q
a5 Calendar
a6 BusinessDayConvention
a7 Bool
a8 OvernightIborIndex
a9 (Int, TimeUnit)
a10 DayCounter
a11 Int
a12 Bool
a13 DateGenerationRule
a14 PillarChoice
a15 Maybe Day
a16 =
  let {a1' :: CInt
a1' = Bool -> CInt
forall a. Num a => Bool -> a
C2HSImp.fromBool Bool
a1} in 
  let {a2' :: CInt
a2' = Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
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' = TimeUnit -> CInt
forall a b. (Enum a, Integral b) => a -> b
fromEnumC TimeUnit
a4} in 
  GenQuote q -> (Ptr CQuote' -> IO RateHelper) -> IO RateHelper
forall q b. GenQuote q -> (Ptr CQuote' -> IO b) -> IO b
withQuote GenQuote q
a5 ((Ptr CQuote' -> IO RateHelper) -> IO RateHelper)
-> (Ptr CQuote' -> IO RateHelper) -> IO RateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr CQuote'
a5' -> 
  Calendar -> (Ptr CCalendar -> IO RateHelper) -> IO RateHelper
forall b. Calendar -> (Ptr CCalendar -> IO b) -> IO b
withCalendar Calendar
a6 ((Ptr CCalendar -> IO RateHelper) -> IO RateHelper)
-> (Ptr CCalendar -> IO RateHelper) -> IO RateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr CCalendar
a6' -> 
  let {a7' :: CInt
a7' = BusinessDayConvention -> CInt
forall a b. (Enum a, Integral b) => a -> b
fromEnumC BusinessDayConvention
a7} in 
  let {a8' :: CInt
a8' = Bool -> CInt
forall a. Num a => Bool -> a
C2HSImp.fromBool Bool
a8} in 
  OvernightIborIndex
-> (Ptr COvernightIndex' -> IO RateHelper) -> IO RateHelper
forall b.
OvernightIborIndex -> (Ptr COvernightIndex' -> IO b) -> IO b
withOvernightIborIndex OvernightIborIndex
a9 ((Ptr COvernightIndex' -> IO RateHelper) -> IO RateHelper)
-> (Ptr COvernightIndex' -> IO RateHelper) -> IO RateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr COvernightIndex'
a9' -> 
  let {(CInt
a10'1, CInt
a10'2) = (Int, TimeUnit) -> (CInt, CInt)
forall a b c.
(Enum a, Integral b, Integral c) =>
(b, a) -> (CInt, c)
fromEnumQuantity (Int, TimeUnit)
a10} in 
  DayCounter -> (Ptr CDayCounter -> IO RateHelper) -> IO RateHelper
forall b. DayCounter -> (Ptr CDayCounter -> IO b) -> IO b
withDayCounter DayCounter
a11 ((Ptr CDayCounter -> IO RateHelper) -> IO RateHelper)
-> (Ptr CDayCounter -> IO RateHelper) -> IO RateHelper
forall a b. (a -> b) -> a -> b
$ \Ptr CDayCounter
a11' -> 
  let {a12' :: CInt
a12' = Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
a12} in 
  let {a13' :: CInt
a13' = Bool -> CInt
forall a. Num a => Bool -> a
C2HSImp.fromBool Bool
a13} in 
  let {a14' = (fromIntegral . fromEnum) a14} in 
  let {a15' :: CInt
a15' = (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
a15} in 
  withMaybeDay a16 $ \a16' -> 
  preErrorCheck $ \a17' -> 
  overnightIndexedFundingRateHelperRaw'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' a10'1  a10'2 a11' a12' a13' a14' a15' a16' a17' >>= \res ->
  peekRateHelper res >>= \res' ->
  errorCheck  a17'>>
  return (res')

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


-- |Whole-curve initial guess: node times (including time zero), previous data (empty on
-- first bootstrap), and one trait-specific guess per non-reference pillar. Inputs are borrowed:
-- copy them before retaining them past the callback. Ignored, without execution, on QuantLib 1.43.
type BootstrapInitialGuess = RealVector -> RealVector -> IO RealVector

foreign import ccall unsafe "ql.h qlSupports144" supportsInitialGuess :: Bool

withMaybeBootstrapInitialGuess :: Maybe BootstrapInitialGuess -> (Ptr () -> IO r) -> IO r
withMaybeBootstrapInitialGuess Nothing use = use nullPtr
withMaybeBootstrapInitialGuess (Just f) use
  | not supportsInitialGuess = use nullPtr
  | otherwise = Callback.withCallback call (`Callback.withCallbackPtr` use)
  where
    call args = do
      times <- borrowRealVector (Callback.callbackInput args) (fromIntegral (Callback.callbackSize args))
      previous <- borrowRealVector (Callback.callbackInput2 args) (fromIntegral (Callback.callbackSize2 args))
      values <- f times previous
      let expected = Callback.callbackOutputSize args
      when (V.length values /= expected) $ throwIO $ CallbackResultLength expected (V.length values)
      V.unsafeWith values $ \p -> copyArray (castPtr (Callback.callbackOutput args)) p expected

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

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

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

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 ())) -> (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 ())) -> (IO C2HSImp.CDouble)))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlSwapRateHelper2"
  swapRateHelperBetweenDatesRaw'_ :: ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CDayCounter)) -> ((C2HSImp.Ptr (CIborIndex')) -> ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CFloatingRateCouponPricer')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CSwapRateHelper'))))))))))))))))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlSwapRateHelper1"
  swapRateHelperRaw'_ :: ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CDayCounter)) -> ((C2HSImp.Ptr (CIborIndex')) -> ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CUInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CFloatingRateCouponPricer')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CSwapRateHelper')))))))))))))))))))))))

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 ())) -> (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 ())) -> (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 ())) -> (IO (C2HSImp.Ptr (CInterestRate))))))))))

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

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlYieldTermStructureForwardRate2"
  forwardRateBetweenTimesRaw'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (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 ())) -> (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 ())) -> (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 ())) -> (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.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((QlStubIndexSelection) -> ((QlStubIndexSelection) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (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.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((QlStubIndexSelection) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (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.CInt -> (C2HSImp.CInt -> ((QlStubIndexSelection) -> ((QlStubIndexSelection) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (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.CUInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CInt -> ((QlStubIndexSelection) -> ((QlStubIndexSelection) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (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.CInt -> (C2HSImp.CInt -> ((QlStubIndexSelection) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CRateHelper'))))))))))))))))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlFxSwapRateHelper"
  fxSwapRateHelperRaw'_ :: ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CCalendar)) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CRateHelper')))))))))))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlFxSwapRateHelper2"
  fxSwapRateHelperBetweenDatesRaw'_ :: ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (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 ())) -> (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 (CDayCounter)) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (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 (CDayCounter)) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (COISRateHelper')))))))))))))))))))))))))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlSwapRateHelper"
  swapRateHelperFromIndexRaw'_ :: ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CSwapIndex')) -> ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CFloatingRateCouponPricer')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CSwapRateHelper')))))))))))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlForwardSpreadedTermStructure"
  forwardSpreadedTermStructure'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (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 ())) -> (IO (C2HSImp.Ptr (CYieldTermStructure'))))))))

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

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

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

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 ())) -> (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 ())) -> (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 ())) -> (IO (C2HSImp.Ptr (CFuturesRateHelper')))))))))))))

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

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

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

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

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

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlImpliedTermStructure"
  impliedTermStructure'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (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 ())) -> (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 ())) -> (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 ())) -> (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 ())) -> (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 ())) -> (IO (C2HSImp.Ptr (CPiecewiseYieldCurve')))))))))))))))))))))))))

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 ())) -> (IO (C2HSImp.Ptr (CPiecewiseYieldCurve')))))))))))))))))))))))))))

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.Ptr ())) -> (IO (C2HSImp.Ptr (CPiecewiseYieldCurve'))))))))))))))))))

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.Ptr ())) -> (IO (C2HSImp.Ptr (CPiecewiseYieldCurve'))))))))))))))))))

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.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((C2HSImp.Ptr ()) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPiecewiseYieldCurve'))))))))))))))))))))))

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.Ptr ())) -> (IO (C2HSImp.Ptr (CPiecewiseYieldCurve'))))))))))))))))))

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.Ptr ())) -> (IO (C2HSImp.Ptr (CPiecewiseYieldCurve'))))))))))))))))))

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 ())) -> (IO (C2HSImp.Ptr (CPiecewiseYieldCurve')))))))))))))))))))))

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.Ptr ())) -> (IO (C2HSImp.Ptr (CPiecewiseYieldCurve')))))))))))))))))

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.Ptr ())) -> (IO (C2HSImp.Ptr (CPiecewiseYieldCurve')))))))))))))))))

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.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((C2HSImp.Ptr ()) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CPiecewiseYieldCurve')))))))))))))))))))))

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.Ptr ())) -> (IO (C2HSImp.Ptr (CPiecewiseYieldCurve')))))))))))))))))

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.Ptr ())) -> (IO (C2HSImp.Ptr (CPiecewiseYieldCurve')))))))))))))))))

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 ())) -> (IO (C2HSImp.Ptr (CPiecewiseYieldCurve'))))))))))))))))))))

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 ())) -> (IO (C2HSImp.Ptr (CPiecewiseYieldCurve'))))))))))))))))))))

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.Ptr ())) -> (IO (C2HSImp.Ptr (CPiecewiseYieldCurve'))))))))))))

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 ())) -> (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 ())) -> (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 ())) -> (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 ())) -> (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 ())) -> (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 ())) -> (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 ())) -> (IO (C2HSImp.Ptr (CFittedBondDiscountCurve'))))))))))))))

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

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

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

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlFittedBondDiscountCurveFittingMethodErrorCode"
  fittingMethodErrorCodeRaw'_ :: ((C2HSImp.Ptr (CFittedBondDiscountCurve')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (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 ())) -> (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 ())) -> (IO C2HSImp.CDouble))))))

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

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

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlMultiCurveAddBootstrappedCurve"
  addBootstrappedCurve'_ :: ((C2HSImp.Ptr (CMultiCurve)) -> ((C2HSImp.Ptr (CRelinkableYieldTermStructure')) -> ((C2HSImp.Ptr (CPiecewiseYieldCurve')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (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 ())) -> (IO (C2HSImp.Ptr (CYieldTermStructure')))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlImpliedTermStructureMoving"
  impliedTermStructureMoving'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (CCalendar)) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CYieldTermStructure')))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlOvernightOvernightBasisSwapRateHelper"
  overnightOvernightBasisSwapRateHelper'_ :: ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (COvernightIndex')) -> ((C2HSImp.Ptr (COvernightIndex')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CRateHelper')))))))))))))))))))))

foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlOvernightIndexedFundingRateHelperRaw"
  overnightIndexedFundingRateHelperRaw'_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (COvernightIndex')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CRateHelper')))))))))))))))))))))