Derivative Securities
Derivatives are financial instruments based on the value of other assets like commodities, stocks, or market indexes. Options are a type of derivative that uses stock as its underlying asset. They are contractual agreements giving the buyer the right, but not the obligation, to execute a transaction at a later date.
Options contracts
Options contracts are financial instruments that give the holder the right to buy or sell an asset at a predetermined price on or before a specific date. The two main types of options are call options and put options.
- Call options give the holder the right to buy an asset at a predetermined price on or before the expiration date.
- Put options give the holder the right to sell an asset at a predetermined price on or before the expiration date.
European option contracts
European options are contracts that give the holder the right to buy or sell an asset at a predetermined price on the expiration date.
VLQuantitativeFinancePackage.MyEuropeanCallContractModel
— Typemutable struct MyEuropeanCallContractModel <: AbstractContractModel
The MyEuropeanCallContractModel
mutable struct represents a European call option contract. A call
option is a financial contract that gives the holder the right, but not the obligation, to buy an asset at a specified price (the strike price) within a specified time period. For European options, the contract can only be exercised by the buyer at the expiration date.
Required fields
K::Float64
: The strike price of the option.
Optional fields
sense::Union{Nothing, Int64}
: The sense of the option. A value of1
indicates a long position, and a value of-1
indicates a short position.DTE::Union{Nothing,Float64}
: The days to expiration of the option (measured in units of years).IV::Union{Nothing, Float64}
: The implied volatility of the option contract.premium::Union{Nothing, Float64}
: The premium of the option contract. This is the price paid to the seller by the buyer for the option contract.ticker::Union{Nothing,String}
: The ticker symbol of the underlying asset.copy::Union{Nothing, Int64}
: Number of contracts purchased or sold.
VLQuantitativeFinancePackage.MyEuropeanPutContractModel
— Typemutable struct MyEuropeanPutContractModel <: AbstractContractModel
The MyEuropeanPutContractModel
mutable struct represents a European put option contract. A put
option is a financial contract that gives the holder the right, but not the obligation, to sell an asset at a specified price (the strike price) within a specified time period. For European options, the contract can only be exercised by the buyer at the expiration date.
Required fields
K::Float64
: The strike price of the option.
Optional fields
sense::Union{Nothing, Int64}
: The sense of the option. A value of1
indicates a long position, and a value of-1
indicates a short position.DTE::Union{Nothing,Float64}
: The days to expiration of the option (measured in units of years).IV::Union{Nothing, Float64}
: The implied volatility of the option contract.premium::Union{Nothing, Float64}
: The premium of the option contract. This is the price paid to the seller by the buyer for the option contract.ticker::Union{Nothing,String}
: The ticker symbol of the underlying asset.copy::Union{Nothing, Int64}
: Number of contracts purchased or sold.
VLQuantitativeFinancePackage.build
— Methodfunction build(model::Type{MyEuropeanCallContractModel}, data::NamedTuple) -> MyEuropeanCallContractModel
This build
method constructs an instance of the MyEuropeanCallContractModel
type using the data in a NamedTuple.
Arguments
model::Type{MyEuropeanCallContractModel}
: The type of model to build.data::NamedTuple
: The data to use to build the model.
The data::NamedTuple
must contain the following keys
:
K::Float64
: The strike price of the contract.
The other fields of the MyEuropeanCallContractModel
model are set to nothing
by default. These optional fields can be updated by the user after the model is built, or by passing the values in the data::NamedTuple
argument.
VLQuantitativeFinancePackage.build
— Methodfunction build(model::Type{MyEuropeanPutContractModel}, data::NamedTuple) -> MyEuropeanPutContractModel
This build
method constructs an instance of the MyEuropeanPutContractModel
type using the data in a NamedTuple.
Arguments
model::Type{MyEuropeanPutContractModel}
: The type of model to build.data::NamedTuple
: The data to use to build the model.
The data::NamedTuple
must contain the following keys
:
K::Float64
: The strike price of the contract.
The other fields of the MyEuropeanPutContractModel
model are set to nothing
by default. These optional fields can be updated by the user after the model is built, or by passing the values in the data::NamedTuple
argument.
American option contracts
American options are contracts that give the holder the right to buy or sell an asset at a predetermined price at any time before the expiration date.
VLQuantitativeFinancePackage.MyAmericanCallContractModel
— Typemutable struct MyAmericanCallContractModel <: AbstractContractModel
The MyAmericanCallContractModel
mutable struct represents an American call option contract. An American call
option is a financial contract that gives the holder the right, but not the obligation, to buy an asset at a specified price (the strike price). American option contracts can be exercised at any time on or before the expiration date.
Required fields
K::Float64
: The strike price of the option.
Optional fields
sense::Union{Nothing, Int64}
: The sense of the option. A value of1
indicates a long position, and a value of-1
indicates a short position.DTE::Union{Nothing,Float64}
: The days to expiration of the option (measured in units of years).IV::Union{Nothing, Float64}
: The implied volatility of the option contract.premium::Union{Nothing, Float64}
: The premium of the option contract. This is the price paid to the seller by the buyer for the option contract.ticker::Union{Nothing,String}
: The ticker symbol of the underlying asset.copy::Union{Nothing, Int64}
: Number of contracts purchased or sold.
VLQuantitativeFinancePackage.MyAmericanPutContractModel
— Typemutable struct MyAmericanPutContractModel <: AbstractContractModel
The MyAmericanPutContractModel
mutable struct represents an American put option contract. A put
option is a financial contract that gives the holder the right, but not the obligation, to sell an asset at a specified price (the strike price). For American options, the contract can be exercised at any time on or before the expiration date.
Required fields
K::Float64
: The strike price of the option.
Optional fields
sense::Union{Nothing, Int64}
: The sense of the option. A value of1
indicates a long position, and a value of-1
indicates a short position.DTE::Union{Nothing,Float64}
: The days to expiration of the option (measured in units of years).IV::Union{Nothing, Float64}
: The implied volatility of the option contract.premium::Union{Nothing, Float64}
: The premium of the option contract. This is the price paid to the seller by the buyer for the option contract.ticker::Union{Nothing,String}
: The ticker symbol of the underlying asset.copy::Union{Nothing, Int64}
: Number of contracts purchased or sold.
VLQuantitativeFinancePackage.build
— Methodfunction build(model::Type{MyAmericanCallContractModel}, data::NamedTuple) -> MyAmericanCallContractModel
This build
method constructs an instance of the MyAmericanCallContractModel
type using the data in a NamedTuple.
Arguments
model::Type{MyAmericanCallContractModel}
: The type of model to build.data::NamedTuple
: The data to use to build the model.
The data::NamedTuple
must contain the following keys
:
K::Float64
: The strike price of the contract.
The other fields of the MyAmericanCallContractModel
model are set to nothing
by default. These optional fields can be updated by the user after the model is built, or by passing the values in the data::NamedTuple
argument.
VLQuantitativeFinancePackage.build
— Methodfunction build(model::Type{MyAmericanPutContractModel}, data::NamedTuple) -> MyAmericanPutContractModel
This build
method constructs an instance of the MyAmericanPutContractModel
type using the data in a NamedTuple.
Arguments
model::Type{MyAmericanPutContractModel}
: The type of model to build.data::NamedTuple
: The data to use to build the model.
The data::NamedTuple
must contain the following keys
:
K::Float64
: The strike price of the contract.
The other fields of the MyAmericanPutContractModel
model are set to nothing
by default. These optional fields can be updated by the user after the model is built, or by passing the values in the data::NamedTuple
argument.
Contracts at expiration
VLQuantitativeFinancePackage.payoff
— Functionpayoff(contracts::Array{T,1}, S::Array{Float64,1}) -> Array{Float64,2} where T <: AbstractContractModel
The payoff
function computes the payoff for a set of option contracts at expiration given the underlying prices contained in the S::Array{Float64,1}
array.
Arguments
contracts::Array{T,1}
: An array of option contracts whereT
is a subtype of theAbstractContractModel
type.S::Array{Float64,1}
: An array of underlying prices.
Returns
Array{Float64,2}
: A matrix of size(number_of_underlying_prices, number_of_contracts + 2)
where each row represents an underlying price and each column containts the payoff for each contract.
The first column contains the underlying price, the second column contains the payoff for the first contract, the third column contains the payoff for the second contract, and so on. The last column contains the sum of the payoffs for all contracts.
VLQuantitativeFinancePackage.profit
— Functionprofit(contracts::Array{T,1}, S::Array{Float64,1}) -> Array{Float64,2} where T <: AbstractContractModel
The profit
function computes the profit for a set of option contracts at expiration given the underlying prices contained in the S::Array{Float64,1}
array. This function requires the contracts to have the premium
field set on each contract model.
Arguments
contracts::Array{T,1}
: An array of option contracts whereT
is a subtype of theAbstractContractModel
type. Each contract must have thepremium
field set.S::Array{Float64,1}
: An array of underlying prices at expiration.
Returns
Array{Float64,2}
: A matrix of size(number_of_underlying_prices, number_of_contracts + 2)
where each row represents an underlying price and each column containts the profit for a contract.
The first column contains the underlying price, the second column contains the profit for the first contract, the third column contains the profit for the second contract, and so on. The last column contains the sum of the profits for all contracts.
European contract premiums
European options are the simplest type of options to price because they can only be exercised on the expiration date. There are many methods to compute the premium of an options contract, but the most widely used method (by far) is the Black-Scholes-Merton (BSM) model (and its extensions). The BSM model has a closed-form solution, i.e., a mathematical expression that can be evaluated directly. Thus, it is computationally efficient. Alternatively, the premium of an options contract can be computed using numerical methods, such as binomial trees or Monte Carlo simulation.
Black-Scholes model
The Black-Scholes-Merton model is used to compute the premium of European-style options contracts \cite{BlackScholes1973}; Robert C. Merton, Myron S. Scholes, and Fischer Black won the Nobel Prize in Economics in 1997 for their work on this model. The model assumes that the underlying asset's price follows a geometric Brownian motion with constant drift and volatility, where the drift is the risk-free interest rate, i.e., we evaluate the option using a risk-neutral pricing paradigm. Further, the model assumes that the risk-free interest rate is constant and that the underlying stock does not pay dividends (although the model can be modified to include dividends). Under these assumptions, the price of the option can be computed using the Black-Scholes-Merton pricing formula, which is the parabolic partial differential equation:
\[\begin{aligned} \frac{\partial{V}}{\partial{t}} + \frac{1}{2}\sigma^{2}S^{2}\frac{\partial^{2}V}{\partial{S}^{2}} + \bar{r}S\frac{\partial{V}}{\partial{S}} &= \bar{r}V \\ \frac{dS}{S} &= \bar{r}\,dt + \sigma\,{dW}\\ V(T,S) &= K(S) \end{aligned}\]
where $V(t, S)$ is the price of the option, $S$ is the price of the underlying asset (governed by the risk-neutral geometric Brownian motion model), $K(S)$ is the payoff of the option at expiration, $T$ is the expiration date, $t$ is time, $\bar{r}$ is the risk-free interest rate, and $\sigma$ is the volatility of the underlying asset. $t$ is time, $r$ is the risk-free interest rate, and $\sigma$ is the volatility of the underlying asset. While we could solve the partial differential equation directly, it is more common to use the closed-form solution of the Black-Scholes-Merton pricing formula.
We implement the Black-Scholes-Merton model in the MyBlackScholesContractPricingModel
type, which is used to compute the premium of European options contracts.
VLQuantitativeFinancePackage.MyBlackScholesContractPricingModel
— Typemutable struct MyBlackScholesContractPricingModel <: AbstractAssetModel
The MyBlackScholesContractPricingModel
mutable struct represents a Black-Scholes model for pricing European option contracts.
Required fields
r::Float64
: The annual risk-free discount rateSₒ::Float64
: The current price of the underlying asset
European call options
The Black-Scholes-Merton pricing formula for a European call option is given by the expression:
\[\begin{equation} \mathcal{P}_{c}(K,S(0)) = N(d_{+})S(0) - N(d_{-})K\mathcal{D}^{-1}_{T,0}(\bar{r}) \end{equation}\]
where $N(\dots)$ denotes the standard normal cumulative distribution function, $S(0)$ is the price of the underlying asset at time $t=0$ (when we are evaluating the option), $K$ is the strike price of the contract, and $\mathcal{D}^{-1}_{T,0}(\bar{r})$ is the discount factor from time $t=0$ to time $T$ evaluated at the risk-free interest rate $\bar{r}$. The arguments of the normal cumulative distribution function are given by:
\[\begin{aligned} d_{+} &= \frac{1}{\sigma\sqrt{T}}\left[\ln(\frac{S_{\circ}}{K}) + (\bar{r}+\frac{\sigma^{2}}{2})T\right] \\ d_{-} &= d_{+} - \sigma\sqrt{T} \end{aligned}\]
We implement the Black-Scholes-Merton pricing formula for European call using the premium
function, which takes a MyEuropeanCallContractModel
and a MyBlackScholesContractPricingModel
instance as input arguments. The function returns the premium of the contract.
VLQuantitativeFinancePackage.premium
— Methodfunction premium(contract::MyEuropeanCallContractModel, model::MyBlackScholesContractPricingModel; sigdigits::Int64 = 4)
The premium
function computes the premium for a European call option contract using the Black-Scholes-Merton model. This function requires the contract to have the K
, DTE
, and IV
fields set on the contract model, and the Sₒ
and r
fields set on the pricing model::MyBlackScholesContractPricingModel
instance.
Arguments
contract::MyEuropeanCallContractModel
: An instance of the MyEuropeanCallContractModel type which models the European call option contract.model::MyBlackScholesContractPricingModel
: An instance of the MyBlackScholesContractPricingModel type which models the Black-Scholes-Merton model calculation.
Returns
Float64
: The premium for the European call option contract.
European put options
The Black-Scholes-Merton pricing formula for a European put option is given by the expression:
\[\mathcal{P}_{p}(K,S(0)) = N(-d_{-})\cdot{K}\cdot\mathcal{D}^{-1}_{T,0}(\bar{r}) - N(-d_{+})\cdot{S}(0)\]
where $N(\dots)$ denotes the standard normal cumulative distribution function, $S(0)$ is the price of the underlying asset at time $t=0$ (when we are evaluating the option), $K$ is the strike price of the contract, and $\mathcal{D}^{-1}_{T,0}(\bar{r})$ is the discount factor from time $t=0$ to time $T$ evaluated at the risk-free interest rate $\bar{r}$. The arguments of the normal cumulative distribution function are given by:
\[\begin{aligned} d_{+} &= \frac{1}{\sigma\sqrt{T}}\left[\ln(\frac{S_{\circ}}{K}) + (\bar{r}+\frac{\sigma^{2}}{2})T\right] \\ d_{-} &= d_{+} - \sigma\sqrt{T} \end{aligned}\]
We implement the Black-Scholes-Merton pricing formula for European put using the premium
function, which takes a MyEuropeanPutContractModel
and a MyBlackScholesContractPricingModel
instance as input arguments. The function returns the premium of the contract.
VLQuantitativeFinancePackage.premium
— Methodfunction premium(contract::MyEuropeanPutContractModel,
model::MyBlackScholesContractPricingModel; sigdigits::Int64 = 4) -> Float64
The premium
function computes the premium for a European put option contract using the Black-Scholes-Merton model. This function requires the contract to have the K
, DTE
, and IV
fields set on the contract model, and the Sₒ
and r
fields set on the pricing model::MyBlackScholesContractPricingModel
instance.
Arguments
contract::MyEuropeanPutContractModel
: An instance of theMyEuropeanPutContractModel
type which models the European put option contract.model::MyBlackScholesContractPricingModel
: An instance of theMyBlackScholesContractPricingModel
type which models the Black-Scholes-Merton model calculation.
Returns
Float64
: The premium for the European put option contract.
American contract premiums
Finding the premium for American options is more complex than for European options because the holder can exercise the option at any time before the expiration date. The premium can be calculated using the binomial pricing model, or other more complex models like the trinomial tree model or monte carlo simulation approaches.
Binomial pricing model
The binomial pricing model is a popular method for pricing American options. It uses a binomial tree to model the price of the underlying asset over time. The tree is constructed by moving up and down at each step, representing the price of the underlying asset increasing or decreasing. The premium is calculated by working backward from the expiration date to the present date, calculating the premium at each node and discounting it back to the present date.
VLQuantitativeFinancePackage.MyAdjacencyBasedCRREquityPriceTree
— Typemutable struct MyAdjacencyBasedCRREquityPriceTree <: AbstractEquityPriceTreeModel
The MyAdjacencyBasedCRREquityPriceTree
mutable struct represents a Cox-Ross-Rubinstein (CRR) model for pricing American style option contracts. The lattice is constructed using an adjacency list to represent the connectivity of the nodes in the lattice. The lattice is populated using the populate
function, and the contract pricing is performed using the premium
function.
Required fields
μ::Float64
: The drift rate of the asset priceσ::Float64
: The volatility of the asset priceT::Float64
: The time to expiration of the option contract (measured in units of years)
Optional or computed fields
ΔT::Union{Nothing,Float64}
: The time step sizeu::Union{Nothing,Float64}
: The up-factor for the latticed::Union{Nothing,Float64}
: The down-factor for the latticep::Union{Nothing,Float64}
: The probability of an up move in the latticedata::Union{Nothing, Dict{Int, MyCRRLatticeNodeModel}}
: A dictionary that holds the lattice data for each node where nodes are modeled asMyCRRLatticeNodeModel
instances.connectivity::Union{Nothing, Dict{Int64, Array{Int64,1}}}
: A dictionary that holds the connectivity of the lattice where thekey
is the node index and thevalue
is an array of the connected nodes.levels::Union{Nothing, Dict{Int64,Array{Int64,1}}}
: A dictionary that holds the nodes on each level of the lattice where thekey
is the level index and thevalue
is an array of the nodes on that level.
The optional
fields are computed when the lattice is passed to the populate
function.
VLQuantitativeFinancePackage.MyCRRLatticeNodeModel
— Typemutable struct MyCRRLatticeNodeModel
The MyCRRLatticeNodeModel
mutable struct represents a node in a Cox-Ross-Rubinstein (CRR) model for pricing American style option contracts.
Required fields
price::Float64
: The price of the price at the nodeprobability::Float64
: The probability of reaching the node
Optional or computed fields
intrinsic::Union{Nothing,Float64}
: The intrinsic value of the option contract at the nodeextrinsic::Union{Nothing,Float64}
: The extrinsic value of the option contract at the node
VLQuantitativeFinancePackage.build
— Methodfunction build(model::Type{MyAdjacencyBasedCRREquityPriceTree}, data::NamedTuple) -> MyAdjacencyBasedCRREquityPriceTree
This build
method constructs an instance of the MyAdjacencyBasedCRREquityPriceTree
type using the data in a NamedTuple.
Arguments
model::Type{MyAdjacencyBasedCRREquityPriceTree}
: The type of model to build.data::NamedTuple
: The data to use to build the model.
The data::NamedTuple
must contain the following keys
:
μ::Float64
: The drift rate of the asset price. For a risk-neutral measure, this is the risk-free rate.σ::Float64
: The volatility of the asset price. This is the implied volatility for a risk-neutral measure.T::Float64
: The time to expiration of the option contract (measured in units of years)
VLQuantitativeFinancePackage.populate
— Methodfunction populate(model::MyAdjacencyBasedCRREquityPriceTree;
Sₒ::Float64 = 100.0, h::Int64 = 1)
The populate
function initializes the MyAdjacencyBasedCRREquityPriceTree
model with share prices and probabilities for each node in the lattice. In addition, this methods sets the intrinsic and extrinsic values of each node to 0.0
and computes the connectivity and levels of the lattice.
Arguments
model::MyAdjacencyBasedCRREquityPriceTree
: An instance of theMyAdjacencyBasedCRREquityPriceTree
type.Sₒ::Float64 = 100.0
: The initial price of the equity.h::Int64 = 1
: The number of time steps in the lattice (the height of the binomial price tree).
Returns
MyAdjacencyBasedCRREquityPriceTree
: An updated instance of theMyAdjacencyBasedCRREquityPriceTree
type with the share prices and probabilities computed for each node in the lattice.
VLQuantitativeFinancePackage.premium
— Functionpremium(contract::T, model::MyAdjacencyBasedCRREquityPriceTree;
choice::Function=_rational, sigdigits::Int64 = 4) -> Float64 where {T<:AbstractContractModel}
Computes the premium for an American style option contract using the Cox-Ross-Rubinstein model.
Arguments
contract::T
: An instance of theAbstractContractModel
type which models the option contract.model::MyAdjacencyBasedCRREquityPriceTree
: An instance of the MyAdjacencyBasedCRREquityPriceTree type which models the Cox-Ross-Rubinstein model.choice::Function=_rational
: A function that determines the choice of the option contract. Default value is_rational
.sigdigits::Int64 = 4
: The number of significant digits to round the premium to. Default value is4
.
Returns
Float64
: The premium for the American style option contract.
function premium(contract::MyEuropeanCallContractModel, model::MyBlackScholesContractPricingModel; sigdigits::Int64 = 4)
The premium
function computes the premium for a European call option contract using the Black-Scholes-Merton model. This function requires the contract to have the K
, DTE
, and IV
fields set on the contract model, and the Sₒ
and r
fields set on the pricing model::MyBlackScholesContractPricingModel
instance.
Arguments
contract::MyEuropeanCallContractModel
: An instance of the MyEuropeanCallContractModel type which models the European call option contract.model::MyBlackScholesContractPricingModel
: An instance of the MyBlackScholesContractPricingModel type which models the Black-Scholes-Merton model calculation.
Returns
Float64
: The premium for the European call option contract.
function premium(contract::MyEuropeanPutContractModel,
model::MyBlackScholesContractPricingModel; sigdigits::Int64 = 4) -> Float64
The premium
function computes the premium for a European put option contract using the Black-Scholes-Merton model. This function requires the contract to have the K
, DTE
, and IV
fields set on the contract model, and the Sₒ
and r
fields set on the pricing model::MyBlackScholesContractPricingModel
instance.
Arguments
contract::MyEuropeanPutContractModel
: An instance of theMyEuropeanPutContractModel
type which models the European put option contract.model::MyBlackScholesContractPricingModel
: An instance of theMyBlackScholesContractPricingModel
type which models the Black-Scholes-Merton model calculation.
Returns
Float64
: The premium for the European put option contract.
Implied volatility
The implied volatility of an option is the volatility value that makes the theoretical option price equal to the market price. It is a measure of the market's expectation of the future volatility of the underlying asset. The implied volatility can be calculated using the Black-Scholes model or by fitting the binomial pricing model to the market price.
VLQuantitativeFinancePackage.estimate_implied_volatility
— Functionestimate_implied_volatility(contract::T; Sₒ::Float64 = 100.0, h::Int64 = 1, r̄::Float64 = 0.05) -> Tuple{Float64,Float64} where {T<:AbstractContractModel}
The estimate_implied_volatility
function estimates the implied volatility for a given contract using the Nelder-Mead optimization algorithm.
Arguments
contract::T
: An instance of a contract model that defines the contract parameters, whereT
is a subtype of theAbstractContractModel
type.Sₒ::Float64
: The initial stock price used to compute the premium. The default value is100.0
.h::Int64
: The height of the lattice model used to compute the premium. The default value is1
.r̄::Float64
: The annual risk-free rate used to compute the premium. The default value is0.05
.
Returns
Tuple{Float64,Float64}
: The likelihood and estimated implied volatility for the given contract.
See:
- We use the Nelder-Mead optimization algorithm from the Optim.jl package to estimate the implied volatility.
The Greeks
The Greeks quantify the sensitivity of an option's premium to various factors. Delta
, theta
, vega
, rho
and gamma
are the most widely used Greeks, measuring an option's sensitivity to changes in the underlying asset's share price, the time decay, implied volatility, the risk-free rate and the rate of change in delta, respectively.
VLQuantitativeFinancePackage.delta
— Functionfunction delta(contract::Y; h::Int64=2, T::Float64=(1 / 365), σ::Float64=0.15,
Sₒ::Float64=1.0, μ::Float64=0.0015, choice::Function=_rational)::Float64 where {Y<:AbstractContractModel}
Compute the delta
of a contract using the Cox-Ross-Rubinstein binomial tree method. Delta
measures the change in the options premium for a 1 USD/share
change in the underlying price, and is defined as:
\[\Delta(\star) = \frac{\partial\mathcal{P}}{\partial{S}}\Bigr|_{\star}\]
where $\star$ is the current state of the system, i.e., the current underlying price, time to maturity, implied volatility, and risk-free rate.
Arguments
contract::Y
: The contract model for which we compute the delta whereY
is a subtype ofAbstractContractModel
.h::Int64=2
: The number of levels in the binomial tree.T::Float64 = (1 / 365)
: The time to maturity for the options contract measured in years, assume a 365-day year.σ::Float64 = 0.15
: The implied volatility (IV) for the options contractSₒ::Float64 = 1.0
: Initial share price of the underlying at the time contract was purchasedμ::Float64 = 0.0015
: Single-step growth rate. Equals the risk-free rate for risk-neutral options evaluation
Return
Δ::Float64
: The delta value for this option contract
See also:
VLQuantitativeFinancePackage.theta
— Functionfunction theta(contract::Y; h::Int64=2, T::Float64=(1 / 365), σ::Float64=0.15,
Sₒ::Float64=1.0, μ::Float64=0.0015, choice::Function=_rational) -> Float64 where {Y<:AbstractContractModel}
Compute the theta
of a contract using the Cox-Ross-Rubinstein binomial tree method. Theta
measures the rate of change in the options premium for a 1 day
change in the time to maturity, and is defined as:
\[\theta(\star) = \frac{\partial\mathcal{P}}{\partial{T}}\Bigr|_{\star}\]
where $\star$ is the current state of the system, i.e., the current underlying price, time to maturity, implied volatility, and risk-free rate.
Arguments
contract::Y
: The contract model for which we compute thetheta
whereY
is a subtype ofAbstractContractModel
.h::Int64=2
: The number of levels in the binomial tree.T::Float64 = (1/365)
: The time to maturity for the options contract measured in years assuming a 365-day year.σ::Float64 = 0.15
: The implied volatility (IV) for the options contractSₒ::Float64 = 1.0
: Initial share price of the underlying at the time contract was purchasedμ::Float64 = 0.0015
: Single-step growth rate. Equals the risk-free rate for risk-neutral options evaluation
Return
Θ::Float64
: Thetheta
value for this option contract
See also:
VLQuantitativeFinancePackage.vega
— Functionfunction vega(contract::Y; h::Int64=2, T::Float64=(1 / 365), σ::Float64=0.15,
Sₒ::Float64=1.0, μ::Float64=0.0015, choice::Function=_rational) -> Float64 where {Y<:AbstractContractModel}
Compute the vega
of a contract using the Cox-Ross-Rubinstein binomial tree method. Vega
measures the rate of change in the options premium for a 1%
change in the implied volatility, and is defined as:
\[V(\star) = \frac{\partial\mathcal{P}}{\partial{\sigma}}\Bigr|_{\star}\]
where $\star$ is the current state of the system, i.e., the current underlying price, time to maturity, implied volatility, and risk-free rate.
Arguments
contract::Y
: The contract model for which we compute the delta whereY
is a subtype ofAbstractContractModel
.h::Int64=2
: The number of levels in the binomial tree.T::Float64 = (1 / 365)
: The time to maturity for the options contract measured in years, assume a 365-day year.σ::Float64 = 0.15
: The implied volatility (IV) for the options contractSₒ::Float64 = 1.0
: Initial share price of the underlying at the time contract was purchasedμ::Float64 = 0.0015
: Single-step growth rate. Equals the risk-free rate for risk-neutral options evaluation
Return
V::Float64
: Thevega
value for this option contract
See also:
VLQuantitativeFinancePackage.rho
— Functionfunction rho(contract::Y; h::Int64=2, T::Float64=(1 / 365), σ::Float64=0.15,
Sₒ::Float64=1.0, μ::Float64=0.0015, choice::Function=_rational) -> Float64 where {Y<:AbstractContractModel}
Compute the rho
of a contract using the Cox-Ross-Rubinstein binomial tree method. Rho
measures the rate of change in the options premium for a 1%
change in the risk-free rate $r_f$, and is defined as:
\[\text{rho}(\star) = \frac{\partial\mathcal{P}}{\partial{r_{f}}}\Bigr|_{\star}\]
where $\star$ is the current state of the system, i.e., the current underlying price, time to maturity, implied volatility, and risk-free rate.
Arguments
contract::Y
: The contract model for which we compute the delta whereY
is a subtype ofAbstractContractModel
.h::Int64=2
: The number of levels in the binomial tree.T::Float64 = (1 / 365)
: The time to maturity for the options contract measured in years, assume a 365-day year.σ::Float64 = 0.15
: The implied volatility (IV) for the options contractSₒ::Float64 = 1.0
: Initial share price of the underlying at the time contract was purchasedμ::Float64 = 0.0015
: Single-step growth rate. Equals the risk-free rate for risk-neutral options evaluation
Return
V::Float64
: Thevega
value for this option contract
See also:
VLQuantitativeFinancePackage.gamma
— Functionfunction gamma(contract::Y; h::Int64=2, T::Float64=(1 / 365), σ::Float64=0.15,
Sₒ::Float64=1.0, μ::Float64=0.0015, choice::Function=_rational) -> Float64 where {Y<:AbstractContractModel}
Compute the gamma
of a contract using the Cox-Ross-Rubinstein binomial tree method. Gamma measures the rate of change in the delta
for a 1 USD/share
change in the underlying price, and is defined as:
\[\Gamma(\star) = \frac{\partial^2\mathcal{P}}{\partial{S}^2}\Bigr|_{\star}\]
where $\star$ is the current state of the system, i.e., the current underlying price, time to maturity, implied volatility, and risk-free rate.
Arguments
contract::Y
: The contract model for which we compute the delta whereY
is a subtype ofAbstractContractModel
.h::Int64=2
: The number of levels in the binomial tree.T::Float64 = (1 / 365)
: The time to maturity for the options contract measured in years, assume a 365-day year.σ::Float64 = 0.15
: The implied volatility (IV) for the options contractSₒ::Float64 = 1.0
: Initial share price of the underlying at the time contract was purchasedμ::Float64 = 0.0015
: Single-step growth rate. Equals the risk-free rate for risk-neutral options evaluation
Return
Γ::Float64
: The gamma value for this option contract
See also: