Dr. Yves J. Hilpisch
The Python Quants GmbH
Dr. Yves J. Hilpisch
The Python Quants GmbH
{ | |
"python_interpreter": "/Users/yves/Python/envs/work/bin/python", | |
} | |
// make sure that the Python interpreter is 3.10 or below |
\documentclass{article} | |
\usepackage{amsmath} | |
\title{The Black-Scholes Option Pricing Formula} | |
\author{CPF Program} | |
\date{\today} | |
\begin{document} | |
\maketitle | |
\section{Introduction} | |
The Black-Scholes model, developed by Fischer Black and Myron Scholes in 1973, provides a theoretical estimate of the price of European-style options. This model assumes that the price of the underlying asset follows a geometric Brownian motion with constant drift and volatility. | |
\section{The Black-Scholes Formula} | |
The Black-Scholes formula calculates the price of a European call option. The formula is given by: | |
\begin{equation} | |
C = S_0 N(d_1) - K e^{-rT} N(d_2) | |
\end{equation} | |
where: | |
\begin{align*} | |
d_1 &= \frac{\ln(S_0 / K) + (r + \sigma^2 / 2)T}{\sigma \sqrt{T}}, \\ | |
d_2 &= d_1 - \sigma \sqrt{T}. | |
\end{align*} | |
Here, | |
\begin{itemize} | |
\item \( C \) is the price of the call option, | |
\item \( S_0 \) is the current price of the underlying asset, | |
\item \( K \) is the strike price, | |
\item \( T \) is the time to expiration, | |
\item \( r \) is the risk-free interest rate, | |
\item \( \sigma \) is the volatility of the underlying asset, | |
\item \( N(\cdot) \) is the cumulative distribution function of the standard normal distribution. | |
\end{itemize} | |
\section{Derivation} | |
The derivation of the Black-Scholes formula involves stochastic calculus and the application of Ito's Lemma. The key assumptions include: | |
\begin{itemize} | |
\item The underlying asset follows a geometric Brownian motion. | |
\item Markets are frictionless (no transaction costs or taxes). | |
\item There are no arbitrage opportunities. | |
\item The risk-free rate and volatility are constant over the option's life. | |
\end{itemize} | |
\section{Conclusion} | |
The Black-Scholes model is a fundamental tool in financial economics, providing insights into the pricing of options and the management of financial risk. Despite its assumptions, it forms the basis for more advanced models and real-world applications. | |
\end{document} |
### | |
### Setting Up Apple Mac Computers | |
### | |
BASIC | |
* installing & setting up OS | |
* SEARCHING via cmd+space bar | |
* adjusting dock to preferred settings (search: dock) | |
* adjusting function keys settings (search: function keys) | |
* maybe changing wallpaper | |
BROWSER & WEB | |
* installing Chrome | |
* Google account | |
* extensions (AdBlock, Privacy Badger, etc.) | |
TOOLS | |
* Alfred 5 (→ download from web page) | |
* Spectacle ... | |
* ... or Rectangle | |
* AppCleaner | |
* BetterDummy | |
SYSTEM & SHELL | |
* installing iTerm2 | |
* chsh -s /bin/bash | |
* vim ~/.bash_profile | |
export BASH_SILENCE_DEPRECATION_WARNING=1 | |
* sudo scutil --set HostName "newname" | |
* xcode-select --install | |
* installing Homebrew (https://brew.sh/): | |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | |
* execute on the shell: | |
(echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> /Users/yves/.bash_profile eval "$(/opt/homebrew/bin/brew shellenv)" | |
* installation via: brew install <package> | |
[* on ARM | M1: | |
** softwareupdate --install-rosetta | then: | |
** /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"] | |
* installing tools (wget, htop, screen, etc.) | |
* installing MacVim (brew install macvim) | |
* configuring iTerm2 (wget http://hilpisch.com/iterm2.json) | |
* configuring Vim (wget http://certificate.tpq.io/.vimrc) | |
* create SSH key pair (ssh-keygen) | |
* optional: installing gist (brew install gist) | |
* optional: configure gist with Github | |
SUBLIME | |
* installing Sublime | |
* Sublime license key | |
* package installation | |
** Package Control (CMD+SHIFT+P Install Package Control) | |
** Cobalt2 Theme | |
** Origami Package | |
** Terminus Package | |
** Anaconda Package (requires Python 3.10 or earlier) | |
** AsciiDoctor Package | |
** File Browser Package | |
* configuring Sublime | |
** Key Bindings | |
** User Preferences | |
* On the Command Line: | |
https://www.sublimetext.com/docs/3/osx_command_line.html | |
ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /Users/yves/Python/bin/subl | |
PYTHON | |
* downloading Miniconda | |
* installing Miniconda | |
* creating a work environment | |
* installing major packages (np, pd, mpl, sk, ipy, jup, ker, tf) | |
* installing major tools (ipy, lab) | |
* configuring Jupyter Lab (key bindings, plotting) | |
TA-LIB | |
brew install ta-lib | |
export TA_INCLUDE_PATH="$(brew --prefix ta-lib)/include" | |
export TA_LIBRARY_PATH="$(brew --prefix ta-lib)/lib" | |
pip install --no-cache-dir ta-lib | |
DROPBOX | |
* installing Dropbox | |
* choosing folders to sync | |
OFFICE | |
* Discord | |
* Apple suite (Pages, etc.) | |
* optional: Libre Office | |
* optional: Microsoft Office | |
* Telegram | |
DOCKER | |
* Download from Docker Hub | |
ASCIIDOCTOR | |
* brew install asciidoctor | |
* sudo gem install coderay | |
LATEX | |
* https://www.xm1math.net/texmaker/download.html (texmaker) | |
* http://www.tug.org/mactex/morepackages.html (basic package) | |
* http://www.tug.org/mactex/mactex-download.html (full package) | |
* https://github.com/amaxwell/tlutility/releases (tex live utility); install Helvetic (URW Base 35 Package) | |
* https://sourceforge.net/projects/cm-unicode/files/cm-unicode/0.7.0/ (standard fonts, in case) |
{ | |
"Ansi 0 Color" : { | |
"Green Component" : 0, | |
"Blue Component" : 0, | |
"Red Component" : 0 | |
}, | |
"Tags" : [ | |
], | |
"Ansi 12 Color" : { | |
"Green Component" : 0.3333333432674408, | |
"Blue Component" : 1, | |
"Red Component" : 0.3333333432674408 | |
}, | |
"Ansi 7 Color" : { | |
"Green Component" : 0.73333334922790527, | |
"Blue Component" : 0.73333334922790527, | |
"Red Component" : 0.73333334922790527 | |
}, | |
"Ansi 8 Color" : { | |
"Green Component" : 0.3333333432674408, | |
"Blue Component" : 0.3333333432674408, | |
"Red Component" : 0.3333333432674408 | |
}, | |
"Bold Color" : { | |
"Green Component" : 1, | |
"Blue Component" : 1, | |
"Red Component" : 1 | |
}, | |
"Ansi 9 Color" : { | |
"Green Component" : 0.3333333432674408, | |
"Blue Component" : 0.3333333432674408, | |
"Red Component" : 1 | |
}, | |
"Ansi 1 Color" : { | |
"Green Component" : 0, | |
"Blue Component" : 0, | |
"Red Component" : 0.73333334922790527 | |
}, | |
"Custom Directory" : "Recycle", | |
"Rows" : 25, | |
"Default Bookmark" : "No", | |
"Non-ASCII Anti Aliased" : true, | |
"Use Bright Bold" : true, | |
"Ansi 10 Color" : { | |
"Green Component" : 1, | |
"Blue Component" : 0.3333333432674408, | |
"Red Component" : 0.3333333432674408 | |
}, | |
"Use Cursor Guide" : false, | |
"Ambiguous Double Width" : false, | |
"Jobs to Ignore" : [ | |
"rlogin", | |
"ssh", | |
"slogin", | |
"telnet" | |
], | |
"Ansi 15 Color" : { | |
"Green Component" : 1, | |
"Blue Component" : 1, | |
"Red Component" : 1 | |
}, | |
"Foreground Color" : { | |
"Red Component" : 0.20998050458729267, | |
"Color Space" : "sRGB", | |
"Blue Component" : 0.8111572265625, | |
"Alpha Component" : 1, | |
"Green Component" : 0.36539334674586144 | |
}, | |
"Working Directory" : "\/Users\/yves", | |
"Use Tab Color" : true, | |
"Blinking Cursor" : true, | |
"Disable Window Resizing" : true, | |
"Sync Title" : false, | |
"Prompt Before Closing 2" : false, | |
"BM Growl" : true, | |
"Command" : "", | |
"Description" : "Default", | |
"Smart Cursor Color" : false, | |
"Mouse Reporting" : true, | |
"Screen" : -1, | |
"Selection Color" : { | |
"Red Component" : 0.53411865234375, | |
"Color Space" : "sRGB", | |
"Blue Component" : 0.028190863318741322, | |
"Alpha Component" : 1, | |
"Green Component" : 0.028190863318741322 | |
}, | |
"Columns" : 80, | |
"Idle Code" : 0, | |
"Ansi 13 Color" : { | |
"Green Component" : 0.3333333432674408, | |
"Blue Component" : 1, | |
"Red Component" : 1 | |
}, | |
"Custom Command" : "Yes", | |
"ASCII Anti Aliased" : true, | |
"Non Ascii Font" : "Monaco 12", | |
"Vertical Spacing" : 1, | |
"Use Bold Font" : true, | |
"Option Key Sends" : 0, | |
"Selected Text Color" : { | |
"Red Component" : 0.29999999999999999, | |
"Color Space" : "sRGB", | |
"Blue Component" : 0.29999999999999999, | |
"Alpha Component" : 1, | |
"Green Component" : 0.29999999999999999 | |
}, | |
"Background Color" : { | |
"Red Component" : 0, | |
"Color Space" : "sRGB", | |
"Blue Component" : 0, | |
"Alpha Component" : 1, | |
"Green Component" : 0 | |
}, | |
"Character Encoding" : 4, | |
"Ansi 11 Color" : { | |
"Green Component" : 1, | |
"Blue Component" : 0.3333333432674408, | |
"Red Component" : 1 | |
}, | |
"Use Italic Font" : true, | |
"Unlimited Scrollback" : true, | |
"Keyboard Map" : { | |
"0xf700-0x260000" : { | |
"Action" : 10, | |
"Text" : "[1;6A" | |
}, | |
"0x37-0x40000" : { | |
"Action" : 11, | |
"Text" : "0x1f" | |
}, | |
"0x32-0x40000" : { | |
"Action" : 11, | |
"Text" : "0x00" | |
}, | |
"0xf709-0x20000" : { | |
"Action" : 10, | |
"Text" : "[17;2~" | |
}, | |
"0xf70c-0x20000" : { | |
"Action" : 10, | |
"Text" : "[20;2~" | |
}, | |
"0xf729-0x20000" : { | |
"Action" : 10, | |
"Text" : "[1;2H" | |
}, | |
"0xf72b-0x40000" : { | |
"Action" : 10, | |
"Text" : "[1;5F" | |
}, | |
"0xf705-0x20000" : { | |
"Action" : 10, | |
"Text" : "[1;2Q" | |
}, | |
"0xf703-0x260000" : { | |
"Action" : 10, | |
"Text" : "[1;6C" | |
}, | |
"0xf700-0x220000" : { | |
"Action" : 10, | |
"Text" : "[1;2A" | |
}, | |
"0xf701-0x280000" : { | |
"Action" : 11, | |
"Text" : "0x1b 0x1b 0x5b 0x42" | |
}, | |
"0x38-0x40000" : { | |
"Action" : 11, | |
"Text" : "0x7f" | |
}, | |
"0x33-0x40000" : { | |
"Action" : 11, | |
"Text" : "0x1b" | |
}, | |
"0xf703-0x220000" : { | |
"Action" : 10, | |
"Text" : "[1;2C" | |
}, | |
"0xf701-0x240000" : { | |
"Action" : 10, | |
"Text" : "[1;5B" | |
}, | |
"0xf70d-0x20000" : { | |
"Action" : 10, | |
"Text" : "[21;2~" | |
}, | |
"0xf702-0x260000" : { | |
"Action" : 10, | |
"Text" : "[1;6D" | |
}, | |
"0xf729-0x40000" : { | |
"Action" : 10, | |
"Text" : "[1;5H" | |
}, | |
"0xf706-0x20000" : { | |
"Action" : 10, | |
"Text" : "[1;2R" | |
}, | |
"0x34-0x40000" : { | |
"Action" : 11, | |
"Text" : "0x1c" | |
}, | |
"0xf700-0x280000" : { | |
"Action" : 11, | |
"Text" : "0x1b 0x1b 0x5b 0x41" | |
}, | |
"0x2d-0x40000" : { | |
"Action" : 11, | |
"Text" : "0x1f" | |
}, | |
"0xf70e-0x20000" : { | |
"Action" : 10, | |
"Text" : "[23;2~" | |
}, | |
"0xf702-0x220000" : { | |
"Action" : 10, | |
"Text" : "[1;2D" | |
}, | |
"0xf703-0x280000" : { | |
"Action" : 11, | |
"Text" : "0x1b 0x1b 0x5b 0x43" | |
}, | |
"0xf700-0x240000" : { | |
"Action" : 10, | |
"Text" : "[1;5A" | |
}, | |
"0xf707-0x20000" : { | |
"Action" : 10, | |
"Text" : "[1;2S" | |
}, | |
"0xf70a-0x20000" : { | |
"Action" : 10, | |
"Text" : "[18;2~" | |
}, | |
"0x35-0x40000" : { | |
"Action" : 11, | |
"Text" : "0x1d" | |
}, | |
"0xf70f-0x20000" : { | |
"Action" : 10, | |
"Text" : "[24;2~" | |
}, | |
"0xf703-0x240000" : { | |
"Action" : 10, | |
"Text" : "[1;5C" | |
}, | |
"0xf701-0x260000" : { | |
"Action" : 10, | |
"Text" : "[1;6B" | |
}, | |
"0xf702-0x280000" : { | |
"Action" : 11, | |
"Text" : "0x1b 0x1b 0x5b 0x44" | |
}, | |
"0xf72b-0x20000" : { | |
"Action" : 10, | |
"Text" : "[1;2F" | |
}, | |
"0x36-0x40000" : { | |
"Action" : 11, | |
"Text" : "0x1e" | |
}, | |
"0xf708-0x20000" : { | |
"Action" : 10, | |
"Text" : "[15;2~" | |
}, | |
"0xf701-0x220000" : { | |
"Action" : 10, | |
"Text" : "[1;2B" | |
}, | |
"0xf70b-0x20000" : { | |
"Action" : 10, | |
"Text" : "[19;2~" | |
}, | |
"0xf702-0x240000" : { | |
"Action" : 10, | |
"Text" : "[1;5D" | |
}, | |
"0xf704-0x20000" : { | |
"Action" : 10, | |
"Text" : "[1;2P" | |
} | |
}, | |
"Window Type" : 0, | |
"Cursor Type" : 0, | |
"Initial Text" : "", | |
"Background Image Location" : "", | |
"Blur" : false, | |
"Scrollback Lines" : 0, | |
"Send Code When Idle" : false, | |
"Close Sessions On End" : true, | |
"Terminal Type" : "xterm-256color", | |
"Visual Bell" : true, | |
"Flashing Bell" : false, | |
"Underline Color" : { | |
"Red Component" : 0.654998779296875, | |
"Color Space" : "sRGB", | |
"Blue Component" : 0.10070446319878101, | |
"Alpha Component" : 1, | |
"Green Component" : 0.10070446319878101 | |
}, | |
"Silence Bell" : false, | |
"Use Underline Color" : true, | |
"Session Close Undo Timeout" : 30, | |
"Ansi 14 Color" : { | |
"Green Component" : 1, | |
"Blue Component" : 1, | |
"Red Component" : 0.3333333432674408 | |
}, | |
"Name" : "Default", | |
"Cursor Text Color" : { | |
"Red Component" : 0.5, | |
"Color Space" : "sRGB", | |
"Blue Component" : 0.5, | |
"Alpha Component" : 1, | |
"Green Component" : 0.5 | |
}, | |
"Minimum Contrast" : 0.29221413352272729, | |
"Shortcut" : "", | |
"Cursor Color" : { | |
"Red Component" : 0.807220458984375, | |
"Color Space" : "sRGB", | |
"Blue Component" : 0.11749383481219411, | |
"Alpha Component" : 1, | |
"Green Component" : 0.20558300480000469 | |
}, | |
"Tab Color" : { | |
"Red Component" : 0.29999999999999999, | |
"Color Space" : "sRGB", | |
"Blue Component" : 0.29999999999999999, | |
"Alpha Component" : 1, | |
"Green Component" : 0.29999999999999999 | |
}, | |
"Transparency" : 0, | |
"Guid" : "D42DBBAB-067D-4EA1-A731-55C2FD2557B3", | |
"Ansi 3 Color" : { | |
"Green Component" : 0.73333334922790527, | |
"Blue Component" : 0, | |
"Red Component" : 0.73333334922790527 | |
}, | |
"Horizontal Spacing" : 1, | |
"Right Option Key Sends" : 0, | |
"Use Non-ASCII Font" : false, | |
"Ansi 6 Color" : { | |
"Green Component" : 0.73333334922790527, | |
"Blue Component" : 0.73333334922790527, | |
"Red Component" : 0 | |
}, | |
"Normal Font" : "Courier 21", | |
"Ansi 2 Color" : { | |
"Green Component" : 0.73333334922790527, | |
"Blue Component" : 0, | |
"Red Component" : 0 | |
}, | |
"Ansi 4 Color" : { | |
"Green Component" : 0, | |
"Blue Component" : 0.73333334922790527, | |
"Red Component" : 0 | |
}, | |
"Ansi 5 Color" : { | |
"Green Component" : 0, | |
"Blue Component" : 0.73333334922790527, | |
"Red Component" : 0.73333334922790527 | |
} | |
} |
{ | |
"shortcuts": [ | |
{"command": "kernelmenu:restart-and-clear", | |
"keys": [ | |
"Ctrl Shift 0" | |
], | |
"selector": "body"}, | |
{"command": "runmenu:run-all", | |
"keys": [ | |
"Ctrl Shift A" | |
], | |
"selector": "body"}, | |
{"command": "runmenu:restart-and-run-all", | |
"keys": [ | |
"Ctrl Shift N" | |
], | |
"selector": "body"}, | |
{"command": "notebook:run-all-above", | |
"keys": [ | |
"Ctrl Shift Y" | |
], | |
"selector": "body"}, | |
{"command": "notebook:run-all-below", | |
"keys": [ | |
"Ctrl Shift X" | |
], | |
"selector": "body"}, | |
{ | |
"command": "application:activate-next-tab", | |
"keys": [ | |
"Ctrl Shift ]" | |
], | |
"selector": "body", | |
"disabled": true | |
}, | |
{ | |
"command": "application:activate-previous-tab", | |
"keys": [ | |
"Ctrl Shift [" | |
], | |
"selector": "body", | |
"disabled": true | |
}, | |
{ | |
"command": "application:activate-next-tab", | |
"keys": [ | |
"Ctrl Shift L" | |
], | |
"selector": "body" | |
}, | |
{ | |
"command": "application:activate-previous-tab", | |
"keys": [ | |
"Ctrl Shift K" | |
], | |
"selector": "body" | |
}, | |
{ | |
"command": "application:activate-next-tab", | |
"keys": [ | |
"Ctrl Shift ]" | |
], | |
"selector": "body", | |
"disabled": true | |
}, | |
{ | |
"command": "application:activate-previous-tab", | |
"keys": [ | |
"Ctrl Shift [" | |
], | |
"selector": "body", | |
"disabled": true | |
}, | |
{ | |
"command": "application:activate-next-tab", | |
"keys": [ | |
"Ctrl Shift L" | |
], | |
"selector": "body" | |
}, | |
{ | |
"command": "application:activate-previous-tab", | |
"keys": [ | |
"Ctrl Shift K" | |
], | |
"selector": "body" | |
}, ] | |
} |
{ | |
"keys": ["f1"], | |
"command": "dired", | |
"args": { "immediate": true } | |
}, | |
{ | |
"keys": ["ctrl+alt+t"], "command": "terminus_open", "args": { | |
"cwd": "${file_path:${folder}}" | |
} | |
}, | |
{ | |
"keys": ["shift+ctrl+alt+t"], "command": "terminus_open", "args": { | |
"cmd": "ipython", | |
"cwd": "${file_path:${folder}}" | |
} | |
} |
{ | |
"added_words": | |
[ | |
"blockchain", | |
"screenshot", | |
"Hilpisch" | |
], | |
"auto_match_enabled": false, | |
"bold_folder_labels": true, | |
"caret_extra_bottom": 2, | |
"caret_extra_top": 2, | |
"caret_extra_width": 3, | |
"caret_style": "phase", | |
"color_scheme": "Packages/Theme - Cobalt2/cobalt2.tmTheme", | |
"font_size": 16, | |
"highlight_line": true, | |
"highlight_modified_tabs": true, | |
"ignored_packages": | |
[ | |
], | |
"ignored_words": | |
[ | |
"drawdown" | |
], | |
"indent_guide_options": | |
[ | |
"draw_normal", | |
"draw_active" | |
], | |
"line_padding_bottom": 1, | |
"line_padding_top": 1, | |
"rulers": | |
[ | |
80, | |
90 | |
], | |
"spell_check": true, | |
"theme": "Cobalt2.sublime-theme", | |
"wide_caret": true | |
} |
# | |
# This is a first Python test file. | |
# | |
import random | |
rn=[round(random.gauss(0,1), 3) | |
for i in range(20)] | |
print(rn) |
" | |
" This is an example file for: | |
" ~/.vimrc | |
" | |
" It configures some useful features | |
" for Python development and other purposes. | |
" | |
" It is to be saved in user home with name ".vimrc" | |
" i.e. at location "~/.vimrc" | |
" | |
" change "~/.inputrc" to include | |
" set editing-mode vi | |
" | |
" auto-completion for Python files | |
set completeopt=menu,noinsert | |
set complete=k**/*.py | |
" show line numbers | |
set number | |
" set tabs to have 4 spaces | |
set ts=4 | |
" indent when moving to the next line while writing code | |
set autoindent | |
" expand tabs into spaces | |
set expandtab | |
" when using the >> or << commands, shift lines by 4 spaces | |
set shiftwidth=4 | |
" show a visual line under the cursor's current line | |
set cursorline | |
" show the matching part of the pair for [] {} and () | |
set showmatch | |
" enable all Python syntax highlighting features | |
let python_highlight_all = 1 | |
" set register to clipboard | |
set clipboard=unnamed | |
" cursor placement via mouse click | |
set mouse=a | |
" Python formatting specifics | |
set tabstop=8 | |
set softtabstop=4 | |
filetype indent on | |
" Set ruler and line wrap | |
set colorcolumn=80 | |
set textwidth=85 | |
" executing current Python script via | |
" CTRL+x (python) or via CTRL+SHIFT+x (python3) | |
map <C-x> :w<CR>:!python %<CR> | |
map <C-S-x> :w<CR>:!python3 %<CR> | |
" remote terminal arrow keys fix | |
set term=ansi | |
" enable syntax highlighting | |
syntax enable |