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
(2) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Brian S. <bri...@gm...> - 2021-04-05 10:18:29
|
I see. Thanks for pointing this out.
Coming back to the calculation of 2nd coupon, I did manual calculation
given that in the yield curve construction, I choose continuous
compounding -
(math.sqrt(math.exp(0.05)) - 1)*2 * Actual360().yearFraction(spots[1],
spots[2]) * 100
This gives answer 2.5877678758305054
Whereas, QL gives coupon payment as 2.5884898292778846
So, I dont see any exact match. Is there any definitive reason for
this? Or just due to floating point error?
On Mon, 5 Apr 2021 at 15:32, David Duarte <nh...@gm...> wrote:
>
> Because the fixing date for that coupon is 29.01.2018 and you specified 0 for that fixing...
>
> Try changing this line, and the first coupon will have the rate you input:;
>
> myindex.addFixing(Date(29, 1, 2018), 0.0, True)
>
> On Mon, 5 Apr 2021 at 10:58, Brian Smith <bri...@gm...> wrote:
>>
>> Thanks.
>>
>> But still I dont have any clue what was wrong in below code?
>>
>> [c.amount() for c in FloatingRateBond(0, 100, bond_schedule , myindex,
>> Actual360()).cashflows()]
>>
>> Why am I getting 0 here as first coupon?
>>
>> On Mon, 5 Apr 2021 at 15:11, David Duarte <nh...@gm...> wrote:
>> >
>> > The curve you are building takes continuous rates as inputs and uses linear interpolation of zero yields for non node points.
>> > You could alternatively specify annually compounded rates as inputs.
>> >
>> >
>> > In any case, you can inspect the cashflow details with ql.as_floating_coupon.
>> >
>> > Here is an example:
>> >
>> > bond = FloatingRateBond(0, 100, bond_schedule , myindex, Actual360())
>> > interest_cashflows = [*map(as_floating_rate_coupon, bond.cashflows())][:-1]
>> > rate = interest_cashflows[1].rate()
>> > accrualDays = interest_cashflows[1].accrualDays()
>> >
>> > print("Floating rate:", rate)
>> > print("Cashflow", 100 * rate * accrualDays/360)
>> >
>> >
>> > # Floating rate: 0.050644366225002097
>> > # Cashflow 2.588489829277885
>> >
>> >
>> > On Mon, 5 Apr 2021 at 07:02, Brian Smith <bri...@gm...> wrote:
>> >>
>> >> Thanks again.
>> >>
>> >> Below is my modified code with 0 replaced by a dummy 0.05. But still I
>> >> see 0 for first coupon payment.
>> >>
>> >> from QuantLib import *
>> >>
>> >> mydate = Date(31, 1, 2018)
>> >>
>> >> Settings.instance().evaluationDate = mydate
>> >>
>> >> spots = [mydate, mydate + Period("6m"), mydate + Period("1y"), mydate
>> >> + Period("2y"), mydate + Period("3y")]
>> >> spotsdate = [0.05, 0.05, 0.05, 0.05, 0.05]
>> >>
>> >> curveHandle = YieldTermStructureHandle(ZeroCurve(spots, spotsdate,
>> >> Actual360(), Canada(), Linear(), Continuous))
>> >>
>> >> myindex = Euribor6M(curveHandle)
>> >> myindex.addFixing(Date(29, 1, 2018), 0.00)
>> >>
>> >> bond_schedule = Schedule(mydate, mydate + Period("1y"), Period(6,
>> >> Months), Canada(), Unadjusted, Unadjusted, DateGeneration.Forward,
>> >> False)
>> >>
>> >> [c.amount() for c in FloatingRateBond(0, 100, bond_schedule , myindex,
>> >> Actual360()).cashflows()]
>> >> [c.date() for c in FloatingRateBond(0, 100, bond_schedule , myindex,
>> >> Actual360()).cashflows()]
>> >>
>> >> ### [0.0, 2.5884898292778846, 100.0]
>> >> ### [Date(31,7,2018), Date(31,1,2019), Date(31,1,2019)]
>> >>
>> >> To match the second coupon payment, I used below manual formula to
>> >> convert continuous compounding to semi-annual :
>> >>
>> >> (math.sqrt(math.exp(0.05)) - 1)*2 * Actual360().yearFraction(spots[1],
>> >> spots[2]) * 100
>> >> ### 2.5877678758305054
>> >>
>> >> With this, I got a better match, but still not exact. Should I make
>> >> any other adjustment?
>> >>
>> >> Appreciate your pointer.
>> >>
>> >> Thanks and regards,
>> >>
>> >> On Mon, 5 Apr 2021 at 04:08, Arkadiy Naumov <ark...@gm...> wrote:
>> >> >
>> >> > As far as the first zero - that's your extra fixing contributing. Either set it to 0.05 or create a custom index that does not have 2-days settlement, so you don't even have to worry about it.
>> >> > For the interest being slightly off - 0.05 is continuously compounded (you set your zero curve this way), but the bond resets to "simple" rate (which is higher, so the numbers make sense at least directionally)
>> >> >
>> >> > On Sun, Apr 4, 2021 at 4:09 AM Brian Smith <bri...@gm...> wrote:
>> >> >>
>> >> >> Thanks for your comments.
>> >> >>
>> >> >> But I still failed to understand the coupon payments at various coupon
>> >> >> dates. Below is my full example -
>> >> >>
>> >> >> from QuantLib import *
>> >> >>
>> >> >> mydate = Date(31, 1, 2018)
>> >> >>
>> >> >> Settings.instance().evaluationDate = mydate
>> >> >>
>> >> >> spots = [mydate, mydate + Period("6m"), mydate + Period("1y"), mydate
>> >> >> + Period("2y"), mydate + Period("3y")]
>> >> >> spotsdate = [0, 0.05, 0.05, 0.05, 0.05]
>> >> >>
>> >> >> curveHandle = YieldTermStructureHandle(ZeroCurve(spots, spotsdate,
>> >> >> Actual360(), Canada(), Linear(), Continuous))
>> >> >>
>> >> >> myindex = Euribor6M(curveHandle)
>> >> >> myindex.addFixing(Date(29, 1, 2018), 0.00)
>> >> >>
>> >> >> bond_schedule = Schedule(mydate, mydate + Period("1y"), Period(6,
>> >> >> Months), Canada(), Unadjusted, Unadjusted, DateGeneration.Forward,
>> >> >> False)
>> >> >>
>> >> >> [c.amount() for c in FloatingRateBond(0, 100, bond_schedule , myindex,
>> >> >> Actual360()).cashflows()]
>> >> >> [c.date() for c in FloatingRateBond(0, 100, bond_schedule , myindex,
>> >> >> Actual360()).cashflows()]
>> >> >>
>> >> >> ### [0.0, 2.5884898292778846, 100.0]
>> >> >> ### [Date(31,7,2018), Date(31,1,2019), Date(31,1,2019)]
>> >> >>
>> >> >> So I see on the 1st coupon date, QL is showing coupon payment as 0. Why?
>> >> >> And, on the last coupon date, coupon payment is 2.5884898292778846.
>> >> >> How this number is calculated? If I manually calculate this, I get
>> >> >> just a close match -
>> >> >>
>> >> >> 5 * Actual360().yearFraction(spots[1], spots[2])
>> >> >>
>> >> >> ### 2.5555555555555554
>> >> >>
>> >> >> Am I missing something?
>> >> >>
>> >> >> On Sun, 4 Apr 2021 at 03:27, Arkadiy Naumov <ark...@gm...> wrote:
>> >> >> >
>> >> >> > And as to the zeros - I may be wrong, but try explicitly setting the evaluationDate to whatever date you want to be your spot.
>> >> >> >
>> >> >> > On Sat, Apr 3, 2021 at 5:50 PM Arkadiy Naumov <ark...@gm...> wrote:
>> >> >> >>
>> >> >> >> Hi Brian,
>> >> >> >>
>> >> >> >> Without running your code - the reason Jan29th comes into play is because Euribor6M has a two days settlement built in: https://github.com/lballabio/QuantLib/blob/master/ql/indexes/ibor/eurlibor.cpp#L63
>> >> >> >>
>> >> >> >>
>> >> >> >> On Sat, Apr 3, 2021 at 10:22 AM Brian Smith <bri...@gm...> wrote:
>> >> >> >>>
>> >> >> >>> Hi,
>> >> >> >>>
>> >> >> >>> I found out that I have to add a dummy quote to get this work. So I added -
>> >> >> >>>
>> >> >> >>> myindex = Euribor6M(curveHandle)
>> >> >> >>> myindex.addFixing(Date(27, 7, 2018), 0.00)
>> >> >> >>>
>> >> >> >>> bond_schedule = Schedule(mydate,
>> >> >> >>> mydate + Period("1y"), Period(6, Months), Canada(), Unadjusted,
>> >> >> >>> Unadjusted, DateGeneration.Forward, False)
>> >> >> >>>
>> >> >> >>> [c.amount() for c in FloatingRateBond(0, 10000, bond_schedule ,
>> >> >> >>> myindex, Actual360()).cashflows()]
>> >> >> >>> [c.date() for c in FloatingRateBond(0, 10000, bond_schedule , myindex,
>> >> >> >>> Actual360()).cashflows()]
>> >> >> >>>
>> >> >> >>> However with this, I am getting strange result as all the coupon
>> >> >> >>> payments are coming as zero.
>> >> >> >>>
>> >> >> >>> Can you please help me to understand what went wrong in my code?
>> >> >> >>>
>> >> >> >>>
>> >> >> >>> On Sat, 3 Apr 2021 at 14:39, Brian Smith <bri...@gm...> wrote:
>> >> >> >>> >
>> >> >> >>> > Hi,
>> >> >> >>> >
>> >> >> >>> > I want to extract all the cash flow amounts from a bond as defined below -
>> >> >> >>> >
>> >> >> >>> > from QuantLib import *
>> >> >> >>> >
>> >> >> >>> > mydate = Date(31, 1, 2018)
>> >> >> >>> >
>> >> >> >>> > spots = [mydate, mydate + Period("6m"), mydate + Period("1y"), mydate
>> >> >> >>> > + Period("2y"), mydate + Period("3y")]
>> >> >> >>> > spotsdate = [0, 0.25, 0.45, 0.65, 0.85]
>> >> >> >>> >
>> >> >> >>> > curveHandle = YieldTermStructureHandle(ZeroCurve(spots, spotsdate,
>> >> >> >>> > Actual360(), Canada(), Linear(), Continuous))
>> >> >> >>> >
>> >> >> >>> > [c.amount() for c in FloatingRateBond(0, 10000, Schedule(mydate,
>> >> >> >>> > mydate + Period("1y"), Period(6, Months), Canada(), Unadjusted,
>> >> >> >>> > Unadjusted, DateGeneration.Forward, False) , Euribor6M(curveHandle),
>> >> >> >>> > Actual360()).cashflows()]
>> >> >> >>> >
>> >> >> >>> > However above code failed to achieve any result, but giving out below error -
>> >> >> >>> >
>> >> >> >>> > Traceback (most recent call last):File "<stdin>", line 1, in
>> >> >> >>> > <module>File "<stdin>", line 1, in <listcomp>File
>> >> >> >>> > "/usr/local/lib/python3.9/site-packages/QuantLib/QuantLib.py", line
>> >> >> >>> > 9967, in amountreturn _QuantLib.CashFlow_amount(self)RuntimeError:
>> >> >> >>> > Missing Euribor6M Actual/360 fixing for January 29th, 2018
>> >> >> >>> >
>> >> >> >>> > I wonder where the date January 29th, 2018 comes from and how to resolve this?
>> >> >> >>> >
>> >> >> >>> > Any pointer will be highly appreciated.
>> >> >> >>> >
>> >> >> >>> > Thanks for your time.
>> >> >> >>>
>> >> >> >>>
>> >> >> >>> _______________________________________________
>> >> >> >>> 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: David D. <nh...@gm...> - 2021-04-05 10:02:43
|
Because the fixing date for that coupon is 29.01.2018 and you specified 0
for that fixing...
Try changing this line, and the first coupon will have the rate you input:;
myindex.addFixing(Date(29, 1, 2018), 0.0, True)
On Mon, 5 Apr 2021 at 10:58, Brian Smith <bri...@gm...> wrote:
> Thanks.
>
> But still I dont have any clue what was wrong in below code?
>
> [c.amount() for c in FloatingRateBond(0, 100, bond_schedule , myindex,
> Actual360()).cashflows()]
>
> Why am I getting 0 here as first coupon?
>
> On Mon, 5 Apr 2021 at 15:11, David Duarte <nh...@gm...> wrote:
> >
> > The curve you are building takes continuous rates as inputs and uses
> linear interpolation of zero yields for non node points.
> > You could alternatively specify annually compounded rates as inputs.
> >
> >
> > In any case, you can inspect the cashflow details with
> ql.as_floating_coupon.
> >
> > Here is an example:
> >
> > bond = FloatingRateBond(0, 100, bond_schedule , myindex, Actual360())
> > interest_cashflows = [*map(as_floating_rate_coupon,
> bond.cashflows())][:-1]
> > rate = interest_cashflows[1].rate()
> > accrualDays = interest_cashflows[1].accrualDays()
> >
> > print("Floating rate:", rate)
> > print("Cashflow", 100 * rate * accrualDays/360)
> >
> >
> > # Floating rate: 0.050644366225002097
> > # Cashflow 2.588489829277885
> >
> >
> > On Mon, 5 Apr 2021 at 07:02, Brian Smith <bri...@gm...>
> wrote:
> >>
> >> Thanks again.
> >>
> >> Below is my modified code with 0 replaced by a dummy 0.05. But still I
> >> see 0 for first coupon payment.
> >>
> >> from QuantLib import *
> >>
> >> mydate = Date(31, 1, 2018)
> >>
> >> Settings.instance().evaluationDate = mydate
> >>
> >> spots = [mydate, mydate + Period("6m"), mydate + Period("1y"), mydate
> >> + Period("2y"), mydate + Period("3y")]
> >> spotsdate = [0.05, 0.05, 0.05, 0.05, 0.05]
> >>
> >> curveHandle = YieldTermStructureHandle(ZeroCurve(spots, spotsdate,
> >> Actual360(), Canada(), Linear(), Continuous))
> >>
> >> myindex = Euribor6M(curveHandle)
> >> myindex.addFixing(Date(29, 1, 2018), 0.00)
> >>
> >> bond_schedule = Schedule(mydate, mydate + Period("1y"), Period(6,
> >> Months), Canada(), Unadjusted, Unadjusted, DateGeneration.Forward,
> >> False)
> >>
> >> [c.amount() for c in FloatingRateBond(0, 100, bond_schedule , myindex,
> >> Actual360()).cashflows()]
> >> [c.date() for c in FloatingRateBond(0, 100, bond_schedule , myindex,
> >> Actual360()).cashflows()]
> >>
> >> ### [0.0, 2.5884898292778846, 100.0]
> >> ### [Date(31,7,2018), Date(31,1,2019), Date(31,1,2019)]
> >>
> >> To match the second coupon payment, I used below manual formula to
> >> convert continuous compounding to semi-annual :
> >>
> >> (math.sqrt(math.exp(0.05)) - 1)*2 * Actual360().yearFraction(spots[1],
> >> spots[2]) * 100
> >> ### 2.5877678758305054
> >>
> >> With this, I got a better match, but still not exact. Should I make
> >> any other adjustment?
> >>
> >> Appreciate your pointer.
> >>
> >> Thanks and regards,
> >>
> >> On Mon, 5 Apr 2021 at 04:08, Arkadiy Naumov <ark...@gm...>
> wrote:
> >> >
> >> > As far as the first zero - that's your extra fixing contributing.
> Either set it to 0.05 or create a custom index that does not have 2-days
> settlement, so you don't even have to worry about it.
> >> > For the interest being slightly off - 0.05 is continuously compounded
> (you set your zero curve this way), but the bond resets to "simple" rate
> (which is higher, so the numbers make sense at least directionally)
> >> >
> >> > On Sun, Apr 4, 2021 at 4:09 AM Brian Smith <
> bri...@gm...> wrote:
> >> >>
> >> >> Thanks for your comments.
> >> >>
> >> >> But I still failed to understand the coupon payments at various
> coupon
> >> >> dates. Below is my full example -
> >> >>
> >> >> from QuantLib import *
> >> >>
> >> >> mydate = Date(31, 1, 2018)
> >> >>
> >> >> Settings.instance().evaluationDate = mydate
> >> >>
> >> >> spots = [mydate, mydate + Period("6m"), mydate + Period("1y"), mydate
> >> >> + Period("2y"), mydate + Period("3y")]
> >> >> spotsdate = [0, 0.05, 0.05, 0.05, 0.05]
> >> >>
> >> >> curveHandle = YieldTermStructureHandle(ZeroCurve(spots, spotsdate,
> >> >> Actual360(), Canada(), Linear(), Continuous))
> >> >>
> >> >> myindex = Euribor6M(curveHandle)
> >> >> myindex.addFixing(Date(29, 1, 2018), 0.00)
> >> >>
> >> >> bond_schedule = Schedule(mydate, mydate + Period("1y"), Period(6,
> >> >> Months), Canada(), Unadjusted, Unadjusted, DateGeneration.Forward,
> >> >> False)
> >> >>
> >> >> [c.amount() for c in FloatingRateBond(0, 100, bond_schedule ,
> myindex,
> >> >> Actual360()).cashflows()]
> >> >> [c.date() for c in FloatingRateBond(0, 100, bond_schedule ,
> myindex,
> >> >> Actual360()).cashflows()]
> >> >>
> >> >> ### [0.0, 2.5884898292778846, 100.0]
> >> >> ### [Date(31,7,2018), Date(31,1,2019), Date(31,1,2019)]
> >> >>
> >> >> So I see on the 1st coupon date, QL is showing coupon payment as 0.
> Why?
> >> >> And, on the last coupon date, coupon payment is 2.5884898292778846.
> >> >> How this number is calculated? If I manually calculate this, I get
> >> >> just a close match -
> >> >>
> >> >> 5 * Actual360().yearFraction(spots[1], spots[2])
> >> >>
> >> >> ### 2.5555555555555554
> >> >>
> >> >> Am I missing something?
> >> >>
> >> >> On Sun, 4 Apr 2021 at 03:27, Arkadiy Naumov <
> ark...@gm...> wrote:
> >> >> >
> >> >> > And as to the zeros - I may be wrong, but try explicitly setting
> the evaluationDate to whatever date you want to be your spot.
> >> >> >
> >> >> > On Sat, Apr 3, 2021 at 5:50 PM Arkadiy Naumov <
> ark...@gm...> wrote:
> >> >> >>
> >> >> >> Hi Brian,
> >> >> >>
> >> >> >> Without running your code - the reason Jan29th comes into play is
> because Euribor6M has a two days settlement built in:
> https://github.com/lballabio/QuantLib/blob/master/ql/indexes/ibor/eurlibor.cpp#L63
> >> >> >>
> >> >> >>
> >> >> >> On Sat, Apr 3, 2021 at 10:22 AM Brian Smith <
> bri...@gm...> wrote:
> >> >> >>>
> >> >> >>> Hi,
> >> >> >>>
> >> >> >>> I found out that I have to add a dummy quote to get this work.
> So I added -
> >> >> >>>
> >> >> >>> myindex = Euribor6M(curveHandle)
> >> >> >>> myindex.addFixing(Date(27, 7, 2018), 0.00)
> >> >> >>>
> >> >> >>> bond_schedule = Schedule(mydate,
> >> >> >>> mydate + Period("1y"), Period(6, Months), Canada(), Unadjusted,
> >> >> >>> Unadjusted, DateGeneration.Forward, False)
> >> >> >>>
> >> >> >>> [c.amount() for c in FloatingRateBond(0, 10000, bond_schedule ,
> >> >> >>> myindex, Actual360()).cashflows()]
> >> >> >>> [c.date() for c in FloatingRateBond(0, 10000, bond_schedule ,
> myindex,
> >> >> >>> Actual360()).cashflows()]
> >> >> >>>
> >> >> >>> However with this, I am getting strange result as all the coupon
> >> >> >>> payments are coming as zero.
> >> >> >>>
> >> >> >>> Can you please help me to understand what went wrong in my code?
> >> >> >>>
> >> >> >>>
> >> >> >>> On Sat, 3 Apr 2021 at 14:39, Brian Smith <
> bri...@gm...> wrote:
> >> >> >>> >
> >> >> >>> > Hi,
> >> >> >>> >
> >> >> >>> > I want to extract all the cash flow amounts from a bond as
> defined below -
> >> >> >>> >
> >> >> >>> > from QuantLib import *
> >> >> >>> >
> >> >> >>> > mydate = Date(31, 1, 2018)
> >> >> >>> >
> >> >> >>> > spots = [mydate, mydate + Period("6m"), mydate + Period("1y"),
> mydate
> >> >> >>> > + Period("2y"), mydate + Period("3y")]
> >> >> >>> > spotsdate = [0, 0.25, 0.45, 0.65, 0.85]
> >> >> >>> >
> >> >> >>> > curveHandle = YieldTermStructureHandle(ZeroCurve(spots,
> spotsdate,
> >> >> >>> > Actual360(), Canada(), Linear(), Continuous))
> >> >> >>> >
> >> >> >>> > [c.amount() for c in FloatingRateBond(0, 10000,
> Schedule(mydate,
> >> >> >>> > mydate + Period("1y"), Period(6, Months), Canada(), Unadjusted,
> >> >> >>> > Unadjusted, DateGeneration.Forward, False) ,
> Euribor6M(curveHandle),
> >> >> >>> > Actual360()).cashflows()]
> >> >> >>> >
> >> >> >>> > However above code failed to achieve any result, but giving
> out below error -
> >> >> >>> >
> >> >> >>> > Traceback (most recent call last):File "<stdin>", line 1, in
> >> >> >>> > <module>File "<stdin>", line 1, in <listcomp>File
> >> >> >>> > "/usr/local/lib/python3.9/site-packages/QuantLib/QuantLib.py",
> line
> >> >> >>> > 9967, in amountreturn
> _QuantLib.CashFlow_amount(self)RuntimeError:
> >> >> >>> > Missing Euribor6M Actual/360 fixing for January 29th, 2018
> >> >> >>> >
> >> >> >>> > I wonder where the date January 29th, 2018 comes from and how
> to resolve this?
> >> >> >>> >
> >> >> >>> > Any pointer will be highly appreciated.
> >> >> >>> >
> >> >> >>> > Thanks for your time.
> >> >> >>>
> >> >> >>>
> >> >> >>> _______________________________________________
> >> >> >>> 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: Brian S. <bri...@gm...> - 2021-04-05 09:58:52
|
Thanks.
But still I dont have any clue what was wrong in below code?
[c.amount() for c in FloatingRateBond(0, 100, bond_schedule , myindex,
Actual360()).cashflows()]
Why am I getting 0 here as first coupon?
On Mon, 5 Apr 2021 at 15:11, David Duarte <nh...@gm...> wrote:
>
> The curve you are building takes continuous rates as inputs and uses linear interpolation of zero yields for non node points.
> You could alternatively specify annually compounded rates as inputs.
>
>
> In any case, you can inspect the cashflow details with ql.as_floating_coupon.
>
> Here is an example:
>
> bond = FloatingRateBond(0, 100, bond_schedule , myindex, Actual360())
> interest_cashflows = [*map(as_floating_rate_coupon, bond.cashflows())][:-1]
> rate = interest_cashflows[1].rate()
> accrualDays = interest_cashflows[1].accrualDays()
>
> print("Floating rate:", rate)
> print("Cashflow", 100 * rate * accrualDays/360)
>
>
> # Floating rate: 0.050644366225002097
> # Cashflow 2.588489829277885
>
>
> On Mon, 5 Apr 2021 at 07:02, Brian Smith <bri...@gm...> wrote:
>>
>> Thanks again.
>>
>> Below is my modified code with 0 replaced by a dummy 0.05. But still I
>> see 0 for first coupon payment.
>>
>> from QuantLib import *
>>
>> mydate = Date(31, 1, 2018)
>>
>> Settings.instance().evaluationDate = mydate
>>
>> spots = [mydate, mydate + Period("6m"), mydate + Period("1y"), mydate
>> + Period("2y"), mydate + Period("3y")]
>> spotsdate = [0.05, 0.05, 0.05, 0.05, 0.05]
>>
>> curveHandle = YieldTermStructureHandle(ZeroCurve(spots, spotsdate,
>> Actual360(), Canada(), Linear(), Continuous))
>>
>> myindex = Euribor6M(curveHandle)
>> myindex.addFixing(Date(29, 1, 2018), 0.00)
>>
>> bond_schedule = Schedule(mydate, mydate + Period("1y"), Period(6,
>> Months), Canada(), Unadjusted, Unadjusted, DateGeneration.Forward,
>> False)
>>
>> [c.amount() for c in FloatingRateBond(0, 100, bond_schedule , myindex,
>> Actual360()).cashflows()]
>> [c.date() for c in FloatingRateBond(0, 100, bond_schedule , myindex,
>> Actual360()).cashflows()]
>>
>> ### [0.0, 2.5884898292778846, 100.0]
>> ### [Date(31,7,2018), Date(31,1,2019), Date(31,1,2019)]
>>
>> To match the second coupon payment, I used below manual formula to
>> convert continuous compounding to semi-annual :
>>
>> (math.sqrt(math.exp(0.05)) - 1)*2 * Actual360().yearFraction(spots[1],
>> spots[2]) * 100
>> ### 2.5877678758305054
>>
>> With this, I got a better match, but still not exact. Should I make
>> any other adjustment?
>>
>> Appreciate your pointer.
>>
>> Thanks and regards,
>>
>> On Mon, 5 Apr 2021 at 04:08, Arkadiy Naumov <ark...@gm...> wrote:
>> >
>> > As far as the first zero - that's your extra fixing contributing. Either set it to 0.05 or create a custom index that does not have 2-days settlement, so you don't even have to worry about it.
>> > For the interest being slightly off - 0.05 is continuously compounded (you set your zero curve this way), but the bond resets to "simple" rate (which is higher, so the numbers make sense at least directionally)
>> >
>> > On Sun, Apr 4, 2021 at 4:09 AM Brian Smith <bri...@gm...> wrote:
>> >>
>> >> Thanks for your comments.
>> >>
>> >> But I still failed to understand the coupon payments at various coupon
>> >> dates. Below is my full example -
>> >>
>> >> from QuantLib import *
>> >>
>> >> mydate = Date(31, 1, 2018)
>> >>
>> >> Settings.instance().evaluationDate = mydate
>> >>
>> >> spots = [mydate, mydate + Period("6m"), mydate + Period("1y"), mydate
>> >> + Period("2y"), mydate + Period("3y")]
>> >> spotsdate = [0, 0.05, 0.05, 0.05, 0.05]
>> >>
>> >> curveHandle = YieldTermStructureHandle(ZeroCurve(spots, spotsdate,
>> >> Actual360(), Canada(), Linear(), Continuous))
>> >>
>> >> myindex = Euribor6M(curveHandle)
>> >> myindex.addFixing(Date(29, 1, 2018), 0.00)
>> >>
>> >> bond_schedule = Schedule(mydate, mydate + Period("1y"), Period(6,
>> >> Months), Canada(), Unadjusted, Unadjusted, DateGeneration.Forward,
>> >> False)
>> >>
>> >> [c.amount() for c in FloatingRateBond(0, 100, bond_schedule , myindex,
>> >> Actual360()).cashflows()]
>> >> [c.date() for c in FloatingRateBond(0, 100, bond_schedule , myindex,
>> >> Actual360()).cashflows()]
>> >>
>> >> ### [0.0, 2.5884898292778846, 100.0]
>> >> ### [Date(31,7,2018), Date(31,1,2019), Date(31,1,2019)]
>> >>
>> >> So I see on the 1st coupon date, QL is showing coupon payment as 0. Why?
>> >> And, on the last coupon date, coupon payment is 2.5884898292778846.
>> >> How this number is calculated? If I manually calculate this, I get
>> >> just a close match -
>> >>
>> >> 5 * Actual360().yearFraction(spots[1], spots[2])
>> >>
>> >> ### 2.5555555555555554
>> >>
>> >> Am I missing something?
>> >>
>> >> On Sun, 4 Apr 2021 at 03:27, Arkadiy Naumov <ark...@gm...> wrote:
>> >> >
>> >> > And as to the zeros - I may be wrong, but try explicitly setting the evaluationDate to whatever date you want to be your spot.
>> >> >
>> >> > On Sat, Apr 3, 2021 at 5:50 PM Arkadiy Naumov <ark...@gm...> wrote:
>> >> >>
>> >> >> Hi Brian,
>> >> >>
>> >> >> Without running your code - the reason Jan29th comes into play is because Euribor6M has a two days settlement built in: https://github.com/lballabio/QuantLib/blob/master/ql/indexes/ibor/eurlibor.cpp#L63
>> >> >>
>> >> >>
>> >> >> On Sat, Apr 3, 2021 at 10:22 AM Brian Smith <bri...@gm...> wrote:
>> >> >>>
>> >> >>> Hi,
>> >> >>>
>> >> >>> I found out that I have to add a dummy quote to get this work. So I added -
>> >> >>>
>> >> >>> myindex = Euribor6M(curveHandle)
>> >> >>> myindex.addFixing(Date(27, 7, 2018), 0.00)
>> >> >>>
>> >> >>> bond_schedule = Schedule(mydate,
>> >> >>> mydate + Period("1y"), Period(6, Months), Canada(), Unadjusted,
>> >> >>> Unadjusted, DateGeneration.Forward, False)
>> >> >>>
>> >> >>> [c.amount() for c in FloatingRateBond(0, 10000, bond_schedule ,
>> >> >>> myindex, Actual360()).cashflows()]
>> >> >>> [c.date() for c in FloatingRateBond(0, 10000, bond_schedule , myindex,
>> >> >>> Actual360()).cashflows()]
>> >> >>>
>> >> >>> However with this, I am getting strange result as all the coupon
>> >> >>> payments are coming as zero.
>> >> >>>
>> >> >>> Can you please help me to understand what went wrong in my code?
>> >> >>>
>> >> >>>
>> >> >>> On Sat, 3 Apr 2021 at 14:39, Brian Smith <bri...@gm...> wrote:
>> >> >>> >
>> >> >>> > Hi,
>> >> >>> >
>> >> >>> > I want to extract all the cash flow amounts from a bond as defined below -
>> >> >>> >
>> >> >>> > from QuantLib import *
>> >> >>> >
>> >> >>> > mydate = Date(31, 1, 2018)
>> >> >>> >
>> >> >>> > spots = [mydate, mydate + Period("6m"), mydate + Period("1y"), mydate
>> >> >>> > + Period("2y"), mydate + Period("3y")]
>> >> >>> > spotsdate = [0, 0.25, 0.45, 0.65, 0.85]
>> >> >>> >
>> >> >>> > curveHandle = YieldTermStructureHandle(ZeroCurve(spots, spotsdate,
>> >> >>> > Actual360(), Canada(), Linear(), Continuous))
>> >> >>> >
>> >> >>> > [c.amount() for c in FloatingRateBond(0, 10000, Schedule(mydate,
>> >> >>> > mydate + Period("1y"), Period(6, Months), Canada(), Unadjusted,
>> >> >>> > Unadjusted, DateGeneration.Forward, False) , Euribor6M(curveHandle),
>> >> >>> > Actual360()).cashflows()]
>> >> >>> >
>> >> >>> > However above code failed to achieve any result, but giving out below error -
>> >> >>> >
>> >> >>> > Traceback (most recent call last):File "<stdin>", line 1, in
>> >> >>> > <module>File "<stdin>", line 1, in <listcomp>File
>> >> >>> > "/usr/local/lib/python3.9/site-packages/QuantLib/QuantLib.py", line
>> >> >>> > 9967, in amountreturn _QuantLib.CashFlow_amount(self)RuntimeError:
>> >> >>> > Missing Euribor6M Actual/360 fixing for January 29th, 2018
>> >> >>> >
>> >> >>> > I wonder where the date January 29th, 2018 comes from and how to resolve this?
>> >> >>> >
>> >> >>> > Any pointer will be highly appreciated.
>> >> >>> >
>> >> >>> > Thanks for your time.
>> >> >>>
>> >> >>>
>> >> >>> _______________________________________________
>> >> >>> 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: David D. <nh...@gm...> - 2021-04-05 09:41:22
|
The curve you are building takes continuous rates as inputs and uses linear
interpolation of zero yields for non node points.
You could alternatively specify annually compounded rates as inputs.
In any case, you can inspect the cashflow details with
ql.as_floating_coupon.
Here is an example:
bond = FloatingRateBond(0, 100, bond_schedule , myindex, Actual360())
interest_cashflows = [*map(as_floating_rate_coupon, bond.cashflows())][:-1]
rate = interest_cashflows[1].rate()
accrualDays = interest_cashflows[1].accrualDays()
print("Floating rate:", rate)
print("Cashflow", 100 * rate * accrualDays/360)
# Floating rate: 0.050644366225002097
# Cashflow 2.588489829277885
On Mon, 5 Apr 2021 at 07:02, Brian Smith <bri...@gm...> wrote:
> Thanks again.
>
> Below is my modified code with 0 replaced by a dummy 0.05. But still I
> see 0 for first coupon payment.
>
> from QuantLib import *
>
> mydate = Date(31, 1, 2018)
>
> Settings.instance().evaluationDate = mydate
>
> spots = [mydate, mydate + Period("6m"), mydate + Period("1y"), mydate
> + Period("2y"), mydate + Period("3y")]
> spotsdate = [0.05, 0.05, 0.05, 0.05, 0.05]
>
> curveHandle = YieldTermStructureHandle(ZeroCurve(spots, spotsdate,
> Actual360(), Canada(), Linear(), Continuous))
>
> myindex = Euribor6M(curveHandle)
> myindex.addFixing(Date(29, 1, 2018), 0.00)
>
> bond_schedule = Schedule(mydate, mydate + Period("1y"), Period(6,
> Months), Canada(), Unadjusted, Unadjusted, DateGeneration.Forward,
> False)
>
> [c.amount() for c in FloatingRateBond(0, 100, bond_schedule , myindex,
> Actual360()).cashflows()]
> [c.date() for c in FloatingRateBond(0, 100, bond_schedule , myindex,
> Actual360()).cashflows()]
>
> ### [0.0, 2.5884898292778846, 100.0]
> ### [Date(31,7,2018), Date(31,1,2019), Date(31,1,2019)]
>
> To match the second coupon payment, I used below manual formula to
> convert continuous compounding to semi-annual :
>
> (math.sqrt(math.exp(0.05)) - 1)*2 * Actual360().yearFraction(spots[1],
> spots[2]) * 100
> ### 2.5877678758305054
>
> With this, I got a better match, but still not exact. Should I make
> any other adjustment?
>
> Appreciate your pointer.
>
> Thanks and regards,
>
> On Mon, 5 Apr 2021 at 04:08, Arkadiy Naumov <ark...@gm...>
> wrote:
> >
> > As far as the first zero - that's your extra fixing contributing. Either
> set it to 0.05 or create a custom index that does not have 2-days
> settlement, so you don't even have to worry about it.
> > For the interest being slightly off - 0.05 is continuously compounded
> (you set your zero curve this way), but the bond resets to "simple" rate
> (which is higher, so the numbers make sense at least directionally)
> >
> > On Sun, Apr 4, 2021 at 4:09 AM Brian Smith <bri...@gm...>
> wrote:
> >>
> >> Thanks for your comments.
> >>
> >> But I still failed to understand the coupon payments at various coupon
> >> dates. Below is my full example -
> >>
> >> from QuantLib import *
> >>
> >> mydate = Date(31, 1, 2018)
> >>
> >> Settings.instance().evaluationDate = mydate
> >>
> >> spots = [mydate, mydate + Period("6m"), mydate + Period("1y"), mydate
> >> + Period("2y"), mydate + Period("3y")]
> >> spotsdate = [0, 0.05, 0.05, 0.05, 0.05]
> >>
> >> curveHandle = YieldTermStructureHandle(ZeroCurve(spots, spotsdate,
> >> Actual360(), Canada(), Linear(), Continuous))
> >>
> >> myindex = Euribor6M(curveHandle)
> >> myindex.addFixing(Date(29, 1, 2018), 0.00)
> >>
> >> bond_schedule = Schedule(mydate, mydate + Period("1y"), Period(6,
> >> Months), Canada(), Unadjusted, Unadjusted, DateGeneration.Forward,
> >> False)
> >>
> >> [c.amount() for c in FloatingRateBond(0, 100, bond_schedule , myindex,
> >> Actual360()).cashflows()]
> >> [c.date() for c in FloatingRateBond(0, 100, bond_schedule , myindex,
> >> Actual360()).cashflows()]
> >>
> >> ### [0.0, 2.5884898292778846, 100.0]
> >> ### [Date(31,7,2018), Date(31,1,2019), Date(31,1,2019)]
> >>
> >> So I see on the 1st coupon date, QL is showing coupon payment as 0. Why?
> >> And, on the last coupon date, coupon payment is 2.5884898292778846.
> >> How this number is calculated? If I manually calculate this, I get
> >> just a close match -
> >>
> >> 5 * Actual360().yearFraction(spots[1], spots[2])
> >>
> >> ### 2.5555555555555554
> >>
> >> Am I missing something?
> >>
> >> On Sun, 4 Apr 2021 at 03:27, Arkadiy Naumov <ark...@gm...>
> wrote:
> >> >
> >> > And as to the zeros - I may be wrong, but try explicitly setting the
> evaluationDate to whatever date you want to be your spot.
> >> >
> >> > On Sat, Apr 3, 2021 at 5:50 PM Arkadiy Naumov <
> ark...@gm...> wrote:
> >> >>
> >> >> Hi Brian,
> >> >>
> >> >> Without running your code - the reason Jan29th comes into play is
> because Euribor6M has a two days settlement built in:
> https://github.com/lballabio/QuantLib/blob/master/ql/indexes/ibor/eurlibor.cpp#L63
> >> >>
> >> >>
> >> >> On Sat, Apr 3, 2021 at 10:22 AM Brian Smith <
> bri...@gm...> wrote:
> >> >>>
> >> >>> Hi,
> >> >>>
> >> >>> I found out that I have to add a dummy quote to get this work. So I
> added -
> >> >>>
> >> >>> myindex = Euribor6M(curveHandle)
> >> >>> myindex.addFixing(Date(27, 7, 2018), 0.00)
> >> >>>
> >> >>> bond_schedule = Schedule(mydate,
> >> >>> mydate + Period("1y"), Period(6, Months), Canada(), Unadjusted,
> >> >>> Unadjusted, DateGeneration.Forward, False)
> >> >>>
> >> >>> [c.amount() for c in FloatingRateBond(0, 10000, bond_schedule ,
> >> >>> myindex, Actual360()).cashflows()]
> >> >>> [c.date() for c in FloatingRateBond(0, 10000, bond_schedule ,
> myindex,
> >> >>> Actual360()).cashflows()]
> >> >>>
> >> >>> However with this, I am getting strange result as all the coupon
> >> >>> payments are coming as zero.
> >> >>>
> >> >>> Can you please help me to understand what went wrong in my code?
> >> >>>
> >> >>>
> >> >>> On Sat, 3 Apr 2021 at 14:39, Brian Smith <
> bri...@gm...> wrote:
> >> >>> >
> >> >>> > Hi,
> >> >>> >
> >> >>> > I want to extract all the cash flow amounts from a bond as
> defined below -
> >> >>> >
> >> >>> > from QuantLib import *
> >> >>> >
> >> >>> > mydate = Date(31, 1, 2018)
> >> >>> >
> >> >>> > spots = [mydate, mydate + Period("6m"), mydate + Period("1y"),
> mydate
> >> >>> > + Period("2y"), mydate + Period("3y")]
> >> >>> > spotsdate = [0, 0.25, 0.45, 0.65, 0.85]
> >> >>> >
> >> >>> > curveHandle = YieldTermStructureHandle(ZeroCurve(spots, spotsdate,
> >> >>> > Actual360(), Canada(), Linear(), Continuous))
> >> >>> >
> >> >>> > [c.amount() for c in FloatingRateBond(0, 10000, Schedule(mydate,
> >> >>> > mydate + Period("1y"), Period(6, Months), Canada(), Unadjusted,
> >> >>> > Unadjusted, DateGeneration.Forward, False) ,
> Euribor6M(curveHandle),
> >> >>> > Actual360()).cashflows()]
> >> >>> >
> >> >>> > However above code failed to achieve any result, but giving out
> below error -
> >> >>> >
> >> >>> > Traceback (most recent call last):File "<stdin>", line 1, in
> >> >>> > <module>File "<stdin>", line 1, in <listcomp>File
> >> >>> > "/usr/local/lib/python3.9/site-packages/QuantLib/QuantLib.py",
> line
> >> >>> > 9967, in amountreturn _QuantLib.CashFlow_amount(self)RuntimeError:
> >> >>> > Missing Euribor6M Actual/360 fixing for January 29th, 2018
> >> >>> >
> >> >>> > I wonder where the date January 29th, 2018 comes from and how to
> resolve this?
> >> >>> >
> >> >>> > Any pointer will be highly appreciated.
> >> >>> >
> >> >>> > Thanks for your time.
> >> >>>
> >> >>>
> >> >>> _______________________________________________
> >> >>> 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: Torbjörn L. <tor...@li...> - 2021-04-05 06:41:30
|
Mvh
Torbjörn Lindström
Mobile +46 733 919166
Skickat från min iPhone
> 5 apr. 2021 kl. 00:39 skrev Arkadiy Naumov <ark...@gm...>:
>
>
> As far as the first zero - that's your extra fixing contributing. Either set it to 0.05 or create a custom index that does not have 2-days settlement, so you don't even have to worry about it.
> For the interest being slightly off - 0.05 is continuously compounded (you set your zero curve this way), but the bond resets to "simple" rate (which is higher, so the numbers make sense at least directionally)
>
>> On Sun, Apr 4, 2021 at 4:09 AM Brian Smith <bri...@gm...> wrote:
>> Thanks for your comments.
>>
>> But I still failed to understand the coupon payments at various coupon
>> dates. Below is my full example -
>>
>> from QuantLib import *
>>
>> mydate = Date(31, 1, 2018)
>>
>> Settings.instance().evaluationDate = mydate
>>
>> spots = [mydate, mydate + Period("6m"), mydate + Period("1y"), mydate
>> + Period("2y"), mydate + Period("3y")]
>> spotsdate = [0, 0.05, 0.05, 0.05, 0.05]
>>
>> curveHandle = YieldTermStructureHandle(ZeroCurve(spots, spotsdate,
>> Actual360(), Canada(), Linear(), Continuous))
>>
>> myindex = Euribor6M(curveHandle)
>> myindex.addFixing(Date(29, 1, 2018), 0.00)
>>
>> bond_schedule = Schedule(mydate, mydate + Period("1y"), Period(6,
>> Months), Canada(), Unadjusted, Unadjusted, DateGeneration.Forward,
>> False)
>>
>> [c.amount() for c in FloatingRateBond(0, 100, bond_schedule , myindex,
>> Actual360()).cashflows()]
>> [c.date() for c in FloatingRateBond(0, 100, bond_schedule , myindex,
>> Actual360()).cashflows()]
>>
>> ### [0.0, 2.5884898292778846, 100.0]
>> ### [Date(31,7,2018), Date(31,1,2019), Date(31,1,2019)]
>>
>> So I see on the 1st coupon date, QL is showing coupon payment as 0. Why?
>> And, on the last coupon date, coupon payment is 2.5884898292778846.
>> How this number is calculated? If I manually calculate this, I get
>> just a close match -
>>
>> 5 * Actual360().yearFraction(spots[1], spots[2])
>>
>> ### 2.5555555555555554
>>
>> Am I missing something?
>>
>> On Sun, 4 Apr 2021 at 03:27, Arkadiy Naumov <ark...@gm...> wrote:
>> >
>> > And as to the zeros - I may be wrong, but try explicitly setting the evaluationDate to whatever date you want to be your spot.
>> >
>> > On Sat, Apr 3, 2021 at 5:50 PM Arkadiy Naumov <ark...@gm...> wrote:
>> >>
>> >> Hi Brian,
>> >>
>> >> Without running your code - the reason Jan29th comes into play is because Euribor6M has a two days settlement built in: https://github.com/lballabio/QuantLib/blob/master/ql/indexes/ibor/eurlibor.cpp#L63
>> >>
>> >>
>> >> On Sat, Apr 3, 2021 at 10:22 AM Brian Smith <bri...@gm...> wrote:
>> >>>
>> >>> Hi,
>> >>>
>> >>> I found out that I have to add a dummy quote to get this work. So I added -
>> >>>
>> >>> myindex = Euribor6M(curveHandle)
>> >>> myindex.addFixing(Date(27, 7, 2018), 0.00)
>> >>>
>> >>> bond_schedule = Schedule(mydate,
>> >>> mydate + Period("1y"), Period(6, Months), Canada(), Unadjusted,
>> >>> Unadjusted, DateGeneration.Forward, False)
>> >>>
>> >>> [c.amount() for c in FloatingRateBond(0, 10000, bond_schedule ,
>> >>> myindex, Actual360()).cashflows()]
>> >>> [c.date() for c in FloatingRateBond(0, 10000, bond_schedule , myindex,
>> >>> Actual360()).cashflows()]
>> >>>
>> >>> However with this, I am getting strange result as all the coupon
>> >>> payments are coming as zero.
>> >>>
>> >>> Can you please help me to understand what went wrong in my code?
>> >>>
>> >>>
>> >>> On Sat, 3 Apr 2021 at 14:39, Brian Smith <bri...@gm...> wrote:
>> >>> >
>> >>> > Hi,
>> >>> >
>> >>> > I want to extract all the cash flow amounts from a bond as defined below -
>> >>> >
>> >>> > from QuantLib import *
>> >>> >
>> >>> > mydate = Date(31, 1, 2018)
>> >>> >
>> >>> > spots = [mydate, mydate + Period("6m"), mydate + Period("1y"), mydate
>> >>> > + Period("2y"), mydate + Period("3y")]
>> >>> > spotsdate = [0, 0.25, 0.45, 0.65, 0.85]
>> >>> >
>> >>> > curveHandle = YieldTermStructureHandle(ZeroCurve(spots, spotsdate,
>> >>> > Actual360(), Canada(), Linear(), Continuous))
>> >>> >
>> >>> > [c.amount() for c in FloatingRateBond(0, 10000, Schedule(mydate,
>> >>> > mydate + Period("1y"), Period(6, Months), Canada(), Unadjusted,
>> >>> > Unadjusted, DateGeneration.Forward, False) , Euribor6M(curveHandle),
>> >>> > Actual360()).cashflows()]
>> >>> >
>> >>> > However above code failed to achieve any result, but giving out below error -
>> >>> >
>> >>> > Traceback (most recent call last):File "<stdin>", line 1, in
>> >>> > <module>File "<stdin>", line 1, in <listcomp>File
>> >>> > "/usr/local/lib/python3.9/site-packages/QuantLib/QuantLib.py", line
>> >>> > 9967, in amountreturn _QuantLib.CashFlow_amount(self)RuntimeError:
>> >>> > Missing Euribor6M Actual/360 fixing for January 29th, 2018
>> >>> >
>> >>> > I wonder where the date January 29th, 2018 comes from and how to resolve this?
>> >>> >
>> >>> > Any pointer will be highly appreciated.
>> >>> >
>> >>> > Thanks for your time.
>> >>>
>> >>>
>> >>> _______________________________________________
>> >>> 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: Brian S. <bri...@gm...> - 2021-04-05 06:01:18
|
Thanks again.
Below is my modified code with 0 replaced by a dummy 0.05. But still I
see 0 for first coupon payment.
from QuantLib import *
mydate = Date(31, 1, 2018)
Settings.instance().evaluationDate = mydate
spots = [mydate, mydate + Period("6m"), mydate + Period("1y"), mydate
+ Period("2y"), mydate + Period("3y")]
spotsdate = [0.05, 0.05, 0.05, 0.05, 0.05]
curveHandle = YieldTermStructureHandle(ZeroCurve(spots, spotsdate,
Actual360(), Canada(), Linear(), Continuous))
myindex = Euribor6M(curveHandle)
myindex.addFixing(Date(29, 1, 2018), 0.00)
bond_schedule = Schedule(mydate, mydate + Period("1y"), Period(6,
Months), Canada(), Unadjusted, Unadjusted, DateGeneration.Forward,
False)
[c.amount() for c in FloatingRateBond(0, 100, bond_schedule , myindex,
Actual360()).cashflows()]
[c.date() for c in FloatingRateBond(0, 100, bond_schedule , myindex,
Actual360()).cashflows()]
### [0.0, 2.5884898292778846, 100.0]
### [Date(31,7,2018), Date(31,1,2019), Date(31,1,2019)]
To match the second coupon payment, I used below manual formula to
convert continuous compounding to semi-annual :
(math.sqrt(math.exp(0.05)) - 1)*2 * Actual360().yearFraction(spots[1],
spots[2]) * 100
### 2.5877678758305054
With this, I got a better match, but still not exact. Should I make
any other adjustment?
Appreciate your pointer.
Thanks and regards,
On Mon, 5 Apr 2021 at 04:08, Arkadiy Naumov <ark...@gm...> wrote:
>
> As far as the first zero - that's your extra fixing contributing. Either set it to 0.05 or create a custom index that does not have 2-days settlement, so you don't even have to worry about it.
> For the interest being slightly off - 0.05 is continuously compounded (you set your zero curve this way), but the bond resets to "simple" rate (which is higher, so the numbers make sense at least directionally)
>
> On Sun, Apr 4, 2021 at 4:09 AM Brian Smith <bri...@gm...> wrote:
>>
>> Thanks for your comments.
>>
>> But I still failed to understand the coupon payments at various coupon
>> dates. Below is my full example -
>>
>> from QuantLib import *
>>
>> mydate = Date(31, 1, 2018)
>>
>> Settings.instance().evaluationDate = mydate
>>
>> spots = [mydate, mydate + Period("6m"), mydate + Period("1y"), mydate
>> + Period("2y"), mydate + Period("3y")]
>> spotsdate = [0, 0.05, 0.05, 0.05, 0.05]
>>
>> curveHandle = YieldTermStructureHandle(ZeroCurve(spots, spotsdate,
>> Actual360(), Canada(), Linear(), Continuous))
>>
>> myindex = Euribor6M(curveHandle)
>> myindex.addFixing(Date(29, 1, 2018), 0.00)
>>
>> bond_schedule = Schedule(mydate, mydate + Period("1y"), Period(6,
>> Months), Canada(), Unadjusted, Unadjusted, DateGeneration.Forward,
>> False)
>>
>> [c.amount() for c in FloatingRateBond(0, 100, bond_schedule , myindex,
>> Actual360()).cashflows()]
>> [c.date() for c in FloatingRateBond(0, 100, bond_schedule , myindex,
>> Actual360()).cashflows()]
>>
>> ### [0.0, 2.5884898292778846, 100.0]
>> ### [Date(31,7,2018), Date(31,1,2019), Date(31,1,2019)]
>>
>> So I see on the 1st coupon date, QL is showing coupon payment as 0. Why?
>> And, on the last coupon date, coupon payment is 2.5884898292778846.
>> How this number is calculated? If I manually calculate this, I get
>> just a close match -
>>
>> 5 * Actual360().yearFraction(spots[1], spots[2])
>>
>> ### 2.5555555555555554
>>
>> Am I missing something?
>>
>> On Sun, 4 Apr 2021 at 03:27, Arkadiy Naumov <ark...@gm...> wrote:
>> >
>> > And as to the zeros - I may be wrong, but try explicitly setting the evaluationDate to whatever date you want to be your spot.
>> >
>> > On Sat, Apr 3, 2021 at 5:50 PM Arkadiy Naumov <ark...@gm...> wrote:
>> >>
>> >> Hi Brian,
>> >>
>> >> Without running your code - the reason Jan29th comes into play is because Euribor6M has a two days settlement built in: https://github.com/lballabio/QuantLib/blob/master/ql/indexes/ibor/eurlibor.cpp#L63
>> >>
>> >>
>> >> On Sat, Apr 3, 2021 at 10:22 AM Brian Smith <bri...@gm...> wrote:
>> >>>
>> >>> Hi,
>> >>>
>> >>> I found out that I have to add a dummy quote to get this work. So I added -
>> >>>
>> >>> myindex = Euribor6M(curveHandle)
>> >>> myindex.addFixing(Date(27, 7, 2018), 0.00)
>> >>>
>> >>> bond_schedule = Schedule(mydate,
>> >>> mydate + Period("1y"), Period(6, Months), Canada(), Unadjusted,
>> >>> Unadjusted, DateGeneration.Forward, False)
>> >>>
>> >>> [c.amount() for c in FloatingRateBond(0, 10000, bond_schedule ,
>> >>> myindex, Actual360()).cashflows()]
>> >>> [c.date() for c in FloatingRateBond(0, 10000, bond_schedule , myindex,
>> >>> Actual360()).cashflows()]
>> >>>
>> >>> However with this, I am getting strange result as all the coupon
>> >>> payments are coming as zero.
>> >>>
>> >>> Can you please help me to understand what went wrong in my code?
>> >>>
>> >>>
>> >>> On Sat, 3 Apr 2021 at 14:39, Brian Smith <bri...@gm...> wrote:
>> >>> >
>> >>> > Hi,
>> >>> >
>> >>> > I want to extract all the cash flow amounts from a bond as defined below -
>> >>> >
>> >>> > from QuantLib import *
>> >>> >
>> >>> > mydate = Date(31, 1, 2018)
>> >>> >
>> >>> > spots = [mydate, mydate + Period("6m"), mydate + Period("1y"), mydate
>> >>> > + Period("2y"), mydate + Period("3y")]
>> >>> > spotsdate = [0, 0.25, 0.45, 0.65, 0.85]
>> >>> >
>> >>> > curveHandle = YieldTermStructureHandle(ZeroCurve(spots, spotsdate,
>> >>> > Actual360(), Canada(), Linear(), Continuous))
>> >>> >
>> >>> > [c.amount() for c in FloatingRateBond(0, 10000, Schedule(mydate,
>> >>> > mydate + Period("1y"), Period(6, Months), Canada(), Unadjusted,
>> >>> > Unadjusted, DateGeneration.Forward, False) , Euribor6M(curveHandle),
>> >>> > Actual360()).cashflows()]
>> >>> >
>> >>> > However above code failed to achieve any result, but giving out below error -
>> >>> >
>> >>> > Traceback (most recent call last):File "<stdin>", line 1, in
>> >>> > <module>File "<stdin>", line 1, in <listcomp>File
>> >>> > "/usr/local/lib/python3.9/site-packages/QuantLib/QuantLib.py", line
>> >>> > 9967, in amountreturn _QuantLib.CashFlow_amount(self)RuntimeError:
>> >>> > Missing Euribor6M Actual/360 fixing for January 29th, 2018
>> >>> >
>> >>> > I wonder where the date January 29th, 2018 comes from and how to resolve this?
>> >>> >
>> >>> > Any pointer will be highly appreciated.
>> >>> >
>> >>> > Thanks for your time.
>> >>>
>> >>>
>> >>> _______________________________________________
>> >>> QuantLib-users mailing list
>> >>> Qua...@li...
>> >>> https://lists.sourceforge.net/lists/listinfo/quantlib-users
|
|
From: Arkadiy N. <ark...@gm...> - 2021-04-04 22:38:44
|
As far as the first zero - that's your extra fixing contributing. Either
set it to 0.05 or create a custom index that does not have 2-days
settlement, so you don't even have to worry about it.
For the interest being slightly off - 0.05 is continuously compounded (you
set your zero curve this way), but the bond resets to "simple" rate (which
is higher, so the numbers make sense at least directionally)
On Sun, Apr 4, 2021 at 4:09 AM Brian Smith <bri...@gm...>
wrote:
> Thanks for your comments.
>
> But I still failed to understand the coupon payments at various coupon
> dates. Below is my full example -
>
> from QuantLib import *
>
> mydate = Date(31, 1, 2018)
>
> Settings.instance().evaluationDate = mydate
>
> spots = [mydate, mydate + Period("6m"), mydate + Period("1y"), mydate
> + Period("2y"), mydate + Period("3y")]
> spotsdate = [0, 0.05, 0.05, 0.05, 0.05]
>
> curveHandle = YieldTermStructureHandle(ZeroCurve(spots, spotsdate,
> Actual360(), Canada(), Linear(), Continuous))
>
> myindex = Euribor6M(curveHandle)
> myindex.addFixing(Date(29, 1, 2018), 0.00)
>
> bond_schedule = Schedule(mydate, mydate + Period("1y"), Period(6,
> Months), Canada(), Unadjusted, Unadjusted, DateGeneration.Forward,
> False)
>
> [c.amount() for c in FloatingRateBond(0, 100, bond_schedule , myindex,
> Actual360()).cashflows()]
> [c.date() for c in FloatingRateBond(0, 100, bond_schedule , myindex,
> Actual360()).cashflows()]
>
> ### [0.0, 2.5884898292778846, 100.0]
> ### [Date(31,7,2018), Date(31,1,2019), Date(31,1,2019)]
>
> So I see on the 1st coupon date, QL is showing coupon payment as 0. Why?
> And, on the last coupon date, coupon payment is 2.5884898292778846.
> How this number is calculated? If I manually calculate this, I get
> just a close match -
>
> 5 * Actual360().yearFraction(spots[1], spots[2])
>
> ### 2.5555555555555554
>
> Am I missing something?
>
> On Sun, 4 Apr 2021 at 03:27, Arkadiy Naumov <ark...@gm...>
> wrote:
> >
> > And as to the zeros - I may be wrong, but try explicitly setting the
> evaluationDate to whatever date you want to be your spot.
> >
> > On Sat, Apr 3, 2021 at 5:50 PM Arkadiy Naumov <ark...@gm...>
> wrote:
> >>
> >> Hi Brian,
> >>
> >> Without running your code - the reason Jan29th comes into play is
> because Euribor6M has a two days settlement built in:
> https://github.com/lballabio/QuantLib/blob/master/ql/indexes/ibor/eurlibor.cpp#L63
> >>
> >>
> >> On Sat, Apr 3, 2021 at 10:22 AM Brian Smith <bri...@gm...>
> wrote:
> >>>
> >>> Hi,
> >>>
> >>> I found out that I have to add a dummy quote to get this work. So I
> added -
> >>>
> >>> myindex = Euribor6M(curveHandle)
> >>> myindex.addFixing(Date(27, 7, 2018), 0.00)
> >>>
> >>> bond_schedule = Schedule(mydate,
> >>> mydate + Period("1y"), Period(6, Months), Canada(), Unadjusted,
> >>> Unadjusted, DateGeneration.Forward, False)
> >>>
> >>> [c.amount() for c in FloatingRateBond(0, 10000, bond_schedule ,
> >>> myindex, Actual360()).cashflows()]
> >>> [c.date() for c in FloatingRateBond(0, 10000, bond_schedule , myindex,
> >>> Actual360()).cashflows()]
> >>>
> >>> However with this, I am getting strange result as all the coupon
> >>> payments are coming as zero.
> >>>
> >>> Can you please help me to understand what went wrong in my code?
> >>>
> >>>
> >>> On Sat, 3 Apr 2021 at 14:39, Brian Smith <bri...@gm...>
> wrote:
> >>> >
> >>> > Hi,
> >>> >
> >>> > I want to extract all the cash flow amounts from a bond as defined
> below -
> >>> >
> >>> > from QuantLib import *
> >>> >
> >>> > mydate = Date(31, 1, 2018)
> >>> >
> >>> > spots = [mydate, mydate + Period("6m"), mydate + Period("1y"), mydate
> >>> > + Period("2y"), mydate + Period("3y")]
> >>> > spotsdate = [0, 0.25, 0.45, 0.65, 0.85]
> >>> >
> >>> > curveHandle = YieldTermStructureHandle(ZeroCurve(spots, spotsdate,
> >>> > Actual360(), Canada(), Linear(), Continuous))
> >>> >
> >>> > [c.amount() for c in FloatingRateBond(0, 10000, Schedule(mydate,
> >>> > mydate + Period("1y"), Period(6, Months), Canada(), Unadjusted,
> >>> > Unadjusted, DateGeneration.Forward, False) , Euribor6M(curveHandle),
> >>> > Actual360()).cashflows()]
> >>> >
> >>> > However above code failed to achieve any result, but giving out
> below error -
> >>> >
> >>> > Traceback (most recent call last):File "<stdin>", line 1, in
> >>> > <module>File "<stdin>", line 1, in <listcomp>File
> >>> > "/usr/local/lib/python3.9/site-packages/QuantLib/QuantLib.py", line
> >>> > 9967, in amountreturn _QuantLib.CashFlow_amount(self)RuntimeError:
> >>> > Missing Euribor6M Actual/360 fixing for January 29th, 2018
> >>> >
> >>> > I wonder where the date January 29th, 2018 comes from and how to
> resolve this?
> >>> >
> >>> > Any pointer will be highly appreciated.
> >>> >
> >>> > Thanks for your time.
> >>>
> >>>
> >>> _______________________________________________
> >>> QuantLib-users mailing list
> >>> Qua...@li...
> >>> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>
|
|
From: Philippe H. <phi...@ex...> - 2021-04-04 15:58:14
|
Hi Peter. I am going back to this semi-dated thread. My question is what measure/numeraire is the drift adjustment in the HW engine compatible with, if any? In other words, if I price say a swaption via Monte-Carlo simulation, and say I evaluation my cash flows with the discount factor as numeraire, i.e. I use swap.NPV() to value the forward swap on each path, I overprice the option versus closed-form Jamshidian. I think swap.NPV() is consistent with a money market account as numeraire, so my question is whether I am still supposed to "deflate" the swap.NPV() to satisfy no arbitrage? I thought such deflation typically takes place as an additional drift adjustment that needs to be calibrated, but my question is whether this is already done or not in the HW engine for DF as numeraire, or if there is none and it needs to be done? Philippe Hatstadt On Sun, Oct 25, 2020 at 1:47 PM Peter Caspers <pca...@gm...> wrote: > I think this is expected, according to Brigo Mercurio Formula (3.37) > for the mean of the short rate at t (conditional on F_s with s = 0, > i.e. the unconditional mean) is > > r(0) exp(-at) + alpha(t) - alpha(0) exp(-at) = alpha(t) = f(0,t) + > sigma^2 / (2 a^2) ( 1 - exp(- at) ) ^2 > > because alpha(0) = r(0) and so the first and last summand cancel out. > Plugging in sigma = 0.1 and a = 0.1 that means that E( r( 30 ) ) = > 0.05 + 0.4514... = 0.5014.... This is all including the term > responsible for the fit to the initial flat curve at 5%. And by the > way, I don't think you can disable this part of the drift in > HullWhiteProcess. > > Also, I think sigma = 0.1 is an extremely high value, maybe on purpose > for the sake of the example? > > > On Sun, 25 Oct 2020 at 17:44, Philippe Hatstadt > <phi...@ex...> wrote: > > > > Actually, I have a follow-up question on the drift issue. > > I was experimenting with the Hull-White implementation from the QuantLib > Cookbook, and interestingly, in Chapter 15, they build a flat curve with a > forward rate of 5%, via: > > spot_curve = ql.FlatForward(todays_date, > ql.QuoteHandle(ql.SimpleQuote(forward_rate)), day_count) > > > > The HW parameters are sigma=10% and a=10%, and the HW engine is built > via: > > > > hw_process = ql.HullWhiteProcess(spot_curve_handle, a, sigma) > > > > They then proceed to generate paths of the short term rate, and they > demonstrate that the simulated rate converges to the theoretical expected > forward rate f(0,t<T) but the graph of such expected forward is not flat at > 5%, instead it is monotonously increasing from 5% to as high as 50% after > 30 years. So it very much looks like the paths of rates that they show are > not drift adjusted otherwise the expected path should be flat at 5%. > > So I'm unsure what is going on? Is there an optional argument in the > hw_process call to do the drift adjustment or not? > > > > Philippe Hatstadt > > > > > > On Sun, Oct 25, 2020 at 9:09 AM Peter Caspers <pca...@gm...> > wrote: > >> > >> Hi Philippe, > >> > >> the Jamshidian engine uses a) discount bond prices conditional on the > >> state of the model (i.e. the short rate in the case of the Hull-White > >> model) and b) zero bond option prices in the model to come up with a > >> model swaption price. It retrieves this information via the > >> discountBond() and discountBondOption() methods in the > >> OneFactorAffineModel interface. The methods account for the adjustment > >> term theta(t) in the Hull-White model SDE already, there is nothing > >> that the engine needs to do in addition to that. I don't know if that > >> answers your question? > >> > >> The HullWhiteProcess also takes into account the adjustment to the > >> initial curve already. To see that you can look into the > >> implementation of HullWhiteProcess::drift() > >> > >> > https://github.com/lballabio/QuantLib/blob/master/ql/processes/hullwhiteprocess.cpp#L38 > >> > >> which coincides with e.g. Brigo Mercurio, Interest Rate Models, Theory > >> and Practice, Formulas (3.33) and (3.34) observing that in this > >> context > >> > >> > https://github.com/lballabio/QuantLib/blob/master/ql/processes/ornsteinuhlenbeckprocess.hpp#L90 > >> > >> level_ is zero, speed_ is the Hull-White mean reversion parameter and > >> x stands for the short rate at time t. > >> > >> Does that make sense? > >> > >> Thanks, > >> Peter > >> > >> > >> On Sun, 25 Oct 2020 at 12:47, philippe hatstadt via QuantLib-users > >> <qua...@li...> wrote: > >> > > >> > Is there any information about how the Jamshidian engine does the > drift adjustment to match the initial curve for the Hull White model? > >> > If I want to use the QL HW Process in a MC model, I assume II have to > do the drift adjustment myself, or is there existing QL functionality to do > that? > >> > > >> > Regards > >> > > >> > Philippe Hatstadt > >> > +1-203-252-0408 > >> > https://www.linkedin.com/in/philippe-hatstadt > >> > > >> > > >> > > >> > _______________________________________________ > >> > 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 > > > > > > > > > > Brokerage services offered through Exos Securities LLC, member of SIPC / > FINRA. For important disclosures, click here. > -- Broker-Dealer services offered through Exos Securities LLC, member of SIPC <http://www.sipc.org/> / FINRA <http://www.finra.org/> / BrokerCheck <https://brokercheck.finra.org/>/ 2021 Exos, inc. For important disclosures, click here <https://www.exosfinancial.com/general-disclosures>. |
|
From: Brian S. <bri...@gm...> - 2021-04-04 08:10:07
|
Thanks for your comments.
But I still failed to understand the coupon payments at various coupon
dates. Below is my full example -
from QuantLib import *
mydate = Date(31, 1, 2018)
Settings.instance().evaluationDate = mydate
spots = [mydate, mydate + Period("6m"), mydate + Period("1y"), mydate
+ Period("2y"), mydate + Period("3y")]
spotsdate = [0, 0.05, 0.05, 0.05, 0.05]
curveHandle = YieldTermStructureHandle(ZeroCurve(spots, spotsdate,
Actual360(), Canada(), Linear(), Continuous))
myindex = Euribor6M(curveHandle)
myindex.addFixing(Date(29, 1, 2018), 0.00)
bond_schedule = Schedule(mydate, mydate + Period("1y"), Period(6,
Months), Canada(), Unadjusted, Unadjusted, DateGeneration.Forward,
False)
[c.amount() for c in FloatingRateBond(0, 100, bond_schedule , myindex,
Actual360()).cashflows()]
[c.date() for c in FloatingRateBond(0, 100, bond_schedule , myindex,
Actual360()).cashflows()]
### [0.0, 2.5884898292778846, 100.0]
### [Date(31,7,2018), Date(31,1,2019), Date(31,1,2019)]
So I see on the 1st coupon date, QL is showing coupon payment as 0. Why?
And, on the last coupon date, coupon payment is 2.5884898292778846.
How this number is calculated? If I manually calculate this, I get
just a close match -
5 * Actual360().yearFraction(spots[1], spots[2])
### 2.5555555555555554
Am I missing something?
On Sun, 4 Apr 2021 at 03:27, Arkadiy Naumov <ark...@gm...> wrote:
>
> And as to the zeros - I may be wrong, but try explicitly setting the evaluationDate to whatever date you want to be your spot.
>
> On Sat, Apr 3, 2021 at 5:50 PM Arkadiy Naumov <ark...@gm...> wrote:
>>
>> Hi Brian,
>>
>> Without running your code - the reason Jan29th comes into play is because Euribor6M has a two days settlement built in: https://github.com/lballabio/QuantLib/blob/master/ql/indexes/ibor/eurlibor.cpp#L63
>>
>>
>> On Sat, Apr 3, 2021 at 10:22 AM Brian Smith <bri...@gm...> wrote:
>>>
>>> Hi,
>>>
>>> I found out that I have to add a dummy quote to get this work. So I added -
>>>
>>> myindex = Euribor6M(curveHandle)
>>> myindex.addFixing(Date(27, 7, 2018), 0.00)
>>>
>>> bond_schedule = Schedule(mydate,
>>> mydate + Period("1y"), Period(6, Months), Canada(), Unadjusted,
>>> Unadjusted, DateGeneration.Forward, False)
>>>
>>> [c.amount() for c in FloatingRateBond(0, 10000, bond_schedule ,
>>> myindex, Actual360()).cashflows()]
>>> [c.date() for c in FloatingRateBond(0, 10000, bond_schedule , myindex,
>>> Actual360()).cashflows()]
>>>
>>> However with this, I am getting strange result as all the coupon
>>> payments are coming as zero.
>>>
>>> Can you please help me to understand what went wrong in my code?
>>>
>>>
>>> On Sat, 3 Apr 2021 at 14:39, Brian Smith <bri...@gm...> wrote:
>>> >
>>> > Hi,
>>> >
>>> > I want to extract all the cash flow amounts from a bond as defined below -
>>> >
>>> > from QuantLib import *
>>> >
>>> > mydate = Date(31, 1, 2018)
>>> >
>>> > spots = [mydate, mydate + Period("6m"), mydate + Period("1y"), mydate
>>> > + Period("2y"), mydate + Period("3y")]
>>> > spotsdate = [0, 0.25, 0.45, 0.65, 0.85]
>>> >
>>> > curveHandle = YieldTermStructureHandle(ZeroCurve(spots, spotsdate,
>>> > Actual360(), Canada(), Linear(), Continuous))
>>> >
>>> > [c.amount() for c in FloatingRateBond(0, 10000, Schedule(mydate,
>>> > mydate + Period("1y"), Period(6, Months), Canada(), Unadjusted,
>>> > Unadjusted, DateGeneration.Forward, False) , Euribor6M(curveHandle),
>>> > Actual360()).cashflows()]
>>> >
>>> > However above code failed to achieve any result, but giving out below error -
>>> >
>>> > Traceback (most recent call last):File "<stdin>", line 1, in
>>> > <module>File "<stdin>", line 1, in <listcomp>File
>>> > "/usr/local/lib/python3.9/site-packages/QuantLib/QuantLib.py", line
>>> > 9967, in amountreturn _QuantLib.CashFlow_amount(self)RuntimeError:
>>> > Missing Euribor6M Actual/360 fixing for January 29th, 2018
>>> >
>>> > I wonder where the date January 29th, 2018 comes from and how to resolve this?
>>> >
>>> > Any pointer will be highly appreciated.
>>> >
>>> > Thanks for your time.
>>>
>>>
>>> _______________________________________________
>>> QuantLib-users mailing list
>>> Qua...@li...
>>> https://lists.sourceforge.net/lists/listinfo/quantlib-users
|
|
From: Hitesh K. <hhi...@gm...> - 2021-04-04 07:09:17
|
Hi Quantlib Users, Is it possible to obtain time dependent volatility parameter in HW1F calibration using Quantlib. Thanks, |
|
From: Arkadiy N. <ark...@gm...> - 2021-04-03 21:57:10
|
And as to the zeros - I may be wrong, but try explicitly setting the evaluationDate to whatever date you want to be your spot. On Sat, Apr 3, 2021 at 5:50 PM Arkadiy Naumov <ark...@gm...> wrote: > Hi Brian, > > Without running your code - the reason Jan29th comes into play is because > Euribor6M has a two days settlement built in: > https://github.com/lballabio/QuantLib/blob/master/ql/indexes/ibor/eurlibor.cpp#L63 > > > On Sat, Apr 3, 2021 at 10:22 AM Brian Smith <bri...@gm...> > wrote: > >> Hi, >> >> I found out that I have to add a dummy quote to get this work. So I added >> - >> >> myindex = Euribor6M(curveHandle) >> myindex.addFixing(Date(27, 7, 2018), 0.00) >> >> bond_schedule = Schedule(mydate, >> mydate + Period("1y"), Period(6, Months), Canada(), Unadjusted, >> Unadjusted, DateGeneration.Forward, False) >> >> [c.amount() for c in FloatingRateBond(0, 10000, bond_schedule , >> myindex, Actual360()).cashflows()] >> [c.date() for c in FloatingRateBond(0, 10000, bond_schedule , myindex, >> Actual360()).cashflows()] >> >> However with this, I am getting strange result as all the coupon >> payments are coming as zero. >> >> Can you please help me to understand what went wrong in my code? >> >> >> On Sat, 3 Apr 2021 at 14:39, Brian Smith <bri...@gm...> >> wrote: >> > >> > Hi, >> > >> > I want to extract all the cash flow amounts from a bond as defined >> below - >> > >> > from QuantLib import * >> > >> > mydate = Date(31, 1, 2018) >> > >> > spots = [mydate, mydate + Period("6m"), mydate + Period("1y"), mydate >> > + Period("2y"), mydate + Period("3y")] >> > spotsdate = [0, 0.25, 0.45, 0.65, 0.85] >> > >> > curveHandle = YieldTermStructureHandle(ZeroCurve(spots, spotsdate, >> > Actual360(), Canada(), Linear(), Continuous)) >> > >> > [c.amount() for c in FloatingRateBond(0, 10000, Schedule(mydate, >> > mydate + Period("1y"), Period(6, Months), Canada(), Unadjusted, >> > Unadjusted, DateGeneration.Forward, False) , Euribor6M(curveHandle), >> > Actual360()).cashflows()] >> > >> > However above code failed to achieve any result, but giving out below >> error - >> > >> > Traceback (most recent call last):File "<stdin>", line 1, in >> > <module>File "<stdin>", line 1, in <listcomp>File >> > "/usr/local/lib/python3.9/site-packages/QuantLib/QuantLib.py", line >> > 9967, in amountreturn _QuantLib.CashFlow_amount(self)RuntimeError: >> > Missing Euribor6M Actual/360 fixing for January 29th, 2018 >> > >> > I wonder where the date January 29th, 2018 comes from and how to >> resolve this? >> > >> > Any pointer will be highly appreciated. >> > >> > Thanks for your time. >> >> >> _______________________________________________ >> QuantLib-users mailing list >> Qua...@li... >> https://lists.sourceforge.net/lists/listinfo/quantlib-users >> > |
|
From: Arkadiy N. <ark...@gm...> - 2021-04-03 21:51:20
|
Hi Brian, Without running your code - the reason Jan29th comes into play is because Euribor6M has a two days settlement built in: https://github.com/lballabio/QuantLib/blob/master/ql/indexes/ibor/eurlibor.cpp#L63 On Sat, Apr 3, 2021 at 10:22 AM Brian Smith <bri...@gm...> wrote: > Hi, > > I found out that I have to add a dummy quote to get this work. So I added - > > myindex = Euribor6M(curveHandle) > myindex.addFixing(Date(27, 7, 2018), 0.00) > > bond_schedule = Schedule(mydate, > mydate + Period("1y"), Period(6, Months), Canada(), Unadjusted, > Unadjusted, DateGeneration.Forward, False) > > [c.amount() for c in FloatingRateBond(0, 10000, bond_schedule , > myindex, Actual360()).cashflows()] > [c.date() for c in FloatingRateBond(0, 10000, bond_schedule , myindex, > Actual360()).cashflows()] > > However with this, I am getting strange result as all the coupon > payments are coming as zero. > > Can you please help me to understand what went wrong in my code? > > > On Sat, 3 Apr 2021 at 14:39, Brian Smith <bri...@gm...> > wrote: > > > > Hi, > > > > I want to extract all the cash flow amounts from a bond as defined below > - > > > > from QuantLib import * > > > > mydate = Date(31, 1, 2018) > > > > spots = [mydate, mydate + Period("6m"), mydate + Period("1y"), mydate > > + Period("2y"), mydate + Period("3y")] > > spotsdate = [0, 0.25, 0.45, 0.65, 0.85] > > > > curveHandle = YieldTermStructureHandle(ZeroCurve(spots, spotsdate, > > Actual360(), Canada(), Linear(), Continuous)) > > > > [c.amount() for c in FloatingRateBond(0, 10000, Schedule(mydate, > > mydate + Period("1y"), Period(6, Months), Canada(), Unadjusted, > > Unadjusted, DateGeneration.Forward, False) , Euribor6M(curveHandle), > > Actual360()).cashflows()] > > > > However above code failed to achieve any result, but giving out below > error - > > > > Traceback (most recent call last):File "<stdin>", line 1, in > > <module>File "<stdin>", line 1, in <listcomp>File > > "/usr/local/lib/python3.9/site-packages/QuantLib/QuantLib.py", line > > 9967, in amountreturn _QuantLib.CashFlow_amount(self)RuntimeError: > > Missing Euribor6M Actual/360 fixing for January 29th, 2018 > > > > I wonder where the date January 29th, 2018 comes from and how to resolve > this? > > > > Any pointer will be highly appreciated. > > > > Thanks for your time. > > > _______________________________________________ > QuantLib-users mailing list > Qua...@li... > https://lists.sourceforge.net/lists/listinfo/quantlib-users > |
|
From: Brian S. <bri...@gm...> - 2021-04-03 14:20:26
|
Hi,
I found out that I have to add a dummy quote to get this work. So I added -
myindex = Euribor6M(curveHandle)
myindex.addFixing(Date(27, 7, 2018), 0.00)
bond_schedule = Schedule(mydate,
mydate + Period("1y"), Period(6, Months), Canada(), Unadjusted,
Unadjusted, DateGeneration.Forward, False)
[c.amount() for c in FloatingRateBond(0, 10000, bond_schedule ,
myindex, Actual360()).cashflows()]
[c.date() for c in FloatingRateBond(0, 10000, bond_schedule , myindex,
Actual360()).cashflows()]
However with this, I am getting strange result as all the coupon
payments are coming as zero.
Can you please help me to understand what went wrong in my code?
On Sat, 3 Apr 2021 at 14:39, Brian Smith <bri...@gm...> wrote:
>
> Hi,
>
> I want to extract all the cash flow amounts from a bond as defined below -
>
> from QuantLib import *
>
> mydate = Date(31, 1, 2018)
>
> spots = [mydate, mydate + Period("6m"), mydate + Period("1y"), mydate
> + Period("2y"), mydate + Period("3y")]
> spotsdate = [0, 0.25, 0.45, 0.65, 0.85]
>
> curveHandle = YieldTermStructureHandle(ZeroCurve(spots, spotsdate,
> Actual360(), Canada(), Linear(), Continuous))
>
> [c.amount() for c in FloatingRateBond(0, 10000, Schedule(mydate,
> mydate + Period("1y"), Period(6, Months), Canada(), Unadjusted,
> Unadjusted, DateGeneration.Forward, False) , Euribor6M(curveHandle),
> Actual360()).cashflows()]
>
> However above code failed to achieve any result, but giving out below error -
>
> Traceback (most recent call last):File "<stdin>", line 1, in
> <module>File "<stdin>", line 1, in <listcomp>File
> "/usr/local/lib/python3.9/site-packages/QuantLib/QuantLib.py", line
> 9967, in amountreturn _QuantLib.CashFlow_amount(self)RuntimeError:
> Missing Euribor6M Actual/360 fixing for January 29th, 2018
>
> I wonder where the date January 29th, 2018 comes from and how to resolve this?
>
> Any pointer will be highly appreciated.
>
> Thanks for your time.
|
|
From: Amine I. <ami...@gm...> - 2021-04-03 09:40:09
|
Hi Philippe, To be able to fully reconcile market and MC price for your swaption, your model needs to be calibrated to market prices. Also, the scenarios generated need to be consistent with the numéraire you use for discounting. If you are simulating under risk neutral measure, then your scenarios need to be consistent with: E[D(0,T1)D(T1,T2)] = B(0,T2) for all 0<=T1<= T2 where E[] is the average over your scenarios. Maybe you could enforce this condition as part of your minimisation of model/market value ? That’s my 2c on the subject. Hope it helps. Amine Ifri > On 3 Apr 2021, at 04:12, Philippe Hatstadt <phi...@ex...> wrote: > > > I was able to build a Jupyter Notebook that generates one factor Hull-White paths. I checked that the libor setting does change on each path and it does. > I build a swaption (swaption object below) using the standard method from the Cookbook, as a 1y maturity into a 3y swap based on US 30/360 and 3m USDLibor index. I use sigma and mean rev both equal to 0.10, and a flat forward rate at 5%. > The closed-form Jamshidian pricing comes out at 0.91mm on notional of 10mm. My problem is that the MC value is too high by about 25%, at 1.2mm. I price the swaption with the code below, with 10,000 paths and 10 day timestep. > I checked manually that for all paths, swap.NPV() is correct, which returns the PV as seen as the trade date of a forward starting swap on each path-dependent curve. I was wondering if I am supposed to apply some additional numeraire adjustment? Since swap.NPV() computes the NPV of the swap with full path-wise discounting and forecasting curve, I consider that the Annuity Measure (At) (which makes the forward swap rate a martingale under the At measure), is embedded in the swap.NPV() and therefore I do not need to do anything, or do I? > > MC Python Code for MC Swaption > ---------------------------------------------------------------------------------------------------------- > sum_pv = 0 > ql.Settings.instance().evaluationDate = trade_date > swap = swaption.underlyingSwap() > exercise_date = swaption.exercise().date(0) > for i in range(num_paths): > curve = path_discount_curve(i) > forecastHandle.linkTo(curve) > engine = ql.DiscountingSwapEngine(forecastHandle) > swap.setPricingEngine(engine) > swap_npv = swap.NPV() > sum_pv += max(0, swap_npv) > return sum_pv / num_paths > > > Philippe Hatstadt > > >> On Fri, Apr 2, 2021 at 12:03 PM Luigi Ballabio <lui...@gm...> wrote: >> Hello, >> I would have guessed that passing the forecastHandle to the index (as you did) and relinking it would change the fixings as you expect. I understand your code is probably proprietary, but is there any chance you can post a simplified or abridged version we can run to reproduce the issue? If not, try returning the index as well from the function that builds the swaption, so after relinking the curve you can check if its fixings change or not, or if the curve it contains is actually the one you linked. >> >> Hope this helps, >> Luigi >> >> >>> On Fri, Apr 2, 2021 at 1:05 PM Philippe Hatstadt <phi...@ex...> wrote: >>> Thank you. I’m not sure about the exact steps to clone the libor index? I assume I would create an index inside the MC loop and link its curve to my stochastic curve, but how do I “assign” such index to a swap that already exists? >>> >>> Regards >>> >>> Philippe Hatstadt >>> +1-203-252-0408 >>> https://www.linkedin.com/in/philippe-hatstadt >>> >>> >>>>> On Apr 2, 2021, at 3:23 AM, Amine Ifri <ami...@gm...> wrote: >>>>> >>>> Hi Philippe, >>>> >>>> I believe your forecastHandle variable - which is set to the MC curve generated for scénario i - is actually used for discounting only. discountingSwapEngine only affects the discounting and not the curves upon which the floating index is dependent. >>>> >>>> You need to “clone” the libor 3m index for your underlying swap and relink its curve to a MC curve as well. >>>> >>>> Amine Ifri >>>> >>>>>> On 2 Apr 2021, at 04:11, Philippe Hatstadt <phi...@ex...> wrote: >>>>>> >>>>> >>>>> I have built a Hull-White sequence via standard method, by following precisely the method in the QuantLib Cookbook, with sigma = 10% and mean_rev = 10%. >>>>> My goal is to ultimately build an OAS model for some Agency CMOs, for which I am building a Monte-carlo engine. >>>>> I also built a Jamshidian engine to compute a closed-form value of a european swaption as a test, to make sure that my MC valuation converges to the theoretical value. >>>>> The convergence doesn't work, and I think it has to do with the floating index of the swaption, so let me explain. >>>>> >>>>> I first build a curve name forecastHandle of type ql.RelinkableYieldTermStructureHandle >>>>> I then build a swaption object via my own build_swaption() function, along the lines of the swaption helpers from the Cookbook approach, which returns a ql.Swaption() object. The curve handle is passed to the build_swaption() call along with tenor, maturity and strike. >>>>> I build the floating index as follows inside the function: >>>>> libor_3m = ql.USDLibor(ql.Period('3M'), forecastHandle) >>>>> >>>>> Now switching to the MC calculation. I loop on all the sequences of short-term rates generated by my HW sequence. I verified that the expected value and the variance of the short-rate are the same as in the Cookbook. >>>>> Lastly, in order to calculate the value of the swaption via MC integration, I do the following, which takes place inside a function called swaption_MC(forecastHandle, my_swaption). Importantly, forecastHandle is the same handle that was used to build the swaption, including its libor_3m index. >>>>> for i in range(num_paths): >>>>> curve = hw_discount_curve(i) >>>>> forecastHandle.linkTo(curve) >>>>> engine = ql.DiscountingSwapEngine(forecastHandle) >>>>> swap = my_swaption.underlyingSwap() >>>>> swap.setPricingEngine(engine) >>>>> swap_npv = swap.NPV() >>>>> sum_pv += max(0, swap_npv) >>>>> return sum_pv / num_paths >>>>> I was therefore hoping that by linking the forecastHandle to each path-wise stochastic curve, the libor 3m index would also be path dependent. but somehow, that doesn't appear to be the case, as the floating rates for each reset do not change with each stochastic curve. So I am wondering what I am doing wrong? >>>>> >>>>> Help appreciated. >>>>> >>>>> Philippe Hatstadt >>>>> >>>>> >>>>> >>>>> Broker-Dealer services offered through Exos Securities LLC, member of SIPC / FINRA / BrokerCheck / 2021 Exos, inc. For important disclosures, click here. >>>>> >>>>> _______________________________________________ >>>>> 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 >>> >>> >>> >>> Broker-Dealer services offered through Exos Securities LLC, member of SIPC / FINRA / BrokerCheck / 2021 Exos, inc. For important disclosures, click here. >>> >>> _______________________________________________ >>> QuantLib-users mailing list >>> Qua...@li... >>> https://lists.sourceforge.net/lists/listinfo/quantlib-users > > > > Broker-Dealer services offered through Exos Securities LLC, member of SIPC / FINRA / BrokerCheck / 2021 Exos, inc. For important disclosures, click here. > |
|
From: Brian S. <bri...@gm...> - 2021-04-03 09:10:21
|
Hi,
I want to extract all the cash flow amounts from a bond as defined below -
from QuantLib import *
mydate = Date(31, 1, 2018)
spots = [mydate, mydate + Period("6m"), mydate + Period("1y"), mydate
+ Period("2y"), mydate + Period("3y")]
spotsdate = [0, 0.25, 0.45, 0.65, 0.85]
curveHandle = YieldTermStructureHandle(ZeroCurve(spots, spotsdate,
Actual360(), Canada(), Linear(), Continuous))
[c.amount() for c in FloatingRateBond(0, 10000, Schedule(mydate,
mydate + Period("1y"), Period(6, Months), Canada(), Unadjusted,
Unadjusted, DateGeneration.Forward, False) , Euribor6M(curveHandle),
Actual360()).cashflows()]
However above code failed to achieve any result, but giving out below error -
Traceback (most recent call last):File "<stdin>", line 1, in
<module>File "<stdin>", line 1, in <listcomp>File
"/usr/local/lib/python3.9/site-packages/QuantLib/QuantLib.py", line
9967, in amountreturn _QuantLib.CashFlow_amount(self)RuntimeError:
Missing Euribor6M Actual/360 fixing for January 29th, 2018
I wonder where the date January 29th, 2018 comes from and how to resolve this?
Any pointer will be highly appreciated.
Thanks for your time.
|
|
From: Philippe H. <phi...@ex...> - 2021-04-03 03:12:25
|
I was able to build a Jupyter Notebook that generates one factor Hull-White
paths. I checked that the libor setting does change on each path and it
does.
I build a swaption (swaption object below) using the standard method from
the Cookbook, as a 1y maturity into a 3y swap based on US 30/360 and 3m
USDLibor index. I use sigma and mean rev both equal to 0.10, and a flat
forward rate at 5%.
The closed-form Jamshidian pricing comes out at 0.91mm on notional of 10mm.
My problem is that the MC value is too high by about 25%, at 1.2mm. I price
the swaption with the code below, with 10,000 paths and 10 day timestep.
I checked manually that for all paths, swap.NPV() is correct, which returns
the PV as seen as the trade date of a forward starting swap on each
path-dependent curve. I was wondering if I am supposed to apply some
additional numeraire adjustment? Since swap.NPV() computes the NPV of the
swap with full path-wise discounting and forecasting curve, I consider that
the Annuity Measure (At) (which makes the forward swap rate a martingale
under the At measure), is embedded in the swap.NPV() and therefore I do not
need to do anything, or do I?
MC Python Code for MC Swaption
----------------------------------------------------------------------------------------------------------
sum_pv = 0
ql.Settings.instance().evaluationDate = trade_date
swap = swaption.underlyingSwap()
exercise_date = swaption.exercise().date(0)
for i in range(num_paths):
curve = path_discount_curve(i)
forecastHandle.linkTo(curve)
engine = ql.DiscountingSwapEngine(forecastHandle)
swap.setPricingEngine(engine)
swap_npv = swap.NPV()
sum_pv += max(0, swap_npv)
return sum_pv / num_paths
Philippe Hatstadt
On Fri, Apr 2, 2021 at 12:03 PM Luigi Ballabio <lui...@gm...>
wrote:
> Hello,
> I would have guessed that passing the forecastHandle to the index (as
> you did) and relinking it would change the fixings as you expect. I
> understand your code is probably proprietary, but is there any chance you
> can post a simplified or abridged version we can run to reproduce the
> issue? If not, try returning the index as well from the function that
> builds the swaption, so after relinking the curve you can check if its
> fixings change or not, or if the curve it contains is actually the one you
> linked.
>
> Hope this helps,
> Luigi
>
>
> On Fri, Apr 2, 2021 at 1:05 PM Philippe Hatstadt <
> phi...@ex...> wrote:
>
>> Thank you. I’m not sure about the exact steps to clone the libor index? I
>> assume I would create an index inside the MC loop and link its curve to my
>> stochastic curve, but how do I “assign” such index to a swap that already
>> exists?
>>
>> Regards
>>
>> Philippe Hatstadt
>> +1-203-252-0408
>> https://www.linkedin.com/in/philippe-hatstadt
>>
>>
>> On Apr 2, 2021, at 3:23 AM, Amine Ifri <ami...@gm...> wrote:
>>
>> Hi Philippe,
>>
>> I believe your forecastHandle variable - which is set to the MC curve
>> generated for scénario i - is actually used for discounting only.
>> discountingSwapEngine only affects the discounting and not the curves upon
>> which the floating index is dependent.
>>
>> You need to “clone” the libor 3m index for your underlying swap and
>> relink its curve to a MC curve as well.
>>
>> Amine Ifri
>>
>> On 2 Apr 2021, at 04:11, Philippe Hatstadt <
>> phi...@ex...> wrote:
>>
>>
>> I have built a Hull-White sequence via standard method, by following
>> precisely the method in the QuantLib Cookbook, with sigma = 10% and
>> mean_rev = 10%.
>> My goal is to ultimately build an OAS model for some Agency CMOs, for
>> which I am building a Monte-carlo engine.
>> I also built a Jamshidian engine to compute a closed-form value of a
>> european swaption as a test, to make sure that my MC valuation converges to
>> the theoretical value.
>> The convergence doesn't work, and I think it has to do with the
>> floating index of the swaption, so let me explain.
>>
>> I first build a curve name forecastHandle of type
>> ql.RelinkableYieldTermStructureHandle
>> I then build a swaption object via my own build_swaption() function,
>> along the lines of the swaption helpers from the Cookbook approach, which
>> returns a ql.Swaption() object. The curve handle is passed to the
>> build_swaption() call along with tenor, maturity and strike.
>> I build the floating index as follows inside the function:
>> libor_3m = ql.USDLibor(ql.Period('3M'), forecastHandle)
>>
>> Now switching to the MC calculation. I loop on all the sequences of
>> short-term rates generated by my HW sequence. I verified that the expected
>> value and the variance of the short-rate are the same as in the Cookbook.
>> Lastly, in order to calculate the value of the swaption via MC
>> integration, I do the following, which takes place inside a function called
>> swaption_MC(forecastHandle, my_swaption). Importantly, forecastHandle is
>> the same handle that was used to build the swaption, including its libor_3m
>> index.
>>
>> for i in range(num_paths):
>> curve = hw_discount_curve(i)
>> forecastHandle.linkTo(curve)
>> engine = ql.DiscountingSwapEngine(forecastHandle)
>>
>> swap = my_swaption.underlyingSwap()
>>
>> swap.setPricingEngine(engine)
>> swap_npv = swap.NPV()
>> sum_pv += max(0, swap_npv)
>> return sum_pv / num_paths
>>
>> I was therefore hoping that by linking the forecastHandle to each
>> path-wise stochastic curve, the libor 3m index would also be path
>> dependent. but somehow, that doesn't appear to be the case, as the floating
>> rates for each reset do not change with each stochastic curve. So I am
>> wondering what I am doing wrong?
>>
>> Help appreciated.
>>
>> Philippe Hatstadt
>>
>>
>>
>> Broker-Dealer services offered through Exos Securities LLC, member of
>> SIPC <http://www.sipc.org/> / FINRA <http://www.finra.org/> / BrokerCheck
>> <https://brokercheck.finra.org/>/ 2021 Exos, inc. For important
>> disclosures, click here
>> <https://www.exosfinancial.com/general-disclosures>.
>>
>>
>> _______________________________________________
>> 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
>>
>>
>>
>>
>> Broker-Dealer services offered through Exos Securities LLC, member of
>> SIPC <http://www.sipc.org/> / FINRA <http://www.finra.org/> / BrokerCheck
>> <https://brokercheck.finra.org/>/ 2021 Exos, inc. For important
>> disclosures, click here
>> <https://www.exosfinancial.com/general-disclosures>.
>>
>>
>> _______________________________________________
>> QuantLib-users mailing list
>> Qua...@li...
>> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>>
>
--
Broker-Dealer services offered through Exos Securities LLC, member
of SIPC <http://www.sipc.org/> / FINRA <http://www.finra.org/> /
BrokerCheck <https://brokercheck.finra.org/>/ 2021 Exos, inc. For
important disclosures, click here
<https://www.exosfinancial.com/general-disclosures>.
|
|
From: Philippe H. <phi...@ex...> - 2021-04-02 18:08:39
|
Very helpful, and I was able to make it work in a Jupyter Notebook. So now I just have to figure out why it doesn't work as expected when I call the same Python code from Excel. Thank you so much! Philippe Hatstadt On Fri, Apr 2, 2021 at 12:03 PM Luigi Ballabio <lui...@gm...> wrote: > Hello, > I would have guessed that passing the forecastHandle to the index (as > you did) and relinking it would change the fixings as you expect. I > understand your code is probably proprietary, but is there any chance you > can post a simplified or abridged version we can run to reproduce the > issue? If not, try returning the index as well from the function that > builds the swaption, so after relinking the curve you can check if its > fixings change or not, or if the curve it contains is actually the one you > linked. > > Hope this helps, > Luigi > > > On Fri, Apr 2, 2021 at 1:05 PM Philippe Hatstadt < > phi...@ex...> wrote: > >> Thank you. I’m not sure about the exact steps to clone the libor index? I >> assume I would create an index inside the MC loop and link its curve to my >> stochastic curve, but how do I “assign” such index to a swap that already >> exists? >> >> Regards >> >> Philippe Hatstadt >> +1-203-252-0408 >> https://www.linkedin.com/in/philippe-hatstadt >> >> >> On Apr 2, 2021, at 3:23 AM, Amine Ifri <ami...@gm...> wrote: >> >> Hi Philippe, >> >> I believe your forecastHandle variable - which is set to the MC curve >> generated for scénario i - is actually used for discounting only. >> discountingSwapEngine only affects the discounting and not the curves upon >> which the floating index is dependent. >> >> You need to “clone” the libor 3m index for your underlying swap and >> relink its curve to a MC curve as well. >> >> Amine Ifri >> >> On 2 Apr 2021, at 04:11, Philippe Hatstadt < >> phi...@ex...> wrote: >> >> >> I have built a Hull-White sequence via standard method, by following >> precisely the method in the QuantLib Cookbook, with sigma = 10% and >> mean_rev = 10%. >> My goal is to ultimately build an OAS model for some Agency CMOs, for >> which I am building a Monte-carlo engine. >> I also built a Jamshidian engine to compute a closed-form value of a >> european swaption as a test, to make sure that my MC valuation converges to >> the theoretical value. >> The convergence doesn't work, and I think it has to do with the >> floating index of the swaption, so let me explain. >> >> I first build a curve name forecastHandle of type >> ql.RelinkableYieldTermStructureHandle >> I then build a swaption object via my own build_swaption() function, >> along the lines of the swaption helpers from the Cookbook approach, which >> returns a ql.Swaption() object. The curve handle is passed to the >> build_swaption() call along with tenor, maturity and strike. >> I build the floating index as follows inside the function: >> libor_3m = ql.USDLibor(ql.Period('3M'), forecastHandle) >> >> Now switching to the MC calculation. I loop on all the sequences of >> short-term rates generated by my HW sequence. I verified that the expected >> value and the variance of the short-rate are the same as in the Cookbook. >> Lastly, in order to calculate the value of the swaption via MC >> integration, I do the following, which takes place inside a function called >> swaption_MC(forecastHandle, my_swaption). Importantly, forecastHandle is >> the same handle that was used to build the swaption, including its libor_3m >> index. >> >> for i in range(num_paths): >> curve = hw_discount_curve(i) >> forecastHandle.linkTo(curve) >> engine = ql.DiscountingSwapEngine(forecastHandle) >> >> swap = my_swaption.underlyingSwap() >> >> swap.setPricingEngine(engine) >> swap_npv = swap.NPV() >> sum_pv += max(0, swap_npv) >> return sum_pv / num_paths >> >> I was therefore hoping that by linking the forecastHandle to each >> path-wise stochastic curve, the libor 3m index would also be path >> dependent. but somehow, that doesn't appear to be the case, as the floating >> rates for each reset do not change with each stochastic curve. So I am >> wondering what I am doing wrong? >> >> Help appreciated. >> >> Philippe Hatstadt >> >> >> >> Broker-Dealer services offered through Exos Securities LLC, member of >> SIPC <http://www.sipc.org/> / FINRA <http://www.finra.org/> / BrokerCheck >> <https://brokercheck.finra.org/>/ 2021 Exos, inc. For important >> disclosures, click here >> <https://www.exosfinancial.com/general-disclosures>. >> >> >> _______________________________________________ >> 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 >> >> >> >> >> Broker-Dealer services offered through Exos Securities LLC, member of >> SIPC <http://www.sipc.org/> / FINRA <http://www.finra.org/> / BrokerCheck >> <https://brokercheck.finra.org/>/ 2021 Exos, inc. For important >> disclosures, click here >> <https://www.exosfinancial.com/general-disclosures>. >> >> >> _______________________________________________ >> QuantLib-users mailing list >> Qua...@li... >> https://lists.sourceforge.net/lists/listinfo/quantlib-users >> > -- Broker-Dealer services offered through Exos Securities LLC, member of SIPC <http://www.sipc.org/> / FINRA <http://www.finra.org/> / BrokerCheck <https://brokercheck.finra.org/>/ 2021 Exos, inc. For important disclosures, click here <https://www.exosfinancial.com/general-disclosures>. |
|
From: Luigi B. <lui...@gm...> - 2021-04-02 16:12:35
|
Hello,
I would have guessed that passing the forecastHandle to the index (as
you did) and relinking it would change the fixings as you expect. I
understand your code is probably proprietary, but is there any chance you
can post a simplified or abridged version we can run to reproduce the
issue? If not, try returning the index as well from the function that
builds the swaption, so after relinking the curve you can check if its
fixings change or not, or if the curve it contains is actually the one you
linked.
Hope this helps,
Luigi
On Fri, Apr 2, 2021 at 1:05 PM Philippe Hatstadt <
phi...@ex...> wrote:
> Thank you. I’m not sure about the exact steps to clone the libor index? I
> assume I would create an index inside the MC loop and link its curve to my
> stochastic curve, but how do I “assign” such index to a swap that already
> exists?
>
> Regards
>
> Philippe Hatstadt
> +1-203-252-0408
> https://www.linkedin.com/in/philippe-hatstadt
>
>
> On Apr 2, 2021, at 3:23 AM, Amine Ifri <ami...@gm...> wrote:
>
> Hi Philippe,
>
> I believe your forecastHandle variable - which is set to the MC curve
> generated for scénario i - is actually used for discounting only.
> discountingSwapEngine only affects the discounting and not the curves upon
> which the floating index is dependent.
>
> You need to “clone” the libor 3m index for your underlying swap and relink
> its curve to a MC curve as well.
>
> Amine Ifri
>
> On 2 Apr 2021, at 04:11, Philippe Hatstadt <
> phi...@ex...> wrote:
>
>
> I have built a Hull-White sequence via standard method, by following
> precisely the method in the QuantLib Cookbook, with sigma = 10% and
> mean_rev = 10%.
> My goal is to ultimately build an OAS model for some Agency CMOs, for
> which I am building a Monte-carlo engine.
> I also built a Jamshidian engine to compute a closed-form value of a
> european swaption as a test, to make sure that my MC valuation converges to
> the theoretical value.
> The convergence doesn't work, and I think it has to do with the
> floating index of the swaption, so let me explain.
>
> I first build a curve name forecastHandle of type
> ql.RelinkableYieldTermStructureHandle
> I then build a swaption object via my own build_swaption() function, along
> the lines of the swaption helpers from the Cookbook approach, which returns
> a ql.Swaption() object. The curve handle is passed to the build_swaption()
> call along with tenor, maturity and strike.
> I build the floating index as follows inside the function:
> libor_3m = ql.USDLibor(ql.Period('3M'), forecastHandle)
>
> Now switching to the MC calculation. I loop on all the sequences of
> short-term rates generated by my HW sequence. I verified that the expected
> value and the variance of the short-rate are the same as in the Cookbook.
> Lastly, in order to calculate the value of the swaption via MC
> integration, I do the following, which takes place inside a function called
> swaption_MC(forecastHandle, my_swaption). Importantly, forecastHandle is
> the same handle that was used to build the swaption, including its libor_3m
> index.
>
> for i in range(num_paths):
> curve = hw_discount_curve(i)
> forecastHandle.linkTo(curve)
> engine = ql.DiscountingSwapEngine(forecastHandle)
>
> swap = my_swaption.underlyingSwap()
>
> swap.setPricingEngine(engine)
> swap_npv = swap.NPV()
> sum_pv += max(0, swap_npv)
> return sum_pv / num_paths
>
> I was therefore hoping that by linking the forecastHandle to each
> path-wise stochastic curve, the libor 3m index would also be path
> dependent. but somehow, that doesn't appear to be the case, as the floating
> rates for each reset do not change with each stochastic curve. So I am
> wondering what I am doing wrong?
>
> Help appreciated.
>
> Philippe Hatstadt
>
>
>
> Broker-Dealer services offered through Exos Securities LLC, member of SIPC
> <http://www.sipc.org/> / FINRA <http://www.finra.org/> / BrokerCheck
> <https://brokercheck.finra.org/>/ 2021 Exos, inc. For important
> disclosures, click here
> <https://www.exosfinancial.com/general-disclosures>.
>
>
> _______________________________________________
> 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
>
>
>
>
> Broker-Dealer services offered through Exos Securities LLC, member of SIPC
> <http://www.sipc.org/> / FINRA <http://www.finra.org/> / BrokerCheck
> <https://brokercheck.finra.org/>/ 2021 Exos, inc. For important
> disclosures, click here
> <https://www.exosfinancial.com/general-disclosures>.
>
>
> _______________________________________________
> QuantLib-users mailing list
> Qua...@li...
> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>
|
|
From: Philippe H. <phi...@ex...> - 2021-04-02 11:02:39
|
Thank you. I’m not sure about the exact steps to clone the libor index? I assume I would create an index inside the MC loop and link its curve to my stochastic curve, but how do I “assign” such index to a swap that already exists? Regards Philippe Hatstadt +1-203-252-0408 https://www.linkedin.com/in/philippe-hatstadt > On Apr 2, 2021, at 3:23 AM, Amine Ifri <ami...@gm...> wrote: > > Hi Philippe, > > I believe your forecastHandle variable - which is set to the MC curve generated for scénario i - is actually used for discounting only. discountingSwapEngine only affects the discounting and not the curves upon which the floating index is dependent. > > You need to “clone” the libor 3m index for your underlying swap and relink its curve to a MC curve as well. > > Amine Ifri > >>> On 2 Apr 2021, at 04:11, Philippe Hatstadt <phi...@ex...> wrote: >>> >> >> I have built a Hull-White sequence via standard method, by following precisely the method in the QuantLib Cookbook, with sigma = 10% and mean_rev = 10%. >> My goal is to ultimately build an OAS model for some Agency CMOs, for which I am building a Monte-carlo engine. >> I also built a Jamshidian engine to compute a closed-form value of a european swaption as a test, to make sure that my MC valuation converges to the theoretical value. >> The convergence doesn't work, and I think it has to do with the floating index of the swaption, so let me explain. >> >> I first build a curve name forecastHandle of type ql.RelinkableYieldTermStructureHandle >> I then build a swaption object via my own build_swaption() function, along the lines of the swaption helpers from the Cookbook approach, which returns a ql.Swaption() object. The curve handle is passed to the build_swaption() call along with tenor, maturity and strike. >> I build the floating index as follows inside the function: >> libor_3m = ql.USDLibor(ql.Period('3M'), forecastHandle) >> >> Now switching to the MC calculation. I loop on all the sequences of short-term rates generated by my HW sequence. I verified that the expected value and the variance of the short-rate are the same as in the Cookbook. >> Lastly, in order to calculate the value of the swaption via MC integration, I do the following, which takes place inside a function called swaption_MC(forecastHandle, my_swaption). Importantly, forecastHandle is the same handle that was used to build the swaption, including its libor_3m index. >> for i in range(num_paths): >> curve = hw_discount_curve(i) >> forecastHandle.linkTo(curve) >> engine = ql.DiscountingSwapEngine(forecastHandle) >> swap = my_swaption.underlyingSwap() >> swap.setPricingEngine(engine) >> swap_npv = swap.NPV() >> sum_pv += max(0, swap_npv) >> return sum_pv / num_paths >> I was therefore hoping that by linking the forecastHandle to each path-wise stochastic curve, the libor 3m index would also be path dependent. but somehow, that doesn't appear to be the case, as the floating rates for each reset do not change with each stochastic curve. So I am wondering what I am doing wrong? >> >> Help appreciated. >> >> Philippe Hatstadt >> >> >> >> Broker-Dealer services offered through Exos Securities LLC, member of SIPC / FINRA / BrokerCheck / 2021 Exos, inc. For important disclosures, click here. >> >> _______________________________________________ >> 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 -- Broker-Dealer services offered through Exos Securities LLC, member of SIPC <http://www.sipc.org/> / FINRA <http://www.finra.org/> / BrokerCheck <https://brokercheck.finra.org/>/ 2021 Exos, inc. For important disclosures, click here <https://www.exosfinancial.com/general-disclosures>. |
|
From: Amine I. <ami...@gm...> - 2021-04-02 07:22:46
|
Hi Philippe,
I believe your forecastHandle variable - which is set to the MC curve generated for scénario i - is actually used for discounting only. discountingSwapEngine only affects the discounting and not the curves upon which the floating index is dependent.
You need to “clone” the libor 3m index for your underlying swap and relink its curve to a MC curve as well.
Amine Ifri
> On 2 Apr 2021, at 04:11, Philippe Hatstadt <phi...@ex...> wrote:
>
>
> I have built a Hull-White sequence via standard method, by following precisely the method in the QuantLib Cookbook, with sigma = 10% and mean_rev = 10%.
> My goal is to ultimately build an OAS model for some Agency CMOs, for which I am building a Monte-carlo engine.
> I also built a Jamshidian engine to compute a closed-form value of a european swaption as a test, to make sure that my MC valuation converges to the theoretical value.
> The convergence doesn't work, and I think it has to do with the floating index of the swaption, so let me explain.
>
> I first build a curve name forecastHandle of type ql.RelinkableYieldTermStructureHandle
> I then build a swaption object via my own build_swaption() function, along the lines of the swaption helpers from the Cookbook approach, which returns a ql.Swaption() object. The curve handle is passed to the build_swaption() call along with tenor, maturity and strike.
> I build the floating index as follows inside the function:
> libor_3m = ql.USDLibor(ql.Period('3M'), forecastHandle)
>
> Now switching to the MC calculation. I loop on all the sequences of short-term rates generated by my HW sequence. I verified that the expected value and the variance of the short-rate are the same as in the Cookbook.
> Lastly, in order to calculate the value of the swaption via MC integration, I do the following, which takes place inside a function called swaption_MC(forecastHandle, my_swaption). Importantly, forecastHandle is the same handle that was used to build the swaption, including its libor_3m index.
> for i in range(num_paths):
> curve = hw_discount_curve(i)
> forecastHandle.linkTo(curve)
> engine = ql.DiscountingSwapEngine(forecastHandle)
> swap = my_swaption.underlyingSwap()
> swap.setPricingEngine(engine)
> swap_npv = swap.NPV()
> sum_pv += max(0, swap_npv)
> return sum_pv / num_paths
> I was therefore hoping that by linking the forecastHandle to each path-wise stochastic curve, the libor 3m index would also be path dependent. but somehow, that doesn't appear to be the case, as the floating rates for each reset do not change with each stochastic curve. So I am wondering what I am doing wrong?
>
> Help appreciated.
>
> Philippe Hatstadt
>
>
>
> Broker-Dealer services offered through Exos Securities LLC, member of SIPC / FINRA / BrokerCheck / 2021 Exos, inc. For important disclosures, click here.
>
> _______________________________________________
> QuantLib-users mailing list
> Qua...@li...
> https://lists.sourceforge.net/lists/listinfo/quantlib-users
|
|
From: Philippe H. <phi...@ex...> - 2021-04-02 03:08:47
|
I have built a Hull-White sequence via standard method, by following
precisely the method in the QuantLib Cookbook, with sigma = 10% and
mean_rev = 10%.
My goal is to ultimately build an OAS model for some Agency CMOs, for which
I am building a Monte-carlo engine.
I also built a Jamshidian engine to compute a closed-form value of a
european swaption as a test, to make sure that my MC valuation converges to
the theoretical value.
The convergence doesn't work, and I think it has to do with the
floating index of the swaption, so let me explain.
I first build a curve name forecastHandle of type
ql.RelinkableYieldTermStructureHandle
I then build a swaption object via my own build_swaption() function, along
the lines of the swaption helpers from the Cookbook approach, which returns
a ql.Swaption() object. The curve handle is passed to the build_swaption()
call along with tenor, maturity and strike.
I build the floating index as follows inside the function:
libor_3m = ql.USDLibor(ql.Period('3M'), forecastHandle)
Now switching to the MC calculation. I loop on all the sequences of
short-term rates generated by my HW sequence. I verified that the expected
value and the variance of the short-rate are the same as in the Cookbook.
Lastly, in order to calculate the value of the swaption via MC integration,
I do the following, which takes place inside a function called
swaption_MC(forecastHandle, my_swaption). Importantly, forecastHandle is
the same handle that was used to build the swaption, including its libor_3m
index.
for i in range(num_paths):
curve = hw_discount_curve(i)
forecastHandle.linkTo(curve)
engine = ql.DiscountingSwapEngine(forecastHandle)
swap = my_swaption.underlyingSwap()
swap.setPricingEngine(engine)
swap_npv = swap.NPV()
sum_pv += max(0, swap_npv)
return sum_pv / num_paths
I was therefore hoping that by linking the forecastHandle to each path-wise
stochastic curve, the libor 3m index would also be path dependent. but
somehow, that doesn't appear to be the case, as the floating rates for each
reset do not change with each stochastic curve. So I am wondering what I am
doing wrong?
Help appreciated.
Philippe Hatstadt
--
Broker-Dealer services offered through Exos Securities LLC, member
of SIPC <http://www.sipc.org/> / FINRA <http://www.finra.org/> /
BrokerCheck <https://brokercheck.finra.org/>/ 2021 Exos, inc. For
important disclosures, click here
<https://www.exosfinancial.com/general-disclosures>.
|
|
From: Luigi B. <lui...@gm...> - 2021-04-01 13:24:00
|
Hello everybody,
I published release candidates for version 1.22 at <
https://github.com/lballabio/QuantLib/releases/tag/1.22rc>. If you have
some time in the next week or two, I'd appreciate your feedback.
Have a nice Easter break,
Luigi
|
|
From: Ashwani S. <ash...@gm...> - 2021-03-31 23:39:10
|
Using isda-cds.py <https://github.com/lballabio/QuantLib-SWIG/blob/master/Python/examples/isda-engine.py> example to compare with Bloomberg ISDA Standard Upfront Model but the difference between QL fairUpfront and that from BBG is much larger than the precision set. Running just for 40% recovery and 1000 bps case while looping through 5 maturities (1Y-5Y). Results (as below): Hazard Upfront Market Value Distance Within tolerance 0 0.17 -1.00e+06 -1003010 554.96 False 1 0.17 -1.68e+06 -1682459 641.48 False 2 0.17 -2.25e+06 -2253350 426.70 False 3 0.17 -2.73e+06 -2727484 62.97 False 4 0.17 -3.12e+06 -3120142 458.70 False total distance: 2144.81 Anyone who might have tried this, could you please point the obvious mistake I am committing here? Code attached. Thanks. |
|
From: Jonathan L. <jle...@gm...> - 2021-03-30 15:34:06
|
Hello, I was wondering if it's possible to use the Heston model for pricing options in the Excel add-in. I've seen many examples of a Python implementation and some in C++. Is this possible in Excel? If so, how would I go about doing that? Thank you! Kind regards, J Get Outlook for iOS<https://aka.ms/o0ukef> |
|
From: jian Xu <jia...@gm...> - 2021-03-26 04:46:30
|
Oh, that works! Thanks a lot! On Thu, Mar 25, 2021 at 9:06 PM Mike DelMedico <mik...@gm...> wrote: > > Hi there. Try using: > > ql.ActualActual(ql.ActualActual.ISMA) > > That should work for UST. > > Best, > Mike > > > On Thu, Mar 25, 2021 at 20:42 jian Xu <jia...@gm...> wrote: >> >> Hi, >> In QuantLib, given a semi-annual FixedRateBond with 1% coupon, and >> Actual/Actual day count convention, the actual coupon payment amount >> varies. >> >> But my understanding is that the DCC only affects the accrual >> calculation, not the actual coupon payment amount. Is this correct? >> A check on the Bloomberg terminal seems to confirm this, since any >> Act/Act bond also shows the coupon amount to be constant. >> >> So why is QuantLib different from Bloomberg? Which one is correct in >> reality? (US bond market). Thank you very much. >> >> Following is a piece of code to produce the varying coupon in Python: >> >> import numpy as np >> import pandas as pd >> import QuantLib as ql >> >> acc_start = ql.Date(15, 2, 2020) >> maturity = ql.Date(15, 2, 2025) >> end_of_month = False >> calendar = ql.UnitedStates(ql.UnitedStates.GovernmentBond) >> period = ql.Period(ql.Semiannual) >> accrual_convention = ql.Unadjusted >> date_gen_rule = ql.DateGeneration.Backward >> >> schedule = ql.MakeSchedule(effectiveDate=acc_start, >> terminationDate=maturity, >> tenor=period, >> calendar=calendar, >> convention=accrual_convention, >> rule=date_gen_rule, >> endOfMonth=end_of_month) >> >> face = 100 >> redemption = 100 >> issue_date = ql.Date(16, 2, 2020) >> day_count = ql.ActualActual() >> coupon = 0.01 >> days_settle = 2 >> payment_convention = ql.ModifiedFollowing >> >> bond = ql.FixedRateBond(days_settle, face, schedule, [coupon], >> day_count, payment_convention, redemption, issue_date) >> >> Then [(cf.date(), cf.amount()) for cf in bond.cashflows()] shows the >> amount is not constant. >> >> >> _______________________________________________ >> QuantLib-users mailing list >> Qua...@li... >> https://lists.sourceforge.net/lists/listinfo/quantlib-users |