Skip to contents

Calls tidyquant::tq_get() to get dividends for a given set of tickers. A previously created data.frame can also be input.

Created event_ds from alphavantagepf::av_get_pf quarterly earnings data.

Usage

fg_ratingsEvents(credit, ratings_db, agency = "S.P")

fg_tq_divs(tickers, divs_ds = NULL, ticker_in_label = TRUE)

fg_av_earnings(indt, field = "reportedEPS", ticker_in_label = FALSE)

Arguments

credit

String with name of credit to look up in 'ratings_db'

ratings_db

A 'data.table' or 'data.frame' with the all of the following columns:

columndescriptiontype
CREDITName of creditcharacter
AGENCYName of ratings agencycharacter
RATINGRating assignedcharacter
WATCHWatch denoted by anything with "+" or "-" in the stringcharacter
DT_ENTRYDate which ratings or ratings change was issuedDate
agency

String (default 'S.P') with 'AGENCY to look up in 'ratings_db'

tickers

List of tickers to get dividends for.

divs_ds

Alternatively a data.frame previously obtained using tidyquant::tq_get() with columns (symbol,date,value)

ticker_in_label

(Default: TRUE) Make label ticker and the earnings

indt

data.frame obtained from alphavantage earnings data.

field

(Default: reportedEPS) String in (reportedEPS,estimatedEPS,surprise,surprisePercentage)

Value

data.table suitable for passing into fgts_dygraph() via the event_ds parameter

data.table suitable for passing into fgts_dygraph() via the event_ds parameter

data.table suitable for passing into fgts_dygraph() via the event_ds parameter

Details

Investment grade ratings are shaded in blue, High Yield are in red. Darker areas are closest to the cutoff between the two.

Examples

data("nomfxdta")
copdta <- nomfxdta |> dplyr::filter(variable=="COP")
fgts_dygraph(copdta,title="COP with Ratings",dtstartfrac=0.3,
        event_ds=fg_ratingsEvents("COLOM",ratings_db,agency="S.P"))
if (requireNamespace("tidyquant", quietly = TRUE)) { fgts_dygraph(eqtypx,title="With divs",dtstartfrac=0.8,event_ds=fg_tq_divs(c("IBM","QQQ"))) }
if (requireNamespace("alphavantagepf", quietly = TRUE)) { earnings = alphavantagepf::av_get_pf("IBM","EARNINGS") |> alphavantagepf::av_extract_df("quarterlyEarnings") |> fg_av_earnings() toplot = dplyr::select(eqtypx,date,IBM) fgts_dygraph(toplot,title="With earnings",dtstartfrac=0.8,event_ds=earnings) }