Serving the Quantitative Finance Community

 
User avatar
jungle
Topic Author
Posts: 4
Joined: September 24th, 2001, 1:50 pm

skinning cats - standard VBA codes..?

September 26th, 2001, 1:14 pm

i have noticed that there seem to be a number of different ways to write code to perform the same function, e.g. a simple BS option value. some of these seem to differ quite significantly (e.g. paul's code (in PWIQF), espen's code (http://home.online.no/~espehaug/SayBlackScholes.html) and the code used by jackson (in "advanced modelling in finance using excel and vba".) is there any kind of standard approach? is one method better than another and if so, for what reasons? and, from a philosophical standpoint, should there be a standard way to code?
 
User avatar
spursfan
Posts: 2
Joined: October 7th, 2001, 3:43 pm

skinning cats - standard VBA codes..?

October 7th, 2001, 4:15 pm

as the co-author of the jackson book, and responsible for writing the code let me add some thoughtsi wanted the code to have consistency throughout the book (and hence separate functions for d1 and d2) whilst also not just not borrowing code from othersi also wanted the code to be as clear as possiblewith analytic solutions differences in code are likely to be immaterial as regards speed, though one tries harder to optimise code for the more demanding numerical methods (such as using vectors rather than matrices when using binomial trees)sometimes differences in code reflect different emphasis in teaching (bs recast with inputs as the mean and variance of the ln distribution, or d2 defined before d1 to reflect d2's greater role in the derivation with probabilities and measures)in our code and with our background in spreadsheets i've also tried to use as many excel functions as possible (including those involving arrays) before looking for vba / standard programming techniques (whereas others may say find it easier to translate something more or less straight from numerical recipes)in passing, it would be nice to see some of the older and less sophisticated methods (such as dare i say the crr tree parameters for standard options) being replaced by their newer and more efficient substitutes