wheel_extractor: Find the Best Options for The Wheel Strategy

Description Usage Arguments Value References See Also Examples

View source: R/wheel_extractor.R

Description

Create a data frame with options information to determine what options is the best for short put also known as "The Wheel" strategy

Usage

1
2
3
4
5
6
wheel_extractor(
  ticker = c("AAPL", "GOOG"),
  expiration_date = Sys.Date(),
  consumer_key = NULL,
  sleep_second = 1
)

Arguments

ticker

stock ticker

expiration_date

an option expiration date

consumer_key

Consumer Key from TDAmeritrade Developer

sleep_second

Sleep in second before making a new API call

Value

A data frame object with 10 columns: bid, delta, strikePrice, inTheMoney, ticker, prob_otm, cast_inflow, invested_capital, return_on_risk, and expiration_date. You can inspect the result by yourself or use wheel_visualizer().

References

If you haven't created a free TDAmeritrde API Key, please follow steps from this website https://www.reddit.com/r/algotrading/comments/c81vzq/td_ameritrade_api_access_2019_guide/

See Also

Execute ?wheel_visualizer() on how to visualize the resulting data frame

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#You want to know what strike price from AAPL, AMZN, and TSLA whose
#expiration date is Dec 31, 2021 has the highest return on risk.
#You'd input the parameters as follows:

#result <- wheel_extractor(
#      ticker = c('AAPL', 'AMZN', 'TSLA'),
#      expiration_date = '2021-12-31',
#      consumer_key = 'Your TDA API Key',
#      sleep_second = 1 #or 0 if you want
# )

#If you have many stocks that you want to know you can simply create a data frame and use $.

###### First create a data frame #####
candidates <- data.frame(ticker = c('AAPL', 'AMZN', 'TSLA', 'GOOG'))

###### Then use $ #####
#result <- wheel_extractor(
#      ticker = candidates$ticker
#      expiration_date = '2021-12-31',
#      consumer_key = 'xxx',
#      sleep_second = 1 #or 0 if you want
# )

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