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 module QuantLib.TermStructure.Credit
6 (
7 -- * Types
8 -- ** Curves and helpers
9 GenDefaultProbabilityTermStructure
10 , DefaultProbabilityTermStructure
11 , AffineHazardRateCurve
12 , DefaultProbabilityHelper
13
14 -- ** Coordinates
15 , Reference(..)
16 , TermPoint(..)
17 , TermInterval(..)
18
19 -- ** Bootstrap configuration
20 , ProbabilityTrait(..)
21 , IterativeBootstrapOpts(..)
22
23 -- * Constructors
24 -- ** Flat and spreaded curves
25 , factorSpreadedHazardRateCurve
26 , flatHazardRate
27 , spreadedHazardRateCurve
28 -- ** Helpers and bootstrapped curves
29 , spreadCdsHelper
30 , upfrontCdsHelper
31 , interpolatedDefaultDensityCurve
32 , interpolatedHazardRateCurve
33 , interpolatedAffineHazardRateCurve
34 , interpolatedSurvivalProbabilityCurve
35 , defaultIterativeBootstrapOpts
36 , piecewiseDefaultCurve
37
38 -- * Inspectors
39 , defaultProbability
40 , hazardRate
41 , survivalProbability
42 , defaultDensity
43 , defaultProbabilityBetween
44 , conditionalSurvivalProbability
45 , impliedQuote
46 , impliedQuoteOn
47 ) where
48 import qualified Foreign.C.Types as C2HSImp
49 import qualified Foreign.ForeignPtr as C2HSImp
50 import qualified Foreign.Marshal.Utils as C2HSImp
51 import qualified Foreign.Ptr as C2HSImp
52
53
54
55
56
57
58
59 import QuantLib.Internal
60 import QuantLib.Instrument(PricingModel)
61 import QuantLib.Internal.Type
62 import QuantLib.Time.Schedule(DateGenerationRule, Frequency)
63 import QuantLib.Internal.Common
64 import QuantLib.TermStructure (Reference(..), TermPoint(..), TermInterval(..), setExtrapolation)
65 import Data.List.NonEmpty(NonEmpty, toList)
66
67 data ProbabilityTrait = SurvivalProbability
68 | HazardRate
69 | DefaultDensity
70 deriving (Show,Eq,Read)
71 instance Enum ProbabilityTrait where
72 succ SurvivalProbability = HazardRate
73 succ HazardRate = DefaultDensity
74 succ DefaultDensity = error "ProbabilityTrait.succ: DefaultDensity has no successor"
75
76 pred HazardRate = SurvivalProbability
77 pred DefaultDensity = HazardRate
78 pred SurvivalProbability = error "ProbabilityTrait.pred: SurvivalProbability has no predecessor"
79
80 enumFromTo from to = go from
81 where
82 end = fromEnum to
83 go v = case compare (fromEnum v) end of
84 LT -> v : go (succ v)
85 EQ -> [v]
86 GT -> []
87
88 enumFrom from = enumFromTo from DefaultDensity
89
90 fromEnum SurvivalProbability = 0
91 fromEnum HazardRate = 1
92 fromEnum DefaultDensity = 2
93
94 toEnum 0 = SurvivalProbability
95 toEnum 1 = HazardRate
96 toEnum 2 = DefaultDensity
97 toEnum unmatched = error ("ProbabilityTrait.toEnum: Cannot match " ++ show unmatched)
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116 -- |a curve whose hazard rate is another curve's, scaled by a spread factor
117 factorSpreadedHazardRateCurve :: (GenDefaultProbabilityTermStructure d) -> (GenQuote q) -> IO ((DefaultProbabilityTermStructure))
118 factorSpreadedHazardRateCurve a1 a2 =
119 withDefaultProbabilityTermStructure a1 $ \a1' ->
120 withQuote a2 $ \a2' ->
121 preErrorCheck $ \a3' ->
122 factorSpreadedHazardRateCurve'_ a1' a2' a3' >>= \res ->
123 peekDefaultProbabilityTermStructure res >>= \res' ->
124 errorCheck a3'>>
125 return (res')
126
127
128
129 -- |Flat hazard-rate curve with either a fixed or evaluation-date-relative reference point.
130 flatHazardRate :: Reference -> GenQuote q -> DayCounter -> IO DefaultProbabilityTermStructure
131 flatHazardRate (ReferenceDate d) = flatHazardRateFixed d
132 flatHazardRate (SettlementDays n cal) = flatHazardRateMovingRaw n cal
133 flatHazardRateMovingRaw :: (Word) -> (Calendar) -> (GenQuote q) -> (DayCounter) -> IO ((DefaultProbabilityTermStructure))
134 flatHazardRateMovingRaw a1 a2 a3 a4 =
135 let {a1' = fromIntegral a1} in
136 withCalendar a2 $ \a2' ->
137 withQuote a3 $ \a3' ->
138 withDayCounter a4 $ \a4' ->
139 preErrorCheck $ \a5' ->
140 flatHazardRateMovingRaw'_ a1' a2' a3' a4' a5' >>= \res ->
141 peekDefaultProbabilityTermStructure res >>= \res' ->
142 errorCheck a5'>>
143 return (res')
144
145
146 flatHazardRateFixed :: (Day) -> (GenQuote q) -> (DayCounter) -> IO ((DefaultProbabilityTermStructure))
147 flatHazardRateFixed a1 a2 a3 =
148 withDay a1 $ \a1' ->
149 withQuote a2 $ \a2' ->
150 withDayCounter a3 $ \a3' ->
151 preErrorCheck $ \a4' ->
152 flatHazardRateFixed'_ a1' a2' a3' a4' >>= \res ->
153 peekDefaultProbabilityTermStructure res >>= \res' ->
154 errorCheck a4'>>
155 return (res')
156
157
158
159 -- |a curve whose survival probability is another curve's, multiplied by a spread factor
160 spreadedHazardRateCurve :: (GenDefaultProbabilityTermStructure d) -> (GenQuote q) -> IO ((DefaultProbabilityTermStructure))
161 spreadedHazardRateCurve a1 a2 =
162 withDefaultProbabilityTermStructure a1 $ \a1' ->
163 withQuote a2 $ \a2' ->
164 preErrorCheck $ \a3' ->
165 spreadedHazardRateCurve'_ a1' a2' a3' >>= \res ->
166 peekDefaultProbabilityTermStructure res >>= \res' ->
167 errorCheck a3'>>
168 return (res')
169
170
171
172 defaultProbabilityAtDateRaw :: (GenDefaultProbabilityTermStructure d) -> (Day) -> (Bool) -- ^extrapolate
173 -> IO ((Double))
174 defaultProbabilityAtDateRaw a1 a2 a3 =
175 withDefaultProbabilityTermStructure a1 $ \a1' ->
176 withDay a2 $ \a2' ->
177 let {a3' = C2HSImp.fromBool a3} in
178 preErrorCheck $ \a4' ->
179 defaultProbabilityAtDateRaw'_ a1' a2' a3' a4' >>= \res ->
180 let {res' = realToFrac res} in
181 errorCheck a4'>>
182 return (res')
183
184
185
186 hazardRateAtTimeRaw :: (GenDefaultProbabilityTermStructure d) -> (Double) -> (Bool) -- ^extrapolate
187 -> IO ((Double))
188 hazardRateAtTimeRaw a1 a2 a3 =
189 withDefaultProbabilityTermStructure a1 $ \a1' ->
190 let {a2' = realToFrac a2} in
191 let {a3' = C2HSImp.fromBool a3} in
192 preErrorCheck $ \a4' ->
193 hazardRateAtTimeRaw'_ a1' a2' a3' a4' >>= \res ->
194 let {res' = realToFrac res} in
195 errorCheck a4'>>
196 return (res')
197
198
199
200 hazardRateAtDateRaw :: (GenDefaultProbabilityTermStructure d) -> (Day) -> (Bool) -- ^extrapolate
201 -> IO ((Double))
202 hazardRateAtDateRaw a1 a2 a3 =
203 withDefaultProbabilityTermStructure a1 $ \a1' ->
204 withDay a2 $ \a2' ->
205 let {a3' = C2HSImp.fromBool a3} in
206 preErrorCheck $ \a4' ->
207 hazardRateAtDateRaw'_ a1' a2' a3' a4' >>= \res ->
208 let {res' = realToFrac res} in
209 errorCheck a4'>>
210 return (res')
211
212
213
214 survivalProbabilityAtTimeRaw :: (GenDefaultProbabilityTermStructure d) -> (Double) -> (Bool) -- ^extrapolate
215 -> IO ((Double))
216 survivalProbabilityAtTimeRaw a1 a2 a3 =
217 withDefaultProbabilityTermStructure a1 $ \a1' ->
218 let {a2' = realToFrac a2} in
219 let {a3' = C2HSImp.fromBool a3} in
220 preErrorCheck $ \a4' ->
221 survivalProbabilityAtTimeRaw'_ a1' a2' a3' a4' >>= \res ->
222 let {res' = realToFrac res} in
223 errorCheck a4'>>
224 return (res')
225
226
227
228 survivalProbabilityAtDateRaw :: (GenDefaultProbabilityTermStructure d) -> (Day) -> (Bool) -- ^extrapolate
229 -> IO ((Double))
230 survivalProbabilityAtDateRaw a1 a2 a3 =
231 withDefaultProbabilityTermStructure a1 $ \a1' ->
232 withDay a2 $ \a2' ->
233 let {a3' = C2HSImp.fromBool a3} in
234 preErrorCheck $ \a4' ->
235 survivalProbabilityAtDateRaw'_ a1' a2' a3' a4' >>= \res ->
236 let {res' = realToFrac res} in
237 errorCheck a4'>>
238 return (res')
239
240
241
242 defaultDensityAtTimeRaw :: (GenDefaultProbabilityTermStructure d) -> (Double) -> (Bool) -- ^extrapolate
243 -> IO ((Double))
244 defaultDensityAtTimeRaw a1 a2 a3 =
245 withDefaultProbabilityTermStructure a1 $ \a1' ->
246 let {a2' = realToFrac a2} in
247 let {a3' = C2HSImp.fromBool a3} in
248 preErrorCheck $ \a4' ->
249 defaultDensityAtTimeRaw'_ a1' a2' a3' a4' >>= \res ->
250 let {res' = realToFrac res} in
251 errorCheck a4'>>
252 return (res')
253
254
255
256 defaultDensityAtDateRaw :: (GenDefaultProbabilityTermStructure d) -> (Day) -> (Bool) -- ^extrapolate
257 -> IO ((Double))
258 defaultDensityAtDateRaw a1 a2 a3 =
259 withDefaultProbabilityTermStructure a1 $ \a1' ->
260 withDay a2 $ \a2' ->
261 let {a3' = C2HSImp.fromBool a3} in
262 preErrorCheck $ \a4' ->
263 defaultDensityAtDateRaw'_ a1' a2' a3' a4' >>= \res ->
264 let {res' = realToFrac res} in
265 errorCheck a4'>>
266 return (res')
267
268
269
270 defaultProbabilityAtTimeRaw :: (GenDefaultProbabilityTermStructure d) -> (Double) -> (Bool) -- ^extrapolate
271 -> IO ((Double))
272 defaultProbabilityAtTimeRaw a1 a2 a3 =
273 withDefaultProbabilityTermStructure a1 $ \a1' ->
274 let {a2' = realToFrac a2} in
275 let {a3' = C2HSImp.fromBool a3} in
276 preErrorCheck $ \a4' ->
277 defaultProbabilityAtTimeRaw'_ a1' a2' a3' a4' >>= \res ->
278 let {res' = realToFrac res} in
279 errorCheck a4'>>
280 return (res')
281
282
283
284 defaultProbabilityBetweenDatesRaw :: (GenDefaultProbabilityTermStructure d) -> (Day) -> (Day) -> (Bool) -- ^extrapolate
285 -> IO ((Double))
286 defaultProbabilityBetweenDatesRaw a1 a2 a3 a4 =
287 withDefaultProbabilityTermStructure a1 $ \a1' ->
288 withDay a2 $ \a2' ->
289 withDay a3 $ \a3' ->
290 let {a4' = C2HSImp.fromBool a4} in
291 preErrorCheck $ \a5' ->
292 defaultProbabilityBetweenDatesRaw'_ a1' a2' a3' a4' a5' >>= \res ->
293 let {res' = realToFrac res} in
294 errorCheck a5'>>
295 return (res')
296
297
298
299 defaultProbabilityBetweenTimesRaw :: (GenDefaultProbabilityTermStructure d) -> (Double) -> (Double) -> (Bool) -- ^extrapolate
300 -> IO ((Double))
301 defaultProbabilityBetweenTimesRaw a1 a2 a3 a4 =
302 withDefaultProbabilityTermStructure a1 $ \a1' ->
303 let {a2' = realToFrac a2} in
304 let {a3' = realToFrac a3} in
305 let {a4' = C2HSImp.fromBool a4} in
306 preErrorCheck $ \a5' ->
307 defaultProbabilityBetweenTimesRaw'_ a1' a2' a3' a4' a5' >>= \res ->
308 let {res' = realToFrac res} in
309 errorCheck a5'>>
310 return (res')
311
312
313
314 -- |Hazard rate at a date or year fraction, with annual frequency and continuous compounding.
315 hazardRate :: GenDefaultProbabilityTermStructure d -> TermPoint -> Bool -> IO Double
316 hazardRate curve point = case point of
317 DatePoint d -> hazardRateAtDateRaw curve d
318 TimePoint t -> hazardRateAtTimeRaw curve t
319
320 -- |Survival probability from the reference point to a date or year fraction.
321 survivalProbability :: GenDefaultProbabilityTermStructure d -> TermPoint -> Bool -> IO Double
322 survivalProbability curve point = case point of
323 DatePoint d -> survivalProbabilityAtDateRaw curve d
324 TimePoint t -> survivalProbabilityAtTimeRaw curve t
325
326 -- |Default density at a date or year fraction.
327 defaultDensity :: GenDefaultProbabilityTermStructure d -> TermPoint -> Bool -> IO Double
328 defaultDensity curve point = case point of
329 DatePoint d -> defaultDensityAtDateRaw curve d
330 TimePoint t -> defaultDensityAtTimeRaw curve t
331
332 -- |Default probability from the reference point to a date or year fraction.
333 defaultProbability :: GenDefaultProbabilityTermStructure d -> TermPoint -> Bool -> IO Double
334 defaultProbability curve point = case point of
335 DatePoint d -> defaultProbabilityAtDateRaw curve d
336 TimePoint t -> defaultProbabilityAtTimeRaw curve t
337
338 -- |Default probability over a same-representation date or year-fraction interval.
339 defaultProbabilityBetween :: GenDefaultProbabilityTermStructure d -> TermInterval -> Bool -> IO Double
340 defaultProbabilityBetween curve interval = case interval of
341 DateInterval d1 d2 -> defaultProbabilityBetweenDatesRaw curve d1 d2
342 TimeInterval t1 t2 -> defaultProbabilityBetweenTimesRaw curve t1 t2
343
344 conditionalSurvivalProbabilityAtDatesRaw :: (AffineHazardRateCurve) -> (Day) -> (Day) -> (Double) -> (Bool) -- ^extrapolate
345 -> IO ((Double))
346 conditionalSurvivalProbabilityAtDatesRaw a1 a2 a3 a4 a5 =
347 withAffineHazardRateCurve a1 $ \a1' ->
348 withDay a2 $ \a2' ->
349 withDay a3 $ \a3' ->
350 let {a4' = realToFrac a4} in
351 let {a5' = C2HSImp.fromBool a5} in
352 preErrorCheck $ \a6' ->
353 conditionalSurvivalProbabilityAtDatesRaw'_ a1' a2' a3' a4' a5' a6' >>= \res ->
354 let {res' = realToFrac res} in
355 errorCheck a6'>>
356 return (res')
357
358
359
360 conditionalSurvivalProbabilityAtTimesRaw :: (AffineHazardRateCurve) -> (Double) -> (Double) -> (Double) -> (Bool) -- ^extrapolate
361 -> IO ((Double))
362 conditionalSurvivalProbabilityAtTimesRaw a1 a2 a3 a4 a5 =
363 withAffineHazardRateCurve a1 $ \a1' ->
364 let {a2' = realToFrac a2} in
365 let {a3' = realToFrac a3} in
366 let {a4' = realToFrac a4} in
367 let {a5' = C2HSImp.fromBool a5} in
368 preErrorCheck $ \a6' ->
369 conditionalSurvivalProbabilityAtTimesRaw'_ a1' a2' a3' a4' a5' a6' >>= \res ->
370 let {res' = realToFrac res} in
371 errorCheck a6'>>
372 return (res')
373
374
375
376 -- |Probability of survival to the interval's later point, conditional on survival to its earlier
377 -- point and on the stochastic hazard-rate component realizing @yVal@ there -- see
378 -- 'ql/experimental/credit/onefactoraffinesurvival.hpp'.
379 conditionalSurvivalProbability :: AffineHazardRateCurve -> TermInterval -> Double -- ^yVal
380 -> Bool -> IO Double
381 conditionalSurvivalProbability curve interval yVal = case interval of
382 DateInterval d1 d2 -> conditionalSurvivalProbabilityAtDatesRaw curve d1 d2 yVal
383 TimeInterval t1 t2 -> conditionalSurvivalProbabilityAtTimesRaw curve t1 t2 yVal
384
385 -- |bootstrap helper for a CDS quoted by running spread
386 spreadCdsHelper :: (GenQuote q) -- ^runningSpread
387 -> ((Word,TimeUnit)) -- ^tenor
388 -> (Int) -- ^settlementDays
389 -> (Calendar) -> (Frequency) -> (BusinessDayConvention) -> (DateGenerationRule) -> (DayCounter) -> (Double) -- recoveryRate
390 -> (GenYieldTermStructure y) -- ^discountCurve
391 -> (Bool) -- ^settlesAccrual
392 -> (Bool) -- ^paysAtDefaultTime
393 -> (Maybe Day) -- ^startDate
394 -> (DayCounter) -- ^lastPeriodDayCounter
395 -> (Bool) -- ^rebatesAccrual
396 -> (PricingModel) -- ^model
397 -> (Maybe Day) -- ^tradeDate (1.44; QuantLib 1.43 requires 'Nothing')
398 -> IO ((DefaultProbabilityHelper))
399 spreadCdsHelper a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 =
400 withQuote a1 $ \a1' ->
401 let {(a2'1, a2'2) = fromEnumQuantity a2} in
402 let {a3' = fromIntegral a3} in
403 withCalendar a4 $ \a4' ->
404 let {a5' = (fromIntegral . fromEnum) a5} in
405 let {a6' = fromEnumC a6} in
406 let {a7' = (fromIntegral . fromEnum) a7} in
407 withDayCounter a8 $ \a8' ->
408 let {a9' = realToFrac a9} in
409 withYieldTermStructure a10 $ \a10' ->
410 let {a11' = C2HSImp.fromBool a11} in
411 let {a12' = C2HSImp.fromBool a12} in
412 withMaybeDay a13 $ \a13' ->
413 withDayCounter a14 $ \a14' ->
414 let {a15' = C2HSImp.fromBool a15} in
415 let {a16' = (fromIntegral . fromEnum) a16} in
416 withMaybeDay a17 $ \a17' ->
417 preErrorCheck $ \a18' ->
418 spreadCdsHelper'_ a1' a2'1 a2'2 a3' a4' a5' a6' a7' a8' a9' a10' a11' a12' a13' a14' a15' a16' a17' a18' >>= \res ->
419 peekDefaultProbabilityHelper res >>= \res' ->
420 errorCheck a18'>>
421 return (res')
422
423
424
425 -- |the upfront must be quoted in fractional units.
426 upfrontCdsHelper :: (GenQuote q) -- ^upfront
427 -> (Double) -- ^runningSpread
428 -> ((Word,TimeUnit)) -- ^tenor
429 -> (Int) -- ^settlementDays
430 -> (Calendar) -> (Frequency) -> (BusinessDayConvention) -> (DateGenerationRule) -> (DayCounter) -> (Double) -- ^recoveryDate
431 -> (GenYieldTermStructure y) -- ^discountCurve
432 -> (Word) -- ^upfrontSettlementDays
433 -> (Bool) -- &settlesAccrual
434 -> (Bool) -- ^paysAtDefaultTime
435 -> (Maybe Day) -- ^startDate
436 -> (DayCounter) -- ^lastPeriodDayCounter
437 -> (Bool) -- ^rebatesAccrual
438 -> (PricingModel) -- ^model
439 -> (Maybe Day) -- ^tradeDate (1.44; QuantLib 1.43 requires 'Nothing')
440 -> IO ((DefaultProbabilityHelper))
441 upfrontCdsHelper a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 a19 =
442 withQuote a1 $ \a1' ->
443 let {a2' = realToFrac a2} in
444 let {(a3'1, a3'2) = fromEnumQuantity a3} in
445 let {a4' = fromIntegral a4} in
446 withCalendar a5 $ \a5' ->
447 let {a6' = (fromIntegral . fromEnum) a6} in
448 let {a7' = fromEnumC a7} in
449 let {a8' = (fromIntegral . fromEnum) a8} in
450 withDayCounter a9 $ \a9' ->
451 let {a10' = realToFrac a10} in
452 withYieldTermStructure a11 $ \a11' ->
453 let {a12' = fromIntegral a12} in
454 let {a13' = C2HSImp.fromBool a13} in
455 let {a14' = C2HSImp.fromBool a14} in
456 withMaybeDay a15 $ \a15' ->
457 withDayCounter a16 $ \a16' ->
458 let {a17' = C2HSImp.fromBool a17} in
459 let {a18' = (fromIntegral . fromEnum) a18} in
460 withMaybeDay a19 $ \a19' ->
461 preErrorCheck $ \a20' ->
462 upfrontCdsHelper'_ a1' a2' a3'1 a3'2 a4' a5' a6' a7' a8' a9' a10' a11' a12' a13' a14' a15' a16' a17' a18' a19' a20' >>= \res ->
463 peekDefaultProbabilityHelper res >>= \res' ->
464 errorCheck a20'>>
465 return (res')
466
467
468
469 -- |The fair running-spread/upfront quote implied by the helper's current market data and pricing
470 -- engine -- the value that would make the quoted instrument re-price at par. Requires the helper
471 -- to have already been used to bootstrap a curve (throws otherwise, per upstream).
472 impliedQuote :: (DefaultProbabilityHelper) -> IO ((Double))
473 impliedQuote a1 =
474 withDefaultProbabilityHelper a1 $ \a1' ->
475 preErrorCheck $ \a2' ->
476 impliedQuote'_ a1' a2' >>= \res ->
477 let {res' = realToFrac res} in
478 errorCheck a2'>>
479 return (res')
480
481
482
483 -- |The quote that would make the helper reprice exactly on the given default-probability curve:
484 -- a par spread or upfront read with the helper's own conventions on any credit curve.
485 impliedQuoteOn :: (DefaultProbabilityHelper) -> (GenDefaultProbabilityTermStructure d) -> IO ((Double))
486 impliedQuoteOn a1 a2 =
487 withDefaultProbabilityHelper a1 $ \a1' ->
488 withDefaultProbabilityTermStructure a2 $ \a2' ->
489 preErrorCheck $ \a3' ->
490 impliedQuoteOn'_ a1' a2' a3' >>= \res ->
491 let {res' = realToFrac res} in
492 errorCheck a3'>>
493 return (res')
494
495
496
497 interpolatedDefaultDensityCurve :: NonEmpty (Day, Double) -> DayCounter -> Calendar -> [(Day, GenQuote q)] -- ^jumps
498 -> Interpolation -> Bool -> IO DefaultProbabilityTermStructure
499 interpolatedDefaultDensityCurve d dc c q i ex = do
500 curve <- uncurryNested (qlInterpolatedDefaultDensityCurve dd dq dc c qq qd) (qlInterpolation i)
501 setExtrapolation curve ex
502 pure curve
503 where (qd, qq) = unzip q
504 (dd, dq) = unzip (toList d)
505
506 -- |default-probability term structure built by interpolating default densities at given dates
507 qlInterpolatedDefaultDensityCurve :: ([Day]) -> ([Double]) -> (DayCounter) -> (Calendar) -> ([GenQuote q]) -> ([Day]) -> (Int) -> (Int) -> (Int) -> IO ((DefaultProbabilityTermStructure))
508 qlInterpolatedDefaultDensityCurve a1 a2 a3 a4 a5 a6 a7 a8 a9 =
509 withDayArray a1 $ \(a1'1, a1'2) ->
510 withDoubleArray a2 $ \(a2'1, a2'2) ->
511 withDayCounter a3 $ \a3' ->
512 withCalendar a4 $ \a4' ->
513 withQuoteArray a5 $ \(a5'1, a5'2) ->
514 withDayArray a6 $ \(a6'1, a6'2) ->
515 let {a7' = fromIntegral a7} in
516 let {a8' = fromIntegral a8} in
517 let {a9' = fromIntegral a9} in
518 preErrorCheck $ \a10' ->
519 qlInterpolatedDefaultDensityCurve'_ a1'1 a1'2 a2'1 a2'2 a3' a4' a5'1 a5'2 a6'1 a6'2 a7' a8' a9' a10' >>= \res ->
520 peekDefaultProbabilityTermStructure res >>= \res' ->
521 errorCheck a10'>>
522 return (res')
523
524
525
526 interpolatedHazardRateCurve :: NonEmpty (Day, Double) -> DayCounter -> Calendar -> [(Day, GenQuote q)] -- ^jumps
527 -> Interpolation
528 -> Bool -- ^extrapolate past the curve's max date
529 -> IO DefaultProbabilityTermStructure
530 interpolatedHazardRateCurve d dc c q i ex = uncurryNested (qlInterpolatedHazardRateCurve dd dq dc c qq qd) (qlInterpolation i) ex where {(qd, qq) = unzip q; (dd, dq) = unzip (toList d)}
531
532 -- |default-probability term structure built by interpolating hazard rates at given dates
533 qlInterpolatedHazardRateCurve :: ([Day]) -> ([Double]) -> (DayCounter) -> (Calendar) -> ([GenQuote q]) -> ([Day]) -> (Int) -> (Int) -> (Int) -> (Bool) -> IO ((DefaultProbabilityTermStructure))
534 qlInterpolatedHazardRateCurve a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 =
535 withDayArray a1 $ \(a1'1, a1'2) ->
536 withDoubleArray a2 $ \(a2'1, a2'2) ->
537 withDayCounter a3 $ \a3' ->
538 withCalendar a4 $ \a4' ->
539 withQuoteArray a5 $ \(a5'1, a5'2) ->
540 withDayArray a6 $ \(a6'1, a6'2) ->
541 let {a7' = fromIntegral a7} in
542 let {a8' = fromIntegral a8} in
543 let {a9' = fromIntegral a9} in
544 let {a10' = C2HSImp.fromBool a10} in
545 preErrorCheck $ \a11' ->
546 qlInterpolatedHazardRateCurve'_ a1'1 a1'2 a2'1 a2'2 a3' a4' a5'1 a5'2 a6'1 a6'2 a7' a8' a9' a10' a11' >>= \res ->
547 peekDefaultProbabilityTermStructure res >>= \res' ->
548 errorCheck a11'>>
549 return (res')
550
551
552
553 -- |Hazard-rate curve interpolated deterministically between nodes, combined with a one-factor
554 -- affine short-rate model's stochastic discount mechanics -- see
555 -- 'ql/experimental/credit/interpolatedaffinehazardratecurve.hpp'.
556 interpolatedAffineHazardRateCurve :: NonEmpty (Day, Double) -> DayCounter -> GenOneFactorAffineModel om -> Calendar -> [(Day, GenQuote q)] -- ^jumps
557 -> Interpolation
558 -> Bool -- ^extrapolate past the curve's max date
559 -> IO AffineHazardRateCurve
560 interpolatedAffineHazardRateCurve d dc m c q i ex =
561 uncurryNested (qlInterpolatedAffineHazardRateCurve dd dq dc m c qq qd) (qlInterpolation i) ex
562 where {(qd, qq) = unzip q; (dd, dq) = unzip (toList d)}
563
564 qlInterpolatedAffineHazardRateCurve :: ([Day]) -> ([Double]) -> (DayCounter) -> (GenOneFactorAffineModel om) -> (Calendar) -> ([GenQuote q]) -> ([Day]) -> (Int) -> (Int) -> (Int) -> (Bool) -> IO ((AffineHazardRateCurve))
565 qlInterpolatedAffineHazardRateCurve a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 =
566 withDayArray a1 $ \(a1'1, a1'2) ->
567 withDoubleArray a2 $ \(a2'1, a2'2) ->
568 withDayCounter a3 $ \a3' ->
569 withOneFactorAffineModel a4 $ \a4' ->
570 withCalendar a5 $ \a5' ->
571 withQuoteArray a6 $ \(a6'1, a6'2) ->
572 withDayArray a7 $ \(a7'1, a7'2) ->
573 let {a8' = fromIntegral a8} in
574 let {a9' = fromIntegral a9} in
575 let {a10' = fromIntegral a10} in
576 let {a11' = C2HSImp.fromBool a11} in
577 preErrorCheck $ \a12' ->
578 qlInterpolatedAffineHazardRateCurve'_ a1'1 a1'2 a2'1 a2'2 a3' a4' a5' a6'1 a6'2 a7'1 a7'2 a8' a9' a10' a11' a12' >>= \res ->
579 peekAffineHazardRateCurve res >>= \res' ->
580 errorCheck a12'>>
581 return (res')
582
583
584
585 interpolatedSurvivalProbabilityCurve :: NonEmpty (Day, Double) -> DayCounter -> Calendar -> [(Day, GenQuote q)] -- ^jumps
586 -> Interpolation -> Bool -> IO DefaultProbabilityTermStructure
587 interpolatedSurvivalProbabilityCurve d dc c q i ex = do
588 curve <- uncurryNested (qlInterpolatedSurvivalProbabilityCurve dd dq dc c qq qd) (qlInterpolation i)
589 setExtrapolation curve ex
590 pure curve
591 where (qd, qq) = unzip q
592 (dd, dq) = unzip (toList d)
593
594 -- |default-probability term structure built by interpolating survival probabilities at given dates
595 qlInterpolatedSurvivalProbabilityCurve :: ([Day]) -> ([Double]) -> (DayCounter) -> (Calendar) -> ([GenQuote q]) -> ([Day]) -> (Int) -> (Int) -> (Int) -> IO ((DefaultProbabilityTermStructure))
596 qlInterpolatedSurvivalProbabilityCurve a1 a2 a3 a4 a5 a6 a7 a8 a9 =
597 withDayArray a1 $ \(a1'1, a1'2) ->
598 withDoubleArray a2 $ \(a2'1, a2'2) ->
599 withDayCounter a3 $ \a3' ->
600 withCalendar a4 $ \a4' ->
601 withQuoteArray a5 $ \(a5'1, a5'2) ->
602 withDayArray a6 $ \(a6'1, a6'2) ->
603 let {a7' = fromIntegral a7} in
604 let {a8' = fromIntegral a8} in
605 let {a9' = fromIntegral a9} in
606 preErrorCheck $ \a10' ->
607 qlInterpolatedSurvivalProbabilityCurve'_ a1'1 a1'2 a2'1 a2'2 a3' a4' a5'1 a5'2 a6'1 a6'2 a7' a8' a9' a10' >>= \res ->
608 peekDefaultProbabilityTermStructure res >>= \res' ->
609 errorCheck a10'>>
610 return (res')
611
612
613
614 -- QuantLib uses Null<Real>() rather than a number for these defaults.
615 nullableDouble :: Maybe Double -> Double
616 nullableDouble = realToFrac . fromMaybeDouble
617
618 -- |Default-probability term structure bootstrapped from CDS/default helpers with either a fixed
619 -- or evaluation-date-relative reference point and complete iterative-bootstrap settings.
620 piecewiseDefaultCurve :: Reference
621 -> NonEmpty DefaultProbabilityHelper -- ^instruments
622 -> DayCounter -- ^dayCounter
623 -> [(Day, GenQuote q)] -- ^jumps paired with their dates
624 -> ProbabilityTrait -- ^bootstrap trait
625 -> Interpolation -- ^interpolator
626 -> IterativeBootstrapOpts -- ^bootstrap settings
627 -> Bool -- ^extrapolate past the curve's max date
628 -> IO DefaultProbabilityTermStructure
629 piecewiseDefaultCurve reference h dc q t i b ex = do
630 curve <- case reference of
631 ReferenceDate d -> uncurryNested (piecewiseDefaultCurve_ d hs dc qq qd t) (qlInterpolation i)
632 (nullableDouble (ibAccuracy b)) (nullableDouble (ibMinValue b)) (nullableDouble (ibMaxValue b))
633 (ibMaxAttempts b) (ibMaxFactor b) (ibMinFactor b) (ibDontThrow b) (ibDontThrowSteps b) (ibMaxEvaluations b)
634 SettlementDays d c -> uncurryNested (piecewiseDefaultCurve1_ d c hs dc qq qd t) (qlInterpolation i)
635 (nullableDouble (ibAccuracy b)) (nullableDouble (ibMinValue b)) (nullableDouble (ibMaxValue b))
636 (ibMaxAttempts b) (ibMaxFactor b) (ibMinFactor b) (ibDontThrow b) (ibDontThrowSteps b) (ibMaxEvaluations b)
637 setExtrapolation curve ex
638 pure curve
639 where (qd, qq) = unzip q
640 hs = toList h
641 piecewiseDefaultCurve_ :: (Day) -> ([DefaultProbabilityHelper]) -> (DayCounter) -> ([GenQuote q]) -> ([Day]) -> (ProbabilityTrait) -> (Int) -> (Int) -> (Int) -> (Double) -> (Double) -> (Double) -> (Word) -> (Double) -> (Double) -> (Bool) -> (Word) -> (Word) -> IO ((DefaultProbabilityTermStructure))
642 piecewiseDefaultCurve_ a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 =
643 withDay a1 $ \a1' ->
644 withDefaultProbabilityHelperArray a2 $ \(a2'1, a2'2) ->
645 withDayCounter a3 $ \a3' ->
646 withQuoteArray a4 $ \(a4'1, a4'2) ->
647 withDayArray a5 $ \(a5'1, a5'2) ->
648 let {a6' = (fromIntegral . fromEnum) a6} in
649 let {a7' = fromIntegral a7} in
650 let {a8' = fromIntegral a8} in
651 let {a9' = fromIntegral a9} in
652 let {a10' = realToFrac a10} in
653 let {a11' = realToFrac a11} in
654 let {a12' = realToFrac a12} in
655 let {a13' = fromIntegral a13} in
656 let {a14' = realToFrac a14} in
657 let {a15' = realToFrac a15} in
658 let {a16' = C2HSImp.fromBool a16} in
659 let {a17' = fromIntegral a17} in
660 let {a18' = fromIntegral a18} in
661 preErrorCheck $ \a19' ->
662 piecewiseDefaultCurve_'_ 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 ->
663 peekDefaultProbabilityTermStructure res >>= \res' ->
664 errorCheck a19'>>
665 return (res')
666
667
668 piecewiseDefaultCurve1_ :: (Word) -> (Calendar) -> ([DefaultProbabilityHelper]) -> (DayCounter) -> ([GenQuote q]) -> ([Day]) -> (ProbabilityTrait) -> (Int) -> (Int) -> (Int) -> (Double) -> (Double) -> (Double) -> (Word) -> (Double) -> (Double) -> (Bool) -> (Word) -> (Word) -> IO ((DefaultProbabilityTermStructure))
669 piecewiseDefaultCurve1_ a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 a19 =
670 let {a1' = fromIntegral a1} in
671 withCalendar a2 $ \a2' ->
672 withDefaultProbabilityHelperArray a3 $ \(a3'1, a3'2) ->
673 withDayCounter a4 $ \a4' ->
674 withQuoteArray a5 $ \(a5'1, a5'2) ->
675 withDayArray a6 $ \(a6'1, a6'2) ->
676 let {a7' = (fromIntegral . fromEnum) a7} in
677 let {a8' = fromIntegral a8} in
678 let {a9' = fromIntegral a9} in
679 let {a10' = fromIntegral a10} in
680 let {a11' = realToFrac a11} in
681 let {a12' = realToFrac a12} in
682 let {a13' = realToFrac a13} in
683 let {a14' = fromIntegral a14} in
684 let {a15' = realToFrac a15} in
685 let {a16' = realToFrac a16} in
686 let {a17' = C2HSImp.fromBool a17} in
687 let {a18' = fromIntegral a18} in
688 let {a19' = fromIntegral a19} in
689 preErrorCheck $ \a20' ->
690 piecewiseDefaultCurve1_'_ 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' >>= \res ->
691 peekDefaultProbabilityTermStructure res >>= \res' ->
692 errorCheck a20'>>
693 return (res')
694
695
696
697 -- vim: set ff=unix ts=8 sts=2 sw=2 et:
698
699 foreign import ccall safe "QuantLib/TermStructure/Credit.chs.h qlFactorSpreadedHazardRateCurve"
700 factorSpreadedHazardRateCurve'_ :: ((C2HSImp.Ptr (CDefaultProbabilityTermStructure')) -> ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CDefaultProbabilityTermStructure'))))))
701
702 foreign import ccall safe "QuantLib/TermStructure/Credit.chs.h qlFlatHazardRate1"
703 flatHazardRateMovingRaw'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr (CCalendar)) -> ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CDayCounter)) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CDefaultProbabilityTermStructure'))))))))
704
705 foreign import ccall safe "QuantLib/TermStructure/Credit.chs.h qlFlatHazardRate"
706 flatHazardRateFixed'_ :: (C2HSImp.CInt -> ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CDayCounter)) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CDefaultProbabilityTermStructure')))))))
707
708 foreign import ccall safe "QuantLib/TermStructure/Credit.chs.h qlSpreadedHazardRateCurve"
709 spreadedHazardRateCurve'_ :: ((C2HSImp.Ptr (CDefaultProbabilityTermStructure')) -> ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CDefaultProbabilityTermStructure'))))))
710
711 foreign import ccall safe "QuantLib/TermStructure/Credit.chs.h qlDefaultProbabilityTermStructureDefaultProbability"
712 defaultProbabilityAtDateRaw'_ :: ((C2HSImp.Ptr (CDefaultProbabilityTermStructure')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))))
713
714 foreign import ccall safe "QuantLib/TermStructure/Credit.chs.h qlDefaultProbabilityTermStructureHazardRate1"
715 hazardRateAtTimeRaw'_ :: ((C2HSImp.Ptr (CDefaultProbabilityTermStructure')) -> (C2HSImp.CDouble -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))))
716
717 foreign import ccall safe "QuantLib/TermStructure/Credit.chs.h qlDefaultProbabilityTermStructureHazardRate"
718 hazardRateAtDateRaw'_ :: ((C2HSImp.Ptr (CDefaultProbabilityTermStructure')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))))
719
720 foreign import ccall safe "QuantLib/TermStructure/Credit.chs.h qlDefaultProbabilityTermStructureSurvivalProbability1"
721 survivalProbabilityAtTimeRaw'_ :: ((C2HSImp.Ptr (CDefaultProbabilityTermStructure')) -> (C2HSImp.CDouble -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))))
722
723 foreign import ccall safe "QuantLib/TermStructure/Credit.chs.h qlDefaultProbabilityTermStructureSurvivalProbability"
724 survivalProbabilityAtDateRaw'_ :: ((C2HSImp.Ptr (CDefaultProbabilityTermStructure')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))))
725
726 foreign import ccall safe "QuantLib/TermStructure/Credit.chs.h qlDefaultProbabilityTermStructureDefaultDensity1"
727 defaultDensityAtTimeRaw'_ :: ((C2HSImp.Ptr (CDefaultProbabilityTermStructure')) -> (C2HSImp.CDouble -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))))
728
729 foreign import ccall safe "QuantLib/TermStructure/Credit.chs.h qlDefaultProbabilityTermStructureDefaultDensity"
730 defaultDensityAtDateRaw'_ :: ((C2HSImp.Ptr (CDefaultProbabilityTermStructure')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))))
731
732 foreign import ccall safe "QuantLib/TermStructure/Credit.chs.h qlDefaultProbabilityTermStructureDefaultProbability1"
733 defaultProbabilityAtTimeRaw'_ :: ((C2HSImp.Ptr (CDefaultProbabilityTermStructure')) -> (C2HSImp.CDouble -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))))
734
735 foreign import ccall safe "QuantLib/TermStructure/Credit.chs.h qlDefaultProbabilityTermStructureDefaultProbability2"
736 defaultProbabilityBetweenDatesRaw'_ :: ((C2HSImp.Ptr (CDefaultProbabilityTermStructure')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble))))))
737
738 foreign import ccall safe "QuantLib/TermStructure/Credit.chs.h qlDefaultProbabilityTermStructureDefaultProbability3"
739 defaultProbabilityBetweenTimesRaw'_ :: ((C2HSImp.Ptr (CDefaultProbabilityTermStructure')) -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble))))))
740
741 foreign import ccall safe "QuantLib/TermStructure/Credit.chs.h qlAffineHazardRateCurveConditionalSurvivalProbability"
742 conditionalSurvivalProbabilityAtDatesRaw'_ :: ((C2HSImp.Ptr (CAffineHazardRateCurve')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))))))
743
744 foreign import ccall safe "QuantLib/TermStructure/Credit.chs.h qlAffineHazardRateCurveConditionalSurvivalProbability1"
745 conditionalSurvivalProbabilityAtTimesRaw'_ :: ((C2HSImp.Ptr (CAffineHazardRateCurve')) -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))))))
746
747 foreign import ccall safe "QuantLib/TermStructure/Credit.chs.h qlSpreadCdsHelper"
748 spreadCdsHelper'_ :: ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CDefaultProbabilityHelper))))))))))))))))))))))
749
750 foreign import ccall safe "QuantLib/TermStructure/Credit.chs.h qlUpfrontCdsHelper"
751 upfrontCdsHelper'_ :: ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CDouble -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CUInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CDefaultProbabilityHelper))))))))))))))))))))))))
752
753 foreign import ccall safe "QuantLib/TermStructure/Credit.chs.h qlDefaultProbabilityHelperImpliedQuote"
754 impliedQuote'_ :: ((C2HSImp.Ptr (CDefaultProbabilityHelper)) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))
755
756 foreign import ccall safe "QuantLib/TermStructure/Credit.chs.h qlDefaultProbabilityHelperImpliedQuoteOn"
757 impliedQuoteOn'_ :: ((C2HSImp.Ptr (CDefaultProbabilityHelper)) -> ((C2HSImp.Ptr (CDefaultProbabilityTermStructure')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble))))
758
759 foreign import ccall safe "QuantLib/TermStructure/Credit.chs.h qlInterpolatedDefaultDensityCurve"
760 qlInterpolatedDefaultDensityCurve'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((C2HSImp.Ptr (CDayCounter)) -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CQuote'))) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CDefaultProbabilityTermStructure')))))))))))))))))
761
762 foreign import ccall safe "QuantLib/TermStructure/Credit.chs.h qlInterpolatedHazardRateCurve"
763 qlInterpolatedHazardRateCurve'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((C2HSImp.Ptr (CDayCounter)) -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CQuote'))) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CDefaultProbabilityTermStructure'))))))))))))))))))
764
765 foreign import ccall safe "QuantLib/TermStructure/Credit.chs.h qlInterpolatedAffineHazardRateCurve"
766 qlInterpolatedAffineHazardRateCurve'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((C2HSImp.Ptr (CDayCounter)) -> ((C2HSImp.Ptr (COneFactorAffineModel')) -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CQuote'))) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CAffineHazardRateCurve')))))))))))))))))))
767
768 foreign import ccall safe "QuantLib/TermStructure/Credit.chs.h qlInterpolatedSurvivalProbabilityCurve"
769 qlInterpolatedSurvivalProbabilityCurve'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((C2HSImp.Ptr (CDayCounter)) -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CQuote'))) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CDefaultProbabilityTermStructure')))))))))))))))))
770
771 foreign import ccall safe "QuantLib/TermStructure/Credit.chs.h qlPiecewiseDefaultCurve"
772 piecewiseDefaultCurve_'_ :: (C2HSImp.CInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CDefaultProbabilityHelper))) -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CQuote'))) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CInt -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CDefaultProbabilityTermStructure')))))))))))))))))))))))))
773
774 foreign import ccall safe "QuantLib/TermStructure/Credit.chs.h qlPiecewiseDefaultCurve1"
775 piecewiseDefaultCurve1_'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr (CCalendar)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CDefaultProbabilityHelper))) -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CQuote'))) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CInt -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CDefaultProbabilityTermStructure'))))))))))))))))))))))))))