Closed dileepbapat closed 3 years ago
What is wrong with erf
Please check the values near maturity = 0.25/365.0. Values are way off from standard call value. It turned out replacing CDF gave an appropriate call value.
for example price of an in-the-money call option with 2 hours to expiry should be closer to (spot - strike).
call(14341.0, 14000.0, 0.1, 0.2125, 0.25/365.0)
> 552.5131384979031
should be around 341
right?
Ok I'll take a look.
Ok I added a PR for the statrs but its slower (as I expected).
I added a test specifically for your function and I get 342 as the call price, not 552....see the test assertion at https://github.com/danielhstahl/black_scholes_rust/pull/10/files#diff-b1a35a68f14e696205874893c07fd24fdb88882b47c23cc0e0c80a30c7d53759R481
Long story short:
https://github.com/danielhstahl/black_scholes_rust/blob/c5582fa71295b7411a872d0e3a8eaf069edff10e/src/lib.rs#L8