Discrete-Time Black Scholes

Welcome to your 1st assignment in Reinforcement Learning in Finance. This exercise will introduce Black-Scholes model as viewed through the lens of pricing an option as discrete-time replicating portfolio of stock and bond.

Instructions:

Let's get started!

About iPython Notebooks

iPython Notebooks are interactive coding environments embedded in a webpage. You will be using iPython notebooks in this class. You only need to write code between the ### START CODE HERE ### and ### END CODE HERE ### comments. After writing your code, you can run the cell by either pressing "SHIFT"+"ENTER" or by clicking on "Run Cell" (denoted by a play symbol) in the upper bar of the notebook.

We will often specify "(≈ X lines of code)" in the comments to tell you about how much code you need to write. It is just a rough estimate, so don't feel bad if your code is longer or shorter.

Screen Shot 2022-08-21 at 4.48.31 PM.png

Screen Shot 2022-08-21 at 4.50.07 PM.png

Screen Shot 2022-08-21 at 4.56.23 PM.pngScreen Shot 2022-08-21 at 4.54.14 PM.png

Simulate $N_{MC}$ stock price sample paths with $T$ steps by the classical Black-Sholes formula.

$$dS_t=\mu S_tdt+\sigma S_tdW_t\quad\quad S_{t+1}=S_te^{\left(\mu-\frac{1}{2}\sigma^2\right)\Delta t+\sigma\sqrt{\Delta t}Z}$$

where $Z$ is a standard normal random variable.

MC paths are simulated by GeneratePaths() method of DiscreteBlackScholes class.

Part 1

Class DiscreteBlackScholes implements the above calculations with class variables to math symbols mapping of:

$$\Delta S_t=S_{t+1} - e^{-r\Delta t} S_t\space \quad t=T-1,...,0$$

Instructions: Some portions of code in DiscreteBlackScholes have bee taken out. You are to implement the missing portions of code in DiscreteBlackScholes class.

$$\Pi_t=e^{-r\Delta t}\left[\Pi_{t+1}-u_t \Delta S_t\right]\quad t=T-1,...,0$$

DiscreteBlackScholes.opt_hedge corresponds to $\phi_t$ and is computed as $$\phi_t=\mathbf A_t^{-1}\mathbf B_t$$

Screen Shot 2022-08-21 at 5.00.02 PM.png

Screen Shot 2022-08-21 at 5.00.53 PM.png

Screen Shot 2022-08-21 at 5.01.27 PM.png

Screen Shot 2022-08-21 at 5.01.49 PM.png

Screen Shot 2022-08-21 at 5.08.34 PM.png

Screen Shot 2022-08-21 at 5.09.53 PM.png

Screen Shot 2022-08-21 at 5.10.58 PM.png

Screen Shot 2022-08-21 at 5.11.22 PM.png

Screen Shot 2022-08-21 at 5.11.45 PM.png

Screen Shot 2022-08-21 at 5.12.31 PM.png

Screen Shot 2022-08-21 at 5.14.27 PM.pngScreen Shot 2022-08-21 at 5.15.13 PM.pngScreen Shot 2022-08-21 at 5.13.12 PM.png