powered by
Extract data from Alpha Vantage returned data
av_grep_opts( indta, grepstring = "F,M,call", mindays = 3, startdt = Sys.Date(), deltarange = c(0.1, 0.55) )
A reduced set of options obtained from av_get_pf() using Alphavantage HISTORICAL_OPTIONS function.
av_get_pf()
HISTORICAL_OPTIONS
A data.table as returned by av_get_pf()
(default F,M,call) Three item string to select maturities and option types from indta. Each item is an abbreviated code for what to select.
F,M,call
indta
How far out to go: F for first contract (e.g. front week), B for second/back contract, anything else for all contracts.
F
B
Maturity Schedule: M for monthly contracts, Q for quarterly contract, anythign else for weekly contracts.
M
Q
Option Type: call, put, or all
call
put
all
(default 3). Minimum number of days to expiration to be passed through from startdt
startdt
(default Sys.Date()). Date from which expirations will be considered.
Sys.Date()
(default c(0.1,0.55)) Two number list with minimum and maximum absolute valued deltas to pass through.
c(0.1,0.55)
av_get_pf() returns a large list of options. This function helps to narrow down the list by maturity and moneyness.
if (FALSE) { av_get_pf("IBM","HISTORICAL_OPTIONS") |> av_grep_opts("F,M,put",mindays=2) }
Run the code above in your browser using DataLab