You can subscribe to this list here.
| 2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
(60) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2001 |
Jan
(18) |
Feb
(4) |
Mar
(6) |
Apr
(2) |
May
|
Jun
(12) |
Jul
(48) |
Aug
(6) |
Sep
(3) |
Oct
(24) |
Nov
(15) |
Dec
(18) |
| 2002 |
Jan
(39) |
Feb
(12) |
Mar
(80) |
Apr
(72) |
May
(46) |
Jun
(27) |
Jul
(23) |
Aug
(34) |
Sep
(65) |
Oct
(71) |
Nov
(19) |
Dec
(14) |
| 2003 |
Jan
(44) |
Feb
(59) |
Mar
(18) |
Apr
(62) |
May
(54) |
Jun
(27) |
Jul
(46) |
Aug
(15) |
Sep
(44) |
Oct
(36) |
Nov
(19) |
Dec
(12) |
| 2004 |
Jan
(26) |
Feb
(33) |
Mar
(47) |
Apr
(63) |
May
(36) |
Jun
(65) |
Jul
(80) |
Aug
(163) |
Sep
(65) |
Oct
(39) |
Nov
(36) |
Dec
(39) |
| 2005 |
Jan
(97) |
Feb
(78) |
Mar
(64) |
Apr
(64) |
May
(48) |
Jun
(55) |
Jul
(89) |
Aug
(57) |
Sep
(51) |
Oct
(111) |
Nov
(86) |
Dec
(76) |
| 2006 |
Jan
(84) |
Feb
(103) |
Mar
(143) |
Apr
(92) |
May
(55) |
Jun
(58) |
Jul
(71) |
Aug
(57) |
Sep
(74) |
Oct
(59) |
Nov
(8) |
Dec
(32) |
| 2007 |
Jan
(60) |
Feb
(40) |
Mar
(50) |
Apr
(26) |
May
(61) |
Jun
(120) |
Jul
(119) |
Aug
(48) |
Sep
(121) |
Oct
(66) |
Nov
(103) |
Dec
(43) |
| 2008 |
Jan
(60) |
Feb
(109) |
Mar
(92) |
Apr
(106) |
May
(82) |
Jun
(59) |
Jul
(67) |
Aug
(118) |
Sep
(131) |
Oct
(56) |
Nov
(37) |
Dec
(69) |
| 2009 |
Jan
(75) |
Feb
(76) |
Mar
(103) |
Apr
(78) |
May
(61) |
Jun
(35) |
Jul
(66) |
Aug
(69) |
Sep
(166) |
Oct
(46) |
Nov
(72) |
Dec
(65) |
| 2010 |
Jan
(48) |
Feb
(57) |
Mar
(93) |
Apr
(85) |
May
(123) |
Jun
(82) |
Jul
(98) |
Aug
(121) |
Sep
(146) |
Oct
(86) |
Nov
(72) |
Dec
(34) |
| 2011 |
Jan
(96) |
Feb
(55) |
Mar
(73) |
Apr
(57) |
May
(33) |
Jun
(74) |
Jul
(89) |
Aug
(71) |
Sep
(103) |
Oct
(76) |
Nov
(52) |
Dec
(61) |
| 2012 |
Jan
(48) |
Feb
(54) |
Mar
(78) |
Apr
(60) |
May
(75) |
Jun
(59) |
Jul
(33) |
Aug
(66) |
Sep
(43) |
Oct
(46) |
Nov
(75) |
Dec
(51) |
| 2013 |
Jan
(112) |
Feb
(72) |
Mar
(49) |
Apr
(48) |
May
(42) |
Jun
(44) |
Jul
(80) |
Aug
(19) |
Sep
(33) |
Oct
(37) |
Nov
(38) |
Dec
(98) |
| 2014 |
Jan
(113) |
Feb
(93) |
Mar
(49) |
Apr
(106) |
May
(97) |
Jun
(155) |
Jul
(87) |
Aug
(127) |
Sep
(85) |
Oct
(48) |
Nov
(41) |
Dec
(37) |
| 2015 |
Jan
(34) |
Feb
(50) |
Mar
(104) |
Apr
(80) |
May
(82) |
Jun
(66) |
Jul
(41) |
Aug
(84) |
Sep
(37) |
Oct
(65) |
Nov
(83) |
Dec
(52) |
| 2016 |
Jan
(68) |
Feb
(35) |
Mar
(42) |
Apr
(35) |
May
(54) |
Jun
(75) |
Jul
(45) |
Aug
(52) |
Sep
(60) |
Oct
(52) |
Nov
(36) |
Dec
(64) |
| 2017 |
Jan
(92) |
Feb
(59) |
Mar
(35) |
Apr
(53) |
May
(83) |
Jun
(43) |
Jul
(65) |
Aug
(68) |
Sep
(46) |
Oct
(75) |
Nov
(40) |
Dec
(49) |
| 2018 |
Jan
(68) |
Feb
(54) |
Mar
(48) |
Apr
(58) |
May
(51) |
Jun
(44) |
Jul
(40) |
Aug
(68) |
Sep
(35) |
Oct
(15) |
Nov
(7) |
Dec
(37) |
| 2019 |
Jan
(43) |
Feb
(7) |
Mar
(22) |
Apr
(21) |
May
(31) |
Jun
(39) |
Jul
(73) |
Aug
(45) |
Sep
(47) |
Oct
(89) |
Nov
(19) |
Dec
(69) |
| 2020 |
Jan
(52) |
Feb
(63) |
Mar
(45) |
Apr
(59) |
May
(42) |
Jun
(57) |
Jul
(30) |
Aug
(29) |
Sep
(75) |
Oct
(64) |
Nov
(96) |
Dec
(22) |
| 2021 |
Jan
(14) |
Feb
(24) |
Mar
(35) |
Apr
(58) |
May
(36) |
Jun
(15) |
Jul
(18) |
Aug
(31) |
Sep
(30) |
Oct
(33) |
Nov
(27) |
Dec
(16) |
| 2022 |
Jan
(35) |
Feb
(22) |
Mar
(14) |
Apr
(20) |
May
(44) |
Jun
(53) |
Jul
(25) |
Aug
(56) |
Sep
(11) |
Oct
(47) |
Nov
(22) |
Dec
(36) |
| 2023 |
Jan
(30) |
Feb
(17) |
Mar
(31) |
Apr
(48) |
May
(31) |
Jun
(7) |
Jul
(25) |
Aug
(26) |
Sep
(61) |
Oct
(66) |
Nov
(19) |
Dec
(21) |
| 2024 |
Jan
(37) |
Feb
(29) |
Mar
(26) |
Apr
(26) |
May
(34) |
Jun
(9) |
Jul
(27) |
Aug
(13) |
Sep
(15) |
Oct
(25) |
Nov
(13) |
Dec
(8) |
| 2025 |
Jan
(13) |
Feb
(1) |
Mar
(16) |
Apr
(17) |
May
(8) |
Jun
(6) |
Jul
(9) |
Aug
|
Sep
(6) |
Oct
(15) |
Nov
(6) |
Dec
|
| 2026 |
Jan
(6) |
Feb
(4) |
Mar
(20) |
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Christofer B. <bog...@gm...> - 2023-04-13 09:12:38
|
Hi, Just curious on a question outside of QL. What is exactly **ISDA standard model** for CDS, and how/if it is different from other textbook models (e.g. Hull)? Any reference/book will be highly appreciated. Thanks and regards, On Thu, Apr 13, 2023 at 11:07 AM Ben Watson <ben...@ma...> wrote: > > Hi, > > > > I have adding the ISDA standard model to my CDS class. I have run into one > problem when using SOFR.USD to discount – I get this error > > return _QuantLib.CreditDefaultSwap_impliedHazardRate(self, *args) > > RuntimeError: yield term structure day counter (Actual/360) should be > Act/365(Fixed) > > > > The C++ code has this comment > > “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.” > > > > Looks like there is some error trapping on the daycount of the discount > curve. With the demise of LIBOR, ISDA has updated the discounting defn to > use RFR’s, USD as an example is now OIS Actual/360. > > > > See 3.2 in the document below. > > https://rfr.ihsmarkit.com/isda/document/RFR%20Interest%20Rate%20Curve%20Spe > cification%20-%206%20Currencies%20(August%209,%202022).pdf > > > > I could not find the line of code that throw the error, but maybe the best > way to fix this is to get rid of the day count checks. > > > > > > Regards > > > > Ben > > _______________________________________________ > QuantLib-users mailing list > Qua...@li... > https://lists.sourceforge.net/lists/listinfo/quantlib-users |
|
From: Luigi B. <lui...@gm...> - 2023-04-13 08:04:13
|
Thanks, I was just about to suggest that. On Thu, Apr 13, 2023 at 9:37 AM Ben Watson <ben...@ma...> wrote: > I have logged this an issue on github > > > > *From:* Ben Watson <ben...@ma...> > *Sent:* Thursday, April 13, 2023 3:36 PM > *To:* 'QuantLib Users' <qua...@li...> > *Cc:* 'Luigi Ballabio' <lui...@gm...> > *Subject:* CDS standard ISDA model > > > > Hi, > > > > I have adding the ISDA standard model to my CDS class. I have run into one > problem when using SOFR.USD to discount – I get this error > > return _QuantLib.CreditDefaultSwap_impliedHazardRate(self, *args) > > RuntimeError: yield term structure day counter (Actual/360) should be > Act/365(Fixed) > > > > The C++ code has this comment > > “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.” > > > > Looks like there is some error trapping on the daycount of the discount > curve. With the demise of LIBOR, ISDA has updated the discounting defn to > use RFR’s, USD as an example is now OIS Actual/360. > > > > See 3.2 in the document below. > > > https://rfr.ihsmarkit.com/isda/document/RFR%20Interest%20Rate%20Curve%20Specification%20-%206%20Currencies%20(August%209,%202022).pdf > > > > I could not find the line of code that throw the error, but maybe the best > way to fix this is to get rid of the day count checks. > > > > > > Regards > > > > Ben > > |
|
From: Ben W. <ben...@ma...> - 2023-04-13 07:37:45
|
I have logged this an issue on github From: Ben Watson <ben...@ma...> Sent: Thursday, April 13, 2023 3:36 PM To: 'QuantLib Users' <qua...@li...> Cc: 'Luigi Ballabio' <lui...@gm...> Subject: CDS standard ISDA model Hi, I have adding the ISDA standard model to my CDS class. I have run into one problem when using SOFR.USD to discount – I get this error return _QuantLib.CreditDefaultSwap_impliedHazardRate(self, *args) RuntimeError: yield term structure day counter (Actual/360) should be Act/365(Fixed) The C++ code has this comment “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.” Looks like there is some error trapping on the daycount of the discount curve. With the demise of LIBOR, ISDA has updated the discounting defn to use RFR’s, USD as an example is now OIS Actual/360. See 3.2 in the document below. https://rfr.ihsmarkit.com/isda/document/RFR%20Interest%20Rate%20Curve%20Specification%20-%206%20Currencies%20(August%209,%202022).pdf I could not find the line of code that throw the error, but maybe the best way to fix this is to get rid of the day count checks. Regards Ben |
|
From: Ben W. <ben...@ma...> - 2023-04-13 05:36:10
|
Hi, I have adding the ISDA standard model to my CDS class. I have run into one problem when using SOFR.USD to discount – I get this error return _QuantLib.CreditDefaultSwap_impliedHazardRate(self, *args) RuntimeError: yield term structure day counter (Actual/360) should be Act/365(Fixed) The C++ code has this comment “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.” Looks like there is some error trapping on the daycount of the discount curve. With the demise of LIBOR, ISDA has updated the discounting defn to use RFR’s, USD as an example is now OIS Actual/360. See 3.2 in the document below. https://rfr.ihsmarkit.com/isda/document/RFR%20Interest%20Rate%20Curve%20Spe cification%20-%206%20Currencies%20(August%209,%202022).pdf I could not find the line of code that throw the error, but maybe the best way to fix this is to get rid of the day count checks. Regards Ben |
|
From: Aleksis A. R. <ale...@go...> - 2023-04-10 17:04:48
|
Hi. When playing around with quantlib, it seems using the 1-factor GSR model allows computation of swaptions on amortizing swaps by simply supplying a standard swaption vol cube. Just wanted to get some feedback on the veracity of this approach because these swaptions rely on correlations between fwds in the amortization profile (not supplied in this model, so really they require a 2 factor model to price). In the example I compared a 1y10y vanilla swaption to a 1y10y swaption with constant (linear) amortization profile, both with their respective atmf. The numbers do make sense (vega, delta and premium is around half of the vanilla), however the vega risk profile of the latter seems to bucket the risks to the 1y6 and 1y7y buckets (ignoring 1y2y,1y3y,1y4y…etc which you would expect to see): 1Y 6Y 7Y 8Y 9Y 10Y Total 1M 7 0 0 0 0 0 7 1Y 0 7,617 10,665 (5) (7) (4) 18,267 1Y6M 0 90 121 (3) 0 0 208 Total 7 7,707 10,786 (8) (7) (4) 18,482 Thanks, Aleksis |
|
From: Sanjay <kes...@ya...> - 2023-04-07 21:05:35
|
Hi all, I'm just beginning to find my way around QuantLibXL and can't figure out how to model an adjustable rate bond where the coupon rate resets every week and coupons are paid every month based upon the compounded weekly resets. The resets are not from an index but instead, announced by the issuer. Thanks in advance for any help. --S |
|
From: Ben W. <ben...@ma...> - 2023-04-06 23:47:17
|
It does help… got it working –subbing in UpfrontCdsHelper for SpreadCdsHelper and bootstrap. That makes my life a lot easier.
Thank you Luigi
From: Luigi Ballabio <lui...@gm...>
Sent: Thursday, April 6, 2023 8:49 PM
To: Ben Watson <ben...@ma...>
Cc: QuantLib Users <qua...@li...>
Subject: Re: CDS quoted spread v Running/par spread calculator
The model should be `ql.CreditDefaultSwap.Midpoint`. It's an enumeration.
However, it's the way you're trying to use the helper that doesn't work. After you create the helper, it's not connected to any probability curve (hence the "px != 0" error); it should be used to build one. So once you have your set of helpers, you should create a PiecewiseFlatHazardRate instance. Once you have a bootstrapped curve, you could ask helper.impliedQuote() but it will return the upfront (because that's the quote for the helper) and it will simply match your input. If you want a corresponding spread, you can create a CreditDefaultSwap, pass the default probability curve to its engine and ask it for its fair spread.
Hope this helps,
Luigi
On Thu, Apr 6, 2023 at 5:40 AM Ben Watson <ben...@ma... <mailto:ben...@ma...> > wrote:
Hi Luigi,
Thank you for this – looks promising, but not a lot doco on UpfrontCdsHelper to work with. But I have put together a function to test this out. The code also print the all the types of the inputs to the UpfrontCdsHelper to make sure I am passing the correct types.
I got ‘kind of’ close to get it working, but….
If I leave the model (being the MidpointEngine) out of the UpfrontCdsHelper caller function, it throws no error, except that I get the following error when calling impliedQuote
return _QuantLib.DefaultProbabilityHelper_impliedQuote(self)
RuntimeError: Boost assertion failed: px != 0
If I include the MidpointEngine I get the following error
TypeError: Wrong number or type of arguments for overloaded function 'new_UpfrontCdsHelper'.
Possible C/C++ prototypes are:….
…
UpfrontCdsHelper::UpfrontCdsHelper(Rate,Rate,Period const &,Integer,Calendar const &,Frequency,BusinessDayConvention,DateGeneration::Rule,DayCounter const &,Real,Handle< YieldTermStructure > const &,Natural,bool,bool,Date const &,DayCounter const &,bool,CreditDefaultSwap::PricingModel)
….
The type of the is …. model <QuantLib.QuantLib.MidPointCdsEngine; proxy of <Swig Object of type 'ext::shared_ptr< MidPointCdsEngine > *' at 0x000001150752E4E0> > <class 'QuantLib.QuantLib.MidPointCdsEngine'>
Not sure if there is something that I am doing wrong or there is a bug…
Code below….
import QuantLib as ql
def convert_spreads( upfront, running_spread, recovery_rate, notional, maturity_date, today=None, coupon_frequency=4, day_count=ql.Thirty360(), calendar=ql.TARGET(),):
flat_ts = ql.FlatForward(today, 0.0, day_count, ql.Compounded, ql.Annual)
yield_curve_handle = ql.YieldTermStructureHandle(flat_ts)
upfront_quote = ql.QuoteHandle(ql.SimpleQuote(upfront))
running_spread_quote =running_spread# ql.QuoteHandle(ql.SimpleQuote(running_spread))
hazard_rate_structure = upfront_quote
default_probability_curve = ql.FlatHazardRate(0, calendar, hazard_rate_structure, day_count)
MidpointEngine = ql.MidPointCdsEngine( ql.DefaultProbabilityTermStructureHandle(default_probability_curve),recovery_rate,yield_curve_handle, )
settlementDays=2
tenor=ql.Period(5,ql.Years)
frequency= ql.Quarterly
paymentConvention=ql.Following
rule=ql.DateGeneration.TwentiethIMM
dayCounter=ql.Actual365Fixed()
upfrontSettlementDays=3
settlesAccrual =True
paysAtDefaultTime=True
startDate=today
lastPeriodDayCounter=ql.Actual365Fixed()
rebatesAccrual=True
model=MidpointEngine
print('=============================================================================================================================')
print('upfront_quote',upfront_quote,type(upfront_quote)) # const Handle< Quote > & upfront,
print('upfront',upfront,type(upfront)) # Rate runningSpread
print('running_spread_quote',running_spread_quote,type(running_spread_quote)) # Rate runningSpread,
print('tenor',tenor,type(tenor)) # const Period & tenor,
print('settlementDays',settlementDays,type(settlementDays)) # Integer settlementDays,
print('calendar',calendar,type(calendar)) # const Calendar & calendar,
print('frequency',frequency,type(frequency)) # Frequency frequency,
print('paymentConvention',paymentConvention,type(paymentConvention)) # BusinessDayConvention paymentConvention,
print('rule',rule,type(rule)) # DateGeneration::Rule rule,
print('dayCounter',dayCounter,type(dayCounter)) # const DayCounter & dayCounter,
print('recovery_rate',recovery_rate,type(recovery_rate)) # Real recoveryRate,
print('yield_curve_handle',yield_curve_handle,type(yield_curve_handle)) # const Handle< YieldTermStructure > & discountCurve,
print('upfrontSettlementDays',upfrontSettlementDays,type(upfrontSettlementDays)) # Natural upfrontSettlementDays = 3,
print('settlesAccrual',settlesAccrual,type(settlesAccrual)) # bool settlesAccrual = true,
print('paysAtDefaultTime',paysAtDefaultTime,type(paysAtDefaultTime)) # bool paysAtDefaultTime = true,
print('startDate',startDate,type(startDate)) # const Date & startDate = Date(),
print('lastPeriodDayCounter',lastPeriodDayCounter,type(lastPeriodDayCounter)) # const DayCounter & lastPeriodDayCounter = DayCounter(),
print('rebatesAccrual',rebatesAccrual,type(rebatesAccrual)) # bool rebatesAccrual = true,
print('model',model,type(model)) # CreditDefaultSwap::PricingModel model = CreditDefaultSwap::Midpoint
print('=============================================================================================================================')
helper = ql.UpfrontCdsHelper(
upfront, # Rate runningSpread / const Handle< Quote > & upfront,
running_spread_quote, # Rate runningSpread,
tenor, # const Period & tenor,
settlementDays, # Integer settlementDays,
calendar, # const Calendar & calendar,
frequency, # Frequency frequency,
paymentConvention, # BusinessDayConvention paymentConvention,
rule, # DateGeneration::Rule rule,
dayCounter, # const DayCounter & dayCounter,
recovery_rate, # Real recoveryRate,
yield_curve_handle, # const Handle< YieldTermStructure > & discountCurve,
upfrontSettlementDays, # Natural upfrontSettlementDays = 3,
settlesAccrual, # bool settlesAccrual = true,
paysAtDefaultTime, # bool paysAtDefaultTime = true,
startDate, # const Date & startDate = Date(),
lastPeriodDayCounter, # const DayCounter & lastPeriodDayCounter = DayCounter(),
rebatesAccrual, # bool rebatesAccrual = true,
# model, # CreditDefaultSwap::PricingModel model = CreditDefaultSwap::Midpoint
)
fair_running_spread = helper.impliedQuote()
return fair_running_spread
if __name__ == "__main__":
upfront = 0.01
running_spread = 0.012
recovery_rate = 0.4
notional = 1e7
maturity_date = ql.Date(20,12,2028)
today = ql.Date(3,4,2023)
ql.Settings.instance().setEvaluationDate(today)
fair_upfront, fair_running_spread = convert_spreads(upfront, running_spread, recovery_rate, notional, maturity_date, today )
print(f"Fair Running Spread: {fair_running_spread:.4f}")
|
|
From: Luigi B. <lui...@gm...> - 2023-04-06 10:49:24
|
The model should be `ql.CreditDefaultSwap.Midpoint`. It's an enumeration.
However, it's the way you're trying to use the helper that doesn't work.
After you create the helper, it's not connected to any probability curve
(hence the "px != 0" error); it should be used to build one. So once you
have your set of helpers, you should create a PiecewiseFlatHazardRate
instance. Once you have a bootstrapped curve, you could ask
helper.impliedQuote() but it will return the upfront (because that's the
quote for the helper) and it will simply match your input. If you want a
corresponding spread, you can create a CreditDefaultSwap, pass the default
probability curve to its engine and ask it for its fair spread.
Hope this helps,
Luigi
On Thu, Apr 6, 2023 at 5:40 AM Ben Watson <ben...@ma...>
wrote:
> Hi Luigi,
>
>
>
> Thank you for this – looks promising, but not a lot doco on UpfrontCdsHelper
> to work with. But I have put together a function to test this out. The
> code also print the all the types of the inputs to the UpfrontCdsHelper to
> make sure I am passing the correct types.
>
>
>
> I got ‘kind of’ close to get it working, but….
>
>
>
> If I leave the model (being the MidpointEngine) out of the
> UpfrontCdsHelper caller function, it throws no error, except that I get the
> following error when calling impliedQuote
>
>
>
> return _QuantLib.DefaultProbabilityHelper_impliedQuote(self)
>
> RuntimeError: Boost assertion failed: px != 0
>
>
>
> If I include the MidpointEngine I get the following error
>
>
>
> TypeError: Wrong number or type of arguments for overloaded function
> 'new_UpfrontCdsHelper'.
>
> Possible C/C++ prototypes are:….
>
> …
>
> UpfrontCdsHelper::UpfrontCdsHelper(Rate,Rate,Period const
> &,Integer,Calendar const
> &,Frequency,BusinessDayConvention,DateGeneration::Rule,DayCounter const
> &,Real,Handle< YieldTermStructure > const &,Natural,bool,bool,Date const
> &,DayCounter const &,bool,CreditDefaultSwap::PricingModel)
>
> ….
>
>
>
> The type of the is …. model <QuantLib.QuantLib.MidPointCdsEngine; proxy
> of <Swig Object of type 'ext::shared_ptr< MidPointCdsEngine > *' at
> 0x000001150752E4E0> > <class 'QuantLib.QuantLib.MidPointCdsEngine'>
>
>
>
> Not sure if there is something that I am doing wrong or there is a bug…
>
>
>
> Code below….
>
>
>
> import QuantLib as ql
>
> def convert_spreads( upfront, running_spread, recovery_rate,
> notional, maturity_date, today=None, coupon_frequency=4,
> day_count=ql.Thirty360(), calendar=ql.TARGET(),):
>
>
>
> flat_ts = ql.FlatForward(today, 0.0, day_count, ql.Compounded, ql.
> Annual)
>
> yield_curve_handle = ql.YieldTermStructureHandle(flat_ts)
>
>
>
> upfront_quote = ql.QuoteHandle(ql.SimpleQuote(upfront))
>
> running_spread_quote =running_spread#
> ql.QuoteHandle(ql.SimpleQuote(running_spread))
>
>
>
> hazard_rate_structure = upfront_quote
>
> default_probability_curve = ql.FlatHazardRate(0, calendar,
> hazard_rate_structure, day_count)
>
> MidpointEngine = ql.MidPointCdsEngine( ql.
> DefaultProbabilityTermStructureHandle(default_probability_curve),
> recovery_rate,yield_curve_handle, )
>
>
>
> settlementDays=2
>
> tenor=ql.Period(5,ql.Years)
>
> frequency= ql.Quarterly
>
> paymentConvention=ql.Following
>
> rule=ql.DateGeneration.TwentiethIMM
>
> dayCounter=ql.Actual365Fixed()
>
> upfrontSettlementDays=3
>
> settlesAccrual =True
>
> paysAtDefaultTime=True
>
> startDate=today
>
> lastPeriodDayCounter=ql.Actual365Fixed()
>
> rebatesAccrual=True
>
> model=MidpointEngine
>
>
>
> print(
> '============================================================================================================================='
> )
>
> print('upfront_quote',upfront_quote,type(upfront_quote))
> # const Handle< Quote > & upfront,
>
> print('upfront',upfront,type(upfront))
> # Rate runningSpread
>
> print('running_spread_quote',running_spread_quote,type(
> running_spread_quote)) # Rate runningSpread,
>
> print('tenor',tenor,type(tenor))
> # const Period & tenor,
>
> print('settlementDays',settlementDays,type(settlementDays))
> # Integer settlementDays,
>
> print('calendar',calendar,type(calendar))
> # const Calendar & calendar,
>
> print('frequency',frequency,type(frequency))
> # Frequency frequency,
>
> print('paymentConvention',paymentConvention,type(paymentConvention))
> # BusinessDayConvention paymentConvention,
>
> print('rule',rule,type(rule))
> # DateGeneration::Rule rule,
>
> print('dayCounter',dayCounter,type(dayCounter))
> # const DayCounter & dayCounter,
>
> print('recovery_rate',recovery_rate,type(recovery_rate))
> # Real recoveryRate,
>
> print('yield_curve_handle',yield_curve_handle,type(yield_curve_handle))
> # const Handle< YieldTermStructure > &
> discountCurve,
>
> print('upfrontSettlementDays',upfrontSettlementDays,type(
> upfrontSettlementDays)) # Natural upfrontSettlementDays
> = 3,
>
> print('settlesAccrual',settlesAccrual,type(settlesAccrual))
> # bool settlesAccrual = true,
>
> print('paysAtDefaultTime',paysAtDefaultTime,type(paysAtDefaultTime))
> # bool paysAtDefaultTime = true,
>
> print('startDate',startDate,type(startDate))
> # const Date & startDate = Date(),
>
> print('lastPeriodDayCounter',lastPeriodDayCounter,type(
> lastPeriodDayCounter)) # const DayCounter &
> lastPeriodDayCounter = DayCounter(),
>
> print('rebatesAccrual',rebatesAccrual,type(rebatesAccrual))
> # bool rebatesAccrual = true,
>
> print('model',model,type(model))
> # CreditDefaultSwap::PricingModel model =
> CreditDefaultSwap::Midpoint
>
> print(
> '============================================================================================================================='
> )
>
> helper = ql.UpfrontCdsHelper(
>
> upfront, # Rate
> runningSpread / const Handle< Quote > & upfront,
>
> running_spread_quote, # Rate
> runningSpread,
>
> tenor, # const Period &
> tenor,
>
> settlementDays, # Integer
> settlementDays,
>
> calendar, # const Calendar
> & calendar,
>
> frequency, # Frequency
> frequency,
>
> paymentConvention, #
> BusinessDayConvention paymentConvention,
>
> rule, #
> DateGeneration::Rule rule,
>
> dayCounter, # const
> DayCounter & dayCounter,
>
> recovery_rate, # Real
> recoveryRate,
>
> yield_curve_handle, # const Handle<
> YieldTermStructure > & discountCurve,
>
> upfrontSettlementDays, # Natural
> upfrontSettlementDays = 3,
>
> settlesAccrual, # bool
> settlesAccrual = true,
>
> paysAtDefaultTime, # bool
> paysAtDefaultTime = true,
>
> startDate, # const Date &
> startDate = Date(),
>
> lastPeriodDayCounter, # const
> DayCounter & lastPeriodDayCounter = DayCounter(),
>
> rebatesAccrual, # bool
> rebatesAccrual = true,
>
> # model, #
> CreditDefaultSwap::PricingModel model = CreditDefaultSwap::Midpoint
>
> )
>
> fair_running_spread = helper.impliedQuote()
>
> return fair_running_spread
>
>
>
> if __name__ == "__main__":
>
> upfront = 0.01
>
> running_spread = 0.012
>
> recovery_rate = 0.4
>
> notional = 1e7
>
> maturity_date = ql.Date(20,12,2028)
>
>
>
> today = ql.Date(3,4,2023)
>
> ql.Settings.instance().setEvaluationDate(today)
>
> fair_upfront, fair_running_spread = convert_spreads(upfront,
> running_spread, recovery_rate, notional, maturity_date, today )
>
>
>
> print(f"Fair Running Spread: {fair_running_spread:.4f}")
>
>
>
>
>
|
|
From: Ben W. <ben...@ma...> - 2023-04-06 03:46:58
|
Hi Luigi,
Thank you for this – looks promising, but not a lot doco on UpfrontCdsHelper to work with. But I have put together a function to test this out. The code also print the all the types of the inputs to the UpfrontCdsHelper to make sure I am passing the correct types.
I got ‘kind of’ close to get it working, but….
If I leave the model (being the MidpointEngine) out of the UpfrontCdsHelper caller function, it throws no error, except that I get the following error when calling impliedQuote
return _QuantLib.DefaultProbabilityHelper_impliedQuote(self)
RuntimeError: Boost assertion failed: px != 0
If I include the MidpointEngine I get the following error
TypeError: Wrong number or type of arguments for overloaded function 'new_UpfrontCdsHelper'.
Possible C/C++ prototypes are:….
…
UpfrontCdsHelper::UpfrontCdsHelper(Rate,Rate,Period const &,Integer,Calendar const &,Frequency,BusinessDayConvention,DateGeneration::Rule,DayCounter const &,Real,Handle< YieldTermStructure > const &,Natural,bool,bool,Date const &,DayCounter const &,bool,CreditDefaultSwap::PricingModel)
….
The type of the is …. model <QuantLib.QuantLib.MidPointCdsEngine; proxy of <Swig Object of type 'ext::shared_ptr< MidPointCdsEngine > *' at 0x000001150752E4E0> > <class 'QuantLib.QuantLib.MidPointCdsEngine'>
Not sure if there is something that I am doing wrong or there is a bug…
Code below….
import QuantLib as ql
def convert_spreads( upfront, running_spread, recovery_rate, notional, maturity_date, today=None, coupon_frequency=4, day_count=ql.Thirty360(), calendar=ql.TARGET(),):
flat_ts = ql.FlatForward(today, 0.0, day_count, ql.Compounded, ql.Annual)
yield_curve_handle = ql.YieldTermStructureHandle(flat_ts)
upfront_quote = ql.QuoteHandle(ql.SimpleQuote(upfront))
running_spread_quote =running_spread# ql.QuoteHandle(ql.SimpleQuote(running_spread))
hazard_rate_structure = upfront_quote
default_probability_curve = ql.FlatHazardRate(0, calendar, hazard_rate_structure, day_count)
MidpointEngine = ql.MidPointCdsEngine( ql.DefaultProbabilityTermStructureHandle(default_probability_curve),recovery_rate,yield_curve_handle, )
settlementDays=2
tenor=ql.Period(5,ql.Years)
frequency= ql.Quarterly
paymentConvention=ql.Following
rule=ql.DateGeneration.TwentiethIMM
dayCounter=ql.Actual365Fixed()
upfrontSettlementDays=3
settlesAccrual =True
paysAtDefaultTime=True
startDate=today
lastPeriodDayCounter=ql.Actual365Fixed()
rebatesAccrual=True
model=MidpointEngine
print('=============================================================================================================================')
print('upfront_quote',upfront_quote,type(upfront_quote)) # const Handle< Quote > & upfront,
print('upfront',upfront,type(upfront)) # Rate runningSpread
print('running_spread_quote',running_spread_quote,type(running_spread_quote)) # Rate runningSpread,
print('tenor',tenor,type(tenor)) # const Period & tenor,
print('settlementDays',settlementDays,type(settlementDays)) # Integer settlementDays,
print('calendar',calendar,type(calendar)) # const Calendar & calendar,
print('frequency',frequency,type(frequency)) # Frequency frequency,
print('paymentConvention',paymentConvention,type(paymentConvention)) # BusinessDayConvention paymentConvention,
print('rule',rule,type(rule)) # DateGeneration::Rule rule,
print('dayCounter',dayCounter,type(dayCounter)) # const DayCounter & dayCounter,
print('recovery_rate',recovery_rate,type(recovery_rate)) # Real recoveryRate,
print('yield_curve_handle',yield_curve_handle,type(yield_curve_handle)) # const Handle< YieldTermStructure > & discountCurve,
print('upfrontSettlementDays',upfrontSettlementDays,type(upfrontSettlementDays)) # Natural upfrontSettlementDays = 3,
print('settlesAccrual',settlesAccrual,type(settlesAccrual)) # bool settlesAccrual = true,
print('paysAtDefaultTime',paysAtDefaultTime,type(paysAtDefaultTime)) # bool paysAtDefaultTime = true,
print('startDate',startDate,type(startDate)) # const Date & startDate = Date(),
print('lastPeriodDayCounter',lastPeriodDayCounter,type(lastPeriodDayCounter)) # const DayCounter & lastPeriodDayCounter = DayCounter(),
print('rebatesAccrual',rebatesAccrual,type(rebatesAccrual)) # bool rebatesAccrual = true,
print('model',model,type(model)) # CreditDefaultSwap::PricingModel model = CreditDefaultSwap::Midpoint
print('=============================================================================================================================')
helper = ql.UpfrontCdsHelper(
upfront, # Rate runningSpread / const Handle< Quote > & upfront,
running_spread_quote, # Rate runningSpread,
tenor, # const Period & tenor,
settlementDays, # Integer settlementDays,
calendar, # const Calendar & calendar,
frequency, # Frequency frequency,
paymentConvention, # BusinessDayConvention paymentConvention,
rule, # DateGeneration::Rule rule,
dayCounter, # const DayCounter & dayCounter,
recovery_rate, # Real recoveryRate,
yield_curve_handle, # const Handle< YieldTermStructure > & discountCurve,
upfrontSettlementDays, # Natural upfrontSettlementDays = 3,
settlesAccrual, # bool settlesAccrual = true,
paysAtDefaultTime, # bool paysAtDefaultTime = true,
startDate, # const Date & startDate = Date(),
lastPeriodDayCounter, # const DayCounter & lastPeriodDayCounter = DayCounter(),
rebatesAccrual, # bool rebatesAccrual = true,
# model, # CreditDefaultSwap::PricingModel model = CreditDefaultSwap::Midpoint
)
fair_running_spread = helper.impliedQuote()
return fair_running_spread
if __name__ == "__main__":
upfront = 0.01
running_spread = 0.012
recovery_rate = 0.4
notional = 1e7
maturity_date = ql.Date(20,12,2028)
today = ql.Date(3,4,2023)
ql.Settings.instance().setEvaluationDate(today)
fair_upfront, fair_running_spread = convert_spreads(upfront, running_spread, recovery_rate, notional, maturity_date, today )
print(f"Fair Running Spread: {fair_running_spread:.4f}")
|
|
From: Ben W. <ben...@ma...> - 2023-04-06 02:12:04
|
Also forgot to say. There may be an issue with the IsdaCdsEngine – I saw some error messages regarding the daycount basis of the discount curve. I think the code has not been updated to allow RFR discounting – can you pls confirm. I would imagine that the simplest thing would be to remove the daycount error checking of curve.
From: Ben Watson <ben...@ma...>
Sent: Thursday, April 6, 2023 11:38 AM
To: 'QuantLib Users' <qua...@li...>
Cc: 'Luigi Ballabio' <lui...@gm...>
Subject: RE: [Quantlib-users] CDS quoted spread v Running/par spread calculator
Sorry to hassle on this – UpfrontCdsHelper is not working. I do need to decide if I need to go another path to convert the upfront CDS to the running spread.
On Tue, 4 Apr 2023, 11:57 Ben Watson, <ben...@ma... <mailto:ben...@ma...> > wrote:
Thank you Luigi,
Thank you for this – looks promising, but not a lot doco on UpfrontCdsHelper to work with. But I have put together a function to test this out. The code also print the all the types of the inputs to the UpfrontCdsHelper to make sure I am passing the correct types.
I got ‘kind of’ close to get it working, but….
If I leave the model (being the MidpointEngine) out of the UpfrontCdsHelper caller function, it throws no error, except that I get the following error when calling impliedQuote
return _QuantLib.DefaultProbabilityHelper_impliedQuote(self)
RuntimeError: Boost assertion failed: px != 0
If I include the MidpointEngine I get the following error
TypeError: Wrong number or type of arguments for overloaded function 'new_UpfrontCdsHelper'.
Possible C/C++ prototypes are:….
…
…
UpfrontCdsHelper::UpfrontCdsHelper(Rate,Rate,Period const &,Integer,Calendar const &,Frequency,BusinessDayConvention,DateGeneration::Rule,DayCounter const &,Real,Handle< YieldTermStructure > const &,Natural,bool,bool,Date const &,DayCounter const &,bool,CreditDefaultSwap::PricingModel)
….
….
The type of the is …. model <QuantLib.QuantLib.MidPointCdsEngine; proxy of <Swig Object of type 'ext::shared_ptr< MidPointCdsEngine > *' at 0x000001150752E4E0> > <class 'QuantLib.QuantLib.MidPointCdsEngine'>
Not sure if there is something that I am doing wrong or there is a bug…
Code below….
import QuantLib as ql
def convert_spreads( upfront, running_spread, recovery_rate, notional, maturity_date, today=None, coupon_frequency=4, day_count=ql.Thirty360(), calendar=ql.TARGET(),):
flat_ts = ql.FlatForward(today, 0.0, day_count, ql.Compounded, ql.Annual)
yield_curve_handle = ql.YieldTermStructureHandle(flat_ts)
upfront_quote = ql.QuoteHandle(ql.SimpleQuote(upfront))
running_spread_quote =running_spread# ql.QuoteHandle(ql.SimpleQuote(running_spread))
hazard_rate_structure = upfront_quote
default_probability_curve = ql.FlatHazardRate(0, calendar, hazard_rate_structure, day_count)
MidpointEngine = ql.MidPointCdsEngine( ql.DefaultProbabilityTermStructureHandle(default_probability_curve),recovery_rate,yield_curve_handle, )
settlementDays=2
tenor=ql.Period(5,ql.Years)
frequency= ql.Quarterly
paymentConvention=ql.Following
rule=ql.DateGeneration.TwentiethIMM
dayCounter=ql.Actual365Fixed()
upfrontSettlementDays=3
settlesAccrual =True
paysAtDefaultTime=True
startDate=today
lastPeriodDayCounter=ql.Actual365Fixed()
rebatesAccrual=True
model=MidpointEngine
print('=============================================================================================================================')
print('upfront_quote',upfront_quote,type(upfront_quote)) # const Handle< Quote > & upfront,
print('upfront',upfront,type(upfront)) # Rate runningSpread
print('running_spread_quote',running_spread_quote,type(running_spread_quote)) # Rate runningSpread,
print('tenor',tenor,type(tenor)) # const Period & tenor,
print('settlementDays',settlementDays,type(settlementDays)) # Integer settlementDays,
print('calendar',calendar,type(calendar)) # const Calendar & calendar,
print('frequency',frequency,type(frequency)) # Frequency frequency,
print('paymentConvention',paymentConvention,type(paymentConvention)) # BusinessDayConvention paymentConvention,
print('rule',rule,type(rule)) # DateGeneration::Rule rule,
print('dayCounter',dayCounter,type(dayCounter)) # const DayCounter & dayCounter,
print('recovery_rate',recovery_rate,type(recovery_rate)) # Real recoveryRate,
print('yield_curve_handle',yield_curve_handle,type(yield_curve_handle)) # const Handle< YieldTermStructure > & discountCurve,
print('upfrontSettlementDays',upfrontSettlementDays,type(upfrontSettlementDays)) # Natural upfrontSettlementDays = 3,
print('settlesAccrual',settlesAccrual,type(settlesAccrual)) # bool settlesAccrual = true,
print('paysAtDefaultTime',paysAtDefaultTime,type(paysAtDefaultTime)) # bool paysAtDefaultTime = true,
print('startDate',startDate,type(startDate)) # const Date & startDate = Date(),
print('lastPeriodDayCounter',lastPeriodDayCounter,type(lastPeriodDayCounter)) # const DayCounter & lastPeriodDayCounter = DayCounter(),
print('rebatesAccrual',rebatesAccrual,type(rebatesAccrual)) # bool rebatesAccrual = true,
print('model',model,type(model)) # CreditDefaultSwap::PricingModel model = CreditDefaultSwap::Midpoint
print('=============================================================================================================================')
helper = ql.UpfrontCdsHelper(
upfront, # Rate runningSpread / const Handle< Quote > & upfront,
running_spread_quote, # Rate runningSpread,
tenor, # const Period & tenor,
settlementDays, # Integer settlementDays,
calendar, # const Calendar & calendar,
frequency, # Frequency frequency,
paymentConvention, # BusinessDayConvention paymentConvention,
rule, # DateGeneration::Rule rule,
dayCounter, # const DayCounter & dayCounter,
recovery_rate, # Real recoveryRate,
yield_curve_handle, # const Handle< YieldTermStructure > & discountCurve,
upfrontSettlementDays, # Natural upfrontSettlementDays = 3,
settlesAccrual, # bool settlesAccrual = true,
paysAtDefaultTime, # bool paysAtDefaultTime = true,
startDate, # const Date & startDate = Date(),
lastPeriodDayCounter, # const DayCounter & lastPeriodDayCounter = DayCounter(),
rebatesAccrual, # bool rebatesAccrual = true,
# model, # CreditDefaultSwap::PricingModel model = CreditDefaultSwap::Midpoint
)
fair_running_spread = helper.impliedQuote()
return fair_running_spread
if __name__ == "__main__":
upfront = 0.01
running_spread = 0.012
recovery_rate = 0.4
notional = 1e7
maturity_date = ql.Date(20,12,2028)
today = ql.Date(3,4,2023)
ql.Settings.instance().setEvaluationDate(today)
fair_upfront, fair_running_spread = convert_spreads(upfront, running_spread, recovery_rate, notional, maturity_date, today )
print(f"Fair Running Spread: {fair_running_spread:.4f}")
From: Luigi Ballabio <lui...@gm... <mailto:lui...@gm...> >
Sent: Monday, April 3, 2023 6:04 PM
To: Ben Watson <ben...@ma... <mailto:ben...@ma...> >
Cc: QuantLib Users <qua...@li... <mailto:qua...@li...> >
Subject: Re: CDS quoted spread v Running/par spread calculator
Hello Ben,
you can use the UpfrontCdsHelper class instead. It allows you to specify both the spread and the quoted upfront.
Best,
Luigi
On Mon, Apr 3, 2023, 06:44 Ben Watson <ben...@ma... <mailto:ben...@ma...> > wrote:
Just trying to get a bit of guidance on this.
The documentation talks about running spread – which would be the case when coupon=spread. This is not quoted in the market as they quote 100 or 500 coupon.
ql.SpreadCdsHelper( runningSpread, tenor, settlementDays, calendar, frequency, paymentConvention, rule, dayCounter, recoveryRate, yts)
Example in Git hub (https://github.com/lballabio/QuantLib-SWIG/blob/master/Python/examples/cds.py) talks about quoted spread which would in the market come to mean a fixed coupon. The CDS helper however does not have a coupon.
quoted_spreads = [0.0150, 0.0150, 0.0150, 0.0150]
tenors = [ql.Period(3, ql.Months), ql.Period(6, ql.Months), ql.Period(1, ql.Years), ql.Period(2, ql.Years)]
maturities = [calendar.adjust(todaysDate + x, ql.Following) for x in tenors]
instruments = [ ql.SpreadCdsHelper( ql.QuoteHandle(ql.SimpleQuote(s)), tenor, 0, calendar, ql.Quarterly, ql.Following, l.DateGeneration.TwentiethIMM, ql.Actual365Fixed(), recovery_rate, risk_free_rate, )
So not so clear, but it looks like it is running spread
In light of this is there any function that converts the market quote (with 100 or 500 coupon) to the running spread that I can use to bootstrap a CDS curve?
Regards
Ben
From: Ben Watson <ben...@ma... <mailto:ben...@ma...> >
Sent: Thursday, March 30, 2023 10:54 AM
To: 'QuantLib Users' <qua...@li... <mailto:qua...@li...> >; 'Luigi Ballabio' <lui...@gm... <mailto:lui...@gm...> >
Subject: CDS quoted spread v Running/par spread calculator
Hi,
Noticed that the CDS curve builder uses the running spread to boot strap the curve. However the quotes I am working with is basis 100 or 500 coupon with an up front. Does Quantlib have a spread converter to change the quoted spreads to the running spreads?
Ben
_______________________________________________
QuantLib-users mailing list
Qua...@li... <mailto:Qua...@li...>
https://lists.sourceforge.net/lists/listinfo/quantlib-users
|
|
From: Ben W. <ben...@ma...> - 2023-04-06 01:46:31
|
Sorry to hassle on this – UpfrontCdsHelper is not working. I do need to decide if I need to go another path to convert the upfront CDS to the running spread.
On Tue, 4 Apr 2023, 11:57 Ben Watson, <ben...@ma... <mailto:ben...@ma...> > wrote:
Thank you Luigi,
Thank you for this – looks promising, but not a lot doco on UpfrontCdsHelper to work with. But I have put together a function to test this out. The code also print the all the types of the inputs to the UpfrontCdsHelper to make sure I am passing the correct types.
I got ‘kind of’ close to get it working, but….
If I leave the model (being the MidpointEngine) out of the UpfrontCdsHelper caller function, it throws no error, except that I get the following error when calling impliedQuote
return _QuantLib.DefaultProbabilityHelper_impliedQuote(self)
RuntimeError: Boost assertion failed: px != 0
If I include the MidpointEngine I get the following error
TypeError: Wrong number or type of arguments for overloaded function 'new_UpfrontCdsHelper'.
Possible C/C++ prototypes are:….
…
…
UpfrontCdsHelper::UpfrontCdsHelper(Rate,Rate,Period const &,Integer,Calendar const &,Frequency,BusinessDayConvention,DateGeneration::Rule,DayCounter const &,Real,Handle< YieldTermStructure > const &,Natural,bool,bool,Date const &,DayCounter const &,bool,CreditDefaultSwap::PricingModel)
….
….
The type of the is …. model <QuantLib.QuantLib.MidPointCdsEngine; proxy of <Swig Object of type 'ext::shared_ptr< MidPointCdsEngine > *' at 0x000001150752E4E0> > <class 'QuantLib.QuantLib.MidPointCdsEngine'>
Not sure if there is something that I am doing wrong or there is a bug…
Code below….
import QuantLib as ql
def convert_spreads( upfront, running_spread, recovery_rate, notional, maturity_date, today=None, coupon_frequency=4, day_count=ql.Thirty360(), calendar=ql.TARGET(),):
flat_ts = ql.FlatForward(today, 0.0, day_count, ql.Compounded, ql.Annual)
yield_curve_handle = ql.YieldTermStructureHandle(flat_ts)
upfront_quote = ql.QuoteHandle(ql.SimpleQuote(upfront))
running_spread_quote =running_spread# ql.QuoteHandle(ql.SimpleQuote(running_spread))
hazard_rate_structure = upfront_quote
default_probability_curve = ql.FlatHazardRate(0, calendar, hazard_rate_structure, day_count)
MidpointEngine = ql.MidPointCdsEngine( ql.DefaultProbabilityTermStructureHandle(default_probability_curve),recovery_rate,yield_curve_handle, )
settlementDays=2
tenor=ql.Period(5,ql.Years)
frequency= ql.Quarterly
paymentConvention=ql.Following
rule=ql.DateGeneration.TwentiethIMM
dayCounter=ql.Actual365Fixed()
upfrontSettlementDays=3
settlesAccrual =True
paysAtDefaultTime=True
startDate=today
lastPeriodDayCounter=ql.Actual365Fixed()
rebatesAccrual=True
model=MidpointEngine
print('=============================================================================================================================')
print('upfront_quote',upfront_quote,type(upfront_quote)) # const Handle< Quote > & upfront,
print('upfront',upfront,type(upfront)) # Rate runningSpread
print('running_spread_quote',running_spread_quote,type(running_spread_quote)) # Rate runningSpread,
print('tenor',tenor,type(tenor)) # const Period & tenor,
print('settlementDays',settlementDays,type(settlementDays)) # Integer settlementDays,
print('calendar',calendar,type(calendar)) # const Calendar & calendar,
print('frequency',frequency,type(frequency)) # Frequency frequency,
print('paymentConvention',paymentConvention,type(paymentConvention)) # BusinessDayConvention paymentConvention,
print('rule',rule,type(rule)) # DateGeneration::Rule rule,
print('dayCounter',dayCounter,type(dayCounter)) # const DayCounter & dayCounter,
print('recovery_rate',recovery_rate,type(recovery_rate)) # Real recoveryRate,
print('yield_curve_handle',yield_curve_handle,type(yield_curve_handle)) # const Handle< YieldTermStructure > & discountCurve,
print('upfrontSettlementDays',upfrontSettlementDays,type(upfrontSettlementDays)) # Natural upfrontSettlementDays = 3,
print('settlesAccrual',settlesAccrual,type(settlesAccrual)) # bool settlesAccrual = true,
print('paysAtDefaultTime',paysAtDefaultTime,type(paysAtDefaultTime)) # bool paysAtDefaultTime = true,
print('startDate',startDate,type(startDate)) # const Date & startDate = Date(),
print('lastPeriodDayCounter',lastPeriodDayCounter,type(lastPeriodDayCounter)) # const DayCounter & lastPeriodDayCounter = DayCounter(),
print('rebatesAccrual',rebatesAccrual,type(rebatesAccrual)) # bool rebatesAccrual = true,
print('model',model,type(model)) # CreditDefaultSwap::PricingModel model = CreditDefaultSwap::Midpoint
print('=============================================================================================================================')
helper = ql.UpfrontCdsHelper(
upfront, # Rate runningSpread / const Handle< Quote > & upfront,
running_spread_quote, # Rate runningSpread,
tenor, # const Period & tenor,
settlementDays, # Integer settlementDays,
calendar, # const Calendar & calendar,
frequency, # Frequency frequency,
paymentConvention, # BusinessDayConvention paymentConvention,
rule, # DateGeneration::Rule rule,
dayCounter, # const DayCounter & dayCounter,
recovery_rate, # Real recoveryRate,
yield_curve_handle, # const Handle< YieldTermStructure > & discountCurve,
upfrontSettlementDays, # Natural upfrontSettlementDays = 3,
settlesAccrual, # bool settlesAccrual = true,
paysAtDefaultTime, # bool paysAtDefaultTime = true,
startDate, # const Date & startDate = Date(),
lastPeriodDayCounter, # const DayCounter & lastPeriodDayCounter = DayCounter(),
rebatesAccrual, # bool rebatesAccrual = true,
# model, # CreditDefaultSwap::PricingModel model = CreditDefaultSwap::Midpoint
)
fair_running_spread = helper.impliedQuote()
return fair_running_spread
if __name__ == "__main__":
upfront = 0.01
running_spread = 0.012
recovery_rate = 0.4
notional = 1e7
maturity_date = ql.Date(20,12,2028)
today = ql.Date(3,4,2023)
ql.Settings.instance().setEvaluationDate(today)
fair_upfront, fair_running_spread = convert_spreads(upfront, running_spread, recovery_rate, notional, maturity_date, today )
print(f"Fair Running Spread: {fair_running_spread:.4f}")
From: Luigi Ballabio <lui...@gm... <mailto:lui...@gm...> >
Sent: Monday, April 3, 2023 6:04 PM
To: Ben Watson <ben...@ma... <mailto:ben...@ma...> >
Cc: QuantLib Users <qua...@li... <mailto:qua...@li...> >
Subject: Re: CDS quoted spread v Running/par spread calculator
Hello Ben,
you can use the UpfrontCdsHelper class instead. It allows you to specify both the spread and the quoted upfront.
Best,
Luigi
On Mon, Apr 3, 2023, 06:44 Ben Watson <ben...@ma... <mailto:ben...@ma...> > wrote:
Just trying to get a bit of guidance on this.
The documentation talks about running spread – which would be the case when coupon=spread. This is not quoted in the market as they quote 100 or 500 coupon.
ql.SpreadCdsHelper( runningSpread, tenor, settlementDays, calendar, frequency, paymentConvention, rule, dayCounter, recoveryRate, yts)
Example in Git hub (https://github.com/lballabio/QuantLib-SWIG/blob/master/Python/examples/cds.py) talks about quoted spread which would in the market come to mean a fixed coupon. The CDS helper however does not have a coupon.
quoted_spreads = [0.0150, 0.0150, 0.0150, 0.0150]
tenors = [ql.Period(3, ql.Months), ql.Period(6, ql.Months), ql.Period(1, ql.Years), ql.Period(2, ql.Years)]
maturities = [calendar.adjust(todaysDate + x, ql.Following) for x in tenors]
instruments = [ ql.SpreadCdsHelper( ql.QuoteHandle(ql.SimpleQuote(s)), tenor, 0, calendar, ql.Quarterly, ql.Following, l.DateGeneration.TwentiethIMM, ql.Actual365Fixed(), recovery_rate, risk_free_rate, )
So not so clear, but it looks like it is running spread
In light of this is there any function that converts the market quote (with 100 or 500 coupon) to the running spread that I can use to bootstrap a CDS curve?
Regards
Ben
From: Ben Watson <ben...@ma... <mailto:ben...@ma...> >
Sent: Thursday, March 30, 2023 10:54 AM
To: 'QuantLib Users' <qua...@li... <mailto:qua...@li...> >; 'Luigi Ballabio' <lui...@gm... <mailto:lui...@gm...> >
Subject: CDS quoted spread v Running/par spread calculator
Hi,
Noticed that the CDS curve builder uses the running spread to boot strap the curve. However the quotes I am working with is basis 100 or 500 coupon with an up front. Does Quantlib have a spread converter to change the quoted spreads to the running spreads?
Ben
_______________________________________________
QuantLib-users mailing list
Qua...@li... <mailto:Qua...@li...>
https://lists.sourceforge.net/lists/listinfo/quantlib-users
|
|
From: Roland L. <rol...@ac...> - 2023-04-05 10:27:15
|
Dear all, our next ORE release is out on https://github.com/OpenSourceRisk As announced, we have rolled out a range of credit and bond derivatives this time, see the release notes for details. Moreover, * American Monte Carlo simulation is integrated now (Example 39) * par sensitivity analysis has been added (Example 40) * there are additional parametric VaR types including Delta-Gamma Saddlepoint * we have added multi-threading support to sensitivity analysis and exposure simulation (Example 41) * And finally, our ORE Python module can now be installed with “pip install open-source-risk-engine”, and it allows querying ORE results and amending inputs in memory within the Python framework. See Example 42 for a start and more examples in the ORE SWIG repository. Please explore, all feedback is welcome! And join us at the Acadia Quant Summit in London this month https://www.acadia.inc/quant-summit-london to see and discuss ORE. Best wishes, Roland Roland Lichters Quantitative Services [Logo Description automatically generated] Maurenbrecherstrasse 16, 47803 Krefeld, Deutschland office +49 2151 9284800 mobile +49 172 9985795 rol...@ac...<mailto:rol...@ac...> acadia.inc<https://acadia.inc/> [signature_2811593998]<https://www.youtube.com/channel/UCsMyFt94Jyfwo-ecLBpy5xw>[signature_1151196288]<https://twitter.com/AcadiaSoft_>[signature_3977098555]<https://www.linkedin.com/company/acadiasoft-inc> The information contained in this e-mail, and any attachment, is confidential and is intended solely for the use of the intended recipient. Access, copying or re-use of the e-mail or any attachment, or any information contained therein, by any other person is not authorized. If you are not the intended recipient please return the e-mail to the sender and delete it from your computer. The acadia.inc privacy policy is available on our website. |
|
From: Jonathan S. <sw...@gm...> - 2023-04-04 22:23:01
|
Hi Donghee, 1. All of the cpp files including fixedratebond.cpp are compiled and then linked together into the QuantLib library, so yes they are essential in the way that the library is currently built. But as a user of the QuantLib library, you don’t need to use any of the features that you don’t need. 2. In order to use QuantLib::io::rate you will need to include the appropriate header file, just like using a function defined in any other library. Please trying adding the following line at the top of all files where you use QuantLib::io::rate: #include <ql/utilities/dataformatters.hpp> 2023년 4월 4일 (화) 23:48, Donghee Shim <dh7...@gm...>님이 작성: > Dear exports! > > Very sorry for my novice questions! > > I have 2 questions. > > What is the purpose of many .cpp files such as fixedratebond.cpp? Are they > essential in Quantlib? > > > > 2. At my code I used “std::cout << io::rate(couponRates[i])”, > > error occurred “error C2039: 'rate': is not member of 'QuantLib::io“ > > (I included using namespace QuantLib; at the front) > > When I attached the prefix “std::cout << > Quantlib::io::rate(couponRates[i])’, > > the same error occurred. > > > > Thanks! > > Best Regards > > Shim Donghee > _______________________________________________ > QuantLib-users mailing list > Qua...@li... > https://lists.sourceforge.net/lists/listinfo/quantlib-users > |
|
From: Donghee S. <dh7...@gm...> - 2023-04-04 14:46:11
|
Dear exports! Very sorry for my novice questions! I have 2 questions. What is the purpose of many .cpp files such as fixedratebond.cpp? Are they essential in Quantlib? 2. At my code I used “std::cout << io::rate(couponRates[i])”, error occurred “error C2039: 'rate': is not member of 'QuantLib::io“ (I included using namespace QuantLib; at the front) When I attached the prefix “std::cout << Quantlib::io::rate(couponRates[i])’, the same error occurred. Thanks! Best Regards Shim Donghee |
|
From: Ben W. <ben...@ma...> - 2023-04-04 05:43:27
|
Happy to when I can get it working. From: Jack G <jac...@gm...> Sent: Tuesday, April 4, 2023 2:09 PM To: Ben Watson <ben...@ma...> Cc: Luigi Ballabio <lui...@gm...>; QuantLib Users <qua...@li...> Subject: Re: [Quantlib-users] CDS quoted spread v Running/par spread calculator Ben, Please do consider helping us fix the documentation issues you describe by contributing to the python docs here, once you have got it working: https://quantlib-python-docs.readthedocs.io/en/latest/ Many thanks! Jack On Tue, 4 Apr 2023, 11:57 Ben Watson, <ben...@ma... <mailto:ben...@ma...> > wrote: Thank you Luigi, Thank you for this – looks promising, but not a lot doco on UpfrontCdsHelper to work with. But I have put together a function to test this out. The code also print the all the types of the inputs to the UpfrontCdsHelper to make sure I am passing the correct types. I got ‘kind of’ close to get it working, but…. If I leave the model (being the MidpointEngine) out of the UpfrontCdsHelper caller function, it throws no error, except that I get the following error when calling impliedQuote return _QuantLib.DefaultProbabilityHelper_impliedQuote(self) RuntimeError: Boost assertion failed: px != 0 If I include the MidpointEngine I get the following error TypeError: Wrong number or type of arguments for overloaded function 'new_UpfrontCdsHelper'. Possible C/C++ prototypes are:…. … … UpfrontCdsHelper::UpfrontCdsHelper(Rate,Rate,Period const &,Integer,Calendar const &,Frequency,BusinessDayConvention,DateGeneration::Rule,DayCounter const &,Real,Handle< YieldTermStructure > const &,Natural,bool,bool,Date const &,DayCounter const &,bool,CreditDefaultSwap::PricingModel) …. …. The type of the is …. model <QuantLib.QuantLib.MidPointCdsEngine; proxy of <Swig Object of type 'ext::shared_ptr< MidPointCdsEngine > *' at 0x000001150752E4E0> > <class 'QuantLib.QuantLib.MidPointCdsEngine'> Not sure if there is something that I am doing wrong or there is a bug… Code below…. import QuantLib as ql def convert_spreads( upfront, running_spread, recovery_rate, notional, maturity_date, today=None, coupon_frequency=4, day_count=ql.Thirty360(), calendar=ql.TARGET(),): flat_ts = ql.FlatForward(today, 0.0, day_count, ql.Compounded, ql.Annual) yield_curve_handle = ql.YieldTermStructureHandle(flat_ts) upfront_quote = ql.QuoteHandle(ql.SimpleQuote(upfront)) running_spread_quote =running_spread# ql.QuoteHandle(ql.SimpleQuote(running_spread)) hazard_rate_structure = upfront_quote default_probability_curve = ql.FlatHazardRate(0, calendar, hazard_rate_structure, day_count) MidpointEngine = ql.MidPointCdsEngine( ql.DefaultProbabilityTermStructureHandle(default_probability_curve),recovery_rate,yield_curve_handle, ) settlementDays=2 tenor=ql.Period(5,ql.Years) frequency= ql.Quarterly paymentConvention=ql.Following rule=ql.DateGeneration.TwentiethIMM dayCounter=ql.Actual365Fixed() upfrontSettlementDays=3 settlesAccrual =True paysAtDefaultTime=True startDate=today lastPeriodDayCounter=ql.Actual365Fixed() rebatesAccrual=True model=MidpointEngine print('=============================================================================================================================') print('upfront_quote',upfront_quote,type(upfront_quote)) # const Handle< Quote > & upfront, print('upfront',upfront,type(upfront)) # Rate runningSpread print('running_spread_quote',running_spread_quote,type(running_spread_quote)) # Rate runningSpread, print('tenor',tenor,type(tenor)) # const Period & tenor, print('settlementDays',settlementDays,type(settlementDays)) # Integer settlementDays, print('calendar',calendar,type(calendar)) # const Calendar & calendar, print('frequency',frequency,type(frequency)) # Frequency frequency, print('paymentConvention',paymentConvention,type(paymentConvention)) # BusinessDayConvention paymentConvention, print('rule',rule,type(rule)) # DateGeneration::Rule rule, print('dayCounter',dayCounter,type(dayCounter)) # const DayCounter & dayCounter, print('recovery_rate',recovery_rate,type(recovery_rate)) # Real recoveryRate, print('yield_curve_handle',yield_curve_handle,type(yield_curve_handle)) # const Handle< YieldTermStructure > & discountCurve, print('upfrontSettlementDays',upfrontSettlementDays,type(upfrontSettlementDays)) # Natural upfrontSettlementDays = 3, print('settlesAccrual',settlesAccrual,type(settlesAccrual)) # bool settlesAccrual = true, print('paysAtDefaultTime',paysAtDefaultTime,type(paysAtDefaultTime)) # bool paysAtDefaultTime = true, print('startDate',startDate,type(startDate)) # const Date & startDate = Date(), print('lastPeriodDayCounter',lastPeriodDayCounter,type(lastPeriodDayCounter)) # const DayCounter & lastPeriodDayCounter = DayCounter(), print('rebatesAccrual',rebatesAccrual,type(rebatesAccrual)) # bool rebatesAccrual = true, print('model',model,type(model)) # CreditDefaultSwap::PricingModel model = CreditDefaultSwap::Midpoint print('=============================================================================================================================') helper = ql.UpfrontCdsHelper( upfront, # Rate runningSpread / const Handle< Quote > & upfront, running_spread_quote, # Rate runningSpread, tenor, # const Period & tenor, settlementDays, # Integer settlementDays, calendar, # const Calendar & calendar, frequency, # Frequency frequency, paymentConvention, # BusinessDayConvention paymentConvention, rule, # DateGeneration::Rule rule, dayCounter, # const DayCounter & dayCounter, recovery_rate, # Real recoveryRate, yield_curve_handle, # const Handle< YieldTermStructure > & discountCurve, upfrontSettlementDays, # Natural upfrontSettlementDays = 3, settlesAccrual, # bool settlesAccrual = true, paysAtDefaultTime, # bool paysAtDefaultTime = true, startDate, # const Date & startDate = Date(), lastPeriodDayCounter, # const DayCounter & lastPeriodDayCounter = DayCounter(), rebatesAccrual, # bool rebatesAccrual = true, # model, # CreditDefaultSwap::PricingModel model = CreditDefaultSwap::Midpoint ) fair_running_spread = helper.impliedQuote() return fair_running_spread if __name__ == "__main__": upfront = 0.01 running_spread = 0.012 recovery_rate = 0.4 notional = 1e7 maturity_date = ql.Date(20,12,2028) today = ql.Date(3,4,2023) ql.Settings.instance().setEvaluationDate(today) fair_upfront, fair_running_spread = convert_spreads(upfront, running_spread, recovery_rate, notional, maturity_date, today ) print(f"Fair Running Spread: {fair_running_spread:.4f}") From: Luigi Ballabio <lui...@gm... <mailto:lui...@gm...> > Sent: Monday, April 3, 2023 6:04 PM To: Ben Watson <ben...@ma... <mailto:ben...@ma...> > Cc: QuantLib Users <qua...@li... <mailto:qua...@li...> > Subject: Re: CDS quoted spread v Running/par spread calculator Hello Ben, you can use the UpfrontCdsHelper class instead. It allows you to specify both the spread and the quoted upfront. Best, Luigi On Mon, Apr 3, 2023, 06:44 Ben Watson <ben...@ma... <mailto:ben...@ma...> > wrote: Just trying to get a bit of guidance on this. The documentation talks about running spread – which would be the case when coupon=spread. This is not quoted in the market as they quote 100 or 500 coupon. ql.SpreadCdsHelper( runningSpread, tenor, settlementDays, calendar, frequency, paymentConvention, rule, dayCounter, recoveryRate, yts) Example in Git hub (https://github.com/lballabio/QuantLib-SWIG/blob/master/Python/examples/cds.py) talks about quoted spread which would in the market come to mean a fixed coupon. The CDS helper however does not have a coupon. quoted_spreads = [0.0150, 0.0150, 0.0150, 0.0150] tenors = [ql.Period(3, ql.Months), ql.Period(6, ql.Months), ql.Period(1, ql.Years), ql.Period(2, ql.Years)] maturities = [calendar.adjust(todaysDate + x, ql.Following) for x in tenors] instruments = [ ql.SpreadCdsHelper( ql.QuoteHandle(ql.SimpleQuote(s)), tenor, 0, calendar, ql.Quarterly, ql.Following, l.DateGeneration.TwentiethIMM, ql.Actual365Fixed(), recovery_rate, risk_free_rate, ) So not so clear, but it looks like it is running spread In light of this is there any function that converts the market quote (with 100 or 500 coupon) to the running spread that I can use to bootstrap a CDS curve? Regards Ben From: Ben Watson <ben...@ma... <mailto:ben...@ma...> > Sent: Thursday, March 30, 2023 10:54 AM To: 'QuantLib Users' <qua...@li... <mailto:qua...@li...> >; 'Luigi Ballabio' <lui...@gm... <mailto:lui...@gm...> > Subject: CDS quoted spread v Running/par spread calculator Hi, Noticed that the CDS curve builder uses the running spread to boot strap the curve. However the quotes I am working with is basis 100 or 500 coupon with an up front. Does Quantlib have a spread converter to change the quoted spreads to the running spreads? Ben _______________________________________________ QuantLib-users mailing list Qua...@li... <mailto:Qua...@li...> https://lists.sourceforge.net/lists/listinfo/quantlib-users |
|
From: Jack G <jac...@gm...> - 2023-04-04 04:08:59
|
Ben, Please do consider helping us fix the documentation issues you describe by contributing to the python docs here, once you have got it working: https://quantlib-python-docs.readthedocs.io/en/latest/ Many thanks! Jack On Tue, 4 Apr 2023, 11:57 Ben Watson, <ben...@ma...> wrote: > Thank you Luigi, > > > > Thank you for this – looks promising, but not a lot doco on UpfrontCdsHelper > to work with. But I have put together a function to test this out. The > code also print the all the types of the inputs to the UpfrontCdsHelper to > make sure I am passing the correct types. > > > > I got ‘kind of’ close to get it working, but…. > > > > If I leave the model (being the MidpointEngine) out of the > UpfrontCdsHelper caller function, it throws no error, except that I get the > following error when calling impliedQuote > > > > return _QuantLib.DefaultProbabilityHelper_impliedQuote(self) > > RuntimeError: Boost assertion failed: px != 0 > > > > If I include the MidpointEngine I get the following error > > > > TypeError: Wrong number or type of arguments for overloaded function > 'new_UpfrontCdsHelper'. > > Possible C/C++ prototypes are:…. > > … > > … > > UpfrontCdsHelper::UpfrontCdsHelper(Rate,Rate,Period const > &,Integer,Calendar const > &,Frequency,BusinessDayConvention,DateGeneration::Rule,DayCounter const > &,Real,Handle< YieldTermStructure > const &,Natural,bool,bool,Date const > &,DayCounter const &,bool,CreditDefaultSwap::PricingModel) > > …. > > …. > > > > The type of the is …. model <QuantLib.QuantLib.MidPointCdsEngine; proxy > of <Swig Object of type 'ext::shared_ptr< MidPointCdsEngine > *' at > 0x000001150752E4E0> > <class 'QuantLib.QuantLib.MidPointCdsEngine'> > > > > Not sure if there is something that I am doing wrong or there is a bug… > > > > Code below…. > > > > import QuantLib as ql > > > > def convert_spreads( upfront, running_spread, recovery_rate, > notional, maturity_date, today=None, coupon_frequency=4, > day_count=ql.Thirty360(), calendar=ql.TARGET(),): > > > > flat_ts = ql.FlatForward(today, 0.0, day_count, ql.Compounded, ql. > Annual) > > yield_curve_handle = ql.YieldTermStructureHandle(flat_ts) > > > > upfront_quote = ql.QuoteHandle(ql.SimpleQuote(upfront)) > > running_spread_quote =running_spread# > ql.QuoteHandle(ql.SimpleQuote(running_spread)) > > > > hazard_rate_structure = upfront_quote > > default_probability_curve = ql.FlatHazardRate(0, calendar, > hazard_rate_structure, day_count) > > MidpointEngine = ql.MidPointCdsEngine( ql. > DefaultProbabilityTermStructureHandle(default_probability_curve), > recovery_rate,yield_curve_handle, ) > > > > settlementDays=2 > > tenor=ql.Period(5,ql.Years) > > frequency= ql.Quarterly > > paymentConvention=ql.Following > > rule=ql.DateGeneration.TwentiethIMM > > dayCounter=ql.Actual365Fixed() > > upfrontSettlementDays=3 > > settlesAccrual =True > > paysAtDefaultTime=True > > startDate=today > > lastPeriodDayCounter=ql.Actual365Fixed() > > rebatesAccrual=True > > model=MidpointEngine > > > > print( > '=============================================================================================================================' > ) > > print('upfront_quote',upfront_quote,type(upfront_quote)) > # const Handle< Quote > & upfront, > > print('upfront',upfront,type(upfront)) > # Rate runningSpread > > print('running_spread_quote',running_spread_quote,type( > running_spread_quote)) # Rate runningSpread, > > print('tenor',tenor,type(tenor)) > # const Period & tenor, > > print('settlementDays',settlementDays,type(settlementDays)) > # Integer settlementDays, > > print('calendar',calendar,type(calendar)) > # const Calendar & calendar, > > print('frequency',frequency,type(frequency)) > # Frequency frequency, > > print('paymentConvention',paymentConvention,type(paymentConvention)) > # BusinessDayConvention paymentConvention, > > print('rule',rule,type(rule)) > # DateGeneration::Rule rule, > > print('dayCounter',dayCounter,type(dayCounter)) > # const DayCounter & dayCounter, > > print('recovery_rate',recovery_rate,type(recovery_rate)) > # Real recoveryRate, > > print('yield_curve_handle',yield_curve_handle,type(yield_curve_handle)) > # const Handle< YieldTermStructure > & > discountCurve, > > print('upfrontSettlementDays',upfrontSettlementDays,type( > upfrontSettlementDays)) # Natural upfrontSettlementDays > = 3, > > print('settlesAccrual',settlesAccrual,type(settlesAccrual)) > # bool settlesAccrual = true, > > print('paysAtDefaultTime',paysAtDefaultTime,type(paysAtDefaultTime)) > # bool paysAtDefaultTime = true, > > print('startDate',startDate,type(startDate)) > # const Date & startDate = Date(), > > print('lastPeriodDayCounter',lastPeriodDayCounter,type( > lastPeriodDayCounter)) # const DayCounter & > lastPeriodDayCounter = DayCounter(), > > print('rebatesAccrual',rebatesAccrual,type(rebatesAccrual)) > # bool rebatesAccrual = true, > > print('model',model,type(model)) > # CreditDefaultSwap::PricingModel model = > CreditDefaultSwap::Midpoint > > print( > '=============================================================================================================================' > ) > > > > helper = ql.UpfrontCdsHelper( > > upfront, # Rate > runningSpread / const Handle< Quote > & upfront, > > running_spread_quote, # Rate > runningSpread, > > tenor, # const Period & > tenor, > > settlementDays, # Integer > settlementDays, > > calendar, # const Calendar > & calendar, > > frequency, # Frequency > frequency, > > paymentConvention, # > BusinessDayConvention paymentConvention, > > rule, # > DateGeneration::Rule rule, > > dayCounter, # const > DayCounter & dayCounter, > > recovery_rate, # Real > recoveryRate, > > yield_curve_handle, # const Handle< > YieldTermStructure > & discountCurve, > > upfrontSettlementDays, # Natural > upfrontSettlementDays = 3, > > settlesAccrual, # bool > settlesAccrual = true, > > paysAtDefaultTime, # bool > paysAtDefaultTime = true, > > startDate, # const Date & > startDate = Date(), > > lastPeriodDayCounter, # const > DayCounter & lastPeriodDayCounter = DayCounter(), > > rebatesAccrual, # bool > rebatesAccrual = true, > > # model, # > CreditDefaultSwap::PricingModel model = CreditDefaultSwap::Midpoint > > ) > > > > fair_running_spread = helper.impliedQuote() > > > > return fair_running_spread > > > > if __name__ == "__main__": > > upfront = 0.01 > > running_spread = 0.012 > > recovery_rate = 0.4 > > notional = 1e7 > > maturity_date = ql.Date(20,12,2028) > > > > today = ql.Date(3,4,2023) > > ql.Settings.instance().setEvaluationDate(today) > > fair_upfront, fair_running_spread = convert_spreads(upfront, > running_spread, recovery_rate, notional, maturity_date, today ) > > > > print(f"Fair Running Spread: {fair_running_spread:.4f}") > > > > > > > > > > > > *From:* Luigi Ballabio <lui...@gm...> > *Sent:* Monday, April 3, 2023 6:04 PM > *To:* Ben Watson <ben...@ma...> > *Cc:* QuantLib Users <qua...@li...> > *Subject:* Re: CDS quoted spread v Running/par spread calculator > > > > Hello Ben, > > you can use the UpfrontCdsHelper class instead. It allows you to > specify both the spread and the quoted upfront. > > > > Best, > > Luigi > > > > > > On Mon, Apr 3, 2023, 06:44 Ben Watson <ben...@ma...> > wrote: > > Just trying to get a bit of guidance on this. > > > > The documentation talks about running spread – which would be the case when coupon=spread. This is not quoted in the market as they quote 100 or 500 coupon. > > ql.*SpreadCdsHelper*( runningSpread, tenor, settlementDays, calendar, frequency, paymentConvention, rule, dayCounter, recoveryRate, yts) > > > > Example in Git hub ( > https://github.com/lballabio/QuantLib-SWIG/blob/master/Python/examples/cds.py) > talks about quoted spread which would in the market come to mean a fixed > coupon. The CDS helper however does not have a coupon. > > > > quoted_spreads = [0.0150, 0.0150, 0.0150, 0.0150] > > tenors = [ql.Period(3, ql.Months), ql.Period(6, ql.Months), ql.Period(1, > ql.Years), ql.Period(2, ql.Years)] > > maturities = [calendar.adjust(todaysDate + x, ql.Following) for x in > tenors] > > > > instruments = [ ql.SpreadCdsHelper( > ql.QuoteHandle(ql.SimpleQuote(s)), tenor, 0, > calendar, ql.Quarterly, ql.Following, > l.DateGeneration.TwentiethIMM, ql.Actual365Fixed(), > recovery_rate, risk_free_rate, ) > > > > So not so clear, but it looks like it is running spread > > > > In light of this is there any function that converts the market quote > (with 100 or 500 coupon) to the running spread that I can use to bootstrap > a CDS curve? > > > > Regards > > > > Ben > > > > > > > > > > > > *From:* Ben Watson <ben...@ma...> > *Sent:* Thursday, March 30, 2023 10:54 AM > *To:* 'QuantLib Users' <qua...@li...>; 'Luigi > Ballabio' <lui...@gm...> > *Subject:* CDS quoted spread v Running/par spread calculator > > > > Hi, > > > > Noticed that the CDS curve builder uses the running spread to boot strap > the curve. However the quotes I am working with is basis 100 or 500 coupon > with an up front. Does Quantlib have a spread converter to change the > quoted spreads to the running spreads? > > > > Ben > > _______________________________________________ > QuantLib-users mailing list > Qua...@li... > https://lists.sourceforge.net/lists/listinfo/quantlib-users > |
|
From: Ben W. <ben...@ma...> - 2023-04-04 03:56:37
|
Thank you Luigi,
Thank you for this – looks promising, but not a lot doco on UpfrontCdsHelper to work with. But I have put together a function to test this out. The code also print the all the types of the inputs to the UpfrontCdsHelper to make sure I am passing the correct types.
I got ‘kind of’ close to get it working, but….
If I leave the model (being the MidpointEngine) out of the UpfrontCdsHelper caller function, it throws no error, except that I get the following error when calling impliedQuote
return _QuantLib.DefaultProbabilityHelper_impliedQuote(self)
RuntimeError: Boost assertion failed: px != 0
If I include the MidpointEngine I get the following error
TypeError: Wrong number or type of arguments for overloaded function 'new_UpfrontCdsHelper'.
Possible C/C++ prototypes are:….
…
…
UpfrontCdsHelper::UpfrontCdsHelper(Rate,Rate,Period const &,Integer,Calendar const &,Frequency,BusinessDayConvention,DateGeneration::Rule,DayCounter const &,Real,Handle< YieldTermStructure > const &,Natural,bool,bool,Date const &,DayCounter const &,bool,CreditDefaultSwap::PricingModel)
….
….
The type of the is …. model <QuantLib.QuantLib.MidPointCdsEngine; proxy of <Swig Object of type 'ext::shared_ptr< MidPointCdsEngine > *' at 0x000001150752E4E0> > <class 'QuantLib.QuantLib.MidPointCdsEngine'>
Not sure if there is something that I am doing wrong or there is a bug…
Code below….
import QuantLib as ql
def convert_spreads( upfront, running_spread, recovery_rate, notional, maturity_date, today=None, coupon_frequency=4, day_count=ql.Thirty360(), calendar=ql.TARGET(),):
flat_ts = ql.FlatForward(today, 0.0, day_count, ql.Compounded, ql.Annual)
yield_curve_handle = ql.YieldTermStructureHandle(flat_ts)
upfront_quote = ql.QuoteHandle(ql.SimpleQuote(upfront))
running_spread_quote =running_spread# ql.QuoteHandle(ql.SimpleQuote(running_spread))
hazard_rate_structure = upfront_quote
default_probability_curve = ql.FlatHazardRate(0, calendar, hazard_rate_structure, day_count)
MidpointEngine = ql.MidPointCdsEngine( ql.DefaultProbabilityTermStructureHandle(default_probability_curve),recovery_rate,yield_curve_handle, )
settlementDays=2
tenor=ql.Period(5,ql.Years)
frequency= ql.Quarterly
paymentConvention=ql.Following
rule=ql.DateGeneration.TwentiethIMM
dayCounter=ql.Actual365Fixed()
upfrontSettlementDays=3
settlesAccrual =True
paysAtDefaultTime=True
startDate=today
lastPeriodDayCounter=ql.Actual365Fixed()
rebatesAccrual=True
model=MidpointEngine
print('=============================================================================================================================')
print('upfront_quote',upfront_quote,type(upfront_quote)) # const Handle< Quote > & upfront,
print('upfront',upfront,type(upfront)) # Rate runningSpread
print('running_spread_quote',running_spread_quote,type(running_spread_quote)) # Rate runningSpread,
print('tenor',tenor,type(tenor)) # const Period & tenor,
print('settlementDays',settlementDays,type(settlementDays)) # Integer settlementDays,
print('calendar',calendar,type(calendar)) # const Calendar & calendar,
print('frequency',frequency,type(frequency)) # Frequency frequency,
print('paymentConvention',paymentConvention,type(paymentConvention)) # BusinessDayConvention paymentConvention,
print('rule',rule,type(rule)) # DateGeneration::Rule rule,
print('dayCounter',dayCounter,type(dayCounter)) # const DayCounter & dayCounter,
print('recovery_rate',recovery_rate,type(recovery_rate)) # Real recoveryRate,
print('yield_curve_handle',yield_curve_handle,type(yield_curve_handle)) # const Handle< YieldTermStructure > & discountCurve,
print('upfrontSettlementDays',upfrontSettlementDays,type(upfrontSettlementDays)) # Natural upfrontSettlementDays = 3,
print('settlesAccrual',settlesAccrual,type(settlesAccrual)) # bool settlesAccrual = true,
print('paysAtDefaultTime',paysAtDefaultTime,type(paysAtDefaultTime)) # bool paysAtDefaultTime = true,
print('startDate',startDate,type(startDate)) # const Date & startDate = Date(),
print('lastPeriodDayCounter',lastPeriodDayCounter,type(lastPeriodDayCounter)) # const DayCounter & lastPeriodDayCounter = DayCounter(),
print('rebatesAccrual',rebatesAccrual,type(rebatesAccrual)) # bool rebatesAccrual = true,
print('model',model,type(model)) # CreditDefaultSwap::PricingModel model = CreditDefaultSwap::Midpoint
print('=============================================================================================================================')
helper = ql.UpfrontCdsHelper(
upfront, # Rate runningSpread / const Handle< Quote > & upfront,
running_spread_quote, # Rate runningSpread,
tenor, # const Period & tenor,
settlementDays, # Integer settlementDays,
calendar, # const Calendar & calendar,
frequency, # Frequency frequency,
paymentConvention, # BusinessDayConvention paymentConvention,
rule, # DateGeneration::Rule rule,
dayCounter, # const DayCounter & dayCounter,
recovery_rate, # Real recoveryRate,
yield_curve_handle, # const Handle< YieldTermStructure > & discountCurve,
upfrontSettlementDays, # Natural upfrontSettlementDays = 3,
settlesAccrual, # bool settlesAccrual = true,
paysAtDefaultTime, # bool paysAtDefaultTime = true,
startDate, # const Date & startDate = Date(),
lastPeriodDayCounter, # const DayCounter & lastPeriodDayCounter = DayCounter(),
rebatesAccrual, # bool rebatesAccrual = true,
# model, # CreditDefaultSwap::PricingModel model = CreditDefaultSwap::Midpoint
)
fair_running_spread = helper.impliedQuote()
return fair_running_spread
if __name__ == "__main__":
upfront = 0.01
running_spread = 0.012
recovery_rate = 0.4
notional = 1e7
maturity_date = ql.Date(20,12,2028)
today = ql.Date(3,4,2023)
ql.Settings.instance().setEvaluationDate(today)
fair_upfront, fair_running_spread = convert_spreads(upfront, running_spread, recovery_rate, notional, maturity_date, today )
print(f"Fair Running Spread: {fair_running_spread:.4f}")
From: Luigi Ballabio <lui...@gm...>
Sent: Monday, April 3, 2023 6:04 PM
To: Ben Watson <ben...@ma...>
Cc: QuantLib Users <qua...@li...>
Subject: Re: CDS quoted spread v Running/par spread calculator
Hello Ben,
you can use the UpfrontCdsHelper class instead. It allows you to specify both the spread and the quoted upfront.
Best,
Luigi
On Mon, Apr 3, 2023, 06:44 Ben Watson <ben...@ma... <mailto:ben...@ma...> > wrote:
Just trying to get a bit of guidance on this.
The documentation talks about running spread – which would be the case when coupon=spread. This is not quoted in the market as they quote 100 or 500 coupon.
ql.SpreadCdsHelper( runningSpread, tenor, settlementDays, calendar, frequency, paymentConvention, rule, dayCounter, recoveryRate, yts)
Example in Git hub (https://github.com/lballabio/QuantLib-SWIG/blob/master/Python/examples/cds.py) talks about quoted spread which would in the market come to mean a fixed coupon. The CDS helper however does not have a coupon.
quoted_spreads = [0.0150, 0.0150, 0.0150, 0.0150]
tenors = [ql.Period(3, ql.Months), ql.Period(6, ql.Months), ql.Period(1, ql.Years), ql.Period(2, ql.Years)]
maturities = [calendar.adjust(todaysDate + x, ql.Following) for x in tenors]
instruments = [ ql.SpreadCdsHelper( ql.QuoteHandle(ql.SimpleQuote(s)), tenor, 0, calendar, ql.Quarterly, ql.Following, l.DateGeneration.TwentiethIMM, ql.Actual365Fixed(), recovery_rate, risk_free_rate, )
So not so clear, but it looks like it is running spread
In light of this is there any function that converts the market quote (with 100 or 500 coupon) to the running spread that I can use to bootstrap a CDS curve?
Regards
Ben
From: Ben Watson <ben...@ma... <mailto:ben...@ma...> >
Sent: Thursday, March 30, 2023 10:54 AM
To: 'QuantLib Users' <qua...@li... <mailto:qua...@li...> >; 'Luigi Ballabio' <lui...@gm... <mailto:lui...@gm...> >
Subject: CDS quoted spread v Running/par spread calculator
Hi,
Noticed that the CDS curve builder uses the running spread to boot strap the curve. However the quotes I am working with is basis 100 or 500 coupon with an up front. Does Quantlib have a spread converter to change the quoted spreads to the running spreads?
Ben
|
|
From: Luigi B. <lui...@gm...> - 2023-04-03 08:04:42
|
Hello Ben,
you can use the UpfrontCdsHelper class instead. It allows you to
specify both the spread and the quoted upfront.
Best,
Luigi
On Mon, Apr 3, 2023, 06:44 Ben Watson <ben...@ma...>
wrote:
> Just trying to get a bit of guidance on this.
>
>
>
> The documentation talks about running spread – which would be the case when coupon=spread. This is not quoted in the market as they quote 100 or 500 coupon.
>
> ql.*SpreadCdsHelper*( runningSpread, tenor, settlementDays, calendar, frequency, paymentConvention, rule, dayCounter, recoveryRate, yts)
>
>
>
> Example in Git hub (
> https://github.com/lballabio/QuantLib-SWIG/blob/master/Python/examples/cds.py)
> talks about quoted spread which would in the market come to mean a fixed
> coupon. The CDS helper however does not have a coupon.
>
>
>
> quoted_spreads = [0.0150, 0.0150, 0.0150, 0.0150]
>
> tenors = [ql.Period(3, ql.Months), ql.Period(6, ql.Months), ql.Period(1,
> ql.Years), ql.Period(2, ql.Years)]
>
> maturities = [calendar.adjust(todaysDate + x, ql.Following) for x in
> tenors]
>
>
>
> instruments = [ ql.SpreadCdsHelper(
> ql.QuoteHandle(ql.SimpleQuote(s)), tenor, 0,
> calendar, ql.Quarterly, ql.Following,
> l.DateGeneration.TwentiethIMM, ql.Actual365Fixed(),
> recovery_rate, risk_free_rate, )
>
>
>
> So not so clear, but it looks like it is running spread
>
>
>
> In light of this is there any function that converts the market quote
> (with 100 or 500 coupon) to the running spread that I can use to bootstrap
> a CDS curve?
>
>
>
> Regards
>
>
>
> Ben
>
>
>
>
>
>
>
>
>
>
>
> *From:* Ben Watson <ben...@ma...>
> *Sent:* Thursday, March 30, 2023 10:54 AM
> *To:* 'QuantLib Users' <qua...@li...>; 'Luigi
> Ballabio' <lui...@gm...>
> *Subject:* CDS quoted spread v Running/par spread calculator
>
>
>
> Hi,
>
>
>
> Noticed that the CDS curve builder uses the running spread to boot strap
> the curve. However the quotes I am working with is basis 100 or 500 coupon
> with an up front. Does Quantlib have a spread converter to change the
> quoted spreads to the running spreads?
>
>
>
> Ben
>
>
|
|
From: Ben W. <ben...@ma...> - 2023-04-03 05:08:09
|
Just trying to get a bit of guidance on this. The documentation talks about running spread – which would be the case when coupon=spread. This is not quoted in the market as they quote 100 or 500 coupon. ql.SpreadCdsHelper( runningSpread, tenor, settlementDays, calendar, frequency, paymentConvention, rule, dayCounter, recoveryRate, yts) Example in Git hub (https://github.com/lballabio/QuantLib-SWIG/blob/master/Python/examples/cds.py) talks about quoted spread which would in the market come to mean a fixed coupon. The CDS helper however does not have a coupon. quoted_spreads = [0.0150, 0.0150, 0.0150, 0.0150] tenors = [ql.Period(3, ql.Months), ql.Period(6, ql.Months), ql.Period(1, ql.Years), ql.Period(2, ql.Years)] maturities = [calendar.adjust(todaysDate + x, ql.Following) for x in tenors] instruments = [ ql.SpreadCdsHelper( ql.QuoteHandle(ql.SimpleQuote(s)), tenor, 0, calendar, ql.Quarterly, ql.Following, l.DateGeneration.TwentiethIMM, ql.Actual365Fixed(), recovery_rate, risk_free_rate, ) So not so clear, but it looks like it is running spread In light of this is there any function that converts the market quote (with 100 or 500 coupon) to the running spread that I can use to bootstrap a CDS curve? Regards Ben From: Ben Watson <ben...@ma...> Sent: Thursday, March 30, 2023 10:54 AM To: 'QuantLib Users' <qua...@li...>; 'Luigi Ballabio' <lui...@gm...> Subject: CDS quoted spread v Running/par spread calculator Hi, Noticed that the CDS curve builder uses the running spread to boot strap the curve. However the quotes I am working with is basis 100 or 500 coupon with an up front. Does Quantlib have a spread converter to change the quoted spreads to the running spreads? Ben |
|
From: Peter C. <pca...@gm...> - 2023-03-30 08:52:05
|
Quick question on this: I am looking at this code
// The last fixing is not used for its full
period (the date is between its
// start and end date). We can use the
telescopic formula until the previous
// date, then we'll add the missing bit.
const DiscountFactor endDiscount =
curve->discount(valueDates[n-1]);
compoundFactor *= startDiscount / endDiscount;
Rate fixing = index->fixing(fixingDates[n-1]);
Time span =
index->dayCounter().yearFraction(valueDates[n-1], date);
compoundFactor *= (1.0 + fixing * span);
and I am wondering why we don't just do
const DiscountFactor endDiscount =
curve->discount(date);
compoundFactor *= startDiscount / endDiscount;
instead, i.e. what is the benefit of separating out the last fixing
and compute its contribution exactly while we use the telescopic
approximation for all previous fixings anyway?
Thanks
Peter
On Tue, 28 Mar 2023 at 16:11, Luigi Ballabio <lui...@gm...> wrote:
>
> Hello,
> no, unfortunately rate cutoff is not implemented yet. I think it's for coupons that end on a holiday, but I don't know if that's an ISDA rule.
>
> Luigi
>
> On Mon, Jan 30, 2023 at 1:16 PM Ioannis Rigopoulos <qua...@de...> wrote:
>>
>> Hi Tom,
>>
>> It is a financial feature part of the OIS term sheet and called "Rate
>> Cutoff". I have written about this at
>> https://www.deriscope.com/products/Key_OI_Term_Rate__Rate_Cutoff.html
>>
>> Regards,
>>
>> Ioannis
>>
>> On 1/30/2023 12:38 PM, Tom Anderson wrote:
>> > Hello,
>> >
>> > I have a rather basic question.
>> > OvernightIndexedCouponPricer::averageRate has a special case for when
>> > "the last fixing is not used for its full period":
>> >
>> > https://github.com/lballabio/QuantLib/blob/38bf3fa4a728d82a9975b2ae5fb86eee0433f3ce/ql/cashflows/overnightindexedcoupon.cpp#L107
>> >
>> >
>> > Is this for when the coupon ends on a day that is not a business day?
>> > Looking at how the list of dates is put together (in the telescopic
>> > case), that seems to be the only reason the last date would not be the
>> > end of the accrual period:
>> >
>> > https://github.com/lballabio/QuantLib/blob/38bf3fa4a728d82a9975b2ae5fb86eee0433f3ce/ql/cashflows/overnightindexedcoupon.cpp#L188
>> >
>> >
>> > If so, out of interest, does this ultimately flow from ISDA rules for
>> > OISs, or is this just financial common sense?
>> >
>> > Thanks,
>> > tom
>> >
>>
>> --
>> Diese E-Mail wurde von Avast-Antivirussoftware auf Viren geprüft.
>> www.avast.com
>>
>>
>> _______________________________________________
>> QuantLib-users mailing list
>> Qua...@li...
>> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>
> _______________________________________________
> QuantLib-users mailing list
> Qua...@li...
> https://lists.sourceforge.net/lists/listinfo/quantlib-users
|
|
From: Ben W. <ben...@ma...> - 2023-03-30 00:20:16
|
Hi, Noticed that the CDS curve builder uses the running spread to boot strap the curve. However the quotes I am working with is basis 100 or 500 coupon with an up front. Does Quantlib have a spread converter to change the quoted spreads to the running spreads? Ben |
|
From: Luigi B. <lui...@gm...> - 2023-03-28 14:09:58
|
Hello,
no, unfortunately rate cutoff is not implemented yet. I think it's for
coupons that end on a holiday, but I don't know if that's an ISDA rule.
Luigi
On Mon, Jan 30, 2023 at 1:16 PM Ioannis Rigopoulos <qua...@de...>
wrote:
> Hi Tom,
>
> It is a financial feature part of the OIS term sheet and called "Rate
> Cutoff". I have written about this at
> https://www.deriscope.com/products/Key_OI_Term_Rate__Rate_Cutoff.html
>
> Regards,
>
> Ioannis
>
> On 1/30/2023 12:38 PM, Tom Anderson wrote:
> > Hello,
> >
> > I have a rather basic question.
> > OvernightIndexedCouponPricer::averageRate has a special case for when
> > "the last fixing is not used for its full period":
> >
> >
> https://github.com/lballabio/QuantLib/blob/38bf3fa4a728d82a9975b2ae5fb86eee0433f3ce/ql/cashflows/overnightindexedcoupon.cpp#L107
> >
> >
> > Is this for when the coupon ends on a day that is not a business day?
> > Looking at how the list of dates is put together (in the telescopic
> > case), that seems to be the only reason the last date would not be the
> > end of the accrual period:
> >
> >
> https://github.com/lballabio/QuantLib/blob/38bf3fa4a728d82a9975b2ae5fb86eee0433f3ce/ql/cashflows/overnightindexedcoupon.cpp#L188
> >
> >
> > If so, out of interest, does this ultimately flow from ISDA rules for
> > OISs, or is this just financial common sense?
> >
> > Thanks,
> > tom
> >
>
> --
> Diese E-Mail wurde von Avast-Antivirussoftware auf Viren geprüft.
> www.avast.com
>
>
> _______________________________________________
> QuantLib-users mailing list
> Qua...@li...
> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>
|
|
From: Serhat G. <ki...@gm...> - 2023-03-26 23:33:12
|
Hi Richard, I am not sure how well-known it is. I used the Python implementation and seems like it does the job. Regards, Serhat On Sun, Mar 26, 2023, 7:00 PM Rick PT <ric...@gm...> wrote: > Thank you Serhat. > Unless I am mistaken, it seems to be super old, is it reliable and > accepted as it among the quant community? > > Le lun. 27 mars 2023 à 00:56, Serhat Güven <ki...@gm...> a écrit : > >> Hi Richard, >> >> You might want to check the ta-lib library (https://www.ta-lib.org/) for >> technical indicators. >> >> Regards, >> Serhat >> >> On Sun, Mar 26, 2023, 3:08 PM Rick PT <ric...@gm...> wrote: >> >>> Good evening, >>> >>> I am new to QuantLib and I was looking for the basic indicators (SMA, >>> RSI, MACD, etc.) but I can't find anything with a simple : grep -riI >>> "MACD" . >>> Are the implementations provided somewhere? >>> >>> Thank you, >>> Richard >>> _______________________________________________ >>> QuantLib-users mailing list >>> Qua...@li... >>> https://lists.sourceforge.net/lists/listinfo/quantlib-users >>> >> |
|
From: Rick PT <ric...@gm...> - 2023-03-26 23:00:45
|
Thank you Serhat. Unless I am mistaken, it seems to be super old, is it reliable and accepted as it among the quant community? Le lun. 27 mars 2023 à 00:56, Serhat Güven <ki...@gm...> a écrit : > Hi Richard, > > You might want to check the ta-lib library (https://www.ta-lib.org/) for > technical indicators. > > Regards, > Serhat > > On Sun, Mar 26, 2023, 3:08 PM Rick PT <ric...@gm...> wrote: > >> Good evening, >> >> I am new to QuantLib and I was looking for the basic indicators (SMA, >> RSI, MACD, etc.) but I can't find anything with a simple : grep -riI >> "MACD" . >> Are the implementations provided somewhere? >> >> Thank you, >> Richard >> _______________________________________________ >> QuantLib-users mailing list >> Qua...@li... >> https://lists.sourceforge.net/lists/listinfo/quantlib-users >> > |
|
From: Serhat G. <ki...@gm...> - 2023-03-26 22:57:07
|
Hi Richard, You might want to check the ta-lib library (https://www.ta-lib.org/) for technical indicators. Regards, Serhat On Sun, Mar 26, 2023, 3:08 PM Rick PT <ric...@gm...> wrote: > Good evening, > > I am new to QuantLib and I was looking for the basic indicators (SMA, RSI, > MACD, etc.) but I can't find anything with a simple : grep -riI "MACD" . > Are the implementations provided somewhere? > > Thank you, > Richard > _______________________________________________ > QuantLib-users mailing list > Qua...@li... > https://lists.sourceforge.net/lists/listinfo/quantlib-users > |