Tools for working with financial options
AUTHORS: - Brian Manion, 2013: initial version
Calculates call/put price of European style options using Black-Scholes formula. See [S] for one of many standard references for this formula.
INPUT:
OUTPUT:
The price of an option with the given parameters.
EXAMPLES:
sage: finance.black_scholes(42, 40, 0.5, 0.1, 0.2, 'call') # abs tol 1e-10
4.759422392871532
sage: finance.black_scholes(42, 40, 0.5, 0.1, 0.2, 'put') # abs tol 1e-10
0.8085993729000958
sage: finance.black_scholes(100, 95, 0.25, 0.1, 0.5, 'call') # abs tol 1e-10
13.695272738608132
sage: finance.black_scholes(100, 95, 0.25, 0.1, 0.5, 'put') # abs tol 1e-10
6.349714381299734
sage: finance.black_scholes(527.07, 520, 0.424563772, 0.0236734,0.15297,'whichever makes me more money')
Traceback (most recent call last):
...
ValueError: 'whichever makes me more money' is not a valid string
REFERENCES:
[S] | Shreve, S. Stochastic Calculus for Finance II: Continuous-Time Models. New York: Springer, 2004 |