amaggiulli / QLNet

QLNet C# Library
https://amaggiulli.github.io/QLNet/
BSD 3-Clause "New" or "Revised" License
387 stars 174 forks source link

how to pricing American option with volatility surface? #66

Closed mike1232 closed 8 years ago

mike1232 commented 8 years ago

In the option examples, QLNet uses the flat term structures for r, q and volatility. how to use the curve term structures? in particular, how to set up a volatility surface and use the surface as input for the pricing engines? In QuantLib C++, you can create a wrapper:

boost::shared_ptr ForwardImpliedVolSurface(Date todaysDate, Date forwardDate, Calendar calendar, std::vector maturityArray, std::vector strikeArray, Matrix volatilityMatrix) { // Handle to boost::shared_ptr DayCounter dayCounter = Actual365Fixed(); boost::shared_ptr volatilitySurface(new BlackVarianceSurface(todaysDate, calendar, maturityArray, strikeArray, volatilityMatrix, dayCounter)); Handle volatilitySurfaceH(volatilitySurface);

// Volatility surface interpolation volatilitySurface->enableExtrapolation(true);

// Change interpolator to bicubic splines volatilitySurface->setInterpolation(Bicubic());

// Forward implied volatility surface boost::shared_ptr forwardVolSurface(new ImpliedVolTermStructure(volatilitySurfaceH, forwardDate));

return(forwardVolSurface); }

how does QLNet achieve this?

Thanks Mike

amaggiulli commented 8 years ago

BlackVarianceSurface atm is not implemented in QLNet.

igitur commented 8 years ago

I implemented BlackVarianceSurface. You can find it in the master branch. However, I don't have any test cases and I'm unsure how buggy my implementation is. @mike1232 , if you can provide some tests, it would help a lot.

amaggiulli commented 8 years ago

moved on Ver-1.6 branch

igitur commented 8 years ago

See #76