generate_scenarios: Generate scenarios from Black-Scholes model

View source: R/generate_scenarios.R

generate_scenariosR Documentation

Generate scenarios from Black-Scholes model

Description

The generate_scenarios function is used to generate trajectories of stock price from Geometric Brownian Motion.

Usage

generate_scenarios(initial_price, rate, vol, dt = 1/250, initial_time = 0, End_Time = 1, n = 10^5, seed = 219)

Arguments

initial_price

numeric value, initial price of the asset.

rate

numeric value, risk free rate in the model.

vol

numeric value, volatility of the model, vol > 0.

dt

numeric value, represents the number of simulated stock prices in one trajectory.

initial_time

numeric value, start time of the simulations.

End_Time

numeric value, end time of the simulations.

n

numeric value, numbers of trajectory simulations, n is natural number.

seed

numeric value, denotes the seed from which the simulations are drawn, seed is natural number.

Details

generate_scenarios() function generate asset price assumed that stock price are from Black-Scholes model. Next asset price is calculate by iteration:
asset_{i} = asset_{i-1}(1 + rate*dt + vol*Z), where Z is draw from normal distribution with variance dt.

When in parameter rate we take risk free rate of the market, we generate scenarios using equivalent martingale measure.
If in parameter rate we take drift of the model, function generate scenarios in a real measure.

Usually initial_time = 0, if that's not the case we assumed that we are in the course of a lifetime of options, and previous stock price is important (in the case of path-dependent options) initial_time should me equal one of the values in vector c (0, seq(dt, End_Time, dt) ).

1/dt + 1 represent number of changes in stock price in a year. In the default case we assumed dt = 1/250, which represent the average number of trading days.

Value

A numeric matrix, where in columns are different trajectories of asset prices.

Examples

generate_scenarios(100, 0.05, 0.3)
generate_scenarios(100, 0.05, 0.3, n = 10^4)
generate_scenarios(100, 0.05, 0.3, dt = 1/500, initial_time = 0, End_Time = 1, n = 10^5, seed = 219)




mociepa/ShortfallRiskHedging documentation built on Sept. 30, 2022, 6:43 p.m.