Page 6 of 7

Re: Finite Difference Method [Option Pricing]: Optimal Grid Structuring

Posted: November 21st, 2016, 2:03 pm
by Cuchulainn
I changed boundary condition as you suggested.
Image
My FDM model and QMC model yield very close result!
s=95,K=90,H=100,t=0.1,sigma=0.2,r=0,monitorfrequency=20
QMC=1.952 (50,000 trials)
FDM=1.951 (2000 steps)

I still have no idea about smin and smax by the way. In this example I just randomly pick smin=50 and smax=150 (so one node in price axis lies exactly on the barrier)
I used the BKG barrier correction formula with the same data as above. I get
m = 20
S, C
====================
94.95917 1.994772
94.97934 1.992696
94.99951 1.990581
95.01967 1.988427
95.03984 1.986233

My FDM model and QMC model yield very close result!
They could both be a bit off?

Re: Finite Difference Method [Option Pricing]: Optimal Grid Structuring

Posted: November 21st, 2016, 3:26 pm
by Billy7
I changed boundary condition as you suggested.
Image
My FDM model and QMC model yield very close result!
s=95,K=90,H=100,t=0.1,sigma=0.2,r=0,monitorfrequency=20
QMC=1.952 (50,000 trials)
FDM=1.951 (2000 steps)

I still have no idea about smin and smax by the way. In this example I just randomly pick smin=50 and smax=150 (so one node in price axis lies exactly on the barrier)
I used the BKG barrier correction formula with the same data as above. I get
m = 20
S, C
====================
94.95917 1.994772
94.97934 1.992696
94.99951 1.990581
95.01967 1.988427
95.03984 1.986233

My FDM model and QMC model yield very close result!
They could both be a bit off?
Yes they were and so can the BKG correction it seems. The correct price here is 1.9602906. Is it hard to get the MOL working for discrete barriers? And what would its stability characteristics be, would it handle the repeatedly imposed discontinuities as gracefully as the fully implicit setup?

Re: Finite Difference Method [Option Pricing]: Optimal Grid Structuring

Posted: November 21st, 2016, 4:10 pm
by Cuchulainn
I changed boundary condition as you suggested.
Image
My FDM model and QMC model yield very close result!
s=95,K=90,H=100,t=0.1,sigma=0.2,r=0,monitorfrequency=20
QMC=1.952 (50,000 trials)
FDM=1.951 (2000 steps)

I still have no idea about smin and smax by the way. In this example I just randomly pick smin=50 and smax=150 (so one node in price axis lies exactly on the barrier)
I used the BKG barrier correction formula with the same data as above. I get
m = 20
S, C
====================
94.95917 1.994772
94.97934 1.992696
94.99951 1.990581
95.01967 1.988427
95.03984 1.986233

My FDM model and QMC model yield very close result!
They could both be a bit off?
Yes they were and so can the BKG correction it seems. The correct price here is 1.9602906. Is it hard to get the MOL working for discrete barriers? And what would its stability characteristics be, would it handle the repeatedly imposed discontinuities as gracefully as the fully implicit setup?
It is possible to model "When" events (like in Mathematica) at the monitoring dates which would be more accurate I reckon What is the best algorithm?

Re: Finite Difference Method [Option Pricing]: Optimal Grid Structuring

Posted: November 21st, 2016, 4:59 pm
by Billy7
Alan knows, it's the same concept as with the dividend handling he implemented for Mathematica (apart from the fact that you really also need to smooth at each barrier monitoring date, otherwise convergence will be slow and erratic). But I don't know how he did it, I'm guessing restarting the ODE solver with the adjusted values?

Re: Finite Difference Method [Option Pricing]: Optimal Grid Structuring

Posted: November 21st, 2016, 5:41 pm
by Cuchulainn
Tnanks.
Anyway, the other ODE solvers show the same behavior, i.e. value too high.

Re: Finite Difference Method [Option Pricing]: Optimal Grid Structuring

Posted: November 22nd, 2016, 5:02 am
by jackgurae
By the way, you haven't confirmed your time scheme, I've been assuming all along it's the (fully) implicit method (thus 1st order in time, thus the above extrapolation in time). I've also been assuming that your spatial (asset) discretization is using central differences so it's second order. And that's why you cannot just double both NS and NT together and do the RE, because you have different orders in asset and time. RE depends on the order.
Yes, it is (fully) implicit method and it uses central difference for asset discretization.

Re: Finite Difference Method [Option Pricing]: Optimal Grid Structuring

Posted: November 22nd, 2016, 8:06 am
by jackgurae
I still see 2000x2000 result more accurate than 2000x40+2000x20 result. I don't know why.
My 2000x2000 FDM can get only 3 digits right. I implement payoff averaging at initial condition and also at monitoring dates.

My psuedo code goes like this
if S(j) = H then
    for z = 1 to 11
        tmpS = S(j)-ds/2+(z-1)*ds/2/5
        tmpO = interpolate(S,O,tmpS)
    loop
end if
It means, at barrier, 
    - after solving linear equations and get result O
    - instead of replace O with 0 or rebate if S >= H
    - let averaging that out with for loop
    - Say H=100, S9=98,S10=100,S11=102 and O9=3,O10=1,O11=0
    - it just linearly interpolate O for S=99 to S=101 then average O and replace original O10
    - if S=99 then O=O9+(O10-O9)/(S10-S9)*(99-S9)=3+(1-3)/2*1=2
    - So O10 will be greater than 0

I also use Thomas Algorithm to solve tridiagonal system, now 2000x2000grid will be solved under a second.

Re: Finite Difference Method [Option Pricing]: Optimal Grid Structuring

Posted: November 22nd, 2016, 10:02 am
by jackgurae
ImageThis is my result.
I pick smin =0.4*H and smax=1.2*H so that there is no saw tooth.
Best I can get is 1.9608 with Payoff-averaging 2,000-step FDM.
That convergence graph looks right. That's already a huge improvement over your "naive" implementation. Now there are probably two reasons why you are still a little far off the exact result. One is that you are using the implicit scheme (are you?) which is first order in time. My result comes from a second order scheme. So if you are using implicit, first thing you should try is Richardson Extrapolation which in this case means calculate first a fine price as cuo(NS, NT) and then a crude one as cuo(NS, NT/2) and find the 2nd order (in time) correct price as 2*fine_price - crude_price. I am assuming you're using central differences otherwise so you're 2nd order in space.
The other reason why you may be a little off is that the payoff-averaging (or intermediate solution smoothing) you used is the simplest one. My code is using something slightly more fancy, but we may get to that later, first try the RE and see what happens.
P.S. I didn't understand your "so that there is no saw tooth." comment. We know there should be because the solution is allowed to become non-zero above the barrier in between monitoring dates, no?
Oh sorry, somehow, I missed this reply. So you have repeatedly reply me everything.

Re: Finite Difference Method [Option Pricing]: Optimal Grid Structuring

Posted: November 22nd, 2016, 10:23 am
by Billy7
I still see 2000x2000 result more accurate than 2000x40+2000x20 result. I don't know why.
Your code should be fine. I said you will get more accurate results with 10 and 20 times steps combined for the continuously monitored case, but for the discretely monitored case I suggested at least 2 time steps pr monitoring period. You did one of your runs with 20 (1 timestep per period:-). Run 2000x40 and 2000x80 and you should get better than the 2000x2000 I think (still in 6% of the time).

Re: Finite Difference Method [Option Pricing]: Optimal Grid Structuring

Posted: November 22nd, 2016, 10:44 am
by Billy7
ImageThis is my result.
I pick smin =0.4*H and smax=1.2*H so that there is no saw tooth.
Best I can get is 1.9608 with Payoff-averaging 2,000-step FDM.
That convergence graph looks right. That's already a huge improvement over your "naive" implementation. Now there are probably two reasons why you are still a little far off the exact result. One is that you are using the implicit scheme (are you?) which is first order in time. My result comes from a second order scheme. So if you are using implicit, first thing you should try is Richardson Extrapolation which in this case means calculate first a fine price as cuo(NS, NT) and then a crude one as cuo(NS, NT/2) and find the 2nd order (in time) correct price as 2*fine_price - crude_price. I am assuming you're using central differences otherwise so you're 2nd order in space.
The other reason why you may be a little off is that the payoff-averaging (or intermediate solution smoothing) you used is the simplest one. My code is using something slightly more fancy, but we may get to that later, first try the RE and see what happens.
P.S. I didn't understand your "so that there is no saw tooth." comment. We know there should be because the solution is allowed to become non-zero above the barrier in between monitoring dates, no?
Oh sorry, somehow, I missed this reply. So you have repeatedly reply me everything.
Right:) I suspect the main reason why you're still a little off (it was 1.9609, wasn't it?) is the implicit time stepping since it's first order. The reason why I suggested to used it was because it handles discontinuities well (Crank Nicolson which is 2nd order doesn't) and because we wanted a simple solution. Of course that doesn't mean you cannot get accurate. All you now have to do is combine 2000x2000 & 2000x1000 (and then 2000x1000 & 2000x500 to see how much this differs, so that you get an idea of how close you are to the time-converged result). Let me know.

Re: Finite Difference Method [Option Pricing]: Optimal Grid Structuring

Posted: November 22nd, 2016, 11:05 am
by jackgurae
2000x2000&2000x1000 = 1.9571&1.9584 => 1.9567
2000x1000&2000x500 = 1.9584&1.9609 => 1.9576
I think I mess up my code somehow.
Particularly at smin and smax.
I use smin = 0
smax= smin+(H-smin)/(0.8*N)*N

Then I adjust smin=0.8*H
2000x2000&2000x1000 = 1.9607&1.9619 => 1.9602
2000x1000&2000x500 = 1.9619&1.9645 => 1.9611

I'm not sure that increasing smin (and therefore grid is more detailed) will improve result.

Re: Finite Difference Method [Option Pricing]: Optimal Grid Structuring

Posted: November 22nd, 2016, 11:19 am
by Billy7
I'm not sure I understand. How did you get the first values and how the second ones? (which look better by the way)
What is this? smax= smin+(H-smin)/(0.8*N)*N. And Smin at 0.8*H? So Smin=80 in your example? No, no, leave Smin at 0 and Smax at 120 and tell me what you get. And debug through your payoff averaging and make sure you do it as you explained in the first page, with V's where you had used the payoff. Remember that after the barrier the area that contributes to the averaging integral is zero.

Re: Finite Difference Method [Option Pricing]: Optimal Grid Structuring

Posted: November 22nd, 2016, 11:47 am
by jackgurae
First set
I use smin=0 and smax=that formula that I come up myself=125.
Well I just want to make sure that barrier lies on the grid at N=0.8N.
Second set
I use smin=0.8*H=80 and smax=105

Re: Finite Difference Method [Option Pricing]: Optimal Grid Structuring

Posted: November 22nd, 2016, 11:52 am
by Billy7
First set
I use smin=0 and smax=that formula that I come up myself=125.
Well I just want to make sure that barrier lies on the grid at N=0.8N.
Second set
I use smin=0.8*H=80 and smax=105
A OK.Your Smin is way too high in this case, just plot your solution when you use Smin=0 and you will see that at S=80 it's still far from zero. Just use 20 for now and Smax at 120 you still should be able to get very accurate results with 2000 steps.
The fact that your first set with Smin=0 and Smax=125 is off means you're doing something wrong.

Re: Finite Difference Method [Option Pricing]: Optimal Grid Structuring

Posted: November 22nd, 2016, 11:55 am
by jackgurae
First set
I use smin=0 and smax=that formula that I come up myself=125.
Well I just want to make sure that barrier lies on the grid at N=0.8N.
Second set
I use smin=0.8*H=80 and smax=105
A OK.Your Smin is way too high in this case, just use 20 for now and Smax at 120 you still should be able to get very accurate results with 2000 steps.
Thank you. I appreciate your help very much.
Today, I'm off now. Will come back again tmr if I have improvement.