General Topics
Technical Topics
Brokerage Firms
Community Lounge
Site Support

# Need accurate open source black scholes algorithms.

Discussion in 'Options' started by TimeCorrosion, Dec 22, 2009.

1. ### TimeCorrosion

Hello:

I have been using the Scheme and C++ algorithms from Espen Haug's website:

http://www.espenhaug.com/black_scholes.html

They work okay under most circumstances, but when I try to simulate option values under hyperinflation with interest rates greater than 50%, the put values given by Espen Haug's algorithms are significantly different from the put values given by online option calculators; for instance, the option calculator from the Optons Industry Council:

http://www.optionseducation.org/quotes/default.jsp

(Try stock 100, strike 100, 30 days, 20% volatility, and use 1% and 50% interest rates on Haug's and OIC's algorithms, and you will see that Haug's gives call of 4.8 and put of 0.78 with interest of 50%, and with 50% interest, OIC's give call of 4.8 and put of 1.173; the puts are similar when interest is 1%)

So, which ones are correct? Any other SIMPLE open source algorithms I can use for my programming? I don't need the fancy but unnecessarily lengthy programs from QuantLib.org.

Thanks!

2. ### dcraig

Hmm. it's been long ago when I played with the same formula, but my program gives for the same param:
Call=Put=6.47725 for RFIR=50%, and
Call=Put=2.80501 for RFIR=1%.

(But I use 253 days/year. This is mostly the source for the differences as some do use 360 or 365 days etc...)

Sorry, can't help with the source code because it's integrated into a commercial project...

4. ### Equalizer

You do of course understand that no-one in their right mind uses bog-standard Black-Scholes-Merton for pricing right? I gather you are aware of IV?

http://www.wilmott.com/attachments/j.1745-6622.1989.tb00175.zip

If you wish to check values you should be able to code BSM or a Binomial tree method (CRR or JR, etc) in Excel in no time. Pretty basic stuff. Check out Simon Benninga's book or Kerry Back's book.

 OK, I'm 99.99% sure the stuff-up you made was not to use identical exercise style in each calculation. Are you sure you are not using European exercise with Haug (bog-standard BSM) and American exercise with OIC (tree/lattice method) to get the variation in put price?[/Edit]

WHILE YOU'RE HERE, TAKE A MINUTE TO VISIT SOME OF OUR SPONSORS: