Browse by Topic
Related Topics

# Optimizing Financial Modeling with Mathematica

On January 25 and 27 in Chicago and New York, respectively, Wolfram, in conjunction with NVIDIA, hosted a seminar themed “Optimizing Financial Modeling” to showcase how Mathematica and CUDA can be applied within the financial industry. Full presentations and a white paper on CUDA programming with Mathematica are available for download on the seminar page.

Dr. Phillip Zecher, Chief Risk Officer of EQA Partners, detailed how Mathematica is used in every facet of his firm’s operation, and NVIDIA’s Senior CUDA Consultant John Ashley explained how CUDA programming is changing financial computation.

My talk concerned Mathematica 8’s broad functionality for finance. Each capability is deserving of a full seminar unto itself, so because of the sheer number of topics and functions, I was only able to briefly touch on a few examples from each category. A full list of financial tools in Mathematica is available in the online documentation. The following TabView presents an overview of the new financial functions:

At first glance, it may seem that such an array of functions might be hard to digest, but they all come with Mathematica’s patented structure of FunctionName[arguments], where the FunctionName is exactly what it is called by the financial community. This makes absorbing and manipulating these new functions far more manageable than the usual array of acronyms encountered in other programs. For example, the function TimeValue accepts any type of financial instrument, such as annuities and cash flows, and we can replace the nominal interest rate with an effective interest rate with different periods of compounding:

We can use another TabView to provide a succession of examples of the functions TimeValue, Annuity, and Cashflow in conjunction with Solve and Expectation that makes their combined use transparent:

The evaluation of bonds also have consistent structure given by FinancialBond[{"FaceValue"->FV,"Coupon"->Crate,"Maturity"->M, "CouponInterval"->CI,"RedemptionValue"->RV}, {"InterestRate"->IR,"Settlement"->S,"DayCountBasis"->DCB}] so that it is easy to construct the following applet for pricing a bond and its various properties with varying yield curve and input parameters:

In the same way, financial derivatives also accept a well-defined structure of parameters and ambient parameters that fully describe the dependence of the option on its underlying security. One does not even need to remember the lists of parameters required to specify the model, but only its name. Thus the parameter specification for an American Put option is described by the command:

In this way we can easily make a template for calculating and pasting financial derivatives with variable inputs:

The output of the above Manipulate is copied directly onto your clipboard so that you can paste it into an input cell, wrap ReleaseHold around it, and replace the PlaceHolders by numerical values, as in the example below:

Finally, though by no means exhaustively, there is the function TradingChart, which takes data from the pre-existing function FinancialData and graphs it up with financial indicators, which can be used to identify possible trading events. In the case below, I have chosen a darker opacity for those closing prices in the bottom and top third of values because they suggest possible moments when one is most likely to buy or sell, respectively.

One of the main purposes of the conference was also to highlight Mathematica’s development of CUDA programming and to show that it can be applied to the massively parallel evaluation of financial options. To access this functionality, we must first load in the CUDALink package, which allows one to utilize the many parallel cores on the GPU. Here we simultaneously evaluate one hundred thousand different Asian arithmetic options, which are each simulated using Monte Carlo techniques. The time required to perform these calculations is a small fraction of the time required using CPU compilation.

For more information, please refer to the Financial Engineering and Mathematics page, or visit the Optimizing Financial Modeling seminar page to download the full presentations and a white paper on CUDA programming with Mathematica.