You can subscribe to this list here.
| 2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
(60) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2001 |
Jan
(18) |
Feb
(4) |
Mar
(6) |
Apr
(2) |
May
|
Jun
(12) |
Jul
(48) |
Aug
(6) |
Sep
(3) |
Oct
(24) |
Nov
(15) |
Dec
(18) |
| 2002 |
Jan
(39) |
Feb
(12) |
Mar
(80) |
Apr
(72) |
May
(46) |
Jun
(27) |
Jul
(23) |
Aug
(34) |
Sep
(65) |
Oct
(71) |
Nov
(19) |
Dec
(14) |
| 2003 |
Jan
(44) |
Feb
(59) |
Mar
(18) |
Apr
(62) |
May
(54) |
Jun
(27) |
Jul
(46) |
Aug
(15) |
Sep
(44) |
Oct
(36) |
Nov
(19) |
Dec
(12) |
| 2004 |
Jan
(26) |
Feb
(33) |
Mar
(47) |
Apr
(63) |
May
(36) |
Jun
(65) |
Jul
(80) |
Aug
(163) |
Sep
(65) |
Oct
(39) |
Nov
(36) |
Dec
(39) |
| 2005 |
Jan
(97) |
Feb
(78) |
Mar
(64) |
Apr
(64) |
May
(48) |
Jun
(55) |
Jul
(89) |
Aug
(57) |
Sep
(51) |
Oct
(111) |
Nov
(86) |
Dec
(76) |
| 2006 |
Jan
(84) |
Feb
(103) |
Mar
(143) |
Apr
(92) |
May
(55) |
Jun
(58) |
Jul
(71) |
Aug
(57) |
Sep
(74) |
Oct
(59) |
Nov
(8) |
Dec
(32) |
| 2007 |
Jan
(60) |
Feb
(40) |
Mar
(50) |
Apr
(26) |
May
(61) |
Jun
(120) |
Jul
(119) |
Aug
(48) |
Sep
(121) |
Oct
(66) |
Nov
(103) |
Dec
(43) |
| 2008 |
Jan
(60) |
Feb
(109) |
Mar
(92) |
Apr
(106) |
May
(82) |
Jun
(59) |
Jul
(67) |
Aug
(118) |
Sep
(131) |
Oct
(56) |
Nov
(37) |
Dec
(69) |
| 2009 |
Jan
(75) |
Feb
(76) |
Mar
(103) |
Apr
(78) |
May
(61) |
Jun
(35) |
Jul
(66) |
Aug
(69) |
Sep
(166) |
Oct
(46) |
Nov
(72) |
Dec
(65) |
| 2010 |
Jan
(48) |
Feb
(57) |
Mar
(93) |
Apr
(85) |
May
(123) |
Jun
(82) |
Jul
(98) |
Aug
(121) |
Sep
(146) |
Oct
(86) |
Nov
(72) |
Dec
(34) |
| 2011 |
Jan
(96) |
Feb
(55) |
Mar
(73) |
Apr
(57) |
May
(33) |
Jun
(74) |
Jul
(89) |
Aug
(71) |
Sep
(103) |
Oct
(76) |
Nov
(52) |
Dec
(61) |
| 2012 |
Jan
(48) |
Feb
(54) |
Mar
(78) |
Apr
(60) |
May
(75) |
Jun
(59) |
Jul
(33) |
Aug
(66) |
Sep
(43) |
Oct
(46) |
Nov
(75) |
Dec
(51) |
| 2013 |
Jan
(112) |
Feb
(72) |
Mar
(49) |
Apr
(48) |
May
(42) |
Jun
(44) |
Jul
(80) |
Aug
(19) |
Sep
(33) |
Oct
(37) |
Nov
(38) |
Dec
(98) |
| 2014 |
Jan
(113) |
Feb
(93) |
Mar
(49) |
Apr
(106) |
May
(97) |
Jun
(155) |
Jul
(87) |
Aug
(127) |
Sep
(85) |
Oct
(48) |
Nov
(41) |
Dec
(37) |
| 2015 |
Jan
(34) |
Feb
(50) |
Mar
(104) |
Apr
(80) |
May
(82) |
Jun
(66) |
Jul
(41) |
Aug
(84) |
Sep
(37) |
Oct
(65) |
Nov
(83) |
Dec
(52) |
| 2016 |
Jan
(68) |
Feb
(35) |
Mar
(42) |
Apr
(35) |
May
(54) |
Jun
(75) |
Jul
(45) |
Aug
(52) |
Sep
(60) |
Oct
(52) |
Nov
(36) |
Dec
(64) |
| 2017 |
Jan
(92) |
Feb
(59) |
Mar
(35) |
Apr
(53) |
May
(83) |
Jun
(43) |
Jul
(65) |
Aug
(68) |
Sep
(46) |
Oct
(75) |
Nov
(40) |
Dec
(49) |
| 2018 |
Jan
(68) |
Feb
(54) |
Mar
(48) |
Apr
(58) |
May
(51) |
Jun
(44) |
Jul
(40) |
Aug
(68) |
Sep
(35) |
Oct
(15) |
Nov
(7) |
Dec
(37) |
| 2019 |
Jan
(43) |
Feb
(7) |
Mar
(22) |
Apr
(21) |
May
(31) |
Jun
(39) |
Jul
(73) |
Aug
(45) |
Sep
(47) |
Oct
(89) |
Nov
(19) |
Dec
(69) |
| 2020 |
Jan
(52) |
Feb
(63) |
Mar
(45) |
Apr
(59) |
May
(42) |
Jun
(57) |
Jul
(30) |
Aug
(29) |
Sep
(75) |
Oct
(64) |
Nov
(96) |
Dec
(22) |
| 2021 |
Jan
(14) |
Feb
(24) |
Mar
(35) |
Apr
(58) |
May
(36) |
Jun
(15) |
Jul
(18) |
Aug
(31) |
Sep
(30) |
Oct
(33) |
Nov
(27) |
Dec
(16) |
| 2022 |
Jan
(35) |
Feb
(22) |
Mar
(14) |
Apr
(20) |
May
(44) |
Jun
(53) |
Jul
(25) |
Aug
(56) |
Sep
(11) |
Oct
(47) |
Nov
(22) |
Dec
(36) |
| 2023 |
Jan
(30) |
Feb
(17) |
Mar
(31) |
Apr
(48) |
May
(31) |
Jun
(7) |
Jul
(25) |
Aug
(26) |
Sep
(61) |
Oct
(66) |
Nov
(19) |
Dec
(21) |
| 2024 |
Jan
(37) |
Feb
(29) |
Mar
(26) |
Apr
(26) |
May
(34) |
Jun
(9) |
Jul
(27) |
Aug
(13) |
Sep
(15) |
Oct
(25) |
Nov
(13) |
Dec
(8) |
| 2025 |
Jan
(13) |
Feb
(1) |
Mar
(16) |
Apr
(17) |
May
(8) |
Jun
(6) |
Jul
(9) |
Aug
|
Sep
(6) |
Oct
(15) |
Nov
(6) |
Dec
|
| 2026 |
Jan
(6) |
Feb
(4) |
Mar
(20) |
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Philippe H. <phi...@ex...> - 2022-12-02 13:24:19
|
<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto">How about shifted log normal?<br><br><div dir="ltr">Regards<div><br></div><div>Philippe Hatstadt</div><div>+1-203-252-0408</div><div><br></div></div><div dir="ltr"><br><blockquote type="cite">On Dec 2, 2022, at 7:54 AM, Ashish Bansal <ash...@gm...> wrote:<br><br></blockquote></div><blockquote type="cite"><div dir="ltr"><div dir="ltr">Thanks a lot Philippe and Jonathan for the help. Really appreciate it.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, 2 Dec 2022 at 18:12, Jonathan Sweemer <<a href="mailto:sw...@gm...">sw...@gm...</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Generally you wouldn't use the Black-Scholes model to price options on calendar spreads because the assumption of geometric Brownian motion is not valid.<br><div><br></div><div>As a first step, you might consider using an arithmetic Brownian motion, which can go negative. Iain Clark's excellent book briefly mentions this in a footnote on page 13.</div><div><br></div><div><a href="https://books.google.co.kr/books?id=7vua-0-2sgMC&pg=PT31&source=gbs_toc_r&cad=3#v=onepage&q&f=false" target="_blank">https://books.google.co.kr/books?id=7vua-0-2sgMC&pg=PT31&source=gbs_toc_r&cad=3#v=onepage&q&f=false</a><br></div><div><br></div><div>There are some Bachelier functions in QuantLib that don't appear to require a positive strike but I haven't used them before, so I might be wrong. Seems like a good place to start though.</div><div><br></div><div><a href="https://github.com/lballabio/QuantLib/blob/master/ql/pricingengines/blackformula.cpp#L704" target="_blank">https://github.com/lballabio/QuantLib/blob/master/ql/pricingengines/blackformula.cpp#L704</a><br></div><div><br></div><div>For more advanced modeling of this product, you'll probably have to implement something bespoke.</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Dec 2, 2022 at 6:55 PM Ashish Bansal <<a href="mailto:ash...@gm..." target="_blank">ash...@gm...</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi,<br><div><br></div><div>I use the Blackscholes engine to evaluate the commodity options. However, it supports only positive strikes and throws error for a negative strike. </div><div><br></div><div>Now, I wish to evaluate the spread options traded on CBOT:<br><a href="https://www.cmegroup.com/markets/agriculture/grains/corn.quotes.options.html#optionProductId=2730" target="_blank">Consecutive Corn CSO Quotes - CME Group</a><br></div><div><br></div><div>How can I evaluate these using Quantlib? Any suggestions on the correct engine to use which supports the negative strike?</div><div><br></div><div>Thanks</div><div>Ashish Bansal</div></div> _______________________________________________<br> QuantLib-users mailing list<br> <a href="mailto:Qua...@li..." target="_blank">Qua...@li...</a><br> <a href="https://lists.sourceforge.net/lists/listinfo/quantlib-users" rel="noreferrer" target="_blank">https://lists.sourceforge.net/lists/listinfo/quantlib-users</a><br> </blockquote></div> </blockquote></div> <span>_______________________________________________</span><br><span>QuantLib-users mailing list</span><br><span>Qua...@li...</span><br><span>https://lists.sourceforge.net/lists/listinfo/quantlib-users</span><br></div></blockquote></body></html> <br> <p dir="ltr" style="line-height:1.2;margin-top:4pt;margin-bottom:0pt"><span style="font-family:Arial;background-color:transparent;font-size:9pt;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap">Broker-Dealer services offered through Exos Securities LLC, member of </span><a href="http://www.sipc.org/" style="font-family:Arial;font-size:medium" target="_blank"><span style="font-size:9pt;color:rgb(17,85,204);background-color:transparent;vertical-align:baseline;white-space:pre-wrap">SIPC</span></a><span style="font-family:Arial;background-color:transparent;font-size:9pt;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap"> / </span><span style="font-family:Arial;background-color:transparent;font-size:9pt;color:rgb(17,85,204);vertical-align:baseline;white-space:pre-wrap"><a href="http://www.finra.org/" target="_blank">FINRA</a></span><span style="font-family:Arial;background-color:transparent;font-size:9pt;color:rgb(34,34,34);vertical-align:baseline;white-space:pre-wrap"> / <a href="https://brokercheck.finra.org/" target="_blank">BrokerCheck </a>/ 2022 Exos, inc. For important disclosures, </span><span style="font-family:Arial;background-color:transparent;font-size:9pt;color:rgb(17,85,204);vertical-align:baseline;white-space:pre-wrap"><a href="https://www.exosfinancial.com/general-disclosures" target="_blank">click here</a></span><span style="font-family:Arial;background-color:transparent;font-size:9pt;color:rgb(34,34,34);vertical-align:baseline;white-space:pre-wrap">. </span><br></p><p dir="ltr" style="line-height:1.2;margin-top:4pt;margin-bottom:0pt"><br></p> |
|
From: Ashish B. <ash...@gm...> - 2022-12-02 13:02:38
|
Interest rates work with shifted log normal. Would commodity prices work with that? Do you have any reference where i can see what adjustments to make for shifting the CM prices. Ashish On Fri, 2 Dec 2022 at 18:26, Philippe Hatstadt < phi...@ex...> wrote: > How about shifted log normal? > > Regards > > Philippe Hatstadt > +1-203-252-0408 > > > On Dec 2, 2022, at 7:54 AM, Ashish Bansal <ash...@gm...> wrote: > > > Thanks a lot Philippe and Jonathan for the help. Really appreciate it. > > On Fri, 2 Dec 2022 at 18:12, Jonathan Sweemer <sw...@gm...> wrote: > >> Generally you wouldn't use the Black-Scholes model to price options on >> calendar spreads because the assumption of geometric Brownian motion is not >> valid. >> >> As a first step, you might consider using an arithmetic Brownian motion, >> which can go negative. Iain Clark's excellent book briefly mentions this in >> a footnote on page 13. >> >> >> https://books.google.co.kr/books?id=7vua-0-2sgMC&pg=PT31&source=gbs_toc_r&cad=3#v=onepage&q&f=false >> >> There are some Bachelier functions in QuantLib that don't appear to >> require a positive strike but I haven't used them before, so I might be >> wrong. Seems like a good place to start though. >> >> >> https://github.com/lballabio/QuantLib/blob/master/ql/pricingengines/blackformula.cpp#L704 >> >> For more advanced modeling of this product, you'll probably have to >> implement something bespoke. >> >> >> On Fri, Dec 2, 2022 at 6:55 PM Ashish Bansal <ash...@gm...> >> wrote: >> >>> Hi, >>> >>> I use the Blackscholes engine to evaluate the commodity options. >>> However, it supports only positive strikes and throws error for a negative >>> strike. >>> >>> Now, I wish to evaluate the spread options traded on CBOT: >>> Consecutive Corn CSO Quotes - CME Group >>> <https://www.cmegroup.com/markets/agriculture/grains/corn.quotes.options.html#optionProductId=2730> >>> >>> How can I evaluate these using Quantlib? Any suggestions on the correct >>> engine to use which supports the negative strike? >>> >>> Thanks >>> Ashish Bansal >>> _______________________________________________ >>> QuantLib-users mailing list >>> Qua...@li... >>> https://lists.sourceforge.net/lists/listinfo/quantlib-users >>> >> _______________________________________________ > QuantLib-users mailing list > Qua...@li... > https://lists.sourceforge.net/lists/listinfo/quantlib-users > > > Broker-Dealer services offered through Exos Securities LLC, member of SIPC > <http://www.sipc.org/> / FINRA <http://www.finra.org/> / BrokerCheck > <https://brokercheck.finra.org/>/ 2022 Exos, inc. For important > disclosures, click here > <https://www.exosfinancial.com/general-disclosures>. > > > |
|
From: Ashish B. <ash...@gm...> - 2022-12-02 13:01:29
|
Specific to IV, i didn't calculate IV for barriers so not sure. The IV is not implied for all the option types like for averaging options, it doesn't work. However, i do see the same being implemented for Barriers: https://github.com/lballabio/QuantLib/blob/2536f0e3db681f4cb8f4972f09d561e8f085b5ea/ql/instruments/barrieroption.cpp#L51 Volatility BarrierOption::impliedVolatility( Real targetValue, const ext::shared_ptr<GeneralizedBlackScholesProcess>& process, Real accuracy, Size maxEvaluations, Volatility minVol, Volatility maxVol) What error are you getting? Try to enter more arguments in it and try. Regards Ashish On Fri, 2 Dec 2022 at 17:15, Elric StormBringer < elr...@gm...> wrote: > thanks everyone, very grateful for all the helpful responses. > > perhaps to be a bit more clear; I was having problems with the FX Touch > Barrier Options > 1. When I specified the option is Vanilla European : option = > ql.VanillaOption(payoff, exercise) > -> using the option.impliedVolatility(premium, process) *** works *** [see > screenshot below[/ > > 2. But when I specify the product type to be anything else, it no longer > works, and I just get error messages... > -> so, is it we need more special arguments for non-European-Vanilla? Or > does the Implied Volatility work *** ONLY *** for European Vanilla Options? > > [image: image.png] > > > > > [image: image.png] > > > On Fri, 2 Dec 2022 at 17:41, Ashish Bansal <ash...@gm...> > wrote: > >> Hi Elric, >> >> If you want a basic code for barrier then I wrote 1 in this thread: >> https://sourceforge.net/p/quantlib/mailman/message/37670218/ >> >> can also refer to the examples of barrier options in this test suite if >> you are comfortable with C++: >> >> https://github.com/lballabio/QuantLib/blob/master/test-suite/barrieroption.cpp >> >> Thanks >> Ashish >> >> On Wed, 30 Nov 2022 at 18:21, Jonathan Sweemer <sw...@gm...> wrote: >> >>> Hi Kiann, >>> >>> I'm surprised that the error you're seeing isn't related to the >>> arguments you pass to BlackScholesProcess. You should be passing term >>> structure objects instead of numerical values. >>> >>> See these links for more information: >>> >>> 1. >>> https://quantlib-python-docs.readthedocs.io/en/latest/stochastic_processes.html#blackscholesprocess >>> 2. >>> https://github.com/lballabio/QuantLib-SWIG/blob/master/SWIG/stochasticprocess.i#L116-L121 >>> 3. >>> https://stackoverflow.com/questions/4891490/calculating-europeanoptionimpliedvolatility-in-quantlib-python >>> >>> >>> >>> On Wed, Nov 30, 2022 at 8:13 PM Elric StormBringer < >>> elr...@gm...> wrote: >>> >>>> Hi there, a noob using/investigationg QuantLib library via python. >>>> >>>> Great job there guys! >>>> >>>> I've been browsing the online documentation, but still having problem >>>> trying to find the 'arguments' and 'fields' inside each. >>>> For example, after I've defined the trade details/market-data/engine >>>> for : ql.BarrierOption.impliedVolatility >>>> -> I am trying to use .ImpliedVolatility. >>>> -> However, I am getting errors from my input fields >>>> : option_.impliedVolatility(0.01, ql.BlackScholesProcess(1.0, 0.0, 0.3)) >>>> >>>> Can I check, what are the syntax of the data-fields to be used? The >>>> error message is : impliedVolatility() missing 2 required positional >>>> arguments: 'targetValue' and 'process' >>>> >>>> Kind regards >>>> Kiann >>>> _______________________________________________ >>>> 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: Ashish B. <ash...@gm...> - 2022-12-02 12:53:42
|
Thanks a lot Philippe and Jonathan for the help. Really appreciate it. On Fri, 2 Dec 2022 at 18:12, Jonathan Sweemer <sw...@gm...> wrote: > Generally you wouldn't use the Black-Scholes model to price options on > calendar spreads because the assumption of geometric Brownian motion is not > valid. > > As a first step, you might consider using an arithmetic Brownian motion, > which can go negative. Iain Clark's excellent book briefly mentions this in > a footnote on page 13. > > > https://books.google.co.kr/books?id=7vua-0-2sgMC&pg=PT31&source=gbs_toc_r&cad=3#v=onepage&q&f=false > > There are some Bachelier functions in QuantLib that don't appear to > require a positive strike but I haven't used them before, so I might be > wrong. Seems like a good place to start though. > > > https://github.com/lballabio/QuantLib/blob/master/ql/pricingengines/blackformula.cpp#L704 > > For more advanced modeling of this product, you'll probably have to > implement something bespoke. > > > On Fri, Dec 2, 2022 at 6:55 PM Ashish Bansal <ash...@gm...> > wrote: > >> Hi, >> >> I use the Blackscholes engine to evaluate the commodity options. However, >> it supports only positive strikes and throws error for a negative strike. >> >> Now, I wish to evaluate the spread options traded on CBOT: >> Consecutive Corn CSO Quotes - CME Group >> <https://www.cmegroup.com/markets/agriculture/grains/corn.quotes.options.html#optionProductId=2730> >> >> How can I evaluate these using Quantlib? Any suggestions on the correct >> engine to use which supports the negative strike? >> >> Thanks >> Ashish Bansal >> _______________________________________________ >> QuantLib-users mailing list >> Qua...@li... >> https://lists.sourceforge.net/lists/listinfo/quantlib-users >> > |
|
From: Jonathan S. <sw...@gm...> - 2022-12-02 12:42:13
|
Generally you wouldn't use the Black-Scholes model to price options on calendar spreads because the assumption of geometric Brownian motion is not valid. As a first step, you might consider using an arithmetic Brownian motion, which can go negative. Iain Clark's excellent book briefly mentions this in a footnote on page 13. https://books.google.co.kr/books?id=7vua-0-2sgMC&pg=PT31&source=gbs_toc_r&cad=3#v=onepage&q&f=false There are some Bachelier functions in QuantLib that don't appear to require a positive strike but I haven't used them before, so I might be wrong. Seems like a good place to start though. https://github.com/lballabio/QuantLib/blob/master/ql/pricingengines/blackformula.cpp#L704 For more advanced modeling of this product, you'll probably have to implement something bespoke. On Fri, Dec 2, 2022 at 6:55 PM Ashish Bansal <ash...@gm...> wrote: > Hi, > > I use the Blackscholes engine to evaluate the commodity options. However, > it supports only positive strikes and throws error for a negative strike. > > Now, I wish to evaluate the spread options traded on CBOT: > Consecutive Corn CSO Quotes - CME Group > <https://www.cmegroup.com/markets/agriculture/grains/corn.quotes.options.html#optionProductId=2730> > > How can I evaluate these using Quantlib? Any suggestions on the correct > engine to use which supports the negative strike? > > Thanks > Ashish Bansal > _______________________________________________ > QuantLib-users mailing list > Qua...@li... > https://lists.sourceforge.net/lists/listinfo/quantlib-users > |
|
From: Elric S. <elr...@gm...> - 2022-12-02 11:45:33
|
thanks everyone, very grateful for all the helpful responses. perhaps to be a bit more clear; I was having problems with the FX Touch Barrier Options 1. When I specified the option is Vanilla European : option = ql.VanillaOption(payoff, exercise) -> using the option.impliedVolatility(premium, process) *** works *** [see screenshot below[/ 2. But when I specify the product type to be anything else, it no longer works, and I just get error messages... -> so, is it we need more special arguments for non-European-Vanilla? Or does the Implied Volatility work *** ONLY *** for European Vanilla Options? [image: image.png] [image: image.png] On Fri, 2 Dec 2022 at 17:41, Ashish Bansal <ash...@gm...> wrote: > Hi Elric, > > If you want a basic code for barrier then I wrote 1 in this thread: > https://sourceforge.net/p/quantlib/mailman/message/37670218/ > > can also refer to the examples of barrier options in this test suite if > you are comfortable with C++: > > https://github.com/lballabio/QuantLib/blob/master/test-suite/barrieroption.cpp > > Thanks > Ashish > > On Wed, 30 Nov 2022 at 18:21, Jonathan Sweemer <sw...@gm...> wrote: > >> Hi Kiann, >> >> I'm surprised that the error you're seeing isn't related to the arguments >> you pass to BlackScholesProcess. You should be passing term structure >> objects instead of numerical values. >> >> See these links for more information: >> >> 1. >> https://quantlib-python-docs.readthedocs.io/en/latest/stochastic_processes.html#blackscholesprocess >> 2. >> https://github.com/lballabio/QuantLib-SWIG/blob/master/SWIG/stochasticprocess.i#L116-L121 >> 3. >> https://stackoverflow.com/questions/4891490/calculating-europeanoptionimpliedvolatility-in-quantlib-python >> >> >> >> On Wed, Nov 30, 2022 at 8:13 PM Elric StormBringer < >> elr...@gm...> wrote: >> >>> Hi there, a noob using/investigationg QuantLib library via python. >>> >>> Great job there guys! >>> >>> I've been browsing the online documentation, but still having problem >>> trying to find the 'arguments' and 'fields' inside each. >>> For example, after I've defined the trade details/market-data/engine for >>> : ql.BarrierOption.impliedVolatility >>> -> I am trying to use .ImpliedVolatility. >>> -> However, I am getting errors from my input fields >>> : option_.impliedVolatility(0.01, ql.BlackScholesProcess(1.0, 0.0, 0.3)) >>> >>> Can I check, what are the syntax of the data-fields to be used? The >>> error message is : impliedVolatility() missing 2 required positional >>> arguments: 'targetValue' and 'process' >>> >>> Kind regards >>> Kiann >>> _______________________________________________ >>> 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: Ashish B. <ash...@gm...> - 2022-12-02 09:50:49
|
Hi, I use the Blackscholes engine to evaluate the commodity options. However, it supports only positive strikes and throws error for a negative strike. Now, I wish to evaluate the spread options traded on CBOT: Consecutive Corn CSO Quotes - CME Group <https://www.cmegroup.com/markets/agriculture/grains/corn.quotes.options.html#optionProductId=2730> How can I evaluate these using Quantlib? Any suggestions on the correct engine to use which supports the negative strike? Thanks Ashish Bansal |
|
From: Ashish B. <ash...@gm...> - 2022-12-02 09:41:59
|
Hi Elric, If you want a basic code for barrier then I wrote 1 in this thread: https://sourceforge.net/p/quantlib/mailman/message/37670218/ can also refer to the examples of barrier options in this test suite if you are comfortable with C++: https://github.com/lballabio/QuantLib/blob/master/test-suite/barrieroption.cpp Thanks Ashish On Wed, 30 Nov 2022 at 18:21, Jonathan Sweemer <sw...@gm...> wrote: > Hi Kiann, > > I'm surprised that the error you're seeing isn't related to the arguments > you pass to BlackScholesProcess. You should be passing term structure > objects instead of numerical values. > > See these links for more information: > > 1. > https://quantlib-python-docs.readthedocs.io/en/latest/stochastic_processes.html#blackscholesprocess > 2. > https://github.com/lballabio/QuantLib-SWIG/blob/master/SWIG/stochasticprocess.i#L116-L121 > 3. > https://stackoverflow.com/questions/4891490/calculating-europeanoptionimpliedvolatility-in-quantlib-python > > > > On Wed, Nov 30, 2022 at 8:13 PM Elric StormBringer < > elr...@gm...> wrote: > >> Hi there, a noob using/investigationg QuantLib library via python. >> >> Great job there guys! >> >> I've been browsing the online documentation, but still having problem >> trying to find the 'arguments' and 'fields' inside each. >> For example, after I've defined the trade details/market-data/engine for >> : ql.BarrierOption.impliedVolatility >> -> I am trying to use .ImpliedVolatility. >> -> However, I am getting errors from my input fields >> : option_.impliedVolatility(0.01, ql.BlackScholesProcess(1.0, 0.0, 0.3)) >> >> Can I check, what are the syntax of the data-fields to be used? The error >> message is : impliedVolatility() missing 2 required positional >> arguments: 'targetValue' and 'process' >> >> Kind regards >> Kiann >> _______________________________________________ >> 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: Jonathan S. <sw...@gm...> - 2022-11-30 12:51:16
|
Hi Kiann, I'm surprised that the error you're seeing isn't related to the arguments you pass to BlackScholesProcess. You should be passing term structure objects instead of numerical values. See these links for more information: 1. https://quantlib-python-docs.readthedocs.io/en/latest/stochastic_processes.html#blackscholesprocess 2. https://github.com/lballabio/QuantLib-SWIG/blob/master/SWIG/stochasticprocess.i#L116-L121 3. https://stackoverflow.com/questions/4891490/calculating-europeanoptionimpliedvolatility-in-quantlib-python On Wed, Nov 30, 2022 at 8:13 PM Elric StormBringer < elr...@gm...> wrote: > Hi there, a noob using/investigationg QuantLib library via python. > > Great job there guys! > > I've been browsing the online documentation, but still having problem > trying to find the 'arguments' and 'fields' inside each. > For example, after I've defined the trade details/market-data/engine for : > ql.BarrierOption.impliedVolatility > -> I am trying to use .ImpliedVolatility. > -> However, I am getting errors from my input fields > : option_.impliedVolatility(0.01, ql.BlackScholesProcess(1.0, 0.0, 0.3)) > > Can I check, what are the syntax of the data-fields to be used? The error > message is : impliedVolatility() missing 2 required positional arguments: > 'targetValue' and 'process' > > Kind regards > Kiann > _______________________________________________ > QuantLib-users mailing list > Qua...@li... > https://lists.sourceforge.net/lists/listinfo/quantlib-users > |
|
From: Diego D'A. <die...@gm...> - 2022-11-30 12:47:30
|
Hi Elric, Have you provided the market price from which you want to derive the implied vol? When I read that the targetValue is missing, that is what comes to my mind. Cheers, Diego On Wed, 30 Nov 2022, 11:11 Elric StormBringer, < elr...@gm...> wrote: > Hi there, a noob using/investigationg QuantLib library via python. > > Great job there guys! > > I've been browsing the online documentation, but still having problem > trying to find the 'arguments' and 'fields' inside each. > For example, after I've defined the trade details/market-data/engine for : > ql.BarrierOption.impliedVolatility > -> I am trying to use .ImpliedVolatility. > -> However, I am getting errors from my input fields > : option_.impliedVolatility(0.01, ql.BlackScholesProcess(1.0, 0.0, 0.3)) > > Can I check, what are the syntax of the data-fields to be used? The error > message is : impliedVolatility() missing 2 required positional arguments: > 'targetValue' and 'process' > > Kind regards > Kiann > _______________________________________________ > QuantLib-users mailing list > Qua...@li... > https://lists.sourceforge.net/lists/listinfo/quantlib-users > |
|
From: Elric S. <elr...@gm...> - 2022-11-30 11:10:27
|
Hi there, a noob using/investigationg QuantLib library via python. Great job there guys! I've been browsing the online documentation, but still having problem trying to find the 'arguments' and 'fields' inside each. For example, after I've defined the trade details/market-data/engine for : ql.BarrierOption.impliedVolatility -> I am trying to use .ImpliedVolatility. -> However, I am getting errors from my input fields : option_.impliedVolatility(0.01, ql.BlackScholesProcess(1.0, 0.0, 0.3)) Can I check, what are the syntax of the data-fields to be used? The error message is : impliedVolatility() missing 2 required positional arguments: 'targetValue' and 'process' Kind regards Kiann |
|
From: Peter C. <pca...@gm...> - 2022-11-25 18:01:02
|
Hi Marek not sure what PCHIP exactly refers to (MatLab ?), but if that is a Hermite Spline you probably want to use CubicInterpolation with a FirstDerivative boundary condition. Plus probably monotonic = true if I read the docs correctly. https://www.mathworks.com/help/matlab/ref/pchip.html Thanks Peter On Mon, 21 Nov 2022 at 19:14, Marek Grasshoff <mar...@gm...> wrote: > > Anyone knows please? > > Mar...@gm... > 0 (044) 778 778 0850 > > On 13 Nov 2022, at 20:06, Marek Grasshoff <mar...@gm...> wrote: > > > > Hi, > > > > I was wondering which interpolation method in QuantLib corresponds to PCHIP? > > > > I tried MonotonicCubicNaturalSpline, but a.) the results don’t match pchip and b.) it actually does overshoot > > > > Example: y = 1/(1+x^2) > > Set samples for x = -5, -4.3, -3.6, -2.9, -2.2, -1.5, -0.8, -0.1, 0.6, 1.3, 2, 2.7, 3.4, 4.1, 4.8 > > And you will see for x_target = 0.0 an overshoot (the interpolation for x = 0.0 is bigger than any of the sample y) > > > > > > > > > > _______________________________________________ > 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: Marek G. <mar...@gm...> - 2022-11-21 18:14:09
|
Anyone knows please? Mar...@gm... 0 (044) 778 778 0850 On 13 Nov 2022, at 20:06, Marek Grasshoff <mar...@gm...> wrote: Hi, I was wondering which interpolation method in QuantLib corresponds to PCHIP? I tried MonotonicCubicNaturalSpline, but a.) the results don’t match pchip and b.) it actually does overshoot Example: y = 1/(1+x^2) Set samples for x = -5, -4.3, -3.6, -2.9, -2.2, -1.5, -0.8, -0.1, 0.6, 1.3, 2, 2.7, 3.4, 4.1, 4.8 And you will see for x_target = 0.0 an overshoot (the interpolation for x = 0.0 is bigger than any of the sample y) _______________________________________________ QuantLib-users mailing list Qua...@li... https://lists.sourceforge.net/lists/listinfo/quantlib-users |
|
From: Jorg L. <jo...@xc...> - 2022-11-21 17:15:25
|
Fixing a typo below: https://github.com/xcelerit/XAD Regards, Jörg On Mon, 21 Nov 2022 at 13:59, Jorg Lotze <jo...@xc...> wrote: > > Hi all, > > Adjoint algorithmic differentiation (AAD) can now be enabled in > QuantLib using the open-source XAD AAD tool > <https://github.com/xcelerit/XAD> and an XAD/QuantLib integration > module <https://github.com/xcelerit/qlxad>. > > QuantLib's AAD-compatibility is actively maintained via automated > CI/CD checks, running daily against QuantLib's master branch > <https://github.com/xcelerit/qlxad/actions/workflows/ci.yaml>. > > We'd love to hear your feedback and pull requests are welcome. > > Regards, > Jörg Lotze |
|
From: Jorg L. <jo...@xc...> - 2022-11-21 15:52:46
|
Hi all, Adjoint algorithmic differentiation (AAD) can now be enabled in QuantLib using the open-source XAD AAD tool <https://github.com/xelerit/XAD> and an XAD/QuantLib integration module <https://github.com/xcelerit/qlxad>. QuantLib's AAD-compatibility is actively maintained via automated CI/CD checks, running daily against QuantLib's master branch <https://github.com/xcelerit/qlxad/actions/workflows/ci.yaml>. We'd love to hear your feedback and pull requests are welcome. Regards, Jörg Lotze |
|
From: Ashish B. <ash...@gm...> - 2022-11-19 11:00:30
|
Hi Klaus, Thanks for response. Where could I read about our get example of what you suggested: "one or two damping steps or use the TrBDF2 scheme." By damping step do you mean by shocking the underlying price revaluating the option? Regards Ashish On Sat, Nov 19, 2022, 3:50 PM Klaus Spanderen <kl...@sp...> wrote: > Hi Ashish, > > > > the gamma is in absolute terms, meaning just the second derivative of the > npv w.r.t. the underlying. By default QuantLib is using Crank-Nicolson > scheme, which is fast but might give instable gammas for some ATM options. > To stablize the gamma you can either use one or two damping steps or use > the TrBDF2 scheme. > > > > best regards > > Klaus > > > > On Donnerstag, 17. November 2022 13:31:29 CET Ashish Bansal wrote: > > Hi, > > > I am calculating the option gamma using the following functions: > engine = FdBlackScholesVanillaEngine > Process = BlackScholesMertonProcess > payoff = PlainVanillaPayoff with american option > gamma function = option.gamma() > > > For a few of the options, I am getting the gamma more than 1, up to 13. I > want to know if the above function returns the gamma in percentage terms or > decimal. Should I be dividing the gamma by 100 to get the correct value? > > > Regards, > > Ashish > > > > |
|
From: Klaus S. <kl...@sp...> - 2022-11-19 10:24:09
|
Hi Ashish, the gamma is in absolute terms, meaning just the second derivative of the npv w.r.t. the underlying. By default QuantLib is using Crank-Nicolson scheme, which is fast but might give instable gammas for some ATM options. To stablize the gamma you can either use one or two damping steps or use the TrBDF2 scheme. best regards Klaus On Donnerstag, 17. November 2022 13:31:29 CET Ashish Bansal wrote: Hi, I am calculating the option gamma using the following functions:engine = FdBlackScholesVanillaEngineProcess = BlackScholesMertonProcesspayoff = PlainVanillaPayoff with american optiongamma function = option.gamma() For a few of the options, I am getting the gamma more than 1, up to 13. I want to know if the above function returns the gamma in percentage terms or decimal. Should I be dividing the gamma by 100 to get the correct value? Regards, Ashish |
|
From: Ashish B. <ash...@gm...> - 2022-11-17 12:31:27
|
Hi, I am calculating the option gamma using the following functions: engine = FdBlackScholesVanillaEngine Process = BlackScholesMertonProcess payoff = PlainVanillaPayoff with american option gamma function = option.gamma() For a few of the options, I am getting the gamma more than 1, up to 13. I want to know if the above function returns the gamma in percentage terms or decimal. Should I be dividing the gamma by 100 to get the correct value? Regards, Ashish |
|
From: Wojciech S. <woj...@gm...> - 2022-11-17 09:46:28
|
Klaus,
I agree with Dan, it is very usefull, it deserves posting in
Python/examples directory.
Regards,
Wojtek
czw., 17 lis 2022, 02:29 użytkownik Dan VolPM <dan...@gm...> napisał:
> Thank you so much Klaus, this is extremely useful and thorough and
> definitely helps a ton !
>
> On Tue, Nov 15, 2022 at 5:32 PM Klaus Spanderen <kl...@sp...>
> wrote:
>
>> Hi Dan,
>>
>>
>>
>> please find below an example of a Andreasen-Huge local volatility
>> calibration, a Monte-Carlo pricing of one of the calibration options using
>> this local volatility surface and the comparison with the expected result.
>>
>>
>>
>> W.r.t. point 1, the GeneralizedBlackScholesProcess should be constructed
>> directly using the local volatility surface from the Andreasen-Huge
>> algorithm (see code below), not the implied volatility surface from the
>> Andreasen-Huge interpolation algorithm. In the latter case the process
>> would use Dupire's equation to get back the local volatility, which is
>> notourisly instable and might lead to arbitrage violations.
>>
>>
>>
>> I hope the example code below helps wr.t. 2 and 3.
>>
>>
>>
>> best regards
>>
>> Klaus
>>
>>
>>
>>
>>
>> import math
>>
>> import QuantLib as ql
>>
>>
>>
>> if __name__ == "__main__":
>>
>> today = ql.Date.todaysDate()
>>
>> ql.Settings.instance().evaluationDate = today
>>
>>
>>
>> spot = ql.QuoteHandle(ql.SimpleQuote(100))
>>
>>
>>
>> dc = ql.Actual365Fixed()
>>
>> qTS = ql.YieldTermStructureHandle(ql.FlatForward(today, 0.025, dc))
>>
>> rTS = ql.YieldTermStructureHandle(ql.FlatForward(today, 0.05, dc))
>>
>>
>>
>> vol_data = [
>>
>> # maturity in days, strike, volatility
>>
>> (30, 75, 0.13),
>>
>> (30, 100, 0.26),
>>
>> (30, 125, 0.3),
>>
>> (180, 80, 0.4),
>>
>> (180, 150, 0.6),
>>
>> (365, 110, 0.5)]
>>
>>
>>
>> calibration_set = ql.CalibrationSet(
>>
>> [(
>>
>> ql.VanillaOption(
>>
>> ql.PlainVanillaPayoff(ql.Option.Call, strike),
>>
>> ql.EuropeanExercise(today + ql.Period(maturity_in_days, ql.Days))
>>
>> ),
>>
>> ql.SimpleQuote(volatility)
>>
>> ) for maturity_in_days, strike, volatility in vol_data]
>>
>> )
>>
>>
>>
>> local_vol = ql.LocalVolTermStructureHandle(
>>
>> ql.AndreasenHugeLocalVolAdapter(
>>
>> ql.AndreasenHugeVolatilityInterpl(calibration_set, spot, rTS, qTS)
>>
>> )
>>
>> )
>>
>>
>>
>> option = calibration_set[-2][0] # maturity in days: 180, strike: 150,
>> vol: 0.6
>>
>>
>>
>> dummy_vol = ql.BlackVolTermStructureHandle()
>>
>> local_vol_process = ql.GeneralizedBlackScholesProcess(spot, qTS, rTS,
>> dummy_vol, local_vol)
>>
>>
>>
>> option.setPricingEngine(ql.MCEuropeanEngine(
>>
>> local_vol_process, "lowdiscrepancy",
>>
>> timeSteps=100, brownianBridge=True, requiredSamples=32000, seed=42)
>>
>> )
>>
>>
>>
>> T = dc.yearFraction(today, option.exercise().lastDate())
>>
>> fwd = spot.value() * qTS.discount(T) / rTS.discount(T)
>>
>> vol = calibration_set[-2][1].value()
>>
>>
>>
>> expected = ql.BlackCalculator(
>>
>> ql.as_plain_vanilla_payoff(option.payoff()), fwd, vol * math.sqrt(T),
>> rTS.discount(T)).value()
>>
>>
>>
>> print("Expected : %.3f" % expected)
>>
>> print("Local Vol Monte-Carlo: %.3f" % option.NPV())
>>
>>
>>
>> time_steps = 100
>>
>> rsg = ql.GaussianRandomSequenceGenerator(
>>
>> ql.UniformRandomSequenceGenerator(time_steps,
>> ql.UniformRandomGenerator(42))
>>
>> )
>>
>> path_generator = ql.GaussianPathGenerator(local_vol_process, 1.0,
>> time_steps, rsg, False)
>>
>> next_path = path_generator.next().value()
>>
>>
>>
>> print("\nExample path: " + str({next_path.time(i): next_path.value(i) for
>> i in range(len(next_path))}))
>>
>>
>>
>>
>>
> _______________________________________________
> QuantLib-users mailing list
> Qua...@li...
> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>
|
|
From: Dan V. <dan...@gm...> - 2022-11-17 01:28:09
|
Thank you so much Klaus, this is extremely useful and thorough and
definitely helps a ton !
On Tue, Nov 15, 2022 at 5:32 PM Klaus Spanderen <kl...@sp...> wrote:
> Hi Dan,
>
>
>
> please find below an example of a Andreasen-Huge local volatility
> calibration, a Monte-Carlo pricing of one of the calibration options using
> this local volatility surface and the comparison with the expected result.
>
>
>
> W.r.t. point 1, the GeneralizedBlackScholesProcess should be constructed
> directly using the local volatility surface from the Andreasen-Huge
> algorithm (see code below), not the implied volatility surface from the
> Andreasen-Huge interpolation algorithm. In the latter case the process
> would use Dupire's equation to get back the local volatility, which is
> notourisly instable and might lead to arbitrage violations.
>
>
>
> I hope the example code below helps wr.t. 2 and 3.
>
>
>
> best regards
>
> Klaus
>
>
>
>
>
> import math
>
> import QuantLib as ql
>
>
>
> if __name__ == "__main__":
>
> today = ql.Date.todaysDate()
>
> ql.Settings.instance().evaluationDate = today
>
>
>
> spot = ql.QuoteHandle(ql.SimpleQuote(100))
>
>
>
> dc = ql.Actual365Fixed()
>
> qTS = ql.YieldTermStructureHandle(ql.FlatForward(today, 0.025, dc))
>
> rTS = ql.YieldTermStructureHandle(ql.FlatForward(today, 0.05, dc))
>
>
>
> vol_data = [
>
> # maturity in days, strike, volatility
>
> (30, 75, 0.13),
>
> (30, 100, 0.26),
>
> (30, 125, 0.3),
>
> (180, 80, 0.4),
>
> (180, 150, 0.6),
>
> (365, 110, 0.5)]
>
>
>
> calibration_set = ql.CalibrationSet(
>
> [(
>
> ql.VanillaOption(
>
> ql.PlainVanillaPayoff(ql.Option.Call, strike),
>
> ql.EuropeanExercise(today + ql.Period(maturity_in_days, ql.Days))
>
> ),
>
> ql.SimpleQuote(volatility)
>
> ) for maturity_in_days, strike, volatility in vol_data]
>
> )
>
>
>
> local_vol = ql.LocalVolTermStructureHandle(
>
> ql.AndreasenHugeLocalVolAdapter(
>
> ql.AndreasenHugeVolatilityInterpl(calibration_set, spot, rTS, qTS)
>
> )
>
> )
>
>
>
> option = calibration_set[-2][0] # maturity in days: 180, strike: 150, vol:
> 0.6
>
>
>
> dummy_vol = ql.BlackVolTermStructureHandle()
>
> local_vol_process = ql.GeneralizedBlackScholesProcess(spot, qTS, rTS,
> dummy_vol, local_vol)
>
>
>
> option.setPricingEngine(ql.MCEuropeanEngine(
>
> local_vol_process, "lowdiscrepancy",
>
> timeSteps=100, brownianBridge=True, requiredSamples=32000, seed=42)
>
> )
>
>
>
> T = dc.yearFraction(today, option.exercise().lastDate())
>
> fwd = spot.value() * qTS.discount(T) / rTS.discount(T)
>
> vol = calibration_set[-2][1].value()
>
>
>
> expected = ql.BlackCalculator(
>
> ql.as_plain_vanilla_payoff(option.payoff()), fwd, vol * math.sqrt(T),
> rTS.discount(T)).value()
>
>
>
> print("Expected : %.3f" % expected)
>
> print("Local Vol Monte-Carlo: %.3f" % option.NPV())
>
>
>
> time_steps = 100
>
> rsg = ql.GaussianRandomSequenceGenerator(
>
> ql.UniformRandomSequenceGenerator(time_steps,
> ql.UniformRandomGenerator(42))
>
> )
>
> path_generator = ql.GaussianPathGenerator(local_vol_process, 1.0,
> time_steps, rsg, False)
>
> next_path = path_generator.next().value()
>
>
>
> print("\nExample path: " + str({next_path.time(i): next_path.value(i) for
> i in range(len(next_path))}))
>
>
>
>
>
|
|
From: Ben W. <ben...@ma...> - 2022-11-16 07:02:08
|
Is there an example of how to apply x days interest to a bond in QL python. Regards Ben |
|
From: Klaus S. <kl...@sp...> - 2022-11-15 22:44:38
|
Hi Dan,
please find below an example of a Andreasen-Huge local volatility calibration, a Monte-Carlo pricing of one of the calibration options using this local volatility surface and the comparison with the expected result.
W.r.t. point 1, the GeneralizedBlackScholesProcess should be constructed directly using the local volatility surface from the Andreasen-Huge algorithm (see code below), not the implied volatility surface from the Andreasen-Huge interpolation algorithm. In the latter case the process would use Dupire's equation to get back the local volatility, which is notourisly instable and might lead to arbitrage violations.
I hope the example code below helps wr.t. 2 and 3.
best regards
Klaus
import math
import QuantLib as ql
if __name__ == "__main__":
today = ql.Date.todaysDate()
ql.Settings.instance().evaluationDate = today
spot = ql.QuoteHandle(ql.SimpleQuote(100))
dc = ql.Actual365Fixed()
qTS = ql.YieldTermStructureHandle(ql.FlatForward(today, 0.025, dc))
rTS = ql.YieldTermStructureHandle(ql.FlatForward(today, 0.05, dc))
vol_data = [
# maturity in days, strike, volatility
(30, 75, 0.13),
(30, 100, 0.26),
(30, 125, 0.3),
(180, 80, 0.4),
(180, 150, 0.6),
(365, 110, 0.5)]
calibration_set = ql.CalibrationSet(
[(
ql.VanillaOption(
ql.PlainVanillaPayoff(ql.Option.Call, strike),
ql.EuropeanExercise(today + ql.Period(maturity_in_days, ql.Days))
),
ql.SimpleQuote(volatility)
) for maturity_in_days, strike, volatility in vol_data]
)
local_vol = ql.LocalVolTermStructureHandle(
ql.AndreasenHugeLocalVolAdapter(
ql.AndreasenHugeVolatilityInterpl(calibration_set, spot, rTS, qTS)
)
)
option = calibration_set[-2][0] # maturity in days: 180, strike: 150, vol: 0.6
dummy_vol = ql.BlackVolTermStructureHandle()
local_vol_process = ql.GeneralizedBlackScholesProcess(spot, qTS, rTS, dummy_vol, local_vol)
option.setPricingEngine(ql.MCEuropeanEngine(
local_vol_process, "lowdiscrepancy",
timeSteps=100, brownianBridge=True, requiredSamples=32000, seed=42)
)
T = dc.yearFraction(today, option.exercise().lastDate())
fwd = spot.value() * qTS.discount(T) / rTS.discount(T)
vol = calibration_set[-2][1].value()
expected = ql.BlackCalculator(
ql.as_plain_vanilla_payoff(option.payoff()), fwd, vol * math.sqrt(T), rTS.discount(T)).value()
print("Expected : %.3f" % expected)
print("Local Vol Monte-Carlo: %.3f" % option.NPV())
time_steps = 100
rsg = ql.GaussianRandomSequenceGenerator(
ql.UniformRandomSequenceGenerator(time_steps, ql.UniformRandomGenerator(42))
)
path_generator = ql.GaussianPathGenerator(local_vol_process, 1.0, time_steps, rsg, False)
next_path = path_generator.next().value()
print("\nExample path: " + str({next_path.time(i): next_path.value(i) for i in range(len(next_path))}))
|
|
From: Dan V. <dan...@gm...> - 2022-11-14 16:23:06
|
Hello, We try to price a MC product on equity with local volatility. In this regard, I first have a black variance surface with holes from implying vols in the market. Of course simply activating local vol on that surface is not sufficient as many arbitrages are found, therefore this is not a robust enough solution. FYI I am providing a very granular surface because I need precision at every time step to the downside. We tried using the AndreasenHugeLocalVolAdapter as it is supposed to provide an arb free workable local vol surface. But several things: 1. If used with a basic vanilla pricer (for testing purposes) it still finds arbitrages and can't price 2. It is unclear whether we still need to build a Vol Term Structure object and if we do, is there such a thing as a localvoltermstructure object ? if there is, it would be great to know the syntax as we couldn't find anything on it on the web. 3. Lastly, if we manage to fix 1 & 2, how do we go about building a path on the back of that term structure. I couldn't find any localvol processes. Should we build a BlackMerton process except feeding it a localvol term structure ? Will it understand it ? Basically any sample code to generate local vol paths for MC pricing would be greatly appreciated. Thanks, Dan PS: we are using Python |
|
From: Peter C. <pca...@gm...> - 2022-11-14 15:58:32
|
Hi Gaussian1dSwaptionEngine will use curve2 for discounting and curve1 for the floating leg projection. By the way, you can override the discount curve to be used in the engine constructor. Gaussian1dJamshidianSwaptionEngine is a single-curve engine using curve2. If you use Gaussian1dJamshidianSwaptionEngine for calibration, you probably want to set curve 2 = floating leg forwarding curve. Thanks Peter On Sun, 13 Nov 2022 at 15:14, <log...@se...> wrote: > > Hello, > I'm pricing a swaption where the underlying swap's floating leg is based on curve1. > Then I have another curve, say curve2, which I use in GSR like this > model = ql.Gsr(curve2, volStepDates, volatilities, reversions) > > When I use in the swaption pricing: > A) engine = ql.Gaussian1dSwaptionEngine(model) > B) engine = ql.Gaussian1dJamshidianSwaptionEngine(model) > I'm getting quite a significant difference between NPV A) and NPV B), is not due to technical nature of the pricer. > > It feels like Gaussian1dJamshidianSwaptionEngine ignores the floating leg's curve1 (and usese curve2 everywhere), while the Gaussian1dSwaptionEngine takes into account curve1 for the floating leg. Can someone please explain how curves are treated in these pricers? > > Thanks, > M. > _______________________________________________ > QuantLib-users mailing list > Qua...@li... > https://lists.sourceforge.net/lists/listinfo/quantlib-users |
|
From: Marek G. <mar...@gm...> - 2022-11-13 20:06:48
|
Hi, I was wondering which interpolation method in QuantLib corresponds to PCHIP? I tried MonotonicCubicNaturalSpline, but a.) the results don't match pchip and b.) it actually does overshoot Example: y = 1/(1+x^2) Set samples for x = -5, -4.3, -3.6, -2.9, -2.2, -1.5, -0.8, -0.1, 0.6, 1.3, 2, 2.7, 3.4, 4.1, 4.8 And you will see for x_target = 0.0 an overshoot (the interpolation for x = 0.0 is bigger than any of the sample y) |