shuoli (Intel) 于 提交
Introduction
The Binomial Options Pricing Model (BOPM) is a generalized numerical method used to value options in the quantitative Financial Services industry. To be accurate, it is a latticebased approach that uses a discretetime model of the varying price over time of the underlying financial instrument. For historical reason, it’s also known as a tree model because it has a root and the leavenodes. In this paper, we continue to follow treeanalogy convention knowing that it’s a lattice approach in reality.
The binomial model was first proposed by Cox, Ross, and Rubenstein in 1979 [1]. Binomial option pricing is a simple but powerful technique that can be used to solve many complex optionpricing problems. The name was derived from the construction of a binomial tree that models different possible paths that might be followed by the underlying asset price over the time span of the option.
This article presents the Binomial Option Pricing Code to provide a representative way of pricing derivatives using lattice methods.
Code Access
Binomial Option Pricing Code is maintained by Shuo Li and is available under the BSD 3Clause Licensing Agreement. The code supports the asynchronous offload of the Intel® Xeon® processor (referred to as “host” in this document) with the Intel® Xeon Phi™ coprocessor (referred to as “coprocessor” in this document) in a single node environment.
To get access to the code and test workloads:
Download the Binomialsrc.tar file
Build Directions
Here are the steps you need to follow in order to rebuild the program
 You have to install Intel Composer XE 2013 SP 3 in your system.
 Source the environment variable script file compilervars.csh under /pkg_bin
 Untar the binomialsrc.tar, execute build_sh script file with csh/tcsh shell
 Invoke executable file ./Binomial
Run Directions
./Binomial [verbose] [precision]
verbose
0: turn off workload feedback and result validation (default)
1: turn on workload feedback and result validation
precision:
0 single precision (default)
1 double precision
[command prompt]$ ./Binomial
Binomial Option Pricing in single precision:
Pricing 36600000 Option with time step of 2048.
Benchmarking the reference result in single...
Completed in 256.17960 seconds. Options per second: 142868.51654
[command prompt]$ ./Binomial 1 1
Initializing data...
...allocating memory for options.
...generating input data in mem.
Creating the reference result...
Benchmarking the reference result...
Binomial Option Pricing in double precision:
Pricing 36600000 Option with time step of 2048.
Benchmarking the reference result in double...
Completed in 514.10377 seconds. Options per second: 71191.85352
L1 norm: 2.717881E05
TEST PASSED
The program created and priced 36,600,000 sets of option data. The program was vectorized and parallelized to run on both the Intel^{®} Xeon® Processors and Intel® Xeon Phi™ Coprocessor. The products involved are Intel E2697V2 at 2.7 Ghz and Intel® Xeon Phi™ Coprocessor 7120P. Intel® Composer XE 2013 SP1 is used to build the final executable program.
This program calculates the European call option price for each input data set. This benchmark runs on single node with or without a Intel Xeon Phi Coprocessor. It can also be modified to run in a cluster environment. The program reports a latency measure in seconds spent in pricing activities and also a throughput measure using 36.6 million options. Verbose mode provides additional information and also validates the results using a BlackScholesMerton [2] formula.
Background
As previously stated, binomial option pricing is a simple but powerful technique used to solve complex optionpricing problems. Unlike the BlackScholesMerton and other complex option pricing models, it does not require solutions to stochastic differential equations; the binomial optionpricing model is mathematically trivial. Anyone with a good understanding of the time value of money and riskneutral valuation should be able to understand the binomial model.
Consider a stock with the initial value of S_{0} and an option f with lifetime T. During the life of the option, the stock price can either move up from S_{0} to a new level, S_{0}u where u > 1 (going up by u1 percent), or it can move down from S_{0} to a new level S_{0}d where d < 1 (going down by 1d percent).
Let’s suppose that when the stock price moves to S_{0}u, the payoff from option is f_{u}; when the stock price moves down to S_{0}d, the payoff from the option is f_{d}. Binomial valuation starts by creating a riskless portfolio consisting of a long option in Δ unit shares of the underlying stocks and a short position in one unit of option. When the stock moves up, the value of the portfolio becomes S_{0}u Δ f_{u}; when the stock moves down, the value of the portfolio becomes S_{0}d Δ –f_{d}. Using no arbitrage argument, these two cases should be the equal value or:
S_{0}u Δ f_{u} = S_{0}d Δ –f_{d}
Therefore:
The riskneutral argument also dictates that all portfolios shall earn the riskfree interest rate. Since we know the riskfree interest r, the current value of the portfolio when the stock goes up can be written as follows:

(S_{0}u –f_{u}) e^{rT} 
This must equal the cost of setting up the portfolio:  
S_{0}Δ  f = (S_{0}u –f_{u})e^{rT}  
Thus:  
f = S_{0}Δ  (S_{0}u –f_{u})e^{rT}  
Since we know Δ, we can further reduce this equation as follows:  
f = e^{rT }[pf_{u} + (1p)f_{d} ]  
where  
With the last two equations, we can naturally interpret the variable p as the probability of an upward movement in the underlying stock price. Thus, 1p is the probability of a downward movement. We can further state that the value of the option today is the expected future payoff discounted at the riskfree rate.
The last challenge in creating a binomial optionpricing algorithm is to integrate the stock price movement process into the binomial tree parameters u and d. Using the same assumption as the BlackScholes model, which Hull[3] has elaborated in Chapter 14 of his book, we can construct a binomial tree by using the underlying stock price volatility σ. Cox, Ross, and Rubinstein (1979) proposed the following set of u and d:
These values not only match the volatility with the up and down movement of stock price but also make the binomial tree recombinant, in the sense that the nodes that represent a stock moving up then down and the stock price moving down then up, will be merged or recombined as a single node. This property also spares us from the elaborated process to propagate the internal node values to the leaf nodes; instead it gives a closedend formula for each leaf node.
Now we can easily extend the onestep binomial tree into a twostep binomial tree, threestep binomial tree, and Nstep binomial tree. The previous picture shows a perfectly balanced Nstep binomial tree, where each initial node has exactly two child nodes representing an upward movement and a downward movement of the stock price, respectively.
The probability of an upward movement is p and the probability of downward movement is 1p. The NStep binomial tree has N+1 level; each level has one less node than its previous level and one more node than its next level. The number of leaf nodes for NStep binomial tree is N+1.
Implementation of Binomial Tree Options Pricing
Binomial option pricing can be conceptually described as a threestep process:
 Binomial tree representation and generation
 Calculation of option values at the leaf nodes
 Backward inductive calculation of option value at internal nodes; the value at the root node is the current price of the option
The next step is to determine a data structure that can represent all the tree nodes. Since the binomial tree model involves calculations on adjacent levels, the minimum data structure required is the one that holds all the node values in one level, including the leaf nodes level, which has the number of nodes equal to the number of time steps +1. Depending on the application precision requirement, we can choose a onedimensional, singleprecision, floatingpoint array to accomplish this purpose.
static float Call[NUM_STEPS+1];
Binomial Option Pricing ImplementationEuropean Options
The following code gives the implementation of Binomial Tree European Option Pricing in C/C++.
#include <mathimf.h> #include <omp.h> #include <stdio.h> #define NUM_STEPS 2048 #define OPT_N 18300000 const float RISKFREE = 0.06f; const float VOLATILITY = 0.10f; __forceinline float Exp( float x) { return expf( x); } __forceinline double Exp( double x) { return exp( x); } __forceinline float Sqrt( float x) { return sqrtf( x); } __forceinline double Sqrt( double x) { return sqrt( x); } template <class Basetype> void BinomialTemplate( Basetype *CallResult, Basetype *S, Basetype *X, Basetype *T) { #pragma omp parallel for for(int opt = 0; opt < OPT_N; opt++) { __attribute__((align(4096)))Basetype Call[NUM_STEPS + 1]; const Basetype Sx = S[opt]; const Basetype Xx = X[opt]; const Basetype Tx = T[opt]; const Basetype dt = Tx / static_cast<Basetype>(NUM_STEPS); const Basetype vDt = VOLATILITY * Sqrt(dt); const Basetype rDt = RISKFREE * dt; const Basetype If = Exp(rDt); const Basetype Df = Exp(rDt); const Basetype u = Exp(vDt); const Basetype d = Exp(vDt); const Basetype pu = (If  d) / (u  d); const Basetype pd = 1.0f  pu; const Basetype puByDf = pu * Df; const Basetype pdByDf = pd * Df; #pragma simd for(int i = 0; i <= NUM_STEPS; i++) { Basetype d = Sx * Exp(vDt * (2.0 * i  NUM_STEPS))  Xx; Call[i] = (d > 0) ? d : 0; } for(int i = NUM_STEPS; i > 0; i) #pragma simd #pragma unroll(4) for(int j = 0; j <= i  1; j++) Call[j] = puByDf * Call[j + 1] + pdByDf * Call[j]; CallResult[opt] = (Basetype)Call[0]; } }
In the hybrid version of the code. The program execute simultaneously on the host Intel Xeon processors and on the Intel Xeon Phi coprocessors. The main program instantiates the above code twice, once to run on the host processor, another to run on MIC coprocessor. It uses asynchronous offload capability from Intel Compiler so that host and coprocessor can work concurrently.
About the Author
Shuo Li works at Software and Service Group at Intel Corporation. His main interest is parallel programming, and application software performance. In his recent role as a software performance engineer covering financial service industry, Shuo works closely with software developers and modelers and help them achieve best possible performance with their software solutions.
Shuo holds a Master's degree in Computer Science from university of Oregon and an MBA degree from the Duke University.
References and Resources
[1]Option Pricing: A Simplified Approach (1979) by John C. Cox, Stephen A. Ross, and Mark Rubinstein:
[2]The Pricing of Options and Corporate Liabilities (MayJun 1973) by Fischer Black and Myron Scholes:
[3]Hull, John C, Options, Futures, and other Derivatives,10^{th} Edition PrenticeHull, 2014
[4]Intel Xeon processor: http://www.intel.com/content/www/us/en/processors/xeon/xeonprocessore7family.html
[5]Intel Xeon Phi™ Coprocessor: https://software.intel.com/enus/articles/quickstartguidefortheintelxeonphicoprocessordeveloper
添加评论
顶部（有关技术讨论的信息，请访问开发人员论坛。有关网站或软件产品的问题，请联系支持部门。）
请登录添加评论。 还不是成员？ 立即加入