wheel_visualizer: Visualize Options with the Best Return on Risk

Description Usage Arguments Value Examples

View source: R/wheel_visualizer.R

Description

This function will create a histogram plot for the resulting data frame from the wheel_extractor() function.

Usage

1
2
3
4
5
wheel_visualizer(
  data = NULL,
  visualization_type = "ggplot_histogram",
  include_in_the_money = FALSE
)

Arguments

data

A resulting data frame object from wheel_extractor() function.

visualization_type

Currently only support ggplot2's ggplot_histogram.

include_in_the_money

The Wheel generally employs on OTM options. But the data frame also includes ITM.

Value

Ggplot2 histogram chart.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
#First let's create sample data frame
sample <- data.frame(
     strikePrice = c(50, 60, 70, 80),
     inTheMoney = c(FALSE, FALSE, FALSE, TRUE),
     ticker = c('AAPL', 'AAPL', 'TSLA', 'TSLA'),
     prob_otm = c(0.3, 0.4, 0.3, 0.4),
     cash_inflow = c(250, 400, 115, 220),
     invested_capital = c(5000, 6000, 7000, 8000),
     return_on_risk = c(0.05, 0.07, 0.02, 0.03)
)

#Then use the function
wheel_visualizer(data = sample)

pohnson/ROptionsStrategies documentation built on Dec. 22, 2021, 8:51 a.m.