# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# # European Option

# ## Introductory Example
#
# The football team is doing particularly well this year, with a major game coming up this weekend on the opponent's campus followed by a home game a week later. The home game ticket has a face price of \$60, but the demand and therefore price for tickets may go up substantially if the team wins this weekend. On the other hand, with a loss and poor weather the ticket price will almost certainly fall below face value.
#
# Let's consider two scenarios:
#
# 1. Demand increases resulting in a ticket price of \$90. We are optimistic this will happen, so assign a probability of 80% to this scenario.
#
# 2. Demand falls resulting in a ticket price of \$40. Since this is the only other scenario we're considering, this has a probability of 20%.
#
# Our concern is that we want to avoid the risk of having to spend \$90 for a ticket. Can we enter into a deal with someone who would take a fixed payment today in return for giving us the option to buy a ticket at face value on game day?
#
# ### Expected Ticket Price
#
# One idea might be to compute the expected price of a ticket, and see if someone will accept the difference between that and face value for the option to buy the ticket on game day.
#
# The expected value of the ticket on game day is
#
# \begin{align*}
# \bar{S} & = E[S] \\
# & = \sum_{n=1}^{N} p_n S_n \\
# & = 0.8 \times $90 + 0.2 \times $40 \\
# & = $72 + $8 \\
# & = $80
# \end{align*}
#
# where the sum is over all of the possible scenarios. The difference \$80 - \$60 = \$20 reflects the difference between the expected future price of the ticket and the current price. Is that a fair value for an option to buy the ticket at face value on game day?
#
# This probabilistic approach assumes there is a counterparty willing to average risk over many football games. The problem is that we don't have a way to assign value to the risk associated with any one game. 
#
# ### Expected Option Value
#
# Can we refine the probabilistic approach? For example, let's consider the actual cost of the option under each scenario. The value of the option is the difference between market and face price on game day. For the first scenario the value is clearly \$90 - \$60 = \$30. For the second scenario, however, the option has no value since a rational person would pay the market price of \$40 rather than the face price of \$60.
#
# Thus the expected value of the option is
#
# \begin{align*}
# E[C] & = 0.8 \times ($90 - $60) + 0.2 \times $0 \\
# & = $24
# \end{align*}
#
# Again, however, the counterparty to this option is undertaking some risk.  80\% of the time the counterparty will need to pay out \$30 for each option which is \$6 more than received. We haven't established how to assign a price for taking that risk, so this approach isn't a satisfactory means of pricing an option.

# ## Replicating Portfolio
#
# An approach to pricing options is to create a portfolio of financial goods that replicates the payoff of the option under all possible outcomes. If we can sucessfully create such a portfolio, then the current value of the replicating portfolio establishes the current value of the option.
#
# We start with the assumption that a call option $C$ will be constructed using $x$ units of an underlying good with price $S$, and $y$ units of cash. The value at the start is
#
# $$C = xS + y$$
#
# There are two scenarios.  In the first scenario the price increases to
#
# \begin{align*}
# C_u & = x u S + y(1+r) \\
# C_d & = x d S + y(1+r)
# \end{align*}
#
# where $r$ is the interest rate on cash over the period of the option. Solving for $x$
#
# $$x = \frac{C_u - C_d}{(u-d)S}$$
#
# Then solving for $y$
#
# $$y = \frac{uC_d - dC_u}{(u-d)(1+r)}$$
#
# Putting these values into the expression for $C$ gives
#
# $$C = \frac{\left[(1+r)-d\right]C_u + \left[u-(1+r)\right]C_d}{(u-d)(1+r)}$$
#
# ### Example
#
# For the example above, $r$ = 0, $u = \frac{3}{2}$, $d = \frac{2}{3}$, $C_u$ = \$30, and $C_d$ = \$0. Plugging in these values
#
# $$xS = \frac{C_u - C_d}{(u-d)} = \frac{$30 - $0}{\frac{3}{2} - \frac{2}{3}} = \frac{6}{5}\times $30 = $36$$
#
# $$y = \frac{\frac{3}{2}\times $0 - \frac{2}{3}\times $30}{\frac{3}{2} - \frac{2}{3}} = 
# - \frac{6}{5}\times\frac{2}{3}\times $30 = -$24$$
#
# So the current value of the option is
#
# $$C = xS + y = $36 - $24 = $12$$
#
# How would this example work in practice?
#
# At the start of the contract, party A offering the option would accept \$12 from the party B buying the option. A would take the \$12, borrow \$24 more and buy the equivalent of 6/10's of a ticket at a cost of $0.6 \times \$60 = \$36.$
#
# On game day there are two possible situations. In the high ticket price scenario, the 6/10's of a ticket would have appreciated to $0.6 \tiems \$90 = \$54$. This provides enough money to pay of the \$30 needed to pay value of the option to B with \$24 left over to pay off the loan. In the low ticket price scenario the option contract has no value.  The 6/10's of a ticket has a value $0.6\times \$40 = \$24$ which covers the loan. So either way, party A can cover all costs from the portfolio consisting of a portion of the ticket and borrowed money.
#
#
#



StarcoderdataJupyterScriptsDedupFiltered