Posted by
Luigi Ballabio on
Jan 17, 2006; 1:22am
URL: http://quantlib.414.s1.nabble.com/Strange-Basic-Option-Valuation-Problem-Part-II-tp4357p4358.html
Hi,
On 1/16/06, UNG <
[hidden email]> wrote:
> ** Option calculator
>
http://www.888options.com/resources/options_calc.jsp> (Bloomberg results are the same within 4th decimal)
> I.V. 0.549 Delta 0.2105 Gamma 0.0576 Vega 0.0261
> Rho 0.0052
These are the results when the volatility is set to 0.549, aren't they?
In QuantLib, calling the impliedVolatility() method returns the
implied volatility, but it does not set the volatility of the option
to the result. Therefore...
> ** Quantlib:
> impliedVol: 0.549073
> delta: 0.0567826
> gamma: 0.0417672
> theta: -0.00485107
> vega: 0.0103857
> rho: 0.150655
...the above are still the results for the volatility you began with,
namely, 0.30. You can compare them with the corresponding results from
the calculator.
If you want to set the volatility to the implied one, you have to do
it yourself. A way to do it in your code is to replace
Volatility volatility = 0.3;
with
boost::shared_ptr<SimpleQuote> volQuote(new SimpleQuote(0.30));
Handle<Quote> volatility(volQuote);
so that you can modify the volatility. Later in the code, you can write
double impliedVol = option.impliedVolatility(optPx );
// now set the new value...
volQuote->setValue(impliedVol);
// so that the results below are now those you want
double delta = option.delta();
etc. etc
Later,
Luigi