## 这是一篇来自美国的关于解决下面几个问题的CS代写，需要提交解决方案的所有组件（书面/分析工作、代码/脚本/笔记本、图形、绘图等）。在每个问题的部分中以PDF形式进行众包标记。您还必须单独提交一个单独的zip文件，其中包含任何和所有的DropBox文件（也就是说，zip中的文件应该是.ipynb类型）

Submit all components of your solutions (written/analytical work, code/scripts/notebooks, fifigures, plots, etc.) to CrowdMark in PDF form in the section for each question.

You must also separately submit a single zip fifile containing any and all code/notebooks/scripts you write to the DropBox on LEARN in runnable format (that is, the fifiles in the zip should be of type .ipynb).

**For full marks, you must show your work and adequately explain your logic! **

- (10 marks) Monte Carlo option pricing.

As we derived in class, for the purposes of pricing options, we can pretend that the asset price *S *evolves in the risk-neutral world as

*dS *= *rSdt *+ *σ*(*S, t*)*SdZ, *

where *r *is the risk free rate, *σ*(*S, t*) is the volatility (as a function of *S *and *t*), and *dZ *is the increment of a Weiner process.

Let the expiry time of an option be *T*, and let

*N *=*T /*∆*t **, *

*S**i *= *S*(*i*∆*t*)*, *

where ∆*t *is the time step size. Then, given an initial price *S*0, *M *difffferent simulations of the path of the asset should be generated using the simple time-stepping rule

*S**i*+1 = *S**i *+ *S**i*(*r*∆*t *+ *σφ**i **√ *∆*t*)*, *(1)

where *φ**i **∼ **N*(0*, *1) at each step. If the value of *S**N *= *S*(*T*) generated by the *m**th *simulation is denoted by (*S**N *)*m*, then an approximate value (i.e., Monte Carlo estimate) of the option price is given by

*V *(*S*0*, *0) = *e **−**rT* P *M m*=1 Payoffff((*S**N *)*m*)/*M *! *.*

For the volatility function, we will use *σ*(*S, t*) = *γ/S *where *γ *= 20 is a constant.

Since the basic time stepping method of Equation (1) could potentially produce negative values,for this question we will simply set the asset price to * *= 10*−*8 whenever timestepping produces

*S**i*+1 *≤ *0.

Prepare a Jupyter notebook that implements this method in Python/NumPy. Use the data for computing European puts given in Table 1. For a fifixed ∆*t*, write code to plot the computed option value versus number of simulations *M*, for each of

*M *= 1000*, *2000*, *4000*, *8000*, *16000*, *32000*, *64000*, *96000*, *128000*, *192000*, *256000*. *

Generate such a plot for the following values of ∆*t *= 10*/*250*, *2*.*5*/*250*, *1*/*250. (We often assume 250 days in a fifinancial year). Title each of your 3 plots with the corresponding timestep size.

Comment on the behavior you observe from these plots.

Additionally, for the smallest ∆*t *value, write code to generate a simple text table where each row contains *M*, the estimated option value, and the lower and upper bound values of the 95% confifidence interval, for that value of *M*.

Be sure to vectorize the inner loop of your code. That is, for a given choice of ∆*t *and *M*, there should only be one explicit loop (i.e., over the time steps) so that all of the *M *simulations are computed simultaneously with vector operations, rather than one entry at a time.

Risk free rate *r *0.08

Time to expiry *T *1.0 years

Strike Price *K *$101

Initial asset price *S*0 $100

*γ *20

* *10*−*8

Table 1: Parameters for Q1.

- (10 marks) Delta hedging: single stochastic paths.

As we have seen in lecture, discrete delta hedging consists of a portfolio Π(*t*) with components:

- A short option position
*−**V*(*S*(*t*)*, t*). - Long
*α*(*t*) shares at price*S*(*t*). - An amount in a risk-free bank account
*B*(*t*).

Initially, we have

Π(0) = *−**V *(*S*(0)*, *0) + *α*(0) *S*(0) + *B*(0) = 0

*α*(0) =*∂V /**∂S *(*S*(0)*, *0)

*B*(0) = *V *(*S*(0)*, *0) *− **α*(0) *S*(0)*. *

The hedge is rebalanced at discrete times *t**i *. Defifining

*α**i *=*∂V /**∂S *(*S**i **, t**i*)

*V**i *= *V *(*S**i **, t**i*)*, *

then we have to update the hedge by purchasing *α**i **− **α**i**−*1 shares at *t *= *t**i *, so that updating our share position requires

*S*(*t**i*) (*α**i **− **α**i**−*1)

in cash, which we borrow from the bank. At the instant after the rebalancing time *t**i *, the value of the portfolio is

Π*i *= *−**V**i *+ *α**i**S**i *+ *B**i **.*

Develop Python/NumPy code in a Jupyter notebook for simulating a stochastic path of a delta hedge. At the end of each discrete hedging interval, update your portfolio, using the current asset price, and the corresponding values of option and delta (using *blsprice, blsdelta*). (Note that you do not need to rebalance at the fifinal time, *t *= *T*.)

Compute the relative hedging error at expiry time *t *= *T*, i.e.

Relative Hedge Error =*e **−**rT *Π(*T*)/*|**V *(0)*|.*

Your code should be able to produce plots showing: the stock price *S**i *, the value in the risk free account (*B**i*), the stock holding (*α**i **S**i*), and the total portfolio value Π*i *at each point along this single stochastic path. The plots should be loosely similar to Figure 8.1.3 in the course notes. (Of course, your actual values will be difffferent, due to the randomness inherent in the algorithm). Use the PyPlot function legend to identify the difffferent curves.

Using the code above, generate four difffferent plots, using 10*, *100*, *1000*, *10000 timesteps / intervals in [0*, T*].

Generate an additional plot of number of rebalances vs. the corresponding *absolute value *of the relative hedge error. That is, it should have rebalance counts on the x-axis and error on the y-axis.

To evolve the stock price *S *for this question, we will assume GBM and use the following *exact *update rule for GBM:

*S*(*t**i*+1) = *S*(*t**i*) exp h (*µ **− **σ *2 */*2)(*t**i*+1 *− **t**i*) + *σφ*p *t**i*+1 *− **t**i *i *, *(2)

where *φ **∼ **N*(0*, *1).

Use the data in Table 2. There is no need to vectorize this code. Comment on what you observe.

**程序辅导定制C/C++/JAVA/安卓/PYTHON/留学生/PHP/APP开发/MATLAB**

本网站支持 Alipay WeChatPay PayPal等支付方式

**E-mail:** vipdue@outlook.com **微信号:**vipnxx

如果您使用手机请先保存二维码，微信识别。如果用电脑，直接掏出手机果断扫描。