代写C++代码 代做C++程序 C++辅导 C++教学

C++网络家教 远程写代码 在线Debug 讲解答疑 不是中介,本人直接写

微信: ittutor QQ: 14061936 Email: ittutor@qq.com

导航

 (I) Write a function or functions to evaluate the Black-Scholes functions for Put and Call. Test it by verifying the 

Put-Call parity relationship. Perform the test on a variety of different values of r, , S0, and T - t. (Take q = 0.) 

Write the program so that it takes as input actual dates (current date and expiration date).  

 

Hint: The time to expiration of the option in years = (the number of business days between current date and 

expiration date)/ (total number of business days in one year).  

 

Functions should be declared in .h files and defined in corresponding .cpp files. (e.g., hw2_StdNormal.h and 

hw2_StdNormal.cpp)  

 

Please do the following: 

1. Complete the code for the function: double Normal(double) by implementing the algorithm in the notes. 

 

2.  Implement Black-Scholes functions for Call and Put. Follow the examples of BSF_call and BSF_put found in 

the file BSF_wk4.py.  

 

3. Test your work in step 2 by implementing a function like BSF_Test in BSF_wk4.py 

 

4. Try to write one BSF function that returns a pair<double, double> where the first member is the call value and 

the second is the put value. 

 

5. Try to implement the Black-Scholes functions as Function Objects in which the single variable is the spot price.  

 

6. Finally, try to implement the Black-Scholes functions as Function Objects in which the single variable is the 

volatility . 

 

(II) There are three variables of interest: T - t, S, . If T- t is held fixed, one can investigate the near term behavior 

of the option price as S and  vary. If  is held fixed, one can view the theoretical future dynamics of the option 

prices. Each of these studies can be made by creating grids of values that can be imported into a spreadsheet and 

charted. Write a program to create these types of data.  

 

Hint: The program’s input should include fixed current date, fixed expiration date, range of S, the range of  and 

other necessary parameters (e.g., r, q, flag of call/put, etc.) The output should be a csv-file of option prices with 

varying and S. The generation the range of S or should be done in an automatic manner. For example, let the 

user set the min(S)=20, max(S)=35, step(S)=1 (or n(S)=16), and then an array of [20, 21, …, 35] would be 

generated. In the csv files, column names and row names should be presented, and the first line should contain 

basic information of the option, like below: 

 

Call Option K=27 sigma=1 r=0.01 q=0 t=08/19/2014 T=09/19/2014 range(S)=20:1:35  range()=0.5:0.1:1.5 

S \   0.5  0.6  0.7  …  1.4  1.5 

20             

…             

35             

 

 

(III) Implement the plan of Problem 2 for the case of an option portfolio consisting of one European Call that 

expires in expiration date T1 (e.g., November 21st

) and a short position in a European call that expires in another 

expiration date T2 (e.g., October 17th

) . Both options have the same underlying and the same strike. (This position 

is called a “Call Calendar Spread".) 

 

One table of the portfolio price for varying S and  is expected to output in a csv file. The input current date 

should be no later than min(T1,T2). The format requirement of csv file remains the same as that in problem (II).  


相关推荐