Serving the Quantitative Finance Community

 
User avatar
plessas
Topic Author
Posts: 2
Joined: March 9th, 2002, 10:23 pm

Explicit Finite Differences and PWIQF

September 5th, 2002, 11:20 pm

Greetings all,I am trying to implement the Explicit Finite Differences Method in VB but I am experiencing some problems and I also have a question regarding Paul's code.Why are you centering the Grid on the strike and not the current assets price so as not to go through the interpolation scheme?What criteria should I set for the scheme to be stable? The DT = (DS / (2*VOL*PRICE))^2 doesn't seem to work Thank you,Dimitrios
 
User avatar
plessas
Topic Author
Posts: 2
Joined: March 9th, 2002, 10:23 pm

Explicit Finite Differences and PWIQF

September 6th, 2002, 1:59 am

One more thing...could someone tell me how the a, b, c equations change in the presence of a constant dividend yield?Thank you very much,Dimitrios
 
User avatar
Fozzie
Posts: 0
Joined: April 11th, 2002, 4:21 pm

Explicit Finite Differences and PWIQF

September 6th, 2002, 3:33 pm

Hi Plessas,Well, since no-one else seems to be replying, i'll have a quick bash... Unfortunately, don't have a copy of the book, so can't tell you about a, b and c (Paul, do you owe me a free one?!). Generally people centre the grid on the strike as a good estimator of where the most interesting structure is likely to occur (eg highest gamma). It's also an easy way of selecting a suitable SMax (eg 2 or 3 times the strike). If spot is 10% of strike currently, you may still want to go out to 2 * strike... However, you are right, it doesn't guarantee you that the spot will land on a gridpoint. On the other hand, writing a bit of interpolation is never a bad thing!Criteria for stability is dt / ds^2 < 0.5 * vol ^2 * SMax^2Hope that helps,Fozzie
 
User avatar
plessas
Topic Author
Posts: 2
Joined: March 9th, 2002, 10:23 pm

Explicit Finite Differences and PWIQF

September 6th, 2002, 4:46 pm

Thanks Fozzie I will try that.You made me think of another question though:Shouldn't volatility be taken into account when you calculate Smax? Like say 3 times 1+VOL times S0 times T-t or something like that??a, b and c are the coefficients of f(-1), f() and f(+1)Thanx again,Dimitrios
 
User avatar
Fozzie
Posts: 0
Joined: April 11th, 2002, 4:21 pm

Explicit Finite Differences and PWIQF

September 10th, 2002, 7:58 am

ah, but I don't know what f is either!As for Smax, it really depends on how you feel about it. I think of it as a proxy for infinity. In which case, it's not really important what the vol is, it just has to be far enough away from all the other action that nothing interesting is going on there apart from the boundary condition. Clearly it also has to be high enough that it's also a considerable distance from spot given the volatility and time to expiry, but relying on that alone may put you in the wrong place eg 40% vol, 1 year to expiry, atm call, spot at 100. I'd be putting SMax somewhere between 200 and 300. Your formula gives 420 which seems a long way out (look at the price graph and see where the behaviour effectively becomes linear...)BUT it really all is down to the problem you're solving. You should play around with the numbers to see the effect - there's going to be a trade off between accuracy and speed. For research, doesn't matter so much, if you needed the numbers instantaneously for something, then it might.Regds,Fozzie
 
User avatar
WaaghBakri
Posts: 1
Joined: March 21st, 2002, 4:07 am

Explicit Finite Differences and PWIQF

September 10th, 2002, 10:39 am

Fozzie, If you don't mind, a real naive question. Are spurious "reflections" off the upper truncated domain an issue at all? If so, for some problems, does specifying the second derivative wrt asset = 0, besides acting as a boundary condition, also act as a dissipative mechanism for any spurious reflection? Thanks.
 
User avatar
plessas
Topic Author
Posts: 2
Joined: March 9th, 2002, 10:23 pm

Explicit Finite Differences and PWIQF

September 10th, 2002, 5:49 pm

I have played arround for a couple of days and found that the parameterization that gives the best results is the following:' assetsteps: userinputDT = 1 / (1 * assetsteps * vol) ^ 2 ' This shouldn't work should it?timesteps = Int(time / DT) + 1DT = time / timestepsDZ = vol * Sqr(3 * DT)Zmin = Log(price) - Int(0.5 * assetsteps) * DZZmax = Log(price) + Int(0.5 * assetsteps) * DZassetsteps = Int((Zmax - Zmin) / DZ) ' Assetsteps change by one if input is oddI have used the change of variable: Z = logSSqr is the Square Root and log is the natural logarithm (ln)I am happy with the results, stability and the convergence, but I am a bit concerned with what I read in books, especially on the stability conditions.Anyhow I am moving on to implicit now.Thanx again!Dimitrios
 
User avatar
Fozzie
Posts: 0
Joined: April 11th, 2002, 4:21 pm

Explicit Finite Differences and PWIQF

September 24th, 2002, 8:48 am

Sorry guys, only just noticed there were some more comments here...WaaghBakri, I've never had any serious problems with reflections using the scheme, but then I've never used an explicit scheme for anything particularly serious. If you are having trouble with reflections then the first thing I would try would be to move the boundary further away. In cases where you can play about with how the boundary condition is specified (eg V_SS = 0 as opposed to specifying the linear form of V) then some forms may well improve matters and i can see that second deriv set to zero may help, but I don't know for a fact that it will. Putting in a form of heat sink should but I doubt that would be appropriate for most financial problems!plessas, glad to see you're having success with the results. Why shouldn't your condition work? Looks to me as if you're setting dt equal to the condition then moving one step inside so you're just within the constraint. Good luck with the implicit etc (wld recommend you go straight to theta scheme, so you can do crank-nicholson etc too, and it's no harder to implement imho).regds, fozzie
 
User avatar
plessas
Topic Author
Posts: 2
Joined: March 9th, 2002, 10:23 pm

Explicit Finite Differences and PWIQF

September 24th, 2002, 1:27 pm

Thanx for your reply Fozzie!I have moved on to the implicit method. Have formulated the system and solved it using Gauss Jordan algorithm. Any thoughts here in terms of timestep, assetsteps, number of timesteps-assetsteps?rgds,Dimitrios
 
User avatar
Fozzie
Posts: 0
Joined: April 11th, 2002, 4:21 pm

Explicit Finite Differences and PWIQF

September 24th, 2002, 4:21 pm

Really depends on the problem. I'd decide on the timestep depending on the option spec (eg early exercise criteria, barriers - checked daily, weekly?) then reduce the asset step until you have a sufficiently accurate solution. Try experimenting a bit to get a picture of how the parameters affect the solution. If you're just performing a one-off pricing, then performance isn't so important and you may as well just whack up the number of steps. It's only really important to optimise if you're going to need real-time prices or it's some 20d monster that still has to be solved via pde or tree...!rgds, fozzie
 
User avatar
plessas
Topic Author
Posts: 2
Joined: March 9th, 2002, 10:23 pm

Explicit Finite Differences and PWIQF

September 25th, 2002, 12:10 am

QuoteOriginally posted by: FozzieSorry guys, only just noticed there were some more comments here...plessas, glad to see you're having success with the results. Why shouldn't your condition work? Looks to me as if you're setting dt equal to the condition then moving one step inside so you're just within the constraint. regds, fozzieI thought I was moving one step in the wrong direction fozzie. I am increasing the timestep thus decreasing the number of timesteps. Or am I getting this all wrong?rgds,Dimitris
 
User avatar
Fozzie
Posts: 0
Joined: April 11th, 2002, 4:21 pm

Explicit Finite Differences and PWIQF

September 25th, 2002, 8:53 am

looks to me like you're working out dt exactly, then calculating how many timesteps this corresponds to, taking the integer part and adding one. So you're increasing the number of steps and decreasing dt to just under the limit...> timesteps = Int(time / DT) + 1
 
User avatar
plessas
Topic Author
Posts: 2
Joined: March 9th, 2002, 10:23 pm

Explicit Finite Differences and PWIQF

September 25th, 2002, 12:30 pm

No no.. my concern is not there...The actual condition I have seen in books is:DT = 1 / (2 * assetsteps * vol) ^ 2while I use:DT = 1 / (1 * assetsteps * vol) ^ 2 Thats what worries me.rgds,Dimitris
 
User avatar
Fozzie
Posts: 0
Joined: April 11th, 2002, 4:21 pm

Explicit Finite Differences and PWIQF

September 25th, 2002, 3:01 pm

ah, I think you might be misreading the books (or they are at fault). The condition for the heat eqn is dt/ds^2 < 1/2. however, for BS eqn, you need to multiply by the factor in front of the second deriv, to get1/2 vol^2 SMax^2 dt/ds^2 < 1/2So you can cancel the 1/2 from both sides...fozzie
 
User avatar
plessas
Topic Author
Posts: 2
Joined: March 9th, 2002, 10:23 pm

Explicit Finite Differences and PWIQF

September 25th, 2002, 5:33 pm

Glad to see you are still with me Fozzie Starting from your condition:1/2 vol^2 SMax^2 dt/ds^2 < 1/2 -> assuming Smin=0vol^2 * assetsteps^2 * dt < 1 ->dt < 1 / (vol^2 * assetsteps^2)Which is the condition I have found (by trial and error) to work. However if this is the right one shouldnt any dt' < dt work as well?Thus shouldnt a dt' equal to: dt' = 1 / (4 * vol^2 * assetsteps^2) or even dt'' = 1 / (1000 * vol^2 * assetsteps^2) work?rgds,Dimitris