Hi Luigi, Eric,
I developed the things concerning the pricing of non quoted swaptions a bit further and exported them to excel (based on the files in Eric's prerelease).
I noticed that the QuantLibAddin::SwapIndex always uses the QuantLib::SwapIndex constructor _with_ the discount curve parameter. Therefore you can not set up a swap index in excel without specifiying the discount curve. I would expect instead that specifying no discount curve leads to a QuantLib::SwapIndex where exogenousDiscount_ = false, especially since the default value for the discount curve in the excel wizard is an empty value. Therefore I propose to check in the QuantLibAddin constructor, if the handle is empty and in this case invoke the QuantLib constructor without discount curve. Then the exogenous_ flag will be set to false and everything is fine.
On the QuantLib side I introduced an enumeration which specifies the conversion mode. There are four modes available now
Pricing: Compute price w.r.t. quoted index atm, then compute implied volatility w.r.t. non quoted index atm
Arithmetic: Use arithmetic mean of atm and strike to approximate normal volatility
Geometric: Use geometric mean of atm and strike to approximate normal volatility
Basispoint: Use atm to approximate normal volatility
This replaces the old "exact" flag.
Furthermore I changed the interface of nonQuotedIndexVolatility. The swap index is now a boost::shared_ptr. As I understand it, this is more in line with the excel export stuff.
I attach the modified QuantLib files again. Below I insert the changes concerning the export to excel.
One more comment on the project file: I use QuantLibAddin_vc9.sln with MSVC 2008. When I generate the xll and try to register it in excel I get an error message (not a valid addin). I have to set "generate manifest" to yes in order to get a valid xll. This should be changed in the project file therefore, I think.
Thank you, best regards
Peter
types:
<DataType defaultSuperType='enumeration'>QuantLib::SwaptionVolatilityCube::NormalConversion</DataType>
enumeratedtypes:
<EnumeratedTypeGroup type='QuantLib::SwaptionVolatilityCube::NormalConversion'>
<includeFile>oh/enumerations/typefactory.hpp</includeFile>
<constructor>true</constructor>
<EnumeratedTypes>
<EnumeratedType>
<string>Pricing</string>
<value>QuantLib::SwaptionVolatilityCube::Pricing</value>
</EnumeratedType>
<EnumeratedType>
<string>Arithmetic</string>
<value>QuantLib::SwaptionVolatilityCube::Arithmetic</value>
</EnumeratedType>
<EnumeratedType>
<string>Geometric</string>
<value>QuantLib::SwaptionVolatilityCube::Geometric</value>
</EnumeratedType>
<EnumeratedType>
<string>Basispoint</string>
<value>QuantLib::SwaptionVolatilityCube::Basispoint</value>
</EnumeratedType>
</EnumeratedTypes>
</EnumeratedTypeGroup>
swaptionvolstructure:
<Member name='qlSwaptionVTSNonQuotedIndexVolatility' type='QuantLib::SwaptionVolatilityCube' superType='libraryTermStructure'>
<description>returns a lognormal volatility for a non quoted index via normal conversion</description>
<libraryFunction>nonQuotedIndexVolatility</libraryFunction>
<SupportedPlatforms>
<SupportedPlatform name='Excel'/>
<!--SupportedPlatform name='Cpp'/-->
</SupportedPlatforms>
<ParameterList>
<Parameters>
<Parameter name='OptionDate'>
<type>QuantLib::Date</type>
<tensorRank>scalar</tensorRank>
<description>Option Date</description>
</Parameter>
<Parameter name='SwapIndex' superType='objectClass'>
<type>QuantLib::SwapIndex</type>
<tensorRank>scalar</tensorRank>
<description>Underlying Swap Index</description>
</Parameter>
<Parameter name='Strike'>
<type>double</type>
<tensorRank>scalar</tensorRank>
<description>Strike</description>
</Parameter>
<Parameter name='Extrapolate' default='false'>
<type>bool</type>
<tensorRank>scalar</tensorRank>
<description>Extrapolate</description>
</Parameter>
<Parameter name='Conversion' default='"Arithmetic"'>
<type>QuantLib::SwaptionVolatilityCube::NormalConversion</type>
<tensorRank>scalar</tensorRank>
<description>Pricing, Arithmetic, Geometric, Basispoint</description>
</Parameter>
<Parameter name='FallBackConversion' default='"Arithmetic"'>
<type>QuantLib::SwaptionVolatilityCube::NormalConversion</type>
<tensorRank>scalar</tensorRank>
<description>This conversion is used if Pricing fails</description>
</Parameter>
</Parameters>
</ParameterList>
<ReturnValue>
<type>double</type>
<tensorRank>scalar</tensorRank>
</ReturnValue>
</Member>
stub.enum.types:
#include <ql/termstructures/volatility/swaption/swaptionvolcube.hpp>
----- Original Nachricht ----
Von: Peter Caspers <
[hidden email]>
An:
[hidden email]
Datum: 26.03.2010 17:18
Betreff: Multicurve Swaption Volatility
Hi,
I am interested in computing swaption (and also cap) volatilities for non quoted indices e.g. the volatility for a 2y/5y swaption with the underlying swap being vs. 3M Euribor. The quoted volatility for this swaption is vs. 6M Euribor. The market converts this volatility using a normal black76 model which is level independent contrary to the lognormal standard model.
As far as I can see QuantLib 1.0 supports the separation of discounting and forwarding curves for curve bootstrapping and swap index estimation.
However, both swaption and cap volatility classes seem to need adjustments. I started to do some things about swaption volatilities and would be happy to contribute them to the project. I attach the modified source files. The modifications are marked with a comment which reads // PC. Perhaps the people who wrote the classes can have a look at the code and see if something like that can be introduced in future versions.
1. The ATM swaption class SwaptionVolatilityMatrix does not know anything about absolute rate levels. So it would probably be a great effort to do something here. I left this class unchanged and concentrated on the cube classes solely.
2. The first adjustment I did is to add a method discountingTermStructure() to the class SwapIndex. In case the index has an exogeneous discount curve, this is returned, otherwise an empty Handle.
3. The next adjustment is in the class SwaptionVolatilityCube. The atmStrike() method does not work for swap indices with exogeneous discount curve. I did the necessary modifications to take this into account. The interface of the method does not need to be changed.
4. It seems hard to me to extend the existing volatility methods in order to return volatilities for non quoted indices. Instead I added a method nonQuotedIndexVolatility() to compute a (lognormal) volatility for a non quoted index. It should work together with all extensions (SABR, bilinear) of the base cube class. There is an approximated mode (exact = false which is also the default) and an exact mode (exact = true) implemented. The approximation is due to Kazuhiro Iwasawa , "Analytic Formula for the European Normal Black Scholes Formula", Section 3.
If I can do anything else to push this forward, please let me know, I am not so much into the development processes of this project yet...
Thank you, best regards
Peter