Binomial American Options with Discrete Dividends & Greeks

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Binomial American Options with Discrete Dividends & Greeks

jamesquant
This post was updated on .
How do I calculate using quantlib C# Binomial American Options with Discrete Dividends & Greeks? any examples or help would be very appreciated.
Reply | Threaded
Open this post in threaded view
|

Re: Binomial American Options with Discrete Dividends & Greeks

Luigi Ballabio
Hi James,
    there's no binomial engine for that, but you can use the FDDividendAmericanEngine and DividendVanillaOption classes; see test-suite/dividendoption.cpp for an example. Due to the way the numerical calculation is performed, the engine doesn't provide all the Greeks natively; only delta and gamma. For the others, you'll have to bump the inputs and reprice the option.

Luigi


On Mon, Nov 2, 2015 at 9:57 AM jamesquant <[hidden email]> wrote:
How do I calculate using quantlib Binomial American Options with Discrete
Dividends & Greeks?



--
View this message in context: http://quantlib.10058.n7.nabble.com/Binomial-American-Options-with-Discrete-Dividends-Greeks-tp17012.html
Sent from the quantlib-dev mailing list archive at Nabble.com.

------------------------------------------------------------------------------
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
--

------------------------------------------------------------------------------

_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

答复: Binomial American Options with Discrete Dividends & Greeks

cheng li
In reply to this post by jamesquant
Just bump an recalculate。。。

-----邮件原件-----
发件人: jamesquant [mailto:[hidden email]]
发送时间: 2015年11月2日 0:11
收件人: [hidden email]
主题: [Quantlib-dev] Binomial American Options with Discrete Dividends &
Greeks

How do I calculate using quantlib Binomial American Options with Discrete
Dividends & Greeks?



--
View this message in context:
http://quantlib.10058.n7.nabble.com/Binomial-American-Options-with-Discrete-
Dividends-Greeks-tp17012.html
Sent from the quantlib-dev mailing list archive at Nabble.com.

----------------------------------------------------------------------------
--
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev


------------------------------------------------------------------------------
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: 答复: Binomial American Options with Discrete Dividends & Greeks

jamesquant
Hi. Do you have an example of how to do this?
Reply | Threaded
Open this post in threaded view
|

Re: 答复: Binomial American Options with Discrete Dividends & Greeks

Luigi Ballabio
In the test suite, https://github.com/lballabio/quantlib/blob/master/QuantLib/test-suite/dividendoption.cpp#L677

The lines from 694 to 725 initialize the option and its market data. Those from 741 to 757 calculates the value and the greeks, and compares the available greeks with those calculated by bumping the data (e.g., to calculate the delta modify thevalue of the underlying, recalculate, and see how much the value has changed; the same approach can be  used for all the other greeks). For an American option, you'll need to specify an American exercise: see line 827.

Luigi


On Tue, Nov 3, 2015 at 11:32 AM jamesquant <[hidden email]> wrote:
Hi. Do you have an example of how to do this?



--
View this message in context: http://quantlib.10058.n7.nabble.com/Binomial-American-Options-with-Discrete-Dividends-Greeks-tp17012p17017.html
Sent from the quantlib-dev mailing list archive at Nabble.com.

------------------------------------------------------------------------------
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
--

------------------------------------------------------------------------------

_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: 答复: Binomial American Options with Discrete Dividends & Greeks

jamesquant
This post was updated on .
Hi Luigi,

Your solution worked well of bumping the data to calculate the greeks apart from theta, the issue is I was +1 day however when expiry was tomorrow then it would hit the expiry date and crash.

 // perturb date and get theta
                Settings.setEvaluationDate(pToday.InnerDateTime.AddHours(1));
                value_p = option.NPV();
                Settings.setEvaluationDate(pToday);

                res[3, 0] = pHeaders ? "Theta" : res[3, 0] = value_p - option.NPV();
                if (pHeaders) res[3, 1] = value_p - option.NPV();

I then tried to plus +1 hour but this wasnt successful, because even with 1 hour before expiry then same issue would happen,

Is the answer to Theta to use a closed formula instead of bumping the data? or is there a better way to manage the datetime issue in QLNET?

Please note I am trying to get this solution to work for European Options now only, not American options.

Best Regards,
James

Reply | Threaded
Open this post in threaded view
|

Re: 答复: Binomial American Options with Discrete Dividends & Greeks

Luigi Ballabio
Hello,
    I don't think QL.NET provides intraday pricing (given that QuantLib itself only did in the latest release, and as an optional feature) so setting the time back one hour won't work.  One thing you can try: if you have the price, delta and gamma (that is, P, dP/du and d^2P/du^2) you might plug them in the Black-Scholes equation and get dP/dt (i.e., the theta).

Luigi


On Fri, Mar 11, 2016 at 12:12 PM jamesquant <[hidden email]> wrote:
Hi Luigi,

Your solution worked well of bumping the data to calculate the greeks apart
from theta, the issue is I was +1 day however when expiry was tomorrow then
it would hit the expiry date and crash.

 // perturb date and get theta

Settings.setEvaluationDate(pToday.InnerDateTime.AddHours(1));
                value_p = option.NPV();
                Settings.setEvaluationDate(pToday);

                res[3, 0] = pHeaders ? "Theta" : res[3, 0] = value_p -
option.NPV();
                if (pHeaders) res[3, 1] = value_p - option.NPV();

I then tried to plus +1 hour but this wasnt successful, because even with 1
hour before expiry then same issue would happen,

Is the answer to Theta to use a closed formula instead of bumping the data?
or is there a better way to manage the datetime issue in QLNET?

Best Regards,
James





--
View this message in context: http://quantlib.10058.n7.nabble.com/Binomial-American-Options-with-Discrete-Dividends-Greeks-tp17012p17343.html
Sent from the quantlib-dev mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785111&iu=/4140
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev

------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev