never executed always true always false
1 -- GENERATED by C->Haskell Compiler, version 0.28.8 Switcheroo, 25 November 2017 (Haskell)
2 -- Edit the ORIGNAL .chs file instead!
3
4
5 {-# LANGUAGE TemplateHaskell #-}
6 module QuantLib.TermStructure.Yield
7 (
8 YieldTermStructure
9 , GenYieldTermStructure
10 , BondHelper
11 , RateHelper
12 , SwapRateHelper
13 , OISRateHelper
14 , FittingMethod(..)
15 , FittedBondDiscountCurve
16 , fittedBondDiscountCurve
17 , fittedBondDiscountCurve'
18 , RelinkableYieldTermStructure
19 , relinkableYieldTermStructure
20 , linkTo
21 , GenRateHelper
22
23 , BootstrapTrait(..)
24 , PillarChoice(..)
25 , FuturesType(..)
26 , CPIInterpolationType(..)
27 , depositRateHelper'
28 , depositRateHelper
29 , fixedRateBondHelper
30 , cpiBondHelper
31 , discount'
32 , swapRateHelper'
33 , flatForward
34 , flatForward'
35 , zeroRate'
36 , forwardRateForPeriod
37 , forwardRate'
38 , forwardRate
39 , zeroRate
40 , discount
41 , fraRateHelper
42 , bondHelper
43 , oisRateHelper
44 , oisRateHelper'
45 , OISRateHelperOpts(..)
46 , defaultOISRateHelperOpts
47 , oisRateHelperFull
48 , oisRateHelperFull'
49 , swapRateHelper
50 , forwardSpreadedTermStructure
51 , zeroSpreadedTermStructure
52 , bmaSwapRateHelper
53 , multipleResetsSwapRateHelper
54 , fraIborRateHelper'
55 , fraRateHelper'
56 , fraIborRateHelper
57 , futuresRateHelper'
58 , futuresIborRateHelper
59 , futuresRateHelper
60 , overnightIndexFutureRateHelper
61 , sofrFutureRateHelper
62 , impliedQuote
63 , impliedTermStructure
64
65 , asYieldTermStructure
66 , asRateHelper
67
68 , piecewiseZeroSpreadedTermStructure
69 , quantoTermStructure
70 , ultimateForwardTermStructure
71 , minimumCostValue
72 , numberOfIterations
73
74 , piecewiseYieldCurve
75 , piecewiseYieldCurve'
76 , IterativeBootstrapOpts(..)
77 , defaultIterativeBootstrapOpts
78 , piecewiseYieldCurveFull
79 , piecewiseYieldCurveFull'
80 , piecewiseYieldCurveGlobalBootstrap'
81 , piecewiseYieldCurveGlobalBootstrapSimpleZeroLinear'
82 , piecewiseYieldCurveGlobalBootstrapSimpleZeroLinearFull'
83 , piecewiseYieldCurveGlobalBootstrapForwardRateLinear'
84 , piecewiseYieldCurveGlobalBootstrapZeroYieldLinear'
85 , piecewiseYieldCurveLocalBootstrap'
86 , Bootstrap(..)
87 , LocalBootstrapTrait(..)
88 , piecewiseYieldCurve2'
89 , interpolatedZeroCurve
90 , interpolatedForwardCurve
91 , interpolatedDiscountCurve
92 , interpolatedSpreadDiscountCurve
93
94 , MultiCurve
95 , multiCurve
96 , addBootstrappedCurve
97 , addNonBootstrappedCurve
98
99 , iborIborBasisSwapRateHelper
100 , overnightIborBasisSwapRateHelper
101 , constNotionalCrossCurrencyBasisSwapRateHelper
102 , mtMCrossCurrencyBasisSwapRateHelper
103 , constNotionalCrossCurrencySwapRateHelper
104 , fxSwapRateHelper
105 , fxSwapRateHelper'
106
107 , bondHelperBond
108 , swapRateHelperSwap
109 , oisRateHelperSwap
110 ) where
111 import qualified Foreign.C.Types as C2HSImp
112 import qualified Foreign.ForeignPtr as C2HSImp
113 import qualified Foreign.Marshal.Utils as C2HSImp
114 import qualified Foreign.Ptr as C2HSImp
115
116
117 import QuantLib.Internal hiding(maxDate)
118 import QuantLib.Internal.Common
119 import QuantLib.Internal.Syntax(deriveOptionsRecord)
120 import Language.Haskell.TH(mkName)
121 import Language.Haskell.TH.Lib(varT)
122 import QuantLib.Quote hiding(linkTo)
123 import Data.Maybe(fromMaybe)
124 import qualified QuantLib.Instrument.Bond as Bond (BondPriceType)
125 import QuantLib.InterestRate(Compounding)
126 import QuantLib.CashFlow(RateAveragingType(..))
127 import QuantLib.Time.Calendar(calendar, CalendarConstructor(..))
128 import QuantLib.Internal.Type
129 import QuantLib.Time.Schedule(Frequency(..), DateGenerationRule(..))
130 import QuantLib.Time.Date(Month(..))
131
132
133
134
135
136
137
138 -- breaking recursive dependencies with Index.InterestRate TermStructure.Volatilitiy modules
139 -- if you put all pointer declarations in a separate module
140 -- ch2s will not attach finalizers to foreign ptrs in other modules
141 -- I don't want to create extra modules just to workaround the issue with cyclic dependencies and this will not help with finalizers anyway
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191 data BootstrapTrait = Discount
192 | ZeroYield
193 | ForwardRate
194 | SimpleZeroYield
195 deriving (Enum,Show,Eq,Read)
196
197
198 data PillarChoice = MaturityDate
199 | LastRelevantDate
200 | CustomDate
201 deriving (Enum,Show,Eq,Read)
202
203
204 data FuturesType = IMM
205 | ASX
206 | Custom
207 deriving (Enum,Show,Eq,Read)
208
209
210
211 -- OISRateHelperOpts bundles every trailing param oisRateHelper/oisRateHelper' hardcode
212 -- (see the comment above them, further down), pre-populated with upstream's own
213 -- defaults via defaultOISRateHelperOpts, overridden through record-update syntax at
214 -- the call site -- see the add-quantlib-options-record skill for why this exists as a
215 -- second entry point instead of widening oisRateHelper/oisRateHelper'
216 -- themselves. The three Calendar fields are Maybe here (unlike the raw binding's plain
217 -- Calendar) since a real Calendar is only obtainable in IO (`calendar Null`) and can't
218 -- live in a pure default record value -- oisRateHelperFull/oisRateHelperFull'
219 -- substitute a fresh Null calendar for Nothing, same as the narrow constructors do
220 -- today. This splice must stay textually before every {#fun#}-generated binding in
221 -- this file: c2hs always appends its raw foreign-import stubs at the physical end of
222 -- the generated module regardless of where in the .chs a {#fun#} hook appears, and a
223 -- top-level TH splice anywhere in between would otherwise split the file into
224 -- declaration groups that can't see each other, breaking every earlier {#fun#}
225 -- wrapper's reference to its own (always-last) foreign-import stub.
226 $(deriveOptionsRecord "OISRateHelperOpts" ["m"]
227 [ ("oisTelescopicValueDates", [t|Bool|], [|False|])
228 , ("oisPaymentLag", [t|Int|], [|0|])
229 , ("oisPaymentConvention", [t|BusinessDayConvention|], [|Following|])
230 , ("oisPaymentFrequency", [t|Frequency|], [|Annual|])
231 , ("oisPaymentCalendar", [t|Maybe Calendar|], [|Nothing|])
232 , ("oisForwardStart", [t|(Int, TimeUnit)|], [|(0, Days)|]) -- ^ignored by oisRateHelperFull' (ctor2 has no forwardStart)
233 , ("oisOvernightSpread", [t|Maybe (GenQuote $(varT (mkName "m")))|], [|Nothing|])
234 , ("oisPillar", [t|PillarChoice|], [|LastRelevantDate|])
235 , ("oisCustomPillarDate", [t|Maybe Day|], [|Nothing|])
236 , ("oisAveragingMethod", [t|RateAveragingType|], [|AveragingCompound|])
237 , ("oisEndOfMonth", [t|Maybe Bool|], [|Nothing|])
238 , ("oisFixedPaymentFrequency", [t|Maybe Frequency|], [|Nothing|])
239 , ("oisFixedCalendar", [t|Maybe Calendar|], [|Nothing|])
240 , ("oisLookbackDays", [t|Maybe Word|], [|Nothing|])
241 , ("oisLockoutDays", [t|Word|], [|0|])
242 , ("oisApplyObservationShift", [t|Bool|], [|False|])
243 , ("oisPricer", [t|Maybe FloatingRateCouponPricer|], [|Nothing|])
244 , ("oisRule", [t|DateGenerationRule|], [|Backward|])
245 , ("oisOvernightCalendar", [t|Maybe Calendar|], [|Nothing|])
246 , ("oisConvention", [t|BusinessDayConvention|], [|ModifiedFollowing|])
247 ])
248
249 -- IterativeBootstrapOpts bundles every constructor parameter of QuantLib's
250 -- @IterativeBootstrap@ (@ql\/termstructures\/iterativebootstrap.hpp@), which is the
251 -- bootstrapper 'piecewiseYieldCurve'\/'piecewiseYieldCurve'' use and whose settings they
252 -- hardcode to upstream's defaults. Shape borrowed from QuantLib-SWIG's @_IterativeBootstrap@
253 -- struct. Same splice-placement constraint as OISRateHelperOpts above.
254 $(deriveOptionsRecord "IterativeBootstrapOpts" []
255 [ ("ibAccuracy", [t|Maybe Double|], [|Nothing|])
256 , ("ibMinValue", [t|Maybe Double|], [|Nothing|])
257 , ("ibMaxValue", [t|Maybe Double|], [|Nothing|])
258 , ("ibMaxAttempts", [t|Word|], [|1|])
259 , ("ibMaxFactor", [t|Double|], [|2.0|])
260 , ("ibMinFactor", [t|Double|], [|2.0|])
261 , ("ibDontThrow", [t|Bool|], [|False|])
262 , ("ibDontThrowSteps", [t|Word|], [|10|])
263 , ("ibMaxEvaluations", [t|Word|], [|100|])
264 ])
265
266 -- Upstream defaults accuracy/minValue/maxValue to Null<Real>() rather than to a number, so
267 -- those three are Maybe on the Haskell side; fromMaybeDouble supplies the sentinel, and the
268 -- {#fun#} specs below take a plain Double, hence the realToFrac.
269 nullableDouble :: Maybe Double -> Double
270 nullableDouble = realToFrac . fromMaybeDouble
271
272 -- |Rate helper for bootstrapping over deposit rates, taking its conventions from an ibor index.
273 depositRateHelper' :: (GenQuote q) -> (GenIborIndex ibor) -> IO ((RateHelper))
274 depositRateHelper' a1 a2 =
275 withQuote a1 $ \a1' ->
276 withIborIndex a2 $ \a2' ->
277 preErrorCheck $ \a3' ->
278 depositRateHelper''_ a1' a2' a3' >>= \res ->
279 peekRateHelper res >>= \res' ->
280 errorCheck a3'>>
281 return (res')
282
283
284
285 -- |Rate helper for bootstrapping over deposit rates.
286 depositRateHelper :: (GenQuote q) -- ^rate
287 -> ((Int,TimeUnit)) -- ^tenor
288 -> (Word) -- ^fixingDays
289 -> (Calendar) -- ^calendar
290 -> (BusinessDayConvention) -- ^convention
291 -> (Bool) -- ^endOfMonth
292 -> (DayCounter) -> IO ((RateHelper))
293 depositRateHelper a1 a2 a3 a4 a5 a6 a7 =
294 withQuote a1 $ \a1' ->
295 let {(a2'1, a2'2) = fromEnumQuantity a2} in
296 let {a3' = fromIntegral a3} in
297 withCalendar a4 $ \a4' ->
298 let {a5' = fromEnumC a5} in
299 let {a6' = C2HSImp.fromBool a6} in
300 withDayCounter a7 $ \a7' ->
301 preErrorCheck $ \a8' ->
302 depositRateHelper'_ a1' a2'1 a2'2 a3' a4' a5' a6' a7' a8' >>= \res ->
303 peekRateHelper res >>= \res' ->
304 errorCheck a8'>>
305 return (res')
306
307
308
309 -- |Fixed-coupon bond helper for curve bootstrap: builds the underlying bond internally from a
310 -- schedule and coupons (unlike 'bondHelper', which takes an existing 'Bond').
311 fixedRateBondHelper :: (GenQuote q) -> (Word) -- ^settlementDays
312 -> (Double) -- ^faceAmount
313 -> (Schedule) -> ([Double]) -- ^coupons
314 -> (DayCounter) -> (BusinessDayConvention) -- ^paymentConvention
315 -> (Double) -- ^redemption
316 -> (Maybe Day) -- ^issueDate
317 -> IO ((BondHelper))
318 fixedRateBondHelper a1 a2 a3 a4 a5 a6 a7 a8 a9 =
319 withQuote a1 $ \a1' ->
320 let {a2' = fromIntegral a2} in
321 let {a3' = realToFrac a3} in
322 withSchedule a4 $ \a4' ->
323 withDoubleArray a5 $ \(a5'1, a5'2) ->
324 withDayCounter a6 $ \a6' ->
325 let {a7' = fromEnumC a7} in
326 let {a8' = realToFrac a8} in
327 withMaybeDay a9 $ \a9' ->
328 preErrorCheck $ \a10' ->
329 fixedRateBondHelper'_ a1' a2' a3' a4' a5'1 a5'2 a6' a7' a8' a9' a10' >>= \res ->
330 peekBondHelper res >>= \res' ->
331 errorCheck a10'>>
332 return (res')
333
334
335
336 -- |Bootstrap helper for a 'QuantLib.Instrument.Bond.CPIBond' -- a 'CPIBondHelper', which is a
337 -- plain 'BondHelper' subclass with no extra methods, so it's returned as the generic
338 -- 'BondHelper' type (same shape as 'fixedRateBondHelper').
339 cpiBondHelper :: (GenQuote q) -> (Word) -- ^settlementDays
340 -> (Double) -- ^faceAmount
341 -> (Double) -- ^baseCPI
342 -> ((Word,TimeUnit)) -- ^observationLag
343 -> (ZeroInflationIndex) -> (CPIInterpolationType) -- ^observationInterpolation
344 -> (Schedule) -> ([Double]) -- ^coupons
345 -> (DayCounter) -- ^accrualDayCounter
346 -> (BusinessDayConvention) -- ^paymentConvention
347 -> (Maybe Day) -- ^issueDate
348 -> (Calendar) -- ^paymentCalendar
349 -> IO ((BondHelper))
350 cpiBondHelper a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 =
351 withQuote a1 $ \a1' ->
352 let {a2' = fromIntegral a2} in
353 let {a3' = realToFrac a3} in
354 let {a4' = realToFrac a4} in
355 let {(a5'1, a5'2) = fromEnumQuantity a5} in
356 withZeroInflationIndex a6 $ \a6' ->
357 let {a7' = fromEnumC a7} in
358 withSchedule a8 $ \a8' ->
359 withDoubleArray a9 $ \(a9'1, a9'2) ->
360 withDayCounter a10 $ \a10' ->
361 let {a11' = fromEnumC a11} in
362 withMaybeDay a12 $ \a12' ->
363 withCalendar a13 $ \a13' ->
364 preErrorCheck $ \a14' ->
365 cpiBondHelper'_ a1' a2' a3' a4' a5'1 a5'2 a6' a7' a8' a9'1 a9'2 a10' a11' a12' a13' a14' >>= \res ->
366 peekBondHelper res >>= \res' ->
367 errorCheck a14'>>
368 return (res')
369
370
371
372 -- |Returns a discount factor from the given YieldTermStructure object
373 discount' :: (GenYieldTermStructure y) -> (Day) -- ^d
374 -> (Bool) -- ^extrapolate
375 -> IO ((Double))
376 discount' a1 a2 a3 =
377 withYieldTermStructure a1 $ \a1' ->
378 withDay a2 $ \a2' ->
379 let {a3' = C2HSImp.fromBool a3} in
380 preErrorCheck $ \a4' ->
381 discount''_ a1' a2' a3' a4' >>= \res ->
382 let {res' = realToFrac res} in
383 errorCheck a4'>>
384 return (res')
385
386
387
388 -- |Rate helper for bootstrapping over swap rates, built from explicit tenor\/calendar\/
389 -- frequency\/day-count\/index conventions rather than a 'GenSwapIndex' bundling them
390 -- (as 'swapRateHelper' does).
391 swapRateHelper' :: (GenQuote q1) -- ^rate
392 -> ((Int,TimeUnit)) -- ^tenor
393 -> (Calendar) -- ^calendar
394 -> (Frequency) -- ^fixedFrequency
395 -> (BusinessDayConvention) -- ^fixedConvention
396 -> (DayCounter) -- ^fixedDayCount
397 -> (GenIborIndex ibor) -- ^iborIndex
398 -> (Maybe (GenQuote q2)) -- ^spread
399 -> ((Int,TimeUnit)) -- ^fwdStart
400 -> (Maybe (GenYieldTermStructure y)) -- ^discountingCurve
401 -> (Maybe Word) -- ^settlementDays
402 -> (PillarChoice) -- ^pillar
403 -> (Maybe Day) -- ^customPillarDate
404 -> (Bool) -- ^endOfMonth
405 -> (Maybe Bool) -- ^useIndexedCoupons
406 -> (Maybe BusinessDayConvention) -- ^floatConvention
407 -> (Maybe FloatingRateCouponPricer) -- ^couponPricer
408 -> IO ((SwapRateHelper))
409 swapRateHelper' a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 =
410 withQuote a1 $ \a1' ->
411 let {(a2'1, a2'2) = fromEnumQuantity a2} in
412 withCalendar a3 $ \a3' ->
413 let {a4' = (fromIntegral . fromEnum) a4} in
414 let {a5' = fromEnumC a5} in
415 withDayCounter a6 $ \a6' ->
416 withIborIndex a7 $ \a7' ->
417 withMaybeQuote a8 $ \a8' ->
418 let {(a9'1, a9'2) = fromEnumQuantity a9} in
419 withMaybeYieldTermStructure a10 $ \a10' ->
420 let {a11' = fromMaybeInt a11} in
421 let {a12' = (fromIntegral . fromEnum) a12} in
422 withMaybeDay a13 $ \a13' ->
423 let {a14' = C2HSImp.fromBool a14} in
424 let {a15' = fromMaybeBool a15} in
425 let {a16' = fromMaybeEnum a16} in
426 withMaybeFloatingRateCouponPricer a17 $ \a17' ->
427 preErrorCheck $ \a18' ->
428 swapRateHelper''_ 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 ->
429 peekSwapRateHelper res >>= \res' ->
430 errorCheck a18'>>
431 return (res')
432
433
434
435 -- |Flat interest-rate curve with a fixed reference date.
436 flatForward :: (Day) -> (GenQuote q) -> (DayCounter) -> (Compounding) -> (Frequency) -> IO ((YieldTermStructure))
437 flatForward a1 a2 a3 a4 a5 =
438 withDay a1 $ \a1' ->
439 withQuote a2 $ \a2' ->
440 withDayCounter a3 $ \a3' ->
441 let {a4' = (fromIntegral . fromEnum) a4} in
442 let {a5' = (fromIntegral . fromEnum) a5} in
443 preErrorCheck $ \a6' ->
444 flatForward'_ a1' a2' a3' a4' a5' a6' >>= \res ->
445 peekYieldTermStructure res >>= \res' ->
446 errorCheck a6'>>
447 return (res')
448
449
450
451 -- |Flat interest-rate curve whose reference date moves with the evaluation date, offset by
452 -- 'settlementDays' on 'calendar'.
453 flatForward' :: (Word) -- ^settlementDays
454 -> (Calendar) -> (GenQuote q) -> (DayCounter) -> (Compounding) -> (Frequency) -> IO ((YieldTermStructure))
455 flatForward' a1 a2 a3 a4 a5 a6 =
456 let {a1' = fromIntegral a1} in
457 withCalendar a2 $ \a2' ->
458 withQuote a3 $ \a3' ->
459 withDayCounter a4 $ \a4' ->
460 let {a5' = (fromIntegral . fromEnum) a5} in
461 let {a6' = (fromIntegral . fromEnum) a6} in
462 preErrorCheck $ \a7' ->
463 flatForward''_ a1' a2' a3' a4' a5' a6' a7' >>= \res ->
464 peekYieldTermStructure res >>= \res' ->
465 errorCheck a7'>>
466 return (res')
467
468
469
470 -- |The resulting interest rate has the required daycounting rule.
471 zeroRate' :: (GenYieldTermStructure y) -> (Day) -> (DayCounter) -> (Compounding) -> (Frequency) -> (Bool) -- ^extrapolate
472 -> IO ((InterestRate))
473 zeroRate' a1 a2 a3 a4 a5 a6 =
474 withYieldTermStructure a1 $ \a1' ->
475 withDay a2 $ \a2' ->
476 withDayCounter a3 $ \a3' ->
477 let {a4' = (fromIntegral . fromEnum) a4} in
478 let {a5' = (fromIntegral . fromEnum) a5} in
479 let {a6' = C2HSImp.fromBool a6} in
480 preErrorCheck $ \a7' ->
481 zeroRate''_ a1' a2' a3' a4' a5' a6' a7' >>= \res ->
482 peekInterestRate res >>= \res' ->
483 errorCheck a7'>>
484 return (res')
485
486
487
488 -- |The resulting interest rate has the required day-counting rule. /Warning/ dates are not adjusted for holidays
489 forwardRateForPeriod :: (GenYieldTermStructure y) -> (Day) -> ((Int,TimeUnit)) -> (DayCounter) -> (Compounding) -> (Frequency) -> (Bool) -- ^extrapolate
490 -> IO ((InterestRate))
491 forwardRateForPeriod a1 a2 a3 a4 a5 a6 a7 =
492 withYieldTermStructure a1 $ \a1' ->
493 withDay a2 $ \a2' ->
494 let {(a3'1, a3'2) = fromEnumQuantity a3} in
495 withDayCounter a4 $ \a4' ->
496 let {a5' = (fromIntegral . fromEnum) a5} in
497 let {a6' = (fromIntegral . fromEnum) a6} in
498 let {a7' = C2HSImp.fromBool a7} in
499 preErrorCheck $ \a8' ->
500 forwardRateForPeriod'_ a1' a2' a3'1 a3'2 a4' a5' a6' a7' a8' >>= \res ->
501 peekInterestRate res >>= \res' ->
502 errorCheck a8'>>
503 return (res')
504
505
506
507 -- |The resulting interest rate has the required day-counting rule.
508 forwardRate' :: (GenYieldTermStructure y) -> (Day) -> (Day) -> (DayCounter) -> (Compounding) -> (Frequency) -> (Bool) -- ^extrapolate
509 -> IO ((InterestRate))
510 forwardRate' a1 a2 a3 a4 a5 a6 a7 =
511 withYieldTermStructure a1 $ \a1' ->
512 withDay a2 $ \a2' ->
513 withDay a3 $ \a3' ->
514 withDayCounter a4 $ \a4' ->
515 let {a5' = (fromIntegral . fromEnum) a5} in
516 let {a6' = (fromIntegral . fromEnum) a6} in
517 let {a7' = C2HSImp.fromBool a7} in
518 preErrorCheck $ \a8' ->
519 forwardRate''_ a1' a2' a3' a4' a5' a6' a7' a8' >>= \res ->
520 peekInterestRate res >>= \res' ->
521 errorCheck a8'>>
522 return (res')
523
524
525
526 -- |The resulting interest rate has the same day-counting rule used by the term structure. The same rule should be used for calculating the passed times t1 and t2.
527 forwardRate :: (GenYieldTermStructure y) -> (Double) -> (Double) -> (Compounding) -> (Frequency) -> (Bool) -- ^extrapolate
528 -> IO ((InterestRate))
529 forwardRate a1 a2 a3 a4 a5 a6 =
530 withYieldTermStructure a1 $ \a1' ->
531 let {a2' = realToFrac a2} in
532 let {a3' = realToFrac a3} in
533 let {a4' = (fromIntegral . fromEnum) a4} in
534 let {a5' = (fromIntegral . fromEnum) a5} in
535 let {a6' = C2HSImp.fromBool a6} in
536 preErrorCheck $ \a7' ->
537 forwardRate'_ a1' a2' a3' a4' a5' a6' a7' >>= \res ->
538 peekInterestRate res >>= \res' ->
539 errorCheck a7'>>
540 return (res')
541
542
543
544 -- |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.
545 zeroRate :: (GenYieldTermStructure y) -> (Double) -> (Compounding) -> (Frequency) -> (Bool) -- ^extrapolate
546 -> IO ((InterestRate))
547 zeroRate a1 a2 a3 a4 a5 =
548 withYieldTermStructure a1 $ \a1' ->
549 let {a2' = realToFrac a2} in
550 let {a3' = (fromIntegral . fromEnum) a3} in
551 let {a4' = (fromIntegral . fromEnum) a4} in
552 let {a5' = C2HSImp.fromBool a5} in
553 preErrorCheck $ \a6' ->
554 zeroRate'_ a1' a2' a3' a4' a5' a6' >>= \res ->
555 peekInterestRate res >>= \res' ->
556 errorCheck a6'>>
557 return (res')
558
559
560
561 -- |The same day-counting rule used by the term structure should be used for calculating the passed time t.
562 discount :: (GenYieldTermStructure y) -> (Double) -> (Bool) -- ^extrapolate
563 -> IO ((Double))
564 discount a1 a2 a3 =
565 withYieldTermStructure a1 $ \a1' ->
566 let {a2' = realToFrac a2} in
567 let {a3' = C2HSImp.fromBool a3} in
568 preErrorCheck $ \a4' ->
569 discount'_ a1' a2' a3' a4' >>= \res ->
570 let {res' = realToFrac res} in
571 errorCheck a4'>>
572 return (res')
573
574
575
576 -- |Rate helper for bootstrapping over FRA rates.
577 fraRateHelper :: (GenQuote q) -- ^rate
578 -> (Word) -- ^monthsToStart
579 -> (Word) -- ^monthsToEnd
580 -> (Word) -- ^fixingDays
581 -> (Calendar) -- ^calendar
582 -> (BusinessDayConvention) -- ^convention
583 -> (Bool) -- ^endOfMonth
584 -> (DayCounter) -> (PillarChoice) -- ^pillar
585 -> (Maybe Day) -- ^customPillarDate
586 -> (Bool) -- ^useIndexedCoupon
587 -> IO ((RateHelper))
588 fraRateHelper a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 =
589 withQuote a1 $ \a1' ->
590 let {a2' = fromIntegral a2} in
591 let {a3' = fromIntegral a3} in
592 let {a4' = fromIntegral a4} in
593 withCalendar a5 $ \a5' ->
594 let {a6' = fromEnumC a6} in
595 let {a7' = C2HSImp.fromBool a7} in
596 withDayCounter a8 $ \a8' ->
597 let {a9' = (fromIntegral . fromEnum) a9} in
598 withMaybeDay a10 $ \a10' ->
599 let {a11' = C2HSImp.fromBool a11} in
600 preErrorCheck $ \a12' ->
601 fraRateHelper'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' a10' a11' a12' >>= \res ->
602 peekRateHelper res >>= \res' ->
603 errorCheck a12'>>
604 return (res')
605
606
607
608 -- |Bootstrapping helper for an ibor-ibor basis swap: pays @baseIndex + basis@, receives
609 -- @otherIndex@. Pass @bootstrapBaseCurve = True@ (with 'otherIndex' carrying a forecast curve)
610 -- to bootstrap the forecast curve for 'baseIndex', or 'False' (with 'baseIndex' carrying a
611 -- forecast curve) to bootstrap the forecast curve for 'otherIndex'. An exogenous discount curve
612 -- is always required.
613 iborIborBasisSwapRateHelper :: (GenQuote q) -- ^basis
614 -> ((Int,TimeUnit)) -- ^tenor
615 -> (Word) -- ^settlementDays
616 -> (Calendar) -- ^calendar
617 -> (BusinessDayConvention) -- ^convention
618 -> (Bool) -- ^endOfMonth
619 -> (GenIborIndex ibor1) -- ^baseIndex
620 -> (GenIborIndex ibor2) -- ^otherIndex
621 -> (GenYieldTermStructure y) -- ^discountHandle
622 -> (Bool) -- ^bootstrapBaseCurve
623 -> IO ((RateHelper))
624 iborIborBasisSwapRateHelper a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 =
625 withQuote a1 $ \a1' ->
626 let {(a2'1, a2'2) = fromEnumQuantity a2} in
627 let {a3' = fromIntegral a3} in
628 withCalendar a4 $ \a4' ->
629 let {a5' = fromEnumC a5} in
630 let {a6' = C2HSImp.fromBool a6} in
631 withIborIndex a7 $ \a7' ->
632 withIborIndex a8 $ \a8' ->
633 withYieldTermStructure a9 $ \a9' ->
634 let {a10' = C2HSImp.fromBool a10} in
635 preErrorCheck $ \a11' ->
636 iborIborBasisSwapRateHelper'_ a1' a2'1 a2'2 a3' a4' a5' a6' a7' a8' a9' a10' a11' >>= \res ->
637 peekRateHelper res >>= \res' ->
638 errorCheck a11'>>
639 return (res')
640
641
642
643 -- |Bootstrapping helper for an overnight-ibor basis swap: pays @baseIndex + basis@, receives
644 -- @otherIndex@. Bootstraps the forecast curve for 'otherIndex'; 'baseIndex' needs an existing
645 -- forecast curve. If 'Nothing', the overnight index's own curve is used as the discount curve.
646 overnightIborBasisSwapRateHelper :: (GenQuote q) -- ^basis
647 -> ((Int,TimeUnit)) -- ^tenor
648 -> (Word) -- ^settlementDays
649 -> (Calendar) -- ^calendar
650 -> (BusinessDayConvention) -- ^convention
651 -> (Bool) -- ^endOfMonth
652 -> (OvernightIborIndex) -- ^baseIndex
653 -> (GenIborIndex ibor) -- ^otherIndex
654 -> (Maybe (GenYieldTermStructure y)) -- ^discountHandle
655 -> IO ((RateHelper))
656 overnightIborBasisSwapRateHelper a1 a2 a3 a4 a5 a6 a7 a8 a9 =
657 withQuote a1 $ \a1' ->
658 let {(a2'1, a2'2) = fromEnumQuantity a2} in
659 let {a3' = fromIntegral a3} in
660 withCalendar a4 $ \a4' ->
661 let {a5' = fromEnumC a5} in
662 let {a6' = C2HSImp.fromBool a6} in
663 withOvernightIborIndex a7 $ \a7' ->
664 withIborIndex a8 $ \a8' ->
665 withMaybeYieldTermStructure a9 $ \a9' ->
666 preErrorCheck $ \a10' ->
667 overnightIborBasisSwapRateHelper'_ a1' a2'1 a2'2 a3' a4' a5' a6' a7' a8' a9' a10' >>= \res ->
668 peekRateHelper res >>= \res' ->
669 errorCheck a10'>>
670 return (res')
671
672
673
674 -- |Bootstrapping helper for a constant-notional cross-currency basis swap: the collateral is
675 -- paid in the quote currency, the basis is given on the base-currency leg. 'Nothing' for either
676 -- frequency parameter derives the corresponding leg's schedule from its index tenor (or, for the
677 -- quote-currency leg, falls back to the base-currency frequency if that is given).
678 constNotionalCrossCurrencyBasisSwapRateHelper :: (GenQuote q) -- ^basis
679 -> ((Int,TimeUnit)) -- ^tenor
680 -> (Word) -- ^fixingDays
681 -> (Calendar) -- ^calendar
682 -> (BusinessDayConvention) -- ^convention
683 -> (Bool) -- ^endOfMonth
684 -> (GenIborIndex ibor1) -- ^baseCurrencyIndex
685 -> (GenIborIndex ibor2) -- ^quoteCurrencyIndex
686 -> (GenYieldTermStructure y) -- ^collateralCurve
687 -> (Bool) -- ^isFxBaseCurrencyCollateralCurrency
688 -> (Bool) -- ^isBasisOnFxBaseCurrencyLeg
689 -> (Maybe Frequency) -- ^paymentFrequency
690 -> (Int) -- ^paymentLag
691 -> (Maybe Frequency) -- ^quoteCurrencyPaymentFrequency
692 -> IO ((RateHelper))
693 constNotionalCrossCurrencyBasisSwapRateHelper a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 =
694 withQuote a1 $ \a1' ->
695 let {(a2'1, a2'2) = fromEnumQuantity a2} in
696 let {a3' = fromIntegral a3} in
697 withCalendar a4 $ \a4' ->
698 let {a5' = fromEnumC a5} in
699 let {a6' = C2HSImp.fromBool a6} in
700 withIborIndex a7 $ \a7' ->
701 withIborIndex a8 $ \a8' ->
702 withYieldTermStructure a9 $ \a9' ->
703 let {a10' = C2HSImp.fromBool a10} in
704 let {a11' = C2HSImp.fromBool a11} in
705 let {a12' = fromMaybeEnum a12} in
706 let {a13' = fromIntegral a13} in
707 let {a14' = fromMaybeEnum a14} in
708 preErrorCheck $ \a15' ->
709 constNotionalCrossCurrencyBasisSwapRateHelper'_ a1' a2'1 a2'2 a3' a4' a5' a6' a7' a8' a9' a10' a11' a12' a13' a14' a15' >>= \res ->
710 peekRateHelper res >>= \res' ->
711 errorCheck a15'>>
712 return (res')
713
714
715
716 -- |Bootstrapping helper for a marked-to-market cross-currency basis swap: like
717 -- 'constNotionalCrossCurrencyBasisSwapRateHelper', but the notional on the MtM leg resets at
718 -- each payment to reflect the FX rate.
719 mtMCrossCurrencyBasisSwapRateHelper :: (GenQuote q) -- ^basis
720 -> ((Int,TimeUnit)) -- ^tenor
721 -> (Word) -- ^fixingDays
722 -> (Calendar) -- ^calendar
723 -> (BusinessDayConvention) -- ^convention
724 -> (Bool) -- ^endOfMonth
725 -> (GenIborIndex ibor1) -- ^baseCurrencyIndex
726 -> (GenIborIndex ibor2) -- ^quoteCurrencyIndex
727 -> (GenYieldTermStructure y) -- ^collateralCurve
728 -> (Bool) -- ^isFxBaseCurrencyCollateralCurrency
729 -> (Bool) -- ^isBasisOnFxBaseCurrencyLeg
730 -> (Bool) -- ^isFxBaseCurrencyLegResettable
731 -> (Maybe Frequency) -- ^paymentFrequency
732 -> (Int) -- ^paymentLag
733 -> (Maybe Frequency) -- ^quoteCurrencyPaymentFrequency
734 -> IO ((RateHelper))
735 mtMCrossCurrencyBasisSwapRateHelper a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 =
736 withQuote a1 $ \a1' ->
737 let {(a2'1, a2'2) = fromEnumQuantity a2} in
738 let {a3' = fromIntegral a3} in
739 withCalendar a4 $ \a4' ->
740 let {a5' = fromEnumC a5} in
741 let {a6' = C2HSImp.fromBool a6} in
742 withIborIndex a7 $ \a7' ->
743 withIborIndex a8 $ \a8' ->
744 withYieldTermStructure a9 $ \a9' ->
745 let {a10' = C2HSImp.fromBool a10} in
746 let {a11' = C2HSImp.fromBool a11} in
747 let {a12' = C2HSImp.fromBool a12} in
748 let {a13' = fromMaybeEnum a13} in
749 let {a14' = fromIntegral a14} in
750 let {a15' = fromMaybeEnum a15} in
751 preErrorCheck $ \a16' ->
752 mtMCrossCurrencyBasisSwapRateHelper'_ a1' a2'1 a2'2 a3' a4' a5' a6' a7' a8' a9' a10' a11' a12' a13' a14' a15' a16' >>= \res ->
753 peekRateHelper res >>= \res' ->
754 errorCheck a16'>>
755 return (res')
756
757
758
759 -- |Bootstrapping helper for a fixed-vs-floating cross-currency par swap: quoted at par, so the
760 -- FX spot cancels out and isn't required. 'collateralOnFixedLeg' selects which leg is discounted
761 -- with 'collateralCurve' -- the other leg's discount curve is the one being bootstrapped.
762 constNotionalCrossCurrencySwapRateHelper :: (GenQuote q) -- ^fixedRate
763 -> ((Int,TimeUnit)) -- ^tenor
764 -> (Word) -- ^fixingDays
765 -> (Calendar) -- ^calendar
766 -> (BusinessDayConvention) -- ^convention
767 -> (Bool) -- ^endOfMonth
768 -> (Frequency) -- ^fixedFrequency
769 -> (DayCounter) -- ^fixedDayCount
770 -> (GenIborIndex ibor) -- ^floatIndex
771 -> (GenYieldTermStructure y) -- ^collateralCurve
772 -> (Bool) -- ^collateralOnFixedLeg
773 -> (Int) -- ^paymentLag
774 -> IO ((RateHelper))
775 constNotionalCrossCurrencySwapRateHelper a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 =
776 withQuote a1 $ \a1' ->
777 let {(a2'1, a2'2) = fromEnumQuantity a2} in
778 let {a3' = fromIntegral a3} in
779 withCalendar a4 $ \a4' ->
780 let {a5' = fromEnumC a5} in
781 let {a6' = C2HSImp.fromBool a6} in
782 let {a7' = (fromIntegral . fromEnum) a7} in
783 withDayCounter a8 $ \a8' ->
784 withIborIndex a9 $ \a9' ->
785 withYieldTermStructure a10 $ \a10' ->
786 let {a11' = C2HSImp.fromBool a11} in
787 let {a12' = fromIntegral a12} in
788 preErrorCheck $ \a13' ->
789 constNotionalCrossCurrencySwapRateHelper'_ a1' a2'1 a2'2 a3' a4' a5' a6' a7' a8' a9' a10' a11' a12' a13' >>= \res ->
790 peekRateHelper res >>= \res' ->
791 errorCheck a13'>>
792 return (res')
793
794
795
796 -- |Bootstrapping helper from FX swap points, tenor-relative. 'collateralCurve' discounts the
797 -- collateral currency; the curve being bootstrapped is for the other currency. 'fwdPoint' and
798 -- 'spotFx' must be quoted in the same units (points already scaled to match the spot).
799 fxSwapRateHelper :: (GenQuote q1) -- ^fwdPoint
800 -> (GenQuote q2) -- ^spotFx
801 -> ((Int,TimeUnit)) -- ^tenor
802 -> (Word) -- ^fixingDays
803 -> (Calendar) -- ^calendar
804 -> (BusinessDayConvention) -- ^convention
805 -> (Bool) -- ^endOfMonth
806 -> (Bool) -- ^isFxBaseCurrencyCollateralCurrency
807 -> (GenYieldTermStructure y) -- ^collateralCurve
808 -> (Calendar) -- ^tradingCalendar
809 -> IO ((RateHelper))
810 fxSwapRateHelper a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 =
811 withQuote a1 $ \a1' ->
812 withQuote a2 $ \a2' ->
813 let {(a3'1, a3'2) = fromEnumQuantity a3} in
814 let {a4' = fromIntegral a4} in
815 withCalendar a5 $ \a5' ->
816 let {a6' = fromEnumC a6} in
817 let {a7' = C2HSImp.fromBool a7} in
818 let {a8' = C2HSImp.fromBool a8} in
819 withYieldTermStructure a9 $ \a9' ->
820 withCalendar a10 $ \a10' ->
821 preErrorCheck $ \a11' ->
822 fxSwapRateHelper'_ a1' a2' a3'1 a3'2 a4' a5' a6' a7' a8' a9' a10' a11' >>= \res ->
823 peekRateHelper res >>= \res' ->
824 errorCheck a11'>>
825 return (res')
826
827
828
829 -- |Bootstrapping helper from FX swap points, explicit start\/end date.
830 fxSwapRateHelper' :: (GenQuote q1) -- ^fwdPoint
831 -> (GenQuote q2) -- ^spotFx
832 -> (Day) -- ^startDate
833 -> (Day) -- ^endDate
834 -> (Bool) -- ^isFxBaseCurrencyCollateralCurrency
835 -> (GenYieldTermStructure y) -- ^collateralCurve
836 -> IO ((RateHelper))
837 fxSwapRateHelper' a1 a2 a3 a4 a5 a6 =
838 withQuote a1 $ \a1' ->
839 withQuote a2 $ \a2' ->
840 withDay a3 $ \a3' ->
841 withDay a4 $ \a4' ->
842 let {a5' = C2HSImp.fromBool a5} in
843 withYieldTermStructure a6 $ \a6' ->
844 preErrorCheck $ \a7' ->
845 fxSwapRateHelper''_ a1' a2' a3' a4' a5' a6' a7' >>= \res ->
846 peekRateHelper res >>= \res' ->
847 errorCheck a7'>>
848 return (res')
849
850
851
852 -- |/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.
853 -- BondPriceType (QuantLib.Instrument.Bond) is later in exposed-modules than
854 -- this file, so priceType is marshalled as a plain Int via fromEnum here
855 -- instead of a {#import#}'d enum type, per CLAUDE.md's cross-module workaround.
856 bondHelper :: GenQuote q -> Bond -> Bond.BondPriceType -> IO BondHelper
857 bondHelper cleanPrice bond priceType = bondHelper_ cleanPrice bond (fromEnum priceType)
858
859 bondHelper_ :: (GenQuote q) -> (Bond) -> (Int) -- ^priceType
860 -> IO ((BondHelper))
861 bondHelper_ a1 a2 a3 =
862 withQuote a1 $ \a1' ->
863 withBond a2 $ \a2' ->
864 let {a3' = fromIntegral a3} in
865 preErrorCheck $ \a4' ->
866 bondHelper_'_ a1' a2' a3' a4' >>= \res ->
867 peekBondHelper res >>= \res' ->
868 errorCheck a4'>>
869 return (res')
870
871
872 -- oisRateHelper/oisRateHelper' keep their original 5-param signatures (below);
873 -- both call the same full-arity raw bindings as oisRateHelperFull/oisRateHelperFull'
874 -- (the options-record wrappers spliced further down in this file), hardcoding
875 -- upstream's own defaults for every trailing param -- widening the underlying C
876 -- shim was cheaper than maintaining a second near-duplicate one (see
877 -- cbits/qlTermStructure.cpp's qlOISRateHelper/qlOISRateHelper2).
878 oisRateHelper :: Word -> (Int, TimeUnit) -> GenQuote q -> OvernightIborIndex
879 -> Maybe (GenYieldTermStructure y) -> IO OISRateHelper
880 oisRateHelper settlementDays tenor fixedRate idx discountingCurve = do
881 cal <- calendar Null
882 oisRateHelper_ settlementDays tenor fixedRate idx discountingCurve
883 False 0 Following Annual cal (0, Days) Nothing LastRelevantDate Nothing AveragingCompound
884 Nothing Nothing cal Nothing 0 False Nothing Backward cal ModifiedFollowing
885
886 oisRateHelper' :: Day -> Day -> GenQuote q -> OvernightIborIndex
887 -> Maybe (GenYieldTermStructure y) -> IO OISRateHelper
888 oisRateHelper' startDate endDate fixedRate idx discountingCurve = do
889 cal <- calendar Null
890 oisRateHelper2_ startDate endDate fixedRate idx discountingCurve
891 False 0 Following Annual cal Nothing LastRelevantDate Nothing AveragingCompound
892 Nothing Nothing cal Nothing 0 False Nothing Backward cal ModifiedFollowing
893
894 oisRateHelper_ :: (Word) -- ^settlementDays
895 -> ((Int,TimeUnit)) -- ^tenor
896 -> (GenQuote q1) -> (OvernightIborIndex) -> (Maybe (GenYieldTermStructure y)) -- ^discountingCurve
897 -> (Bool) -- ^telescopicValueDates
898 -> (Int) -- ^paymentLag
899 -> (BusinessDayConvention) -- ^paymentConvention
900 -> (Frequency) -- ^paymentFrequency
901 -> (Calendar) -- ^paymentCalendar
902 -> ((Int,TimeUnit)) -- ^forwardStart
903 -> (Maybe (GenQuote q2)) -- ^overnightSpread
904 -> (PillarChoice) -- ^pillar
905 -> (Maybe Day) -- ^customPillarDate
906 -> (RateAveragingType) -- ^averagingMethod
907 -> (Maybe Bool) -- ^endOfMonth
908 -> (Maybe Frequency) -- ^fixedPaymentFrequency
909 -> (Calendar) -- ^fixedCalendar
910 -> (Maybe Word) -- ^lookbackDays
911 -> (Word) -- ^lockoutDays
912 -> (Bool) -- ^applyObservationShift
913 -> (Maybe FloatingRateCouponPricer) -- ^pricer
914 -> (DateGenerationRule) -- ^rule
915 -> (Calendar) -- ^overnightCalendar
916 -> (BusinessDayConvention) -- ^convention (q1.k.q1. overnightConvention)
917 -> IO ((OISRateHelper))
918 oisRateHelper_ a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 a19 a20 a21 a22 a23 a24 a25 =
919 let {a1' = fromIntegral a1} in
920 let {(a2'1, a2'2) = fromEnumQuantity a2} in
921 withQuote a3 $ \a3' ->
922 withOvernightIborIndex a4 $ \a4' ->
923 withMaybeYieldTermStructure a5 $ \a5' ->
924 let {a6' = C2HSImp.fromBool a6} in
925 let {a7' = fromIntegral a7} in
926 let {a8' = fromEnumC a8} in
927 let {a9' = (fromIntegral . fromEnum) a9} in
928 withCalendar a10 $ \a10' ->
929 let {(a11'1, a11'2) = fromEnumQuantity a11} in
930 withMaybeQuote a12 $ \a12' ->
931 let {a13' = (fromIntegral . fromEnum) a13} in
932 withMaybeDay a14 $ \a14' ->
933 let {a15' = (fromIntegral . fromEnum) a15} in
934 let {a16' = fromMaybeBool a16} in
935 let {a17' = fromMaybeEnum a17} in
936 withCalendar a18 $ \a18' ->
937 let {a19' = fromMaybeInt a19} in
938 let {a20' = fromIntegral a20} in
939 let {a21' = C2HSImp.fromBool a21} in
940 withMaybeFloatingRateCouponPricer a22 $ \a22' ->
941 let {a23' = (fromIntegral . fromEnum) a23} in
942 withCalendar a24 $ \a24' ->
943 let {a25' = fromEnumC a25} in
944 preErrorCheck $ \a26' ->
945 oisRateHelper_'_ a1' a2'1 a2'2 a3' a4' a5' a6' a7' a8' a9' a10' a11'1 a11'2 a12' a13' a14' a15' a16' a17' a18' a19' a20' a21' a22' a23' a24' a25' a26' >>= \res ->
946 peekOISRateHelper res >>= \res' ->
947 errorCheck a26'>>
948 return (res')
949
950
951 oisRateHelper2_ :: (Day) -- ^startDate
952 -> (Day) -- ^endDate
953 -> (GenQuote q1) -> (OvernightIborIndex) -> (Maybe (GenYieldTermStructure y)) -- ^discountingCurve
954 -> (Bool) -- ^telescopicValueDates
955 -> (Int) -- ^paymentLag
956 -> (BusinessDayConvention) -- ^paymentConvention
957 -> (Frequency) -- ^paymentFrequency
958 -> (Calendar) -- ^paymentCalendar
959 -> (Maybe (GenQuote q2)) -- ^overnightSpread
960 -> (PillarChoice) -- ^pillar
961 -> (Maybe Day) -- ^customPillarDate
962 -> (RateAveragingType) -- ^averagingMethod
963 -> (Maybe Bool) -- ^endOfMonth
964 -> (Maybe Frequency) -- ^fixedPaymentFrequency
965 -> (Calendar) -- ^fixedCalendar
966 -> (Maybe Word) -- ^lookbackDays
967 -> (Word) -- ^lockoutDays
968 -> (Bool) -- ^applyObservationShift
969 -> (Maybe FloatingRateCouponPricer) -- ^pricer
970 -> (DateGenerationRule) -- ^rule
971 -> (Calendar) -- ^overnightCalendar
972 -> (BusinessDayConvention) -- ^convention (q1.k.q1. overnightConvention)
973 -> IO ((OISRateHelper))
974 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 =
975 withDay a1 $ \a1' ->
976 withDay a2 $ \a2' ->
977 withQuote a3 $ \a3' ->
978 withOvernightIborIndex a4 $ \a4' ->
979 withMaybeYieldTermStructure a5 $ \a5' ->
980 let {a6' = C2HSImp.fromBool a6} in
981 let {a7' = fromIntegral a7} in
982 let {a8' = fromEnumC a8} in
983 let {a9' = (fromIntegral . fromEnum) a9} in
984 withCalendar a10 $ \a10' ->
985 withMaybeQuote a11 $ \a11' ->
986 let {a12' = (fromIntegral . fromEnum) a12} in
987 withMaybeDay a13 $ \a13' ->
988 let {a14' = (fromIntegral . fromEnum) a14} in
989 let {a15' = fromMaybeBool a15} in
990 let {a16' = fromMaybeEnum a16} in
991 withCalendar a17 $ \a17' ->
992 let {a18' = fromMaybeInt a18} in
993 let {a19' = fromIntegral a19} in
994 let {a20' = C2HSImp.fromBool a20} in
995 withMaybeFloatingRateCouponPricer a21 $ \a21' ->
996 let {a22' = (fromIntegral . fromEnum) a22} in
997 withCalendar a23 $ \a23' ->
998 let {a24' = fromEnumC a24} in
999 preErrorCheck $ \a25' ->
1000 oisRateHelper2_'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' a10' a11' a12' a13' a14' a15' a16' a17' a18' a19' a20' a21' a22' a23' a24' a25' >>= \res ->
1001 peekOISRateHelper res >>= \res' ->
1002 errorCheck a25'>>
1003 return (res')
1004
1005
1006
1007 oisRateHelperFull :: Word -> (Int, TimeUnit) -> GenQuote q -> OvernightIborIndex
1008 -> Maybe (GenYieldTermStructure y) -> OISRateHelperOpts m -> IO OISRateHelper
1009 oisRateHelperFull settlementDays tenor fixedRate idx discountingCurve opts = do
1010 cal <- calendar Null
1011 oisRateHelper_ settlementDays tenor fixedRate idx discountingCurve
1012 (oisTelescopicValueDates opts) (oisPaymentLag opts) (oisPaymentConvention opts)
1013 (oisPaymentFrequency opts) (fromMaybe cal (oisPaymentCalendar opts))
1014 (oisForwardStart opts) (oisOvernightSpread opts) (oisPillar opts) (oisCustomPillarDate opts)
1015 (oisAveragingMethod opts) (oisEndOfMonth opts) (oisFixedPaymentFrequency opts)
1016 (fromMaybe cal (oisFixedCalendar opts)) (oisLookbackDays opts) (oisLockoutDays opts)
1017 (oisApplyObservationShift opts) (oisPricer opts) (oisRule opts)
1018 (fromMaybe cal (oisOvernightCalendar opts)) (oisConvention opts)
1019
1020 oisRateHelperFull' :: Day -> Day -> GenQuote q -> OvernightIborIndex
1021 -> Maybe (GenYieldTermStructure y) -> OISRateHelperOpts m -> IO OISRateHelper
1022 oisRateHelperFull' startDate endDate fixedRate idx discountingCurve opts = do
1023 cal <- calendar Null
1024 oisRateHelper2_ startDate endDate fixedRate idx discountingCurve
1025 (oisTelescopicValueDates opts) (oisPaymentLag opts) (oisPaymentConvention opts)
1026 (oisPaymentFrequency opts) (fromMaybe cal (oisPaymentCalendar opts))
1027 (oisOvernightSpread opts) (oisPillar opts) (oisCustomPillarDate opts)
1028 (oisAveragingMethod opts) (oisEndOfMonth opts) (oisFixedPaymentFrequency opts)
1029 (fromMaybe cal (oisFixedCalendar opts)) (oisLookbackDays opts) (oisLockoutDays opts)
1030 (oisApplyObservationShift opts) (oisPricer opts) (oisRule opts)
1031 (fromMaybe cal (oisOvernightCalendar opts)) (oisConvention opts)
1032
1033 -- |Rate helper for bootstrapping over swap rates, built from a 'GenSwapIndex' bundling the
1034 -- swap's conventions.
1035 swapRateHelper :: (GenQuote q1) -- ^rate
1036 -> (GenSwapIndex sidx) -> (Maybe (GenQuote q2)) -- ^spread
1037 -> ((Int,TimeUnit)) -- ^fwdStart
1038 -> (Maybe (GenYieldTermStructure y)) -- ^discountingCurve
1039 -> (PillarChoice) -- ^pillar
1040 -> (Maybe Day) -- ^customPillarDate
1041 -> (Bool) -- ^endOfMonth
1042 -> (Maybe Bool) -- ^useIndexedCoupons
1043 -> (Maybe FloatingRateCouponPricer) -- ^couponPricer
1044 -> IO ((SwapRateHelper))
1045 swapRateHelper a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 =
1046 withQuote a1 $ \a1' ->
1047 withSwapIndex a2 $ \a2' ->
1048 withMaybeQuote a3 $ \a3' ->
1049 let {(a4'1, a4'2) = fromEnumQuantity a4} in
1050 withMaybeYieldTermStructure a5 $ \a5' ->
1051 let {a6' = (fromIntegral . fromEnum) a6} in
1052 withMaybeDay a7 $ \a7' ->
1053 let {a8' = C2HSImp.fromBool a8} in
1054 let {a9' = fromMaybeBool a9} in
1055 withMaybeFloatingRateCouponPricer a10 $ \a10' ->
1056 preErrorCheck $ \a11' ->
1057 swapRateHelper'_ a1' a2' a3' a4'1 a4'2 a5' a6' a7' a8' a9' a10' a11' >>= \res ->
1058 peekSwapRateHelper res >>= \res' ->
1059 errorCheck a11'>>
1060 return (res')
1061
1062
1063
1064 -- |A yield curve offset from 'baseCurve' by a spread added to its instantaneous forward rate,
1065 -- remaining linked to changes in either.
1066 forwardSpreadedTermStructure :: (GenYieldTermStructure y) -> (GenQuote q) -> IO ((YieldTermStructure))
1067 forwardSpreadedTermStructure a1 a2 =
1068 withYieldTermStructure a1 $ \a1' ->
1069 withQuote a2 $ \a2' ->
1070 preErrorCheck $ \a3' ->
1071 forwardSpreadedTermStructure'_ a1' a2' a3' >>= \res ->
1072 peekYieldTermStructure res >>= \res' ->
1073 errorCheck a3'>>
1074 return (res')
1075
1076
1077
1078 -- |A yield curve offset from 'baseCurve' by a spread added to its zero-yield rate, remaining
1079 -- linked to changes in either.
1080 zeroSpreadedTermStructure :: (GenYieldTermStructure y) -> (GenQuote q) -> (Compounding) -> (Frequency) -> IO ((YieldTermStructure))
1081 zeroSpreadedTermStructure a1 a2 a3 a4 =
1082 withYieldTermStructure a1 $ \a1' ->
1083 withQuote a2 $ \a2' ->
1084 let {a3' = (fromIntegral . fromEnum) a3} in
1085 let {a4' = (fromIntegral . fromEnum) a4} in
1086 preErrorCheck $ \a5' ->
1087 zeroSpreadedTermStructure'_ a1' a2' a3' a4' a5' >>= \res ->
1088 peekYieldTermStructure res >>= \res' ->
1089 errorCheck a5'>>
1090 return (res')
1091
1092
1093
1094 -- |Rate helper for bootstrapping over BMA swap rates.
1095 bmaSwapRateHelper :: (GenQuote q) -- ^liborFraction
1096 -> ((Int,TimeUnit)) -- ^tenor
1097 -> (Word) -- ^settlementDAys
1098 -> (Calendar) -> ((Int,TimeUnit)) -- ^bmpPeriod
1099 -> (BusinessDayConvention) -> (DayCounter) -> (BMAIndex) -> (GenIborIndex ibor) -> IO ((RateHelper))
1100 bmaSwapRateHelper a1 a2 a3 a4 a5 a6 a7 a8 a9 =
1101 withQuote a1 $ \a1' ->
1102 let {(a2'1, a2'2) = fromEnumQuantity a2} in
1103 let {a3' = fromIntegral a3} in
1104 withCalendar a4 $ \a4' ->
1105 let {(a5'1, a5'2) = fromEnumQuantity a5} in
1106 let {a6' = fromEnumC a6} in
1107 withDayCounter a7 $ \a7' ->
1108 withBMAIndex a8 $ \a8' ->
1109 withIborIndex a9 $ \a9' ->
1110 preErrorCheck $ \a10' ->
1111 bmaSwapRateHelper'_ a1' a2'1 a2'2 a3' a4' a5'1 a5'2 a6' a7' a8' a9' a10' >>= \res ->
1112 peekRateHelper res >>= \res' ->
1113 errorCheck a10'>>
1114 return (res')
1115
1116
1117
1118 -- |Rate helper for bootstrapping from multiple-resets swap quotes (a floating leg that resets
1119 -- several times per fixed-leg coupon period).
1120 multipleResetsSwapRateHelper :: (Word) -- ^settlementDays
1121 -> ((Int,TimeUnit)) -- ^tenor
1122 -> (GenQuote q1) -- ^fixedRate
1123 -> (GenIborIndex ibor) -> (Word) -- ^resetsPerCoupon
1124 -> (Maybe (GenYieldTermStructure y)) -- ^discountingCurve
1125 -> (RateAveragingType) -- ^averagingMethod
1126 -> (Double) -- ^spread
1127 -> (Frequency) -- ^fixedFrequency
1128 -> (DayCounter) -- ^fixedDayCount
1129 -> (BusinessDayConvention) -- ^fixedConvention
1130 -> IO ((RateHelper))
1131 multipleResetsSwapRateHelper a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 =
1132 let {a1' = fromIntegral a1} in
1133 let {(a2'1, a2'2) = fromEnumQuantity a2} in
1134 withQuote a3 $ \a3' ->
1135 withIborIndex a4 $ \a4' ->
1136 let {a5' = fromIntegral a5} in
1137 withMaybeYieldTermStructure a6 $ \a6' ->
1138 let {a7' = (fromIntegral . fromEnum) a7} in
1139 let {a8' = realToFrac a8} in
1140 let {a9' = (fromIntegral . fromEnum) a9} in
1141 withDayCounter a10 $ \a10' ->
1142 let {a11' = fromEnumC a11} in
1143 preErrorCheck $ \a12' ->
1144 multipleResetsSwapRateHelper'_ a1' a2'1 a2'2 a3' a4' a5' a6' a7' a8' a9' a10' a11' a12' >>= \res ->
1145 peekRateHelper res >>= \res' ->
1146 errorCheck a12'>>
1147 return (res')
1148
1149
1150
1151 -- |Rate helper for bootstrapping over FRA rates, taking its fixing/day-count conventions from an
1152 -- ibor index instead of explicit 'Calendar'\/'BusinessDayConvention'\/'DayCounter' arguments.
1153 fraIborRateHelper' :: (GenQuote q) -> (Word) -- ^monthsToStart
1154 -> (GenIborIndex ibor) -> (PillarChoice) -- ^pillar
1155 -> (Maybe Day) -- ^customPillarDate
1156 -> (Bool) -- ^useIndexedCoupon
1157 -> IO ((RateHelper))
1158 fraIborRateHelper' a1 a2 a3 a4 a5 a6 =
1159 withQuote a1 $ \a1' ->
1160 let {a2' = fromIntegral a2} in
1161 withIborIndex a3 $ \a3' ->
1162 let {a4' = (fromIntegral . fromEnum) a4} in
1163 withMaybeDay a5 $ \a5' ->
1164 let {a6' = C2HSImp.fromBool a6} in
1165 preErrorCheck $ \a7' ->
1166 fraIborRateHelper''_ a1' a2' a3' a4' a5' a6' a7' >>= \res ->
1167 peekRateHelper res >>= \res' ->
1168 errorCheck a7'>>
1169 return (res')
1170
1171
1172
1173 -- |Rate helper for bootstrapping over FRA rates, with the FRA period given as a start\/length
1174 -- pair rather than 'fraRateHelper''s monthsToStart\/monthsToEnd.
1175 fraRateHelper' :: (GenQuote q) -> ((Int,TimeUnit)) -- ^periodToStart
1176 -> (Word) -- ^lengthInMonths
1177 -> (Word) -- ^fixingDays
1178 -> (Calendar) -> (BusinessDayConvention) -> (Bool) -- ^endOfMonth
1179 -> (DayCounter) -> (PillarChoice) -- ^pillar
1180 -> (Maybe Day) -- ^customPillarDate
1181 -> (Bool) -- ^useIndexedCoupon
1182 -> IO ((RateHelper))
1183 fraRateHelper' a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 =
1184 withQuote a1 $ \a1' ->
1185 let {(a2'1, a2'2) = fromEnumQuantity a2} in
1186 let {a3' = fromIntegral a3} in
1187 let {a4' = fromIntegral a4} in
1188 withCalendar a5 $ \a5' ->
1189 let {a6' = fromEnumC a6} in
1190 let {a7' = C2HSImp.fromBool a7} in
1191 withDayCounter a8 $ \a8' ->
1192 let {a9' = (fromIntegral . fromEnum) a9} in
1193 withMaybeDay a10 $ \a10' ->
1194 let {a11' = C2HSImp.fromBool a11} in
1195 preErrorCheck $ \a12' ->
1196 fraRateHelper''_ a1' a2'1 a2'2 a3' a4' a5' a6' a7' a8' a9' a10' a11' a12' >>= \res ->
1197 peekRateHelper res >>= \res' ->
1198 errorCheck a12'>>
1199 return (res')
1200
1201
1202
1203 -- |Rate helper for bootstrapping over FRA rates, taking its conventions from an ibor index and
1204 -- the FRA period as a start\/length pair.
1205 fraIborRateHelper :: (GenQuote q) -> ((Int,TimeUnit)) -- ^periodToStart
1206 -> (GenIborIndex ibor) -> (PillarChoice) -- ^pillar
1207 -> (Maybe Day) -- ^customPillarDate
1208 -> (Bool) -- ^useIndexedCoupon
1209 -> IO ((RateHelper))
1210 fraIborRateHelper a1 a2 a3 a4 a5 a6 =
1211 withQuote a1 $ \a1' ->
1212 let {(a2'1, a2'2) = fromEnumQuantity a2} in
1213 withIborIndex a3 $ \a3' ->
1214 let {a4' = (fromIntegral . fromEnum) a4} in
1215 withMaybeDay a5 $ \a5' ->
1216 let {a6' = C2HSImp.fromBool a6} in
1217 preErrorCheck $ \a7' ->
1218 fraIborRateHelper'_ a1' a2'1 a2'2 a3' a4' a5' a6' a7' >>= \res ->
1219 peekRateHelper res >>= \res' ->
1220 errorCheck a7'>>
1221 return (res')
1222
1223
1224
1225 -- |Rate helper for bootstrapping over IborIndex futures prices, given explicit start\/end dates.
1226 futuresRateHelper' :: (GenQuote q1) -> (Day) -- ^immStartDate
1227 -> (Day) -- ^endDate
1228 -> (DayCounter) -> (Maybe (GenQuote q2)) -- ^convexityAdjustment
1229 -> (FuturesType) -- ^type
1230 -> IO ((RateHelper))
1231 futuresRateHelper' a1 a2 a3 a4 a5 a6 =
1232 withQuote a1 $ \a1' ->
1233 withDay a2 $ \a2' ->
1234 withDay a3 $ \a3' ->
1235 withDayCounter a4 $ \a4' ->
1236 withMaybeQuote a5 $ \a5' ->
1237 let {a6' = (fromIntegral . fromEnum) a6} in
1238 preErrorCheck $ \a7' ->
1239 futuresRateHelper''_ a1' a2' a3' a4' a5' a6' a7' >>= \res ->
1240 peekRateHelper res >>= \res' ->
1241 errorCheck a7'>>
1242 return (res')
1243
1244
1245
1246 -- |Rate helper for bootstrapping over IborIndex futures prices, taking its conventions from an
1247 -- ibor index.
1248 futuresIborRateHelper :: (GenQuote q1) -> (Day) -- ^immDate
1249 -> (GenIborIndex ibor) -> (Maybe (GenQuote q2)) -> IO ((RateHelper))
1250 futuresIborRateHelper a1 a2 a3 a4 =
1251 withQuote a1 $ \a1' ->
1252 withDay a2 $ \a2' ->
1253 withIborIndex a3 $ \a3' ->
1254 withMaybeQuote a4 $ \a4' ->
1255 preErrorCheck $ \a5' ->
1256 futuresIborRateHelper'_ a1' a2' a3' a4' a5' >>= \res ->
1257 peekRateHelper res >>= \res' ->
1258 errorCheck a5'>>
1259 return (res')
1260
1261
1262
1263 -- |Rate helper for bootstrapping over IborIndex futures prices, given explicit
1264 -- calendar\/convention\/day-counter conventions.
1265 futuresRateHelper :: (GenQuote q1) -> (Day) -- ^immDate
1266 -> (Word) -- ^lengthInMonths
1267 -> (Calendar) -> (BusinessDayConvention) -> (Bool) -- ^endOfMonth
1268 -> (DayCounter) -> (Maybe (GenQuote q2)) -- ^convexityAdjustment
1269 -> (FuturesType) -- ^type
1270 -> IO ((RateHelper))
1271 futuresRateHelper a1 a2 a3 a4 a5 a6 a7 a8 a9 =
1272 withQuote a1 $ \a1' ->
1273 withDay a2 $ \a2' ->
1274 let {a3' = fromIntegral a3} in
1275 withCalendar a4 $ \a4' ->
1276 let {a5' = fromEnumC a5} in
1277 let {a6' = C2HSImp.fromBool a6} in
1278 withDayCounter a7 $ \a7' ->
1279 withMaybeQuote a8 $ \a8' ->
1280 let {a9' = (fromIntegral . fromEnum) a9} in
1281 preErrorCheck $ \a10' ->
1282 futuresRateHelper'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' a10' >>= \res ->
1283 peekRateHelper res >>= \res' ->
1284 errorCheck a10'>>
1285 return (res')
1286
1287
1288
1289 -- |Rate helper for bootstrapping over overnight-index compounding futures.
1290 overnightIndexFutureRateHelper :: (GenQuote q1) -> (Day) -- ^valueDate
1291 -> (Day) -- ^maturityDate
1292 -> (OvernightIborIndex) -> (Maybe (GenQuote q2)) -- ^convexityAdjustment
1293 -> (RateAveragingType) -- ^averagingMethod
1294 -> (PillarChoice) -- ^pillar
1295 -> (Maybe Day) -- ^customPillarDate
1296 -> IO ((RateHelper))
1297 overnightIndexFutureRateHelper a1 a2 a3 a4 a5 a6 a7 a8 =
1298 withQuote a1 $ \a1' ->
1299 withDay a2 $ \a2' ->
1300 withDay a3 $ \a3' ->
1301 withOvernightIborIndex a4 $ \a4' ->
1302 withMaybeQuote a5 $ \a5' ->
1303 let {a6' = (fromIntegral . fromEnum) a6} in
1304 let {a7' = (fromIntegral . fromEnum) a7} in
1305 withMaybeDay a8 $ \a8' ->
1306 preErrorCheck $ \a9' ->
1307 overnightIndexFutureRateHelper'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' >>= \res ->
1308 peekRateHelper res >>= \res' ->
1309 errorCheck a9'>>
1310 return (res')
1311
1312
1313
1314 -- |Rate helper for bootstrapping over CME SOFR futures. Compounds overnight SOFR from the third
1315 -- Wednesday of 'referenceMonth'\/'referenceYear' (inclusive) to the third Wednesday of the
1316 -- following month or quarter (exclusive), per 'referenceFreq'.
1317 sofrFutureRateHelper :: (GenQuote q1) -> (Month) -- ^referenceMonth
1318 -> (Int) -- ^referenceYear
1319 -> (Frequency) -- ^referenceFreq
1320 -> (Maybe (GenQuote q2)) -- ^convexityAdjustment
1321 -> (PillarChoice) -- ^pillar
1322 -> (Maybe Day) -- ^customPillarDate
1323 -> IO ((RateHelper))
1324 sofrFutureRateHelper a1 a2 a3 a4 a5 a6 a7 =
1325 withQuote a1 $ \a1' ->
1326 let {a2' = (fromIntegral . fromEnum) a2} in
1327 let {a3' = fromIntegral a3} in
1328 let {a4' = (fromIntegral . fromEnum) a4} in
1329 withMaybeQuote a5 $ \a5' ->
1330 let {a6' = (fromIntegral . fromEnum) a6} in
1331 withMaybeDay a7 $ \a7' ->
1332 preErrorCheck $ \a8' ->
1333 sofrFutureRateHelper'_ a1' a2' a3' a4' a5' a6' a7' a8' >>= \res ->
1334 peekRateHelper res >>= \res' ->
1335 errorCheck a8'>>
1336 return (res')
1337
1338
1339
1340 -- |The quote value implied by the current bootstrapped state of the curve the helper was
1341 -- last used against, i.e. what the helper's own market quote would need to be to make it
1342 -- reprice exactly.
1343 impliedQuote :: (GenRateHelper rh) -> IO ((Double))
1344 impliedQuote a1 =
1345 withRateHelper a1 $ \a1' ->
1346 preErrorCheck $ \a2' ->
1347 impliedQuote'_ a1' a2' >>= \res ->
1348 let {res' = realToFrac res} in
1349 errorCheck a2'>>
1350 return (res')
1351
1352
1353
1354 -- |A yield curve identical to 'baseCurve' but reporting a different reference date; observes
1355 -- and stays linked to 'baseCurve'.
1356 impliedTermStructure :: (GenYieldTermStructure y) -> (Day) -> IO ((YieldTermStructure))
1357 impliedTermStructure a1 a2 =
1358 withYieldTermStructure a1 $ \a1' ->
1359 withDay a2 $ \a2' ->
1360 preErrorCheck $ \a3' ->
1361 impliedTermStructure'_ a1' a2' a3' >>= \res ->
1362 peekYieldTermStructure res >>= \res' ->
1363 errorCheck a3'>>
1364 return (res')
1365
1366
1367
1368 -- |A yield curve with a vector of zero-yield spreads added to 'baseCurve', interpolating
1369 -- between the given dates with the given 'Interpolation'. Remains linked to changes in
1370 -- 'baseCurve' or the spread quotes.
1371 piecewiseZeroSpreadedTermStructure :: GenYieldTermStructure y
1372 -> [(Day, GenQuote q)] -- ^spreads
1373 -> Compounding -> Frequency -> Interpolation -> IO YieldTermStructure
1374 piecewiseZeroSpreadedTermStructure ts qd c f i = uncurryNested (qlPiecewiseZeroSpreadedTermStructure ts qs ds c f) (qlInterpolation i)
1375 where (ds, qs) = unzip qd
1376 qlPiecewiseZeroSpreadedTermStructure :: (GenYieldTermStructure y) -> ([GenQuote q]) -> ([Day]) -> (Compounding) -> (Frequency) -> (Int) -> (Int) -> (Int) -> IO ((YieldTermStructure))
1377 qlPiecewiseZeroSpreadedTermStructure a1 a2 a3 a4 a5 a6 a7 a8 =
1378 withYieldTermStructure a1 $ \a1' ->
1379 withQuoteArray a2 $ \(a2'1, a2'2) ->
1380 withDayArray a3 $ \(a3'1, a3'2) ->
1381 let {a4' = (fromIntegral . fromEnum) a4} in
1382 let {a5' = (fromIntegral . fromEnum) a5} in
1383 let {a6' = fromIntegral a6} in
1384 let {a7' = fromIntegral a7} in
1385 let {a8' = fromIntegral a8} in
1386 preErrorCheck $ \a9' ->
1387 qlPiecewiseZeroSpreadedTermStructure'_ a1' a2'1 a2'2 a3'1 a3'2 a4' a5' a6' a7' a8' a9' >>= \res ->
1388 peekYieldTermStructure res >>= \res' ->
1389 errorCheck a9'>>
1390 return (res')
1391
1392
1393
1394 -- |Quanto term structure, modelling the quanto effect in option pricing. Stays linked to all
1395 -- four inputs.
1396 quantoTermStructure :: (GenYieldTermStructure y1) -- ^underlyingDividendTS
1397 -> (GenYieldTermStructure y2) -- ^riskFreeTS
1398 -> (GenYieldTermStructure y3) -- ^foreignRsikFreeTS
1399 -> (GenBlackVolTermStructure bv1) -- ^underlyingBlackVolTS
1400 -> (Double) -- ^strike
1401 -> (GenBlackVolTermStructure bv2) -- ^exchRateBlackVolTS
1402 -> (Double) -- ^exchRateATMlevel
1403 -> (Double) -- ^underlyingExchRateCorrelation
1404 -> IO ((YieldTermStructure))
1405 quantoTermStructure a1 a2 a3 a4 a5 a6 a7 a8 =
1406 withYieldTermStructure a1 $ \a1' ->
1407 withYieldTermStructure a2 $ \a2' ->
1408 withYieldTermStructure a3 $ \a3' ->
1409 withBlackVolTermStructure a4 $ \a4' ->
1410 let {a5' = realToFrac a5} in
1411 withBlackVolTermStructure a6 $ \a6' ->
1412 let {a7' = realToFrac a7} in
1413 let {a8' = realToFrac a8} in
1414 preErrorCheck $ \a9' ->
1415 quantoTermStructure'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' >>= \res ->
1416 peekYieldTermStructure res >>= \res' ->
1417 errorCheck a9'>>
1418 return (res')
1419
1420
1421
1422 -- |Blends 'originalCurve' with an ultimate forward rate beyond the last liquid point, per the
1423 -- \"UFR\" methodology used for extrapolating long-dated (e.g. Solvency II) curves.
1424 ultimateForwardTermStructure :: (GenYieldTermStructure y) -- ^originalCurve
1425 -> (GenQuote q1) -- ^lastLiquidForwardRate
1426 -> (GenQuote q2) -- ^ultimateForwardRate
1427 -> ((Int,TimeUnit)) -- ^firstSmoothingPoint
1428 -> (Double) -- ^alpha
1429 -> (Maybe Int) -- ^roundingDigits
1430 -> (Compounding) -> (Frequency) -> IO ((YieldTermStructure))
1431 ultimateForwardTermStructure a1 a2 a3 a4 a5 a6 a7 a8 =
1432 withYieldTermStructure a1 $ \a1' ->
1433 withQuote a2 $ \a2' ->
1434 withQuote a3 $ \a3' ->
1435 let {(a4'1, a4'2) = fromEnumQuantity a4} in
1436 let {a5' = realToFrac a5} in
1437 let {a6' = fromMaybeInt a6} in
1438 let {a7' = (fromIntegral . fromEnum) a7} in
1439 let {a8' = (fromIntegral . fromEnum) a8} in
1440 preErrorCheck $ \a9' ->
1441 ultimateForwardTermStructure'_ a1' a2' a3' a4'1 a4'2 a5' a6' a7' a8' a9' >>= \res ->
1442 peekYieldTermStructure res >>= \res' ->
1443 errorCheck a9'>>
1444 return (res')
1445
1446
1447
1448 -- |Term structure bootstrapped to reprice a set of 'instruments', one interpolated segment per
1449 -- instrument, iteratively (pillar by pillar): each bootstrapped instrument's maturity ends its
1450 -- own segment, and reprices correctly on the resulting curve. Fixed reference date.
1451 piecewiseYieldCurve :: Day -- ^referenceDate
1452 -> [GenRateHelper rh] -- ^instruments
1453 -> DayCounter -- ^dayCounter
1454 -> [(Day, GenQuote q)] -- ^jumps
1455 -> BootstrapTrait -- ^bootstrap trait
1456 -> Interpolation -- ^interpolator
1457 -> IO YieldTermStructure
1458 piecewiseYieldCurve d r dc qd t i = uncurryNested (qlPiecewiseYieldCurve d r dc qs ds t) (qlInterpolation i) where (ds, qs) = unzip qd
1459 qlPiecewiseYieldCurve :: (Day) -> ([GenRateHelper rh]) -> (DayCounter) -> ([GenQuote q]) -> ([Day]) -> (BootstrapTrait) -> (Int) -> (Int) -> (Int) -> IO ((YieldTermStructure))
1460 qlPiecewiseYieldCurve a1 a2 a3 a4 a5 a6 a7 a8 a9 =
1461 withDay a1 $ \a1' ->
1462 withRateHelperArray a2 $ \(a2'1, a2'2) ->
1463 withDayCounter a3 $ \a3' ->
1464 withQuoteArray a4 $ \(a4'1, a4'2) ->
1465 withDayArray a5 $ \(a5'1, a5'2) ->
1466 let {a6' = (fromIntegral . fromEnum) a6} in
1467 let {a7' = fromIntegral a7} in
1468 let {a8' = fromIntegral a8} in
1469 let {a9' = fromIntegral a9} in
1470 preErrorCheck $ \a10' ->
1471 qlPiecewiseYieldCurve'_ a1' a2'1 a2'2 a3' a4'1 a4'2 a5'1 a5'2 a6' a7' a8' a9' a10' >>= \res ->
1472 peekYieldTermStructure res >>= \res' ->
1473 errorCheck a10'>>
1474 return (res')
1475
1476
1477
1478 -- |Like 'piecewiseYieldCurve', but with a reference date that moves with the evaluation date
1479 -- (settlement days on 'calendar'), and lets extrapolation past the curve's max date be enabled.
1480 -- @IterativeBootstrap@, upstream's default bootstrapper, with default settings -- see
1481 -- 'piecewiseYieldCurve2'' for choosing a different bootstrapper (@GlobalBootstrap@\/
1482 -- @LocalBootstrap@) or overriding @IterativeBootstrap@'s own settings; this is exactly
1483 -- @piecewiseYieldCurve2' ... ('Iterative' trait interpolator 'defaultIterativeBootstrapOpts') ...@.
1484 piecewiseYieldCurve' :: Word -- ^settlementDays
1485 -> Calendar -- ^calendar
1486 -> [GenRateHelper rh] -- ^instruments
1487 -> DayCounter -- ^dayCounter
1488 -> [(Day, GenQuote q)] -- ^jumps
1489 -> BootstrapTrait -- ^bootstrap trait
1490 -> Interpolation -- ^interpolator
1491 -> Bool -- ^extrapolate past the curve's max date
1492 -> IO YieldTermStructure
1493 piecewiseYieldCurve' s cal r dc qd t i ex =
1494 piecewiseYieldCurve2' s cal r dc qd (Iterative t i defaultIterativeBootstrapOpts) ex
1495
1496 -- |Like 'piecewiseYieldCurve', but exposes every @IterativeBootstrap@ setting through
1497 -- 'IterativeBootstrapOpts' instead of hardcoding upstream's defaults. Start from
1498 -- 'defaultIterativeBootstrapOpts' and override with record-update syntax; passing it
1499 -- unchanged is exactly 'piecewiseYieldCurve'. 'ibAccuracy'\/'ibMinValue'\/'ibMaxValue' are
1500 -- 'Maybe' because upstream defaults them to @Null\<Real\>()@ (\"pick a sensible value per
1501 -- pillar\"), not to a number. 'ibDontThrow' is the one to reach for when a curve fails to
1502 -- bootstrap: it substitutes the best value found so far for a pillar that won't solve,
1503 -- rather than throwing.
1504 piecewiseYieldCurveFull :: Day -- ^referenceDate
1505 -> [GenRateHelper rh] -- ^instruments
1506 -> DayCounter -- ^dayCounter
1507 -> [(Day, GenQuote q)] -- ^jumps
1508 -> BootstrapTrait -- ^bootstrap trait
1509 -> Interpolation -- ^interpolator
1510 -> IterativeBootstrapOpts -- ^bootstrap settings
1511 -> IO YieldTermStructure
1512 piecewiseYieldCurveFull d r dc qd t i b =
1513 uncurryNested (qlPiecewiseYieldCurveFull d r dc qs ds t) (qlInterpolation i)
1514 (nullableDouble (ibAccuracy b)) (nullableDouble (ibMinValue b)) (nullableDouble (ibMaxValue b))
1515 (ibMaxAttempts b) (ibMaxFactor b) (ibMinFactor b) (ibDontThrow b) (ibDontThrowSteps b) (ibMaxEvaluations b)
1516 where (ds, qs) = unzip qd
1517 qlPiecewiseYieldCurveFull :: (Day) -> ([GenRateHelper rh]) -> (DayCounter) -> ([GenQuote q]) -> ([Day]) -> (BootstrapTrait) -> (Int) -> (Int) -> (Int) -> (Double) -> (Double) -> (Double) -> (Word) -> (Double) -> (Double) -> (Bool) -> (Word) -> (Word) -> IO ((YieldTermStructure))
1518 qlPiecewiseYieldCurveFull a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 =
1519 withDay a1 $ \a1' ->
1520 withRateHelperArray a2 $ \(a2'1, a2'2) ->
1521 withDayCounter a3 $ \a3' ->
1522 withQuoteArray a4 $ \(a4'1, a4'2) ->
1523 withDayArray a5 $ \(a5'1, a5'2) ->
1524 let {a6' = (fromIntegral . fromEnum) a6} in
1525 let {a7' = fromIntegral a7} in
1526 let {a8' = fromIntegral a8} in
1527 let {a9' = fromIntegral a9} in
1528 let {a10' = realToFrac a10} in
1529 let {a11' = realToFrac a11} in
1530 let {a12' = realToFrac a12} in
1531 let {a13' = fromIntegral a13} in
1532 let {a14' = realToFrac a14} in
1533 let {a15' = realToFrac a15} in
1534 let {a16' = C2HSImp.fromBool a16} in
1535 let {a17' = fromIntegral a17} in
1536 let {a18' = fromIntegral a18} in
1537 preErrorCheck $ \a19' ->
1538 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 ->
1539 peekYieldTermStructure res >>= \res' ->
1540 errorCheck a19'>>
1541 return (res')
1542
1543
1544
1545 -- |'piecewiseYieldCurve'' with the same @IterativeBootstrap@ settings 'piecewiseYieldCurveFull'
1546 -- exposes; see there for what they mean.
1547 piecewiseYieldCurveFull' :: Word -- ^settlementDays
1548 -> Calendar -- ^calendar
1549 -> [GenRateHelper rh] -- ^instruments
1550 -> DayCounter -- ^dayCounter
1551 -> [(Day, GenQuote q)] -- ^jumps
1552 -> BootstrapTrait -- ^bootstrap trait
1553 -> Interpolation -- ^interpolator
1554 -> IterativeBootstrapOpts -- ^bootstrap settings
1555 -> Bool -- ^extrapolate past the curve's max date
1556 -> IO YieldTermStructure
1557 piecewiseYieldCurveFull' s cal r dc qd t i b ex =
1558 uncurryNested (qlPiecewiseYieldCurveFull1 s cal r dc qs ds t) (qlInterpolation i)
1559 (nullableDouble (ibAccuracy b)) (nullableDouble (ibMinValue b)) (nullableDouble (ibMaxValue b))
1560 (ibMaxAttempts b) (ibMaxFactor b) (ibMinFactor b) (ibDontThrow b) (ibDontThrowSteps b) (ibMaxEvaluations b) ex
1561 where (ds, qs) = unzip qd
1562 qlPiecewiseYieldCurveFull1 :: (Word) -> (Calendar) -> ([GenRateHelper rh]) -> (DayCounter) -> ([GenQuote q]) -> ([Day]) -> (BootstrapTrait) -> (Int) -> (Int) -> (Int) -> (Double) -> (Double) -> (Double) -> (Word) -> (Double) -> (Double) -> (Bool) -> (Word) -> (Word) -> (Bool) -> IO ((YieldTermStructure))
1563 qlPiecewiseYieldCurveFull1 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 a19 a20 =
1564 let {a1' = fromIntegral a1} in
1565 withCalendar a2 $ \a2' ->
1566 withRateHelperArray a3 $ \(a3'1, a3'2) ->
1567 withDayCounter a4 $ \a4' ->
1568 withQuoteArray a5 $ \(a5'1, a5'2) ->
1569 withDayArray a6 $ \(a6'1, a6'2) ->
1570 let {a7' = (fromIntegral . fromEnum) a7} in
1571 let {a8' = fromIntegral a8} in
1572 let {a9' = fromIntegral a9} in
1573 let {a10' = fromIntegral a10} in
1574 let {a11' = realToFrac a11} in
1575 let {a12' = realToFrac a12} in
1576 let {a13' = realToFrac a13} in
1577 let {a14' = fromIntegral a14} in
1578 let {a15' = realToFrac a15} in
1579 let {a16' = realToFrac a16} in
1580 let {a17' = C2HSImp.fromBool a17} in
1581 let {a18' = fromIntegral a18} in
1582 let {a19' = fromIntegral a19} in
1583 let {a20' = C2HSImp.fromBool a20} in
1584 preErrorCheck $ \a21' ->
1585 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 ->
1586 peekYieldTermStructure res >>= \res' ->
1587 errorCheck a21'>>
1588 return (res')
1589
1590
1591
1592 -- |Like 'piecewiseYieldCurve'', but bootstraps with QuantLib's @GlobalBootstrap@ instead of
1593 -- @IterativeBootstrap@ -- all instruments (and, for a 'MultiCurve' cycle, all member curves) are
1594 -- solved for together under one optimizer, rather than pillar-by-pillar. This is what lets a
1595 -- rate helper reference another curve's not-yet-bootstrapped handle: see the \"relinkable
1596 -- handles\" tests in "QuantLib.Spec.TermStructure" for the two-curve cycle this exists for.
1597 -- Hardcodes trait=Discount\/interpolator=LogLinear in its own shim (the only combination this
1598 -- dispatch supports, per CLAUDE.md's dispatch-table-scope note) rather than taking
1599 -- 'BootstrapTrait'\/'Interpolation' params. 'instrumentWeights' is upstream's
1600 -- @GlobalBootstrap@ constructor's trailing @instrumentWeights@ parameter -- an empty list
1601 -- reproduces its default (equal weighting); a non-empty one must have one entry per alive
1602 -- instrument. The @additionalHelpers@\/@additionalDates@\/@additionalPenalties@\/
1603 -- @additionalVariables@ overloads (functor callbacks into the optimizer) are not bound -- see
1604 -- README's # TODO.
1605 piecewiseYieldCurveGlobalBootstrap' :: Word -- ^settlementDays
1606 -> Calendar -- ^calendar
1607 -> [GenRateHelper rh] -- ^instruments
1608 -> DayCounter -- ^dayCounter
1609 -> [(Day, GenQuote q)] -- ^jumps
1610 -> Double -- ^accuracy
1611 -> [Double] -- ^instrumentWeights (empty for upstream's default equal weighting)
1612 -> Bool -- ^extrapolate past the curve's max date
1613 -> IO YieldTermStructure
1614 piecewiseYieldCurveGlobalBootstrap' s cal r dc qd acc w ex =
1615 piecewiseYieldCurve2' s cal r dc qd (GlobalDiscountLogLinear acc w) ex
1616 qlPiecewiseYieldCurveGlobalBootstrap1 :: (Word) -> (Calendar) -> ([GenRateHelper rh]) -> (DayCounter) -> ([GenQuote q]) -> ([Day]) -> (Double) -> ([Double]) -> (Bool) -> IO ((YieldTermStructure))
1617 qlPiecewiseYieldCurveGlobalBootstrap1 a1 a2 a3 a4 a5 a6 a7 a8 a9 =
1618 let {a1' = fromIntegral a1} in
1619 withCalendar a2 $ \a2' ->
1620 withRateHelperArray a3 $ \(a3'1, a3'2) ->
1621 withDayCounter a4 $ \a4' ->
1622 withQuoteArray a5 $ \(a5'1, a5'2) ->
1623 withDayArray a6 $ \(a6'1, a6'2) ->
1624 let {a7' = realToFrac a7} in
1625 withDoubleArray a8 $ \(a8'1, a8'2) ->
1626 let {a9' = C2HSImp.fromBool a9} in
1627 preErrorCheck $ \a10' ->
1628 qlPiecewiseYieldCurveGlobalBootstrap1'_ a1' a2' a3'1 a3'2 a4' a5'1 a5'2 a6'1 a6'2 a7' a8'1 a8'2 a9' a10' >>= \res ->
1629 peekYieldTermStructure res >>= \res' ->
1630 errorCheck a10'>>
1631 return (res')
1632
1633
1634
1635 -- |Like 'piecewiseYieldCurveGlobalBootstrap'', but hardcodes trait=SimpleZeroYield\/
1636 -- interpolator=Linear instead of trait=Discount\/interpolator=LogLinear -- QuantLib-SWIG's only
1637 -- bound @GlobalBootstrap@ combination (@GlobalLinearSimpleZeroCurve@).
1638 piecewiseYieldCurveGlobalBootstrapSimpleZeroLinear' :: Word -- ^settlementDays
1639 -> Calendar -- ^calendar
1640 -> [GenRateHelper rh] -- ^instruments
1641 -> DayCounter -- ^dayCounter
1642 -> [(Day, GenQuote q)] -- ^jumps
1643 -> Double -- ^accuracy
1644 -> [Double] -- ^instrumentWeights (empty for upstream's default equal weighting)
1645 -> Bool -- ^extrapolate past the curve's max date
1646 -> IO YieldTermStructure
1647 piecewiseYieldCurveGlobalBootstrapSimpleZeroLinear' s cal r dc qd acc w ex =
1648 piecewiseYieldCurve2' s cal r dc qd (GlobalSimpleZeroLinear acc w) ex
1649 qlPiecewiseYieldCurveGlobalBootstrap2 :: (Word) -> (Calendar) -> ([GenRateHelper rh]) -> (DayCounter) -> ([GenQuote q]) -> ([Day]) -> (Double) -> ([Double]) -> (Bool) -> IO ((YieldTermStructure))
1650 qlPiecewiseYieldCurveGlobalBootstrap2 a1 a2 a3 a4 a5 a6 a7 a8 a9 =
1651 let {a1' = fromIntegral a1} in
1652 withCalendar a2 $ \a2' ->
1653 withRateHelperArray a3 $ \(a3'1, a3'2) ->
1654 withDayCounter a4 $ \a4' ->
1655 withQuoteArray a5 $ \(a5'1, a5'2) ->
1656 withDayArray a6 $ \(a6'1, a6'2) ->
1657 let {a7' = realToFrac a7} in
1658 withDoubleArray a8 $ \(a8'1, a8'2) ->
1659 let {a9' = C2HSImp.fromBool a9} in
1660 preErrorCheck $ \a10' ->
1661 qlPiecewiseYieldCurveGlobalBootstrap2'_ a1' a2' a3'1 a3'2 a4' a5'1 a5'2 a6'1 a6'2 a7' a8'1 a8'2 a9' a10' >>= \res ->
1662 peekYieldTermStructure res >>= \res' ->
1663 errorCheck a10'>>
1664 return (res')
1665
1666
1667
1668 -- |Like 'piecewiseYieldCurveGlobalBootstrapSimpleZeroLinear'', but bootstraps with
1669 -- @GlobalBootstrap@'s functor-callback constructor instead of the plain @accuracy@\/
1670 -- @instrumentWeights@ one -- upstream QuantLib-SWIG's canned @AdditionalErrors@\/@AdditionalDates@
1671 -- functors (see README's # TODO), constructed internally from @additionalHelpers@\/
1672 -- @additionalDates@ rather than taking the formula itself as a parameter (it's fixed, not a
1673 -- user-supplied callback). @additionalDates@ must have exactly @length additionalHelpers - 2@
1674 -- entries -- @AdditionalErrors@' fixed linear-interpolation formula produces that many
1675 -- equations, and @GlobalBootstrap@ requires equations to match unknowns; a mismatch raises a
1676 -- 'QuantLib.Type.Error' naming both counts.
1677 piecewiseYieldCurveGlobalBootstrapSimpleZeroLinearFull' :: Word -- ^settlementDays
1678 -> Calendar -- ^calendar
1679 -> [GenRateHelper rh1] -- ^instruments
1680 -> DayCounter -- ^dayCounter
1681 -> [(Day, GenQuote q)] -- ^jumps
1682 -> [GenRateHelper rh2] -- ^additionalHelpers
1683 -> [Day] -- ^additionalDates (length must be @length additionalHelpers - 2@)
1684 -> Double -- ^accuracy
1685 -> Bool -- ^extrapolate past the curve's max date
1686 -> IO YieldTermStructure
1687 piecewiseYieldCurveGlobalBootstrapSimpleZeroLinearFull' s cal r dc qd ar ad acc ex =
1688 piecewiseYieldCurve2' s cal r dc qd (GlobalSimpleZeroLinearFull ar ad acc) ex
1689 qlPiecewiseYieldCurveGlobalBootstrap3 :: (Word) -> (Calendar) -> ([GenRateHelper rh1]) -> (DayCounter) -> ([GenQuote q]) -> ([Day]) -> ([GenRateHelper rh2]) -> ([Day]) -> (Double) -> (Bool) -> IO ((YieldTermStructure))
1690 qlPiecewiseYieldCurveGlobalBootstrap3 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 =
1691 let {a1' = fromIntegral a1} in
1692 withCalendar a2 $ \a2' ->
1693 withRateHelperArray a3 $ \(a3'1, a3'2) ->
1694 withDayCounter a4 $ \a4' ->
1695 withQuoteArray a5 $ \(a5'1, a5'2) ->
1696 withDayArray a6 $ \(a6'1, a6'2) ->
1697 withRateHelperArray a7 $ \(a7'1, a7'2) ->
1698 withDayArray a8 $ \(a8'1, a8'2) ->
1699 let {a9' = realToFrac a9} in
1700 let {a10' = C2HSImp.fromBool a10} in
1701 preErrorCheck $ \a11' ->
1702 qlPiecewiseYieldCurveGlobalBootstrap3'_ a1' a2' a3'1 a3'2 a4' a5'1 a5'2 a6'1 a6'2 a7'1 a7'2 a8'1 a8'2 a9' a10' a11' >>= \res ->
1703 peekYieldTermStructure res >>= \res' ->
1704 errorCheck a11'>>
1705 return (res')
1706
1707
1708
1709 -- |Like 'piecewiseYieldCurveGlobalBootstrap'', but hardcodes trait=ForwardRate\/interpolator=Linear
1710 -- instead of trait=Discount\/interpolator=LogLinear -- the other two 'IterativeBootstrap' traits
1711 -- paired with the cheapest interpolator (github issue #15).
1712 piecewiseYieldCurveGlobalBootstrapForwardRateLinear' :: Word -- ^settlementDays
1713 -> Calendar -- ^calendar
1714 -> [GenRateHelper rh] -- ^instruments
1715 -> DayCounter -- ^dayCounter
1716 -> [(Day, GenQuote q)] -- ^jumps
1717 -> Double -- ^accuracy
1718 -> [Double] -- ^instrumentWeights (empty for upstream's default equal weighting)
1719 -> Bool -- ^extrapolate past the curve's max date
1720 -> IO YieldTermStructure
1721 piecewiseYieldCurveGlobalBootstrapForwardRateLinear' s cal r dc qd acc w ex =
1722 piecewiseYieldCurve2' s cal r dc qd (GlobalForwardRateLinear acc w) ex
1723 qlPiecewiseYieldCurveGlobalBootstrap4 :: (Word) -> (Calendar) -> ([GenRateHelper rh]) -> (DayCounter) -> ([GenQuote q]) -> ([Day]) -> (Double) -> ([Double]) -> (Bool) -> IO ((YieldTermStructure))
1724 qlPiecewiseYieldCurveGlobalBootstrap4 a1 a2 a3 a4 a5 a6 a7 a8 a9 =
1725 let {a1' = fromIntegral a1} in
1726 withCalendar a2 $ \a2' ->
1727 withRateHelperArray a3 $ \(a3'1, a3'2) ->
1728 withDayCounter a4 $ \a4' ->
1729 withQuoteArray a5 $ \(a5'1, a5'2) ->
1730 withDayArray a6 $ \(a6'1, a6'2) ->
1731 let {a7' = realToFrac a7} in
1732 withDoubleArray a8 $ \(a8'1, a8'2) ->
1733 let {a9' = C2HSImp.fromBool a9} in
1734 preErrorCheck $ \a10' ->
1735 qlPiecewiseYieldCurveGlobalBootstrap4'_ a1' a2' a3'1 a3'2 a4' a5'1 a5'2 a6'1 a6'2 a7' a8'1 a8'2 a9' a10' >>= \res ->
1736 peekYieldTermStructure res >>= \res' ->
1737 errorCheck a10'>>
1738 return (res')
1739
1740
1741
1742 -- |Like 'piecewiseYieldCurveGlobalBootstrap'', but hardcodes trait=ZeroYield\/interpolator=Linear
1743 -- instead of trait=Discount\/interpolator=LogLinear.
1744 piecewiseYieldCurveGlobalBootstrapZeroYieldLinear' :: Word -- ^settlementDays
1745 -> Calendar -- ^calendar
1746 -> [GenRateHelper rh] -- ^instruments
1747 -> DayCounter -- ^dayCounter
1748 -> [(Day, GenQuote q)] -- ^jumps
1749 -> Double -- ^accuracy
1750 -> [Double] -- ^instrumentWeights (empty for upstream's default equal weighting)
1751 -> Bool -- ^extrapolate past the curve's max date
1752 -> IO YieldTermStructure
1753 piecewiseYieldCurveGlobalBootstrapZeroYieldLinear' s cal r dc qd acc w ex =
1754 piecewiseYieldCurve2' s cal r dc qd (GlobalZeroYieldLinear acc w) ex
1755 qlPiecewiseYieldCurveGlobalBootstrap5 :: (Word) -> (Calendar) -> ([GenRateHelper rh]) -> (DayCounter) -> ([GenQuote q]) -> ([Day]) -> (Double) -> ([Double]) -> (Bool) -> IO ((YieldTermStructure))
1756 qlPiecewiseYieldCurveGlobalBootstrap5 a1 a2 a3 a4 a5 a6 a7 a8 a9 =
1757 let {a1' = fromIntegral a1} in
1758 withCalendar a2 $ \a2' ->
1759 withRateHelperArray a3 $ \(a3'1, a3'2) ->
1760 withDayCounter a4 $ \a4' ->
1761 withQuoteArray a5 $ \(a5'1, a5'2) ->
1762 withDayArray a6 $ \(a6'1, a6'2) ->
1763 let {a7' = realToFrac a7} in
1764 withDoubleArray a8 $ \(a8'1, a8'2) ->
1765 let {a9' = C2HSImp.fromBool a9} in
1766 preErrorCheck $ \a10' ->
1767 qlPiecewiseYieldCurveGlobalBootstrap5'_ a1' a2' a3'1 a3'2 a4' a5'1 a5'2 a6'1 a6'2 a7' a8'1 a8'2 a9' a10' >>= \res ->
1768 peekYieldTermStructure res >>= \res' ->
1769 errorCheck a10'>>
1770 return (res')
1771
1772
1773
1774 -- |Like 'piecewiseYieldCurve'', but bootstraps with QuantLib's @LocalBootstrap@ instead of
1775 -- @IterativeBootstrap@ -- each interpolated segment is solved from a local window of
1776 -- @localisation@ neighbouring instruments rather than pillar-by-pillar over the whole curve,
1777 -- giving a localised risk profile with a smoother (non-local) interpolation method.
1778 -- @LocalBootstrap@'s upstream 'localInterpolate' requirement is met only by @ConvexMonotone@
1779 -- (Hagan\/West \"Interpolation Methods for Curve Construction\"), so the interpolator is
1780 -- hardcoded to @ConvexMonotone@ in the shim -- not a 'Interpolation' parameter here, the same
1781 -- way 'piecewiseYieldCurveGlobalBootstrap'' hardcodes its own interpolator. @localisation@\/
1782 -- @forcePositive@\/@accuracy@ are @LocalBootstrap@'s own constructor parameters;
1783 -- @quadraticity@\/@monotonicity@\/@convexForcePositive@ are @ConvexMonotone@'s (upstream
1784 -- defaults 0.3\/0.7\/'True'). 'Discount' is rejected with a 'QuantLib.Type.Error': verified
1785 -- (against a standalone reproduction with the same installed QuantLib, independent of hasquant)
1786 -- to return numerically wrong discount factors with this bootstrapper\/interpolator pair,
1787 -- regardless of @accuracy@ or the input quotes -- use 'ForwardRate', 'ZeroYield' or
1788 -- 'SimpleZeroYield' instead, all three of which reprice correctly. Matches upstream's own
1789 -- @test-suite\/piecewiseyieldcurve.cpp@, whose only @LocalBootstrap@+@ConvexMonotone@ coverage
1790 -- uses 'ForwardRate', never 'Discount'.
1791 piecewiseYieldCurveLocalBootstrap' :: Word -- ^settlementDays
1792 -> Calendar -- ^calendar
1793 -> [GenRateHelper rh] -- ^instruments
1794 -> DayCounter -- ^dayCounter
1795 -> [(Day, GenQuote q)] -- ^jumps
1796 -> BootstrapTrait -- ^bootstrap trait ('Discount' is rejected, see above)
1797 -> Word -- ^localisation
1798 -> Bool -- ^forcePositive (LocalBootstrap's)
1799 -> Double -- ^accuracy
1800 -> Double -- ^quadraticity (ConvexMonotone's)
1801 -> Double -- ^monotonicity (ConvexMonotone's)
1802 -> Bool -- ^convexForcePositive (ConvexMonotone's)
1803 -> Bool -- ^extrapolate past the curve's max date
1804 -> IO YieldTermStructure
1805 -- Not delegated to piecewiseYieldCurve2': this function's signature takes the full
1806 -- 'BootstrapTrait' (including 'Discount', for backward compatibility) and raises a
1807 -- 'QuantLib.Type.Error' for it at runtime via the C shim's own QL_FAIL, whereas 'Local' takes
1808 -- 'LocalBootstrapTrait', which has no 'Discount' case to convert from -- see 'Bootstrap'.
1809 piecewiseYieldCurveLocalBootstrap' s cal r dc qd t loc fp acc q m cfp ex =
1810 qlPiecewiseYieldCurveLocalBootstrap1 s cal r dc qs ds t loc fp acc q m cfp ex where (ds, qs) = unzip qd
1811 qlPiecewiseYieldCurveLocalBootstrap1 :: (Word) -> (Calendar) -> ([GenRateHelper rh]) -> (DayCounter) -> ([GenQuote q]) -> ([Day]) -> (BootstrapTrait) -> (Word) -> (Bool) -> (Double) -> (Double) -> (Double) -> (Bool) -> (Bool) -> IO ((YieldTermStructure))
1812 qlPiecewiseYieldCurveLocalBootstrap1 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 =
1813 let {a1' = fromIntegral a1} in
1814 withCalendar a2 $ \a2' ->
1815 withRateHelperArray a3 $ \(a3'1, a3'2) ->
1816 withDayCounter a4 $ \a4' ->
1817 withQuoteArray a5 $ \(a5'1, a5'2) ->
1818 withDayArray a6 $ \(a6'1, a6'2) ->
1819 let {a7' = (fromIntegral . fromEnum) a7} in
1820 let {a8' = fromIntegral a8} in
1821 let {a9' = C2HSImp.fromBool a9} in
1822 let {a10' = realToFrac a10} in
1823 let {a11' = realToFrac a11} in
1824 let {a12' = realToFrac a12} in
1825 let {a13' = C2HSImp.fromBool a13} in
1826 let {a14' = C2HSImp.fromBool a14} in
1827 preErrorCheck $ \a15' ->
1828 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 ->
1829 peekYieldTermStructure res >>= \res' ->
1830 errorCheck a15'>>
1831 return (res')
1832
1833
1834
1835 -- |Selects which of QuantLib's three @PiecewiseYieldCurve@ bootstrappers 'piecewiseYieldCurve2''
1836 -- uses, and carries exactly the parameters valid for that choice -- no combination this ADT can
1837 -- express is rejected at runtime by 'piecewiseYieldCurve2'' (contrast 'piecewiseYieldCurveLocalBootstrap''
1838 -- above, which still takes a full 'BootstrapTrait' and rejects 'Discount' with a
1839 -- 'QuantLib.Type.Error': 'Local' uses 'LocalBootstrapTrait' instead, which simply has no
1840 -- constructor for it). 'Iterative' is upstream's default bootstrapper (see 'piecewiseYieldCurve''\/
1841 -- 'piecewiseYieldCurveFull''); the three 'Global*' constructors and 'Local' mirror
1842 -- 'piecewiseYieldCurveGlobalBootstrap''\/'piecewiseYieldCurveGlobalBootstrapSimpleZeroLinear''\/
1843 -- 'piecewiseYieldCurveGlobalBootstrapSimpleZeroLinearFull''\/
1844 -- 'piecewiseYieldCurveGlobalBootstrapForwardRateLinear''\/
1845 -- 'piecewiseYieldCurveGlobalBootstrapZeroYieldLinear''\/'piecewiseYieldCurveLocalBootstrap''
1846 -- respectively -- see those functions' haddock for what each field means, since 'piecewiseYieldCurve2''
1847 -- dispatches straight through to the same shims they use.
1848 data Bootstrap rh2
1849 = Iterative BootstrapTrait Interpolation IterativeBootstrapOpts
1850 | GlobalDiscountLogLinear Double [Double] -- ^accuracy, instrumentWeights
1851 | GlobalSimpleZeroLinear Double [Double] -- ^accuracy, instrumentWeights
1852 | GlobalSimpleZeroLinearFull [GenRateHelper rh2] [Day] Double -- ^additionalHelpers, additionalDates, accuracy
1853 | GlobalForwardRateLinear Double [Double] -- ^accuracy, instrumentWeights
1854 | GlobalZeroYieldLinear Double [Double] -- ^accuracy, instrumentWeights
1855 | Local LocalBootstrapTrait Word Bool Double Double Double Bool
1856 -- ^trait, localisation, forcePositive (LocalBootstrap's), accuracy, quadraticity, monotonicity, convexForcePositive (ConvexMonotone's)
1857
1858 -- |'BootstrapTrait' restricted to the three traits 'piecewiseYieldCurveLocalBootstrap''\/'Local'
1859 -- accept -- 'Discount' has no constructor here because it is numerically unusable with
1860 -- @LocalBootstrap@\/@ConvexMonotone@ (see 'piecewiseYieldCurveLocalBootstrap''), not merely
1861 -- undesirable, so it is unrepresentable rather than rejected at runtime.
1862 data LocalBootstrapTrait = LForwardRate | LZeroYield | LSimpleZeroYield
1863 deriving (Show, Eq, Read)
1864
1865 fromBootstrapTrait :: LocalBootstrapTrait -> BootstrapTrait
1866 fromBootstrapTrait LForwardRate = ForwardRate
1867 fromBootstrapTrait LZeroYield = ZeroYield
1868 fromBootstrapTrait LSimpleZeroYield = SimpleZeroYield
1869
1870 -- |Bootstraps a term structure with settlement-day reference-date semantics (see
1871 -- 'piecewiseYieldCurve''), choosing the bootstrapper via 'Bootstrap' instead of by which function
1872 -- you call. 'piecewiseYieldCurve''\/'piecewiseYieldCurveFull''\/'piecewiseYieldCurveGlobalBootstrap''\/
1873 -- 'piecewiseYieldCurveGlobalBootstrapSimpleZeroLinear''\/'piecewiseYieldCurveGlobalBootstrapSimpleZeroLinearFull''\/
1874 -- 'piecewiseYieldCurveLocalBootstrap'' are each a one-line call into this function with a
1875 -- particular 'Bootstrap' constructor; kept as separate named entry points since 'piecewiseYieldCurve'
1876 -- (fixed reference date, no settlement days) has no counterpart here -- @GlobalBootstrap@\/
1877 -- @LocalBootstrap@ have no fixed-reference-date shim upstream, so a fully unified entry point can
1878 -- only exist in this settlementDays-taking shape.
1879 piecewiseYieldCurve2' :: Word -- ^settlementDays
1880 -> Calendar -- ^calendar
1881 -> [GenRateHelper rh] -- ^instruments
1882 -> DayCounter -- ^dayCounter
1883 -> [(Day, GenQuote q)] -- ^jumps
1884 -> Bootstrap rh2 -- ^bootstrapper choice
1885 -> Bool -- ^extrapolate past the curve's max date
1886 -> IO YieldTermStructure
1887 piecewiseYieldCurve2' s cal r dc qd bootstrap ex = case bootstrap of
1888 Iterative t i b -> uncurryNested (qlPiecewiseYieldCurveFull1 s cal r dc qs ds t) (qlInterpolation i)
1889 (nullableDouble (ibAccuracy b)) (nullableDouble (ibMinValue b)) (nullableDouble (ibMaxValue b))
1890 (ibMaxAttempts b) (ibMaxFactor b) (ibMinFactor b) (ibDontThrow b) (ibDontThrowSteps b) (ibMaxEvaluations b) ex
1891 GlobalDiscountLogLinear acc w -> qlPiecewiseYieldCurveGlobalBootstrap1 s cal r dc qs ds acc w ex
1892 GlobalSimpleZeroLinear acc w -> qlPiecewiseYieldCurveGlobalBootstrap2 s cal r dc qs ds acc w ex
1893 GlobalSimpleZeroLinearFull ah ad acc -> qlPiecewiseYieldCurveGlobalBootstrap3 s cal r dc qs ds ah ad acc ex
1894 GlobalForwardRateLinear acc w -> qlPiecewiseYieldCurveGlobalBootstrap4 s cal r dc qs ds acc w ex
1895 GlobalZeroYieldLinear acc w -> qlPiecewiseYieldCurveGlobalBootstrap5 s cal r dc qs ds acc w ex
1896 Local t loc fp acc q m cfp -> qlPiecewiseYieldCurveLocalBootstrap1 s cal r dc qs ds (fromBootstrapTrait t) loc fp acc q m cfp ex
1897 where (ds, qs) = unzip qd
1898
1899 -- |Yield curve interpolating discount factors directly between the given dates.
1900 interpolatedDiscountCurve :: [(Day, Double)] -- ^dates, dfs
1901 -> DayCounter -- ^dayCounter
1902 -> Calendar -- ^cal
1903 -> [(Day, GenQuote q)] -- ^jumps
1904 -> Interpolation -- ^interpolator
1905 -> Bool -- ^extrapolate past the curve's max date
1906 -> IO YieldTermStructure
1907 interpolatedDiscountCurve r dc c qd i ex = uncurryNested (qlInterpolatedDiscountCurve rs rd dc c qs ds) (qlInterpolation i) ex
1908 where (rd, rs) = unzip r
1909 (ds, qs) = unzip qd
1910 qlInterpolatedDiscountCurve :: ([Double]) -> ([Day]) -> (DayCounter) -> (Calendar) -> ([GenQuote q]) -> ([Day]) -> (Int) -> (Int) -> (Int) -> (Bool) -> IO ((YieldTermStructure))
1911 qlInterpolatedDiscountCurve a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 =
1912 withDoubleArray a1 $ \(a1'1, a1'2) ->
1913 withDayArray a2 $ \(a2'1, a2'2) ->
1914 withDayCounter a3 $ \a3' ->
1915 withCalendar a4 $ \a4' ->
1916 withQuoteArray a5 $ \(a5'1, a5'2) ->
1917 withDayArray a6 $ \(a6'1, a6'2) ->
1918 let {a7' = fromIntegral a7} in
1919 let {a8' = fromIntegral a8} in
1920 let {a9' = fromIntegral a9} in
1921 let {a10' = C2HSImp.fromBool a10} in
1922 preErrorCheck $ \a11' ->
1923 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 ->
1924 peekYieldTermStructure res >>= \res' ->
1925 errorCheck a11'>>
1926 return (res')
1927
1928
1929
1930 -- |Yield curve interpolating instantaneous forward rates directly between the given dates.
1931 interpolatedForwardCurve :: [(Day, Double)] -- ^dates, forwards
1932 -> DayCounter -- ^dayCounter
1933 -> Calendar -- ^cal
1934 -> [(Day, GenQuote q)] -- ^jumps
1935 -> Interpolation -- ^interpolator
1936 -> IO YieldTermStructure
1937 interpolatedForwardCurve r dc c qd i = uncurryNested (qlInterpolatedForwardCurve rs rd dc c qs ds) (qlInterpolation i) where {(rd, rs) = unzip r; (ds, qs) = unzip qd}
1938 qlInterpolatedForwardCurve :: ([Double]) -> ([Day]) -> (DayCounter) -> (Calendar) -> ([GenQuote q]) -> ([Day]) -> (Int) -> (Int) -> (Int) -> IO ((YieldTermStructure))
1939 qlInterpolatedForwardCurve a1 a2 a3 a4 a5 a6 a7 a8 a9 =
1940 withDoubleArray a1 $ \(a1'1, a1'2) ->
1941 withDayArray a2 $ \(a2'1, a2'2) ->
1942 withDayCounter a3 $ \a3' ->
1943 withCalendar a4 $ \a4' ->
1944 withQuoteArray a5 $ \(a5'1, a5'2) ->
1945 withDayArray a6 $ \(a6'1, a6'2) ->
1946 let {a7' = fromIntegral a7} in
1947 let {a8' = fromIntegral a8} in
1948 let {a9' = fromIntegral a9} in
1949 preErrorCheck $ \a10' ->
1950 qlInterpolatedForwardCurve'_ a1'1 a1'2 a2'1 a2'2 a3' a4' a5'1 a5'2 a6'1 a6'2 a7' a8' a9' a10' >>= \res ->
1951 peekYieldTermStructure res >>= \res' ->
1952 errorCheck a10'>>
1953 return (res')
1954
1955
1956
1957 -- |Yield curve interpolating zero-yield rates directly between the given dates.
1958 interpolatedZeroCurve :: [(Day, Double)] -- ^dates, yields
1959 -> DayCounter -- ^dayCounter
1960 -> Calendar -- ^cal
1961 -> [(Day, GenQuote q)] -- ^jumps, jumpDates
1962 -> Interpolation -- ^interpolator
1963 -> IO YieldTermStructure
1964 interpolatedZeroCurve r dc c qd i = uncurryNested (qlInterpolatedZeroCurve rs rd dc c qs ds) (qlInterpolation i) where {(rd, rs) = unzip r; (ds, qs) = unzip qd}
1965 qlInterpolatedZeroCurve :: ([Double]) -> ([Day]) -> (DayCounter) -> (Calendar) -> ([GenQuote q]) -> ([Day]) -> (Int) -> (Int) -> (Int) -> IO ((YieldTermStructure))
1966 qlInterpolatedZeroCurve a1 a2 a3 a4 a5 a6 a7 a8 a9 =
1967 withDoubleArray a1 $ \(a1'1, a1'2) ->
1968 withDayArray a2 $ \(a2'1, a2'2) ->
1969 withDayCounter a3 $ \a3' ->
1970 withCalendar a4 $ \a4' ->
1971 withQuoteArray a5 $ \(a5'1, a5'2) ->
1972 withDayArray a6 $ \(a6'1, a6'2) ->
1973 let {a7' = fromIntegral a7} in
1974 let {a8' = fromIntegral a8} in
1975 let {a9' = fromIntegral a9} in
1976 preErrorCheck $ \a10' ->
1977 qlInterpolatedZeroCurve'_ a1'1 a1'2 a2'1 a2'2 a3' a4' a5'1 a5'2 a6'1 a6'2 a7' a8' a9' a10' >>= \res ->
1978 peekYieldTermStructure res >>= \res' ->
1979 errorCheck a10'>>
1980 return (res')
1981
1982
1983
1984 -- |Discount factors interpolated as a multiplicative spread applied on top of 'baseCurve'.
1985 -- Upstream requires the first discount factor to be exactly @1.0@, flagging its date as the
1986 -- curve's own reference date; a mismatched leading value throws a 'QuantLib.Type.Error'.
1987 interpolatedSpreadDiscountCurve :: GenYieldTermStructure y
1988 -> [(Day, Double)] -- ^dates, dfs
1989 -> Interpolation -- ^interpolator
1990 -> IO YieldTermStructure
1991 interpolatedSpreadDiscountCurve ts r i = uncurryNested (qlInterpolatedSpreadDiscountCurve ts rs rd) (qlInterpolation i) where (rd, rs) = unzip r
1992 qlInterpolatedSpreadDiscountCurve :: (GenYieldTermStructure y) -> ([Double]) -> ([Day]) -> (Int) -> (Int) -> (Int) -> IO ((YieldTermStructure))
1993 qlInterpolatedSpreadDiscountCurve a1 a2 a3 a4 a5 a6 =
1994 withYieldTermStructure a1 $ \a1' ->
1995 withDoubleArray a2 $ \(a2'1, a2'2) ->
1996 withDayArray a3 $ \(a3'1, a3'2) ->
1997 let {a4' = fromIntegral a4} in
1998 let {a5' = fromIntegral a5} in
1999 let {a6' = fromIntegral a6} in
2000 preErrorCheck $ \a7' ->
2001 qlInterpolatedSpreadDiscountCurve'_ a1' a2'1 a2'2 a3'1 a3'2 a4' a5' a6' a7' >>= \res ->
2002 peekYieldTermStructure res >>= \res' ->
2003 errorCheck a7'>>
2004 return (res')
2005
2006
2007
2008 -- |reference date based on current evaluation date
2009 fittedBondDiscountCurve :: (Word) -- ^settlementDays
2010 -> (Calendar) -> ([BondHelper]) -> (DayCounter) -> (FittingMethod) -> (Double) -- ^accuracy
2011 -> (Word) -- ^maxEvaluations
2012 -> ([Double]) -- ^guess
2013 -> (Double) -- ^simplexLambda
2014 -> IO ((FittedBondDiscountCurve))
2015 fittedBondDiscountCurve a1 a2 a3 a4 a5 a6 a7 a8 a9 =
2016 let {a1' = fromIntegral a1} in
2017 withCalendar a2 $ \a2' ->
2018 withBondHelperArray a3 $ \(a3'1, a3'2) ->
2019 withDayCounter a4 $ \a4' ->
2020 withFittedBondDiscountCurveFittingMethod a5 $ \a5' ->
2021 let {a6' = realToFrac a6} in
2022 let {a7' = fromIntegral a7} in
2023 withDoubleArray a8 $ \(a8'1, a8'2) ->
2024 let {a9' = realToFrac a9} in
2025 preErrorCheck $ \a10' ->
2026 fittedBondDiscountCurve'_ a1' a2' a3'1 a3'2 a4' a5' a6' a7' a8'1 a8'2 a9' a10' >>= \res ->
2027 peekFittedBondDiscountCurve res >>= \res' ->
2028 errorCheck a10'>>
2029 return (res')
2030
2031
2032
2033 -- |curve reference date fixed for life of curve
2034 fittedBondDiscountCurve' :: (Day) -> ([BondHelper]) -> (DayCounter) -> (FittingMethod) -> (Double) -- ^accuracy
2035 -> (Word) -- ^maxEvaluations
2036 -> ([Double]) -- ^guess
2037 -> (Double) -- ^simplexLambda
2038 -> IO ((FittedBondDiscountCurve))
2039 fittedBondDiscountCurve' a1 a2 a3 a4 a5 a6 a7 a8 =
2040 withDay a1 $ \a1' ->
2041 withBondHelperArray a2 $ \(a2'1, a2'2) ->
2042 withDayCounter a3 $ \a3' ->
2043 withFittedBondDiscountCurveFittingMethod a4 $ \a4' ->
2044 let {a5' = realToFrac a5} in
2045 let {a6' = fromIntegral a6} in
2046 withDoubleArray a7 $ \(a7'1, a7'2) ->
2047 let {a8' = realToFrac a8} in
2048 preErrorCheck $ \a9' ->
2049 fittedBondDiscountCurve''_ a1' a2'1 a2'2 a3' a4' a5' a6' a7'1 a7'2 a8' a9' >>= \res ->
2050 peekFittedBondDiscountCurve res >>= \res' ->
2051 errorCheck a9'>>
2052 return (res')
2053
2054
2055
2056 -- |final value of cost function after optimization
2057 minimumCostValue :: (FittedBondDiscountCurve) -> IO ((Double))
2058 minimumCostValue a1 =
2059 withFittedBondDiscountCurve a1 $ \a1' ->
2060 preErrorCheck $ \a2' ->
2061 minimumCostValue'_ a1' a2' >>= \res ->
2062 let {res' = realToFrac res} in
2063 errorCheck a2'>>
2064 return (res')
2065
2066
2067
2068 -- |final number of iterations used in the optimization problem
2069 numberOfIterations :: (FittedBondDiscountCurve) -> IO ((Int))
2070 numberOfIterations a1 =
2071 withFittedBondDiscountCurve a1 $ \a1' ->
2072 preErrorCheck $ \a2' ->
2073 numberOfIterations'_ a1' a2' >>= \res ->
2074 let {res' = fromIntegral res} in
2075 errorCheck a2'>>
2076 return (res')
2077
2078
2079
2080 -- |A curve behind a relinkable handle. The result /is/ a 'YieldTermStructure': pass it to
2081 -- any curve-taking function and everything built on it keeps tracking whatever the handle
2082 -- currently points at, so a later 'linkTo' reprices already-constructed instruments
2083 -- without rebuilding them. 'Nothing' gives an empty handle -- meaningful rather than an
2084 -- error, since that is what makes a rate helper discount off the curve being bootstrapped
2085 -- -- but reading a curve value through one throws until it is linked.
2086 relinkableYieldTermStructure :: (Maybe (GenYieldTermStructure y)) -> IO ((RelinkableYieldTermStructure))
2087 relinkableYieldTermStructure a1 =
2088 withMaybeYieldTermStructure a1 $ \a1' ->
2089 preErrorCheck $ \a2' ->
2090 relinkableYieldTermStructure'_ a1' a2' >>= \res ->
2091 peekRelinkableYieldTermStructure res >>= \res' ->
2092 errorCheck a2'>>
2093 return (res')
2094
2095
2096
2097 -- |Point a relinkable handle at a different curve. Everything already built on the handle
2098 -- reprices against the new curve, with no object rebuilt.
2099 --
2100 -- This is the one mutator in the module. The API rules here otherwise forbid new setters
2101 -- and prefer constructing a fresh object, but relinking /is/ the capability being bound:
2102 -- a forecast curve is cloned into every floating coupon of every instrument, so without
2103 -- it a curve scenario means rebuilding the whole portfolio.
2104 linkTo :: (RelinkableYieldTermStructure) -> (GenYieldTermStructure y) -> IO ()
2105 linkTo a1 a2 =
2106 withRelinkableYieldTermStructure a1 $ \a1' ->
2107 withYieldTermStructure a2 $ \a2' ->
2108 preErrorCheck $ \a3' ->
2109 linkTo'_ a1' a2' a3' >>
2110 errorCheck a3'>>
2111 return ()
2112
2113
2114
2115 -- |Builds a set of curves that form a genuine dependency cycle -- the scenario
2116 -- 'RelinkableYieldTermStructure' exists for. Protocol (see the class's own upstream doc
2117 -- comment): build each member curve's rate helpers off an empty 'relinkableYieldTermStructure'
2118 -- (the /internal/ handle), construct the curves themselves (e.g. via
2119 -- 'piecewiseYieldCurveGlobalBootstrap''), then hand each pair of (internal handle, curve) to
2120 -- 'addBootstrappedCurve' -- which returns an /external/ handle to reference the curve by from
2121 -- then on, and links the internal handle to it (with ownership/observability stripped to avoid
2122 -- shared_ptr and notification cycles) so the curves' own cross-references resolve.
2123 multiCurve :: (Double) -- ^accuracy
2124 -> IO ((MultiCurve))
2125 multiCurve a1 =
2126 let {a1' = realToFrac a1} in
2127 preErrorCheck $ \a2' ->
2128 multiCurve'_ a1' a2' >>= \res ->
2129 peekMultiCurve res >>= \res' ->
2130 errorCheck a2'>>
2131 return (res')
2132
2133
2134
2135 -- |Add a curve built with a bootstrapper (e.g. 'piecewiseYieldCurveGlobalBootstrap'') to the
2136 -- cycle. See 'multiCurve' for the protocol.
2137 addBootstrappedCurve :: (MultiCurve) -> (RelinkableYieldTermStructure) -- ^internalHandle
2138 -> (GenYieldTermStructure y) -- ^curve
2139 -> IO ((YieldTermStructure))
2140 addBootstrappedCurve a1 a2 a3 =
2141 withMultiCurve a1 $ \a1' ->
2142 withRelinkableYieldTermStructure a2 $ \a2' ->
2143 withYieldTermStructure a3 $ \a3' ->
2144 preErrorCheck $ \a4' ->
2145 addBootstrappedCurve'_ a1' a2' a3' a4' >>= \res ->
2146 peekYieldTermStructure res >>= \res' ->
2147 errorCheck a4'>>
2148 return (res')
2149
2150
2151
2152 -- |Add a curve that isn't built with a bootstrapper (e.g. a spreaded curve) to the cycle. See
2153 -- 'multiCurve' for the protocol.
2154 addNonBootstrappedCurve :: (MultiCurve) -> (RelinkableYieldTermStructure) -- ^internalHandle
2155 -> (GenYieldTermStructure y) -- ^curve
2156 -> IO ((YieldTermStructure))
2157 addNonBootstrappedCurve a1 a2 a3 =
2158 withMultiCurve a1 $ \a1' ->
2159 withRelinkableYieldTermStructure a2 $ \a2' ->
2160 withYieldTermStructure a3 $ \a3' ->
2161 preErrorCheck $ \a4' ->
2162 addNonBootstrappedCurve'_ a1' a2' a3' a4' >>= \res ->
2163 peekYieldTermStructure res >>= \res' ->
2164 errorCheck a4'>>
2165 return (res')
2166
2167
2168
2169 -- |The bond the helper prices. For 'fixedRateBondHelper'\/'cpiBondHelper' this is the only way
2170 -- to reach it, since they build the bond internally rather than taking one (unlike 'bondHelper').
2171 bondHelperBond :: (BondHelper) -> IO ((Bond))
2172 bondHelperBond a1 =
2173 withGenRateHelper a1 $ \a1' ->
2174 preErrorCheck $ \a2' ->
2175 bondHelperBond'_ a1' a2' >>= \res ->
2176 peekBond res >>= \res' ->
2177 errorCheck a2'>>
2178 return (res')
2179
2180
2181
2182 -- |The underlying swap the helper builds from its tenor and index.
2183 swapRateHelperSwap :: (SwapRateHelper) -> IO ((VanillaSwap))
2184 swapRateHelperSwap a1 =
2185 withGenRateHelper a1 $ \a1' ->
2186 preErrorCheck $ \a2' ->
2187 swapRateHelperSwap'_ a1' a2' >>= \res ->
2188 peekVanillaSwap res >>= \res' ->
2189 errorCheck a2'>>
2190 return (res')
2191
2192
2193
2194 -- |The underlying overnight indexed swap the helper builds from its tenor and index.
2195 oisRateHelperSwap :: (OISRateHelper) -> IO ((OvernightIndexedSwap))
2196 oisRateHelperSwap a1 =
2197 withGenRateHelper a1 $ \a1' ->
2198 preErrorCheck $ \a2' ->
2199 oisRateHelperSwap'_ a1' a2' >>= \res ->
2200 peekOvernightIndexedSwap res >>= \res' ->
2201 errorCheck a2'>>
2202 return (res')
2203
2204
2205
2206 -- vim: set ff=unix ts=8 sts=2 sw=2 et:
2207
2208 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlDepositRateHelper1"
2209 depositRateHelper''_ :: ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CIborIndex')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CRateHelper'))))))
2210
2211 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlDepositRateHelper"
2212 depositRateHelper'_ :: ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CDayCounter)) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CRateHelper'))))))))))))
2213
2214 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlFixedRateBondHelper"
2215 fixedRateBondHelper'_ :: ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CUInt -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (CSchedule)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CBondHelper'))))))))))))))
2216
2217 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlCPIBondHelper"
2218 cpiBondHelper'_ :: ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CUInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CZeroInflationIndex')) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CSchedule)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CCalendar)) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CBondHelper')))))))))))))))))))
2219
2220 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlYieldTSDiscount"
2221 discount''_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))))
2222
2223 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlSwapRateHelper1"
2224 swapRateHelper''_ :: ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CDayCounter)) -> ((C2HSImp.Ptr (CIborIndex')) -> ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CUInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CFloatingRateCouponPricer)) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CSwapRateHelper')))))))))))))))))))))))
2225
2226 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlFlatForward"
2227 flatForward'_ :: (C2HSImp.CInt -> ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CYieldTermStructure')))))))))
2228
2229 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlFlatForward1"
2230 flatForward''_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr (CCalendar)) -> ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CYieldTermStructure'))))))))))
2231
2232 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlYieldTermStructureZeroRate"
2233 zeroRate''_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CInterestRate))))))))))
2234
2235 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlYieldTermStructureForwardRate1"
2236 forwardRateForPeriod'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CInterestRate))))))))))))
2237
2238 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlYieldTermStructureForwardRate"
2239 forwardRate''_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CInterestRate)))))))))))
2240
2241 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlYieldTermStructureForwardRate2"
2242 forwardRate'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CInterestRate))))))))))
2243
2244 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlYieldTermStructureZeroRate1"
2245 zeroRate'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CDouble -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CInterestRate)))))))))
2246
2247 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlYieldTermStructureDiscount1"
2248 discount'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CDouble -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))))
2249
2250 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlFraRateHelper"
2251 fraRateHelper'_ :: ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CRateHelper')))))))))))))))
2252
2253 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlIborIborBasisSwapRateHelper"
2254 iborIborBasisSwapRateHelper'_ :: ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CIborIndex')) -> ((C2HSImp.Ptr (CIborIndex')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CRateHelper')))))))))))))))
2255
2256 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlOvernightIborBasisSwapRateHelper"
2257 overnightIborBasisSwapRateHelper'_ :: ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (COvernightIndex')) -> ((C2HSImp.Ptr (CIborIndex')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CRateHelper'))))))))))))))
2258
2259 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlConstNotionalCrossCurrencyBasisSwapRateHelper"
2260 constNotionalCrossCurrencyBasisSwapRateHelper'_ :: ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CIborIndex')) -> ((C2HSImp.Ptr (CIborIndex')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CRateHelper')))))))))))))))))))
2261
2262 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlMtMCrossCurrencyBasisSwapRateHelper"
2263 mtMCrossCurrencyBasisSwapRateHelper'_ :: ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CIborIndex')) -> ((C2HSImp.Ptr (CIborIndex')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CRateHelper'))))))))))))))))))))
2264
2265 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlConstNotionalCrossCurrencySwapRateHelper"
2266 constNotionalCrossCurrencySwapRateHelper'_ :: ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CDayCounter)) -> ((C2HSImp.Ptr (CIborIndex')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CRateHelper')))))))))))))))))
2267
2268 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlFxSwapRateHelper"
2269 fxSwapRateHelper'_ :: ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CCalendar)) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CRateHelper')))))))))))))))
2270
2271 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlFxSwapRateHelper2"
2272 fxSwapRateHelper''_ :: ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CRateHelper'))))))))))
2273
2274 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlBondHelper"
2275 bondHelper_'_ :: ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CBond')) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CBondHelper')))))))
2276
2277 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlOISRateHelper"
2278 oisRateHelper_'_ :: (C2HSImp.CUInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (COvernightIndex')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CFloatingRateCouponPricer)) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (COISRateHelper')))))))))))))))))))))))))))))))
2279
2280 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlOISRateHelper2"
2281 oisRateHelper2_'_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (COvernightIndex')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CCalendar)) -> ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CFloatingRateCouponPricer)) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (COISRateHelper'))))))))))))))))))))))))))))
2282
2283 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlSwapRateHelper"
2284 swapRateHelper'_ :: ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CSwapIndex')) -> ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CFloatingRateCouponPricer)) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CSwapRateHelper')))))))))))))))
2285
2286 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlForwardSpreadedTermStructure"
2287 forwardSpreadedTermStructure'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CYieldTermStructure'))))))
2288
2289 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlZeroSpreadedTermStructure"
2290 zeroSpreadedTermStructure'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CYieldTermStructure'))))))))
2291
2292 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlBMASwapRateHelper"
2293 bmaSwapRateHelper'_ :: ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CDayCounter)) -> ((C2HSImp.Ptr (CBMAIndex')) -> ((C2HSImp.Ptr (CIborIndex')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CRateHelper')))))))))))))))
2294
2295 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlMultipleResetsSwapRateHelper"
2296 multipleResetsSwapRateHelper'_ :: (C2HSImp.CUInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CIborIndex')) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CRateHelper'))))))))))))))))
2297
2298 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlFraRateHelper1"
2299 fraIborRateHelper''_ :: ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (CIborIndex')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CRateHelper'))))))))))
2300
2301 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlFraRateHelper2"
2302 fraRateHelper''_ :: ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CRateHelper'))))))))))))))))
2303
2304 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlFraRateHelper3"
2305 fraIborRateHelper'_ :: ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CIborIndex')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CRateHelper')))))))))))
2306
2307 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlFuturesRateHelper1"
2308 futuresRateHelper''_ :: ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CDayCounter)) -> ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CRateHelper'))))))))))
2309
2310 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlFuturesRateHelper2"
2311 futuresIborRateHelper'_ :: ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CIborIndex')) -> ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CRateHelper'))))))))
2312
2313 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlFuturesRateHelper"
2314 futuresRateHelper'_ :: ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CDayCounter)) -> ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CRateHelper')))))))))))))
2315
2316 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlOvernightIndexFutureRateHelper"
2317 overnightIndexFutureRateHelper'_ :: ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (COvernightIndex')) -> ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CRateHelper'))))))))))))
2318
2319 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlSofrFutureRateHelper"
2320 sofrFutureRateHelper'_ :: ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CRateHelper')))))))))))
2321
2322 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlRateHelperImpliedQuote"
2323 impliedQuote'_ :: ((C2HSImp.Ptr (CRateHelper')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))
2324
2325 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlImpliedTermStructure"
2326 impliedTermStructure'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CYieldTermStructure'))))))
2327
2328 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlPiecewiseZeroSpreadedTermStructure"
2329 qlPiecewiseZeroSpreadedTermStructure'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CQuote'))) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CYieldTermStructure'))))))))))))))
2330
2331 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlQuantoTermStructure"
2332 quantoTermStructure'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CBlackVolTermStructure')) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (CBlackVolTermStructure')) -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CYieldTermStructure'))))))))))))
2333
2334 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlUltimateForwardTermStructure"
2335 ultimateForwardTermStructure'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CYieldTermStructure')))))))))))))
2336
2337 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlPiecewiseYieldCurve"
2338 qlPiecewiseYieldCurve'_ :: (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.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CYieldTermStructure'))))))))))))))))
2339
2340 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlPiecewiseYieldCurveFull"
2341 qlPiecewiseYieldCurveFull'_ :: (C2HSImp.CInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CRateHelper'))) -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CQuote'))) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CInt -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CYieldTermStructure')))))))))))))))))))))))))
2342
2343 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlPiecewiseYieldCurveFull1"
2344 qlPiecewiseYieldCurveFull1'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CRateHelper'))) -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CQuote'))) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CInt -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CYieldTermStructure')))))))))))))))))))))))))))
2345
2346 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlPiecewiseYieldCurveGlobalBootstrap1"
2347 qlPiecewiseYieldCurveGlobalBootstrap1'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CRateHelper'))) -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CQuote'))) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CYieldTermStructure')))))))))))))))))
2348
2349 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlPiecewiseYieldCurveGlobalBootstrap2"
2350 qlPiecewiseYieldCurveGlobalBootstrap2'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CRateHelper'))) -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CQuote'))) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CYieldTermStructure')))))))))))))))))
2351
2352 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlPiecewiseYieldCurveGlobalBootstrap3"
2353 qlPiecewiseYieldCurveGlobalBootstrap3'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CRateHelper'))) -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CQuote'))) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CRateHelper'))) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CDouble -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CYieldTermStructure')))))))))))))))))))
2354
2355 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlPiecewiseYieldCurveGlobalBootstrap4"
2356 qlPiecewiseYieldCurveGlobalBootstrap4'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CRateHelper'))) -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CQuote'))) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CYieldTermStructure')))))))))))))))))
2357
2358 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlPiecewiseYieldCurveGlobalBootstrap5"
2359 qlPiecewiseYieldCurveGlobalBootstrap5'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CRateHelper'))) -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CQuote'))) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CYieldTermStructure')))))))))))))))))
2360
2361 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlPiecewiseYieldCurveLocalBootstrap1"
2362 qlPiecewiseYieldCurveLocalBootstrap1'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CRateHelper'))) -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CQuote'))) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CInt -> (C2HSImp.CUInt -> (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CYieldTermStructure')))))))))))))))))))))
2363
2364 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlInterpolatedDiscountCurve"
2365 qlInterpolatedDiscountCurve'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> ((C2HSImp.Ptr (CDayCounter)) -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CQuote'))) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CYieldTermStructure'))))))))))))))))))
2366
2367 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlInterpolatedForwardCurve"
2368 qlInterpolatedForwardCurve'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> ((C2HSImp.Ptr (CDayCounter)) -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CQuote'))) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CYieldTermStructure')))))))))))))))))
2369
2370 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlInterpolatedZeroCurve"
2371 qlInterpolatedZeroCurve'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> ((C2HSImp.Ptr (CDayCounter)) -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CQuote'))) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CYieldTermStructure')))))))))))))))))
2372
2373 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlInterpolatedSpreadDiscountCurve"
2374 qlInterpolatedSpreadDiscountCurve'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CYieldTermStructure'))))))))))))
2375
2376 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlFittedBondDiscountCurve"
2377 fittedBondDiscountCurve'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CBondHelper'))) -> ((C2HSImp.Ptr (CDayCounter)) -> ((C2HSImp.Ptr (CFittedBondDiscountCurveFittingMethod)) -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CFittedBondDiscountCurve')))))))))))))))
2378
2379 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlFittedBondDiscountCurve1"
2380 fittedBondDiscountCurve''_ :: (C2HSImp.CInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CBondHelper'))) -> ((C2HSImp.Ptr (CDayCounter)) -> ((C2HSImp.Ptr (CFittedBondDiscountCurveFittingMethod)) -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CFittedBondDiscountCurve'))))))))))))))
2381
2382 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlFittedBondDiscountCurveFittingMethodMinimumCostValue"
2383 minimumCostValue'_ :: ((C2HSImp.Ptr (CFittedBondDiscountCurve')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))
2384
2385 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlFittedBondDiscountCurveFittingMethodNumberOfIterations"
2386 numberOfIterations'_ :: ((C2HSImp.Ptr (CFittedBondDiscountCurve')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CInt)))
2387
2388 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlRelinkableYieldTermStructure"
2389 relinkableYieldTermStructure'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CRelinkableYieldTermStructure')))))
2390
2391 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlRelinkableYieldTermStructureLinkTo"
2392 linkTo'_ :: ((C2HSImp.Ptr (CRelinkableYieldTermStructure')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO ()))))
2393
2394 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlMultiCurve"
2395 multiCurve'_ :: (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CMultiCurve)))))
2396
2397 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlMultiCurveAddBootstrappedCurve"
2398 addBootstrappedCurve'_ :: ((C2HSImp.Ptr (CMultiCurve)) -> ((C2HSImp.Ptr (CRelinkableYieldTermStructure')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CYieldTermStructure')))))))
2399
2400 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlMultiCurveAddNonBootstrappedCurve"
2401 addNonBootstrappedCurve'_ :: ((C2HSImp.Ptr (CMultiCurve)) -> ((C2HSImp.Ptr (CRelinkableYieldTermStructure')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CYieldTermStructure')))))))
2402
2403 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlBondHelperBond"
2404 bondHelperBond'_ :: ((C2HSImp.Ptr (CBondHelper')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CBond')))))
2405
2406 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlSwapRateHelperSwap"
2407 swapRateHelperSwap'_ :: ((C2HSImp.Ptr (CSwapRateHelper')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CVanillaSwap')))))
2408
2409 foreign import ccall safe "QuantLib/TermStructure/Yield.chs.h qlOISRateHelperSwap"
2410 oisRateHelperSwap'_ :: ((C2HSImp.Ptr (COISRateHelper')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (COvernightIndexedSwap')))))