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.Instrument.Credit
6 (
7 -- * Types
8 CreditDefaultSwap
9 , SyntheticCDO
10 , NthToDefault
11 , ProtectionSide(..)
12 , Claim(..)
13
14 -- * Constructors
15 -- ** Credit-default swaps and options
16 , creditDefaultSwap
17 , creditDefaultSwapWithUpfront
18 , cdsOption
19 -- ** Portfolio credit
20 , syntheticCdo
21 , nthToDefault
22
23 -- * Inspectors
24 -- ** Credit-default swaps and options
25 , atmRate
26 , impliedVolatility
27 , riskyAnnuity
28 , accrualRebateNpv
29 , conventionalSpread
30 , couponLegBps
31 , couponLegNpv
32 , coupons
33 , defaultLegNpv
34 , fairUpfront
35 , impliedHazardRate
36 , upfrontBps
37 , upfrontNpv
38 -- ** Synthetic CDOs
39 , fairPremium
40 , fairUpfrontPremium
41 , premiumValue
42 , protectionValue
43 , premiumLegNpv
44 , protectionLegNpv
45 , cdoRemainingNotional
46 , implicitCorrelation
47 -- ** Nth-to-default
48 , ntdFairPremium
49 ) where
50 import qualified Foreign.C.Types as C2HSImp
51 import qualified Foreign.ForeignPtr as C2HSImp
52 import qualified Foreign.Marshal.Utils as C2HSImp
53 import qualified Foreign.Ptr as C2HSImp
54
55
56 import Data.List.NonEmpty(NonEmpty)
57
58 import QuantLib.Internal
59 import QuantLib.Internal.Common
60 import QuantLib.Internal.Type
61 import QuantLib.Instrument(PricingModel)
62
63
64
65
66
67
68
69 data ProtectionSide = Buyer
70 | Seller
71 deriving (Enum,Show,Eq,Read)
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102 -- |CDS quoted as running-spread only.
103 -- side Whether the protection is bought or sold. notional Notional value spread Running spread in fractional units. schedule Coupon schedule. paymentConvention Business-day convention for payment-date adjustment. dayCounter Day-count convention for accrual. settlesAccrual Whether or not the accrued coupon is due in the event of a default. paysAtDefaultTime If set to true, any payments triggered by a default event are due at default time. If set to false, they are due at the end of the accrual period. protectionStart The first date where a default event will trigger the contract.
104 creditDefaultSwap :: (ProtectionSide) -> (Double) -- ^notional
105 -> (Double) -- ^spread
106 -> (Schedule) -> (BusinessDayConvention) -> (DayCounter) -> (Bool) -- ^settlesAccrual
107 -> (Bool) -- ^paysAtDefaultTime
108 -> (Maybe Day) -- ^protectionStart
109 -> (Claim) -> (DayCounter) -- ^lastPeriodDayCounter
110 -> (Bool) -- ^rebatesAccrual
111 -> (Maybe Day) -- ^tradeDate
112 -> (Word) -- ^cashSettlementDays
113 -> IO ((CreditDefaultSwap))
114 creditDefaultSwap a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 =
115 let {a1' = (fromIntegral . fromEnum) a1} in
116 let {a2' = realToFrac a2} in
117 let {a3' = realToFrac a3} in
118 withSchedule a4 $ \a4' ->
119 let {a5' = fromEnumC a5} in
120 withDayCounter a6 $ \a6' ->
121 let {a7' = C2HSImp.fromBool a7} in
122 let {a8' = C2HSImp.fromBool a8} in
123 withMaybeDay a9 $ \a9' ->
124 withClaim a10 $ \a10' ->
125 withDayCounter a11 $ \a11' ->
126 let {a12' = C2HSImp.fromBool a12} in
127 withMaybeDay a13 $ \a13' ->
128 let {a14' = fromIntegral a14} in
129 preErrorCheck $ \a15' ->
130 creditDefaultSwap'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' a10' a11' a12' a13' a14' a15' >>= \res ->
131 peekCreditDefaultSwap res >>= \res' ->
132 errorCheck a15'>>
133 return (res')
134
135
136
137 -- |CDS quoted as upfront and running spread.
138 -- side Whether the protection is bought or sold. notional Notional value upfront Upfront in fractional units. spread Running spread in fractional units. schedule Coupon schedule. paymentConvention Business-day convention for payment-date adjustment. dayCounter Day-count convention for accrual. settlesAccrual Whether or not the accrued coupon is due in the event of a default. paysAtDefaultTime If set to true, any payments triggered by a default event are due at default time. If set to false, they are due at the end of the accrual period. protectionStart The first date where a default event will trigger the contract. upfrontDate Settlement date for the upfront payment.
139 creditDefaultSwapWithUpfront :: (ProtectionSide) -> (Double) -- ^notional
140 -> (Double) -- ^upfront
141 -> (Double) -- ^spread
142 -> (Schedule) -> (BusinessDayConvention) -> (DayCounter) -> (Bool) -- ^settlesAccrual
143 -> (Bool) -- ^paysAtDefaultTime
144 -> (Maybe Day) -- ^protectionStart
145 -> (Maybe Day) -- ^upfrontDate
146 -> (Claim) -> (DayCounter) -- ^lastPeriodDayCounter
147 -> (Bool) -- ^rebatesAccrual
148 -> (Maybe Day) -- ^tradeDate
149 -> (Word) -- ^cashSettlementDays
150 -> IO ((CreditDefaultSwap))
151 creditDefaultSwapWithUpfront a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 =
152 let {a1' = (fromIntegral . fromEnum) a1} in
153 let {a2' = realToFrac a2} in
154 let {a3' = realToFrac a3} in
155 let {a4' = realToFrac a4} in
156 withSchedule a5 $ \a5' ->
157 let {a6' = fromEnumC a6} in
158 withDayCounter a7 $ \a7' ->
159 let {a8' = C2HSImp.fromBool a8} in
160 let {a9' = C2HSImp.fromBool a9} in
161 withMaybeDay a10 $ \a10' ->
162 withMaybeDay a11 $ \a11' ->
163 withClaim a12 $ \a12' ->
164 withDayCounter a13 $ \a13' ->
165 let {a14' = C2HSImp.fromBool a14} in
166 withMaybeDay a15 $ \a15' ->
167 let {a16' = fromIntegral a16} in
168 preErrorCheck $ \a17' ->
169 creditDefaultSwapWithUpfront'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' a10' a11' a12' a13' a14' a15' a16' a17' >>= \res ->
170 peekCreditDefaultSwap res >>= \res' ->
171 errorCheck a17'>>
172 return (res')
173
174
175
176 -- |The fair running spread implied by the underlying CDS's term structures at the option's exercise.
177 atmRate :: (CdsOption) -> IO ((Double))
178 atmRate a1 =
179 withCdsOption a1 $ \a1' ->
180 preErrorCheck $ \a2' ->
181 atmRate'_ a1' a2' >>= \res ->
182 let {res' = realToFrac res} in
183 errorCheck a2'>>
184 return (res')
185
186
187
188 -- |An option giving the right to enter the underlying CDS, buying protection and paying coupon.
189 cdsOption :: (CreditDefaultSwap) -> (Exercise) -> (Bool) -- ^knocksOut
190 -> IO ((CdsOption))
191 cdsOption a1 a2 a3 =
192 withGenInstrument a1 $ \a1' ->
193 withExercise a2 $ \a2' ->
194 let {a3' = C2HSImp.fromBool a3} in
195 preErrorCheck $ \a4' ->
196 cdsOption'_ a1' a2' a3' a4' >>= \res ->
197 peekCdsOption res >>= \res' ->
198 errorCheck a4'>>
199 return (res')
200
201
202
203 -- |Volatility that reproduces a given option price under the pricing engine's volatility model.
204 impliedVolatility :: (CdsOption) -> (Double) -- ^price
205 -> (GenYieldTermStructure y) -> (GenDefaultProbabilityTermStructure d) -> (Double) -- ^recoveryRate
206 -> (Double) -- ^accuracy
207 -> (Word) -- ^maxEvaluations
208 -> (Double) -- ^minVol
209 -> (Double) -- ^maxVol
210 -> IO ((Double))
211 impliedVolatility a1 a2 a3 a4 a5 a6 a7 a8 a9 =
212 withCdsOption a1 $ \a1' ->
213 let {a2' = realToFrac a2} in
214 withYieldTermStructure a3 $ \a3' ->
215 withDefaultProbabilityTermStructure a4 $ \a4' ->
216 let {a5' = realToFrac a5} in
217 let {a6' = realToFrac a6} in
218 let {a7' = fromIntegral a7} in
219 let {a8' = realToFrac a8} in
220 let {a9' = realToFrac a9} in
221 preErrorCheck $ \a10' ->
222 impliedVolatility'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' a10' >>= \res ->
223 let {res' = realToFrac res} in
224 errorCheck a10'>>
225 return (res')
226
227
228
229 -- |The risky annuity used to convert between the option's price and its implied volatility.
230 riskyAnnuity :: (CdsOption) -> IO ((Double))
231 riskyAnnuity a1 =
232 withCdsOption a1 $ \a1' ->
233 preErrorCheck $ \a2' ->
234 riskyAnnuity'_ a1' a2' >>= \res ->
235 let {res' = realToFrac res} in
236 errorCheck a2'>>
237 return (res')
238
239
240
241 -- |Conventional/standard upfront-to-spread conversion.
242 -- Under a standard ISDA model and a set of standardised instrument characteristics, it is the running only quoted spread that will make a CDS contract have an NPV of 0 when quoted for that running only spread. Refer to: "ISDA Standard CDS converter specification." May 2009.The conventional recovery rate to apply in the calculation is as specified by ISDA, not necessarily equal to the market-quoted one. It is typically 0.4 for SeniorSec and 0.2 for subordinate.The conversion employs a flat hazard rate. As a result, you will not recover the market quotes.This method performs the calculation with the instrument characteristics. It will coincide with the ISDA calculation if your object has the standard characteristics. Notably: The calendar should have no bank holidays, just weekends.The yield curve should be LIBOR piecewise constant in fwd rates, with a discount factor of 1 on the calculation date, which coincides with the trade date.Convention should be Following for yield curve and contract cashflows.The CDS should pay accrued and mature on standard IMM dates, settle on trade date +1 and upfront settle on trade date +3.
243 conventionalSpread :: (CreditDefaultSwap) -> (Double) -> (GenYieldTermStructure y) -> (DayCounter) -> (PricingModel) -- ^model
244 -> IO ((Double))
245 conventionalSpread a1 a2 a3 a4 a5 =
246 withGenInstrument a1 $ \a1' ->
247 let {a2' = realToFrac a2} in
248 withYieldTermStructure a3 $ \a3' ->
249 withDayCounter a4 $ \a4' ->
250 let {a5' = (fromIntegral . fromEnum) a5} in
251 preErrorCheck $ \a6' ->
252 conventionalSpread'_ a1' a2' a3' a4' a5' a6' >>= \res ->
253 let {res' = realToFrac res} in
254 errorCheck a6'>>
255 return (res')
256
257
258
259 -- |Returns the variation of the fixed-leg value given a one-basis-point change in the running spread.
260 couponLegBps :: (CreditDefaultSwap) -> IO ((Double))
261 couponLegBps a1 =
262 withGenInstrument a1 $ \a1' ->
263 preErrorCheck $ \a2' ->
264 couponLegBps'_ a1' a2' >>= \res ->
265 let {res' = realToFrac res} in
266 errorCheck a2'>>
267 return (res')
268
269
270
271 -- |NPV of the coupon (premium) leg.
272 couponLegNpv :: (CreditDefaultSwap) -> IO ((Double))
273 couponLegNpv a1 =
274 withGenInstrument a1 $ \a1' ->
275 preErrorCheck $ \a2' ->
276 couponLegNpv'_ a1' a2' >>= \res ->
277 let {res' = realToFrac res} in
278 errorCheck a2'>>
279 return (res')
280
281
282
283 -- |The coupon-leg cash flows of the CDS.
284 coupons :: (CreditDefaultSwap) -> IO ((Leg))
285 coupons a1 =
286 withGenInstrument a1 $ \a1' ->
287 preErrorCheck $ \a2' ->
288 coupons'_ a1' a2' >>= \res ->
289 peekLeg res >>= \res' ->
290 errorCheck a2'>>
291 return (res')
292
293
294
295 -- |NPV of the default (protection) leg.
296 defaultLegNpv :: (CreditDefaultSwap) -> IO ((Double))
297 defaultLegNpv a1 =
298 withGenInstrument a1 $ \a1' ->
299 preErrorCheck $ \a2' ->
300 defaultLegNpv'_ a1' a2' >>= \res ->
301 let {res' = realToFrac res} in
302 errorCheck a2'>>
303 return (res')
304
305
306
307 -- |Returns the upfront spread that, given the running spread and the quoted recovery rate, will make the instrument have an NPV of 0.
308 fairUpfront :: (CreditDefaultSwap) -> IO ((Double))
309 fairUpfront a1 =
310 withGenInstrument a1 $ \a1' ->
311 preErrorCheck $ \a2' ->
312 fairUpfront'_ a1' a2' >>= \res ->
313 let {res' = realToFrac res} in
314 errorCheck a2'>>
315 return (res')
316
317
318
319 -- |Implied hazard rate calculation.
320 -- This method performs the calculation with the instrument characteristics. It will coincide with the ISDA calculation if your object has the standard characteristics. Notably: The calendar should have no bank holidays, just weekends.The yield curve should be LIBOR piecewise constant in fwd rates, with a discount factor of 1 on the calculation date, which coincides with the trade date.Convention should be Following for yield curve and contract cashflows.The CDS should pay accrued and mature on standard IMM dates, settle on trade date +1 and upfront settle on trade date +3.
321 impliedHazardRate :: (CreditDefaultSwap) -> (Double) -- ^targetNPV
322 -> (GenYieldTermStructure y) -> (DayCounter) -> (Double) -- ^recoveryRate
323 -> (Double) -- ^accuracy
324 -> (PricingModel) -- ^model
325 -> IO ((Double))
326 impliedHazardRate a1 a2 a3 a4 a5 a6 a7 =
327 withGenInstrument a1 $ \a1' ->
328 let {a2' = realToFrac a2} in
329 withYieldTermStructure a3 $ \a3' ->
330 withDayCounter a4 $ \a4' ->
331 let {a5' = realToFrac a5} in
332 let {a6' = realToFrac a6} in
333 let {a7' = (fromIntegral . fromEnum) a7} in
334 preErrorCheck $ \a8' ->
335 impliedHazardRate'_ a1' a2' a3' a4' a5' a6' a7' a8' >>= \res ->
336 let {res' = realToFrac res} in
337 errorCheck a8'>>
338 return (res')
339
340
341
342 -- |Returns the variation of the upfront payment value given a one-basis-point change in the upfront.
343 upfrontBps :: (CreditDefaultSwap) -> IO ((Double))
344 upfrontBps a1 =
345 withGenInstrument a1 $ \a1' ->
346 preErrorCheck $ \a2' ->
347 upfrontBps'_ a1' a2' >>= \res ->
348 let {res' = realToFrac res} in
349 errorCheck a2'>>
350 return (res')
351
352
353
354 -- |NPV of the upfront payment.
355 upfrontNpv :: (CreditDefaultSwap) -> IO ((Double))
356 upfrontNpv a1 =
357 withGenInstrument a1 $ \a1' ->
358 preErrorCheck $ \a2' ->
359 upfrontNpv'_ a1' a2' >>= \res ->
360 let {res' = realToFrac res} in
361 errorCheck a2'>>
362 return (res')
363
364
365
366 -- |NPV of the rebate paid/received on an early default for the fraction of the accrual period
367 -- elapsed since the last coupon date; zero unless the CDS was constructed with @rebatesAccrual@.
368 accrualRebateNpv :: (CreditDefaultSwap) -> IO ((Double))
369 accrualRebateNpv a1 =
370 withGenInstrument a1 $ \a1' ->
371 preErrorCheck $ \a2' ->
372 accrualRebateNpv'_ a1' a2' >>= \res ->
373 let {res' = realToFrac res} in
374 errorCheck a2'>>
375 return (res')
376
377
378
379 -- |A synthetic CDO tranche over a tranche-loss basket. @notional@ overrides the basket tranche.
380 syntheticCdo :: TrancheBasket -> ProtectionSide -> Schedule -> Double -> Double -> DayCounter -> BusinessDayConvention
381 -> Maybe Double -> IO SyntheticCDO
382 syntheticCdo basket side sched upfrontRate runningRate dc conv notional =
383 syntheticCDO_ basket side sched upfrontRate runningRate dc conv (maybe False (const True) notional) (maybe 0 id notional)
384 syntheticCDO_ :: (TrancheBasket) -> (ProtectionSide) -> (Schedule) -> (Double) -> (Double) -> (DayCounter) -> (BusinessDayConvention) -> (Bool) -> (Double) -> IO ((SyntheticCDO))
385 syntheticCDO_ a1 a2 a3 a4 a5 a6 a7 a8 a9 =
386 withTrancheBasket a1 $ \a1' ->
387 let {a2' = (fromIntegral . fromEnum) a2} in
388 withSchedule a3 $ \a3' ->
389 let {a4' = realToFrac a4} in
390 let {a5' = realToFrac a5} in
391 withDayCounter a6 $ \a6' ->
392 let {a7' = fromEnumC a7} in
393 let {a8' = C2HSImp.fromBool a8} in
394 let {a9' = realToFrac a9} in
395 preErrorCheck $ \a10' ->
396 syntheticCDO_'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' a10' >>= \res ->
397 peekSyntheticCDO res >>= \res' ->
398 errorCheck a10'>>
399 return (res')
400
401
402
403 -- |The fair running premium that makes the tranche's NPV zero (holding the upfront fixed).
404 fairPremium :: (SyntheticCDO) -> IO ((Double))
405 fairPremium a1 =
406 withGenInstrument a1 $ \a1' ->
407 preErrorCheck $ \a2' ->
408 fairPremium'_ a1' a2' >>= \res ->
409 let {res' = realToFrac res} in
410 errorCheck a2'>>
411 return (res')
412
413
414
415 -- |The fair upfront premium that makes the tranche's NPV zero (holding the running rate fixed).
416 fairUpfrontPremium :: (SyntheticCDO) -> IO ((Double))
417 fairUpfrontPremium a1 =
418 withGenInstrument a1 $ \a1' ->
419 preErrorCheck $ \a2' ->
420 fairUpfrontPremium'_ a1' a2' >>= \res ->
421 let {res' = realToFrac res} in
422 errorCheck a2'>>
423 return (res')
424
425
426
427 -- |NPV of the premium (running plus upfront) leg.
428 premiumValue :: (SyntheticCDO) -> IO ((Double))
429 premiumValue a1 =
430 withGenInstrument a1 $ \a1' ->
431 preErrorCheck $ \a2' ->
432 premiumValue'_ a1' a2' >>= \res ->
433 let {res' = realToFrac res} in
434 errorCheck a2'>>
435 return (res')
436
437
438
439 -- |NPV of the protection leg.
440 protectionValue :: (SyntheticCDO) -> IO ((Double))
441 protectionValue a1 =
442 withGenInstrument a1 $ \a1' ->
443 preErrorCheck $ \a2' ->
444 protectionValue'_ a1' a2' >>= \res ->
445 let {res' = realToFrac res} in
446 errorCheck a2'>>
447 return (res')
448
449
450
451 -- |NPV of the premium (running plus upfront) leg, as a plain NPV (not divided by notional).
452 premiumLegNpv :: (SyntheticCDO) -> IO ((Double))
453 premiumLegNpv a1 =
454 withGenInstrument a1 $ \a1' ->
455 preErrorCheck $ \a2' ->
456 premiumLegNpv'_ a1' a2' >>= \res ->
457 let {res' = realToFrac res} in
458 errorCheck a2'>>
459 return (res')
460
461
462
463 -- |NPV of the protection leg, as a plain NPV.
464 protectionLegNpv :: (SyntheticCDO) -> IO ((Double))
465 protectionLegNpv a1 =
466 withGenInstrument a1 $ \a1' ->
467 preErrorCheck $ \a2' ->
468 protectionLegNpv'_ a1' a2' >>= \res ->
469 let {res' = realToFrac res} in
470 errorCheck a2'>>
471 return (res')
472
473
474
475 -- |Total outstanding tranche notional, not wiped out by realized losses.
476 cdoRemainingNotional :: (SyntheticCDO) -> IO ((Double))
477 cdoRemainingNotional a1 =
478 withGenInstrument a1 $ \a1' ->
479 preErrorCheck $ \a2' ->
480 cdoRemainingNotional'_ a1' a2' >>= \res ->
481 let {res' = realToFrac res} in
482 errorCheck a2'>>
483 return (res')
484
485
486
487 -- |The flat Gaussian-copula LHP correlation (constant along time and portfolio loss level)
488 -- that makes the tranche's NPV equal @targetNPV@.
489 -- recoveries One recovery rate per basket name, in the basket's own name order. discountCurve Curve to discount both legs with. targetNPV NPV to match; 0 for a fairly-priced tranche. accuracy Root-finding accuracy on the correlation.
490 implicitCorrelation :: (SyntheticCDO) -> (NonEmpty Double) -- ^recoveries
491 -> (GenYieldTermStructure y) -- ^discountCurve
492 -> (Double) -- ^targetNPV
493 -> (Double) -- ^accuracy
494 -> IO ((Double))
495 implicitCorrelation a1 a2 a3 a4 a5 =
496 withGenInstrument a1 $ \a1' ->
497 withNonEmptyDoubleArray a2 $ \(a2'1, a2'2) ->
498 withYieldTermStructure a3 $ \a3' ->
499 let {a4' = realToFrac a4} in
500 let {a5' = realToFrac a5} in
501 preErrorCheck $ \a6' ->
502 implicitCorrelation'_ a1' a2'1 a2'2 a3' a4' a5' a6' >>= \res ->
503 let {res' = realToFrac res} in
504 errorCheck a6'>>
505 return (res')
506
507
508
509 -- |Protection against the @n@-th default in a 'QuantLib.Credit.DigitalBasket'.
510 nthToDefault :: (DigitalBasket) -> (Word) -> (ProtectionSide) -> (Schedule) -> (Double) -> (Double) -> (DayCounter) -> (Double) -> (Bool) -> IO ((NthToDefault))
511 nthToDefault a1 a2 a3 a4 a5 a6 a7 a8 a9 =
512 withDigitalBasket a1 $ \a1' ->
513 let {a2' = fromIntegral a2} in
514 let {a3' = (fromIntegral . fromEnum) a3} in
515 withSchedule a4 $ \a4' ->
516 let {a5' = realToFrac a5} in
517 let {a6' = realToFrac a6} in
518 withDayCounter a7 $ \a7' ->
519 let {a8' = realToFrac a8} in
520 let {a9' = C2HSImp.fromBool a9} in
521 preErrorCheck $ \a10' ->
522 nthToDefault'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' a10' >>= \res ->
523 peekNthToDefault res >>= \res' ->
524 errorCheck a10'>>
525 return (res')
526
527
528
529 -- |The fair running premium that makes the nth-to-default swap's NPV zero.
530 ntdFairPremium :: (NthToDefault) -> IO ((Double))
531 ntdFairPremium a1 =
532 withGenInstrument a1 $ \a1' ->
533 preErrorCheck $ \a2' ->
534 ntdFairPremium'_ a1' a2' >>= \res ->
535 let {res' = realToFrac res} in
536 errorCheck a2'>>
537 return (res')
538
539
540
541 -- vim: set ff=unix ts=8 sts=2 sw=2 et:
542
543 foreign import ccall safe "QuantLib/Instrument/Credit.chs.h qlCreditDefaultSwap"
544 creditDefaultSwap'_ :: (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (CSchedule)) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CQlClaim)) -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CCreditDefaultSwap'))))))))))))))))))
545
546 foreign import ccall safe "QuantLib/Instrument/Credit.chs.h qlCreditDefaultSwap1"
547 creditDefaultSwapWithUpfront'_ :: (C2HSImp.CInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (CSchedule)) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CQlClaim)) -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CCreditDefaultSwap'))))))))))))))))))))
548
549 foreign import ccall safe "QuantLib/Instrument/Credit.chs.h qlCdsOptionAtmRate"
550 atmRate'_ :: ((C2HSImp.Ptr (CCdsOption')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))
551
552 foreign import ccall safe "QuantLib/Instrument/Credit.chs.h qlCdsOption"
553 cdsOption'_ :: ((C2HSImp.Ptr (CCreditDefaultSwap')) -> ((QlExercise) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CCdsOption')))))))
554
555 foreign import ccall safe "QuantLib/Instrument/Credit.chs.h qlCdsOptionImpliedVolatility"
556 impliedVolatility'_ :: ((C2HSImp.Ptr (CCdsOption')) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CDefaultProbabilityTermStructure')) -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))))))))))
557
558 foreign import ccall safe "QuantLib/Instrument/Credit.chs.h qlCdsOptionRiskyAnnuity"
559 riskyAnnuity'_ :: ((C2HSImp.Ptr (CCdsOption')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))
560
561 foreign import ccall safe "QuantLib/Instrument/Credit.chs.h qlCreditDefaultSwapConventionalSpread"
562 conventionalSpread'_ :: ((C2HSImp.Ptr (CCreditDefaultSwap')) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))))))
563
564 foreign import ccall safe "QuantLib/Instrument/Credit.chs.h qlCreditDefaultSwapCouponLegBPS"
565 couponLegBps'_ :: ((C2HSImp.Ptr (CCreditDefaultSwap')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))
566
567 foreign import ccall safe "QuantLib/Instrument/Credit.chs.h qlCreditDefaultSwapCouponLegNPV"
568 couponLegNpv'_ :: ((C2HSImp.Ptr (CCreditDefaultSwap')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))
569
570 foreign import ccall safe "QuantLib/Instrument/Credit.chs.h qlCreditDefaultSwapCoupons"
571 coupons'_ :: ((C2HSImp.Ptr (CCreditDefaultSwap')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CLeg')))))
572
573 foreign import ccall safe "QuantLib/Instrument/Credit.chs.h qlCreditDefaultSwapDefaultLegNPV"
574 defaultLegNpv'_ :: ((C2HSImp.Ptr (CCreditDefaultSwap')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))
575
576 foreign import ccall safe "QuantLib/Instrument/Credit.chs.h qlCreditDefaultSwapFairUpfront"
577 fairUpfront'_ :: ((C2HSImp.Ptr (CCreditDefaultSwap')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))
578
579 foreign import ccall safe "QuantLib/Instrument/Credit.chs.h qlCreditDefaultSwapImpliedHazardRate"
580 impliedHazardRate'_ :: ((C2HSImp.Ptr (CCreditDefaultSwap')) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))))))))
581
582 foreign import ccall safe "QuantLib/Instrument/Credit.chs.h qlCreditDefaultSwapUpfrontBPS"
583 upfrontBps'_ :: ((C2HSImp.Ptr (CCreditDefaultSwap')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))
584
585 foreign import ccall safe "QuantLib/Instrument/Credit.chs.h qlCreditDefaultSwapUpfrontNPV"
586 upfrontNpv'_ :: ((C2HSImp.Ptr (CCreditDefaultSwap')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))
587
588 foreign import ccall safe "QuantLib/Instrument/Credit.chs.h qlCreditDefaultSwapAccrualRebateNPV"
589 accrualRebateNpv'_ :: ((C2HSImp.Ptr (CCreditDefaultSwap')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))
590
591 foreign import ccall safe "QuantLib/Instrument/Credit.chs.h qlSyntheticCDO"
592 syntheticCDO_'_ :: ((C2HSImp.Ptr (CBasket)) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CSchedule)) -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CSyntheticCDO')))))))))))))
593
594 foreign import ccall safe "QuantLib/Instrument/Credit.chs.h qlSyntheticCDOFairPremium"
595 fairPremium'_ :: ((C2HSImp.Ptr (CSyntheticCDO')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))
596
597 foreign import ccall safe "QuantLib/Instrument/Credit.chs.h qlSyntheticCDOFairUpfrontPremium"
598 fairUpfrontPremium'_ :: ((C2HSImp.Ptr (CSyntheticCDO')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))
599
600 foreign import ccall safe "QuantLib/Instrument/Credit.chs.h qlSyntheticCDOPremiumValue"
601 premiumValue'_ :: ((C2HSImp.Ptr (CSyntheticCDO')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))
602
603 foreign import ccall safe "QuantLib/Instrument/Credit.chs.h qlSyntheticCDOProtectionValue"
604 protectionValue'_ :: ((C2HSImp.Ptr (CSyntheticCDO')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))
605
606 foreign import ccall safe "QuantLib/Instrument/Credit.chs.h qlSyntheticCDOPremiumLegNPV"
607 premiumLegNpv'_ :: ((C2HSImp.Ptr (CSyntheticCDO')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))
608
609 foreign import ccall safe "QuantLib/Instrument/Credit.chs.h qlSyntheticCDOProtectionLegNPV"
610 protectionLegNpv'_ :: ((C2HSImp.Ptr (CSyntheticCDO')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))
611
612 foreign import ccall safe "QuantLib/Instrument/Credit.chs.h qlSyntheticCDORemainingNotional"
613 cdoRemainingNotional'_ :: ((C2HSImp.Ptr (CSyntheticCDO')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))
614
615 foreign import ccall safe "QuantLib/Instrument/Credit.chs.h qlSyntheticCDOImplicitCorrelation"
616 implicitCorrelation'_ :: ((C2HSImp.Ptr (CSyntheticCDO')) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble))))))))
617
618 foreign import ccall safe "QuantLib/Instrument/Credit.chs.h qlNthToDefault"
619 nthToDefault'_ :: ((C2HSImp.Ptr (CBasket)) -> (C2HSImp.CUInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (CSchedule)) -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (CDayCounter)) -> (C2HSImp.CDouble -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO (C2HSImp.Ptr (CNthToDefault')))))))))))))
620
621 foreign import ccall safe "QuantLib/Instrument/Credit.chs.h qlNthToDefaultFairPremium"
622 ntdFairPremium'_ :: ((C2HSImp.Ptr (CNthToDefault')) -> ((C2HSImp.Ptr (C2HSImp.Ptr ())) -> (IO C2HSImp.CDouble)))