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
(5) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Ashwani S. <ash...@gm...> - 2021-03-04 14:01:22
|
Thanks Alix. I saw another post with similar problem this morning which was useful, here is the link <https://quant.stackexchange.com/questions/59269/quantlib-calibrating-hull-white-one-factor-on-negative-interest-rates> Updated the SwaptionHelper as you suggested (code below) and now it works. helper = ql.SwaptionHelper(ql.Period(d.start, ql.Years), ql.Period(d.length, ql.Years), ql.QuoteHandle(ql.SimpleQuote(d.volatility)), ql.USDLibor(ql.Period(3, ql.Months), term_structure), ql.Period('1Y'), ql.Actual360(), ql.Actual360(), term_structure, ql.BlackCalibrationHelper.RelativePriceError, ql.nullDouble(), 1.0, ql.Normal, 0.0, ) On Thu, Mar 4, 2021 at 6:16 AM Alix Lassauzet <ali...@gm...> wrote: > Hi, > > The constructor of a SwaptionHelper object does not look correct to me. > Take a look on the 3 différents ways to instantiate this class: > > C++ > > https://github.com/lballabio/QuantLib/blob/master/ql/models/shortrate/calibrationhelpers/swaptionhelper.hpp > > Swig > > https://github.com/lballabio/QuantLib-SWIG/blob/master/SWIG/calibrationhelpers.i > > Alix > > > Le jeu. 4 mars 2021 à 02:44, Ashwani Singh <ash...@gm...> a > écrit : > >> Looked into archeived messages but couldn't find anything relevant. I am >> trying to calibrate Hull White model using Goutam's code here >> <http://gouthamanbalaraman.com/blog/short-interest-rate-model-calibration-quantlib.html> with >> a tweak that instead of using flatForward term_structure, I am using >> ql.PiecewiseCubicZero(calc_date, bond_helpers, day_count) calibrated to US >> Treasuries. >> >> I suspect the error has to do with negative rates, but here is the piece >> of code which throws an error when I try running it >> >> swaptions = [] >> index = ql.USDLibor(ql.Period(3, ql.Months), term_structure) >> >> # Read US Swaptions vol data >> CalibrationData = namedtuple("CalibrationData", >> "start, length, volatility") >> data = [CalibrationData(1, 5, 0.1148), >> CalibrationData(2, 4, 0.1108), >> CalibrationData(3, 3, 0.1070), >> CalibrationData(4, 2, 0.1021), >> CalibrationData(5, 1, 0.1000 )] >> >> for d in data: >> vol_handle = ql.QuoteHandle(ql.SimpleQuote(d.volatility)) >> helper = ql.SwaptionHelper(ql.Period(d.start, ql.Years), >> ql.Period(d.length, ql.Years), >> vol_handle, >> index, >> index.tenor(), >> day_count, >> day_count, >> term_structure, >> ql.Normal, >> ) >> helper.setPricingEngine(engine) >> swaptions.append(helper) >> >> optimization_method = ql.LevenbergMarquardt(1.0e-8,1.0e-8,1.0e-8) >> end_criteria = ql.EndCriteria(10000, 100, 1e-6, 1e-8, 1e-8) >> model.calibrate(swaptions, optimization_method, end_criteria) >> >> >> ---------------------------------------------------------------------------RuntimeError Traceback (most recent call last)<ipython-input-78-1c3c09dff89b> in <module> 24 model = ql.HullWhite(yield_curve_handle) 25 engine = ql.JamshidianSwaptionEngine(model)---> 26 alpha, sigma = calibrate_hullwhite(yield_curve_handle, engine, model, day_count) 27 28 # Generate HW simulation paths >> <ipython-input-77-cab060688d5e> in calibrate_hullwhite(term_structure, engine, model, day_count) 32 optimization_method = ql.LevenbergMarquardt(1.0e-8,1.0e-8,1.0e-8) 33 end_criteria = ql.EndCriteria(10000, 100, 1e-6, 1e-8, 1e-8)---> 34 model.calibrate(swaptions, optimization_method, end_criteria) 35 36 return model.params() >> ~\AppData\Local\anaconda3\lib\site-packages\quantlib-1.21-py3.8-win-amd64.egg\QuantLib\QuantLib.py in calibrate(self, *args) 11289 > 11291 return _QuantLib.CalibratedModel_calibrate(self, *args) >> >> 11290 def calibrate(self, *args): >> >> 11292 11293 def setParams(self, params): RuntimeError: strike + >> displacement (-0.0114291 + 0) must be non-negative >> >> >> >> Any suggestions would be appreciated. >> >> Thanks. >> >> _______________________________________________ >> QuantLib-users mailing list >> Qua...@li... >> https://lists.sourceforge.net/lists/listinfo/quantlib-users >> > |
|
From: Alix L. <ali...@gm...> - 2021-03-04 06:16:41
|
Hi, The constructor of a SwaptionHelper object does not look correct to me. Take a look on the 3 différents ways to instantiate this class: C++ https://github.com/lballabio/QuantLib/blob/master/ql/models/shortrate/calibrationhelpers/swaptionhelper.hpp Swig https://github.com/lballabio/QuantLib-SWIG/blob/master/SWIG/calibrationhelpers.i Alix Le jeu. 4 mars 2021 à 02:44, Ashwani Singh <ash...@gm...> a écrit : > Looked into archeived messages but couldn't find anything relevant. I am > trying to calibrate Hull White model using Goutam's code here > <http://gouthamanbalaraman.com/blog/short-interest-rate-model-calibration-quantlib.html> with > a tweak that instead of using flatForward term_structure, I am using > ql.PiecewiseCubicZero(calc_date, bond_helpers, day_count) calibrated to US > Treasuries. > > I suspect the error has to do with negative rates, but here is the piece > of code which throws an error when I try running it > > swaptions = [] > index = ql.USDLibor(ql.Period(3, ql.Months), term_structure) > > # Read US Swaptions vol data > CalibrationData = namedtuple("CalibrationData", > "start, length, volatility") > data = [CalibrationData(1, 5, 0.1148), > CalibrationData(2, 4, 0.1108), > CalibrationData(3, 3, 0.1070), > CalibrationData(4, 2, 0.1021), > CalibrationData(5, 1, 0.1000 )] > > for d in data: > vol_handle = ql.QuoteHandle(ql.SimpleQuote(d.volatility)) > helper = ql.SwaptionHelper(ql.Period(d.start, ql.Years), > ql.Period(d.length, ql.Years), > vol_handle, > index, > index.tenor(), > day_count, > day_count, > term_structure, > ql.Normal, > ) > helper.setPricingEngine(engine) > swaptions.append(helper) > > optimization_method = ql.LevenbergMarquardt(1.0e-8,1.0e-8,1.0e-8) > end_criteria = ql.EndCriteria(10000, 100, 1e-6, 1e-8, 1e-8) > model.calibrate(swaptions, optimization_method, end_criteria) > > > ---------------------------------------------------------------------------RuntimeError Traceback (most recent call last)<ipython-input-78-1c3c09dff89b> in <module> 24 model = ql.HullWhite(yield_curve_handle) 25 engine = ql.JamshidianSwaptionEngine(model)---> 26 alpha, sigma = calibrate_hullwhite(yield_curve_handle, engine, model, day_count) 27 28 # Generate HW simulation paths > <ipython-input-77-cab060688d5e> in calibrate_hullwhite(term_structure, engine, model, day_count) 32 optimization_method = ql.LevenbergMarquardt(1.0e-8,1.0e-8,1.0e-8) 33 end_criteria = ql.EndCriteria(10000, 100, 1e-6, 1e-8, 1e-8)---> 34 model.calibrate(swaptions, optimization_method, end_criteria) 35 36 return model.params() > ~\AppData\Local\anaconda3\lib\site-packages\quantlib-1.21-py3.8-win-amd64.egg\QuantLib\QuantLib.py in calibrate(self, *args) 11289 > 11291 return _QuantLib.CalibratedModel_calibrate(self, *args) > > 11290 def calibrate(self, *args): > > 11292 11293 def setParams(self, params): RuntimeError: strike + > displacement (-0.0114291 + 0) must be non-negative > > > > Any suggestions would be appreciated. > > Thanks. > > _______________________________________________ > QuantLib-users mailing list > Qua...@li... > https://lists.sourceforge.net/lists/listinfo/quantlib-users > |
|
From: Ashwani S. <ash...@gm...> - 2021-03-04 01:43:33
|
Looked into archeived messages but couldn't find anything relevant. I am trying to calibrate Hull White model using Goutam's code here <http://gouthamanbalaraman.com/blog/short-interest-rate-model-calibration-quantlib.html> with a tweak that instead of using flatForward term_structure, I am using ql.PiecewiseCubicZero(calc_date, bond_helpers, day_count) calibrated to US Treasuries. I suspect the error has to do with negative rates, but here is the piece of code which throws an error when I try running it swaptions = [] index = ql.USDLibor(ql.Period(3, ql.Months), term_structure) # Read US Swaptions vol data CalibrationData = namedtuple("CalibrationData", "start, length, volatility") data = [CalibrationData(1, 5, 0.1148), CalibrationData(2, 4, 0.1108), CalibrationData(3, 3, 0.1070), CalibrationData(4, 2, 0.1021), CalibrationData(5, 1, 0.1000 )] for d in data: vol_handle = ql.QuoteHandle(ql.SimpleQuote(d.volatility)) helper = ql.SwaptionHelper(ql.Period(d.start, ql.Years), ql.Period(d.length, ql.Years), vol_handle, index, index.tenor(), day_count, day_count, term_structure, ql.Normal, ) helper.setPricingEngine(engine) swaptions.append(helper) optimization_method = ql.LevenbergMarquardt(1.0e-8,1.0e-8,1.0e-8) end_criteria = ql.EndCriteria(10000, 100, 1e-6, 1e-8, 1e-8) model.calibrate(swaptions, optimization_method, end_criteria) ---------------------------------------------------------------------------RuntimeError Traceback (most recent call last)<ipython-input-78-1c3c09dff89b> in <module> 24 model = ql.HullWhite(yield_curve_handle) 25 engine = ql.JamshidianSwaptionEngine(model)---> 26 alpha, sigma = calibrate_hullwhite(yield_curve_handle, engine, model, day_count) 27 28 # Generate HW simulation paths <ipython-input-77-cab060688d5e> in calibrate_hullwhite(term_structure, engine, model, day_count) 32 optimization_method = ql.LevenbergMarquardt(1.0e-8,1.0e-8,1.0e-8) 33 end_criteria = ql.EndCriteria(10000, 100, 1e-6, 1e-8, 1e-8)---> 34 model.calibrate(swaptions, optimization_method, end_criteria) 35 36 return model.params() ~\AppData\Local\anaconda3\lib\site-packages\quantlib-1.21-py3.8-win-amd64.egg\QuantLib\QuantLib.py in calibrate(self, *args) 11289 > 11291 return _QuantLib.CalibratedModel_calibrate(self, *args) 11290 def calibrate(self, *args): 11292 11293 def setParams(self, params): RuntimeError: strike + displacement (-0.0114291 + 0) must be non-negative Any suggestions would be appreciated. Thanks. |
|
From: Sumit S. <su...@mo...> - 2021-03-02 20:32:03
|
Thanks a lot Francois. I set the day_count to the following.. day_count = ql.ActualActual(ql.ActualActual.Bond, schedule) I then managed to match the cashflows. Regards Sumit On Mon, 1 Mar 2021 at 11:52, Francois Botha <ig...@gm...> wrote: > Hi Sumit, > > I'm not very familiar with all the details of other countries' treasury > bonds, but are you sure that the first coupon is only a partial coupon > payment instead of the full 0.8125 ? > > If I enter a bond issue date of e.g. 2020-06-15 in my Schedule > constructor, then all the bond coupons are 0.8125 and I get an accrued > interest amount on settlement date 2021-02-23 of 0.3125. However, I also > get a yield of 0.17% at settlement date as you did originally. > > One more thing... as I say I'm not familiar with your bonds, but South > African government bonds use a business day convention of FOLLOWING, not > MODFOL. In your example, it wouldn't make a difference though. > > Hope this helps. > > regards, > Francois Botha > > > On Mon, 1 Mar 2021 at 13:27, Sumit Sengupta <su...@mo...> > wrote: > >> Just a follow up. I made this change to the day_count which seems to have >> resolved the cashflows. >> *day_count = ql.ActualActual(ql.ActualActual.Bond,schedule)* >> >> However, the accrued amount looks incorrect. >> fixedRateBond.accruedAmount() gives me a value of 0.004 which is far too >> small. It should be in the region of around 0.31 >> >> Any help would be appreciated.. >> >> Thanks, >> Sumit >> >> On Mon, 1 Mar 2021 at 11:08, Sumit Sengupta <su...@mo...> >> wrote: >> >>> Hi, >>> >>> I have the following code to calculate the yield of a Treasury bond. >>> >>> The issue I have is the code gives a yield of 0.17% - which is much >>> higher than the expected 0.13% >>> >>> Looking at the cashflows, it gives me the below.... >>> Date Amount Expected >>> Date(15,6,2021) 0.5031 >>> Date(15,12,2021) 0.8147 0.8125 >>> Date(15,6,2022) 0.8103 0.8125 >>> Date(15,12,2022) 0.8147 0.8125 >>> Date(15,12,2022) 100 >>> Any thoughts? >>> >>> Thanks, >>> Sumit >>> >>> calc_date = ql.Date(22,2,2021) >>> ql.Settings.instance().evaluationDate = calc_date >>> day_count = ql.ActualActual() >>> calendar = ql.UnitedStates() >>> bussiness_convention = ql.ModifiedFollowing >>> end_of_month = True >>> settlement_days = 1 >>> face_amount = 100 >>> coupon_frequency = ql.Period(ql.Semiannual) >>> >>> price = 102.625 >>> coupon = 1.625/100 >>> maturity_date = ql.Date(15, 12, 2022) >>> # issue_date = ql.Date(1, 2, 2021) >>> coupon_frequency = ql.Period(6, ql.Months) >>> >>> schedule = ql.Schedule(calc_date, >>> maturity_date, >>> coupon_frequency, >>> calendar, >>> bussiness_convention, >>> bussiness_convention, >>> ql.DateGeneration.Backward, >>> end_of_month) >>> fixedRateBond = ql.FixedRateBond( >>> settlement_days, >>> face_amount, >>> schedule, >>> [coupon], >>> ql.ActualActual() >>> ) >>> yld = fixedRateBond.bondYield(price, ql.ActualActual(),ql.Compounded, >>> ql.Semiannual) >>> yld * 100 >>> [x.amount()for x in fixedRateBond.cashflows()] >>> >>> >>> >>> -- >>> Mosaic Smart Data >>> >>> mobile +44 (0)7961839363 >>> su...@mo... >>> 25 Finsbury Circus ▫ EC2M 7EE ▫ London ▫ United Kingdom >>> www.mosaicsmartdata.com >>> >> >> >> -- >> Mosaic Smart Data >> >> mobile +44 (0)7961839363 >> su...@mo... >> 25 Finsbury Circus ▫ EC2M 7EE ▫ London ▫ United Kingdom >> www.mosaicsmartdata.com >> _______________________________________________ >> QuantLib-users mailing list >> Qua...@li... >> https://lists.sourceforge.net/lists/listinfo/quantlib-users >> > -- Mosaic Smart Data mobile +44 (0)7961839363 su...@mo... 25 Finsbury Circus ▫ EC2M 7EE ▫ London ▫ United Kingdom www.mosaicsmartdata.com |
|
From: Luigi B. <lui...@gm...> - 2021-03-02 19:58:43
|
Hi,
the QuantLib-SWIG version in master is not yet up to date with the
latest changes in the library's master. For the time being, use the latest
released version instead.
Luigi
On Tue, Mar 2, 2021 at 6:54 PM S.J. Liu via QuantLib-users <
qua...@li...> wrote:
> Quantlib-SWIG make -C Java error: NettingType is not a member of
> QuantLib::OvernightIndexFuture
> <https://stackoverflow.com/questions/66443912/quantlib-swig-make-c-java-error-nettingtype-is-not-a-member-of-quantlibov?r=SearchResults>
>
>
> Quantlib-SWIG make -C Java error: NettingType is not a member of
> QuantLib::OvernightIndexFuture
>
> I cloned Quantlib from GitHub, make and install it fine. I also cloned
> Quantlib-swig. make -C Java or make-C Python get the same error about
> NettingType not a member of OvernightIndexFuture. ( I u...
>
> <https://stackoverflow.com/questions/66443912/quantlib-swig-make-c-java-error-nettingtype-is-not-a-member-of-quantlibov?r=SearchResults>
>
> Hi All,
>
> Does anyone have the same problem? I was using the most recent code and
> trying to build on Linux Ubuntu.
>
> Thanks.
> _______________________________________________
> QuantLib-users mailing list
> Qua...@li...
> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>
|
|
From: S.J. L. <sjl...@ya...> - 2021-03-02 17:48:52
|
Quantlib-SWIG make -C Java error: NettingType is not a member of QuantLib::OvernightIndexFuture | | | | | | | | | | | Quantlib-SWIG make -C Java error: NettingType is not a member of QuantLib::OvernightIndexFuture I cloned Quantlib from GitHub, make and install it fine. I also cloned Quantlib-swig. make -C Java or make-C Python get the same error about NettingType not a member of OvernightIndexFuture.( I u... | | | | Hi All, Does anyone have the same problem? I was using the most recent code and trying to build on Linux Ubuntu. Thanks. |
|
From: SX L <han...@ho...> - 2021-03-02 13:43:03
|
I am not sure if similar questions have been asked before. Say, I have an EQ and FX hybrid payoff, and I decide to use MC to price it. How to handle the different Vol DCCs for EQ and FX? You know, for certain day, it could be a biz day for FX, but holiday for EQ (vol = 0). |
|
From: Francois B. <ig...@gm...> - 2021-03-01 11:52:59
|
Hi Sumit, I'm not very familiar with all the details of other countries' treasury bonds, but are you sure that the first coupon is only a partial coupon payment instead of the full 0.8125 ? If I enter a bond issue date of e.g. 2020-06-15 in my Schedule constructor, then all the bond coupons are 0.8125 and I get an accrued interest amount on settlement date 2021-02-23 of 0.3125. However, I also get a yield of 0.17% at settlement date as you did originally. One more thing... as I say I'm not familiar with your bonds, but South African government bonds use a business day convention of FOLLOWING, not MODFOL. In your example, it wouldn't make a difference though. Hope this helps. regards, Francois Botha On Mon, 1 Mar 2021 at 13:27, Sumit Sengupta <su...@mo...> wrote: > Just a follow up. I made this change to the day_count which seems to have > resolved the cashflows. > *day_count = ql.ActualActual(ql.ActualActual.Bond,schedule)* > > However, the accrued amount looks incorrect. > fixedRateBond.accruedAmount() gives me a value of 0.004 which is far too > small. It should be in the region of around 0.31 > > Any help would be appreciated.. > > Thanks, > Sumit > > On Mon, 1 Mar 2021 at 11:08, Sumit Sengupta <su...@mo...> > wrote: > >> Hi, >> >> I have the following code to calculate the yield of a Treasury bond. >> >> The issue I have is the code gives a yield of 0.17% - which is much >> higher than the expected 0.13% >> >> Looking at the cashflows, it gives me the below.... >> Date Amount Expected >> Date(15,6,2021) 0.5031 >> Date(15,12,2021) 0.8147 0.8125 >> Date(15,6,2022) 0.8103 0.8125 >> Date(15,12,2022) 0.8147 0.8125 >> Date(15,12,2022) 100 >> Any thoughts? >> >> Thanks, >> Sumit >> >> calc_date = ql.Date(22,2,2021) >> ql.Settings.instance().evaluationDate = calc_date >> day_count = ql.ActualActual() >> calendar = ql.UnitedStates() >> bussiness_convention = ql.ModifiedFollowing >> end_of_month = True >> settlement_days = 1 >> face_amount = 100 >> coupon_frequency = ql.Period(ql.Semiannual) >> >> price = 102.625 >> coupon = 1.625/100 >> maturity_date = ql.Date(15, 12, 2022) >> # issue_date = ql.Date(1, 2, 2021) >> coupon_frequency = ql.Period(6, ql.Months) >> >> schedule = ql.Schedule(calc_date, >> maturity_date, >> coupon_frequency, >> calendar, >> bussiness_convention, >> bussiness_convention, >> ql.DateGeneration.Backward, >> end_of_month) >> fixedRateBond = ql.FixedRateBond( >> settlement_days, >> face_amount, >> schedule, >> [coupon], >> ql.ActualActual() >> ) >> yld = fixedRateBond.bondYield(price, ql.ActualActual(),ql.Compounded, >> ql.Semiannual) >> yld * 100 >> [x.amount()for x in fixedRateBond.cashflows()] >> >> >> >> -- >> Mosaic Smart Data >> >> mobile +44 (0)7961839363 >> su...@mo... >> 25 Finsbury Circus ▫ EC2M 7EE ▫ London ▫ United Kingdom >> www.mosaicsmartdata.com >> > > > -- > Mosaic Smart Data > > mobile +44 (0)7961839363 > su...@mo... > 25 Finsbury Circus ▫ EC2M 7EE ▫ London ▫ United Kingdom > www.mosaicsmartdata.com > _______________________________________________ > QuantLib-users mailing list > Qua...@li... > https://lists.sourceforge.net/lists/listinfo/quantlib-users > |
|
From: Sumit S. <su...@mo...> - 2021-03-01 11:36:24
|
Hi,
I have the following code to calculate the yield of a Treasury bond.
The issue I have is the code gives a yield of 0.17% - which is much higher
than the expected 0.13%
Looking at the cashflows, it gives me the below....
Date Amount Expected
Date(15,6,2021) 0.5031
Date(15,12,2021) 0.8147 0.8125
Date(15,6,2022) 0.8103 0.8125
Date(15,12,2022) 0.8147 0.8125
Date(15,12,2022) 100
Any thoughts?
Thanks,
Sumit
calc_date = ql.Date(22,2,2021)
ql.Settings.instance().evaluationDate = calc_date
day_count = ql.ActualActual()
calendar = ql.UnitedStates()
bussiness_convention = ql.ModifiedFollowing
end_of_month = True
settlement_days = 1
face_amount = 100
coupon_frequency = ql.Period(ql.Semiannual)
price = 102.625
coupon = 1.625/100
maturity_date = ql.Date(15, 12, 2022)
# issue_date = ql.Date(1, 2, 2021)
coupon_frequency = ql.Period(6, ql.Months)
schedule = ql.Schedule(calc_date,
maturity_date,
coupon_frequency,
calendar,
bussiness_convention,
bussiness_convention,
ql.DateGeneration.Backward,
end_of_month)
fixedRateBond = ql.FixedRateBond(
settlement_days,
face_amount,
schedule,
[coupon],
ql.ActualActual()
)
yld = fixedRateBond.bondYield(price, ql.ActualActual(),ql.Compounded,
ql.Semiannual)
yld * 100
[x.amount()for x in fixedRateBond.cashflows()]
--
Mosaic Smart Data
mobile +44 (0)7961839363
su...@mo...
25 Finsbury Circus ▫ EC2M 7EE ▫ London ▫ United Kingdom
www.mosaicsmartdata.com
|
|
From: Sumit S. <su...@mo...> - 2021-03-01 11:24:04
|
Just a follow up. I made this change to the day_count which seems to have resolved the cashflows. *day_count = ql.ActualActual(ql.ActualActual.Bond,schedule)* However, the accrued amount looks incorrect. fixedRateBond.accruedAmount() gives me a value of 0.004 which is far too small. It should be in the region of around 0.31 Any help would be appreciated.. Thanks, Sumit On Mon, 1 Mar 2021 at 11:08, Sumit Sengupta <su...@mo...> wrote: > Hi, > > I have the following code to calculate the yield of a Treasury bond. > > The issue I have is the code gives a yield of 0.17% - which is much > higher than the expected 0.13% > > Looking at the cashflows, it gives me the below.... > Date Amount Expected > Date(15,6,2021) 0.5031 > Date(15,12,2021) 0.8147 0.8125 > Date(15,6,2022) 0.8103 0.8125 > Date(15,12,2022) 0.8147 0.8125 > Date(15,12,2022) 100 > Any thoughts? > > Thanks, > Sumit > > calc_date = ql.Date(22,2,2021) > ql.Settings.instance().evaluationDate = calc_date > day_count = ql.ActualActual() > calendar = ql.UnitedStates() > bussiness_convention = ql.ModifiedFollowing > end_of_month = True > settlement_days = 1 > face_amount = 100 > coupon_frequency = ql.Period(ql.Semiannual) > > price = 102.625 > coupon = 1.625/100 > maturity_date = ql.Date(15, 12, 2022) > # issue_date = ql.Date(1, 2, 2021) > coupon_frequency = ql.Period(6, ql.Months) > > schedule = ql.Schedule(calc_date, > maturity_date, > coupon_frequency, > calendar, > bussiness_convention, > bussiness_convention, > ql.DateGeneration.Backward, > end_of_month) > fixedRateBond = ql.FixedRateBond( > settlement_days, > face_amount, > schedule, > [coupon], > ql.ActualActual() > ) > yld = fixedRateBond.bondYield(price, ql.ActualActual(),ql.Compounded, > ql.Semiannual) > yld * 100 > [x.amount()for x in fixedRateBond.cashflows()] > > > > -- > Mosaic Smart Data > > mobile +44 (0)7961839363 > su...@mo... > 25 Finsbury Circus ▫ EC2M 7EE ▫ London ▫ United Kingdom > www.mosaicsmartdata.com > -- Mosaic Smart Data mobile +44 (0)7961839363 su...@mo... 25 Finsbury Circus ▫ EC2M 7EE ▫ London ▫ United Kingdom www.mosaicsmartdata.com |
|
From: Luigi B. <lui...@gm...> - 2021-02-27 15:14:06
|
Hello,
the idea of using ForwardSpreadedTermStructure is correct, but as you
saw, currently there's no way to limit the spread between two dates.
To do that, you can modify the C++ class and add the functionality. The
constructor would take and store the two dates; the forwardImpl method
would add the spread only if between the two times corresponding to the
dates (accordingly to the day counter of the underlying term structure);
and the zeroYieldImpl method should add to the underlying curve the average
of the added spread from 0 to t, whose formula you can deduce.
If you do so, please consider contributing the changes as a pull request.
Regards,
Luigi
On Thu, Feb 4, 2021 at 12:23 AM T O <tm...@ho...> wrote:
> Hello,
>
> I have two somewhat unrelated questions.
>
> 1.) I was looking to implement Hagan's Delta risk hedging via waves. In
> order to calculate the box shifts in the instantaneous forward rate can I
> use the ForwardSpreadedTermStructure to revalue the portfolio? I don't
> actually see how you can set the spread between 2 dates, but was curious if
> there's a way.
>
>
> 2.) Is there a way to feed SwaptionVolMatrix and swaptionvolcube2 forward
> premiums directly to imply normal vols? or do I have to do this in steps.
> convert to spot prem and get implied vol for each point on the
> surface/cube.
>
> Thanks,
> TO
>
>
>
>
> Sent from Outlook <http://aka.ms/weboutlook>
> _______________________________________________
> QuantLib-users mailing list
> Qua...@li...
> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>
|
|
From: Edward L. <ed...@ed...> - 2021-02-24 07:11:07
|
Hi,
I am trying to calculate some of the second and third order greeks using QuantLib. At this stage I am maintaining three BlackScholesMertonProcess processes (standard; one for increased volatility; one for increased underlying price) and using those for some of the functions.
That said, I am struggling with how I can apply this approach to greeks such as vomma, speed, color, ultima, etc. Does anyone have any suggestions? I also hope the other ones I've got are correct.
# First order
def delta(self):
return self._ql_option.delta()
def vega(self):
return self._ql_option_for_vol_increase.NPV() - self._ql_option.NPV()
def theta(self):
return self._ql_option.theta()
def lambda(self):
return self._ql_option.delta() * (self._spot.value() / self._ql_option.NPV())
def elasticity(self):
return self.lambda()
# rho: not implemented - not a priority
# epsilon: not implemented - not a priority
# Second order
def gamma(self):
return self._ql_option.gamma()
def vanna(self):
return self._ql_option_for_vol_increase.delta() - self._ql_option.delta()
def charm(self):
return self._ql_option_for_price_increase.theta() - self._ql_option.theta()
# vomma: not implemented
# veta: not implemented
# vera: not implemented
# Third order
# speed: not implemented
def zomma(self):
return self._ql_option_for_vol_increase.gamma() - self._ql_option.gamma()
# color: not implemented
# ultima: not implemented
Thanks!
|
|
From: Krishnan <rkr...@gm...> - 2021-02-22 21:50:19
|
<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!-- /* Font Definitions */ @font-face {font-family:"Cambria Math"; panose-1:2 4 5 3 5 4 6 3 2 4;} @font-face {font-family:Calibri; panose-1:2 15 5 2 2 2 4 3 2 4;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {margin:0cm; font-size:11.0pt; font-family:"Calibri",sans-serif;} a:link, span.MsoHyperlink {mso-style-priority:99; color:blue; text-decoration:underline;} .MsoChpDefault {mso-style-type:export-only;} @page WordSection1 {size:612.0pt 792.0pt; margin:72.0pt 72.0pt 72.0pt 72.0pt;} div.WordSection1 {page:WordSection1;} --></style></head><body lang=EN-CA link=blue vlink="#954F72" style='word-wrap:break-word'><div class=WordSection1><p class=MsoNormal><span lang=EN-US>Please ignore my question. I think I have the answer.</span></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Sent from <a href="https://go.microsoft.com/fwlink/?LinkId=550986">Mail</a> for Windows 10</p><p class=MsoNormal><o:p> </o:p></p><div style='mso-element:para-border-div;border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal style='border:none;padding:0cm'><b>From: </b><a href="mailto:rkr...@gm...">Kishore Krishnan</a><br><b>Sent: </b>February 22, 2021 3:22 PM<br><b>To: </b><a href="mailto:qua...@li...">qua...@li...</a><br><b>Subject: </b>YearFraction method</p></div><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal>Hi,</p><div><p class=MsoNormal>I am using quantlib's year fraction method in Python as below:</p></div><div><p class=MsoNormal>t0 = ql_day_count.yearFraction(dt1, dt2). My day count is Actual Actual (ISMA) , I get a number that is significantly different from that in Excel. For example, dt1 is 2021-02-17 and dt2 is 2027-06-01. Quantlib returns a value of 6.25. Excel on the other hand returns a value of 6.285. I am using the basis as 1 (Actual/Actual) in Excel. I am trying to understand the difference. Would appreciate some help.</p></div><div><p class=MsoNormal>Thanks</p></div></div><p class=MsoNormal>Krish</p><p class=MsoNormal><o:p> </o:p></p></div></body></html> |
|
From: Kishore K. <rkr...@gm...> - 2021-02-22 20:22:51
|
Hi, I am using quantlib's year fraction method in Python as below: t0 = ql_day_count.yearFraction(dt1, dt2). My day count is Actual Actual (ISMA) , I get a number that is significantly different from that in Excel. For example, dt1 is 2021-02-17 and dt2 is 2027-06-01. Quantlib returns a value of 6.25. Excel on the other hand returns a value of 6.285. I am using the basis as 1 (Actual/Actual) in Excel. I am trying to understand the difference. Would appreciate some help. Thanks Krish |
|
From: jian Xu <jia...@gm...> - 2021-02-19 23:44:34
|
Oh, never mind, I found it. It's
ql.as_coupon(cashflow).
thanks anyway.
On Fri, Feb 19, 2021 at 5:40 PM jian Xu <jia...@gm...> wrote:
>
> Thank you so much Matthias and Luigi. So if I'm using Python, how do
> I downcast a cashflow object into a coupon object?
>
> On Fri, Feb 12, 2021 at 3:33 AM Matthias Siemering
> <mat...@gm...> wrote:
> >
> > Personally, I would consider QuantLib as a low-level layer in whatever financial application you want to create - unless you want to use it for some quick analysis in which case the Python (or R) bindings present a nice alternative, albeit not as feature-complete as the underlying C++ library.
> >
> > So, I would create a composite with a [FixedRate|FloatingRate]Bond instance for the pricing related functions and such attributes you would like to access on a frequent basis, e.g. DCM or frequency. Some FOSS actually follows this approach - I think, for instance ORE does something similar (maybe exposing properties as string rather than "strongly typed", but my memory about the OREData structures is a bit rusty).
> >
> > Otherwise, obviously Luigi's suggestion to parse the leg(s) and their flowlets is a good way to retrieve details you would like to see on a cashflow table of some kind. I was going to say that this works for FixedRateBond and FloatingRateBond, because those wrappers should leave you with only one leg. But other bond packages do allow you to specifiy more than one leg. The fixed-to-float example is an obvious one. Maybe also bonds with a fixed coupon as teaser and structured coupon period thereafter.
> >
> > By the way: Downcast, but no love for the visitor? Have been in the one or other battle about "Visitor pattern considered harmful", but maybe that is beyond the scope of the original question...
> >
> > struct CashflowVisitor : public Visitor<QuantLib::Coupon>
> > {
> > // some members
> > void visit(QuantLib::Coupon &coupon) override
> > {
> > someConsumer.consume(coupon.dayCounter());
> > }
> > };
> >
> > Frequency needs to be implied from the start and end dates, so using the leg info may not be desirable after all.
> >
> >
> >
> > On Fri, Feb 12, 2021 at 9:19 AM Luigi Ballabio <lui...@gm...> wrote:
> >>
> >> Given a bond in general, you can't. For instance, you might have a convertible fixed-to-floater where the first part of the bond pays annual fixed coupons and the second part pays semiannual floating-rate coupons, possibly with a different day count. What you might do is examine the coupons themselves: call bond.cashflows(), iterate over it, and for each of the cash flows try to downcast it to a coupon (using ext::dynamic_pointer_cast<Coupon>) and call its methods.
> >>
> >> Luigi
> >>
> >>
> >> On Fri, Feb 12, 2021 at 6:29 AM jian Xu <jia...@gm...> wrote:
> >>>
> >>> So given a bond in general, how to find out its accrual day count and
> >>> the payment frequency?
> >>>
> >>> On Thu, Feb 11, 2021 at 3:33 PM Luigi Ballabio <lui...@gm...> wrote:
> >>> >
> >>> > Hello,
> >>> > as Matthias says, FixedRateCoupon and FloatingRateCoupon are convenience classes used to build a bond, but don't have specific behavior. I'm not opposed to having them return some info, but I'd try to avoid storing too much extra data in them just for that purpose...
> >>> >
> >>> > Luigi
> >>> >
> >>> >
> >>> > On Thu, Feb 11, 2021 at 9:44 PM <mat...@gm...> wrote:
> >>> >>
> >>> >> Hello Jian,
> >>> >>
> >>> >> I can only guess, but maybe the classes FixedRateBond and FloatingRateBond were thought of as "easy wrappers" around the main Bond class - making it more convenient for users to create a Bond instance with floating or fixed coupon legs (or none, in case of ZeroCouponBond).
> >>> >>
> >>> >> Actually I can only find one reference for the "frequency" accessor - and that one is in a unit test to ensure that frequency setting is sort of ignored for a custom schedule.
> >>> >>
> >>> >> Curious to hear other opinions.
> >>> >>
> >>> >> Thanks,
> >>> >>
> >>> >> Matthias
> >>> >>
> >>> >>
> >>> >> -----Original Message-----
> >>> >> From: jian Xu <jia...@gm...>
> >>> >> Sent: Thursday, 11 February 2021 21:13
> >>> >> To: QuantLib users <qua...@li...>
> >>> >> Subject: [Quantlib-users] Why doesn't FloatingRateBond has dayCounter() and frequency()?
> >>> >>
> >>> >> Hi,
> >>> >>
> >>> >> I noticed that FixedRateBond has dayCounter() and frequency() methods, but the FloatingRateBond does not. What's the reason for that? It seems to me that dayCounter and frequency are equally valid concepts for floating and fixed rate bonds. Or am I missing something?
> >>> >> Thanks.
> >>> >>
> >>> >> Jian
> >>> >>
> >>> >>
> >>> >> _______________________________________________
> >>> >> 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: jian Xu <jia...@gm...> - 2021-02-19 23:40:43
|
Thank you so much Matthias and Luigi. So if I'm using Python, how do
I downcast a cashflow object into a coupon object?
On Fri, Feb 12, 2021 at 3:33 AM Matthias Siemering
<mat...@gm...> wrote:
>
> Personally, I would consider QuantLib as a low-level layer in whatever financial application you want to create - unless you want to use it for some quick analysis in which case the Python (or R) bindings present a nice alternative, albeit not as feature-complete as the underlying C++ library.
>
> So, I would create a composite with a [FixedRate|FloatingRate]Bond instance for the pricing related functions and such attributes you would like to access on a frequent basis, e.g. DCM or frequency. Some FOSS actually follows this approach - I think, for instance ORE does something similar (maybe exposing properties as string rather than "strongly typed", but my memory about the OREData structures is a bit rusty).
>
> Otherwise, obviously Luigi's suggestion to parse the leg(s) and their flowlets is a good way to retrieve details you would like to see on a cashflow table of some kind. I was going to say that this works for FixedRateBond and FloatingRateBond, because those wrappers should leave you with only one leg. But other bond packages do allow you to specifiy more than one leg. The fixed-to-float example is an obvious one. Maybe also bonds with a fixed coupon as teaser and structured coupon period thereafter.
>
> By the way: Downcast, but no love for the visitor? Have been in the one or other battle about "Visitor pattern considered harmful", but maybe that is beyond the scope of the original question...
>
> struct CashflowVisitor : public Visitor<QuantLib::Coupon>
> {
> // some members
> void visit(QuantLib::Coupon &coupon) override
> {
> someConsumer.consume(coupon.dayCounter());
> }
> };
>
> Frequency needs to be implied from the start and end dates, so using the leg info may not be desirable after all.
>
>
>
> On Fri, Feb 12, 2021 at 9:19 AM Luigi Ballabio <lui...@gm...> wrote:
>>
>> Given a bond in general, you can't. For instance, you might have a convertible fixed-to-floater where the first part of the bond pays annual fixed coupons and the second part pays semiannual floating-rate coupons, possibly with a different day count. What you might do is examine the coupons themselves: call bond.cashflows(), iterate over it, and for each of the cash flows try to downcast it to a coupon (using ext::dynamic_pointer_cast<Coupon>) and call its methods.
>>
>> Luigi
>>
>>
>> On Fri, Feb 12, 2021 at 6:29 AM jian Xu <jia...@gm...> wrote:
>>>
>>> So given a bond in general, how to find out its accrual day count and
>>> the payment frequency?
>>>
>>> On Thu, Feb 11, 2021 at 3:33 PM Luigi Ballabio <lui...@gm...> wrote:
>>> >
>>> > Hello,
>>> > as Matthias says, FixedRateCoupon and FloatingRateCoupon are convenience classes used to build a bond, but don't have specific behavior. I'm not opposed to having them return some info, but I'd try to avoid storing too much extra data in them just for that purpose...
>>> >
>>> > Luigi
>>> >
>>> >
>>> > On Thu, Feb 11, 2021 at 9:44 PM <mat...@gm...> wrote:
>>> >>
>>> >> Hello Jian,
>>> >>
>>> >> I can only guess, but maybe the classes FixedRateBond and FloatingRateBond were thought of as "easy wrappers" around the main Bond class - making it more convenient for users to create a Bond instance with floating or fixed coupon legs (or none, in case of ZeroCouponBond).
>>> >>
>>> >> Actually I can only find one reference for the "frequency" accessor - and that one is in a unit test to ensure that frequency setting is sort of ignored for a custom schedule.
>>> >>
>>> >> Curious to hear other opinions.
>>> >>
>>> >> Thanks,
>>> >>
>>> >> Matthias
>>> >>
>>> >>
>>> >> -----Original Message-----
>>> >> From: jian Xu <jia...@gm...>
>>> >> Sent: Thursday, 11 February 2021 21:13
>>> >> To: QuantLib users <qua...@li...>
>>> >> Subject: [Quantlib-users] Why doesn't FloatingRateBond has dayCounter() and frequency()?
>>> >>
>>> >> Hi,
>>> >>
>>> >> I noticed that FixedRateBond has dayCounter() and frequency() methods, but the FloatingRateBond does not. What's the reason for that? It seems to me that dayCounter and frequency are equally valid concepts for floating and fixed rate bonds. Or am I missing something?
>>> >> Thanks.
>>> >>
>>> >> Jian
>>> >>
>>> >>
>>> >> _______________________________________________
>>> >> 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: Moh A. <ah...@gm...> - 2021-02-14 13:35:50
|
Hi, I'm considering using QuantLib on a Pharo SmallTalk project. Pharo has a Foreign Function Interface that allows access to C libraries. Is anyone aware of smth that exists in the direction of wrapping the QuantLib library into C functions? Any suggestion is welcome. Thanks algo |
|
From: Aleksis A. R. <ale...@go...> - 2021-02-12 18:37:13
|
Yes, either the cookbook or the swap example (https://github.com/lballabio/QuantLib-SWIG/blob/master/Python/examples/swap.py <https://github.com/lballabio/QuantLib-SWIG/blob/master/Python/examples/swap.py>) illustrate the enquiry functions for a single ccy curve (e.g. NPV, dv01). The fx swap curve works in the same way fed into these functions (so u can get fx implied yields, NPVs etc for fx forwards). One thing to note is if u want to price fx or xccy swaps then that will involve a bit more work because u need to incorporate principal exchanges (which can be done with the FloatFloatSwap class for instance) and work with a two curve/ccy framework - but this is also possible. > On 12 Feb 2021, at 15:53, john gedik <joh...@ou...> wrote: > > Thank you for the quick reply. So that comment was wrong and QuantLib has support for FX Forwards. > > I believe ‘testQuote(self)’ function tests the calculation part. Is that correct? > > Where can I find a little more information of the implementation and calculation? Is it in the implementation or the cookbook? > > John > > From: Aleksis Ali Raza <ale...@go... <mailto:ale...@go...>> > Sent: Friday, February 12, 2021 6:44 AM > To: john gedik <joh...@ou... <mailto:joh...@ou...>> > Cc: qua...@li... <mailto:qua...@li...> > Subject: Re: [Quantlib-users] Fx Forward Valuation > > If you’re using Python then I believe > > https://github.com/lballabio/QuantLib-SWIG/blob/master/Python/test/ratehelpers.py <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Flballabio%2FQuantLib-SWIG%2Fblob%2Fmaster%2FPython%2Ftest%2Fratehelpers.py&data=04%7C01%7C%7C7eba1a6a74f645e52cab08d8cf4b7d9a%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637487270623506622%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=yLbNHMLTjV7gksNZzyfBbqBQPkXO2owDylqH18kfuL0%3D&reserved=0> > > has an implementation of building an FX swap curve (using fwd points rather than implied yields) with the FXSwapRateHelper class. > > > On 12 Feb 2021, at 10:53, john gedik <joh...@ou... <mailto:joh...@ou...>> wrote: > > QuantLib Users, > > I would like to use QuantLib to calculate the MarketValue of an FX Forward for a currency pair (for example EUR-USD) in the future. I have standard interest rates (Spot, TN, 1d, 2d, 1w …) for both currencies. > > I have seen comments mentioning QuantLib does not support it as in below but if it does, can you point me to samples? > > QuantLib / Thread: [Quantlib-users] FX Forward Market Value calculation with QuantLib (sourceforge.net) <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsourceforge.net%2Fp%2Fquantlib%2Fmailman%2Fquantlib-users%2Fthread%2FAM6PR0102MB3093A3D065B7D0AA024C9656E4A70%2540AM6PR0102MB3093.eurprd01.prod.exchangelabs.com%2F%23msg36492097&data=04%7C01%7C%7C7eba1a6a74f645e52cab08d8cf4b7d9a%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637487270623516614%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=8yrwtKNX0psHp13731sVjlqCDejr87vy8%2Bowm8L%2BwUk%3D&reserved=0> > > Thanks in advance, > John Gedik > _______________________________________________ > QuantLib-users mailing list > Qua...@li... <mailto:Qua...@li...> > https://lists.sourceforge.net/lists/listinfo/quantlib-users <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.sourceforge.net%2Flists%2Flistinfo%2Fquantlib-users&data=04%7C01%7C%7C7eba1a6a74f645e52cab08d8cf4b7d9a%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637487270623516614%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=12kSyITrF69zq4KtRLxZ48x1SU%2BgQwbfgj9jYBfu4g0%3D&reserved=0> |
|
From: Beau L. <le...@gm...> - 2021-02-12 14:21:01
|
Hi everyone, I'm new to QL and was wondering if anyone has an off the shelf solution to the issue of calculating yield to call with a new redemption price using the FixedRateBond? In other words is there a way to give FixedRateBond a redemption price other than par? I can solve my issue by setting up a new bond with CallableFixedRateBond, but this seems to overcomplicate the issue. Thank you, Beau Lescott |
|
From: Aleksis A. R. <ale...@go...> - 2021-02-12 11:44:20
|
If you’re using Python then I believe https://github.com/lballabio/QuantLib-SWIG/blob/master/Python/test/ratehelpers.py <https://github.com/lballabio/QuantLib-SWIG/blob/master/Python/test/ratehelpers.py> has an implementation of building an FX swap curve (using fwd points rather than implied yields) with the FXSwapRateHelper class. > On 12 Feb 2021, at 10:53, john gedik <joh...@ou...> wrote: > > QuantLib Users, > > I would like to use QuantLib to calculate the MarketValue of an FX Forward for a currency pair (for example EUR-USD) in the future. I have standard interest rates (Spot, TN, 1d, 2d, 1w …) for both currencies. > > I have seen comments mentioning QuantLib does not support it as in below but if it does, can you point me to samples? > > QuantLib / Thread: [Quantlib-users] FX Forward Market Value calculation with QuantLib (sourceforge.net) <https://sourceforge.net/p/quantlib/mailman/quantlib-users/thread/AM6PR0102MB3093A3D065B7D0AA024C9656E4A70%40AM6PR0102MB3093.eurprd01.prod.exchangelabs.com/#msg36492097> > > Thanks in advance, > John Gedik > _______________________________________________ > QuantLib-users mailing list > Qua...@li... <mailto:Qua...@li...> > https://lists.sourceforge.net/lists/listinfo/quantlib-users <https://lists.sourceforge.net/lists/listinfo/quantlib-users> |
|
From: john g. <joh...@ou...> - 2021-02-12 11:08:29
|
QuantLib Users, I would like to use QuantLib to calculate the MarketValue of an FX Forward for a currency pair (for example EUR-USD) in the future. I have standard interest rates (Spot, TN, 1d, 2d, 1w ...) for both currencies. I have seen comments mentioning QuantLib does not support it as in below but if it does, can you point me to samples? QuantLib / Thread: [Quantlib-users] FX Forward Market Value calculation with QuantLib (sourceforge.net)<https://sourceforge.net/p/quantlib/mailman/quantlib-users/thread/AM6PR0102MB3093A3D065B7D0AA024C9656E4A70%40AM6PR0102MB3093.eurprd01.prod.exchangelabs.com/#msg36492097> Thanks in advance, John Gedik |
|
From: Matthias S. <mat...@gm...> - 2021-02-12 09:33:56
|
Personally, I would consider QuantLib as a low-level layer in whatever
financial application you want to create - unless you want to use it for
some quick analysis in which case the Python (or R) bindings present a nice
alternative, albeit not as feature-complete as the underlying C++ library.
So, I would create a composite with a [FixedRate|FloatingRate]Bond instance
for the pricing related functions and such attributes you would like to
access on a frequent basis, e.g. DCM or frequency. Some FOSS actually
follows this approach - I think, for instance ORE does something similar
(maybe exposing properties as string rather than "strongly typed", but my
memory about the OREData structures is a bit rusty).
Otherwise, obviously Luigi's suggestion to parse the leg(s) and their
flowlets is a good way to retrieve details you would like to see on a
cashflow table of some kind. I was going to say that this works for
FixedRateBond and FloatingRateBond, because those wrappers should leave you
with only one leg. But other bond packages do allow you to specifiy more
than one leg. The fixed-to-float example is an obvious one. Maybe also
bonds with a fixed coupon as teaser and structured coupon period thereafter.
By the way: Downcast, but no love for the visitor? Have been in the one or
other battle about "Visitor pattern considered harmful", but maybe that is
beyond the scope of the original question...
struct CashflowVisitor : public Visitor<QuantLib::Coupon>
{
// some members
void visit(QuantLib::Coupon &coupon) override
{
someConsumer.consume(coupon.dayCounter());
}
};
Frequency needs to be implied from the start and end dates, so using the
leg info may not be desirable after all.
On Fri, Feb 12, 2021 at 9:19 AM Luigi Ballabio <lui...@gm...>
wrote:
> Given a bond in general, you can't. For instance, you might have a
> convertible fixed-to-floater where the first part of the bond pays annual
> fixed coupons and the second part pays semiannual floating-rate coupons,
> possibly with a different day count. What you might do is examine the
> coupons themselves: call bond.cashflows(), iterate over it, and for each of
> the cash flows try to downcast it to a coupon (using
> ext::dynamic_pointer_cast<Coupon>) and call its methods.
>
> Luigi
>
>
> On Fri, Feb 12, 2021 at 6:29 AM jian Xu <jia...@gm...> wrote:
>
>> So given a bond in general, how to find out its accrual day count and
>> the payment frequency?
>>
>> On Thu, Feb 11, 2021 at 3:33 PM Luigi Ballabio <lui...@gm...>
>> wrote:
>> >
>> > Hello,
>> > as Matthias says, FixedRateCoupon and FloatingRateCoupon are
>> convenience classes used to build a bond, but don't have specific
>> behavior. I'm not opposed to having them return some info, but I'd try to
>> avoid storing too much extra data in them just for that purpose...
>> >
>> > Luigi
>> >
>> >
>> > On Thu, Feb 11, 2021 at 9:44 PM <mat...@gm...> wrote:
>> >>
>> >> Hello Jian,
>> >>
>> >> I can only guess, but maybe the classes FixedRateBond and
>> FloatingRateBond were thought of as "easy wrappers" around the main Bond
>> class - making it more convenient for users to create a Bond instance with
>> floating or fixed coupon legs (or none, in case of ZeroCouponBond).
>> >>
>> >> Actually I can only find one reference for the "frequency" accessor -
>> and that one is in a unit test to ensure that frequency setting is sort of
>> ignored for a custom schedule.
>> >>
>> >> Curious to hear other opinions.
>> >>
>> >> Thanks,
>> >>
>> >> Matthias
>> >>
>> >>
>> >> -----Original Message-----
>> >> From: jian Xu <jia...@gm...>
>> >> Sent: Thursday, 11 February 2021 21:13
>> >> To: QuantLib users <qua...@li...>
>> >> Subject: [Quantlib-users] Why doesn't FloatingRateBond has
>> dayCounter() and frequency()?
>> >>
>> >> Hi,
>> >>
>> >> I noticed that FixedRateBond has dayCounter() and frequency() methods,
>> but the FloatingRateBond does not. What's the reason for that? It seems
>> to me that dayCounter and frequency are equally valid concepts for floating
>> and fixed rate bonds. Or am I missing something?
>> >> Thanks.
>> >>
>> >> Jian
>> >>
>> >>
>> >> _______________________________________________
>> >> 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: Luigi B. <lui...@gm...> - 2021-02-12 08:19:58
|
Given a bond in general, you can't. For instance, you might have a convertible fixed-to-floater where the first part of the bond pays annual fixed coupons and the second part pays semiannual floating-rate coupons, possibly with a different day count. What you might do is examine the coupons themselves: call bond.cashflows(), iterate over it, and for each of the cash flows try to downcast it to a coupon (using ext::dynamic_pointer_cast<Coupon>) and call its methods. Luigi On Fri, Feb 12, 2021 at 6:29 AM jian Xu <jia...@gm...> wrote: > So given a bond in general, how to find out its accrual day count and > the payment frequency? > > On Thu, Feb 11, 2021 at 3:33 PM Luigi Ballabio <lui...@gm...> > wrote: > > > > Hello, > > as Matthias says, FixedRateCoupon and FloatingRateCoupon are > convenience classes used to build a bond, but don't have specific > behavior. I'm not opposed to having them return some info, but I'd try to > avoid storing too much extra data in them just for that purpose... > > > > Luigi > > > > > > On Thu, Feb 11, 2021 at 9:44 PM <mat...@gm...> wrote: > >> > >> Hello Jian, > >> > >> I can only guess, but maybe the classes FixedRateBond and > FloatingRateBond were thought of as "easy wrappers" around the main Bond > class - making it more convenient for users to create a Bond instance with > floating or fixed coupon legs (or none, in case of ZeroCouponBond). > >> > >> Actually I can only find one reference for the "frequency" accessor - > and that one is in a unit test to ensure that frequency setting is sort of > ignored for a custom schedule. > >> > >> Curious to hear other opinions. > >> > >> Thanks, > >> > >> Matthias > >> > >> > >> -----Original Message----- > >> From: jian Xu <jia...@gm...> > >> Sent: Thursday, 11 February 2021 21:13 > >> To: QuantLib users <qua...@li...> > >> Subject: [Quantlib-users] Why doesn't FloatingRateBond has dayCounter() > and frequency()? > >> > >> Hi, > >> > >> I noticed that FixedRateBond has dayCounter() and frequency() methods, > but the FloatingRateBond does not. What's the reason for that? It seems > to me that dayCounter and frequency are equally valid concepts for floating > and fixed rate bonds. Or am I missing something? > >> Thanks. > >> > >> Jian > >> > >> > >> _______________________________________________ > >> 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: jian Xu <jia...@gm...> - 2021-02-12 05:30:00
|
So given a bond in general, how to find out its accrual day count and the payment frequency? On Thu, Feb 11, 2021 at 3:33 PM Luigi Ballabio <lui...@gm...> wrote: > > Hello, > as Matthias says, FixedRateCoupon and FloatingRateCoupon are convenience classes used to build a bond, but don't have specific behavior. I'm not opposed to having them return some info, but I'd try to avoid storing too much extra data in them just for that purpose... > > Luigi > > > On Thu, Feb 11, 2021 at 9:44 PM <mat...@gm...> wrote: >> >> Hello Jian, >> >> I can only guess, but maybe the classes FixedRateBond and FloatingRateBond were thought of as "easy wrappers" around the main Bond class - making it more convenient for users to create a Bond instance with floating or fixed coupon legs (or none, in case of ZeroCouponBond). >> >> Actually I can only find one reference for the "frequency" accessor - and that one is in a unit test to ensure that frequency setting is sort of ignored for a custom schedule. >> >> Curious to hear other opinions. >> >> Thanks, >> >> Matthias >> >> >> -----Original Message----- >> From: jian Xu <jia...@gm...> >> Sent: Thursday, 11 February 2021 21:13 >> To: QuantLib users <qua...@li...> >> Subject: [Quantlib-users] Why doesn't FloatingRateBond has dayCounter() and frequency()? >> >> Hi, >> >> I noticed that FixedRateBond has dayCounter() and frequency() methods, but the FloatingRateBond does not. What's the reason for that? It seems to me that dayCounter and frequency are equally valid concepts for floating and fixed rate bonds. Or am I missing something? >> Thanks. >> >> Jian >> >> >> _______________________________________________ >> 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 |