How to obtain the Greeks

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

How to obtain the Greeks

Ibrahim El-Fayoumi
Hello Luigi
When I tried to use the example with package to obtain the greeks,
I did the following:
......
         // options
        VanillaOption europeanOption(payoff, europeanExercise);
        VanillaOption bermudanOption(payoff, bermudanExercise);
        VanillaOption americanOption(payoff, americanExercise);

        // Analytic formulas:

        // Black-Scholes for European
        method = "Black-Scholes";
        europeanOption.setPricingEngine(boost::shared_ptr<PricingEngine>(
                                     new AnalyticEuropeanEngine(bsmProcess)));
        std::cout << std::setw(widths[0]) << std::left << method
                  << std::fixed
                  << std::setw(widths[1]) << std::left << europeanOption.NPV()
                  << std::setw(widths[2]) << std::left << "N/A"
                  << std::setw(widths[3]) << std::left << "N/A"
                  << std::endl;
        std::cout << europeanObtion.delta();


...

This did not work, what I am missing?

Thanks
ibrahim



-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: How to obtain the Greeks

Luigi Ballabio
On Wed, 2008-01-09 at 13:34 +0000, Ibrahim El-Fayoumi wrote:

> Hello Luigi
> When I tried to use the example with package to obtain the greeks,
> I did the following:
> ......
> // options
>         VanillaOption europeanOption(payoff, europeanExercise);
>         VanillaOption bermudanOption(payoff, bermudanExercise);
>         VanillaOption americanOption(payoff, americanExercise);
>
>         // Analytic formulas:
>
>         // Black-Scholes for European
>         method = "Black-Scholes";
>         europeanOption.setPricingEngine(boost::shared_ptr<PricingEngine>(
>                                      new AnalyticEuropeanEngine(bsmProcess)));
>         std::cout << std::setw(widths[0]) << std::left << method
>                   << std::fixed
>                   << std::setw(widths[1]) << std::left << europeanOption.NPV()
>                   << std::setw(widths[2]) << std::left << "N/A"
>                   << std::setw(widths[3]) << std::left << "N/A"
>                   << std::endl;
> std::cout << europeanObtion.delta();
>
>
> ...
>
> This did not work, what I am missing?

Hi Ibrahim,
        "did not work" as in "compilation error" or "runtime error"? In any
case, what does the error message say exactly?

Luigi


--

The Feynman Problem Solving Algorithm:
1) Write down the problem.
2) Think very hard.
3) Write down the solution.



-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: How to obtain the Greeks

Ibrahim ElFayoumi
Hello Luigi
I got exception, not with the analytic European option but rather the binomial american option

My question whether the greeks are available for all options calculation or not?
I mean, delta, vega, gamma, theta, and rho...

Regards
Ibrahim
On Wed, 2008-01-09 at 13:34 +0000, Ibrahim El-Fayoumi wrote:
> Hello Luigi
> When I tried to use the example with package to obtain the greeks, 
> I did the following:
> ......
> 	 // options
>         VanillaOption europeanOption(payoff, europeanExercise);
>         VanillaOption bermudanOption(payoff, bermudanExercise);
>         VanillaOption americanOption(payoff, americanExercise);
> 
>         // Analytic formulas:
> 
>         // Black-Scholes for European
>         method = "Black-Scholes";
>         europeanOption.setPricingEngine(boost::shared_ptr<PricingEngine>(
>                                      new AnalyticEuropeanEngine(bsmProcess)));
>         std::cout << std::setw(widths[0]) << std::left << method
>                   << std::fixed
>                   << std::setw(widths[1]) << std::left << europeanOption.NPV()
>                   << std::setw(widths[2]) << std::left << "N/A"
>                   << std::setw(widths[3]) << std::left << "N/A"
>                   << std::endl;
> 	std::cout << europeanObtion.delta();
> 
> 
> ...
> 
> This did not work, what I am missing?

Hi Ibrahim,
	"did not work" as in "compilation error" or "runtime error"? In any
case, what does the error message say exactly?

Luigi


Ibrahim El-Fayoumi
Senior Software Engineer

IWL Limited
ABN 53 078 119 212
Level 7, 141 St Georges Terrace
Perth WA Australia 6000
Phone: +61 8 9282 8430
Fax: +61 8 9321 1553
Mobile: 0402 817 354
Email: Ibrahim.El-Fayoumi@iwl.com.au

Visit our corporate website:www.iwl.com.au

This e-mail and any files transmitted with it are confidential and are only for the use of the person to whom they are addressed. If you are not the intended recipient, you are hereby notified that any use, dissemination, forwarding, printing, copying or dealing in any way whatsoever with this e-mail is strictly prohibited. If you have received this e-mail in error, please reply to us immediately and delete the document. It is the recipient's duty to virus scan and otherwise test the enclosed information before using the information or loading attached files onto any computer system. IWL Limited does not warrant that the information contained in this e-mail is free from viruses, defects, errors, interception or interference. Any views expressed in this message are those of the individual sender, except where that sender specifically states them to be the views of IWL Limited.

IWL Disclaimer

This e-mail and any files transmitted with it are confidential
and are only for the use of the person to whom they are
addressed. If you are not the intended recipient, you are
hereby notified that any use, dissemination, forwarding,
printing, copying or dealing in any way whatsoever with this
e-mail is strictly prohibited. If you have received this e-mail
in error, please reply to user immediately and delete the
document. It is the recipient's duty to virus-scan and otherwise
test the enclosed information before using the information or
loading attached files onto any computer system. Australian
Investment Exchange Ltd does not warrant that the information
contained in this e-mail is free from viruses, defects, errors,
interception or interference. Australian Investment Exchange Ltd,
and each of its related companies each reserve the right to
monitor all e-mail communications through its networks. Any
views expressed in this message are those of the individual
sender, except where that sender specifically states them to
be the views of Australian Investment Exchange Ltd. Your
private information is only used and disclosed for the intention
which you have provided it for. This information is not
disclosed or used unless your consent has been provided
or in the case that Australian Investment Exchange Ltd permitted
to do so under the Privacy Act of 1988.



-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: How to obtain the Greeks

Luigi Ballabio
On Thu, 2008-01-10 at 09:07 +0900, Ibrahim El-Fayoumi wrote:
> Hello Luigi
> I got exception, not with the analytic European option but rather the
> binomial american option
>
> My question whether the greeks are available for all options
> calculation or not?
> I mean, delta, vega, gamma, theta, and rho...

Oh, I see. No, not all greeks are available for all engines. Let me
check the source... yes, the binomial engine only provides delta, gamma
and theta. If you need the other greeks, you'll have to perturb the
input values and calculate them numerically.

Luigi


--

The young man knows the rules, but the old man knows the exceptions.
-- O. W. Holmes



-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: How to obtain the Greeks

Ibrahim El-Fayoumi
Luigi
I see, also, the errorEstimate() does not work at all, so I guess it is the
same story.
Thanks
Ibrahim

-----Original Message-----
From: Luigi Ballabio [mailto:[hidden email]]
Sent: Thursday, January 10, 2008 6:18 PM
To: Ibrahim El-Fayoumi
Cc: [hidden email]; [hidden email]
Subject: Re: [Quantlib-dev] How to obtain the Greeks

On Thu, 2008-01-10 at 09:07 +0900, Ibrahim El-Fayoumi wrote:
> Hello Luigi
> I got exception, not with the analytic European option but rather the
> binomial american option
>
> My question whether the greeks are available for all options
> calculation or not?
> I mean, delta, vega, gamma, theta, and rho...

Oh, I see. No, not all greeks are available for all engines. Let me
check the source... yes, the binomial engine only provides delta, gamma
and theta. If you need the other greeks, you'll have to perturb the
input values and calculate them numerically.

Luigi


--

The young man knows the rules, but the old man knows the exceptions.
-- O. W. Holmes



-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev