This package provide a way to simulate a fully random stock ticker based on theory provided by "Stochastic Calculus For Finance ii", Shreve"
It returns a data.frame containing the following variables:
| Arguments | Default | Description | |---|---|---| | time_to_maturity | 4 | Final time up to the Stock Price Path goes | | seed | 1 | It fixes initial value of the pseudo random number generation in order to get reproducible experiments. | | scale | 100 | Define the partition of the time period. | | sigma | 1 | |
library(StockPriceSimulator) stock_tick <- sstock()
ggplot2::ggplot(stock_tick, ggplot2::aes(time_periods, stock_price_path)) + ggplot2::geom_point()
It returns a data.frame containing the following variables:
The computed path is based on approximation given by the Itô's formula.
| Arguments | Default | Description | |---|---|---| | time_to_maturity | 4 | Final time up to the Stock Price Path goes | | seed | 1 | It fixes initial value of the pseudo random number generation in order to get reproducible experiments. | | scale | 100 | Define the partition of the time period. | | sigma | 1 | standard deviation of the stock | | alpha | 0 | Mean trend
library(StockPriceSimulator) ## Call the path generating function from equation: stock_tick <- sstock(scale = 1000) ## Call the path generating function from Itôs approximation stock_tick_ito <- sstock_ito(scale = 1000)
ggplot2::ggplot(stock_tick, ggplot2::aes(time_periods, stock_price_path)) + ggplot2::geom_point(color = 'pink') + ggplot2::geom_line(data = stock_tick_ito, ggplot2::aes(time_periods, stock_price_path), color = 'steelblue')
Delta return the position one should take in order to hedge a short position in a call.
# Create a stoch price motion from 0 to 4(Year) with a daily step S <- sstock(initial_stock_price = 50, time_to_maturity = 4, scale = 360) # According to the previous sampled path, the option price is computed # With option in the money C <- BSM(stock_path = S)
```{R echo=FALSE} ggplot2::ggplot(S, ggplot2::aes(time_periods, stock_price_path)) + ggplot2::geom_point()
```{R echo=FALSE} ggplot2::ggplot(C, ggplot2::aes(time_periods, option_price_path)) + ggplot2::geom_point()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.