| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
QuantLib.Instrument.Swap
Contents
Synopsis
- type GenSwap s = GenInstrument (AnyOf CSwap' s)
- type Swap = GenSwap CSwap
- type GenFixedVsFloatingSwap f = GenSwap (AnyOf CFixedVsFloatingSwap' f)
- type FixedVsFloatingSwap = GenFixedVsFloatingSwap CFixedVsFloatingSwap
- type VanillaSwap = GenFixedVsFloatingSwap CVanillaSwap
- type NonstandardSwap = GenSwap CNonstandardSwap
- type IrregularSwap = GenSwap CIrregularSwap
- type FloatFloatSwap = GenSwap CFloatFloatSwap
- type AssetSwap = GenSwap CAssetSwap
- type OvernightIndexedSwap = GenSwap COvernightIndexedSwap
- type BMASwap = GenSwap CBMASwap
- type ZeroCouponInflationSwap = GenSwap CZeroCouponInflationSwap
- type YearOnYearInflationSwap = GenSwap CYearOnYearInflationSwap
- type CPISwap = GenSwap CCPISwap
- type ZeroCouponSwap = GenSwap CZeroCouponSwap
- type EquityTotalReturnSwap = GenSwap CEquityTotalReturnSwap
- type VarianceSwap = GenInstrument CVarianceSwap
- type GenConstNotionalCrossCurrencySwap x = GenSwap (AnyOf CConstNotionalCrossCurrencySwap' x)
- type ConstNotionalCrossCurrencySwap = GenConstNotionalCrossCurrencySwap CConstNotionalCrossCurrencySwap
- type ConstNotionalCrossCurrencyBasisSwap = GenConstNotionalCrossCurrencySwap CConstNotionalCrossCurrencyBasisSwap
- type ConstNotionalCrossCurrencyFixedVsFloatingSwap = GenConstNotionalCrossCurrencySwap CConstNotionalCrossCurrencyFixedVsFloatingSwap
- type Swaption = GenOption CSwaption
- type IrregularSwaption = GenOption CIrregularSwaption
- type NonstandardSwaption = GenOption CNonstandardSwaption
- type FloatFloatSwaption = GenOption CFloatFloatSwaption
- type VarianceOption = GenInstrument CVarianceOption
- data SwapType
- data SwaptionPriceType
- data IrregularSettlementType
- data CPIInterpolationType
- data CalibrationBasketType
- data FloatFloatSwapOpts = FloatFloatSwapOpts {
- ffsIntermediateCapitalExchange :: Bool
- ffsFinalCapitalExchange :: Bool
- ffsFirstLegGearing :: Double
- ffsFirstLegSpread :: Double
- ffsFirstLegCappedRate :: Maybe Double
- ffsFirstLegFlooredRate :: Maybe Double
- ffsSecondLegGearing :: Double
- ffsSecondLegSpread :: Double
- ffsSecondLegCappedRate :: Maybe Double
- ffsSecondLegFlooredRate :: Maybe Double
- ffsFirstLegPaymentConvention :: Maybe BusinessDayConvention
- ffsSecondLegPaymentConvention :: Maybe BusinessDayConvention
- defaultFloatFloatSwapOpts :: FloatFloatSwapOpts
- data FloatFloatSwapVaryingOpts = FloatFloatSwapVaryingOpts {
- ffsvIntermediateCapitalExchange :: Bool
- ffsvFinalCapitalExchange :: Bool
- ffsvFirstLegGearing :: [Double]
- ffsvFirstLegSpread :: [Double]
- ffsvFirstLegCappedRate :: [Double]
- ffsvFirstLegFlooredRate :: [Double]
- ffsvSecondLegGearing :: [Double]
- ffsvSecondLegSpread :: [Double]
- ffsvSecondLegCappedRate :: [Double]
- ffsvSecondLegFlooredRate :: [Double]
- ffsvFirstLegPaymentConvention :: Maybe BusinessDayConvention
- ffsvSecondLegPaymentConvention :: Maybe BusinessDayConvention
- defaultFloatFloatSwapVaryingOpts :: FloatFloatSwapVaryingOpts
- data ConstNotionalCrossCurrencyBasisSwapOpts = ConstNotionalCrossCurrencyBasisSwapOpts {
- cccbsPayPaymentLag :: Int
- cccbsRecPaymentLag :: Int
- cccbsPayCompoundSpread :: Bool
- cccbsPayObservation :: OvernightObservation
- cccbsPayAveragingMethod :: RateAveragingType
- cccbsRecCompoundSpread :: Bool
- cccbsRecObservation :: OvernightObservation
- cccbsRecAveragingMethod :: RateAveragingType
- cccbsTelescopicValueDates :: Bool
- defaultConstNotionalCrossCurrencyBasisSwapOpts :: ConstNotionalCrossCurrencyBasisSwapOpts
- data OvernightObservation = OvernightObservation {
- lookbackDays :: !(Maybe Word)
- lockoutDays :: !Word
- applyObservationShift :: !Bool
- defaultOvernightObservation :: OvernightObservation
- asSwap :: GenSwap s -> IO Swap
- swapFromLegs :: [(Leg, Bool)] -> IO Swap
- swap :: GenLeg l1 -> GenLeg l2 -> IO Swap
- bmaSwap :: SwapType -> Double -> Schedule -> Double -> Double -> GenIborIndex ibor -> DayCounter -> Schedule -> BMAIndex -> DayCounter -> IO BMASwap
- vanillaSwap :: SwapType -> Double -> Schedule -> Double -> DayCounter -> Schedule -> GenIborIndex ibor -> Double -> DayCounter -> Maybe BusinessDayConvention -> Maybe Bool -> IO VanillaSwap
- nonstandardSwapFromVanilla :: GenFixedVsFloatingSwap f -> IO NonstandardSwap
- nonstandardSwap :: SwapType -> [Double] -> [Double] -> Schedule -> [Double] -> DayCounter -> Schedule -> GenIborIndex ibor -> Double -> Double -> DayCounter -> Bool -> Bool -> Maybe BusinessDayConvention -> IO NonstandardSwap
- nonstandardSwapFromGearingsAndSpreads :: SwapType -> [Double] -> [Double] -> Schedule -> [Double] -> DayCounter -> Schedule -> GenIborIndex ibor -> [Double] -> [Double] -> DayCounter -> Bool -> Bool -> Maybe BusinessDayConvention -> IO NonstandardSwap
- floatFloatSwap :: SwapType -> Double -> Double -> Schedule -> GenInterestRateIndex ridx1 -> DayCounter -> Schedule -> GenInterestRateIndex ridx2 -> DayCounter -> FloatFloatSwapOpts -> IO FloatFloatSwap
- floatFloatSwapFromNominals :: SwapType -> [Double] -> [Double] -> Schedule -> GenInterestRateIndex ridx1 -> DayCounter -> Schedule -> GenInterestRateIndex ridx2 -> DayCounter -> FloatFloatSwapVaryingOpts -> IO FloatFloatSwap
- makeVanillaSwap :: (Word, TimeUnit) -> GenIborIndex ibor -> Double -> (Int, TimeUnit) -> Maybe Int -> (Word, TimeUnit) -> DayCounter -> Maybe BusinessDayConvention -> Maybe BusinessDayConvention -> Maybe Calendar -> Maybe Calendar -> Maybe Double -> Maybe SwapType -> IO VanillaSwap
- makeCms :: (Word, TimeUnit) -> GenSwapIndex sidx -> GenIborIndex ibor -> Double -> (Int, TimeUnit) -> Maybe Int -> (Word, TimeUnit) -> DayCounter -> Maybe Calendar -> Maybe Calendar -> Maybe Double -> Maybe SwapType -> IO Swap
- zeroCouponInflationSwap :: SwapType -> Double -> Day -> Day -> Calendar -> BusinessDayConvention -> DayCounter -> Double -> ZeroInflationIndex -> (Word, TimeUnit) -> CPIInterpolationType -> Bool -> Calendar -> BusinessDayConvention -> IO ZeroCouponInflationSwap
- yearOnYearInflationSwap :: SwapType -> Double -> Schedule -> Double -> DayCounter -> Schedule -> YoYInflationIndex -> (Word, TimeUnit) -> CPIInterpolationType -> Double -> DayCounter -> Calendar -> BusinessDayConvention -> IO YearOnYearInflationSwap
- cpiSwap :: SwapType -> Double -> Bool -> Double -> DayCounter -> Schedule -> BusinessDayConvention -> Word -> GenIborIndex ibor -> Double -> Double -> DayCounter -> Schedule -> BusinessDayConvention -> (Word, TimeUnit) -> ZeroInflationIndex -> CPIInterpolationType -> Maybe Double -> IO CPISwap
- zeroCouponSwap :: SwapType -> Double -> Day -> Day -> Double -> GenIborIndex ibor -> Calendar -> BusinessDayConvention -> Word -> IO ZeroCouponSwap
- zeroCouponSwapFromRate :: SwapType -> Double -> Day -> Day -> Double -> DayCounter -> GenIborIndex ibor -> Calendar -> BusinessDayConvention -> Word -> IO ZeroCouponSwap
- equityTotalReturnSwapIbor :: SwapType -> Double -> Schedule -> EquityIndex -> GenIborIndex ibor -> DayCounter -> Double -> Double -> Calendar -> BusinessDayConvention -> Word -> IO EquityTotalReturnSwap
- equityTotalReturnSwapOvernight :: SwapType -> Double -> Schedule -> EquityIndex -> OvernightIborIndex -> DayCounter -> Double -> Double -> Calendar -> BusinessDayConvention -> Word -> IO EquityTotalReturnSwap
- varianceSwap :: PositionType -> Double -> Double -> Day -> Day -> IO VarianceSwap
- varianceOption :: Payoff -> Double -> Day -> Day -> IO VarianceOption
- constNotionalCrossCurrencySwap :: GenLeg l1 -> Currency -> GenLeg l2 -> Currency -> IO ConstNotionalCrossCurrencySwap
- constNotionalCrossCurrencySwapFromLegs :: [(Leg, Bool)] -> [Currency] -> IO ConstNotionalCrossCurrencySwap
- constNotionalCrossCurrencyBasisSwap :: Double -> Currency -> Schedule -> GenIborIndex ibor1 -> Double -> Double -> Double -> Currency -> Schedule -> GenIborIndex ibor2 -> Double -> Double -> ConstNotionalCrossCurrencyBasisSwapOpts -> IO ConstNotionalCrossCurrencyBasisSwap
- constNotionalCrossCurrencyFixedVsFloatingSwap :: SwapType -> Double -> Currency -> Schedule -> Double -> DayCounter -> BusinessDayConvention -> Word -> Calendar -> Double -> Currency -> Schedule -> GenIborIndex ibor -> Double -> BusinessDayConvention -> Word -> Calendar -> Bool -> Bool -> OvernightObservation -> RateAveragingType -> IO ConstNotionalCrossCurrencyFixedVsFloatingSwap
- overnightIndexedSwap :: SwapType -> Double -> Schedule -> Double -> DayCounter -> OvernightIborIndex -> Double -> Int -> BusinessDayConvention -> Calendar -> Bool -> RateAveragingType -> OvernightObservation -> IO OvernightIndexedSwap
- overnightIndexedSwapFromNominals :: SwapType -> [Double] -> Schedule -> Double -> DayCounter -> OvernightIborIndex -> Double -> Int -> BusinessDayConvention -> Calendar -> Bool -> RateAveragingType -> OvernightObservation -> IO OvernightIndexedSwap
- assetSwap :: Bool -> Bond -> Double -> GenIborIndex ibor -> Double -> Schedule -> DayCounter -> Bool -> Double -> Maybe Double -> Maybe Day -> IO AssetSwap
- swaption :: GenFixedVsFloatingSwap f -> Exercise -> SettlementType -> SettlementMethod -> IO Swaption
- irregularSwaption :: IrregularSwap -> Exercise -> IrregularSettlementType -> IO IrregularSwaption
- irregularSwap :: SwapType -> GenLeg fixed -> GenLeg float -> IO IrregularSwap
- nonstandardSwaptionFromSwaption :: Swaption -> IO NonstandardSwaption
- nonstandardSwaption :: NonstandardSwap -> Exercise -> SettlementType -> SettlementMethod -> IO NonstandardSwaption
- floatFloatSwaption :: FloatFloatSwap -> Exercise -> SettlementType -> SettlementMethod -> IO FloatFloatSwaption
- class HasFixedLeg a where
- fixedLeg :: a -> IO Leg
- fixedLegBps :: a -> IO Double
- fixedLegNpv :: a -> IO Double
- class HasFloatingLeg a where
- floatingLeg :: a -> IO Leg
- floatingLegBps :: a -> IO Double
- floatingLegNpv :: a -> IO Double
- class HasFairRate a where
- class HasFairSpread a where
- fairSpread :: a -> IO Double
- class HasInstrumentUnderlying a where
- type InstrumentUnderlying a
- underlyingSwap :: a -> IO (InstrumentUnderlying a)
- impliedVolatility :: Swaption -> Double -> GenYieldTermStructure y -> Double -> Double -> Word -> Double -> Double -> VolatilityType -> Double -> SwaptionPriceType -> IO Double
- endDiscounts :: GenSwap s -> Word -> IO Double
- leg :: GenSwap s -> Word -> IO Leg
- numberOfLegs :: GenSwap s -> IO Word
- legBps :: GenSwap s -> Word -> IO Double
- legNpv :: GenSwap s -> Word -> IO Double
- maturityDate :: GenSwap s -> IO (Maybe Day)
- npvDateDiscount :: GenSwap s -> IO Double
- startDate :: GenSwap s -> IO (Maybe Day)
- startDiscounts :: GenSwap s -> Word -> IO Double
- nonstandardSwapFixedRate :: NonstandardSwap -> IO [Double]
- legCurrency :: GenConstNotionalCrossCurrencySwap x -> Word -> IO Currency
- inCcyLegBps :: GenConstNotionalCrossCurrencySwap x -> Word -> IO Double
- inCcyLegNpv :: GenConstNotionalCrossCurrencySwap x -> Word -> IO Double
- npvDateDiscounts :: GenConstNotionalCrossCurrencySwap x -> Word -> IO Double
- fairPaySpread :: ConstNotionalCrossCurrencyBasisSwap -> IO Double
- fairRecSpread :: ConstNotionalCrossCurrencyBasisSwap -> IO Double
- bmaLeg :: BMASwap -> IO Leg
- bmaLegBps :: BMASwap -> IO Double
- bmaLegNpv :: BMASwap -> IO Double
- fairLiborFraction :: BMASwap -> IO Double
- fairLiborSpread :: BMASwap -> IO Double
- liborFraction :: BMASwap -> IO Double
- liborLeg :: BMASwap -> IO Leg
- liborLegBps :: BMASwap -> IO Double
- liborLegNpv :: BMASwap -> IO Double
- calibrationBasket :: NonstandardSwaption -> GenSwapIndex sidx -> GenSwaptionVolatilityStructure sv -> CalibrationBasketType -> IO [BlackCalibrationHelper]
- floatFloatSwaptionCalibrationBasket :: FloatFloatSwaption -> GenSwapIndex sidx -> GenSwaptionVolatilityStructure sv -> CalibrationBasketType -> IO [BlackCalibrationHelper]
- bondLeg :: AssetSwap -> IO Leg
- cleanPrice :: AssetSwap -> IO Double
- fairCleanPrice :: AssetSwap -> IO Double
- fairNonParRepayment :: AssetSwap -> IO Double
- nonParRepayment :: AssetSwap -> IO Double
- parSwap :: AssetSwap -> IO Bool
- payBondCoupon :: AssetSwap -> IO Bool
- firstLegFairSpread :: FloatFloatSwap -> IO Double
- secondLegFairSpread :: FloatFloatSwap -> IO Double
- fairFixedPayment :: ZeroCouponSwap -> IO Double
- fairFixedRate :: ZeroCouponSwap -> DayCounter -> IO Double
- equityLegNpv :: EquityTotalReturnSwap -> IO Double
- interestRateLegNpv :: EquityTotalReturnSwap -> IO Double
- fairMargin :: EquityTotalReturnSwap -> IO Double
- variance :: VarianceSwap -> IO Double
- overnightLeg :: OvernightIndexedSwap -> IO Leg
- overnightLegBps :: OvernightIndexedSwap -> IO Double
- overnightLegNpv :: OvernightIndexedSwap -> IO Double
Types
Swap hierarchy
type GenSwap s = GenInstrument (AnyOf CSwap' s) Source #
type Swap = GenSwap CSwap Source #
An Instrument; see the hierarchy under GenInstrument.
type GenFixedVsFloatingSwap f = GenSwap (AnyOf CFixedVsFloatingSwap' f) Source #
type FixedVsFloatingSwap = GenFixedVsFloatingSwap CFixedVsFloatingSwap Source #
A Swap; see the hierarchy under GenInstrument.
type VanillaSwap = GenFixedVsFloatingSwap CVanillaSwap Source #
A FixedVsFloatingSwap; see the hierarchy under GenInstrument.
type NonstandardSwap = GenSwap CNonstandardSwap Source #
A Swap; see the hierarchy under GenInstrument.
type IrregularSwap = GenSwap CIrregularSwap Source #
A Swap; see the hierarchy under GenInstrument.
type FloatFloatSwap = GenSwap CFloatFloatSwap Source #
A Swap; see the hierarchy under GenInstrument.
type OvernightIndexedSwap = GenSwap COvernightIndexedSwap Source #
A Swap; see the hierarchy under GenInstrument.
type ZeroCouponInflationSwap = GenSwap CZeroCouponInflationSwap Source #
A Swap; see the hierarchy under GenInstrument.
type YearOnYearInflationSwap = GenSwap CYearOnYearInflationSwap Source #
A Swap; see the hierarchy under GenInstrument.
type ZeroCouponSwap = GenSwap CZeroCouponSwap Source #
A Swap; see the hierarchy under GenInstrument.
type EquityTotalReturnSwap = GenSwap CEquityTotalReturnSwap Source #
A Swap; see the hierarchy under GenInstrument.
type VarianceSwap = GenInstrument CVarianceSwap Source #
An Instrument; see the hierarchy under GenInstrument.
type GenConstNotionalCrossCurrencySwap x = GenSwap (AnyOf CConstNotionalCrossCurrencySwap' x) Source #
type ConstNotionalCrossCurrencySwap = GenConstNotionalCrossCurrencySwap CConstNotionalCrossCurrencySwap Source #
A Swap; see the hierarchy under GenInstrument.
type ConstNotionalCrossCurrencyBasisSwap = GenConstNotionalCrossCurrencySwap CConstNotionalCrossCurrencyBasisSwap Source #
A ConstNotionalCrossCurrencySwap; see the hierarchy under GenInstrument.
type ConstNotionalCrossCurrencyFixedVsFloatingSwap = GenConstNotionalCrossCurrencySwap CConstNotionalCrossCurrencyFixedVsFloatingSwap Source #
A ConstNotionalCrossCurrencySwap; see the hierarchy under GenInstrument.
Swaptions and variance options
type IrregularSwaption = GenOption CIrregularSwaption Source #
An Option; see the hierarchy under GenInstrument.
type NonstandardSwaption = GenOption CNonstandardSwaption Source #
An Option; see the hierarchy under GenInstrument.
type FloatFloatSwaption = GenOption CFloatFloatSwaption Source #
An Option; see the hierarchy under GenInstrument.
type VarianceOption = GenInstrument CVarianceOption Source #
An Instrument; see the hierarchy under GenInstrument.
Configuration
Instances
| Enum SwapType Source # | |
Defined in QuantLib.Instrument.Swap | |
| Read SwapType Source # | |
| Show SwapType Source # | |
| Eq SwapType Source # | |
data SwaptionPriceType Source #
Constructors
| SwaptionSpot | |
| SwaptionForward |
Instances
data IrregularSettlementType Source #
Constructors
| IrregularPhysical | |
| IrregularCash |
Instances
data CPIInterpolationType Source #
Instances
data CalibrationBasketType Source #
Constructors
| CalibrationBasketNaive | |
| MaturityStrikeByDeltaGamma |
Instances
data FloatFloatSwapOpts Source #
Constructors
data FloatFloatSwapVaryingOpts Source #
Constructors
data ConstNotionalCrossCurrencyBasisSwapOpts Source #
Constructors
data OvernightObservation Source #
Constructors
| OvernightObservation | |
Fields
| |
Instances
| Show OvernightObservation Source # | |
Defined in QuantLib.Internal.Common Methods showsPrec :: Int -> OvernightObservation -> ShowS # show :: OvernightObservation -> String # showList :: [OvernightObservation] -> ShowS # | |
| Eq OvernightObservation Source # | |
Defined in QuantLib.Internal.Common Methods (==) :: OvernightObservation -> OvernightObservation -> Bool # (/=) :: OvernightObservation -> OvernightObservation -> Bool # | |
defaultOvernightObservation :: OvernightObservation Source #
Upstream's own defaults: index fixing days, no lockout, no observation shift.
Constructors
Hierarchy conversion
Swaps
swap :: GenLeg l1 -> GenLeg l2 -> IO Swap Source #
The cash flows belonging to the first leg are paid; the ones belonging to the second leg are received.
Arguments
| :: SwapType | |
| -> Double | nominal |
| -> Schedule | liborSchedule |
| -> Double | liborFraction |
| -> Double | liborSpread |
| -> GenIborIndex ibor | |
| -> DayCounter | liborDayCount |
| -> Schedule | bmaSchedule |
| -> BMAIndex | |
| -> DayCounter | bmaDayCount |
| -> IO BMASwap |
Swap paying Libor against BMA coupons
Arguments
| :: SwapType | |
| -> Double | nominal |
| -> Schedule | fixedSchedule |
| -> Double | fixedRate |
| -> DayCounter | fixedDayCount |
| -> Schedule | floatSchedule |
| -> GenIborIndex ibor | |
| -> Double | spread |
| -> DayCounter | floatingDayCount |
| -> Maybe BusinessDayConvention | paymentConvention |
| -> Maybe Bool | useIndexedCoupons |
| -> IO VanillaSwap |
Fixed-rate vs floating-rate (Ibor) swap; if no payment convention is given, the floating leg's is used.
nonstandardSwapFromVanilla :: GenFixedVsFloatingSwap f -> IO NonstandardSwap Source #
Converts an existing FixedVsFloatingSwap (e.g. a VanillaSwap) into a NonstandardSwap
(upstream's own conversion constructor, NonstandardSwap(const FixedVsFloatingSwap&)).
Arguments
| :: SwapType | |
| -> [Double] | fixedNominal |
| -> [Double] | floatingNominal |
| -> Schedule | fixedSchedule |
| -> [Double] | fixedRate |
| -> DayCounter | fixedDayCount |
| -> Schedule | floatingSchedule |
| -> GenIborIndex ibor | |
| -> Double | gearing |
| -> Double | spread |
| -> DayCounter | floatingDayCount |
| -> Bool | intermediateCapitalExchange |
| -> Bool | finalCapitalExchange |
| -> Maybe BusinessDayConvention | paymentConvention |
| -> IO NonstandardSwap |
VanillaSwap generalized to per-period fixed/floating nominals and fixed rates, plus
optional intermediate/final notional exchange -- a single Double gearing/spread shared
across all floating periods. See nonstandardSwapFromGearingsAndSpreads for per-period gearing/spread.
nonstandardSwapFromGearingsAndSpreads Source #
Arguments
| :: SwapType | |
| -> [Double] | fixedNominal |
| -> [Double] | floatingNominal |
| -> Schedule | fixedSchedule |
| -> [Double] | fixedRate |
| -> DayCounter | fixedDayCount |
| -> Schedule | floatingSchedule |
| -> GenIborIndex ibor | |
| -> [Double] | gearing |
| -> [Double] | spread |
| -> DayCounter | floatingDayCount |
| -> Bool | intermediateCapitalExchange |
| -> Bool | finalCapitalExchange |
| -> Maybe BusinessDayConvention | paymentConvention |
| -> IO NonstandardSwap |
As nonstandardSwap, but with a per-period gearing and spread instead of one shared value.
floatFloatSwap :: SwapType -> Double -> Double -> Schedule -> GenInterestRateIndex ridx1 -> DayCounter -> Schedule -> GenInterestRateIndex ridx2 -> DayCounter -> FloatFloatSwapOpts -> IO FloatFloatSwap Source #
Swap exchanging capped/floored Libor or CMS coupons with a single flat nominal on each leg.
FloatFloatSwapOpts bundles every trailing param the C++ constructor defaults (gearing/
spread/cap/floor per leg, capital exchange, payment conventions); override only what's
needed via record-update syntax on defaultFloatFloatSwapOpts. See floatFloatSwapFromNominals for the
per-period-nominal overload.
floatFloatSwapFromNominals :: SwapType -> [Double] -> [Double] -> Schedule -> GenInterestRateIndex ridx1 -> DayCounter -> Schedule -> GenInterestRateIndex ridx2 -> DayCounter -> FloatFloatSwapVaryingOpts -> IO FloatFloatSwap Source #
As floatFloatSwap, but with per-period nominals on each leg. FloatFloatSwapVaryingOpts
also supplies the per-period gearings, spreads, caps, and floors for both legs.
Arguments
| :: (Word, TimeUnit) | swapTenor |
| -> GenIborIndex ibor | |
| -> Double | fixedRate |
| -> (Int, TimeUnit) | forwardStart |
| -> Maybe Int | settlementDays |
| -> (Word, TimeUnit) | fixedLegTenor |
| -> DayCounter | fixedLegDayCount |
| -> Maybe BusinessDayConvention | fixedLegConvention |
| -> Maybe BusinessDayConvention | fixedLegTerminationDateConvention |
| -> Maybe Calendar | fixedLegCalendar |
| -> Maybe Calendar | floatingLegCalendar |
| -> Maybe Double | nominal |
| -> Maybe SwapType | |
| -> IO VanillaSwap |
Haskell equivalent of QuantLib's fluent MakeVanillaSwap builder -- a
single function with Maybe-wrapped optional parameters instead of
chained .with* calls, covering the subset of makevanillaswap.hpp's
fields named in the parameters below. Not covered at all (no parameter):
explicit effective/termination date overrides, a settlement calendar
distinct from the floating-leg one, floating-leg tenor/convention/
termination convention/day count overrides (always taken from the
index, matching upstream's own defaults), withRule variants (always
DateGeneration::Backward), end-of-month/first-date/next-to-last-date
overrides, a floating-leg spread other than 0, a discounting term
structure or custom pricing engine (use setPricingEngine on the
result instead), indexed/at-par coupon overrides, and payment
convention (always the floating leg's, matching upstream's own default
when unset). fixedLegTenor/fixedLegDayCount are required arguments
here rather than optional with upstream's currency-based inference. A
Nothing settlementDays behaves as Just 0, rather than replicating
upstream's index-valueDate-based spot-date convention.
Arguments
| :: (Word, TimeUnit) | swapTenor |
| -> GenSwapIndex sidx | cms index |
| -> GenIborIndex ibor | floating-leg index |
| -> Double | floating-leg spread |
| -> (Int, TimeUnit) | forwardStart |
| -> Maybe Int | settlementDays |
| -> (Word, TimeUnit) | cmsLegTenor |
| -> DayCounter | cmsLegDayCount |
| -> Maybe Calendar | cmsLegCalendar |
| -> Maybe Calendar | floatingLegCalendar |
| -> Maybe Double | nominal |
| -> Maybe SwapType |
|
| -> IO Swap |
Haskell equivalent of QuantLib's fluent MakeCms builder, in the style of
makeVanillaSwap above -- not a binding of the MakeCms C++ class at all, but a plain
function composing already-bound primitives (schedule,
cmsLeg, iborLeg, swapFromLegs). The result is a plain
Swap (a CMS swap has no calc/getter of its own beyond generic Swap's), with no
FloatingRateCouponPricer attached -- attach one to the CMS leg afterwards via
setCouponPricer =<< (leg result 0swapFromLegs is used instead of swap precisely so the
CMS leg is always leg 0, regardless of SwapType) and setCouponPricer
before pricing.
Unlike MakeCms, cmsLegTenor/cmsLegDayCount are required arguments here rather than
defaulted (upstream hardcodes 3 Months/Actual360); pass those literals to reproduce
MakeCms's own defaults. Not covered at all (no parameter): an explicit effective date
override, CMS-leg/floating-leg termination-date-convention/rule/end-of-month/
first-date/next-to-last-date overrides (always ModifiedFollowing/Backward/False/
unset, matching MakeCms's own defaults for the CMS leg), CMS coupon gearing/caps/floors
(use cmsLegWithOptions and swap directly for those), an ATM-spread lookup, a
discounting term structure or custom pricing engine (use setPricingEngine
on the result instead). A Nothing settlementDays behaves as Just 0, rather than
replicating upstream's index-valueDate-based spot-date convention (matching
makeVanillaSwap's own choice here).
zeroCouponInflationSwap Source #
Arguments
| :: SwapType | |
| -> Double | nominal |
| -> Day | startDate |
| -> Day | maturity |
| -> Calendar | |
| -> BusinessDayConvention | paymentConvention |
| -> DayCounter | |
| -> Double | fixedRate |
| -> ZeroInflationIndex | |
| -> (Word, TimeUnit) | observationLag |
| -> CPIInterpolationType | observationInterpolation |
| -> Bool | adjustInfObsDates |
| -> Calendar | infCalendar |
| -> BusinessDayConvention | infConvention |
| -> IO ZeroCouponInflationSwap |
yearOnYearInflationSwap Source #
Arguments
| :: SwapType | |
| -> Double | nominal |
| -> Schedule | fixedSchedule |
| -> Double | fixedRate |
| -> DayCounter | fixedDayCount |
| -> Schedule | yoySchedule |
| -> YoYInflationIndex | |
| -> (Word, TimeUnit) | observationLag |
| -> CPIInterpolationType | interpolation |
| -> Double | spread |
| -> DayCounter | yoyDayCount |
| -> Calendar | paymentCalendar |
| -> BusinessDayConvention | paymentConvention |
| -> IO YearOnYearInflationSwap |
Arguments
| :: SwapType | |
| -> Double | nominal |
| -> Bool | subtractInflationNominal |
| -> Double | spread |
| -> DayCounter | floatDayCount |
| -> Schedule | floatSchedule |
| -> BusinessDayConvention | floatRoll |
| -> Word | fixingDays |
| -> GenIborIndex ibor | floatIndex |
| -> Double | fixedRate |
| -> Double | baseCPI |
| -> DayCounter | fixedDayCount |
| -> Schedule | fixedSchedule |
| -> BusinessDayConvention | fixedRoll |
| -> (Word, TimeUnit) | observationLag |
| -> ZeroInflationIndex | fixedIndex |
| -> CPIInterpolationType | observationInterpolation |
| -> Maybe Double | inflationNominal |
| -> IO CPISwap |
A fixed-x-CPI-ratio leg (subtracting the inflation notional if
subtractInflationNominal) vs a float+spread leg -- QuantLib's general-purpose inflation
swap, also usable to replicate a single-cashflow ZCIIS (see zeroCouponInflationSwap).
Per-leg NPV/BPS use the generic leg/legNpv/legBps (leg 0 = CPI, leg 1 = float).
Arguments
| :: SwapType | |
| -> Double | baseNominal |
| -> Day | startDate |
| -> Day | maturityDate |
| -> Double | fixedPayment |
| -> GenIborIndex ibor | |
| -> Calendar | paymentCalendar |
| -> BusinessDayConvention | paymentConvention |
| -> Word | paymentDelay |
| -> IO ZeroCouponSwap |
zeroCouponSwapFromRate Source #
Arguments
| :: SwapType | |
| -> Double | baseNominal |
| -> Day | startDate |
| -> Day | maturityDate |
| -> Double | fixedRate |
| -> DayCounter | fixedDayCounter |
| -> GenIborIndex ibor | |
| -> Calendar | paymentCalendar |
| -> BusinessDayConvention | paymentConvention |
| -> Word | paymentDelay |
| -> IO ZeroCouponSwap |
Zero-coupon swap quoted in terms of a fixed rate.
equityTotalReturnSwapIbor Source #
Arguments
| :: SwapType | |
| -> Double | nominal |
| -> Schedule | |
| -> EquityIndex | |
| -> GenIborIndex ibor | interestRateIndex |
| -> DayCounter | |
| -> Double | margin |
| -> Double | gearing |
| -> Calendar | paymentCalendar |
| -> BusinessDayConvention | paymentConvention |
| -> Word | paymentDelay |
| -> IO EquityTotalReturnSwap |
Exchanges the total return of an EquityIndex for a set of floating cash flows linked to an
IborIndex. type (payer/receiver) refers to the equity leg.
equityTotalReturnSwapOvernight Source #
Arguments
| :: SwapType | |
| -> Double | nominal |
| -> Schedule | |
| -> EquityIndex | |
| -> OvernightIborIndex | interestRateIndex |
| -> DayCounter | |
| -> Double | margin |
| -> Double | gearing |
| -> Calendar | paymentCalendar |
| -> BusinessDayConvention | paymentConvention |
| -> Word | paymentDelay |
| -> IO EquityTotalReturnSwap |
As equityTotalReturnSwapIbor, but with the floating leg linked to an overnight index instead
-- fixings are compounded over the accrual period.
Arguments
| :: PositionType | |
| -> Double | strike |
| -> Double | notional |
| -> Day | startDate |
| -> Day | maturityDate |
| -> IO VarianceSwap |
Variance swap: pays off the difference between realized and strike variance, scaled by notional. This class does not manage seasoned variance swaps.
Variance option: an option on realized variance, priced (e.g. via integralHestonVarianceOptionEngine)
against a payoff on the variance level rather than the underlying price. This class does not
manage seasoned variance options.
Cross-currency swaps
constNotionalCrossCurrencySwap Source #
Arguments
| :: GenLeg l1 | |
| -> Currency | firstLegCcy |
| -> GenLeg l2 | |
| -> Currency | secondLegCcy |
| -> IO ConstNotionalCrossCurrencySwap |
Constructs a cross-currency swap from two legs and their currencies; the first leg is paid, the second received.
constNotionalCrossCurrencySwapFromLegs Source #
Arguments
| :: [(Leg, Bool)] | (legs, payer) |
| -> [Currency] | |
| -> IO ConstNotionalCrossCurrencySwap |
Multi-leg constructor.
constNotionalCrossCurrencyBasisSwap :: Double -> Currency -> Schedule -> GenIborIndex ibor1 -> Double -> Double -> Double -> Currency -> Schedule -> GenIborIndex ibor2 -> Double -> Double -> ConstNotionalCrossCurrencyBasisSwapOpts -> IO ConstNotionalCrossCurrencyBasisSwap Source #
Cross-currency basis swap: pay-currency cashflows on leg 0, receive-currency on leg 1.
ConstNotionalCrossCurrencyBasisSwapOpts bundles every trailing param the C++ constructor
defaults (all OIS-only -- payment lag, compound-spread, lookback, observation shift, lockout,
averaging method per leg, plus a shared telescopic-value-dates flag; ignored for a plain Ibor
payIndex/recIndex, since upstream itself only consults them when the index is an overnight
index); override only what's needed via record-update syntax on
defaultConstNotionalCrossCurrencyBasisSwapOpts.
constNotionalCrossCurrencyFixedVsFloatingSwap Source #
Arguments
| :: SwapType | |
| -> Double | fixedNominal |
| -> Currency | fixedCurrency |
| -> Schedule | fixedSchedule |
| -> Double | fixedRate |
| -> DayCounter | fixedDayCount |
| -> BusinessDayConvention | fixedPaymentBdc |
| -> Word | fixedPaymentLag |
| -> Calendar | fixedPaymentCalendar |
| -> Double | floatNominal |
| -> Currency | floatCurrency |
| -> Schedule | floatSchedule |
| -> GenIborIndex ibor | floatIndex |
| -> Double | floatSpread |
| -> BusinessDayConvention | floatPaymentBdc |
| -> Word | floatPaymentLag |
| -> Calendar | floatPaymentCalendar |
| -> Bool | telescopicValueDates |
| -> Bool | floatCompoundSpread |
| -> OvernightObservation | floatObservation |
| -> RateAveragingType | floatAveragingMethod |
| -> IO ConstNotionalCrossCurrencyFixedVsFloatingSwap |
Cross-currency fixed-vs-floating swap: Payer pays the fixed leg (leg 0) and receives the
floating leg (leg 1); Receiver the reverse. Every trailing defaulted param of the upstream
constructor is a required argument here (only 4 trailing defaults, under the options-record
threshold -- see ConstNotionalCrossCurrencyBasisSwapOpts above) -- pass False/False/
defaultOvernightObservation/AveragingCompound to reproduce upstream's own defaults; the
OIS-only ones are ignored for a plain Ibor floatIndex.
Upstream declares the three observation parameters as
floatLookbackDays, floatObservationShift, floatLockoutDays, inverting the order every
other overnight-leg producer uses; OvernightObservation hides that.
Overnight-indexed and asset swaps
Arguments
| :: SwapType | |
| -> Double | nominal |
| -> Schedule | |
| -> Double | fixedRate |
| -> DayCounter | fixedDC |
| -> OvernightIborIndex | |
| -> Double | spread |
| -> Int | paymentLag |
| -> BusinessDayConvention | paymentAdjustment |
| -> Calendar | paymentCalendar |
| -> Bool | telescopicValueDates |
| -> RateAveragingType | averagingMethod |
| -> OvernightObservation | |
| -> IO OvernightIndexedSwap |
Fixed vs compounded-overnight-rate swap, with a single flat nominal for both legs.
overnightIndexedSwapFromNominals Source #
Arguments
| :: SwapType | |
| -> [Double] | nominals |
| -> Schedule | |
| -> Double | fixedRate |
| -> DayCounter | fixedDC |
| -> OvernightIborIndex | |
| -> Double | spread |
| -> Int | paymentLag |
| -> BusinessDayConvention | paymentAdjustment |
| -> Calendar | paymentCalendar |
| -> Bool | telescopicValueDates |
| -> RateAveragingType | averagingMethod |
| -> OvernightObservation | |
| -> IO OvernightIndexedSwap |
As overnightIndexedSwap, but with a per-period nominal schedule instead of a single flat nominal.
Arguments
| :: Bool | payBondCoupon |
| -> Bond | |
| -> Double | bondCleanPrice |
| -> GenIborIndex ibor | |
| -> Double | |
| -> Schedule | floatSchedule |
| -> DayCounter | floatingDayCount |
| -> Bool | parAssetSwap |
| -> Double | gearing |
| -> Maybe Double | nonParRepayment |
| -> Maybe Day | dealMaturity |
| -> IO AssetSwap |
Bullet bond vs Libor swap (par or market asset swap, per parAssetSwap).
Swaptions
swaption :: GenFixedVsFloatingSwap f -> Exercise -> SettlementType -> SettlementMethod -> IO Swaption Source #
An option on a VanillaSwap.
irregularSwaption :: IrregularSwap -> Exercise -> IrregularSettlementType -> IO IrregularSwaption Source #
A priceable option on an IrregularSwap. Use haganIrregularSwaptionEngine
as its pricing engine; QuantLib has no corresponding stock IrregularSwap engine.
irregularSwap :: SwapType -> GenLeg fixed -> GenLeg float -> IO IrregularSwap Source #
nonstandardSwaptionFromSwaption :: Swaption -> IO NonstandardSwaption Source #
Converts an existing Swaption into a NonstandardSwaption (upstream's own conversion
constructor).
nonstandardSwaption :: NonstandardSwap -> Exercise -> SettlementType -> SettlementMethod -> IO NonstandardSwaption Source #
An option on a NonstandardSwap.
floatFloatSwaption :: FloatFloatSwap -> Exercise -> SettlementType -> SettlementMethod -> IO FloatFloatSwaption Source #
An option on a FloatFloatSwap.
Inspectors
Common swap inspectors
class HasFixedLeg a where Source #
Methods
fixedLeg :: a -> IO Leg Source #
fixedLegBps :: a -> IO Double Source #
fixedLegNpv :: a -> IO Double Source #
Instances
| HasFixedLeg OvernightIndexedSwap Source # | |
Defined in QuantLib.Instrument.Swap Methods fixedLeg :: OvernightIndexedSwap -> IO Leg Source # | |
| HasFixedLeg (GenFixedVsFloatingSwap f) Source # | |
Defined in QuantLib.Instrument.Swap Methods fixedLeg :: GenFixedVsFloatingSwap f -> IO Leg Source # fixedLegBps :: GenFixedVsFloatingSwap f -> IO Double Source # fixedLegNpv :: GenFixedVsFloatingSwap f -> IO Double Source # | |
class HasFloatingLeg a where Source #
Methods
floatingLeg :: a -> IO Leg Source #
floatingLegBps :: a -> IO Double Source #
floatingLegNpv :: a -> IO Double Source #
Instances
| HasFloatingLeg AssetSwap Source # | |
Defined in QuantLib.Instrument.Swap | |
| HasFloatingLeg (GenFixedVsFloatingSwap f) Source # | |
Defined in QuantLib.Instrument.Swap Methods floatingLeg :: GenFixedVsFloatingSwap f -> IO Leg Source # floatingLegBps :: GenFixedVsFloatingSwap f -> IO Double Source # floatingLegNpv :: GenFixedVsFloatingSwap f -> IO Double Source # | |
class HasFairRate a where Source #
Instances
class HasFairSpread a where Source #
Methods
fairSpread :: a -> IO Double Source #
Instances
| HasFairSpread AssetSwap Source # | |
Defined in QuantLib.Instrument.Swap | |
| HasFairSpread CPISwap Source # | |
Defined in QuantLib.Instrument.Swap | |
| HasFairSpread ConstNotionalCrossCurrencyFixedVsFloatingSwap Source # | |
Defined in QuantLib.Instrument.Swap Methods fairSpread :: ConstNotionalCrossCurrencyFixedVsFloatingSwap -> IO Double Source # | |
| HasFairSpread CreditDefaultSwap Source # | |
Defined in QuantLib.Instrument.Swap Methods fairSpread :: CreditDefaultSwap -> IO Double Source # | |
| HasFairSpread IrregularSwap Source # | |
Defined in QuantLib.Instrument.Swap Methods fairSpread :: IrregularSwap -> IO Double Source # | |
| HasFairSpread OvernightIndexedSwap Source # | |
Defined in QuantLib.Instrument.Swap Methods | |
| HasFairSpread YearOnYearInflationSwap Source # | |
Defined in QuantLib.Instrument.Swap Methods | |
| HasFairSpread (GenFixedVsFloatingSwap f) Source # | |
Defined in QuantLib.Instrument.Swap Methods fairSpread :: GenFixedVsFloatingSwap f -> IO Double Source # | |
class HasInstrumentUnderlying a where Source #
Options that hold the swap they are written on. CdsOption is constructed in
QuantLib.Instrument.Credit; import this module as well to reach its underlying swap.
Associated Types
type InstrumentUnderlying a Source #
Methods
underlyingSwap :: a -> IO (InstrumentUnderlying a) Source #
Instances
Arguments
| :: Swaption | |
| -> Double | price |
| -> GenYieldTermStructure y | |
| -> Double | guess |
| -> Double | accuracy |
| -> Word | maxEvaluations |
| -> Double | minVol |
| -> Double | maxVol |
| -> VolatilityType | type |
| -> Double | displacement |
| -> SwaptionPriceType | priceType |
| -> IO Double |
implied volatility
numberOfLegs :: GenSwap s -> IO Word Source #
How many legs this swap has; leg indexes run from 0 to one less than this.
maturityDate :: GenSwap s -> IO (Maybe Day) Source #
The swap's maturity date, or Nothing if the swap has no legs.
startDate :: GenSwap s -> IO (Maybe Day) Source #
The swap's start date, or Nothing if the swap has no legs.
nonstandardSwapFixedRate :: NonstandardSwap -> IO [Double] Source #
Per-period fixed rate, one entry per fixed-leg accrual period. For a swap built via
nonstandardSwap/nonstandardSwapFromGearingsAndSpreads, this simply echoes the constructor's fixedRate; for
one built via nonstandardSwapFromVanilla it is derived from the underlying vanilla swap's
fixed leg coupons.
Cross-currency swaps
legCurrency :: GenConstNotionalCrossCurrencySwap x -> Word -> IO Currency Source #
Leg j's currency.
inCcyLegBps :: GenConstNotionalCrossCurrencySwap x -> Word -> IO Double Source #
Basis-point sensitivity of leg j, expressed in the leg's own currency (contrast legBps, in the swap's NPV currency).
inCcyLegNpv :: GenConstNotionalCrossCurrencySwap x -> Word -> IO Double Source #
NPV of leg j, expressed in the leg's own currency (contrast legNpv, in the swap's NPV currency).
npvDateDiscounts :: GenConstNotionalCrossCurrencySwap x -> Word -> IO Double Source #
Discount factor at the instrument's NPV date, for leg j.
fairPaySpread :: ConstNotionalCrossCurrencyBasisSwap -> IO Double Source #
The pay-leg spread that would make the swap's NPV zero.
fairRecSpread :: ConstNotionalCrossCurrencyBasisSwap -> IO Double Source #
The receive-leg spread that would make the swap's NPV zero.
BMA swaps
fairLiborFraction :: BMASwap -> IO Double Source #
The Libor fraction that would make the swap's NPV zero.
fairLiborSpread :: BMASwap -> IO Double Source #
The Libor spread that would make the swap's NPV zero.
Swaption calibration baskets
Arguments
| :: NonstandardSwaption | |
| -> GenSwapIndex sidx | standardSwapBase |
| -> GenSwaptionVolatilityStructure sv | swaptionVolatility |
| -> CalibrationBasketType | |
| -> IO [BlackCalibrationHelper] |
Auto-generates a basket of plain Swaptions used to calibrate a model to price a
NonstandardSwaption -- either ATM swaptions adapted to the exercise dates (Naive) or
swaptions whose maturity/strike/nominal match the underlying's NPV, delta and gamma at each
exercise date (MaturityStrikeByDeltaGamma).
floatFloatSwaptionCalibrationBasket Source #
Arguments
| :: FloatFloatSwaption | |
| -> GenSwapIndex sidx | standardSwapBase |
| -> GenSwaptionVolatilityStructure sv | swaptionVolatility |
| -> CalibrationBasketType | |
| -> IO [BlackCalibrationHelper] |
As calibrationBasket, for a FloatFloatSwaption.
Asset swaps
fairCleanPrice :: AssetSwap -> IO Double Source #
The clean price that would make the swap's NPV zero.
fairNonParRepayment :: AssetSwap -> IO Double Source #
The non-par repayment that would make the swap's NPV zero.
nonParRepayment :: AssetSwap -> IO Double Source #
The non-par repayment, as passed to the constructor.
payBondCoupon :: AssetSwap -> IO Bool Source #
Whether the bond coupon is paid (rather than netted against the floating leg).
Float-float swaps
firstLegFairSpread :: FloatFloatSwap -> IO Double Source #
The spread on leg 1 that would make the swap's NPV zero.
secondLegFairSpread :: FloatFloatSwap -> IO Double Source #
The spread on leg 2 that would make the swap's NPV zero.
Zero-coupon, equity and variance swaps
fairFixedPayment :: ZeroCouponSwap -> IO Double Source #
The fixed payment that would make the swap's NPV zero.
fairFixedRate :: ZeroCouponSwap -> DayCounter -> IO Double Source #
The fixed rate, under the given day counter, that would make the swap's NPV zero.
equityLegNpv :: EquityTotalReturnSwap -> IO Double Source #
NPV of the equity total-return leg.
interestRateLegNpv :: EquityTotalReturnSwap -> IO Double Source #
NPV of the interest-rate leg.
fairMargin :: EquityTotalReturnSwap -> IO Double Source #
The margin that would make the swap's NPV zero.
variance :: VarianceSwap -> IO Double Source #
Realized variance -- requires a pricing engine to be set first
Overnight-indexed swaps
overnightLeg :: OvernightIndexedSwap -> IO Leg Source #
The overnight leg's cash flows.
overnightLegBps :: OvernightIndexedSwap -> IO Double Source #
Basis-point sensitivity of the overnight leg.
overnightLegNpv :: OvernightIndexedSwap -> IO Double Source #
NPV of the overnight leg.