How good is the hedge?


Write a function that takes a simulation and uses the account function to compute the difference between the hedge and the option payoff at expiration assuming the hedge is self-financing.

Calculate distributions for various parameters. (Width)

Start on classic delta hedge.


YuanqinWei wrote Sep 26, 2013 at 5:55 PM

Are we constructing the simulate function such that it only does one simulation? If that's the case, could we just put the diff calculation within the simulate function?

keithalewis wrote Sep 26, 2013 at 8:44 PM

You are a little ahead of the rest of the team. Step 1 is to make sure the code is correct. After that we can speed it up.
You can always branch off from the trunk if you want to experiment with new code.

wrote Sep 27, 2013 at 8:28 PM

wrote Sep 27, 2013 at 8:29 PM

wrote Sep 27, 2013 at 10:14 PM

YuanqinWei wrote Oct 16, 2013 at 2:16 PM

We have finished the delta hedging part and changed rest of the code to implement log-normal underlying. But when we try to debug and run the code, Excel opens and pops up a warning saying: bad allocation. Do you happen to know what that means and how could we fix it?

keithalewis wrote Oct 16, 2013 at 9:24 PM

double interval = 1/365;
in test_delta_simulation is the problem. This evaluates to 0 since 1/365 = 0 (in integer arithmetic) on the right hand side and you get an infinite loop. Change to 1.0/365 and this will run fine.

keithalewis wrote Oct 17, 2013 at 4:05 AM

Looking at the diffs now from what you guys have been up to. I learned at Morgan Stanley that is how your boss figures out who is getting a bonus. It is not the amount of code you write, it is about how useful it is. Complex and unmaintainable code is a big problem for them.

I was worried about everyone being able to deal with C++ code and using subversion. It was a two character change to get revision 25814 by Alice to fix that. C++ is funny that way.

Yudi has been checking in code to deal with the lognormal case. You will have to get me up to speed on Friday with this. doubleBarrierHittingTime seems to be on the right track.

Revison 25618: Jin fixed more than a few typos. She is too modest and the rest of the team can learn from her.

The next step is to turn the code you wrote into data on how well hedges work. That is where Excel comes in useful.