Serving the Quantitative Finance Community

 
User avatar
Cuchulainn
Topic Author
Posts: 20253
Joined: July 16th, 2004, 7:38 am
Location: 20, 000

Re: Benchmark tests: KO European and American double barrier options

January 12th, 2021, 2:46 pm

Thanks!. Now I know this particular scheme is good. It also implies that all the underlying maths has been stressed tested.
 
User avatar
Cuchulainn
Topic Author
Posts: 20253
Joined: July 16th, 2004, 7:38 am
Location: 20, 000

Re: Benchmark tests: KO European and American double barrier options

January 12th, 2021, 3:34 pm

I agree that people abuse the terminology here, but in this case we seem to have on our hands two call options, both with a continuously monitored up-and-out barrier, with one being exercisable only at maturity and the other being exercisable at any time up to and including maturity as long as it has not been knocked out.
"Barrier option with American early exercise feature"?

https://en.wikipedia.org/wiki/Barrier_option

Don't know what else to call it.
 
User avatar
Alan
Posts: 2958
Joined: December 19th, 2001, 4:01 am
Location: California
Contact:

Re: Benchmark tests: KO European and American double barrier options

January 12th, 2021, 4:31 pm

Thanks!. Now I know this particular scheme is good. It also implies that all the underlying maths has been stressed tested.

That's not right. Let's say you're the supervisor of coding for an investment firm and hire an incompetent programmer to code this. He "forgets" to code for the lower barrier knock-out. You ask him to test his code on the example shown and he gets the answer discussed. Since the answer is "correct" to 6 digits, you conclude the scheme/code is good! The code is put into production. You get fired! 

A minimal first test: code the exact sum solution and test it against your code for S0 running from the lower barrier to the upper barrier in fine increments. Is that difference uniformly below some required precision? Now, you can fire the incompetent programmer. Next, vary all the parameters over their defined domains. Next, test all the edge cases ....
 
User avatar
bearish
Posts: 5186
Joined: February 3rd, 2011, 2:19 pm

Re: Benchmark tests: KO European and American double barrier options

January 12th, 2021, 5:33 pm

Wait - you don’t believe in proof by example? Or is it proof by lack of counter example? I would definitely agree that it would be prudent to move something around to make both barriers meaningful. Like crank up the vol and/or time to maturity. Or put them at 110 and 95.
 
User avatar
Cuchulainn
Topic Author
Posts: 20253
Joined: July 16th, 2004, 7:38 am
Location: 20, 000

Re: Benchmark tests: KO European and American double barrier options

January 12th, 2021, 8:38 pm

Thanks!. Now I know this particular scheme is good. It also implies that all the underlying maths has been stressed tested.

That's not right. Let's say you're the supervisor of coding for an investment firm and hire an incompetent programmer to code this. He "forgets" to code for the lower barrier knock-out. You ask him to test his code on the example shown and he gets the answer discussed. Since the answer is "correct" to 6 digits, you conclude the scheme/code is good! The code is put into production. You get fired! 

A minimal first test: code the exact sum solution and test it against your code for S0 running from the lower barrier to the upper barrier in fine increments. Is that difference uniformly below some required precision? Now, you can fire the incompetent programmer. Next, vary all the parameters over their defined domains. Next, test all the edge cases ....
I think you are going off on a tangent here.

1. My well-posed PDE has two boundaries and I have done test against Haug's double barrriers.
2.  "Since the answer is "correct" to 6 digits, you conclude the scheme/code is good! The code is put into production"
No i don't. Have a look at chapter 16 page 524 of my C++ book. Software testing is well-known at this stage.
BTW point 2 was not part of my OP.

You are missing the plank on this one. Or maybe I am not the intended recipient?
Last edited by Cuchulainn on January 12th, 2021, 8:48 pm, edited 1 time in total.
 
User avatar
Cuchulainn
Topic Author
Posts: 20253
Joined: July 16th, 2004, 7:38 am
Location: 20, 000

Re: Benchmark tests: KO European and American double barrier options

January 12th, 2021, 8:47 pm

If I needed to do a full test, I would generate parameters and run 3 solvers (not TWO!)

do 10^9 times
{
randomly gen params
MOL
CN
Ikeda Kunimmoto
}


OKEDOKE(error)

Things will get tricky at the barriers, numerically because of the large slopes. Discrete barrier too.
 
User avatar
Alan
Posts: 2958
Joined: December 19th, 2001, 4:01 am
Location: California
Contact:

Re: Benchmark tests: KO European and American double barrier options

January 12th, 2021, 9:31 pm

Sorry -- was feeling a bit trollish. Anyway, what bearish said.
 
User avatar
Cuchulainn
Topic Author
Posts: 20253
Joined: July 16th, 2004, 7:38 am
Location: 20, 000

Re: Benchmark tests: KO European and American double barrier options

January 14th, 2021, 5:03 pm

OK. i used to be a requirements analyst in another life! 
 
User avatar
Cuchulainn
Topic Author
Posts: 20253
Joined: July 16th, 2004, 7:38 am
Location: 20, 000

Re: Benchmark tests: KO European and American double barrier options

January 16th, 2021, 2:30 pm

So, better exercise for students: what are the results to 30 digits? Now there's a benchmark.  Image
No. Better to expose them to as many numerical methods as possible to many kinds of problems.
// 30 digits implies going down the multiprecision road. It is outside the scope.

edit: Alan, if you give 30 digits I can test it. You can probably do it in one line of MM. I don't have MM.
Sorry, but I have other stuff going on. The hard part would be nailing down the putative exact sum. 
By 'sum' you mean some kind of series solution as here? eq. 2.7, 2.8. I hate series, too many assumptions, how many terms to take, no guarantee of convergence, round-off  error and ugly maths.

Since PDE and SDE are !;1 (Friedman Theorem 5.3) why just solve the PDE and avoid reinventing the wheel?

https://www.researchgate.net/profile/Ja ... ion_detail

BTW PDE solver gives same results w/o any modification to the code and no extra maths  needed.

// Series solutions are a-posterior accurate (like ANNs) and they may not always converge., With FDM, choose step length h, dt a-priori.