| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
QuantLib.Instrument.Credit
Synopsis
- type CreditDefaultSwap = GenInstrument CCreditDefaultSwap
- data ProtectionSide
- data Claim
- creditDefaultSwap :: ProtectionSide -> Double -> Double -> Schedule -> BusinessDayConvention -> DayCounter -> Bool -> Bool -> Maybe Day -> Claim -> IO CreditDefaultSwap
- creditDefaultSwap' :: ProtectionSide -> Double -> Double -> Double -> Schedule -> BusinessDayConvention -> DayCounter -> Bool -> Bool -> Maybe Day -> Maybe Day -> Claim -> IO CreditDefaultSwap
- atmRate :: CdsOption -> IO Double
- cdsOption :: CreditDefaultSwap -> Exercise -> Bool -> IO CdsOption
- impliedVolatility :: CdsOption -> Double -> GenYieldTermStructure a -> DefaultProbabilityTermStructure -> Double -> Double -> Word -> Double -> Double -> IO Double
- riskyAnnuity :: CdsOption -> IO Double
- conventionalSpread :: CreditDefaultSwap -> Double -> GenYieldTermStructure a -> DayCounter -> IO Double
- couponLegBPS :: CreditDefaultSwap -> IO Double
- couponLegNPV :: CreditDefaultSwap -> IO Double
- coupons :: CreditDefaultSwap -> IO Leg
- defaultLegNPV :: CreditDefaultSwap -> IO Double
- fairUpfront :: CreditDefaultSwap -> IO Double
- impliedHazardRate :: CreditDefaultSwap -> Double -> GenYieldTermStructure a -> DayCounter -> Double -> Double -> IO Double
- upfrontBPS :: CreditDefaultSwap -> IO Double
- upfrontNPV :: CreditDefaultSwap -> IO Double
Documentation
type CreditDefaultSwap = GenInstrument CCreditDefaultSwap #
data ProtectionSide #
Instances
| Enum ProtectionSide # | |
Defined in QuantLib.Instrument.Credit Methods succ :: ProtectionSide -> ProtectionSide # pred :: ProtectionSide -> ProtectionSide # toEnum :: Int -> ProtectionSide # fromEnum :: ProtectionSide -> Int # enumFrom :: ProtectionSide -> [ProtectionSide] # enumFromThen :: ProtectionSide -> ProtectionSide -> [ProtectionSide] # enumFromTo :: ProtectionSide -> ProtectionSide -> [ProtectionSide] # enumFromThenTo :: ProtectionSide -> ProtectionSide -> ProtectionSide -> [ProtectionSide] # | |
| Show ProtectionSide # | |
Defined in QuantLib.Instrument.Credit Methods showsPrec :: Int -> ProtectionSide -> ShowS # show :: ProtectionSide -> String # showList :: [ProtectionSide] -> ShowS # | |
| Eq ProtectionSide # | |
Defined in QuantLib.Instrument.Credit Methods (==) :: ProtectionSide -> ProtectionSide -> Bool # (/=) :: ProtectionSide -> ProtectionSide -> Bool # | |
Constructors
| FaceValue | |
| FaceValueAccrual Bond |
Arguments
| :: ProtectionSide | |
| -> Double | notional |
| -> Double | spread |
| -> Schedule | |
| -> BusinessDayConvention | |
| -> DayCounter | |
| -> Bool | settlesAccrual |
| -> Bool | paysAtDefaultTime |
| -> Maybe Day | protectionStart |
| -> Claim | |
| -> IO CreditDefaultSwap |
CDS quoted as running-spread only. 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.
CDS quoted as upfront and running spread. 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.
Arguments
| :: ProtectionSide | |
| -> Double | notional |
| -> Double | upfront |
| -> Double | spread |
| -> Schedule | |
| -> BusinessDayConvention | |
| -> DayCounter | |
| -> Bool | settlesAccrual |
| -> Bool | paysAtDefaultTime |
| -> Maybe Day | protectionStart |
| -> Maybe Day | upfrontDate |
| -> Claim | |
| -> IO CreditDefaultSwap |
riskyAnnuity :: CdsOption -> IO Double #
Conventional/standard upfront-to-spread conversion. 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.
conventionalSpread :: CreditDefaultSwap -> Double -> GenYieldTermStructure a -> DayCounter -> IO Double #
couponLegBPS :: CreditDefaultSwap -> IO Double #
Returns the variation of the fixed-leg value given a one-basis-point change in the running spread.
couponLegNPV :: CreditDefaultSwap -> IO Double #
coupons :: CreditDefaultSwap -> IO Leg #
defaultLegNPV :: CreditDefaultSwap -> IO Double #
Returns the upfront spread that, given the running spread and the quoted recovery rate, will make the instrument have an NPV of 0.
fairUpfront :: CreditDefaultSwap -> IO Double #
Implied hazard rate calculation. 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.
Arguments
| :: CreditDefaultSwap | |
| -> Double | targetNPV |
| -> GenYieldTermStructure a | |
| -> DayCounter | |
| -> Double | recoveryRate |
| -> Double | accuracy |
| -> IO Double |
upfrontBPS :: CreditDefaultSwap -> IO Double #
upfrontNPV :: CreditDefaultSwap -> IO Double #