#14671: Adding Black-Scholes to Sage finance
---------------------------------------------------+------------------------
Reporter: Zaxis | Owner: Zaxis
Type: enhancement | Status: needs_work
Priority: major | Milestone: sage-5.11
Component: finance | Resolution:
Keywords: Black-Scholes, finance, options | Work issues:
Report Upstream: N/A | Reviewers:
Authors: Brian Manion | Merged in:
Dependencies: | Stopgaps:
---------------------------------------------------+------------------------
Comment (by was):
The code works (assuming it is right?), and passes its tests. However,
here are some other issues:
- I wonder if the function could be at least 10 times faster if it were
carefully coded in Cython instead (?):
sage: timeit("finance.black_scholes(100,105,0.0685,0.05,0.4,'call')")
625 loops, best of 3: 769 µs per loop
Usually a function of this complexity should only take maybe 50
microseconds. Optimizing this should not be a stopper for this ticket;
it's something that could be done later in a followup ticket.
- Another more important issues is that you made the standard mistake of
forgetting that the input might by Python ints (instead of Sage integers),
so this goes BOOM:
sage: finance.black_scholes(int(100),int(105),0.0685,0.05,0.4,'call')
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/14671#comment:5>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.