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: Peng Yu <pen...@gm...> - 2021-11-30 14:58:39
|
I see the following two methods in this direction. Pricing American Options Under Variance Gamma https://www.math.columbia.edu/~smirnov/Alihirsa.pdf A fast method for pricing American options under the variance gamma model http://arxiv-export-lb.library.cornell.edu/abs/1903.07519v1 I also notice there is VarianceGammaProcess in quantlib. Does VarianceGammaProcess implement any of these two methods? Or it is something totally different? I want to model American options. I tried the following code (full code attached). american_option.setPricingEngine( ql.BinomialVanillaEngine( process = ql.VarianceGammaProcess( ql.QuoteHandle( ql.SimpleQuote(spot_price) ) , ql.YieldTermStructureHandle( ql.FlatForward(calculation_date, dividend_rate, day_count) ) , ql.YieldTermStructureHandle( ql.FlatForward(calculation_date, risk_free_rate, day_count) ) , sigma = 0.2 , nu = 1 , theta = 1 ) , type = 'crr' , steps = 200) ) But I got the following error. I am not sure what the meaning of the error is. Does it mean BinomialVanillaEngine is not compatible with VarianceGammaProcess? Could anybody show me the correct way to price American options using variance Gamma processes? Traceback (most recent call last): File "./main.py", line 26, in <module> ql.BinomialVanillaEngine( File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/QuantLib/QuantLib.py", line 12456, in BinomialVanillaEngine return cls(process, steps) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/QuantLib/QuantLib.py", line 12365, in __init__ _QuantLib.BinomialCRRVanillaEngine_swiginit(self, _QuantLib.new_BinomialCRRVanillaEngine(arg2, steps)) TypeError: in method 'new_BinomialCRRVanillaEngine', argument 1 of type 'ext::shared_ptr< GeneralizedBlackScholesProcess > const &' > I see a gamma pricing model is mentioned below. But I don't see any > formula in the page. Does anybody where I can find a more detailed > description of the gamma pricing model? > > Does quantlib have an implementation of a gamma pricing model? (I > don't find it. But I may miss it.) > > https://www.investopedia.com/terms/g/gamma-pricing-model.asp -- Regards, Peng |
|
From: Peng Yu <pen...@gm...> - 2021-11-29 03:26:41
|
Hi, I see a gamma pricing model is mentioned below. But I don't see any formula in the page. Does anybody where I can find a more detailed description of the gamma pricing model? Does quantlib have an implementation of a gamma pricing model? (I don't find it. But I may miss it.) https://www.investopedia.com/terms/g/gamma-pricing-model.asp -- Regards, Peng |
|
From: Matthew K. <mat...@gm...> - 2021-11-28 01:51:59
|
Every input into the Black-Scholes model is determined by the user in accordance with their own preferences and modeling. Even calculating the underlying price or time to expiration isn’t something that every quant finance user agrees on. If you want to fully replicate someone else’s inputs, you will need to gather 5 simultaneous examples of their option price, strike and IV combinations, then a solve for all of the unknown input variables to find out what they used for the underlying, time, risk free rate, borrow rate and dividends. I don’t advise this unless it’s extremely important to replicate Yahoo or OPRA. This is also assuming that Yahoo is indeed using Black-Scholes, and not a Tree or some other model as their base. (I don’t know what they use) As for good ways to determine a dividend yield: this is a complex question, and one that you can make good money for if you solve. Many companies pay six figures a year for a data feed to get decent dividend forecasts. A simple and easily scalable method is simply to take the past year’s worth of dividends, and calculate a yield using the assumption that the next year will be the same. But that is not especially accurate relative to what you can buy from data feed providers. Best, Matthew On Sat, Nov 27, 2021 at 11:12 AM Peng Yu <pen...@gm...> wrote: > Thanks. How to determine dividend_rate in practice? For example, the > dividends for the following stock have been changing. > > https://www.nasdaq.com/market-activity/stocks/sjm/dividend-history > > I see implied vol is computed for each option contract below. What > spot_price, risk_free_rate should be used to reproduce the implied vol > shown on Yahoo Finance? Could you show an example for the following > contract? Thanks. > > https://finance.yahoo.com/quote/SJM/options?p=SJM&date=1642723200 > > Contract Name Last Trade Date Strike Last Price Bid Ask > Change % > Change Volume Open Interest Implied Volatility > SJM220121C00130000 2021-11-24 9:59AM > EST 130.00 5.97 5.00 5.30 0.00 - 1 551 > 23.60% > > On 11/27/21, Jonathan Sweemer <sw...@gm...> wrote: > > Hi Peng, > > > > The usual way to back out implied vols from option prices is to use a > > solver. Since you are using python, scipy.optimize.brentq[1] would be a > > good choice. > > > > I've created a gist[2] on github that shows how to extend the example > code > > from the link you provided to calculate implied vols as well. > > > > When I run it on my computer I get the following result, which matches > the > > hardcoded number from the blog. > > > > $ python3 iv.py > > european npv: 6.749271812460607 > > american npv: 6.837765216321175 > > european iv: 0.20000000000000023 > > american iv: 0.19999999999999965 > > > > Note that you should be careful about how you deal with implied vols for > > American options, or any other style of option that is not European. This > > is because most people will assume you are talking about Black-Scholes > > implied vols, which requires the option to be European. Plus, in practice > > you will not want to price American options with flat rates, dividends, > or > > vols, as it is a path-dependent instrument. Nevertheless for the stylized > > example from the blog the approach I've mentioned here should give you > what > > you want. > > > > [1] > > > https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.brentq.html > > [2] https://gist.github.com/sweemer/7a0270655dc70d224d080b04fe11423e > > > > On Sat, Nov 27, 2021 at 2:05 PM Peng Yu <pen...@gm...> wrote: > > > >> Hi, > >> > >> I see the following example to compute prices for American Options. > >> > >> > >> > http://gouthamanbalaraman.com/blog/american-option-pricing-quantlib-python.html > >> > >> But it is not clear how to do the reverse. How to compute IV from > >> bid/ask prices of American options? > >> > >> Could anybody show me a complete example of how to do so with quantlib? > >> Thanks. > >> > >> -- > >> Regards, > >> Peng > >> > >> > >> _______________________________________________ > >> QuantLib-users mailing list > >> Qua...@li... > >> https://lists.sourceforge.net/lists/listinfo/quantlib-users > >> > > > > > -- > Regards, > Peng > > > _______________________________________________ > QuantLib-users mailing list > Qua...@li... > https://lists.sourceforge.net/lists/listinfo/quantlib-users > -- Matthew P. Kolbe (312) 218-6595 mat...@gm... |
|
From: Jonathan S. <sw...@gm...> - 2021-11-27 23:29:28
|
Hi Peng, The spot price should be available on Yahoo Finance, but note that the stock and options market data might have different delays so won't be directly comparable at the same time. For any serious use I recommend getting access to a real-time data feed. According to Yahoo Finance, their options data comes from OPRA[1], so you might be able to find more information on what rates and divs they use to calculate the implied vols shown on Yahoo Finance on an OPRA website. Apart from that, I'm afraid it's beyond the scope of what I'll be able to help you with. [1] https://help.yahoo.com/kb/finance-for-web/SLN2310.html?locale=en_US On Sun, Nov 28, 2021 at 3:08 AM Peng Yu <pen...@gm...> wrote: > Thanks. How to determine dividend_rate in practice? For example, the > dividends for the following stock have been changing. > > https://www.nasdaq.com/market-activity/stocks/sjm/dividend-history > > I see implied vol is computed for each option contract below. What > spot_price, risk_free_rate should be used to reproduce the implied vol > shown on Yahoo Finance? Could you show an example for the following > contract? Thanks. > > https://finance.yahoo.com/quote/SJM/options?p=SJM&date=1642723200 > > Contract Name Last Trade Date Strike Last Price Bid Ask > Change % > Change Volume Open Interest Implied Volatility > SJM220121C00130000 2021-11-24 9:59AM > EST 130.00 5.97 5.00 5.30 0.00 - 1 551 > 23.60% > > On 11/27/21, Jonathan Sweemer <sw...@gm...> wrote: > > Hi Peng, > > > > The usual way to back out implied vols from option prices is to use a > > solver. Since you are using python, scipy.optimize.brentq[1] would be a > > good choice. > > > > I've created a gist[2] on github that shows how to extend the example > code > > from the link you provided to calculate implied vols as well. > > > > When I run it on my computer I get the following result, which matches > the > > hardcoded number from the blog. > > > > $ python3 iv.py > > european npv: 6.749271812460607 > > american npv: 6.837765216321175 > > european iv: 0.20000000000000023 > > american iv: 0.19999999999999965 > > > > Note that you should be careful about how you deal with implied vols for > > American options, or any other style of option that is not European. This > > is because most people will assume you are talking about Black-Scholes > > implied vols, which requires the option to be European. Plus, in practice > > you will not want to price American options with flat rates, dividends, > or > > vols, as it is a path-dependent instrument. Nevertheless for the stylized > > example from the blog the approach I've mentioned here should give you > what > > you want. > > > > [1] > > > https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.brentq.html > > [2] https://gist.github.com/sweemer/7a0270655dc70d224d080b04fe11423e > > > > On Sat, Nov 27, 2021 at 2:05 PM Peng Yu <pen...@gm...> wrote: > > > >> Hi, > >> > >> I see the following example to compute prices for American Options. > >> > >> > >> > http://gouthamanbalaraman.com/blog/american-option-pricing-quantlib-python.html > >> > >> But it is not clear how to do the reverse. How to compute IV from > >> bid/ask prices of American options? > >> > >> Could anybody show me a complete example of how to do so with quantlib? > >> Thanks. > >> > >> -- > >> Regards, > >> Peng > >> > >> > >> _______________________________________________ > >> QuantLib-users mailing list > >> Qua...@li... > >> https://lists.sourceforge.net/lists/listinfo/quantlib-users > >> > > > > > -- > Regards, > Peng > |
|
From: Peng Yu <pen...@gm...> - 2021-11-27 18:08:40
|
Thanks. How to determine dividend_rate in practice? For example, the dividends for the following stock have been changing. https://www.nasdaq.com/market-activity/stocks/sjm/dividend-history I see implied vol is computed for each option contract below. What spot_price, risk_free_rate should be used to reproduce the implied vol shown on Yahoo Finance? Could you show an example for the following contract? Thanks. https://finance.yahoo.com/quote/SJM/options?p=SJM&date=1642723200 Contract Name Last Trade Date Strike Last Price Bid Ask Change % Change Volume Open Interest Implied Volatility SJM220121C00130000 2021-11-24 9:59AM EST 130.00 5.97 5.00 5.30 0.00 - 1 551 23.60% On 11/27/21, Jonathan Sweemer <sw...@gm...> wrote: > Hi Peng, > > The usual way to back out implied vols from option prices is to use a > solver. Since you are using python, scipy.optimize.brentq[1] would be a > good choice. > > I've created a gist[2] on github that shows how to extend the example code > from the link you provided to calculate implied vols as well. > > When I run it on my computer I get the following result, which matches the > hardcoded number from the blog. > > $ python3 iv.py > european npv: 6.749271812460607 > american npv: 6.837765216321175 > european iv: 0.20000000000000023 > american iv: 0.19999999999999965 > > Note that you should be careful about how you deal with implied vols for > American options, or any other style of option that is not European. This > is because most people will assume you are talking about Black-Scholes > implied vols, which requires the option to be European. Plus, in practice > you will not want to price American options with flat rates, dividends, or > vols, as it is a path-dependent instrument. Nevertheless for the stylized > example from the blog the approach I've mentioned here should give you what > you want. > > [1] > https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.brentq.html > [2] https://gist.github.com/sweemer/7a0270655dc70d224d080b04fe11423e > > On Sat, Nov 27, 2021 at 2:05 PM Peng Yu <pen...@gm...> wrote: > >> Hi, >> >> I see the following example to compute prices for American Options. >> >> >> http://gouthamanbalaraman.com/blog/american-option-pricing-quantlib-python.html >> >> But it is not clear how to do the reverse. How to compute IV from >> bid/ask prices of American options? >> >> Could anybody show me a complete example of how to do so with quantlib? >> Thanks. >> >> -- >> Regards, >> Peng >> >> >> _______________________________________________ >> QuantLib-users mailing list >> Qua...@li... >> https://lists.sourceforge.net/lists/listinfo/quantlib-users >> > -- Regards, Peng |
|
From: Jonathan S. <sw...@gm...> - 2021-11-27 13:15:52
|
Hi Peng, The usual way to back out implied vols from option prices is to use a solver. Since you are using python, scipy.optimize.brentq[1] would be a good choice. I've created a gist[2] on github that shows how to extend the example code from the link you provided to calculate implied vols as well. When I run it on my computer I get the following result, which matches the hardcoded number from the blog. $ python3 iv.py european npv: 6.749271812460607 american npv: 6.837765216321175 european iv: 0.20000000000000023 american iv: 0.19999999999999965 Note that you should be careful about how you deal with implied vols for American options, or any other style of option that is not European. This is because most people will assume you are talking about Black-Scholes implied vols, which requires the option to be European. Plus, in practice you will not want to price American options with flat rates, dividends, or vols, as it is a path-dependent instrument. Nevertheless for the stylized example from the blog the approach I've mentioned here should give you what you want. [1] https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.brentq.html [2] https://gist.github.com/sweemer/7a0270655dc70d224d080b04fe11423e On Sat, Nov 27, 2021 at 2:05 PM Peng Yu <pen...@gm...> wrote: > Hi, > > I see the following example to compute prices for American Options. > > > http://gouthamanbalaraman.com/blog/american-option-pricing-quantlib-python.html > > But it is not clear how to do the reverse. How to compute IV from > bid/ask prices of American options? > > Could anybody show me a complete example of how to do so with quantlib? > Thanks. > > -- > Regards, > Peng > > > _______________________________________________ > QuantLib-users mailing list > Qua...@li... > https://lists.sourceforge.net/lists/listinfo/quantlib-users > |
|
From: Peng Yu <pen...@gm...> - 2021-11-27 05:02:42
|
Hi, I see the following example to compute prices for American Options. http://gouthamanbalaraman.com/blog/american-option-pricing-quantlib-python.html But it is not clear how to do the reverse. How to compute IV from bid/ask prices of American options? Could anybody show me a complete example of how to do so with quantlib? Thanks. -- Regards, Peng |
|
From: R M <rm...@gm...> - 2021-11-22 14:46:34
|
Hello QuantLib users, My employer is going through the rigmarole of sourcing RFR option data (e.g. SONIA cap/floor/swaption premiums/vols). It always amazes me that when you ask a data provider for details on the instrument to which a data point corresponds, you don't get a response like "yes, that information is clearly fundamental, here you go". It's more like "everyone knows". But recently we had one provider tell us that their RFR cap/floor data relates to cap/floors that include the first period, and another told us that theirs don't. It also transpired that one provider was using middle-of-period time-to-maturities for mapping cap/floor premiums to vols, which just seems barbaric to me. (I guess this <https://en.wikipedia.org/wiki/Asian_option#European_Asian_call_and_put_options_with_geometric_averaging> is to blame for that.) I don't think QL has started implementing vol surface construction from RFR option data (?), for which these issues are... fundamental. But have discussions on this begun? If not, happy to open a GitHub issue and continue this there. Regards, Ryan |
|
From: Goutham M. <gou...@gm...> - 2021-11-21 09:12:21
|
Hi, Ok I will try this out and update. Best, Goutham On Sat, Nov 20, 2021, 16:28 Luigi Ballabio <lui...@gm...> wrote: > If you want to filter the past cash flows out, you can write something > like: > > remaining_cashflows = [ cf for cf in floatingleg if not > cf.hasOccurred() ] > > Hope this helps, > Luigi > > > On Sat, Nov 20, 2021 at 12:16 PM Goutham Mahesh < > gou...@gm...> wrote: > >> Hi all, >> >> Luigi - Ok I understood that. But I am actually not trying to pass the >> resulting leg into a function like swap.NPV, instead I want to enumerate >> the cash flows from swap.leg(floatingleg). When I do this I am still >> receiving all the Cash Flows(based on the full schedule) and not the ones >> that I need to reflect the new date. My goal is to pass the floating leg >> cash flows into a list. >> >> Charles - What do you mean by that? Sorry, I did not understand. >> >> Thank you all, >> Best, >> Goutham >> >> On Thu, Nov 18, 2021 at 4:55 PM Charles Allderman <ch...@al...> >> wrote: >> >>> I would use a vector of cash flow dates in conjunction with your vector >>> of cash flows and then filter with dates being greater than your evaluation >>> date. >>> >>> On Tue, Nov 16, 2021 at 10:54 PM Goutham Mahesh < >>> gou...@gm...> wrote: >>> >>>> Hi All, >>>> >>>> This is the scenario: >>>> >>>> I have computed the floating leg for and IRS as follows: >>>> floatingleg = IborLeg(data, SwapSchedule, index, Actual360(), >>>> ModifiedFollowing, fixingDays=[0], gearings=[1], spreads = [0]) >>>> >>>> The SwapSchedule is a schedule set for 3 years with quarterly >>>> payments, therefore there are 12 floating leg payments for the swap. >>>> >>>> "data" is a list of 12 nominals for each of the 12 floating leg cash >>>> flows. >>>> data = [1000000, 1000000, 1000000, 1000000, 1000000, 869565, 739130, >>>> 608695, 478260, 347826, 217391, 86956] >>>> >>>> Let us say now that 1 year and 4 cash flow dates have passed. I have >>>> to re-calculate the floating leg. >>>> The "data" list now has 8 nominals to reflect the 8 remaining cash >>>> flow dates. >>>> data = [1000000, 869565, 739130, 608695, 478260, 347826, 217391, 86956] >>>> >>>> My doubt is regarding how to recalculate my floating leg, and if I >>>> should use a new SwapSchedule or a new index. >>>> >>>> For building the SwapSchedule I have currently used the original >>>> date(old_date) and original maturity_date because I do not want the >>>> cash flow dates to change. >>>> >>>> As for the index I have done: >>>> Settings.instance().evaluationDate = new_date >>>> I have built the index using the methodology in the python cookbook >>>> quantlib IRS example. >>>> >>>> The code is running in this situation but the floating leg is still >>>> returning 12 cash flows, whereas I want to return only 8 cash flows to >>>> reflect the 8 remaining payments of the floating leg. >>>> >>>> -- >>>> >>>> Any help will be appreciated as I have been trying really hard to >>>> figure this problem out. If you require more info as to how I built the >>>> index I will send that as well. >>>> >>>> Thank you, >>>> Goutham >>>> _______________________________________________ >>>> 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-11-20 12:28:12
|
If you want to filter the past cash flows out, you can write something like:
remaining_cashflows = [ cf for cf in floatingleg if not
cf.hasOccurred() ]
Hope this helps,
Luigi
On Sat, Nov 20, 2021 at 12:16 PM Goutham Mahesh <gou...@gm...>
wrote:
> Hi all,
>
> Luigi - Ok I understood that. But I am actually not trying to pass the
> resulting leg into a function like swap.NPV, instead I want to enumerate
> the cash flows from swap.leg(floatingleg). When I do this I am still
> receiving all the Cash Flows(based on the full schedule) and not the ones
> that I need to reflect the new date. My goal is to pass the floating leg
> cash flows into a list.
>
> Charles - What do you mean by that? Sorry, I did not understand.
>
> Thank you all,
> Best,
> Goutham
>
> On Thu, Nov 18, 2021 at 4:55 PM Charles Allderman <ch...@al...>
> wrote:
>
>> I would use a vector of cash flow dates in conjunction with your vector
>> of cash flows and then filter with dates being greater than your evaluation
>> date.
>>
>> On Tue, Nov 16, 2021 at 10:54 PM Goutham Mahesh <
>> gou...@gm...> wrote:
>>
>>> Hi All,
>>>
>>> This is the scenario:
>>>
>>> I have computed the floating leg for and IRS as follows:
>>> floatingleg = IborLeg(data, SwapSchedule, index, Actual360(),
>>> ModifiedFollowing, fixingDays=[0], gearings=[1], spreads = [0])
>>>
>>> The SwapSchedule is a schedule set for 3 years with quarterly payments,
>>> therefore there are 12 floating leg payments for the swap.
>>>
>>> "data" is a list of 12 nominals for each of the 12 floating leg cash
>>> flows.
>>> data = [1000000, 1000000, 1000000, 1000000, 1000000, 869565, 739130,
>>> 608695, 478260, 347826, 217391, 86956]
>>>
>>> Let us say now that 1 year and 4 cash flow dates have passed. I have to
>>> re-calculate the floating leg.
>>> The "data" list now has 8 nominals to reflect the 8 remaining cash flow
>>> dates.
>>> data = [1000000, 869565, 739130, 608695, 478260, 347826, 217391, 86956]
>>>
>>> My doubt is regarding how to recalculate my floating leg, and if I
>>> should use a new SwapSchedule or a new index.
>>>
>>> For building the SwapSchedule I have currently used the original
>>> date(old_date) and original maturity_date because I do not want the
>>> cash flow dates to change.
>>>
>>> As for the index I have done:
>>> Settings.instance().evaluationDate = new_date
>>> I have built the index using the methodology in the python cookbook
>>> quantlib IRS example.
>>>
>>> The code is running in this situation but the floating leg is still
>>> returning 12 cash flows, whereas I want to return only 8 cash flows to
>>> reflect the 8 remaining payments of the floating leg.
>>>
>>> --
>>>
>>> Any help will be appreciated as I have been trying really hard to figure
>>> this problem out. If you require more info as to how I built the index I
>>> will send that as well.
>>>
>>> Thank you,
>>> Goutham
>>> _______________________________________________
>>> 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: Goutham M. <gou...@gm...> - 2021-11-20 11:13:14
|
Hi all, Luigi - Ok I understood that. But I am actually not trying to pass the resulting leg into a function like swap.NPV, instead I want to enumerate the cash flows from swap.leg(floatingleg). When I do this I am still receiving all the Cash Flows(based on the full schedule) and not the ones that I need to reflect the new date. My goal is to pass the floating leg cash flows into a list. Charles - What do you mean by that? Sorry, I did not understand. Thank you all, Best, Goutham On Thu, Nov 18, 2021 at 4:55 PM Charles Allderman <ch...@al...> wrote: > I would use a vector of cash flow dates in conjunction with your vector of > cash flows and then filter with dates being greater than your evaluation > date. > > On Tue, Nov 16, 2021 at 10:54 PM Goutham Mahesh < > gou...@gm...> wrote: > >> Hi All, >> >> This is the scenario: >> >> I have computed the floating leg for and IRS as follows: >> floatingleg = IborLeg(data, SwapSchedule, index, Actual360(), >> ModifiedFollowing, fixingDays=[0], gearings=[1], spreads = [0]) >> >> The SwapSchedule is a schedule set for 3 years with quarterly payments, >> therefore there are 12 floating leg payments for the swap. >> >> "data" is a list of 12 nominals for each of the 12 floating leg cash >> flows. >> data = [1000000, 1000000, 1000000, 1000000, 1000000, 869565, 739130, >> 608695, 478260, 347826, 217391, 86956] >> >> Let us say now that 1 year and 4 cash flow dates have passed. I have to >> re-calculate the floating leg. >> The "data" list now has 8 nominals to reflect the 8 remaining cash flow >> dates. >> data = [1000000, 869565, 739130, 608695, 478260, 347826, 217391, 86956] >> >> My doubt is regarding how to recalculate my floating leg, and if I should >> use a new SwapSchedule or a new index. >> >> For building the SwapSchedule I have currently used the original >> date(old_date) and original maturity_date because I do not want the cash >> flow dates to change. >> >> As for the index I have done: >> Settings.instance().evaluationDate = new_date >> I have built the index using the methodology in the python cookbook >> quantlib IRS example. >> >> The code is running in this situation but the floating leg is still >> returning 12 cash flows, whereas I want to return only 8 cash flows to >> reflect the 8 remaining payments of the floating leg. >> >> -- >> >> Any help will be appreciated as I have been trying really hard to figure >> this problem out. If you require more info as to how I built the index I >> will send that as well. >> >> Thank you, >> Goutham >> _______________________________________________ >> QuantLib-users mailing list >> Qua...@li... >> https://lists.sourceforge.net/lists/listinfo/quantlib-users >> > |
|
From: Luigi B. <lui...@gm...> - 2021-11-18 14:00:46
|
Hi Philippe, no such thing on the website, but there's a quantlib-jobs mailing list: see <https://sourceforge.net/projects/quantlib/lists/quantlib-jobs>. Not sure how many people are subscribed. The QuantLib group on LinkedIn (< https://www.linkedin.com/groups/723317/>) might be another place. Luigi On Thu, Nov 18, 2021 at 2:45 PM philippe hatstadt via QuantLib-users < qua...@li...> wrote: > Hi. > Does QuantLib have an area where one can post job offerings somewhere on > its website? > > 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 > |
|
From: philippe h. <pha...@ma...> - 2021-11-18 13:41:23
|
Hi. Does QuantLib have an area where one can post job offerings somewhere on its website? Regards Philippe Hatstadt +1-203-252-0408 https://www.linkedin.com/in/philippe-hatstadt |
|
From: Charles A. <ch...@al...> - 2021-11-18 13:23:55
|
I would use a vector of cash flow dates in conjunction with your vector of cash flows and then filter with dates being greater than your evaluation date. On Tue, Nov 16, 2021 at 10:54 PM Goutham Mahesh <gou...@gm...> wrote: > Hi All, > > This is the scenario: > > I have computed the floating leg for and IRS as follows: > floatingleg = IborLeg(data, SwapSchedule, index, Actual360(), > ModifiedFollowing, fixingDays=[0], gearings=[1], spreads = [0]) > > The SwapSchedule is a schedule set for 3 years with quarterly payments, > therefore there are 12 floating leg payments for the swap. > > "data" is a list of 12 nominals for each of the 12 floating leg cash flows > . > data = [1000000, 1000000, 1000000, 1000000, 1000000, 869565, 739130, > 608695, 478260, 347826, 217391, 86956] > > Let us say now that 1 year and 4 cash flow dates have passed. I have to > re-calculate the floating leg. > The "data" list now has 8 nominals to reflect the 8 remaining cash flow > dates. > data = [1000000, 869565, 739130, 608695, 478260, 347826, 217391, 86956] > > My doubt is regarding how to recalculate my floating leg, and if I should > use a new SwapSchedule or a new index. > > For building the SwapSchedule I have currently used the original > date(old_date) and original maturity_date because I do not want the cash > flow dates to change. > > As for the index I have done: > Settings.instance().evaluationDate = new_date > I have built the index using the methodology in the python cookbook > quantlib IRS example. > > The code is running in this situation but the floating leg is still > returning 12 cash flows, whereas I want to return only 8 cash flows to > reflect the 8 remaining payments of the floating leg. > > -- > > Any help will be appreciated as I have been trying really hard to figure > this problem out. If you require more info as to how I built the index I > will send that as well. > > Thank you, > Goutham > _______________________________________________ > QuantLib-users mailing list > Qua...@li... > https://lists.sourceforge.net/lists/listinfo/quantlib-users > |
|
From: Aleksis A. R. <ale...@go...> - 2021-11-18 09:49:24
|
Hi, the link below may be useful. To evaluate the in-the-life swap I assume you are providing it fixings prior to the new evaluation date. In this case my understanding is that the swap PV you get will not include the settled cashflows (as long as the curve reference date is adjusted accordingly - see link). https://quant.stackexchange.com/questions/36830/quantlib-python-price-same-swap-on-different-evaluation-dates <https://quant.stackexchange.com/questions/36830/quantlib-python-price-same-swap-on-different-evaluation-dates> Aleksis > On 16 Nov 2021, at 20:51, Goutham Mahesh <gou...@gm...> wrote: > > Hi All, > > This is the scenario: > > I have computed the floating leg for and IRS as follows: > floatingleg = IborLeg(data, SwapSchedule, index, Actual360(), ModifiedFollowing, fixingDays=[0], gearings=[1], spreads = [0]) > > The SwapSchedule is a schedule set for 3 years with quarterly payments, therefore there are 12 floating leg payments for the swap. > > "data" is a list of 12 nominals for each of the 12 floating leg cash flows. > data = [1000000, 1000000, 1000000, 1000000, 1000000, 869565, 739130, 608695, 478260, 347826, 217391, 86956] > > Let us say now that 1 year and 4 cash flow dates have passed. I have to re-calculate the floating leg. > The "data" list now has 8 nominals to reflect the 8 remaining cash flow dates. > data = [1000000, 869565, 739130, 608695, 478260, 347826, 217391, 86956] > > My doubt is regarding how to recalculate my floating leg, and if I should use a new SwapSchedule or a new index. > > For building the SwapSchedule I have currently used the original date(old_date) and original maturity_date because I do not want the cash flow dates to change. > > As for the index I have done: > Settings.instance().evaluationDate = new_date > I have built the index using the methodology in the python cookbook quantlib IRS example. > > The code is running in this situation but the floating leg is still returning 12 cash flows, whereas I want to return only 8 cash flows to reflect the 8 remaining payments of the floating leg. > > -- > > Any help will be appreciated as I have been trying really hard to figure this problem out. If you require more info as to how I built the index I will send that as well. > > Thank you, > Goutham > _______________________________________________ > QuantLib-users mailing list > Qua...@li... > https://lists.sourceforge.net/lists/listinfo/quantlib-users |
|
From: <mat...@gm...> - 2021-11-17 21:26:57
|
Hello Christian,
Coincidentally I tried the same thing yesterday, also on 1.24.
And I, too, chose to give MSYS2 a try because with the scripting for GNU autotools it is (ostensibly) the easier approach when compared to MSVC.
By the way, looking at your command for building QuantLib, I am intrigued by the library directory "boost_1_77_0/lib64-msvc-14.1". Is it possible to link QuantLib on MSYS2 with boost binaries seemingly compiled on MSVC?
In my trial run, I just installed boost via pacman.
The ql Makefile was generated with the following settings:
./configure --enable-openmp --enable-error-functions --enable-error-lines --enable-std-classes --enable-thread-safe-observer-pattern --enable-thread-safe-singleton-init --disable-benchmark --disable-examples --with-boost-lib=/mingw64/lib --with-boost-include=/mingw64/include --prefix=$HOME/ql_124
Some remarks:
- I set the thread-safe switches on a hunch that it would be the better choice when using QuantLib from Java.
- Could not find an option to also disable unit tests together with benchmark and examples. I hacked them out of the config, because boost unit test failed linking and I did not care enough to try and fix this. Examples were built, curiously, despite the switch.
- Build takes quite a long time (16 core / 32 thread AMD Zen2 machine, using make -j 32).
- Only static library is built, even though the settings should enable both static and shared library builds.
Now the JNI bindings:
./configure --prefix=$HOME/ql_124 --disable-python --disable-csharp --disable-r --enable-java-autocloseable include=$SCOOP_APPS/openjdk11/11.0.2-9/include --with-jdk-system-include=$SCOOP_APPS/openjdk11/11.0.2-9/include/win32 CXXFLAGS="-I$HOME/ql_124/include -I/mingw64/include"
Some remarks:
- Not sure whether the AutoClosable actually works. In the end, I removed that flag and only use finalize. Wrapping lots of stuff in try-with-resources or similar also seems a bit annoying in the first place.
- Without further adjustment, building the wrapper will result in an error ("object file has too many sections"). Using -O3 as additional CXX flag helps here as might -mbig-obj.
No matter what small tweaking to compiler options I applied, linking always yielded the errors you likely encountered as well. A random pick:
undefined reference to `construction vtable for QuantLib::InterpolatedForwardCurve<QuantLib::BackwardFlat>-in-QuantLib::PiecewiseYieldCurve<QuantLib::ForwardRate, QuantLib::BackwardFlat, QuantLib::IterativeBootstrap>'
I really wonder what is causing this. Looks like some missing implementation for virtual functions?
For now, I gave up on this and compiled everything with MSVC (using cmake, adjusting its options according to the configure flags above, i.e. with thread safe observer "ON" etc).
To build the JNI:
mkdir org\quantlib
swig -DJAVA_AUTOLOAD -DJAVA_FINALIZER -java -c++ -outdir org\quantlib -package org.quantlib -o quantlib_wrap.cpp ..\SWIG\quantlib.i
cl /bigobj /O2 /EHsc /I%SCOOP_APPS%\openjdk11\11.0.2-9\include /I%SCOOP_APPS%\openjdk11\11.0.2-9\include\win32 /IE:\quantlib_1_24\x64-Release\include /I%BOOST_ROOT% /D_USRDLL /D_WINDLL quantlib_wrap.cpp /LD /FeQuantLibJNI.dll /link /LIBPATH:E:\quantlib_1_24\x64-Release\lib /LIBPATH:%BOOST_ROOT%\lib64-msvc-14.2
This worked fine and survived some tests so far.
Maybe you can consider using MSVC as well. But if you do find out how to fix these linker errors, I am curious to hear about it.
Best regards,
Matthias
-----Original Message-----
From: ara...@gm... <ara...@gm...>
Sent: Tuesday, 16 November, 2021 17:01
To: qua...@li...
Subject: [Quantlib-users] Building QuantLib-SWIG for Java under Windows (with MSYS2) fails with "undefined reference to vtable for XYZ"
Hi all,
Thanks for taking the time to read this.
I'm trying to build QuantLib-SWIG for Java under Windows. Instead of Visual Studio I'm using MSYS2 (which is based on Cygwin) for building.
The make command compiles the target quantlib_wrap.o successfully but then fails at the target libQuantLibJNI.so with a ton of error messages like this one:
C:/Users/christian/coding/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe:
quantlib_wrap.o:quantlib_wrap.:(.text$_ZN5boost10shared_ptrIN8QuantLib14SwapRateHelperEEC1IS2_EEPT_[_ZN5boost10shared_ptrIN8QuantLib14SwapRateHelperEEC1IS2_EEPT_]+0x2f):
undefined reference to `vtable for boost::detail::sp_counted_impl_p<QuantLib::SwapRateHelper>'
The versions are:
QuantLib 1.24
QuantLib-SWIG 1.24
Boost 1.77.0 (pre-compiled binaries)
I ran the build of QuantLib-SWIG with the following commands and parameters:
$ ./configure --with-jdk-include="/c/Users/christian/coding/jdk-15/include" --with-jdk-system-include="/c/Users/christian/coding/jdk-15/include/win32"
$ make -C Java
The failing build step is: g++ -g -O2 -shared quantlib_wrap.o -o libQuantLibJNI.so `quantlib-config --libs` The command quantlib-config --libs gives: -L/mingw64/lib -L/c/Users/christian/coding/boost_1_77_0/lib64-msvc-14.1 -lQuantLib The directory /mingw64/lib contains the previously compiled files libQuantLib.a and libQuantLib.la
The build of QuantLib itself was successful. I ran it with the following commands and parameters:
$ ./configure --enable-intraday --with-boost-lib=/c/Users/christian/coding/boost_1_77_0/lib64-msvc-14.1 --with-boost-include=/c/Users/christian/coding/boost_1_77_0
$ make
$ make install
Any ideas would be highly appreciated.
Regards,
Christian
_______________________________________________
QuantLib-users mailing list
Qua...@li...
https://lists.sourceforge.net/lists/listinfo/quantlib-users
|
|
From: Luigi B. <lui...@gm...> - 2021-11-17 09:18:13
|
Hello Goutham,
IborLeg will build all the coupons, because you're passing the whole
schedule, but when you then pass the resulting leg to a function like
CashFlows::npv() it will only take into account the ones that still have to
be paid.
Hope this helps,
Luigi
On Tue, Nov 16, 2021 at 9:54 PM Goutham Mahesh <gou...@gm...>
wrote:
> Hi All,
>
> This is the scenario:
>
> I have computed the floating leg for and IRS as follows:
> floatingleg = IborLeg(data, SwapSchedule, index, Actual360(),
> ModifiedFollowing, fixingDays=[0], gearings=[1], spreads = [0])
>
> The SwapSchedule is a schedule set for 3 years with quarterly payments,
> therefore there are 12 floating leg payments for the swap.
>
> "data" is a list of 12 nominals for each of the 12 floating leg cash flows
> .
> data = [1000000, 1000000, 1000000, 1000000, 1000000, 869565, 739130,
> 608695, 478260, 347826, 217391, 86956]
>
> Let us say now that 1 year and 4 cash flow dates have passed. I have to
> re-calculate the floating leg.
> The "data" list now has 8 nominals to reflect the 8 remaining cash flow
> dates.
> data = [1000000, 869565, 739130, 608695, 478260, 347826, 217391, 86956]
>
> My doubt is regarding how to recalculate my floating leg, and if I should
> use a new SwapSchedule or a new index.
>
> For building the SwapSchedule I have currently used the original
> date(old_date) and original maturity_date because I do not want the cash
> flow dates to change.
>
> As for the index I have done:
> Settings.instance().evaluationDate = new_date
> I have built the index using the methodology in the python cookbook
> quantlib IRS example.
>
> The code is running in this situation but the floating leg is still
> returning 12 cash flows, whereas I want to return only 8 cash flows to
> reflect the 8 remaining payments of the floating leg.
>
> --
>
> Any help will be appreciated as I have been trying really hard to figure
> this problem out. If you require more info as to how I built the index I
> will send that as well.
>
> Thank you,
> Goutham
> _______________________________________________
> QuantLib-users mailing list
> Qua...@li...
> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>
|
|
From: Goutham M. <gou...@gm...> - 2021-11-16 20:51:54
|
Hi All, This is the scenario: I have computed the floating leg for and IRS as follows: floatingleg = IborLeg(data, SwapSchedule, index, Actual360(), ModifiedFollowing, fixingDays=[0], gearings=[1], spreads = [0]) The SwapSchedule is a schedule set for 3 years with quarterly payments, therefore there are 12 floating leg payments for the swap. "data" is a list of 12 nominals for each of the 12 floating leg cash flows. data = [1000000, 1000000, 1000000, 1000000, 1000000, 869565, 739130, 608695, 478260, 347826, 217391, 86956] Let us say now that 1 year and 4 cash flow dates have passed. I have to re-calculate the floating leg. The "data" list now has 8 nominals to reflect the 8 remaining cash flow dates. data = [1000000, 869565, 739130, 608695, 478260, 347826, 217391, 86956] My doubt is regarding how to recalculate my floating leg, and if I should use a new SwapSchedule or a new index. For building the SwapSchedule I have currently used the original date(old_date) and original maturity_date because I do not want the cash flow dates to change. As for the index I have done: Settings.instance().evaluationDate = new_date I have built the index using the methodology in the python cookbook quantlib IRS example. The code is running in this situation but the floating leg is still returning 12 cash flows, whereas I want to return only 8 cash flows to reflect the 8 remaining payments of the floating leg. -- Any help will be appreciated as I have been trying really hard to figure this problem out. If you require more info as to how I built the index I will send that as well. Thank you, Goutham |
|
From: <ara...@gm...> - 2021-11-16 16:00:47
|
Hi all, Thanks for taking the time to read this. I'm trying to build QuantLib-SWIG for Java under Windows. Instead of Visual Studio I'm using MSYS2 (which is based on Cygwin) for building. The make command compiles the target quantlib_wrap.o successfully but then fails at the target libQuantLibJNI.so with a ton of error messages like this one: C:/Users/christian/coding/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: quantlib_wrap.o:quantlib_wrap.:(.text$_ZN5boost10shared_ptrIN8QuantLib14SwapRateHelperEEC1IS2_EEPT_[_ZN5boost10shared_ptrIN8QuantLib14SwapRateHelperEEC1IS2_EEPT_]+0x2f): undefined reference to `vtable for boost::detail::sp_counted_impl_p<QuantLib::SwapRateHelper>' The versions are: QuantLib 1.24 QuantLib-SWIG 1.24 Boost 1.77.0 (pre-compiled binaries) I ran the build of QuantLib-SWIG with the following commands and parameters: $ ./configure --with-jdk-include="/c/Users/christian/coding/jdk-15/include" --with-jdk-system-include="/c/Users/christian/coding/jdk-15/include/win32" $ make -C Java The failing build step is: g++ -g -O2 -shared quantlib_wrap.o -o libQuantLibJNI.so `quantlib-config --libs` The command quantlib-config --libs gives: -L/mingw64/lib -L/c/Users/christian/coding/boost_1_77_0/lib64-msvc-14.1 -lQuantLib The directory /mingw64/lib contains the previously compiled files libQuantLib.a and libQuantLib.la The build of QuantLib itself was successful. I ran it with the following commands and parameters: $ ./configure --enable-intraday --with-boost-lib=/c/Users/christian/coding/boost_1_77_0/lib64-msvc-14.1 --with-boost-include=/c/Users/christian/coding/boost_1_77_0 $ make $ make install Any ideas would be highly appreciated. Regards, Christian |
|
From: <ara...@gm...> - 2021-11-16 15:59:01
|
Hi all, Thanks for taking the time to read this. I'm trying to build QuantLib-SWIG for Java under Windows. Instead of Visual Studio I'm using MSYS2 (which is based on Cygwin) for building. The make command compiles the target quantlib_wrap.o successfully but then fails at the target libQuantLibJNI.so with a ton of error messages like this one: C:/Users/christian/coding/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/1 1.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: quantlib_wrap.o:quantlib_wrap.:(.text$_ZN5boost10shared_ptrIN8QuantLib14Swap RateHelperEEC1IS2_EEPT_[_ZN5boost10shared_ptrIN8QuantLib14SwapRateHelperEEC1 IS2_EEPT_]+0x2f): undefined reference to `vtable for boost::detail::sp_counted_impl_p<QuantLib::SwapRateHelper>' The versions are: QuantLib 1.24 QuantLib-SWIG 1.24 Boost 1.77.0 (pre-compiled binaries) I ran the build of QuantLib-SWIG with the following commands and parameters: $ ./configure --with-jdk-include="/c/Users/christian/coding/jdk-15/include" --with-jdk-system-include="/c/Users/christian/coding/jdk-15/include/win32" $ make -C Java The failing build step is: g++ -g -O2 -shared quantlib_wrap.o -o libQuantLibJNI.so `quantlib-config --libs` The command quantlib-config --libs gives: -L/mingw64/lib -L/c/Users/christian/coding/boost_1_77_0/lib64-msvc-14.1 -lQuantLib The directory /mingw64/lib contains the previously compiled files libQuantLib.a and libQuantLib.la The build of QuantLib itself was successful. I ran it with the following commands and parameters: $ ./configure --enable-intraday --with-boost-lib=/c/Users/christian/coding/boost_1_77_0/lib64-msvc-14.1 --with-boost-include=/c/Users/christian/coding/boost_1_77_0 $ make $ make install Any help would be highly appreciated. Regards, Christian |
|
From: Jan M. <jan...@gm...> - 2021-11-03 13:30:43
|
Hey, I have two HullWhite (ql.HullWhite) models which are being fed into ql.TreeCallableFixedRateBondEngine. I also have a correlation matrix, is it possible to merge these two trinomial trees (forming a new trinomial tree) to price the bonds? or do I have to use ql.HullWhiteProcess in some way? I still want to be able to calculate the clean price, dirty price, OAS etc. Best Regards, Jan Muller |
|
From: <da...@el...> - 2021-11-03 11:46:13
|
By trial and error:
Passing the shift (0.02) as the final parameter to
ConstantSwaptionVolatility, then using ICAP's shifted black vol (0.272)
gives me a matching premium.
From: da...@el... <da...@el...>
Sent: Monday, 1 November 2021 20:28
To: 'QuantLib users' <qua...@li...>
Subject: [Quantlib-users] Pricing a Vanilla EUR swaption to match ICAP
premium
Hi, I am undertaking what on the face of it should be a simple Python task:
replicate the ICAP ATMF cash-settled spot swaption premiums, given their
volatility quotes. I get what seems to be a reasonable number, but that
could just be luck (!).
My base swaption is a EUR 1y10y ATMF receiver, as of today, 1st November.
The ATMF is 0.40%, and according to ICAP:
- 'EUR Cash IRR' vol is 187.3
- 'EUR Cash IRR Shifted Black Vol' is 27.2
- 'EUR Shifts' is 2.00
- 'EUR Cash IRR Cal' Normal vol is 65.1
- 'EUR Spot Cash IRR Premium' is 511.0 (for an atmf straddle)
If I use this code (I have created curves which generate an atmf agreeing
with 0.40%):
const_vol =
ql.ConstantSwaptionVolatility(2,calendar,ql.ModifiedFollowing,
ql.QuoteHandle(ql.SimpleQuote(1.873)),
ql.ActualActual(),ql.ShiftedLognormal)
const_vol_handle = ql.SwaptionVolatilityStructureHandle(const_vol)
blackEngine = ql.BlackSwaptionEngine(discount_curve,const_vol_handle)
swaption = ql.Swaption(parSwap, exercise, ql.Settlement.Cash,
ql.Settlement.ParYieldCurve)
swaption.setPricingEngine(blackEngine)
print('Swaption px {0:.1f} cents'.format(100*swaption.NPV()))
with result:
Swaption px 257.4 cents
and price the swaption, I get a premium which is pretty close to ICAP (once
doubled to 514.8), but not quite the same.
However, I am not sure how (if?) to incorporate the shift of 2 (% I assume),
which is an optional parameter to ql.ConstantSwaptionVolatility() to handle
negative strikes. If I pass 0.02 as this parameter, then I get a
non-sensical premium: should I be bumping my entire swap curve by 2% before
pricing?
Or perhaps I should just be taking the market premia and backing out the
vol?
Grateful for any guidance on this.
Best wishes,
David Sansom
|
|
From: Luigi B. <lui...@gm...> - 2021-11-02 13:49:12
|
Thanks, Jonathan. There was some discussion of providing a FindQuantLib, but nobody opened an issue yet—feel free to do so. Luigi On Tue, Nov 2, 2021 at 2:22 PM Jonathan Sweemer <sw...@gm...> wrote: > Sure, I've pushed up an example[1] for how to include QuantLib into a > project using vcpkg on both Linux and Windows, including the part about the > custom triplet on Linux. If you know of a better place to put the example > then I will be happy to move it there instead. > > Apart from that, Microsoft's documentation[2] is not that bad, albeit a > bit fragmented over several different sites in my experience. > > One thing that would make the integration with vcpkg even better is if > QuantLib supported the find_package command[3]. Has there been any > discussion of this in the past? If not, then that might be a good idea for > someone to help contribute in the near future. > > [1] https://github.com/sweemer/quantlib-vcpkg-example > [2] https://vcpkg.io/en/docs/examples/installing-and-using-packages.html > [3] https://cmake.org/cmake/help/git-master/command/find_package.html > > On Tue, Nov 2, 2021 at 1:04 AM Luigi Ballabio <lui...@gm...> > wrote: > >> Thanks, Jonathan! Do you have a primer on how to use this for someone >> who never used vcpkg? >> >> Luigi >> >> On Sun, Oct 31, 2021 at 8:05 AM Jonathan Sweemer <sw...@gm...> >> wrote: >> >>> Hello QuantLib users, >>> >>> In case there are any other vcpkg users out there, heads up that I have >>> submitted a pull request[1] to update QuantLib from v1.22 to v1.24. >>> >>> I have also enabled the option to build QuantLib as a shared library on >>> Linux through vcpkg, which has been disabled until now for some reason. In >>> case the lack of shared library support on Linux has prevented anyone from >>> using vcpkg, you might want to try again once this change is merged. (Note >>> that in order to build as a shared library on Linux with vcpkg you need to >>> define a new triplet by following the instructions in [2]). >>> >>> On Windows, still only static linkage is supported, both in vcpkg and in >>> QuantLib's CMake build settings. >>> >>> [1] https://github.com/microsoft/vcpkg/pull/21068 >>> [2] >>> https://vcpkg.readthedocs.io/en/latest/examples/overlay-triplets-linux-dynamic/ >>> >>> Jonathan Sweemer >>> _______________________________________________ >>> QuantLib-users mailing list >>> Qua...@li... >>> https://lists.sourceforge.net/lists/listinfo/quantlib-users >>> >> |
|
From: Jonathan S. <sw...@gm...> - 2021-11-02 13:22:22
|
Sure, I've pushed up an example[1] for how to include QuantLib into a project using vcpkg on both Linux and Windows, including the part about the custom triplet on Linux. If you know of a better place to put the example then I will be happy to move it there instead. Apart from that, Microsoft's documentation[2] is not that bad, albeit a bit fragmented over several different sites in my experience. One thing that would make the integration with vcpkg even better is if QuantLib supported the find_package command[3]. Has there been any discussion of this in the past? If not, then that might be a good idea for someone to help contribute in the near future. [1] https://github.com/sweemer/quantlib-vcpkg-example [2] https://vcpkg.io/en/docs/examples/installing-and-using-packages.html [3] https://cmake.org/cmake/help/git-master/command/find_package.html On Tue, Nov 2, 2021 at 1:04 AM Luigi Ballabio <lui...@gm...> wrote: > Thanks, Jonathan! Do you have a primer on how to use this for someone who > never used vcpkg? > > Luigi > > On Sun, Oct 31, 2021 at 8:05 AM Jonathan Sweemer <sw...@gm...> > wrote: > >> Hello QuantLib users, >> >> In case there are any other vcpkg users out there, heads up that I have >> submitted a pull request[1] to update QuantLib from v1.22 to v1.24. >> >> I have also enabled the option to build QuantLib as a shared library on >> Linux through vcpkg, which has been disabled until now for some reason. In >> case the lack of shared library support on Linux has prevented anyone from >> using vcpkg, you might want to try again once this change is merged. (Note >> that in order to build as a shared library on Linux with vcpkg you need to >> define a new triplet by following the instructions in [2]). >> >> On Windows, still only static linkage is supported, both in vcpkg and in >> QuantLib's CMake build settings. >> >> [1] https://github.com/microsoft/vcpkg/pull/21068 >> [2] >> https://vcpkg.readthedocs.io/en/latest/examples/overlay-triplets-linux-dynamic/ >> >> Jonathan Sweemer >> _______________________________________________ >> QuantLib-users mailing list >> Qua...@li... >> https://lists.sourceforge.net/lists/listinfo/quantlib-users >> > |
|
From: <da...@el...> - 2021-11-01 20:28:46
|
Hi, I am undertaking what on the face of it should be a simple Python task:
replicate the ICAP ATMF cash-settled spot swaption premiums, given their
volatility quotes. I get what seems to be a reasonable number, but that
could just be luck (!).
My base swaption is a EUR 1y10y ATMF receiver, as of today, 1st November.
The ATMF is 0.40%, and according to ICAP:
- 'EUR Cash IRR' vol is 187.3
- 'EUR Cash IRR Shifted Black Vol' is 27.2
- 'EUR Shifts' is 2.00
- 'EUR Cash IRR Cal' Normal vol is 65.1
- 'EUR Spot Cash IRR Premium' is 511.0 (for an atmf straddle)
If I use this code (I have created curves which generate an atmf agreeing
with 0.40%):
const_vol =
ql.ConstantSwaptionVolatility(2,calendar,ql.ModifiedFollowing,
ql.QuoteHandle(ql.SimpleQuote(1.873)),
ql.ActualActual(),ql.ShiftedLognormal)
const_vol_handle = ql.SwaptionVolatilityStructureHandle(const_vol)
blackEngine = ql.BlackSwaptionEngine(discount_curve,const_vol_handle)
swaption = ql.Swaption(parSwap, exercise, ql.Settlement.Cash,
ql.Settlement.ParYieldCurve)
swaption.setPricingEngine(blackEngine)
print('Swaption px {0:.1f} cents'.format(100*swaption.NPV()))
with result:
Swaption px 257.4 cents
and price the swaption, I get a premium which is pretty close to ICAP (once
doubled to 514.8), but not quite the same.
However, I am not sure how (if?) to incorporate the shift of 2 (% I assume),
which is an optional parameter to ql.ConstantSwaptionVolatility() to handle
negative strikes. If I pass 0.02 as this parameter, then I get a
non-sensical premium: should I be bumping my entire swap curve by 2% before
pricing?
Or perhaps I should just be taking the market premia and backing out the
vol?
Grateful for any guidance on this.
Best wishes,
David Sansom
|