No FD method solution in the case of a generic partial differential equation like (Stochastic Vol Model) for {d sigma = p dt + q dX}, p = (a – b sigma2) Do read the pdf for bit more understanding. It's just a single page! I am not sure if this is implemented in quantlib, or maybe I don't know how to use it. Thanks for ur time Animesh Saxena Associate (Exotic Derivatives) Blog -> http://quantanalysis.wordpress.com ------------------------------------------------------------------------------ This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev Stochastic Volatility.pdf (76K) Download Attachment |
Have you tried to implement it using other language and check the accuracy (against European call prices which has semi-analytical formula under the Heston model)?
As far as I know, the mixed-derivative term is very difficult to handle and I have seen no research paper using standard FD method to discretize the Heston PDE. One recent paper uses ADI and may be of interest to you. Please see attachment. On Tue, Jul 6, 2010 at 5:43 AM, animesh saxena <[hidden email]> wrote:
-- Stephen Tse http://www.cs.uwaterloo.ca/~sttse/ ------------------------------------------------------------------------------ This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev FD(ADI)-Heston.pdf (385K) Download Attachment |
Stephen,
Thanks for the reply :). I don't generally trust semi-analytical solutions if FD methods are applicable. The advantage in FD methods is from a trader perspective you can model various scenarios. In programming perspective it might be hard to see. So let me say my 2 bit as a quant / trader. Let's say I find out my greek vega from a very sophisticated model say heston for a barrier option. Standard programming practice / maths says that it's partial derivative of V / sigma. This is where the problem starts. Greeks are interrelated. If gamma of option is positive and volatility is maximum and if you are long that option then it will rise in price and you will earn lots of money (Rake Millions ;) ). If gamma is maximum and volatility is minimum and if you are long the option, it won't affect your position much. Similarly if gamma is negative and volatility is maximum and you are long the option, oh dear you are gone with huge losses. So for exotic structures in which gamma changes signs this modeling is not possible in any of the models available till date! I believe if this can somehow be incorporated into quantlib design it will make it a much more practical tool. More analysis on my post -> http://quantanalysis.wordpress.com/2010/02/24/vega-the-stupid-greek/ Below is a simple implementation I have used at my workplace. Parameters need to be fudged. I agree implementation might not be very stable, but it can be done in a better way with other methods like crank nicholson. I know the code is very badly written, but anyway my point is making the fd model more generic so any partial differential equation can be fudged as an operator. Of course too much waste for multi asset options coz it will be too many for loops. So just wanted to know if this is possible? I can help with the math, and these days trying to learn the quantlib design...hopefully will be able to pick up! Thanks again for reading the mail, Animesh Saxena Associate (Exotic Derivatives) Blog -> http://quantanalysis.wordpress.com void stochasticvol(double expiry, double strike, double interestrate, int smax, int sigmax, double dt) { double ds,dsig,a,b,c,d,rho,deltas,deltasig,deltasig1,deltasig2,gammas,gammasig,xgamma,theta; int N,i,j,k; ds = strike / smax*2; dsig = (double)(1 / (double)sigmax); N = (int)(expiry/dt) + 1; dt = expiry/N; a = 0.2; b=1; c=1; d=1; rho = 0; double S[smax]; double Sig[sigmax]; double previousprices[smax][sigmax]; double newprices[smax][sigmax]; for(i=0;i<=smax;i++){ S[i] = i * ds; } std::cout<<ds; for(j=0;j<=sigmax;j++) Sig[j] = dsig * j; for(i=0;i<=smax;i++) for(j=0;j<=sigmax;j++) { previousprices[i][j] = ((S[i] - strike)>0?S[i]-strike:0); } for(k=1;k<=N;k++) { for(i=0;i<=smax-1;i++) { for(j=0;j<=sigmax-1;j++) { deltas = (previousprices[i+1][j] - previousprices[i-1][j])/(2*ds); deltasig1 = (previousprices[i][j+1] - previousprices[i][j])/dsig; deltasig2 = (previousprices[i][j] - previousprices[i][j-1])/dsig; deltasig = deltasig1; if((a-b * Sig[j]) < 0) deltasig = deltasig2; gammas = (previousprices[i+1][j] - 2 * previousprices[i][j] + previousprices[i-1][j])/(ds*ds); gammasig = (previousprices[i][j+1] - 2 * previousprices[i][j] + previousprices[i][j-1])/(dsig*dsig); xgamma = (previousprices[i+1][j+1] - previousprices[i+1][j-1] - previousprices[i-1][j+1] + previousprices[i-1][j-1])/(4*ds*dsig); theta = 0.5 * Sig[j]*Sig[j] *S[i] *S[i] * gammas + interestrate * S[i] * deltas - interestrate * previousprices[i][j] + 0.5 * d *d * Sig[j] * gammasig + c*(a-b * Sig[j])*deltasig + rho * Sig[j] * S[i] * d * pow(Sig[j],2) * xgamma; newprices[i][j] = previousprices[i][j] + dt *theta; } } for(j=0;j<=sigmax-1;j++) newprices[smax][j] = 2 * newprices[smax-1][j] - newprices[smax-2][j]; for(i=0;i<=smax;i++) newprices[i][sigmax] = 2 * newprices[i][sigmax-1] - newprices[i][sigmax-2]; for(i=0;i<=smax;i++) for(j=0;j<=sigmax;j++) { previousprices[i][j] = newprices[i][j]; } } for(i=0;i<smax;i++) for(j=0;j<sigmax;j++){ std::cout<<"Spot" << (i*ds) << "Vol:"<< (j*dsig) << "Price:" << newprices[i][j]<<"\n"; } } Stephen Tse wrote: > Have you tried to implement it using other language and check the > accuracy (against European call prices which has semi-analytical > formula under the Heston model)? > > As far as I know, the mixed-derivative term is very difficult to > handle and I have seen no research paper using standard FD method to > discretize the Heston PDE. One recent paper uses ADI and may be of > interest to you. Please see attachment. > > > On Tue, Jul 6, 2010 at 5:43 AM, animesh saxena > <[hidden email] <mailto:[hidden email]>> wrote: > > > No FD method solution in the case of a generic partial > differential equation like (Stochastic Vol Model) > > for {d sigma = p dt + q dX}, p = (a – b sigma2) > > Do read the pdf for bit more understanding. It's just a single page! > > I am not sure if this is implemented in quantlib, or maybe I don't > know how to use it. > > Thanks for ur time > > Animesh Saxena > > Associate > > (Exotic Derivatives) > > Blog -> http://quantanalysis.wordpress.com > > > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by Sprint > What will you do first with EVO, the first 4G phone? > Visit sprint.com/first <http://sprint.com/first> -- > http://p.sf.net/sfu/sprint-com-first > _______________________________________________ > QuantLib-dev mailing list > [hidden email] > <mailto:[hidden email]> > https://lists.sourceforge.net/lists/listinfo/quantlib-dev > > > > > -- > Stephen Tse > http://www.cs.uwaterloo.ca/~sttse/ <http://www.cs.uwaterloo.ca/%7Esttse/> ------------------------------------------------------------------------------ This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
Free forum by Nabble | Edit this page |