Note:
This is the class website of a course that is not currently running.
Some links may be broken.
Here are a few code snippets I wrote in connection to this class. Feel free to copy and modify them to suit your purposes.
All code I’ve written is in Python as a Jupyter Notebook using NumPy (numerical python libraries).
To run my code you will have to install these on your computer.
The websites above have installation instructions.
You are, of course, free to write code in your preferred language, or even use a spreadsheet.
My code is provided here just as an example.
Pricing up-rebate options using the state process $Y = S$:
viewdownload.
Pricing up-rebate options using the state process $Y = (S, M)$, where $S$ is the stock price, and $M$ is the running maximum:
viewdownload.
Pricing American/European options (much faster code; but less general as it pre-supposes the domain):
viewdownload.