├── DESCRIPTION
├── LICENSE
├── NAMESPACE
├── R
├── data_gurufocus.R
├── data_nasdaq100.R
├── data_sp500.R
├── get_altman_z.R
├── get_asset_turnover.R
├── get_beneish_m.R
├── get_book_value_per_share.R
├── get_buyback_yield.R
├── get_capex_to_sales.R
├── get_cash_conv_cycle.R
├── get_cash_per_share.R
├── get_cash_ratio.R
├── get_cash_to_debt.R
├── get_cogs_to_revenue.R
├── get_current_ratio.R
├── get_days_inventory.R
├── get_days_sales_outstanding.R
├── get_debt_to_assets.R
├── get_debt_to_ebitda.R
├── get_debt_to_equity.R
├── get_debt_to_revenue.R
├── get_diluted_eps.R
├── get_dividend_per_share.R
├── get_e10.R
├── get_ebit_per_share.R
├── get_ebitda_per_share.R
├── get_eff_interest_rate.R
├── get_eps_ex_nri.R
├── get_equity_to_assets.R
├── get_ev_to_ebit.R
├── get_ev_to_ebitda.R
├── get_ev_to_revenue.R
├── get_fcf_per_share.R
├── get_financial_distress.R
├── get_financial_strength.R
├── get_forecasts.R
├── get_free_float.R
├── get_goodwill_to_assets.R
├── get_greenblatt_earnings_yield.R
├── get_gross_profit_to_assets.R
├── get_insider_ownership.R
├── get_institutional_ownership.R
├── get_interest_coverage.R
├── get_inventory_to_revenue.R
├── get_inventory_turnover.R
├── get_liabilities_to_assets.R
├── get_ltd_to_total_assets.R
├── get_net_cash_per_share.R
├── get_net_net_working_capital.R
├── get_operating_cash_flow.R
├── get_owners_eps.R
├── get_pe_ratio.R
├── get_pe_ratio_nri.R
├── get_peg_ratio.R
├── get_piotroski_f.R
├── get_predictability.R
├── get_price_to_book.R
├── get_price_to_fcf.R
├── get_price_to_opcf.R
├── get_price_to_tangible_book.R
├── get_profitability.R
├── get_revenue_per_share.R
├── get_snoa.R
├── get_table.R
├── get_tangible_book_per_share.R
├── get_text.R
├── get_total_debt_per_share.R
├── get_yacktman_return.R
├── get_yoy_ebitda_growth.R
├── get_yoy_eps_growth.R
├── get_yoy_revenue_growth.R
├── input_merge.R
├── regex_ttm.R
├── sanity.R
├── scrape_key_fig.R
├── scrape_ownership_fig.R
├── scrape_predictability.R
├── scrape_profitability.R
└── topicality.R
├── README.md
├── man
├── data_gurufocus.Rd
├── data_nasdaq100.Rd
├── data_sp500.Rd
├── get_altman_z.Rd
├── get_asset_turnover.Rd
├── get_beneish_m.Rd
├── get_book_value_per_share.Rd
├── get_buyback_yield.Rd
├── get_capex_to_sales.Rd
├── get_cash_conv_cycle.Rd
├── get_cash_per_share.Rd
├── get_cash_ratio.Rd
├── get_cash_to_debt.Rd
├── get_cogs_to_revenue.Rd
├── get_current_ratio.Rd
├── get_days_inventory.Rd
├── get_days_sales_outstanding.Rd
├── get_debt_to_assets.Rd
├── get_debt_to_ebitda.Rd
├── get_debt_to_equity.Rd
├── get_debt_to_revenue.Rd
├── get_diluted_eps.Rd
├── get_dividend_per_share.Rd
├── get_e10.Rd
├── get_ebit_per_share.Rd
├── get_ebitda_per_share.Rd
├── get_eff_interest_rate.Rd
├── get_eps_ex_nri.Rd
├── get_equity_to_assets.Rd
├── get_ev_to_ebit.Rd
├── get_ev_to_ebitda.Rd
├── get_ev_to_revenue.Rd
├── get_fcf_per_share.Rd
├── get_financial_distress.Rd
├── get_financial_strength.Rd
├── get_free_floate.Rd
├── get_goodwill_to_assets.Rd
├── get_greenblatt_earnings_yield.Rd
├── get_gross_profit_to_assets.Rd
├── get_insider_ownership.Rd
├── get_institutional_ownership.Rd
├── get_interest_coverage.Rd
├── get_inventory_to_revenue.Rd
├── get_inventory_turnover.Rd
├── get_liabilities_to_assets.Rd
├── get_ltd_to_total_assets.Rd
├── get_net_cash_per_share.Rd
├── get_net_net_working_capital.Rd
├── get_operating_cash_flow.Rd
├── get_owners_eps.Rd
├── get_pe_ratio.Rd
├── get_pe_ratio_nri.Rd
├── get_peg_ratio.Rd
├── get_piotroski_f.Rd
├── get_predictability.Rd
├── get_price_to_book.Rd
├── get_price_to_fcf.Rd
├── get_price_to_opcf.Rd
├── get_price_to_tangible_book.Rd
├── get_profitability.Rd
├── get_revenue_per_share.Rd
├── get_snoa.Rd
├── get_table.Rd
├── get_tangible_book_per_share.Rd
├── get_text.Rd
├── get_total_debt_per_share.Rd
├── get_yacktman_forward_return.Rd
├── get_yoy_ebitda_growth.Rd
├── get_yoy_eps_growth.Rd
├── get_yoy_revenue_growth.Rd
├── input_merge.Rd
├── regex_ttm.Rd
├── sanity.Rd
├── scrape_key_fig.Rd
├── scrape_ownership_fig.Rd
├── scrape_predictability.Rd
├── scrape_profitability.Rd
└── topicality.Rd
├── misc
└── quant_demo.gif
├── quant_0.0.1.0000.pdf
└── tests
├── testthat.R
└── testthat
├── test-data_nasdaq100.R
├── test-data_sp500.R
├── test-get_altman_z.R
├── test-get_asset_turnover.R
├── test-get_beneish_m.R
├── test-get_book_value_per_share.R
├── test-get_buyback_yield.R
├── test-get_capex_to_sales.R
├── test-get_cash_conv_cycle.R
├── test-get_cash_per_share.R
├── test-get_cash_ratio.R
├── test-get_cash_to_debt.R
├── test-get_cogs_to_revenue.R
├── test-get_current_ratio.R
├── test-get_days_inventory.R
├── test-get_days_sales_outstanding.R
├── test-get_debt_to_assets.R
├── test-get_debt_to_ebitda.R
├── test-get_debt_to_equity.R
├── test-get_debt_to_revenue.R
├── test-get_diluted_eps.R
├── test-get_dividend_per_share.R
├── test-get_e10.R
├── test-get_ebit_per_share.R
├── test-get_ebitda_per_share.R
├── test-get_eff_interest_rate.R
├── test-get_eps_ex_nri.R
├── test-get_equity_to_assets.R
├── test-get_ev_to_ebit.R
├── test-get_ev_to_ebitda.R
├── test-get_ev_to_revenue.R
├── test-get_fcf_per_share.R
├── test-get_financial_distress.R
└── test-get_financial_strength.R
/DESCRIPTION:
--------------------------------------------------------------------------------
1 | Package: quant
2 | Title: Fundamentals Data for Stock Research
3 | Version: 0.0.1.0000
4 | Authors@R:
5 | person("Oliver", "Hennhöfer", , "oliver.hennhoefer@mail.de", role = c("aut", "cre"),
6 | comment = c(ORCID = "0000-0001-9834-4685"))
7 | Description: Provides commands for easy retrieval of fundamental stock data from gurufocus.com and tipranks.com for thousands of publicly traded companies.
8 | URL: https://github.com/OliverHennhoefer/quant
9 | Language: en-US
10 | Imports:
11 | plyr,
12 | data.table,
13 | rvest,
14 | utils
15 | License: GPL-3
16 | Encoding: UTF-8
17 | BugReports: https://github.com
18 | Roxygen: list(markdown = TRUE)
19 | RoxygenNote: 7.1.2
20 | Suggests:
21 | testthat (>= 3.0.0)
22 | Config/testthat/edition: 3
23 |
--------------------------------------------------------------------------------
/NAMESPACE:
--------------------------------------------------------------------------------
1 | # Generated by roxygen2: do not edit by hand
2 |
3 | export(data_gurufocus)
4 | export(data_nasdaq100)
5 | export(data_sp500)
6 | export(get_altman_z)
7 | export(get_asset_turnover)
8 | export(get_beneish_m)
9 | export(get_book_value_per_share)
10 | export(get_buyback_yield)
11 | export(get_capex_to_sales)
12 | export(get_cash_conv_cycle)
13 | export(get_cash_per_share)
14 | export(get_cash_ratio)
15 | export(get_cash_to_debt)
16 | export(get_cogs_to_revenue)
17 | export(get_current_ratio)
18 | export(get_days_inventory)
19 | export(get_days_sales_outstanding)
20 | export(get_debt_to_assets)
21 | export(get_debt_to_ebitda)
22 | export(get_debt_to_equity)
23 | export(get_debt_to_revenue)
24 | export(get_diluted_eps)
25 | export(get_dividend_per_share)
26 | export(get_e10)
27 | export(get_ebit_per_share)
28 | export(get_ebitda_per_share)
29 | export(get_eff_interest_rate)
30 | export(get_eps_ex_nri)
31 | export(get_equity_to_assets)
32 | export(get_ev_to_ebit)
33 | export(get_ev_to_ebitda)
34 | export(get_ev_to_revenue)
35 | export(get_fcf_per_share)
36 | export(get_financial_distress)
37 | export(get_financial_strength)
38 | export(get_free_floate)
39 | export(get_goodwill_to_assets)
40 | export(get_greenblatt_earnings_yield)
41 | export(get_gross_profit_to_assets)
42 | export(get_insider_ownership)
43 | export(get_institutional_ownership)
44 | export(get_interest_coverage)
45 | export(get_inventory_to_revenue)
46 | export(get_inventory_turnover)
47 | export(get_liabilities_to_assets)
48 | export(get_ltd_to_total_assets)
49 | export(get_net_cash_per_share)
50 | export(get_net_net_working_capital)
51 | export(get_operating_cash_flow)
52 | export(get_owners_eps)
53 | export(get_pe_ratio)
54 | export(get_pe_ratio_nri)
55 | export(get_peg_ratio)
56 | export(get_piotroski_f)
57 | export(get_predictability)
58 | export(get_price_to_book)
59 | export(get_price_to_fcf)
60 | export(get_price_to_opcf)
61 | export(get_price_to_tangible_book)
62 | export(get_profitability)
63 | export(get_revenue_per_share)
64 | export(get_snoa)
65 | export(get_table)
66 | export(get_tangible_book_per_share)
67 | export(get_text)
68 | export(get_total_debt_per_share)
69 | export(get_yacktman_forward_return)
70 | export(get_yoy_ebitda_growth)
71 | export(get_yoy_eps_growth)
72 | export(get_yoy_revenue_growth)
73 | export(input_merge)
74 | export(regex_ttm)
75 | export(scrape_key_fig)
76 | export(scrape_ownership_fig)
77 | export(scrape_predictability)
78 | export(scrape_profitability)
79 | export(topicality)
80 |
--------------------------------------------------------------------------------
/R/data_gurufocus.R:
--------------------------------------------------------------------------------
1 | #' @title
2 | #' Fetch complete stock list of gurufocus.com
3 | #'
4 | #' @description
5 | #' Fetches the stock list provided by [gurufocus.com](gurufocus.com)
6 | #'
7 | #' @return data.table data.frame
8 | #' @export
9 |
10 | data_gurufocus <- function() {
11 |
12 | # Progress Bar ----------------------------------------------------------------
13 | total_records <- get_text(
14 | url = 'https://www.gurufocus.com/stock_list.php?&p=1&n=100',
15 | xpath = '//*[@id="ajax_content"]/div/div[3]/strong')
16 |
17 | count <- round(as.numeric(total_records)/100, digits = -1) # divisibility
18 | pbar <- utils::txtProgressBar(0, count, style = 3)
19 |
20 | # Fetch Data -----------------------------------------------------------------
21 | i <- 1
22 | dat <- data.table::data.table(NULL)
23 | names <- c("symbol", "company")
24 |
25 | while(TRUE) {
26 | utils::setTxtProgressBar(pbar, i)
27 | i <- i + 1
28 |
29 | url <- paste0("https://www.gurufocus.com/stock_list.php?&p=", i, "&n=100")
30 |
31 | html_page <- rvest::read_html(url)
32 | html_node <- rvest::html_nodes(html_page, xpath = '//*[@id="R1"]')
33 | html_tbl <- rvest::html_table(html_node)
34 | html_dt <- data.table::as.data.table(html_tbl)
35 |
36 | html_dt[, (3:ncol(html_dt))] <- NULL
37 | if(nrow(html_dt) == 0) break
38 |
39 | dat <- data.table::rbindlist(dat, html_dt)
40 | }
41 |
42 | close(pbar)
43 |
44 | data.table::setnames(dat, names)
45 |
46 | return(dat)
47 | }
48 |
--------------------------------------------------------------------------------
/R/data_nasdaq100.R:
--------------------------------------------------------------------------------
1 | #' @title
2 | #' Fetch components of the Nasdaq-100
3 | #'
4 | #' @description
5 | #' Fetches the list of components provided by
6 | #' [wikipedia.org](https://de.wikipedia.org/wiki/NASDAQ-100)
7 | #'
8 | #' @return data.table data.frame
9 | #' @export
10 |
11 | data_nasdaq100 <- function() {
12 |
13 | url <- 'https://en.wikipedia.org/wiki/Nasdaq-100'
14 | xpath <- '//*[@id="constituents"]'
15 |
16 | html_page <- rvest::read_html(url)
17 | html_node <- rvest::html_nodes(html_page, xpath = xpath)
18 | html_tbl <- rvest::html_table(html_node)
19 | html_dt <- data.table::as.data.table(html_tbl)
20 |
21 | html_dt <- html_dt[, c(2, 1, 3, 4)]
22 | names <- c('symbol', 'company', 'sector', 'subsector')
23 | data.table::setnames(html_dt, names)
24 |
25 | return(html_dt)
26 | }
27 |
--------------------------------------------------------------------------------
/R/data_sp500.R:
--------------------------------------------------------------------------------
1 | #' @title
2 | #' Fetch components of the S&P 500
3 | #'
4 | #' @description
5 | #' Fetches the list of components provided by
6 | #' [wikipedia.org](n.wikipedia.org/wiki/List_of_S%26P_500_companies)
7 | #'
8 | #' @return data.table data.frame
9 | #' @export
10 |
11 | data_sp500 <- function() {
12 |
13 | url <- 'https://en.wikipedia.org/wiki/List_of_S%26P_500_companies'
14 | xpath <- '//*[@id="constituents"]'
15 |
16 | html_page <- rvest::read_html(url)
17 | html_node <- rvest::html_nodes(html_page, xpath = xpath)
18 | html_tbl <- rvest::html_table(html_node)
19 | html_dt <- data.table::as.data.table(html_tbl)
20 |
21 | html_dt <- html_dt[, c(1, 2, 4, 5)]
22 | names <- c('symbol', 'company', 'sector', 'subsector')
23 | data.table::setnames(html_dt, names)
24 |
25 | return(html_dt)
26 | }
27 |
--------------------------------------------------------------------------------
/R/get_asset_turnover.R:
--------------------------------------------------------------------------------
1 | #' @title Get Asset-Turnover-Ratio
2 | #'
3 | #' @description Wrapper function for fetching data from
4 | #' [gurufocus.com](https://www.gurufocus.com/term/turnover/AAPL/).
5 | #'
6 | #' @usage get_asset_turnover(df)
7 | #'
8 | #' @param df data.frame. Data frame with column 'symbol' containing at least one
9 | #' valid stock ticker symbol.
10 | #'
11 | #' @return Input data.frame supplemented by the company's available
12 | #' **Asset Turnover** data.
13 | #' @export
14 | #'
15 | #' @examples
16 | #' df <- data.frame('symbol' = 'AAPL')
17 | #' res <- get_asset_turnover(df)
18 | #'
19 | #' @details
20 | #' The Asset-Turnover-Ratio measures the value of a company's
21 | #' *Net Sales Revenue* relative to the value of its *Total Assets*. The ratio
22 | #' indicates how effectively a company is using its assets in order to generate
23 | #' sales.
24 |
25 | get_asset_turnover <- function(df) {
26 |
27 | pfx <- 'ato'
28 | url <- 'https://www.gurufocus.com/term/turnover/'
29 | xpath_tbl <- '//*[@id="target_def_historical_data"]/div[2]/div/table'
30 | xpath_txt <- '//*[@id="def_body_detail_height"]/font[1]'
31 |
32 | res <- suppressWarnings(scrape_key_fig(df, url, pfx, xpath_txt, xpath_tbl))
33 |
34 | return(res)
35 | }
36 |
--------------------------------------------------------------------------------
/R/get_beneish_m.R:
--------------------------------------------------------------------------------
1 | #' @title Get Beneish M-Score
2 | #'
3 | #' @description Wrapper function for fetching data from
4 | #' [gurufocus.com](https://www.gurufocus.com/term/mscore/AAPL/).
5 | #'
6 | #' The Beneish M-Score quantifies the likelihood of reported earnings
7 | #' manipulation. The M-Score is a probabilistic model that classifies the rated
8 | #' company either into the category "Unlikely Manipulator" (M-Score>=-1.78) or
9 | #' "Likely Manipulator" (M-Score>-1.78). The M-Score must not be applied among
10 | #' financial firms like banks and insurance companies due to their very specific
11 | #' business characteristics.
12 | #'
13 | #' @usage get_beneish_m(df)
14 | #'
15 | #' @param df data.frame. Data frame with column 'symbol' containing at least one
16 | #' valid stock ticker symbol.
17 | #'
18 | #' @return Input data.frame supplemented by the company's available
19 | #' **Beneish M-Score** data.
20 | #' @export
21 | #'
22 | #' @examples
23 | #' df <- data.frame('symbol' = 'AAPL')
24 | #' res <- get_beneish_m(df)
25 | #'
26 | #' @details The original formula for calculating the **Beneish M-Score**
27 | #' consists of eight financial ratios:
28 | #' \deqn{M = -4.84+0.92xDSRI+0.528xGMI+0.404xAQI+0.892xSGI+0.115xDEPI-0.172xSGAI
29 | #' +4.679xTATA-0.327xLVGI}
30 | #'
31 | #' \itemize{
32 | #' \item DSRI: Days Sales in Receivables Index as earnings quality metric
33 | #' indicates whether earnings quality is rising or falling.
34 | #'
35 | #' \item GMI: Gross Margin Index as a fundamental momentum metric indicates
36 | #' whether a company's profitability and pricing power is rising or falling.
37 | #'
38 | #' \item AQI: Asset Quality Index can be used to determine whether a company
39 | #' is excessively capitalizing expenses.
40 | #'
41 | #' \item SGI: Sales Growth Index indicates whether a company's sales are
42 | #' rising or falling.
43 | #'
44 | #' \item DEPI: Depreciation Index indicates whether a company is depreciating
45 | #' assets at faster or slower rates.
46 | #'
47 | #' \item SGAI: Sales, General and Administrative (SGA) Expenses Index
48 | #' indicates whether a company's SGA Expenses are rising or falling.
49 | #'
50 | #' \item LVGI: Leverage Index indicates whether a company's leverage is rising
51 | #' or falling.
52 | #'
53 | #' \item TATA: Total Accruals to Total Assets indicates whether a change in
54 | #' accounting practices may resulted in
55 | #' }
56 | #'
57 | #' The formula was parameterized by multivariate linear discriminant analysis
58 | #' applied on a data set of 33 solvent and 33 insolvent companies
59 | #' (see *references*).
60 | #'
61 | #' @references
62 | #' Beneish, Messod D. (1999): The Detection of Earnings Manipulation
63 | #' in Financial Analysts Journal, Volume 55, Issue 5, p. 24-36
64 |
65 | get_beneish_m <- function(df) {
66 |
67 | pfx <- 'mscore'
68 | url <- 'https://www.gurufocus.com/term/mscore/'
69 | xpath_tbl <- '//*[@id="target_def_historical_data"]/div[2]/div/table'
70 | xpath_txt <- '//*[@id="def_body_detail_height"]/font[1]'
71 |
72 | res <- suppressWarnings(scrape_key_fig(df, url, pfx, xpath_txt, xpath_tbl))
73 |
74 | return(res)
75 | }
76 |
--------------------------------------------------------------------------------
/R/get_book_value_per_share.R:
--------------------------------------------------------------------------------
1 | #' @title Get Book Value per Share
2 | #'
3 | #' @description Wrapper function for fetching data from
4 | #' [gurufocus.com](https://www.gurufocus.com/term/Book+Value+Per+Share/AAPL/).
5 | #'
6 | #' @usage get_book_value_per_share(df)
7 | #'
8 | #' @param df data.frame. Data frame with column 'symbol' containing at least one
9 | #' valid stock ticker symbol.
10 | #'
11 | #' @return Input data.frame supplemented by the company's available
12 | #' **Book Value per Share** data.
13 | #' @export
14 | #'
15 | #' @examples
16 | #' df <- data.frame('symbol' = 'AAPL')
17 | #' res <- get_book_value_per_share(df)
18 | #'
19 | #' @details
20 | #' Book value per common share (or, simply book value per share - BVPS) is a
21 | #' method to calculate the per-share book value of a company based on common
22 | #' shareholders' equity in the company. The book value of a company is the
23 | #' difference between that company's total assets and total liabilities, and not
24 | #' its share price in the market.
25 |
26 | get_book_value_per_share <- function(df) {
27 |
28 | pfx <- 'bvps'
29 | url <- 'https://www.gurufocus.com/term/Book+Value+Per+Share/'
30 | xpath_tbl <- '//*[@id="target_def_historical_data"]/div[2]/div/table'
31 | xpath_txt <- '//*[@id="def_body_detail_height"]/font[1]'
32 |
33 | res <- suppressWarnings(scrape_key_fig(df, url, pfx, xpath_txt, xpath_tbl))
34 |
35 | return(res)
36 | }
37 |
--------------------------------------------------------------------------------
/R/get_buyback_yield.R:
--------------------------------------------------------------------------------
1 | #' @title Get Buyback Yield
2 | #'
3 | #' @description Wrapper function for fetching data from
4 | #' [gurufocus.com](https://www.gurufocus.com/term/buyback_yield/AAPL/).
5 | #'
6 | #' @usage get_buyback_yield(df)
7 | #'
8 | #' @param df data.frame. Data frame with column 'symbol' containing at least one
9 | #' valid stock ticker symbol.
10 | #'
11 | #' @return Input data.frame supplemented by the company's available
12 | #' **Buyback Yield** data.
13 | #' @export
14 | #'
15 | #' @examples
16 | #' df <- data.frame('symbol' = 'AAPL')
17 | #' res <- get_buyback_yield(df)
18 | #'
19 | #' @details
20 | #' The buyback yield gives the repurchased outstanding shares in relation to the
21 | #' market capitalization. Higher buyback yields may indicate the managements
22 | #' expectation that the stock is undervalued or its attempt to prevent a hostile
23 | #' takeover among other reasons.
24 |
25 | get_buyback_yield <- function(df) {
26 |
27 | pfx <- 'buyback_yield'
28 | url <- 'https://www.gurufocus.com/term/buyback_yield/'
29 | xpath_tbl <- '//*[@id="target_def_historical_data"]/div[2]/div/table'
30 | xpath_txt <- '//*[@id="def_body_detail_height"]/font[1]'
31 |
32 | res <- suppressWarnings(scrape_key_fig(df, url, pfx, xpath_txt, xpath_tbl))
33 |
34 | return(res)
35 | }
36 |
--------------------------------------------------------------------------------
/R/get_capex_to_sales.R:
--------------------------------------------------------------------------------
1 | #' @title Get CAPEX-Sales-Ratio
2 | #'
3 | #' @description Wrapper function for fetching data from
4 | #' [gurufocus.com](https://www.gurufocus.com/term/capex_to_revenue/AAPL/).
5 | #'
6 | #' @usage get_capex_to_sales(df)
7 | #'
8 | #' @param df data.frame. Data frame with column 'symbol' containing at least one
9 | #' valid stock ticker symbol.
10 | #'
11 | #' @return Input data.frame supplemented by the company's available
12 | #' **CAPEX-Sales-Ratio** data.
13 | #' @export
14 | #'
15 | #' @examples
16 | #' df <- data.frame('symbol' = 'AAPL')
17 | #' res <- get_capex_to_sales(df)
18 | #'
19 | #' @details
20 | #' The CAPEX-Sales-Ratio measures a company's investments into property, plant,
21 | #' equipment and other capital assets (CAPEX) relative to its total sales. The
22 | #' measure indicates how aggressively a company is reinvesting its revenue into
23 | #' productive assets. The interpretation of the ratio depends on how effectively
24 | #' a company uses its assets to produce new income.
25 |
26 | get_capex_to_sales <- function(df) {
27 |
28 | pfx <- 'capex2rev'
29 | url <- 'https://www.gurufocus.com/term/capex_to_revenue/'
30 | xpath_tbl <- '//*[@id="target_def_historical_data"]/div[2]/div/table'
31 | xpath_txt <- '//*[@id="def_body_detail_height"]/font[1]'
32 |
33 | res <- suppressWarnings(scrape_key_fig(df, url, pfx, xpath_txt, xpath_tbl))
34 |
35 | return(res)
36 | }
37 |
--------------------------------------------------------------------------------
/R/get_cash_conv_cycle.R:
--------------------------------------------------------------------------------
1 | #' @title Get Cash Conversion Cycle
2 | #'
3 | #' @description Wrapper function for fetching data from
4 | #' [gurufocus.com](https://www.gurufocus.com/term/CCC/AAPL/).
5 | #'
6 | #' @usage get_cash_conv_cycle(df)
7 | #'
8 | #' @param df data.frame. Data frame with column 'symbol' containing at least one
9 | #' valid stock ticker symbol.
10 | #'
11 | #' @return Input data.frame supplemented by the company's available
12 | #' **Cash Conversion Cycle** data.
13 | #' @export
14 | #'
15 | #' @examples
16 | #' df <- data.frame('symbol' = 'AAPL')
17 | #' res <- get_cash_conv_cycle(df)
18 | #'
19 | #' @details
20 | #' The Cash Conversion Cycle measures the amount of days it takes for a company
21 | #' to convert its investments in inventory and other resources into cash flows
22 | #' from sales. The measure it calculated by Days Sales Outstanding +
23 | #' Days Inventory - Days Payable.
24 | #'
25 | #' A negative value indicates that it takes a company longer to pay its
26 | #' suppliers than it takes the company to sell its inventory and collect its
27 | #' money. It is difficult to compare the Cash Conversion Cycle between
28 | #' different industries.
29 |
30 | get_cash_conv_cycle <- function(df) {
31 |
32 | pfx <- 'cash_conv_cycle'
33 | url <- 'https://www.gurufocus.com/term/CCC/'
34 | xpath_tbl <- '//*[@id="target_def_historical_data"]/div[2]/div/table'
35 | xpath_txt <- '//*[@id="def_body_detail_height"]/font[1]'
36 |
37 | res <- suppressWarnings(scrape_key_fig(df, url, pfx, xpath_txt, xpath_tbl))
38 |
39 | return(res)
40 | }
41 |
--------------------------------------------------------------------------------
/R/get_cash_per_share.R:
--------------------------------------------------------------------------------
1 | #' @title Get Cash-per-Share
2 | #'
3 | #' @description Wrapper function for fetching data from
4 | #' [gurufocus.com](https://www.gurufocus.com/term/cash_per_share/AAPL/).
5 | #'
6 | #' @usage get_cash_per_share(df)
7 | #'
8 | #' @param df data.frame. Data frame with column 'symbol' containing at least one
9 | #' valid stock ticker symbol.
10 | #'
11 | #' @return Input data.frame supplemented by the company's available
12 | #' **Cash-per-Share** data.
13 | #' @export
14 | #'
15 | #' @examples
16 | #' df <- data.frame('symbol' = 'AAPL')
17 | #' res <- get_cash_per_share(df)
18 | #'
19 | #' @details
20 | #' Cash-per-Share gives the cash, cash equivalents and marketable securities
21 | #' divided by the shares outstanding.
22 |
23 | get_cash_per_share <- function(df) {
24 |
25 | pfx <- 'cps'
26 | url <- 'https://www.gurufocus.com/term/cash_per_share/'
27 | xpath_tbl <- '//*[@id="target_def_historical_data"]/div[2]/div/table'
28 | xpath_txt <- '//*[@id="def_body_detail_height"]/font[1]'
29 |
30 | res <- suppressWarnings(scrape_key_fig(df, url, pfx, xpath_txt, xpath_tbl))
31 |
32 | return(res)
33 | }
34 |
--------------------------------------------------------------------------------
/R/get_cash_ratio.R:
--------------------------------------------------------------------------------
1 | #' @title Get Cash-Ratio
2 | #'
3 | #' @description Wrapper function for fetching data from
4 | #' [gurufocus.com](https://www.gurufocus.com/term/cash_ratio/AAPL/).
5 | #'
6 | #' @usage get_cash_ratio(df)
7 | #'
8 | #' @param df data.frame. Data frame with column 'symbol' containing at least one
9 | #' valid stock ticker symbol.
10 | #'
11 | #' @return Input data.frame supplemented by the company's available
12 | #' **Cash-Ratio** data.
13 | #' @export
14 | #'
15 | #' @examples
16 | #' df <- data.frame('symbol' = 'AAPL')
17 | #' res <- get_cash_ratio(df)
18 | #'
19 | #' @details
20 | #' The Asset-Turnover-Ratio measures the value of a company's cash, cash
21 | #' equivalents, marketable securities relative to its current liabilities. The
22 | #' ratio indicates how liquid a company is.
23 | #'
24 | #' It differs from the Cash-to-Debt-Ratio by focusing on current liabilities due
25 | #' in the short-term (< 1 year).
26 |
27 | get_cash_ratio <- function(df) {
28 |
29 | pfx <- 'cash.ratio'
30 | url <- 'https://www.gurufocus.com/term/cash_ratio/'
31 | xpath_tbl <- '//*[@id="target_def_historical_data"]/div[2]/div/table'
32 | xpath_txt <- '//*[@id="def_body_detail_height"]/font[1]'
33 |
34 | res <- suppressWarnings(scrape_key_fig(df, url, pfx, xpath_txt, xpath_tbl))
35 |
36 | return(res)
37 | }
38 |
--------------------------------------------------------------------------------
/R/get_cash_to_debt.R:
--------------------------------------------------------------------------------
1 | #' @title Get Cash-Debt-Ratio
2 | #'
3 | #' @description Wrapper function for fetching data from
4 | #' [gurufocus.com](https://www.gurufocus.com/term/turnover/AAPL/).
5 | #'
6 | #' @usage get_cash_to_debt(df)
7 | #'
8 | #' @param df data.frame. Data frame with column 'symbol' containing at least one
9 | #' valid stock ticker symbol.
10 | #'
11 | #' @return Input data.frame supplemented by the company's available
12 | #' **Cash-Debt-Ratio** data.
13 | #' @export
14 | #'
15 | #' @examples
16 | #' df <- data.frame('symbol' = 'AAPL')
17 | #' res <- get_cash_to_debt(df)
18 | #'
19 | #' @details
20 | #' The Cash-Debt-Ratio measures a company's cash, cash equivalents, marketable
21 | #' securities relative to its debt. A Cash-Debt-Ratio greater 1 indicates that a
22 | #' company can pay off its debt using its cash on hand.
23 | #'
24 | #' It differs from the Cash-Ratio by focusing on current as well as on
25 | #' non-current liabilities.
26 |
27 | get_cash_to_debt <- function(df) {
28 |
29 | pfx <- 'cash2debt'
30 | url <- 'https://www.gurufocus.com/term/cash2debt/'
31 | xpath_tbl <- '//*[@id="target_def_historical_data"]/div[2]/div/table'
32 | xpath_txt <- '//*[@id="def_body_detail_height"]/font[1]'
33 |
34 | res <- suppressWarnings(scrape_key_fig(df, url, pfx, xpath_txt, xpath_tbl))
35 |
36 | return(res)
37 | }
38 |
--------------------------------------------------------------------------------
/R/get_cogs_to_revenue.R:
--------------------------------------------------------------------------------
1 | #' @title Get Cost-of-Goods-Sold-to-Revenue-Ratio
2 | #'
3 | #' @description Wrapper function for fetching data from
4 | #' [gurufocus.com](https://www.gurufocus.com/term/cogs2rev/AAPL/).
5 | #'
6 | #' @usage get_cogs_to_revenue(df)
7 | #'
8 | #' @param df data.frame. Data frame with column 'symbol' containing at least one
9 | #' valid stock ticker symbol.
10 | #'
11 | #' @return Input data.frame supplemented by the company's available
12 | #' **Cost-of-Goods-Sold-to-Revenue-Ratio** data.
13 | #' @export
14 | #'
15 | #' @examples
16 | #' df <- data.frame('symbol' = 'AAPL')
17 | #' res <- get_cogs_to_revenue(df)
18 | #'
19 | #' @details
20 | #' The Asset-Turnover-Ratio measures the direct cost attributed to the
21 | #' production of the products sold relative to the total revenue generated by
22 | #' the company over the same time period. Higher values may indicate
23 | #' inefficiencies in procurement and/or production processes.
24 |
25 | get_cogs_to_revenue <- function(df) {
26 |
27 | pfx <- 'cogs2rev'
28 | url <- 'https://www.gurufocus.com/term/cogs2rev/'
29 | xpath_tbl <- '//*[@id="target_def_historical_data"]/div[2]/div/table'
30 | xpath_txt <- '//*[@id="def_body_detail_height"]/font[1]'
31 |
32 | res <- suppressWarnings(scrape_key_fig(df, url, pfx, xpath_txt, xpath_tbl))
33 |
34 | return(res)
35 | }
36 |
--------------------------------------------------------------------------------
/R/get_current_ratio.R:
--------------------------------------------------------------------------------
1 | #' @title Get Current Ratio
2 | #'
3 | #' @description Wrapper function for fetching data from
4 | #' [gurufocus.com](https://www.gurufocus.com/term/current_ratio/AAPL/).
5 | #'
6 | #' @usage get_current_ratio(df)
7 | #'
8 | #' @param df data.frame. Data frame with column 'symbol' containing at least one
9 | #' valid stock ticker symbol.
10 | #'
11 | #' @return Input data.frame supplemented by the company's available
12 | #' **Current Ratio** data.
13 | #' @export
14 | #'
15 | #' @examples
16 | #' df <- data.frame('symbol' = 'AAPL')
17 | #' res <- get_current_ratio(df)
18 | #'
19 | #' @details
20 | #' The Current Ratio measures a company's ability to its shot-term obligations.
21 |
22 | get_current_ratio <- function(df) {
23 |
24 | pfx <- 'current_ratio'
25 | url <- 'https://www.gurufocus.com/term/current_ratio/'
26 | xpath_tbl <- '//*[@id="target_def_historical_data"]/div[2]/div/table'
27 | xpath_txt <- '//*[@id="def_body_detail_height"]/font[1]'
28 |
29 | res <- suppressWarnings(scrape_key_fig(df, url, pfx, xpath_txt, xpath_tbl))
30 |
31 | return(res)
32 | }
33 |
--------------------------------------------------------------------------------
/R/get_days_inventory.R:
--------------------------------------------------------------------------------
1 | #' @title Get Days Inventory
2 | #'
3 | #' @description Wrapper function for fetching data from
4 | #' [gurufocus.com](https://www.gurufocus.com/term/DaysInventory/AAPL/).
5 | #'
6 | #' @usage get_days_inventory(df)
7 | #'
8 | #' @param df data.frame. Data frame with column 'symbol' containing at least one
9 | #' valid stock ticker symbol.
10 | #'
11 | #' @return Input data.frame supplemented by the company's available
12 | #' **Days Inventory** data.
13 | #' @export
14 | #'
15 | #' @examples
16 | #' df <- data.frame('symbol' = 'AAPL')
17 | #' res <- get_days_inventory(df)
18 | #'
19 | #' @details
20 | #' The Asset-Turnover-Ratio indicates the average time in day that a company
21 | #' takes to turn its inventory, including goods that are work in progress,
22 | #' into sales.
23 |
24 | get_days_inventory <- function(df) {
25 |
26 | pfx <- 'days_inv'
27 | url <- 'https://www.gurufocus.com/term/DaysInventory/'
28 | xpath_tbl <- '//*[@id="target_def_historical_data"]/div[2]/div/table'
29 | xpath_txt <- '//*[@id="def_body_detail_height"]/font[1]'
30 |
31 | res <- suppressWarnings(scrape_key_fig(df, url, pfx, xpath_txt, xpath_tbl))
32 |
33 | return(res)
34 | }
35 |
--------------------------------------------------------------------------------
/R/get_days_sales_outstanding.R:
--------------------------------------------------------------------------------
1 | #' @title Get Days Sales Outstanding
2 | #'
3 | #' @description Wrapper function for fetching data from
4 | #' [gurufocus.com](https://www.gurufocus.com/term/DaysSalesOutstanding/AAPL/).
5 | #'
6 | #' @usage get_days_sales_outstanding(df)
7 | #'
8 | #' @param df data.frame. Data frame with column 'symbol' containing at least one
9 | #' valid stock ticker symbol.
10 | #'
11 | #' @return Input data.frame supplemented by the company's available
12 | #' **Days Sales Outstanding** data.
13 | #' @export
14 | #'
15 | #' @examples
16 | #' df <- data.frame('symbol' = 'AAPL')
17 | #' res <- get_days_sales_outstanding(df)
18 | #'
19 | #' @details
20 | #' The Days Sales Outstanding is the average number of days it takes a company
21 | #' to receive payment for a sale. A higher Days Sales Outstanding indicates the
22 | #' company is getting its payments quickly. Generally DSO <45 days is considered
23 | #' low.
24 |
25 | get_days_sales_outstanding <- function(df) {
26 |
27 | pfx <- 'DaysSalesOutstanding'
28 | url <- 'https://www.gurufocus.com/term/DaysSalesOutstanding/'
29 | xpath_tbl <- '//*[@id="target_def_historical_data"]/div[2]/div/table'
30 | xpath_txt <- '//*[@id="def_body_detail_height"]/font[1]'
31 |
32 | res <- suppressWarnings(scrape_key_fig(df, url, pfx, xpath_txt, xpath_tbl))
33 |
34 | return(res)
35 | }
36 |
--------------------------------------------------------------------------------
/R/get_debt_to_assets.R:
--------------------------------------------------------------------------------
1 | #' @title Get Debt to Asset Ratio
2 | #'
3 | #' @description Wrapper function for fetching data from
4 | #' [gurufocus.com](https://www.gurufocus.com/term/turnover/AAPL/).
5 | #'
6 | #' @usage get_debt_to_assets(df)
7 | #'
8 | #' @param df data.frame. Data frame with column 'symbol' containing at least one
9 | #' valid stock ticker symbol.
10 | #'
11 | #' @return Input data.frame supplemented by the company's available
12 | #' **Debt to Asset Ratio** data.
13 | #' @export
14 | #'
15 | #' @examples
16 | #' df <- data.frame('symbol' = 'AAPL')
17 | #' res <- get_debt_to_assets(df)
18 | #'
19 | #' @details
20 | #' The Asset-Turnover-Ratio is a leverage ratio that defines the total amount of
21 | #' debt relative to a company's assets. A ratio of about >= 1 means a company
22 | #' owns the same amount of liabilities or more as its assets and with that is
23 | #' highly leveraged. Lower ratios indicate that a company owns more asset than
24 | #' liabilities and can meet its obligations by selling assets if needed.
25 |
26 | get_debt_to_assets <- function(df) {
27 |
28 | pfx <- 'debt2asset'
29 | url <- 'https://www.gurufocus.com/term/debt2asset/'
30 | xpath_tbl <- '//*[@id="target_def_historical_data"]/div[2]/div/table'
31 | xpath_txt <- '//*[@id="def_body_detail_height"]/font[1]'
32 |
33 | res <- suppressWarnings(scrape_key_fig(df, url, pfx, xpath_txt, xpath_tbl))
34 |
35 | return(res)
36 | }
37 |
--------------------------------------------------------------------------------
/R/get_debt_to_ebitda.R:
--------------------------------------------------------------------------------
1 | #' @title Get Debt to EBITDA
2 | #'
3 | #' @description Wrapper function for fetching data from
4 | #' [gurufocus.com](https://www.gurufocus.com/term/debt2ebitda/AAPL/).
5 | #'
6 | #' @usage get_debt_to_ebitda(df)
7 | #'
8 | #' @param df data.frame. Data frame with column 'symbol' containing at least one
9 | #' valid stock ticker symbol.
10 | #'
11 | #' @return Input data.frame supplemented by the company's available
12 | #' **Debt to EBITDA** data.
13 | #' @export
14 | #'
15 | #' @examples
16 | #' df <- data.frame('symbol' = 'AAPL')
17 | #' res <- get_debt_to_ebitda(df)
18 | #'
19 | #' @details
20 | #' The Debt to EBITDA is a ratio measuring the amount of income generated and
21 | #' available to pay down debt before covering interest, taxes, depreciation,
22 | #' and amortization expenses. Generally, net debt-to-EBITDA ratios of less than
23 | #' 3 are considered acceptable. The lower the ratio, the higher the probability
24 | #' of the firm successfully paying off its debt. Ratios higher than 3 or 4 serve
25 | #' as red flags and indicate that the company may be financially distressed in
26 | #' the future.
27 |
28 | get_debt_to_ebitda <- function(df) {
29 |
30 | pfx <- 'debt2ebitda'
31 | url <- 'https://www.gurufocus.com/term/debt2ebitda/'
32 | xpath_tbl <- '//*[@id="target_def_historical_data"]/div[2]/div/table'
33 | xpath_txt <- '//*[@id="def_body_detail_height"]/font[1]'
34 |
35 | res <- suppressWarnings(scrape_key_fig(df, url, pfx, xpath_txt, xpath_tbl))
36 |
37 | return(res)
38 | }
39 |
--------------------------------------------------------------------------------
/R/get_debt_to_equity.R:
--------------------------------------------------------------------------------
1 | #' @title Get Debt to Equity Ratio
2 | #'
3 | #' @description Wrapper function for fetching data from
4 | #' [gurufocus.com](https://www.gurufocus.com/term/deb2equity/AAPL/).
5 | #'
6 | #' @usage get_debt_to_equity(df)
7 | #'
8 | #' @param df data.frame. Data frame with column 'symbol' containing at least one
9 | #' valid stock ticker symbol.
10 | #'
11 | #' @return Input data.frame supplemented by the company's available
12 | #' **Debt to Equity Ratio** data.
13 | #' @export
14 | #'
15 | #' @examples
16 | #' df <- data.frame('symbol' = 'AAPL')
17 | #' res <- get_debt_to_equity(df)
18 | #'
19 | #' @details
20 | #' The debt-to-equity (D/E) ratio compares a company's total liabilities to its
21 | #' shareholder equity and can be used to evaluate how much leverage a company is
22 | #' using. Higher-leverage ratios tend to indicate a company or stock with higher
23 | #' risk to shareholders.
24 |
25 | get_debt_to_equity <- function(df) {
26 |
27 | pfx <- 'deb2equity'
28 | url <- 'https://www.gurufocus.com/term/deb2equity/'
29 | xpath_tbl <- '//*[@id="target_def_historical_data"]/div[2]/div/table'
30 | xpath_txt <- '//*[@id="def_body_detail_height"]/font[1]'
31 |
32 | res <- suppressWarnings(scrape_key_fig(df, url, pfx, xpath_txt, xpath_tbl))
33 |
34 | return(res)
35 | }
36 |
--------------------------------------------------------------------------------
/R/get_debt_to_revenue.R:
--------------------------------------------------------------------------------
1 | #' @title Get Debt-to-Revenue Ratio
2 | #'
3 | #' @description Wrapper function for fetching data from
4 | #' [gurufocus.com](https://www.gurufocus.com/term/debt2rev/AAPL/).
5 | #'
6 | #' @usage get_debt_to_revenue(df)
7 | #'
8 | #' @param df data.frame. Data frame with column 'symbol' containing at least one
9 | #' valid stock ticker symbol.
10 | #'
11 | #' @return Input data.frame supplemented by the company's available
12 | #' **Debt to Revenue Ratio** data.
13 | #' @export
14 | #'
15 | #' @examples
16 | #' df <- data.frame('symbol' = 'AAPL')
17 | #' res <- get_debt_to_revenue(df)
18 | #'
19 | #' @details
20 | #' The Debt-to-Revenue Ratio is a personal finance measure that compares the
21 | #' amount of debt you have to your overall income. Lenders, including issuers of
22 | #' mortgages, use it as a way to measure your ability to manage the payments you
23 | #' make each month and repay the money you have borrowed.
24 |
25 | get_debt_to_revenue <- function(df) {
26 |
27 | pfx <- 'debt2rev'
28 | url <- 'https://www.gurufocus.com/term/debt2rev/'
29 | xpath_tbl <- '//*[@id="target_def_historical_data"]/div[2]/div/table'
30 | xpath_txt <- '//*[@id="def_body_detail_height"]/font[1]'
31 |
32 | res <- suppressWarnings(scrape_key_fig(df, url, pfx, xpath_txt, xpath_tbl))
33 |
34 | return(res)
35 | }
36 |
--------------------------------------------------------------------------------
/R/get_diluted_eps.R:
--------------------------------------------------------------------------------
1 | #' @title Get Diluted Earnings per Share
2 | #'
3 | #' @description Wrapper function for fetching data from
4 | #' [gurufocus.com](https://www.gurufocus.com/term/per+share+eps/AAPL/).
5 | #'
6 | #' @usage get_diluted_eps(df)
7 | #'
8 | #' @param df data.frame. Data frame with column 'symbol' containing at least one
9 | #' valid stock ticker symbol.
10 | #'
11 | #' @return Input data.frame supplemented by the company's available
12 | #' **Diluted Earnings per Share ** data.
13 | #' @export
14 | #'
15 | #' @examples
16 | #' df <- data.frame('symbol' = 'AAPL')
17 | #' res <- get_diluted_eps(df)
18 | #'
19 | #' @details
20 | #' The Diluted Earnings per Share calculates a company's earnings per share if
21 | #' all convertible securities were converted. Dilutive securities aren't common
22 | #' stock, but instead securities that can be converted to common stock.
23 |
24 | get_diluted_eps <- function(df) {
25 |
26 | pfx <- 'epsd'
27 | url <- 'https://www.gurufocus.com/term/per+share+eps/'
28 | xpath_tbl <- '//*[@id="target_def_historical_data"]/div[2]/div/table'
29 | xpath_txt <- '//*[@id="def_body_detail_height"]/font[1]'
30 |
31 | res <- suppressWarnings(scrape_key_fig(df, url, pfx, xpath_txt, xpath_tbl))
32 |
33 | return(res)
34 | }
35 |
--------------------------------------------------------------------------------
/R/get_dividend_per_share.R:
--------------------------------------------------------------------------------
1 | #' @title Get Dividend per Share
2 | #'
3 | #' @description Wrapper function for fetching data from
4 | #' [gurufocus.com](https://www.gurufocus.com/term/Dividends+Per+Share/AAPL/).
5 | #'
6 | #' @usage get_dividend_per_share(df)
7 | #'
8 | #' @param df data.frame. Data frame with column 'symbol' containing at least one
9 | #' valid stock ticker symbol.
10 | #'
11 | #' @return Input data.frame supplemented by the company's available
12 | #' **Dividend per Share** data.
13 | #' @export
14 | #'
15 | #' @examples
16 | #' df <- data.frame('symbol' = 'AAPL')
17 | #' res <- get_dividend_per_share(df)
18 | #'
19 | #' @details
20 | #' Dividend per share (DPS) is the sum of declared dividends issued by a company
21 | #' for every ordinary share outstanding. The figure is calculated by dividing
22 | #' the total dividends paid out by a business, including interim dividends, over
23 | #' a period of time, usually a year, by the number of outstanding ordinary
24 | #' shares issued.
25 |
26 | get_dividend_per_share <- function(df) {
27 |
28 | pfx <- 'divps'
29 | url <- 'https://www.gurufocus.com/term/Dividends+Per+Share/'
30 | xpath_tbl <- '//*[@id="target_def_historical_data"]/div[2]/div/table'
31 | xpath_txt <- '//*[@id="def_body_detail_height"]/font[1]'
32 |
33 | res <- suppressWarnings(scrape_key_fig(df, url, pfx, xpath_txt, xpath_tbl))
34 |
35 | return(res)
36 | }
37 |
--------------------------------------------------------------------------------
/R/get_e10.R:
--------------------------------------------------------------------------------
1 | #' @title Get E10
2 | #'
3 | #' @description Wrapper function for fetching data from
4 | #' [gurufocus.com](https://www.gurufocus.com/term/e10/AAPL/).
5 | #'
6 | #' @usage get_e10(df)
7 | #'
8 | #' @param df data.frame. Data frame with column 'symbol' containing at least one
9 | #' valid stock ticker symbol.
10 | #'
11 | #' @return Input data.frame supplemented by the company's available
12 | #' **E10** data.
13 | #' @export
14 | #'
15 | #' @examples
16 | #' df <- data.frame('symbol' = 'AAPL')
17 | #' res <- get_e10(df)
18 | #'
19 | #' @details
20 | #' E10 is a main component used to calculate Shiller PE Ratio. If the month end
21 | #' stock price for this stock is zero, result may not be accurate due to the
22 | #' exchange rate between different shares and the data will not be stored into
23 | #' our database. Selected historical data showed in the calculation section
24 | #' below is only for demonstration purpose.
25 | #' E10 is a concept invented by Prof. Robert Shiller, who uses E10 for his
26 | #' Shiller P/E calculation. E10 is the average of the inflation adjusted
27 | #' earnings of a company over the past 10 years
28 |
29 | get_e10 <- function(df) {
30 |
31 | pfx <- 'e10'
32 | url <- 'https://www.gurufocus.com/term/e10/'
33 | xpath_tbl <- '//*[@id="target_def_historical_data"]/div[2]/div/table'
34 | xpath_txt <- '//*[@id="def_body_detail_height"]/font[1]'
35 |
36 | res <- suppressWarnings(scrape_key_fig(df, url, pfx, xpath_txt, xpath_tbl))
37 |
38 | return(res)
39 | }
40 |
--------------------------------------------------------------------------------
/R/get_ebit_per_share.R:
--------------------------------------------------------------------------------
1 | #' @title Get Earnings Before Interest and Taxes per Share
2 | #'
3 | #' @description Wrapper function for fetching data from
4 | #' [gurufocus.com](https://www.gurufocus.com/term/EBIT_per_share/AAPL/).
5 | #'
6 | #' @usage get_ebit_per_share(df)
7 | #'
8 | #' @param df data.frame. Data frame with column 'symbol' containing at least one
9 | #' valid stock ticker symbol.
10 | #'
11 | #' @return Input data.frame supplemented by the company's available
12 | #' **Earnings Before Interest and Taxes per Share** data.
13 | #' @export
14 | #'
15 | #' @examples
16 | #' df <- data.frame('symbol' = 'AAPL')
17 | #' res <- get_ebit_per_share(df)
18 | #'
19 | #' @details
20 | #' EBIT per Share is the amount of Earnings Before Interest and Taxes (EBIT) per
21 | #' outstanding share of the company's stock.
22 |
23 | get_ebit_per_share <- function(df) {
24 |
25 | pfx <- 'ebitps'
26 | url <- 'https://www.gurufocus.com/term/EBIT_per_share/'
27 | xpath_tbl <- '//*[@id="target_def_historical_data"]/div[2]/div/table'
28 | xpath_txt <- '//*[@id="def_body_detail_height"]/font[1]'
29 |
30 | res <- suppressWarnings(scrape_key_fig(df, url, pfx, xpath_txt, xpath_tbl))
31 |
32 | return(res)
33 | }
34 |
--------------------------------------------------------------------------------
/R/get_ebitda_per_share.R:
--------------------------------------------------------------------------------
1 | #' @title Get Earnings Before Interest, Tax and Depreciation Per Share
2 | #'
3 | #' @description Wrapper function for fetching data from
4 | #' [gurufocus.com](https://www.gurufocus.com/term/EBITDA_per_share/AAPL/).
5 | #'
6 | #' @usage get_ebitda_per_share(df)
7 | #'
8 | #' @param df data.frame. Data frame with column 'symbol' containing at least one
9 | #' valid stock ticker symbol.
10 | #'
11 | #' @return Input data.frame supplemented by the company's available
12 | #' **Get Earnings Before Interest, Tax and Depreciation Per Share** data.
13 | #' @export
14 | #'
15 | #' @examples
16 | #' df <- data.frame('symbol' = 'AAPL')
17 | #' res <- get_ebitda_per_share(df)
18 | #'
19 | #' @details
20 | #' EBITDA per Share is the amount of Earnings Before Interest, Taxes,
21 | #' Depreciation, and Amortization (EBITDA) per outstanding share of the
22 | #' company's stock.
23 |
24 | get_ebitda_per_share <- function(df) {
25 |
26 | pfx <- 'ebitdaps'
27 | url <- 'https://www.gurufocus.com/term/EBITDA_per_share/'
28 | xpath_tbl <- '//*[@id="target_def_historical_data"]/div[2]/div/table'
29 | xpath_txt <- '//*[@id="def_body_detail_height"]/font[1]'
30 |
31 | res <- suppressWarnings(scrape_key_fig(df, url, pfx, xpath_txt, xpath_tbl))
32 |
33 | return(res)
34 | }
35 |
--------------------------------------------------------------------------------
/R/get_eff_interest_rate.R:
--------------------------------------------------------------------------------
1 | #' @title Effective Annual Interest Rate
2 | #'
3 | #' @description Wrapper function for fetching data from
4 | #' [gurufocus.com](https://www.gurufocus.com/term/turnover/AAPL/).
5 | #'
6 | #' @usage get_eff_interest_rate(df)
7 | #'
8 | #' @param df data.frame. Data frame with column 'symbol' containing at least one
9 | #' valid stock ticker symbol.
10 | #'
11 | #' @return Input data.frame supplemented by the company's available
12 | #' **Effective Annual Interest Rate** data.
13 | #' @export
14 | #'
15 | #' @examples
16 | #' df <- data.frame('symbol' = 'AAPL')
17 | #' res <- get_eff_interest_rate(df)
18 | #'
19 | #' @details
20 | #' The Effective Annual Interest Rate is the interest rate on a loan restated
21 | #' from the nominal interest rate and expressed as if compound interest was
22 | #' payable annually. It makes interest rates between loans with different
23 | #' compounding periods more comparable.
24 |
25 | get_eff_interest_rate <- function(df) {
26 |
27 | pfx <- 'EffectiveInterestRate'
28 | url <- 'https://www.gurufocus.com/term/EffectiveInterestRate/'
29 | xpath_tbl <- '//*[@id="target_def_historical_data"]/div[2]/div/table'
30 | xpath_txt <- '//*[@id="def_body_detail_height"]/font[1]'
31 |
32 | res <- suppressWarnings(scrape_key_fig(df, url, pfx, xpath_txt, xpath_tbl))
33 |
34 | return(res)
35 | }
36 |
--------------------------------------------------------------------------------
/R/get_eps_ex_nri.R:
--------------------------------------------------------------------------------
1 | #' @title Get Earnings per Share without Non-recurrent Items
2 | #'
3 | #' @description Wrapper function for fetching data from
4 | #' [gurufocus.com](https://www.gurufocus.com/term/eps_nri/AAPL/).
5 | #'
6 | #' @usage get_eps_ex_nri(df)
7 | #'
8 | #' @param df data.frame. Data frame with column 'symbol' containing at least one
9 | #' valid stock ticker symbol.
10 | #'
11 | #' @return Input data.frame supplemented by the company's available
12 | #' **Earnings per Share ex Non-recurrent Items** data.
13 | #' @export
14 | #'
15 | #' @examples
16 | #' df <- data.frame('symbol' = 'AAPL')
17 | #' res <- get_eps_ex_nri(df)
18 | #'
19 | #' @details
20 | #' The Earnings per Share without Non-recurrent Items is calculated by
21 | #' subtracting non-recurring items, the dividends of preferred stocks and
22 | #' non-operating income from the total net income. With that the measure gives
23 | #' a better impression about the real earnings power of a company.
24 |
25 | get_eps_ex_nri <- function(df) {
26 |
27 | pfx <- 'epsnri'
28 | url <- 'https://www.gurufocus.com/term/eps_nri/'
29 | xpath_tbl <- '//*[@id="target_def_historical_data"]/div[2]/div/table'
30 | xpath_txt <- '//*[@id="def_body_detail_height"]/font[1]'
31 |
32 | res <- suppressWarnings(scrape_key_fig(df, url, pfx, xpath_txt, xpath_tbl))
33 |
34 | return(res)
35 | }
36 |
--------------------------------------------------------------------------------
/R/get_equity_to_assets.R:
--------------------------------------------------------------------------------
1 | #' @title Get Equity-to-Total-Assets Ratio
2 | #'
3 | #' @description Wrapper function for fetching data from
4 | #' [gurufocus.com](https://www.gurufocus.com/term/equity2asset/AAPL/).
5 | #'
6 | #' @usage get_equity_to_assets(df)
7 | #'
8 | #' @param df data.frame. Data frame with column 'symbol' containing at least one
9 | #' valid stock ticker symbol.
10 | #'
11 | #' @return Input data.frame supplemented by the company's available
12 | #' **Equity-to-Total-Assets Ratio** data.
13 | #' @export
14 | #'
15 | #' @examples
16 | #' df <- data.frame('symbol' = 'AAPL')
17 | #' res <- get_equity_to_assets(df)
18 | #'
19 | #' @details
20 | #' The Asset-Turnover-Ratio measures the amount of equity the business or farm
21 | #' has when compared to the total assets owned by the business or farm. To
22 | #' determine the Equity-To-Asset ratio you divide the Net Worth by the Total
23 | #' Assets. This ratio is measured as a percentage.
24 |
25 | get_equity_to_assets <- function(df) {
26 |
27 | pfx <- 'equity2asset'
28 | url <- 'https://www.gurufocus.com/term/equity2asset/'
29 | xpath_tbl <- '//*[@id="target_def_historical_data"]/div[2]/div/table'
30 | xpath_txt <- '//*[@id="def_body_detail_height"]/font[1]'
31 |
32 | res <- suppressWarnings(scrape_key_fig(df, url, pfx, xpath_txt, xpath_tbl))
33 |
34 | return(res)
35 | }
36 |
--------------------------------------------------------------------------------
/R/get_ev_to_ebit.R:
--------------------------------------------------------------------------------
1 | #' @title Get Enterprise Value to Earnings before Interest Ratio
2 | #'
3 | #' @description Wrapper function for fetching data from
4 | #' [gurufocus.com](https://www.gurufocus.com/term/ev2ebit/AAPL/).
5 | #'
6 | #' @usage get_ev_to_ebit(df)
7 | #'
8 | #' @param df data.frame. Data frame with column 'symbol' containing at least one
9 | #' valid stock ticker symbol.
10 | #'
11 | #' @return Input data.frame supplemented by the company's available
12 | #' **Enterprise Value to Earnings before Interest Ratio** data.
13 | #' @export
14 | #'
15 | #' @examples
16 | #' df <- data.frame('symbol' = 'AAPL')
17 | #' res <- get_ev_to_ebit(df)
18 | #'
19 | #' @details
20 | #' The enterprise value to earnings before interest, taxes, depreciation, and
21 | #' amortization ratio (EV/EBITDA) compares the value of a company—debt
22 | #' included—to the company's cash earnings less non-cash expenses.
23 |
24 | get_ev_to_ebit <- function(df) {
25 |
26 | pfx <- 'ev2ebit'
27 | url <- 'https://www.gurufocus.com/term/ev2ebit/'
28 | xpath_tbl <- '//*[@id="target_def_historical_data"]/div[2]/div/table'
29 | xpath_txt <- '//*[@id="def_body_detail_height"]/font[1]'
30 |
31 | res <- suppressWarnings(scrape_key_fig(df, url, pfx, xpath_txt, xpath_tbl))
32 |
33 | return(res)
34 | }
35 |
--------------------------------------------------------------------------------
/R/get_ev_to_ebitda.R:
--------------------------------------------------------------------------------
1 | #' @title Get
2 | #' Enterprise-Value-to-Earnings-before-Interest-and-Depreciation-Ratio
3 | #'
4 | #' @description Wrapper function for fetching data from
5 | #' [gurufocus.com](https://www.gurufocus.com/term/ev2ebitda/AAPL/).
6 | #'
7 | #' @usage get_ev_to_ebitda(df)
8 | #'
9 | #' @param df data.frame. Data frame with column 'symbol' containing at least one
10 | #' valid stock ticker symbol.
11 | #'
12 | #' @return Input data.frame supplemented by the company's available
13 | #' **Enterprise Value to Earnings before Interest and Depreciation** data.
14 | #' @export
15 | #'
16 | #' @examples
17 | #' df <- data.frame('symbol' = 'AAPL')
18 | #' res <- get_ev_to_ebitda(df)
19 | #'
20 | #' @details
21 | #' The enterprise value to earnings before interest, taxes, depreciation, and
22 | #' amortization ratio (EV/EBITDA) compares the value of a company—debt
23 | #' included—to the company's cash earnings less non-cash expenses.
24 |
25 | get_ev_to_ebitda <- function(df) {
26 |
27 | pfx <- 'ev2ebitda'
28 | url <- 'https://www.gurufocus.com/term/ev2ebitda/'
29 | xpath_tbl <- '//*[@id="target_def_historical_data"]/div[2]/div/table'
30 | xpath_txt <- '//*[@id="def_body_detail_height"]/font[1]'
31 |
32 | res <- suppressWarnings(scrape_key_fig(df, url, pfx, xpath_txt, xpath_tbl))
33 |
34 | return(res)
35 | }
36 |
--------------------------------------------------------------------------------
/R/get_ev_to_revenue.R:
--------------------------------------------------------------------------------
1 | #' @title Get Enterprise-Value-to-Revenue Ratio
2 | #'
3 | #' @description Wrapper function for fetching data from
4 | #' [gurufocus.com](https://www.gurufocus.com/term/ev2rev/AAPL/).
5 | #'
6 | #' @usage get_ev_to_revenue(df)
7 | #'
8 | #' @param df data.frame. Data frame with column 'symbol' containing at least one
9 | #' valid stock ticker symbol.
10 | #'
11 | #' @return Input data.frame supplemented by the company's available
12 | #' **Enterprise-Value-to-Revenue Ratio** data.
13 | #' @export
14 | #'
15 | #' @examples
16 | #' df <- data.frame('symbol' = 'AAPL')
17 | #' res <- get_ev_to_revenue(df)
18 | #'
19 | #' @details
20 | #' The Enterprise-Value-to-Revenue Ratio is calculated as the company's
21 | #' enterprise value relative to its revenue. Often used to value a company
22 | #' that does not generate income/profits yet.
23 |
24 | get_ev_to_revenue <- function(df) {
25 |
26 | pfx <- 'ev2rev'
27 | url <- 'https://www.gurufocus.com/term/ev2rev/'
28 | xpath_tbl <- '//*[@id="target_def_historical_data"]/div[2]/div/table'
29 | xpath_txt <- '//*[@id="def_body_detail_height"]/font[1]'
30 |
31 | res <- suppressWarnings(scrape_key_fig(df, url, pfx, xpath_txt, xpath_tbl))
32 |
33 | return(res)
34 | }
35 |
--------------------------------------------------------------------------------
/R/get_fcf_per_share.R:
--------------------------------------------------------------------------------
1 | #' @title Get Free Cash Flow per Share
2 | #'
3 | #' @description Wrapper function for fetching data from
4 | #' [gurufocus.com](https://www.gurufocus.com/term/turnover/AAPL/).
5 | #'
6 | #' @usage get_fcf_per_share(df)
7 | #'
8 | #' @param df data.frame. Data frame with column 'symbol' containing at least one
9 | #' valid stock ticker symbol.
10 | #'
11 | #' @return Input data.frame supplemented by the company's available
12 | #' **Free Cash Flow per Share** data.
13 | #' @export
14 | #'
15 | #' @examples
16 | #' df <- data.frame('symbol' = 'AAPL')
17 | #' res <- get_fcf_per_share(df)
18 | #'
19 | #' @details
20 | #' Free cash flow per share (FCF) is a measure of a company's financial
21 | #' flexibility that is determined by dividing free cash flow by the total number
22 | #' of shares outstanding. This measure serves as a proxy for measuring changes
23 | #' in earnings per share.
24 |
25 | get_fcf_per_share <- function(df) {
26 |
27 | pfx <- 'fcfps'
28 | url <- 'https://www.gurufocus.com/term/per+share_freecashflow/'
29 | xpath_tbl <- '//*[@id="target_def_historical_data"]/div[2]/div/table'
30 | xpath_txt <- '//*[@id="def_body_detail_height"]/font[1]'
31 |
32 | res <- suppressWarnings(scrape_key_fig(df, url, pfx, xpath_txt, xpath_tbl))
33 |
34 | return(res)
35 | }
36 |
--------------------------------------------------------------------------------
/R/get_financial_distress.R:
--------------------------------------------------------------------------------
1 | #' @title Get Probability of Financial Distress
2 | #'
3 | #' @description Wrapper function for fetching data from
4 | #' [gurufocus.com](https://www.gurufocus.com/term/PFD/AAPL/).
5 | #'
6 | #' @usage get_financial_distress(df)
7 | #'
8 | #' @param df data.frame. Data frame with column 'symbol' containing at least one
9 | #' valid stock ticker symbol.
10 | #'
11 | #' @return Input data.frame supplemented by the company's available
12 | #' **Probability of Financial Distress** data.
13 | #' @export
14 | #'
15 | #' @examples
16 | #' df <- data.frame('symbol' = 'AAPL')
17 | #' res <- get_financial_distress(df)
18 | #'
19 | #' @details
20 | #' The Probability of Financial Distress measures the probability that a company
21 | #' will go bankrupt in the upcoming year given its current financial position.
22 | #' The measure is obtained by a logit probability model based on eight
23 | #' explanatory variables.
24 |
25 | get_financial_distress <- function(df) {
26 |
27 | pfx <- 'fin.distress'
28 | url <- 'https://www.gurufocus.com/term/PFD/'
29 | xpath_tbl <- '//*[@id="target_def_historical_data"]/div[2]/div/table'
30 | xpath_txt <- '//*[@id="def_body_detail_height"]/font[1]'
31 |
32 | res <- suppressWarnings(scrape_key_fig(df, url, pfx, xpath_txt, xpath_tbl))
33 |
34 | return(res)
35 | }
36 |
--------------------------------------------------------------------------------
/R/get_financial_strength.R:
--------------------------------------------------------------------------------
1 | #' @title Get Financial Strength Rank
2 | #'
3 | #' @description Wrapper function for fetching data from
4 | #' [gurufocus.com](https://www.gurufocus.com/term/rank_balancesheet/AAPL/).
5 | #'
6 | #' @usage get_financial_strength(df)
7 | #'
8 | #' @param df data.frame. Data frame with column 'symbol' containing at least one
9 | #' valid stock ticker symbol.
10 | #'
11 | #' @return Input data.frame supplemented by the company's available
12 | #' **Financial Strength Rank** data.
13 | #' @export
14 | #'
15 | #' @examples
16 | #' df <- data.frame('symbol' = 'AAPL')
17 | #' res <- get_financial_strength(df)
18 | #'
19 | #' @details
20 | #' The Financial Strength Rank measures how strong a company's financial
21 | #' situation is. The rank is base on following factors:
22 | #' \itemize{
23 | #' \item Interest Coverage
24 | #'
25 | #' \item Debt-to-Revenue Ratio
26 | #'
27 | #' \item Altman Z-score
28 | #' }
29 | #' Companies with a rank of 3 or less are likely to be in financial distress.
30 |
31 | get_financial_strength <- function(df) {
32 |
33 | pfx <- 'fin_strength'
34 | url <- 'https://www.gurufocus.com/term/rank_balancesheet/'
35 | xpath_tbl <- '//*[@id="target_def_historical_data"]/div[2]/div/table'
36 | xpath_txt <- '//*[@id="def_body_detail_height"]/font[1]'
37 |
38 | res <- suppressWarnings(scrape_key_fig(df, url, pfx, xpath_txt, xpath_tbl))
39 |
40 | return(res)
41 | }
42 |
--------------------------------------------------------------------------------
/R/get_forecasts.R:
--------------------------------------------------------------------------------
1 | get_forecasts <- function(df) {
2 |
3 | url <- 'https://www.tipranks.com/stocks/'
4 |
5 | cdf <- data.frame()
6 | rows <- nrow(df)
7 | pbar <- utils::txtProgressBar(min = 0, max = rows, style = 3)
8 |
9 | for(i in 1:rows) {
10 | utils::setTxtProgressBar(pbar, i)
11 |
12 | ticker <- df$symbol[i]
13 | print(ticker)
14 | src_url <- paste0(url, ticker, "/forecast")
15 |
16 | # Try to fetch page data in case a ticker symbol cant be resolved
17 | # (example: OTCPK:BAYRY)
18 | html_page <- tryCatch({
19 | rvest::read_html(src_url)
20 | }, error = function(e) {
21 | print(paste0("No data for ", ticker))
22 | data.frame("symbol" = ticker, "rating" = NA, "upside" = NA,
23 | "buy" = NA, "hold" = NA, "sell" = NA, "totals" = NA)
24 | }
25 | )
26 |
27 | if (is.data.frame(html_page)){
28 | cdf <- plyr::rbind.fill(cdf, html_page)
29 | next
30 | }
31 |
32 | buy_xpath <- '//*[@id="tr-stock-page-content"]/div[1]/div[4]/div[1]/div[2]/
33 | div[3]/div/div/div/div/div[2]/div[1]/span'
34 | html_node <- rvest::html_nodes(html_page, xpath = buy_xpath)
35 | html_text <- rvest::html_text(html_node)
36 | buy <- as.numeric(html_text)
37 |
38 | # When page is available a missing buy rating will be used as a proxy for
39 | # generally missing page information. (example: RTTO)
40 | if (length(buy) == 0) {
41 | table <- data.frame("symbol" = ticker, "rating" = NA, "upside" = NA,
42 | "buy" = NA, "hold" = NA, "sell" = NA, "totals" = NA)
43 | cdf <- plyr::rbind.fill(cdf, table)
44 | next
45 | }
46 |
47 | hold_xpath <- '//*[@id="tr-stock-page-content"]/div[1]/div[4]/div[1]/div[2]/
48 | div[3]/div/div/div/div/div[2]/div[2]/span'
49 | html_node <- rvest::html_nodes(html_page, xpath = hold_xpath)
50 | html_text <- rvest::html_text(html_node)
51 | hold <- as.numeric(html_text)
52 | if (length(hold) == 0) hold <- NA
53 |
54 | sell_xpath <- '//*[@id="tr-stock-page-content"]/div[1]/div[4]/div[1]/div[2]/
55 | div[3]/div/div/div/div/div[2]/div[3]/span'
56 | html_node <- rvest::html_nodes(html_page, xpath = sell_xpath)
57 | html_text <- rvest::html_text(html_node)
58 | sell <- as.numeric(html_text)
59 | if (length(sell) == 0) sell <- NA
60 |
61 | rtg_xpath <- '//*[@id="tr-stock-page-content"]/div[1]/div[4]/div[1]/div[2]/
62 | div[3]/div/div/div/div/div[1]/svg/g/text[1]'
63 | html_node <- rvest::html_nodes(html_page, xpath = rtg_xpath)
64 | html_text <- rvest::html_text(html_node)
65 | rtg <- as.numeric(html_text)
66 | if (length(rtg) == 0) rtg <- NA
67 |
68 | str_xpath <- '//*[@id="tr-stock-page-content"]/div[1]/div[4]/div[1]/div[2]/
69 | div[3]/div/div/span'
70 | html_node <- rvest::html_nodes(html_page, xpath = str_xpath)
71 | str <- rvest::html_text(html_node)
72 | if (length(str) == 0) str <- NA
73 |
74 | ups_xpath <- '//*[@id="tr-stock-page-content"]/div[1]/div[4]/div[2]/div[2]/
75 | div[3]/div/div/div[1]/div[1]/div'
76 | html_node <- rvest::html_nodes(html_page, xpath = ups_xpath)
77 | html_text <- rvest::html_text(html_node)
78 | upside <- as.numeric(gsub("[^0-9.-]+", "\\1", html_text))
79 | if (length(upside) == 0) upside <- NA
80 |
81 |
82 | table <- data.frame("symbol" = ticker,
83 | "rating" = str,
84 | "upside" = upside,
85 | "buy" = buy,
86 | "hold" = hold,
87 | "sell" = sell,
88 | "totals" = rtg)
89 |
90 | cdf <- plyr::rbind.fill(cdf, table)
91 | Sys.sleep(0.5) #To reach approx. 1 request/sec
92 | }
93 |
94 | res <- merge(df, cdf, by = "symbol", suffixes = rep("", 2))
95 | return(res)
96 |
97 | }
98 |
99 |
100 |
--------------------------------------------------------------------------------
/R/get_free_float.R:
--------------------------------------------------------------------------------
1 | #' @title Get Float Percentage of Total Shares Outstanding
2 | #'
3 | #' @description Wrapper function for fetching data from
4 | #' [gurufocus.com](https://www.gurufocus.com/term/FloatPercentageOfTSO/AAPL/).
5 | #'
6 | #' @usage get_free_floate(df)
7 | #'
8 | #' @param df data.frame. Data frame with column 'symbol' containing at least one
9 | #' valid stock ticker symbol.
10 | #'
11 | #' @return Input data.frame supplemented by the company's available
12 | #' **Float Percentage of Total Shares Outstanding** data.
13 | #' @export
14 | #'
15 | #' @examples
16 | #' df <- data.frame('symbol' = 'AAPL')
17 | #' res <- get_free_floate(df)
18 | #'
19 | #' @details
20 | #' The free float percentage, also known as float percentage of total shares
21 | #' outstanding, simply shows the percentage of shares outstanding that trade
22 | #' freely.
23 |
24 | get_free_floate <- function(df) {
25 |
26 | pfx <- 'fptso'
27 | url <- 'https://www.gurufocus.com/term/FloatPercentageOfTSO/'
28 | xpath_tbl <- '//*[@id="target_def_historical_data"]/div[2]/div/table'
29 | xpath_txt <- '//*[@id="def_body_detail_height"]/font[1]'
30 |
31 | res <- suppressWarnings(scrape_key_fig(df, url, pfx, xpath_txt, xpath_tbl))
32 |
33 | return(res)
34 | }
35 |
--------------------------------------------------------------------------------
/R/get_goodwill_to_assets.R:
--------------------------------------------------------------------------------
1 | #' @title Get Goodwill to Assets Ratio
2 | #'
3 | #' @description Wrapper function for fetching data from
4 | #' [gurufocus.com](https://www.gurufocus.com/term/goodwill2asset/AAPL/).
5 | #'
6 | #' @usage get_goodwill_to_assets(df)
7 | #'
8 | #' @param df data.frame. Data frame with column 'symbol' containing at least one
9 | #' valid stock ticker symbol.
10 | #'
11 | #' @return Input data.frame supplemented by the company's available
12 | #' **Goodwill to Asset Ratio** data.
13 | #' @export
14 | #'
15 | #' @examples
16 | #' df <- data.frame('symbol' = 'AAPL')
17 | #' res <- get_goodwill_to_assets(df)
18 | #'
19 | #' @details
20 | #' The Asset-Turnover-Ratio measures the proportion of a company's goodwill,
21 | #' which is an intangible asset, to its total assets and is a factor in that
22 | #' company's valuation. The ratio quantifies a company's brand value and other
23 | #' intangible aspects of its valuation.
24 |
25 | get_goodwill_to_assets <- function(df) {
26 |
27 | pfx <- 'goodwill2asset'
28 | url <- 'https://www.gurufocus.com/term/Goodwill-to-Asset/'
29 | xpath_tbl <- '//*[@id="target_def_historical_data"]/div[2]/div/table'
30 | xpath_txt <- '//*[@id="def_body_detail_height"]/font[1]'
31 |
32 | res <- suppressWarnings(scrape_key_fig(df, url, pfx, xpath_txt, xpath_tbl))
33 |
34 | return(res)
35 | }
36 |
--------------------------------------------------------------------------------
/R/get_greenblatt_earnings_yield.R:
--------------------------------------------------------------------------------
1 | #' @title Get Earnings Yield (Formula by Joel Greenblatt)
2 | #'
3 | #' @description Fetching *Earnings Yield (Formula by Joel Greenblatt)*
4 | #' from gurufocus.com.
5 | #'
6 | #' @usage get_greenblatt_earnings_yield(df)
7 | #'
8 | #' @param df data.frame. Data frame with column *symbol* containing at least one
9 | #' valid stock ticker symbol.
10 | #'
11 | #' @return Input data.frame supplemented by the company's available
12 | #' **Earnings Yield (Joel Greenblatt)** data.
13 | #' @export
14 | #'
15 | #' @examples
16 | #' df <- data.frame('symbol' = 'AAPL')
17 | #' res <- get_greenblatt_earnings_yield(df)
18 | #'
19 | #' @details
20 | #' *Joel Greenblatt's definition of Earnings Yield* has the same problems the
21 | #' regular earnings yield does. It does not consider the growth of the company.
22 | #' It only looks at one-year's business operation. For cyclical companies, the
23 | #' earnings yield is usually highest at the peak of the business cycle, although
24 | #' these earnings are rarely sustainable.
25 |
26 | get_greenblatt_earnings_yield <- function(df) {
27 |
28 | pfx <- 'earning_yield_greenblatt'
29 | url <- 'https://www.gurufocus.com/term/earning_yield_greenblatt/'
30 | xpath_tbl <- '//*[@id="target_def_historical_data"]/div[2]/div/table'
31 | xpath_txt <- '//*[@id="def_body_detail_height"]/font[1]'
32 |
33 | res <- suppressWarnings(scrape_key_fig(df, url, pfx, xpath_txt, xpath_tbl))
34 |
35 | return(res)
36 | }
37 |
--------------------------------------------------------------------------------
/R/get_gross_profit_to_assets.R:
--------------------------------------------------------------------------------
1 | #' @title Get Gross Profit to Asset Ratio
2 | #'
3 | #' @description Wrapper function for fetching data from
4 | #' [gurufocus.com](https://www.gurufocus.com/term/turnover/AAPL/).
5 | #'
6 | #' @usage get_gross_profit_to_assets(df)
7 | #'
8 | #' @param df data.frame. Data frame with column 'symbol' containing at least one
9 | #' valid stock ticker symbol.
10 | #'
11 | #' @return Input data.frame supplemented by the company's available
12 | #' **Gross Profit to Asset Ratio** data.
13 | #' @export
14 | #'
15 | #' @examples
16 | #' df <- data.frame('symbol' = 'AAPL')
17 | #' res <- get_gross_profit_to_assets(df)
18 | #'
19 | #' @details
20 | #' The Asset-Turnover-Ratio is calculated as Gross Profits divided by the firm's
21 | #' Total Assets. The ratio determined how efficiently a firm uses its assets to
22 | #' generate gross profits.
23 |
24 | get_gross_profit_to_assets <- function(df) {
25 |
26 | pfx <- 'grossprofit2asset'
27 | url <- 'https://www.gurufocus.com/term/grossprofit2asset/'
28 | xpath_tbl <- '//*[@id="target_def_historical_data"]/div[2]/div/table'
29 | xpath_txt <- '//*[@id="def_body_detail_height"]/font[1]'
30 |
31 | res <- suppressWarnings(scrape_key_fig(df, url, pfx, xpath_txt, xpath_tbl))
32 |
33 | return(res)
34 | }
35 |
--------------------------------------------------------------------------------
/R/get_insider_ownership.R:
--------------------------------------------------------------------------------
1 | #' @title Get Insider Ownership
2 | #'
3 | #' @description Wrapper function for fetching data from
4 | #' [gurufocus.com](https://www.gurufocus.com/term/InsiderOwnership/AAPL/).
5 | #'
6 | #' @usage get_insider_ownership(df)
7 | #'
8 | #' @param df data.frame. Data frame with column 'symbol' containing at least one
9 | #' valid stock ticker symbol.
10 | #'
11 | #' @return Input data.frame supplemented by the company's available
12 | #' **Insider Ownership** data.
13 | #' @export
14 | #'
15 | #' @examples
16 | #' df <- data.frame('symbol' = 'AAPL')
17 | #' res <- get_insider_ownership(df)
18 | #'
19 | #' @details
20 | #' The Insider Ownership is the percentage of shares that are owned by company
21 | #' insiders relative to the total shares outstanding. Insiders are a company's
22 | #' officers, directors, relatives or generally everyone with key information
23 | #' before made available to the public. High insider ownership can in many cases
24 | #' be interpreted as a signal of confidence. Larger companies have typically
25 | #' low(er) insider ownership.
26 |
27 | get_insider_ownership <- function(df) {
28 |
29 | pfx <- 'insider.own'
30 | url <- 'https://www.gurufocus.com/term/InsiderOwnership/'
31 | xpath_tbl <- '//*[@id="target_def_historical_data"]/div[2]/table'
32 | xpath_txt <- '//*[@id="def_body_detail_height"]/font[1]'
33 |
34 | res <- suppressWarnings(
35 | scrape_ownership_fig(df, url, pfx, xpath_txt, xpath_tbl))
36 |
37 | return(res)
38 | }
39 |
--------------------------------------------------------------------------------
/R/get_institutional_ownership.R:
--------------------------------------------------------------------------------
1 | #' @title Get Institutional Ownership Percentage
2 | #'
3 | #' @description Wrapper function for fetching data from
4 | #' [gurufocus.com](https://www.gurufocus.com/term/InstitutionalOwnership/AAPL/).
5 | #'
6 | #' @usage get_institutional_ownership(df)
7 | #'
8 | #' @param df data.frame. Data frame with column 'symbol' containing at least one
9 | #' valid stock ticker symbol.
10 | #'
11 | #' @return Input data.frame supplemented by the company's available
12 | #' **Institutional Ownership** data.
13 | #' @export
14 | #'
15 | #' @examples
16 | #' df <- data.frame('symbol' = 'AAPL')
17 | #' res <- get_institutional_ownership(df)
18 | #'
19 | #' @details
20 | #' The Institutional Ownership is the percentage of shares that are owned by
21 | #' mutual or pension funds, insurance companies, investment firms, private
22 | #' foundations, endowments and other large entities that manage funds on behalf
23 | #' of others relative to the total shares outstanding.High institutional
24 | #' ownership can in many cases be interpreted as a signal of confidence.
25 |
26 | get_institutional_ownership <- function(df) {
27 |
28 | pfx <- 'inst.own'
29 | url <- 'https://www.gurufocus.com/term/InstitutionalOwnership/'
30 | xpath_tbl <- '//*[@id="target_def_historical_data"]/div[2]/table'
31 | xpath_txt <- '//*[@id="def_body_detail_height"]/font[1]'
32 |
33 | res <- suppressWarnings(
34 | scrape_ownership_fig(df, url, pfx, xpath_txt, xpath_tbl))
35 |
36 | return(res)
37 | }
38 |
--------------------------------------------------------------------------------
/R/get_interest_coverage.R:
--------------------------------------------------------------------------------
1 | #' @title Get Interest Coverage
2 | #'
3 | #' @description Wrapper function for fetching data from
4 | #' [gurufocus.com](https://www.gurufocus.com/term/turnover/AAPL/).
5 | #'
6 | #' @usage get_interest_coverage(df)
7 | #'
8 | #' @param df data.frame. Data frame with column 'symbol' containing at least one
9 | #' valid stock ticker symbol.
10 | #'
11 | #' @return Input data.frame supplemented by the company's available
12 | #' **Interest Coverage** data.
13 | #' @export
14 | #'
15 | #' @examples
16 | #' df <- data.frame('symbol' = 'AAPL')
17 | #' res <- get_interest_coverage(df)
18 | #'
19 | #' @details
20 | #' The Interest Coverage measures how easily a company ca pay interest
21 | #' expenses on outstanding debt. It is calculated by diving a company's
22 | #' Operating Income by its Interest Expense. Higher a coverage are naturally
23 | #' better for the financial stability of a company.
24 |
25 | get_interest_coverage <- function(df) {
26 |
27 | pfx <- 'interest_coverage'
28 | url <- 'https://www.gurufocus.com/term/interest_coverage/'
29 | xpath_tbl <- '//*[@id="target_def_historical_data"]/div[2]/div/table'
30 | xpath_txt <- '//*[@id="def_body_detail_height"]/font[1]'
31 |
32 | res <- suppressWarnings(scrape_key_fig(df, url, pfx, xpath_txt, xpath_tbl))
33 |
34 | return(res)
35 | }
36 |
--------------------------------------------------------------------------------
/R/get_inventory_to_revenue.R:
--------------------------------------------------------------------------------
1 | #' @title Get Inventory to Revenue Ratio
2 | #'
3 | #' @description Wrapper function for fetching data from
4 | #' [gurufocus.com](https://www.gurufocus.com/term/inventory2rev/AAPL/).
5 | #'
6 | #' @usage get_inventory_to_revenue(df)
7 | #'
8 | #' @param df data.frame. Data frame with column 'symbol' containing at least one
9 | #' valid stock ticker symbol.
10 | #'
11 | #' @return Input data.frame supplemented by the company's available
12 | #' **Inventory to Revenue Ratio** data.
13 | #' @export
14 | #'
15 | #' @examples
16 | #' df <- data.frame('symbol' = 'AAPL')
17 | #' res <- get_inventory_to_revenue(df)
18 | #'
19 | #' @details
20 | #' The Asset-Turnover-Ratio measures the percentage of inventories the company
21 | #' currently has on hand to support the current amount of revenue. The ratio
22 | #' indicated of a company to manage their inventory levels.
23 |
24 | get_inventory_to_revenue <- function(df) {
25 |
26 | pfx <- 'inventory2rev'
27 | url <- 'https://www.gurufocus.com/term/inventory2rev/'
28 | xpath_tbl <- '//*[@id="target_def_historical_data"]/div[2]/div/table'
29 | xpath_txt <- '//*[@id="def_body_detail_height"]/font[1]'
30 |
31 | res <- suppressWarnings(scrape_key_fig(df, url, pfx, xpath_txt, xpath_tbl))
32 |
33 | return(res)
34 | }
35 |
--------------------------------------------------------------------------------
/R/get_inventory_turnover.R:
--------------------------------------------------------------------------------
1 | #' @title Get Inventory Turnover
2 | #'
3 | #' @description Wrapper function for fetching data from
4 | #' [gurufocus.com](https://www.gurufocus.com/term/InventoryTurnover/AAPL/).
5 | #'
6 | #' @usage get_inventory_turnover(df)
7 | #'
8 | #' @param df data.frame. Data frame with column 'symbol' containing at least one
9 | #' valid stock ticker symbol.
10 | #'
11 | #' @return Input data.frame supplemented by the company's available
12 | #' **Inventory Turnover** data.
13 | #' @export
14 | #'
15 | #' @examples
16 | #' df <- data.frame('symbol' = 'AAPL')
17 | #' res <- get_inventory_turnover(df)
18 | #'
19 | #' @details
20 | #' Inventory Turnover measures how fast the company turns over its inventory
21 | #' within a year. It is calculated as Cost of Goods Sold divided by Total
22 | #' Inventories.
23 |
24 | get_inventory_turnover <- function(df) {
25 |
26 | pfx <- 'inventory_turnover'
27 | url <- 'https://www.gurufocus.com/term/InventoryTurnover/'
28 | xpath_tbl <- '//*[@id="target_def_historical_data"]/div[2]/div/table'
29 | xpath_txt <- '//*[@id="def_body_detail_height"]/font[1]'
30 |
31 | res <- suppressWarnings(scrape_key_fig(df, url, pfx, xpath_txt, xpath_tbl))
32 |
33 | return(res)
34 | }
35 |
--------------------------------------------------------------------------------
/R/get_liabilities_to_assets.R:
--------------------------------------------------------------------------------
1 | #' @title Get Liabilities to Assets Ratio
2 | #'
3 | #' @description Wrapper function for fetching data from
4 | #' [gurufocus.com](https://www.gurufocus.com/term/turnover/AAPL/).
5 | #'
6 | #' @usage get_liabilities_to_assets(df)
7 | #'
8 | #' @param df data.frame. Data frame with column 'symbol' containing at least one
9 | #' valid stock ticker symbol.
10 | #'
11 | #' @return Input data.frame supplemented by the company's available
12 | #' **Liabilities-to-Assets-Ratiop** data.
13 | #' @export
14 | #'
15 | #' @examples
16 | #' df <- data.frame('symbol' = 'AAPL')
17 | #' res <- get_liabilities_to_assets(df)
18 | #'
19 | #' @details
20 | #' The Liabilities to Assets Ratio is a solvency ratio indicating how much of
21 | #' the company's assets are made of liabilities, calculated as total liabilities
22 | #' divided by total assets. The higher the ratio is, the more risk there is in
23 | #' the company.
24 |
25 | get_liabilities_to_assets <- function(df) {
26 |
27 | pfx <- 'liabilities2assets'
28 | url <- 'https://www.gurufocus.com/term/liabilities_to_assets/'
29 | xpath_tbl <- '//*[@id="target_def_historical_data"]/div[2]/div/table'
30 | xpath_txt <- '//*[@id="def_body_detail_height"]/font[1]'
31 |
32 | res <- suppressWarnings(scrape_key_fig(df, url, pfx, xpath_txt, xpath_tbl))
33 |
34 | return(res)
35 | }
36 |
--------------------------------------------------------------------------------
/R/get_ltd_to_total_assets.R:
--------------------------------------------------------------------------------
1 | #' @title Get Long-Term Debt to Total Asset Ratio
2 | #'
3 | #' @description Wrapper function for fetching data from
4 | #' [gurufocus.com](https://www.gurufocus.com/term/ltd2asset/AAPL/).
5 | #'
6 | #' @usage get_ltd_to_total_assets(df)
7 | #'
8 | #' @param df data.frame. Data frame with column 'symbol' containing at least one
9 | #' valid stock ticker symbol.
10 | #'
11 | #' @return Input data.frame supplemented by the company's available
12 | #' **Long-Term Debt to Total Asset Ratio** data.
13 | #' @export
14 | #'
15 | #' @examples
16 | #' df <- data.frame('symbol' = 'AAPL')
17 | #' res <- get_ltd_to_total_assets(df)
18 | #'
19 | #' @details
20 | #' The Asset-Turnover-Ratio measures the percentage if a company's assets that
21 | #' are financed with loans and financial obligations lasting more than one year.
22 | #' The ratio gives an indication about a company's ability to meet financial
23 | #' requirements for outstanding loans.
24 |
25 | get_ltd_to_total_assets <- function(df) {
26 |
27 | pfx <- 'ltd2asset'
28 | url <- 'https://www.gurufocus.com/term/ltd2asset/'
29 | xpath_tbl <- '//*[@id="target_def_historical_data"]/div[2]/div/table'
30 | xpath_txt <- '//*[@id="def_body_detail_height"]/font[1]'
31 |
32 | res <- suppressWarnings(scrape_key_fig(df, url, pfx, xpath_txt, xpath_tbl))
33 |
34 | return(res)
35 | }
36 |
--------------------------------------------------------------------------------
/R/get_net_cash_per_share.R:
--------------------------------------------------------------------------------
1 | #' @title Get Net Cash per Share
2 | #'
3 | #' @description Wrapper function for fetching data from
4 | #' [gurufocus.com](https://www.gurufocus.com/term/netcash/AAPL/).
5 | #'
6 | #' @usage get_net_cash_per_share(df)
7 | #'
8 | #' @param df data.frame. Data frame with column 'symbol' containing at least one
9 | #' valid stock ticker symbol.
10 | #'
11 | #' @return Input data.frame supplemented by the company's available
12 | #' **Net Cash per Share** data.
13 | #' @export
14 | #'
15 | #' @examples
16 | #' df <- data.frame('symbol' = 'AAPL')
17 | #' res <- get_net_cash_per_share(df)
18 | #'
19 | #' @details
20 | #' Net Cash per Share is calculated by taking all a company's cash, less all
21 | #' current liabilities and dividing that number by the total shares outstanding.
22 |
23 | get_net_cash_per_share <- function(df) {
24 |
25 | pfx <- 'ncps'
26 | url <- 'https://www.gurufocus.com/term/netcash/'
27 | xpath_tbl <- '//*[@id="target_def_historical_data"]/div[2]/div/table'
28 | xpath_txt <- '//*[@id="def_body_detail_height"]/font[1]'
29 |
30 | res <- suppressWarnings(scrape_key_fig(df, url, pfx, xpath_txt, xpath_tbl))
31 |
32 | return(res)
33 | }
34 |
--------------------------------------------------------------------------------
/R/get_net_net_working_capital.R:
--------------------------------------------------------------------------------
1 | #' @title Get Net-Net Working Capital
2 | #'
3 | #' @description Wrapper function for fetching data from
4 | #' [gurufocus.com](https://www.gurufocus.com/term/NCAV/AAPL/).
5 | #'
6 | #' @usage get_net_net_working_capital(df)
7 | #'
8 | #' @param df data.frame. Data frame with column 'symbol' containing at least one
9 | #' valid stock ticker symbol.
10 | #'
11 | #' @return Input data.frame supplemented by the company's available
12 | #' **Net-Net Working Capital** data.
13 | #' @export
14 | #'
15 | #' @examples
16 | #' df <- data.frame('symbol' = 'AAPL')
17 | #' res <- get_net_net_working_capital(df)
18 | #'
19 | #' @details
20 | #' The Net-Net Working Capital technique was developed by Benjamin Graham, in
21 | #' which a company is valued based on its net-current assets per share (NCAVPS).
22 | #' The Net-Net Working Capital is calculated based on current assets, taking
23 | #' cash and cash equivalents at full value, then reducing accounts receivable
24 | #' for doubtful accounts and reducing inventories to liquidation values. Net-net
25 | #' value is calculated by deducting total liabilities from the adjusted current
26 | #' assets. Since the measure does not consider long-term assets or liabilities,
27 | #' it is unreliable for long-term investments.
28 |
29 | get_net_net_working_capital <- function(df) {
30 |
31 | pfx <- 'nnwc'
32 | url <- 'https://www.gurufocus.com/term/NCAV/'
33 | xpath_tbl <- '//*[@id="target_def_historical_data"]/div[2]/div/table'
34 | xpath_txt <- '//*[@id="def_body_detail_height"]/font[1]'
35 |
36 | res <- suppressWarnings(scrape_key_fig(df, url, pfx, xpath_txt, xpath_tbl))
37 |
38 | return(res)
39 | }
40 |
--------------------------------------------------------------------------------
/R/get_operating_cash_flow.R:
--------------------------------------------------------------------------------
1 | #' @title Get Operating Cash Flow per Share
2 | #'
3 | #' @description Wrapper function for fetching data from
4 | #' [gurufocus.com](https://www.gurufocus.com/term/turnover/AAPL/).
5 | #'
6 | #' @usage get_operating_cash_flow(df)
7 | #'
8 | #' @param df data.frame. Data frame with column 'symbol' containing at least one
9 | #' valid stock ticker symbol.
10 | #'
11 | #' @return Input data.frame supplemented by the company's available
12 | #' **Operating Cash Flow per Share** data.
13 | #' @export
14 | #'
15 | #' @examples
16 | #' df <- data.frame('symbol' = 'AAPL')
17 | #' res <- get_operating_cash_flow(df)
18 | #'
19 | #' @details
20 | #' The Asset-Turnover-Ratio measures the value of a company's
21 | #' *Net Sales Revenue* relative to the value of its *Total Assets*. The ratio
22 | #' indicates how effectively a company is using its assets in order to generate
23 | #' sales.
24 |
25 | get_operating_cash_flow <- function(df) {
26 |
27 | pfx <- 'ocf'
28 | url <- 'https://www.gurufocus.com/term/Cash_Flow_from_Operations_per_share/'
29 | xpath_tbl <- '//*[@id="target_def_historical_data"]/div[2]/div/table'
30 | xpath_txt <- '//*[@id="def_body_detail_height"]/font[1]'
31 |
32 | res <- suppressWarnings(scrape_key_fig(df, url, pfx, xpath_txt, xpath_tbl))
33 |
34 | return(res)
35 | }
36 |
--------------------------------------------------------------------------------
/R/get_owners_eps.R:
--------------------------------------------------------------------------------
1 | #' @title Get Owners Earnings per Share
2 | #'
3 | #' @description Wrapper function for fetching data from
4 | #' [gurufocus.com](https://www.gurufocus.com/term/Owner_Earnings/AAPL/).
5 | #'
6 | #' @usage get_owners_eps(df)
7 | #'
8 | #' @param df data.frame. Data frame with column 'symbol' containing at least one
9 | #' valid stock ticker symbol.
10 | #'
11 | #' @return Input data.frame supplemented by the company's available
12 | #' **Owners Earnings per Share** data.
13 | #' @export
14 | #'
15 | #' @examples
16 | #' df <- data.frame('symbol' = 'AAPL')
17 | #' res <- get_owners_eps(df)
18 | #'
19 | #' @details
20 | #' The Owners Earnings per Share is a measure invented by Warren Buffet and
21 | #' originally described in one of his famous annual shareholder letters as
22 | #' follows: "If we think through these questions, we can gain some insights
23 | #' about what may be called 'owner earnings.' These represent (a) reported
24 | #' earnings plus (b) depreciation, depletion, amortization, and certain other
25 | #' non-cash charges such as Company N's items (1) and (4) less the average
26 | #' annual amount of capitalized expenditures for plant and equipment, etc. that
27 | #' the business requires to fully maintain its long-term competitive position
28 | #' and its unit volume. (If the business requires additional working capital to
29 | #' maintain its competitive position and unit volume, the increment also should
30 | #' be included in (c). However, businesses following the LIFO inventory method
31 | #' usually do not require additional working capital if unit volume does not
32 | #' change.)"
33 |
34 | get_owners_eps <- function(df) {
35 |
36 | pfx <- 'owners.eps'
37 | url <- 'https://www.gurufocus.com/term/Owner_Earnings/'
38 | xpath_tbl <- '//*[@id="target_def_historical_data"]/div[2]/div/table'
39 | xpath_txt <- '//*[@id="def_body_detail_height"]/font[1]'
40 |
41 | res <- suppressWarnings(scrape_key_fig(df, url, pfx, xpath_txt, xpath_tbl))
42 |
43 | return(res)
44 | }
45 |
--------------------------------------------------------------------------------
/R/get_pe_ratio.R:
--------------------------------------------------------------------------------
1 | #' @title Get Price-Earnings Ratio
2 | #'
3 | #' @description Wrapper function for fetching data from
4 | #' [gurufocus.com](https://www.gurufocus.com/term/pe/AAPL/).
5 | #'
6 | #' @usage get_pe_ratio(df)
7 | #'
8 | #' @param df data.frame. Data frame with column 'symbol' containing at least one
9 | #' valid stock ticker symbol.
10 | #'
11 | #' @return Input data.frame supplemented by the company's available
12 | #' **Price Earnings Ratio** data.
13 | #' @export
14 | #'
15 | #' @examples
16 | #' df <- data.frame('symbol' = 'AAPL')
17 | #' res <- get_pe_ratio(df)
18 | #'
19 | #' @details
20 | #' The Price-Earnings Ratio calculated by the earnings divided by the market
21 | #' capitalization of a company.
22 |
23 | get_pe_ratio <- function(df) {
24 |
25 | pfx <- 'pe'
26 | url <- 'https://www.gurufocus.com/term/pe/'
27 | xpath_tbl <- '//*[@id="target_def_historical_data"]/div[2]/div/table'
28 | xpath_txt <- '//*[@id="def_body_detail_height"]/font[1]'
29 |
30 | res <- suppressWarnings(scrape_key_fig(df, url, pfx, xpath_txt, xpath_tbl))
31 |
32 | return(res)
33 | }
34 |
--------------------------------------------------------------------------------
/R/get_pe_ratio_nri.R:
--------------------------------------------------------------------------------
1 | #' @title Get Price-Earnings Ratio without Non-Recurring Items
2 | #'
3 | #' @description Wrapper function for fetching data from
4 | #' [gurufocus.com](https://www.gurufocus.com/term/penri/AAPL/).
5 | #'
6 | #' @usage get_pe_ratio_nri(df)
7 | #'
8 | #' @param df data.frame. Data frame with column 'symbol' containing at least one
9 | #' valid stock ticker symbol.
10 | #'
11 | #' @return Input data.frame supplemented by the company's available
12 | #' **Price Earnings Ratio with Non-Recurring Items** data.
13 | #' @export
14 | #'
15 | #' @examples
16 | #' df <- data.frame('symbol' = 'AAPL')
17 | #' res <- get_pe_ratio_nri(df)
18 | #'
19 | #' @details
20 | #' The Asset-Turnover-Ratio gives the price to earnings ratio without the
21 | #' potentially misleading effects if non-recurring items (e.g. sale of a major
22 | #' asset). The ratio only considers regular operating income.
23 |
24 | get_pe_ratio_nri <- function(df) {
25 |
26 | pfx <- 'pe_nri'
27 | url <- 'https://www.gurufocus.com/term/penri/'
28 | xpath_tbl <- '//*[@id="target_def_historical_data"]/div[2]/div/table'
29 | xpath_txt <- '//*[@id="def_body_detail_height"]/font[1]'
30 |
31 | res <- suppressWarnings(scrape_key_fig(df, url, pfx, xpath_txt, xpath_tbl))
32 |
33 | return(res)
34 | }
35 |
--------------------------------------------------------------------------------
/R/get_peg_ratio.R:
--------------------------------------------------------------------------------
1 | #' @title Get Price-Earnings-Growth Ratio
2 | #'
3 | #' @description Wrapper function for fetching data from
4 | #' [gurufocus.com](https://www.gurufocus.com/term/turnover/AAPL/).
5 | #'
6 | #' @usage get_peg_ratio(df)
7 | #'
8 | #' @param df data.frame. Data frame with column 'symbol' containing at least one
9 | #' valid stock ticker symbol.
10 | #'
11 | #' @return Input data.frame supplemented by the company's available
12 | #' **Price-Earnings-Growth Ratio** data.
13 | #' @export
14 | #'
15 | #' @examples
16 | #' df <- data.frame('symbol' = 'AAPL')
17 | #' res <- get_peg_ratio(df)
18 | #'
19 | #' @details
20 | #' The Asset-Turnover-Ratio is defined by the Price-to-Earnings Ratio
21 | #' (without NRI) divided by the 5-Year EBITDA growth rate. A PEG Ratio >1 may
22 | #' indicate overvaluation of a stock, whereas as PEG Ratio <1 may indicate
23 | #' undervaluation.
24 |
25 | get_peg_ratio <- function(df) {
26 |
27 | pfx <- 'peg'
28 | url <- 'https://www.gurufocus.com/term/peg/'
29 | xpath_tbl <- '//*[@id="target_def_historical_data"]/div[2]/div/table'
30 | xpath_txt <- '//*[@id="def_body_detail_height"]/font[1]'
31 |
32 | res <- suppressWarnings(scrape_key_fig(df, url, pfx, xpath_txt, xpath_tbl))
33 |
34 | return(res)
35 | }
36 |
--------------------------------------------------------------------------------
/R/get_piotroski_f.R:
--------------------------------------------------------------------------------
1 | #' @title Get Piotroski F-Score
2 | #'
3 | #' @description Wrapper function for fetching data from
4 | #' [gurufocus.com](https://www.gurufocus.com/term/turnover/AAPL/).
5 | #'
6 | #' @usage get_piotroski_f(df)
7 | #'
8 | #' @param df data.frame. Data frame with column 'symbol' containing at least one
9 | #' valid stock ticker symbol.
10 | #'
11 | #' @return Input data.frame supplemented by the company's available
12 | #' **Piotroski F-Score** data.
13 | #' @export
14 | #'
15 | #' @examples
16 | #' df <- data.frame('symbol' = 'AAPL')
17 | #' res <- get_piotroski_f(df)
18 | #'
19 | #' @details
20 | #' The Asset-Turnover-Ratio measures the value of a company's
21 | #' *Net Sales Revenue* relative to the value of its *Total Assets*. The ratio
22 | #' indicates how effectively a company is using its assets in order to generate
23 | #' sales.
24 |
25 | get_piotroski_f <- function(df) {
26 |
27 | pfx <- 'fscore'
28 | url <- 'https://www.gurufocus.com/term/fscore/'
29 | xpath_tbl <- '//*[@id="target_def_historical_data"]/div[2]/div/table'
30 | xpath_txt <- '//*[@id="def_body_detail_height"]/font[1]'
31 |
32 | res <- suppressWarnings(scrape_key_fig(df, url, pfx, xpath_txt, xpath_tbl))
33 |
34 | return(res)
35 | }
36 |
--------------------------------------------------------------------------------
/R/get_predictability.R:
--------------------------------------------------------------------------------
1 | #' @title Get Predictability Rank
2 | #'
3 | #' @description Wrapper function for fetching data from
4 | #' [gurufocus.com](https://www.gurufocus.com/term/predictability_rank/AAPL/).
5 | #'
6 | #' @usage get_predictability(df)
7 | #'
8 | #' @param df data.frame. Data frame with column 'symbol' containing at least one
9 | #' valid stock ticker symbol.
10 | #'
11 | #' @return Input data.frame supplemented by the company's available
12 | #' **Predictability Rank** data.
13 | #' @export
14 | #'
15 | #' @examples
16 | #' df <- data.frame('symbol' = 'AAPL')
17 | #' res <- get_predictability(df)
18 | #'
19 | #' @details
20 | #' Gurufocus.com ranks the predictability of companies based on the consistency
21 | #' of their revenue per share and EBITDA (earning before interest, tax,
22 | #' depreciation and amortization) per share over the past ten fiscal years, and
23 | #' study the correlation between the stock performances and the predictability
24 | #' of the business.
25 |
26 | get_predictability <- function(df) {
27 |
28 | url <- 'https://www.gurufocus.com/term/predictability_rank/'
29 | xpath_txt <- '//*[@id="target_def_description"]/div/span'
30 |
31 | res <- suppressWarnings(scrape_predictability(df, url, xpath_txt))
32 |
33 | return(res)
34 | }
35 |
--------------------------------------------------------------------------------
/R/get_price_to_book.R:
--------------------------------------------------------------------------------
1 | #' @title Get Price to Book Ratio
2 | #'
3 | #' @description Wrapper function for fetching data from
4 | #' [gurufocus.com](https://www.gurufocus.com/term/pb/AAPL/).
5 | #'
6 | #' @usage get_price_to_book(df)
7 | #'
8 | #' @param df data.frame. Data frame with column 'symbol' containing at least one
9 | #' valid stock ticker symbol.
10 | #'
11 | #' @return Input data.frame supplemented by the company's available
12 | #' **Price to Book Ratio** data.
13 | #' @export
14 | #'
15 | #' @examples
16 | #' df <- data.frame('symbol' = 'AAPL')
17 | #' res <- get_price_to_book(df)
18 | #'
19 | #' @details
20 | #' The Asset-Turnover-Ratio measures the market price of a company to its book
21 | #' value.
22 |
23 | get_price_to_book <- function(df) {
24 |
25 | pfx <- 'pb'
26 | url <- 'https://www.gurufocus.com/term/pb/'
27 | xpath_tbl <- '//*[@id="target_def_historical_data"]/div[2]/div/table'
28 | xpath_txt <- '//*[@id="def_body_detail_height"]/font[1]'
29 |
30 | res <- suppressWarnings(scrape_key_fig(df, url, pfx, xpath_txt, xpath_tbl))
31 |
32 | return(res)
33 | }
34 |
--------------------------------------------------------------------------------
/R/get_price_to_fcf.R:
--------------------------------------------------------------------------------
1 | #' @title Get Price-to-Free-Cash-Flow-Ratio
2 | #'
3 | #' @description Wrapper function for fetching data from
4 | #' [gurufocus.com](https://www.gurufocus.com/term/pfcf/AAPL/).
5 | #'
6 | #' @usage get_price_to_fcf(df)
7 | #'
8 | #' @param df data.frame. Data frame with column 'symbol' containing at least one
9 | #' valid stock ticker symbol.
10 | #'
11 | #' @return Input data.frame supplemented by the company's available
12 | #' **Price-to-Free-Cash-Flow-Ratio** data.
13 | #' @export
14 | #'
15 | #' @examples
16 | #' df <- data.frame('symbol' = 'AAPL')
17 | #' res <- get_price_to_fcf(df)
18 | #'
19 | #' @details
20 | #' The Price-to-Free-Cash-Flow-Ratio measures a company's value relative to its
21 | #' Free Cash Flows.
22 |
23 | get_price_to_fcf <- function(df) {
24 |
25 | pfx <- 'pfcf'
26 | url <- 'https://www.gurufocus.com/term/pfcf/'
27 | xpath_tbl <- '//*[@id="target_def_historical_data"]/div[2]/div/table'
28 | xpath_txt <- '//*[@id="def_body_detail_height"]/font[1]'
29 |
30 | res <- suppressWarnings(scrape_key_fig(df, url, pfx, xpath_txt, xpath_tbl))
31 |
32 | return(res)
33 | }
34 |
--------------------------------------------------------------------------------
/R/get_price_to_opcf.R:
--------------------------------------------------------------------------------
1 | #' @title Get Price-to-Operating-Cash-Flow-Ratio
2 | #'
3 | #' @description Wrapper function for fetching data from
4 | #' [gurufocus.com](https://www.gurufocus.com/term/pocf/AAPL/).
5 | #'
6 | #' @usage get_price_to_opcf(df)
7 | #'
8 | #' @param df data.frame. Data frame with column 'symbol' containing at least one
9 | #' valid stock ticker symbol.
10 | #'
11 | #' @return Input data.frame supplemented by the company's available
12 | #' **Price-to-Operating-Cash-Flow-Ratio** data.
13 | #' @export
14 | #'
15 | #' @examples
16 | #' df <- data.frame('symbol' = 'AAPL')
17 | #' res <- get_price_to_opcf(df)
18 | #'
19 | #' @details
20 | #' The Price-to-Operating-Cash-Flow-Ratio measures a company's value relative to
21 | #' its Operating Cash Flows.
22 |
23 | get_price_to_opcf <- function(df) {
24 |
25 | pfx <- 'pocf'
26 | url <- 'https://www.gurufocus.com/term/pocf/'
27 | xpath_tbl <- '//*[@id="target_def_historical_data"]/div[2]/div/table'
28 | xpath_txt <- '//*[@id="def_body_detail_height"]/font[1]'
29 |
30 | res <- suppressWarnings(scrape_key_fig(df, url, pfx, xpath_txt, xpath_tbl))
31 |
32 | return(res)
33 | }
34 |
--------------------------------------------------------------------------------
/R/get_price_to_tangible_book.R:
--------------------------------------------------------------------------------
1 | #' @title Get Price-Tangible-Book-Ratio
2 | #'
3 | #' @description Wrapper function for fetching data from
4 | #' [gurufocus.com](https://www.gurufocus.com/term/p2tangible_book/AAPL/).
5 | #'
6 | #' @usage get_price_to_tangible_book(df)
7 | #'
8 | #' @param df data.frame. Data frame with column 'symbol' containing at least one
9 | #' valid stock ticker symbol.
10 | #'
11 | #' @return Input data.frame supplemented by the company's available
12 | #' **Price-Tangible-Book-Ratio** data.
13 | #' @export
14 | #'
15 | #' @examples
16 | #' df <- data.frame('symbol' = 'AAPL')
17 | #' res <- get_price_to_tangible_book(df)
18 | #'
19 | #' @details
20 | #' The Price-Tangible-Book-Ratio measures a company's market value to its
21 | #' tangible assets. This ratio is applicable mainly to industrial or other
22 | #' capital-intensive companies (manufacturers, miner, ...) that own a high
23 | #' proportion of hard assets.
24 |
25 | get_price_to_tangible_book <- function(df) {
26 |
27 | pfx <- 'tangible_book'
28 | url <- 'https://www.gurufocus.com/term/p2tangible_book/'
29 | xpath_tbl <- '//*[@id="target_def_historical_data"]/div[2]/div/table'
30 | xpath_txt <- '//*[@id="def_body_detail_height"]/font[1]'
31 |
32 | res <- suppressWarnings(scrape_key_fig(df, url, pfx, xpath_txt, xpath_tbl))
33 |
34 | return(res)
35 | }
36 |
--------------------------------------------------------------------------------
/R/get_profitability.R:
--------------------------------------------------------------------------------
1 | #' @title Get Profitability Rank
2 | #'
3 | #' @description Wrapper function for fetching data from
4 | #' [gurufocus.com](https://www.gurufocus.com/term/rank_profitability/AAPL/).
5 | #'
6 | #' @usage get_profitability(df)
7 | #'
8 | #' @param df data.frame. Data frame with column 'symbol' containing at least one
9 | #' valid stock ticker symbol.
10 | #'
11 | #' @return Input data.frame supplemented by the company's available
12 | #' **Profitability Rank** data.
13 | #' @export
14 | #'
15 | #' @examples
16 | #' df <- data.frame('symbol' = 'AAPL')
17 | #' res <- get_profitability(df)
18 | #'
19 | #' @details
20 | #' Gurufocus.com calculated the Profitability Rank by how profitable a company
21 | #' is and how likely the company's business will stay that way. The maximum rank
22 | #' is 10. A rank of 7 or higher means a higher profitability and may stay that
23 | #' way. A rank of 3 or lower indicates that the company has had trouble to make
24 | #' a profit.
25 | #' The Profitability Rank is based on the Operating Margin and its 5-year
26 | #' average, the Piotroski F-Score, the Consistency of the Profitability and the
27 | #' Predictability Rank (see get_predictability)
28 |
29 | get_profitability <- function(df) {
30 |
31 | url <- 'https://www.gurufocus.com/term/rank_profitability/'
32 | xpath_txt <- '//*[@id="def_body_detail_height"]/font[1]'
33 |
34 | res <- suppressWarnings(scrape_profitability(df, url, xpath_txt))
35 |
36 | return(res)
37 | }
38 |
--------------------------------------------------------------------------------
/R/get_revenue_per_share.R:
--------------------------------------------------------------------------------
1 | #' @title Get Revenue per Share
2 | #'
3 | #' @description Wrapper function for fetching data from
4 | #' [gurufocus.com](https://www.gurufocus.com/term/per+share+rev/AAPL/).
5 | #'
6 | #' @usage get_revenue_per_share(df)
7 | #'
8 | #' @param df data.frame. Data frame with column 'symbol' containing at least one
9 | #' valid stock ticker symbol.
10 | #'
11 | #' @return Input data.frame supplemented by the company's available
12 | #' **Revenue per Share** data.
13 | #' @export
14 | #'
15 | #' @examples
16 | #' df <- data.frame('symbol' = 'AAPL')
17 | #' res <- get_revenue_per_share(df)
18 | #'
19 | #' @details
20 | #' The Asset-Turnover-Ratio measures the value of a company's *Revenue* relative
21 | #' to its market capitalization.
22 |
23 | get_revenue_per_share <- function(df) {
24 |
25 | pfx <- 'rev.ps'
26 | url <- 'https://www.gurufocus.com/term/per+share+rev/'
27 | xpath_tbl <- '//*[@id="target_def_historical_data"]/div[2]/div/table'
28 | xpath_txt <- '//*[@id="def_body_detail_height"]/font[1]'
29 |
30 | res <- suppressWarnings(scrape_key_fig(df, url, pfx, xpath_txt, xpath_tbl))
31 |
32 | return(res)
33 | }
34 |
--------------------------------------------------------------------------------
/R/get_snoa.R:
--------------------------------------------------------------------------------
1 | #' @title Get Scaled Net Operating Assets
2 | #'
3 | #' @description Wrapper function for fetching data from
4 | #' [gurufocus.com](https://www.gurufocus.com/term/SNOA/AAPL/).
5 | #'
6 | #' @usage get_snoa(df)
7 | #'
8 | #' @param df data.frame. Data frame with column 'symbol' containing at least one
9 | #' valid stock ticker symbol.
10 | #'
11 | #' @return Input data.frame supplemented by the company's available
12 | #' **Scaled Net Operating Assets** data.
13 | #' @export
14 | #'
15 | #' @examples
16 | #' df <- data.frame('symbol' = 'AAPL')
17 | #' res <- get_snoa(df)
18 | #'
19 | #' @details
20 | #' Scaled Net Operating Assets (SNOA) is calculated as the difference between
21 | #' operating assets and operating liabilities, scaled by lagged total assets.
22 |
23 | get_snoa <- function(df) {
24 |
25 | pfx <- 'snoa'
26 | url <- 'https://www.gurufocus.com/term/SNOA/'
27 | xpath_tbl <- '//*[@id="target_def_historical_data"]/div[2]/div/table'
28 | xpath_txt <- '//*[@id="def_body_detail_height"]/font[1]'
29 |
30 | res <- suppressWarnings(scrape_key_fig(df, url, pfx, xpath_txt, xpath_tbl))
31 |
32 | return(res)
33 | }
34 |
--------------------------------------------------------------------------------
/R/get_table.R:
--------------------------------------------------------------------------------
1 | #' @title
2 | #' Get HTML table element
3 | #'
4 | #' @param url String. The Uniform Resource Locator of the resource of interest.
5 | #'
6 | #' @param xpath String. The XML path to an element of interest.
7 | #'
8 | #' @param name String. The prefix preceding every scraped output column.
9 | #'
10 | #' @param raw Logical. Controls whether 'gurufocus.com'-specific data processing
11 | #' shall be applied to the table.
12 | #'
13 | #' @examples
14 | #' get_table(name = 'test',
15 | #' url = 'https://www.gurufocus.com/term/cash_per_share/AAPL/',
16 | #' xpath = '//*[@id="target_def_historical_data"]/div[2]/div/table')
17 | #'
18 | #' @return The table to be found under the given XML path and URL.
19 | #' @export
20 |
21 | get_table <- function(url, xpath, name, raw = FALSE) {
22 |
23 | # Scrape annual data table ---------------------------------------------------
24 | html_page <- rvest::read_html(url)
25 | html_node <- rvest::html_nodes(html_page, xpath = xpath)
26 | html_tbl <- rvest::html_table(html_node)
27 | html_dt <- data.table::as.data.table(html_tbl)
28 |
29 | if (ncol(html_dt) == 0) return(data.frame("remove" = TRUE))
30 |
31 | if (raw) return(html_dt[, -1])
32 |
33 | # Clean annual data table ----------------------------------------------------
34 | dat_tbl <- html_dt[-1, ] # Remove header
35 |
36 | colnames(dat_tbl) <- paste0(name,
37 | substr(dat_tbl[1, ],
38 | nchar(dat_tbl[1, ]) - 1,
39 | nchar(dat_tbl[1, ]))) # Add column name prefix
40 |
41 | dat_tbl[dat_tbl == "-" | dat_tbl == ""] <- NA
42 |
43 | dat_col <- as.logical(!colSums(is.na(dat_tbl)) > 0) #keep columns unequal NA
44 | dat_res <- dat_tbl[-1, dat_col, with = FALSE]
45 | #dat_res <- dat_tbl[-1, dat_col, drop = FALSE]
46 | if (!is.data.frame(dat_res)) dat_res <- data.frame("placeholder" = dat_res)
47 | colnames(dat_res) <- colnames(dat_tbl)[dat_col]
48 |
49 | return(dat_res)
50 | }
51 |
--------------------------------------------------------------------------------
/R/get_tangible_book_per_share.R:
--------------------------------------------------------------------------------
1 | #' @title Get Tangible Book Value Per Share
2 | #'
3 | #' @description Fetching *Tangible Book Value Per Share* from gurufocus.com
4 | #'
5 | #' @usage get_tangible_book_per_share(df)
6 | #'
7 | #' @param df data.frame. Data.frame with column *symbol* containing at least one
8 | #' valid stock ticker symbol.
9 | #'
10 | #' @return Input data.frame supplemented by the company's available
11 | #' **Tangible Book Per Share** data.
12 | #' @export
13 | #'
14 | #' @examples
15 | #' df <- data.frame('symbol' = 'AAPL')
16 | #' res <- get_tangible_book_per_share(df)
17 | #'
18 | #' @details
19 | #' The *Tangible book value per share* is the value of a company's tangible
20 | #' assets divided by its current outstanding shares. The TBVPS determines the
21 | #' potential value per share of a company in the event that it must liquidate
22 | #' it's assets.
23 | #' Assets such as property and equipment are considered tangible assets.
24 |
25 | get_tangible_book_per_share <- function(df) {
26 |
27 | pfx <- 'tbvps'
28 | url <- 'https://www.gurufocus.com/term/Tangibles_book_per_share/'
29 | xpath_tbl <- '//*[@id="target_def_historical_data"]/div[2]/div/table'
30 | xpath_txt <- '//*[@id="def_body_detail_height"]/font[1]'
31 |
32 | res <- suppressWarnings(scrape_key_fig(df, url, pfx, xpath_txt, xpath_tbl))
33 |
34 | return(res)
35 | }
36 |
--------------------------------------------------------------------------------
/R/get_text.R:
--------------------------------------------------------------------------------
1 | #' @title
2 | #' Get HTML text element
3 | #'
4 | #' @param url String. The Uniform Resource Locator of the resource of interest.
5 | #'
6 | #' @param xpath String. The XML path to an element of interest.
7 | #'
8 | #' @return
9 | #' The string to be found under the given XML path and URL.
10 | #' @export
11 | #'
12 | #' @examples
13 | #' get_text(url = 'https://www.gurufocus.com/stock/AAPL/summary',
14 | #' xpath = '//*[@id="stock-header"]/div/div[1]/div[1]/div[2]/div/h1/span[1]')
15 |
16 | get_text <- function(url, xpath) {
17 |
18 | html_page <- rvest::read_html(url)
19 | html_node <- rvest::html_nodes(html_page, xpath = xpath)
20 | html_text <- rvest::html_text(html_node)
21 |
22 | return(html_text)
23 | }
24 |
--------------------------------------------------------------------------------
/R/get_total_debt_per_share.R:
--------------------------------------------------------------------------------
1 | #' @title Get Total Debt Per Share
2 | #'
3 | #' @description Wrapper function for fetching data from
4 | #' [gurufocus.com](https://www.gurufocus.com/term/Total_Debt_Per_Share/AAPL/).
5 | #'
6 | #' @usage get_total_debt_per_share(df)
7 | #'
8 | #' @param df data.frame. Data frame with column 'symbol' containing at least one
9 | #' valid stock ticker symbol.
10 | #'
11 | #' @return Input data.frame supplemented by the company's available
12 | #' **Total Debt per Share** data.
13 | #' @export
14 | #'
15 | #' @examples
16 | #' df <- data.frame('symbol' = 'AAPL')
17 | #' res <- get_total_debt_per_share(df)
18 | #'
19 | #' @details
20 | #' Total Debt per Share is calculated as total debt divided by Shares
21 | #' Outstanding (EOP). Total debt is calculated as Long-Term Debt & Capital Lease
22 | #' Obligation plus Short-Term Debt & Capital Lease Obligation.
23 |
24 | get_total_debt_per_share <- function(df) {
25 |
26 | pfx <- 'tdps'
27 | url <- 'https://www.gurufocus.com/term/Total_Debt_Per_Share/'
28 | xpath_tbl <- '//*[@id="target_def_historical_data"]/div[2]/div/table'
29 | xpath_txt <- '//*[@id="def_body_detail_height"]/font[1]'
30 |
31 | res <- suppressWarnings(scrape_key_fig(df, url, pfx, xpath_txt, xpath_tbl))
32 |
33 | return(res)
34 | }
35 |
--------------------------------------------------------------------------------
/R/get_yacktman_return.R:
--------------------------------------------------------------------------------
1 | #' @title Get Forward Rate of Return (Yacktman)
2 | #'
3 | #' @description Wrapper function for fetching data from
4 | #' [gurufocus.com](https://www.gurufocus.com/term/RateOfReturn/AAPL/).
5 | #'
6 | #' @usage get_yacktman_forward_return(df)
7 | #'
8 | #' @param df data.frame. Data frame with column 'symbol' containing at least one
9 | #' valid stock ticker symbol.
10 | #'
11 | #' @return Input data.frame supplemented by the company's available
12 | #' **Forward Rate of Return (Yacktman)** data.
13 | #' @export
14 | #'
15 | #' @examples
16 | #' df <- data.frame('symbol' = 'AAPL')
17 | #' res <- get_yacktman_forward_return(df)
18 | #'
19 | #' @details
20 | #' Yacktman defines forward rate of return as the normalized free cash flow
21 | #' yield plus real growth plus inflation. 's forward rate of return for was
22 | #' 0.00%. Unlike the Earnings Yield %, the Forward Rate of Return uses the
23 | #' normalized Free Cash Flow of the past seven years, and considers growth.
24 | #' The forward rate of return can be thought of as the return that investors
25 | #' buying the stock today can expect from it in the future.
26 |
27 | get_yacktman_forward_return <- function(df) {
28 |
29 | pfx <- 'RateOfReturn'
30 | url <- 'https://www.gurufocus.com/term/RateOfReturn/'
31 | xpath_tbl <- '//*[@id="target_def_historical_data"]/div[2]/div/table'
32 | xpath_txt <- '//*[@id="def_body_detail_height"]/font[1]'
33 |
34 | res <- suppressWarnings(scrape_key_fig(df, url, pfx, xpath_txt, xpath_tbl))
35 |
36 | return(res)
37 | }
38 |
--------------------------------------------------------------------------------
/R/get_yoy_ebitda_growth.R:
--------------------------------------------------------------------------------
1 | #' @title Get Year-over-Year Earnings before Interest, Tax and
2 | #' Appreciation Growth-Rate
3 | #'
4 | #' @description
5 | #' Fetching
6 | #' *Year-over-Year Earnings before Interest, Tax and Appreciation Growth-Rate*
7 | #' from gurufocus.com
8 | #'
9 | #' @usage get_yoy_ebitda_growth(df)
10 | #'
11 | #' @param df data.frame. Data.frame with column *symbol* containing at least one
12 | #' valid ticker symbol of a listed stock.
13 | #'
14 | #' @return Input data.frame supplemented by the company's available
15 | #' **Year-over-Year Earnings before Interest, Tax and Appreciation Growth**
16 | #' data.
17 | #' @export
18 | #'
19 | #' @examples
20 | #' df <- data.frame('symbol' = 'AAPL')
21 | #' res <- get_yoy_ebitda_growth(df)
22 | #'
23 | #' @details
24 | #' *YoY EBITDA Growth* is the percentage change of EBITDA per share.
25 |
26 | get_yoy_ebitda_growth <- function(df) {
27 |
28 | pfx <- 'yoy_ebitda_gwth'
29 | url <- 'https://www.gurufocus.com/term/growth_per_share_ebitda/'
30 | xpath_tbl <- '//*[@id="target_def_historical_data"]/div[2]/div/table'
31 | xpath_txt <- '//*[@id="def_body_detail_height"]/font[1]'
32 |
33 | res <- suppressWarnings(scrape_key_fig(df, url, pfx, xpath_txt, xpath_tbl))
34 |
35 | return(res)
36 | }
37 |
--------------------------------------------------------------------------------
/R/get_yoy_eps_growth.R:
--------------------------------------------------------------------------------
1 | #' @title Get Year-over-Year Earnings per Share Growth
2 | #'
3 | #' @description Wrapper function for fetching data from
4 | #' [gurufocus.com](https://www.gurufocus.com/term/growth_per_share_eps/AAPL/).
5 | #'
6 | #' @usage get_yoy_eps_growth(df)
7 | #'
8 | #' @param df data.frame. Data frame with column 'symbol' containing at least one
9 | #' valid stock ticker symbol.
10 | #'
11 | #' @return Input data.frame supplemented by the company's available
12 | #' **Year-over-Year Earnings per Share Growth** data.
13 | #' @export
14 | #'
15 | #' @examples
16 | #' df <- data.frame('symbol' = 'AAPL')
17 | #' res <- get_yoy_eps_growth(df)
18 | #'
19 | #' @details
20 | #' YoY EPS Growth is the percentage change of Earnings per Share (Diluted) over
21 | #' the past twelve months.
22 |
23 | get_yoy_eps_growth <- function(df) {
24 |
25 | pfx <- 'yoy_eps_gwth'
26 | url <- 'https://www.gurufocus.com/term/growth_per_share_eps/'
27 | xpath_tbl <- '//*[@id="target_def_historical_data"]/div[2]/div/table'
28 | xpath_txt <- '//*[@id="def_body_detail_height"]/font[1]'
29 |
30 | res <- suppressWarnings(scrape_key_fig(df, url, pfx, xpath_txt, xpath_tbl))
31 |
32 | return(res)
33 | }
34 |
--------------------------------------------------------------------------------
/R/get_yoy_revenue_growth.R:
--------------------------------------------------------------------------------
1 | #' @title Get Year-over-Year Revenue Per Share Growth
2 | #'
3 | #' @description Wrapper function for fetching data from
4 | #' [gurufocus.com](https://www.gurufocus.com/term/growth_per_share_rev/AAPL/).
5 | #'
6 | #' @usage get_yoy_revenue_growth(df)
7 | #'
8 | #' @param df data.frame. Data frame with column 'symbol' containing at least one
9 | #' valid stock ticker symbol.
10 | #'
11 | #' @return Input data.frame supplemented by the company's available
12 | #' **Year-over-Year Revenue Per Share Growth** data.
13 | #' @export
14 | #'
15 | #' @examples
16 | #' df <- data.frame('symbol' = 'AAPL')
17 | #' res <- get_yoy_revenue_growth(df)
18 | #'
19 | #' @details
20 | #' YoY Rev. per Sh. Growth is the percentage change of Revenue per Share over
21 | #' the past twelve months
22 |
23 | get_yoy_revenue_growth <- function(df) {
24 |
25 | pfx <- 'yoy_rps_gwth'
26 | url <- 'https://www.gurufocus.com/term/growth_per_share_rev/'
27 | xpath_tbl <- '//*[@id="target_def_historical_data"]/div[2]/div/table'
28 | xpath_txt <- '//*[@id="def_body_detail_height"]/font[1]'
29 |
30 | res <- suppressWarnings(scrape_key_fig(df, url, pfx, xpath_txt, xpath_tbl))
31 |
32 | return(res)
33 | }
34 |
--------------------------------------------------------------------------------
/R/input_merge.R:
--------------------------------------------------------------------------------
1 | #' @title Merge original data frame with scraped data
2 | #'
3 | #' Internal function. Merges data.frame resulting from web scraping to the
4 | #' data.frame provided as input of a respective function.
5 | #'
6 | #' @param df Data.frame. A data.frame to be merged to the original input.
7 | #'
8 | #' @param input Data.frame. A data.frame provided as original function input.
9 | #'
10 | #' @examples
11 | #' df <- data.frame("symbol" = "STOCK", "eps_2016" = 99)
12 | #' input <- data.frame("symbol" = "STOCK", "eps_2016" = 99, "eps_2017" = 199)
13 | #' input_merge(df = df, input = input)
14 | #' @export
15 |
16 | input_merge <- function(df = NULL, input = NULL) {
17 |
18 | # Convert columns to integer -------------------------------------------------
19 | df[2:ncol(df)] <- lapply(2 : ncol(df), function(x) as.numeric(df[[x]]))
20 | colnames(df)[1] <- 'symbol'
21 |
22 | # Merge scraped dfa with input dfa -------------------------------------------
23 | input <- merge(input, df, by = "symbol", suffixes = rep("", 2))
24 |
25 | # Clean merged dfa -----------------------------------------------------------
26 | #input <- input[, !duplicated(colnames(input))]
27 | #input[, .SD, .SDcols = unique(names(input))]
28 |
29 | # Remove insufficient row dfa from scraped KPI -------------------------------
30 | #kpi <- sub("\\_.*", "", colnames(df)[2])
31 | #kpi_col <- input[,data.table::like(names(input), "sector"), with = FALSE]
32 |
33 | ##kpi_col <- input[data.table::like(colnames(input), kpi)]
34 | ##input <- input[!apply(kpi_col, 1, function(x) sum(is.na(x))) > 3, ]
35 | ##input <- input[!duplicated(input$symbol), ]
36 |
37 | # Sort columns ---------------------------------------------------------------
38 | input.first <- input[, 1, drop = FALSE] #Keep 'symbol' in first columns
39 | input.rest <- input[, -1]
40 | input <- cbind(input.first, input.rest[ , order(names(input.rest))])
41 |
42 | input$remove <- NULL
43 | #input <- within(input, rm("remove"))
44 |
45 | return(input)
46 | }
47 |
48 |
49 |
--------------------------------------------------------------------------------
/R/regex_ttm.R:
--------------------------------------------------------------------------------
1 | #' Text-processing of key figure from gurufocus.com
2 | #'
3 | #' Internal **'quant'**-function for processing the scraped character string
4 | #' of key figures provided by gurufocus.com
5 | #'
6 | #' @usage regex_ttm(string)
7 | #'
8 | #' @param string String. The character string to be processed
9 | #'
10 | #' @return
11 | #' The input data frame supplemented by the company's respective key figures
12 | #' of the last five fiscal years plus current years TTM.
13 | #' @export
14 |
15 | regex_ttm <- function(string) {
16 |
17 | # Remove Paranthesis ---------------------------------------------------------
18 | rm_par <- gsub("\\([^\\)]+\\)", "\\1", string)
19 |
20 | # Extract number -------------------------------------------------------------
21 | extr_num <- as.numeric(gsub("[^0-9.-]+", "\\1", rm_par))
22 |
23 | return(extr_num)
24 | }
25 |
--------------------------------------------------------------------------------
/R/sanity.R:
--------------------------------------------------------------------------------
1 | #' @title
2 | #' Apply sanity checks
3 | #'
4 | #' @description
5 | #' Internal function. Applies a sanity check on given input parameter(s)
6 | #'
7 | #' @param df Data.frame. A data.frame to be checked for sanity.
8 | #'
9 | #' @return A `"data.table" "data.frame"` object.
10 |
11 | sanity <- function(df) {
12 |
13 | message <- "Column 'symbol' containing valid stock tickers required!"
14 | if (!('symbol' %in% colnames(df))) stop(message)
15 |
16 | return(NULL)
17 | }
18 |
--------------------------------------------------------------------------------
/R/scrape_key_fig.R:
--------------------------------------------------------------------------------
1 | #' @title Scrape Key Figures from gurufocus.com
2 | #'
3 | #' Main internal **'quant'**-function for scraping stock key figures from
4 | #' [gurufocus.com](https://www.gurufocus.com/dashboard)
5 | #'
6 | #' @usage scrape_key_fig(df, url, pfx, xpath_txt, xpath_tbl)
7 | #'
8 | #' @param df data.frame. Data frame with a column 'symbol' containing at least
9 | #' one valid stock ticker symbol.
10 | #'
11 | #' @param url String. The Uniform Resource Locator of the resource of interest.
12 | #'
13 | #' @param pfx String. Prefix for column names of scraped data sets.
14 | #'
15 | #' @param xpath_txt String. The XML path to a text element of interest.
16 | #'
17 | #' @param xpath_tbl String. The XML path to a table element of interest.
18 | #'
19 | #' @return
20 | #' The input data frame supplemented by a company's respective key figure value
21 | #' of the last five fiscal years plus current years TTM.
22 | #' @export
23 |
24 | scrape_key_fig<- function(df, url, pfx, xpath_txt = NULL, xpath_tbl = NULL) {
25 |
26 | sanity(df)
27 |
28 | cdf <- data.frame()
29 | rows <- nrow(df)
30 | pbar <- utils::txtProgressBar(min = 0, max = rows, style = 3)
31 |
32 | # Ticker Iteration -----------------------------------------------------------
33 | for(i in 1:rows) {
34 | utils::setTxtProgressBar(pbar, i)
35 |
36 | ticker <- df$symbol[i]
37 | src_url <- paste0(url, ticker, "/")
38 |
39 | ## Scrape table data -------------------------------------------------------
40 | table <- get_table(src_url, xpath = xpath_tbl, name = paste0(pfx, "_20"))
41 |
42 | ## Scrape text data (TTM) --------------------------------------------------
43 | ttm <- get_text(src_url, xpath_txt)
44 |
45 | ## Text processing ---------------------------------------------------------
46 | ex_num <- regex_ttm(ttm)
47 | df_num <- data.frame(ex_num)
48 | colnames(df_num) <- paste0(pfx, "_ttm")
49 |
50 | ## Bind text and table -----------------------------------------------------
51 | table <- cbind(ticker, table, df_num)
52 | colnames(table)[1] <- "symbol"
53 |
54 | ## Check for outdated dataF ------------------------------------------------
55 | if (topicality(table)) {
56 | table <- data.frame("symbol" = ticker, "ttm" = NA)
57 | names(table)[2] <- paste0(pfx, "_ttm")
58 | }
59 |
60 | ## Slot data together ------------------------------------------------------
61 | cdf <- plyr::rbind.fill(cdf, table)
62 | }
63 |
64 | # Merge scraped data with given data frame -----------------------------------
65 | res <- input_merge(df = cdf, input = df)
66 | return(res)
67 |
68 | }
69 |
--------------------------------------------------------------------------------
/R/scrape_ownership_fig.R:
--------------------------------------------------------------------------------
1 | #' @title
2 | #' Get Key Figure from gurufocus.com
3 | #'
4 | #' @description
5 | #' Function for fetching data from
6 | #' [gurufocus.com](https://www.gurufocus.com/term/InstitutionalOwnership/AAPL/).
7 | #'
8 | #' @usage scrape_ownership_fig(df, url, pfx, xpath_txt, xpath_tbl)
9 | #'
10 | #' @param df data.frame. Data frame with a column 'symbol' containing at least
11 | #' one valid stock ticker symbol.
12 | #'
13 | #' @param url String. The Uniform Resource Locator of the resource of interest.
14 | #'
15 | #' @param pfx String. Prefix for column names of scraped data sets.
16 | #'
17 | #' @param xpath_txt String. The XML path to a text element of interest.
18 | #'
19 | #' @param xpath_tbl String. The XML path to a table element of interest.
20 | #'
21 | #' @return
22 | #' The input data frame supplemented by a company's respective key figure value
23 | #' of the last five fiscal years plus current years TTM.
24 | #' @export
25 |
26 | scrape_ownership_fig <- function(df, url, pfx, xpath_txt, xpath_tbl) {
27 |
28 | sanity(df)
29 |
30 | cdf <- data.frame()
31 | rows <- nrow(df)
32 | pbar <- utils::txtProgressBar(min = 0, max = rows, style = 3)
33 |
34 | # Ticker Iteration -----------------------------------------------------------
35 | for(i in 1:rows) {
36 | utils::setTxtProgressBar(pbar, i)
37 |
38 | ticker <- df$symbol[i]
39 | src_url <- paste0(url, ticker, "/")
40 |
41 | ## Scrape table data -------------------------------------------------------
42 | table <- get_table(src_url, xpath = xpath_tbl,
43 | name = paste0(pfx, "_20"),
44 | raw = TRUE)
45 | colnames(table) <- as.character(table[1, ])
46 | table <- table[-1,]
47 |
48 | ## Scrape text data (TTM) --------------------------------------------------
49 | ttm <- get_text(src_url, xpath_txt)
50 |
51 | ## Text processing ---------------------------------------------------------
52 | ex_num <- regex_ttm(ttm)
53 |
54 | ## Check for outdated data -------------------------------------------------
55 | if (is.null(dim(table)) || length(table) == 0) {
56 | otable <- data.frame("symbol" = ticker, "ttm" = ex_num)
57 | colnames(otable)[2] <- paste0(pfx, "_ttm")
58 | } else {
59 | colnames(table) <- gsub("-", "_", paste0(pfx, "_", colnames(table)))
60 |
61 | df_ttm <- data.frame(ex_num)
62 | colnames(df_ttm) <- paste0(pfx, "_ttm")
63 | otable <- cbind(ticker, table, df_ttm)
64 | colnames(otable)[1] <- "symbol"
65 | }
66 |
67 | ## Slot data together ------------------------------------------------------
68 | cdf <- plyr::rbind.fill(cdf, otable)
69 | }
70 |
71 | # Merge scraped data with given data frame -----------------------------------
72 | res <- input_merge(df = cdf, input = df)
73 | return(res)
74 |
75 | }
76 |
--------------------------------------------------------------------------------
/R/scrape_predictability.R:
--------------------------------------------------------------------------------
1 | #' @title Helper Function for Predictability
2 | #'
3 | #' @param df data.frame
4 | #' @param url String
5 | #' @param xpath_txt String
6 | #'
7 | #' @return data.frame
8 | #' @export
9 |
10 | scrape_predictability<- function(df, url, xpath_txt) {
11 |
12 | sanity(df)
13 |
14 | df$predictability <- NA
15 | rows <- nrow(df)
16 | pbar <- utils::txtProgressBar(0, rows, style = 3)
17 |
18 | for(i in 1:rows) {
19 | utils::setTxtProgressBar(pbar, i)
20 |
21 | ticker <- df$symbol[i]
22 | src_url <- paste0(url, ticker, "/")
23 |
24 | pred_rank <- get_text(src_url, xpath = xpath_txt)
25 |
26 | if (identical(pred_rank, character(0))) df$predictability[i] <- NA
27 | else df$predictability[i] <- substr(pred_rank, 1, 1)
28 | }
29 |
30 | return(df)
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/R/scrape_profitability.R:
--------------------------------------------------------------------------------
1 | #' @title Helper Function for Profitability
2 | #'
3 | #' @usage scrape_profitability(df, url, xpath_txt)
4 | #'
5 | #' @param df data.frame
6 | #' @param url String
7 | #' @param xpath_txt String
8 | #'
9 | #' @return data.frame
10 | #' @export
11 |
12 | scrape_profitability <- function(df, url, xpath_txt) {
13 |
14 | sanity(df)
15 |
16 | df$profitability <- NA
17 | rows <- nrow(df)
18 | pbar <- utils::txtProgressBar(0, rows, style = 3)
19 |
20 | for(i in 1:rows) {
21 | utils::setTxtProgressBar(pbar, i)
22 |
23 | ticker <- df$symbol[i]
24 | src_url <- paste0(url, ticker, "/")
25 |
26 | profitability <- get_text(src_url, xpath = xpath_txt)
27 |
28 | df$profitability[i] <- regex_ttm(profitability)
29 | }
30 |
31 | return(df)
32 |
33 | }
34 |
35 |
--------------------------------------------------------------------------------
/R/topicality.R:
--------------------------------------------------------------------------------
1 | #' @title Merge original data frame with scraped data
2 | #'
3 | #' Internal function. Merges data.frame resulting from web scraping to the
4 | #' data.frame provided as input of a respective function.
5 | #'
6 | #' @param table Data.frame
7 | #'
8 | #' @examples
9 | #' df <- data.frame("symbol" = "STOCK", "eps_2016" = 99)
10 | #' topicality(df)
11 | #' @export
12 | topicality <- function(table) {
13 |
14 | # Check whether available data is outdated -----------------------------------
15 | table_years <- colnames(x = table)[2]
16 | if (identical(table_years, "remove")) return(FALSE) #remove tag (s. get_table)
17 |
18 | oldest_year <- as.numeric(substr(x = table_years,
19 | start = nchar(table_years) - 3,
20 | stop = nchar(table_years)))
21 | if(is.na(oldest_year)) return(FALSE)
22 |
23 | year_now <- data.table::year(Sys.time())
24 |
25 | if( oldest_year < (year_now - 6) | # oldest table year not older than six yrs
26 | oldest_year > (year_now + 1) | # oldest table year not in the future
27 | ncol(table) < 2) { # number table columns > 2
28 | return(TRUE)
29 | } else {
30 | return(FALSE)
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Fetching Stock Data for Fundamental Analysis
2 |
3 | The project relies on data provided by [gurufocus.com](https://www.gurufocus.com/new_index/) and [tipranks.com](https://www.tipranks.com/)
4 |
5 | This webscraping toolset provides functionalities for easily gathering stock data for up to the last five fiscal years.
6 |
7 | 📚 Extensive data for 6.000+ unique listings.
8 | :memo: More than 50 different metrics.
9 | 📅 Data for the company's last five fiscal years and current years TTM value.
10 | ♻️ Convenient merging-abilities for updating past scraping results.
11 |
12 | ## Demo
13 | 
14 |
15 | ## Prerequisite
16 |
17 | Note that the installation of 'quant' requires [RTools](https://cran.r-project.org/bin/windows/Rtools/) in order to build R and R packages from source on Windows.
18 |
19 | ## Installation
20 | ```r
21 | # Github Download 'quant'-package (dev version)
22 | devtools::install_github('OliverHennhoefer/quant')
23 | ```
24 |
25 | ## Application
26 | ```r
27 | df <- data.frame("symbol" = c("AAPL", "MSFT", "BABA"))
28 |
29 | # Diluted Earnings per Share
30 | df %>%
31 | get_diluted_eps()
32 |
33 | > Symbol EPS_2017 EPS_2018 EPS_2019 EPS_2020 EPS_2021 EPS_TTM
34 | 1 AAPL 2.30 2.98 2.97 3.28 5.61 6.04
35 | 2 BABA 2.46 3.88 4.97 7.97 8.40 3.74
36 | 3 MSFT 3.25 2.13 5.06 5.76 8.05 9.39
37 | ```
38 |
39 | Easily fetch several data for the most common financial measures or even more uncustomary ratios:
40 | ```r
41 | df <- data.frame("symbol" = c("AAPL", "MSFT", "BABA"))
42 |
43 | # Profitability Rank, Probability of Financial Distress
44 | df %>%
45 | get_profitability() %>%
46 | get_financial_distress()
47 |
48 | > Symbol Fin.Distress Profitability
49 | 1 AAPL 0.02 10
50 | 2 BABA 0.29 9
51 | 3 MSFT 0.03 10
52 | ```
53 | ## Data Providers
54 | [gurufocus.com](gurufocus.com)
55 | [tipranks.com](tipranks.com)
56 | [wikipedia.com](wikipedia.com)
57 |
--------------------------------------------------------------------------------
/man/data_gurufocus.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/data_gurufocus.R
3 | \name{data_gurufocus}
4 | \alias{data_gurufocus}
5 | \title{Fetch complete stock list of gurufocus.com}
6 | \usage{
7 | data_gurufocus()
8 | }
9 | \value{
10 | data.table data.frame
11 | }
12 | \description{
13 | Fetches the stock list provided by \url{gurufocus.com}
14 | }
15 |
--------------------------------------------------------------------------------
/man/data_nasdaq100.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/data_nasdaq100.R
3 | \name{data_nasdaq100}
4 | \alias{data_nasdaq100}
5 | \title{Fetch components of the Nasdaq-100}
6 | \usage{
7 | data_nasdaq100()
8 | }
9 | \value{
10 | data.table data.frame
11 | }
12 | \description{
13 | Fetches the list of components provided by
14 | \href{https://de.wikipedia.org/wiki/NASDAQ-100}{wikipedia.org}
15 | }
16 |
--------------------------------------------------------------------------------
/man/data_sp500.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/data_sp500.R
3 | \name{data_sp500}
4 | \alias{data_sp500}
5 | \title{Fetch components of the S&P 500}
6 | \usage{
7 | data_sp500()
8 | }
9 | \value{
10 | data.table data.frame
11 | }
12 | \description{
13 | Fetches the list of components provided by
14 | \href{n.wikipedia.org/wiki/List_of_S\%26P_500_companies}{wikipedia.org}
15 | }
16 |
--------------------------------------------------------------------------------
/man/get_altman_z.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/get_altman_z.R
3 | \name{get_altman_z}
4 | \alias{get_altman_z}
5 | \title{Get Altman Z-Score}
6 | \usage{
7 | get_altman_z(df)
8 | }
9 | \arguments{
10 | \item{df}{data.frame. Data frame with column 'symbol' containing at least one
11 | valid stock ticker symbol.}
12 | }
13 | \value{
14 | Input data.frame supplemented by the company's available
15 | \strong{Altman Z-score} data.
16 | }
17 | \description{
18 | Wrapper function for fetching data from
19 | \href{https://www.gurufocus.com/term/zscore/AAPL/}{gurufocus.com}.
20 | }
21 | \details{
22 | The Altman Z-Score quantifies the risk of bankruptcy of a company within the
23 | next two years. The Z-Score is a multivariate measure of financial distress
24 | and classifies the rated company either into the \emph{Distress Zone} (<=1.8) or
25 | into the \emph{Safe Zone} (>=3). Values in between can be seen as \emph{Grey Zone}
26 | indicating \emph{Grey Zone} indicating a latent risks of bankruptcy.
27 |
28 | The original formula for calculating the \strong{Altman Z-score} is a
29 | linear combination of five business ratios:
30 | \deqn{Z = 1.2X_{1} + 1.4X_{2} + 3.3X_{3} + 0.6X_{4} + 1.0X_{5}}
31 |
32 | \itemize{
33 | \item \eqn{X_{1}}: Ratio of working capital to total assets. Measures
34 | liquid assets in relation to the size of the company and determines the
35 | short-term company's solvency.
36 |
37 | \item \eqn{X_{2}}: Ratio of retained earnings to total assets. Determines
38 | whether the company was successful in generating profits and retaining
39 | profits for future reinvestments in the business.
40 |
41 | \item \eqn{X_{3}}: Ratio of earnings before interest and taxes to total
42 | assets. Determines how effective a company is at using its own assets for
43 | generating profits.
44 |
45 | \item \eqn{X_{4}}: Ratio of market value of equity to book value of total
46 | liabilities. Gives an impression to what extent the company's own assets
47 | can decline in value before the liabilities exceed these assets and the
48 | company becomes insolvent.
49 |
50 | \item \eqn{X_{5}}: Ratio of Sales to total assets. Common measure for
51 | determining the total asset turnover ratio that measures how effective a
52 | company is at generating revenue from its own assets.
53 | }
54 |
55 | The formula was parameterized by multivariate linear discriminant analysis
56 | applied on a data set of 33 solvent and 33 insolvent companies
57 | (see \emph{references}).
58 | }
59 | \examples{
60 | df <- data.frame('symbol' = 'AAPL')
61 | res <- get_altman_z(df)
62 |
63 | }
64 | \references{
65 | Altman, Edward I. (1968): Financial Ratios, Discriminant Analysis and the
66 | Prediction of Corporate Bankruptcy in The Journal of Finance, Volume 23,
67 | Issue 4, p. 589-610
68 |
69 | Altman, Edward I., Sanders, A. (1998): Credit Risk Measurement: Developments
70 | over the last 20 Years in Journal of Banking and Finance, Volume 21,
71 | p. 1721-1742
72 |
73 | Altman, Edward I. (2000): Predicting Financial Distress of Companies:
74 | Revisiting the Z-Score and Zeta Models, Working Paper, New York University
75 |
76 | Altman, Edward I. (2002): Revisiting Credit Scoring Models in a Basel 2
77 | Environment, Working Paper, Stern School of Business, New York University
78 |
79 | Altman, Edward I., Iwanicz-Drozdowska, Malgorzata, Laitinen, Erkki K.,
80 | Suvas, Arto (2014): Distressed Firm and Bankruptcy Prediction in an
81 | international Context: A Review and empirical Analysis of Altman's Z-Score
82 | Model, Working Paper, Stern School of Business, New York University
83 | }
84 |
--------------------------------------------------------------------------------
/man/get_asset_turnover.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/get_asset_turnover.R
3 | \name{get_asset_turnover}
4 | \alias{get_asset_turnover}
5 | \title{Get Asset-Turnover-Ratio}
6 | \usage{
7 | get_asset_turnover(df)
8 | }
9 | \arguments{
10 | \item{df}{data.frame. Data frame with column 'symbol' containing at least one
11 | valid stock ticker symbol.}
12 | }
13 | \value{
14 | Input data.frame supplemented by the company's available
15 | \strong{Asset Turnover} data.
16 | }
17 | \description{
18 | Wrapper function for fetching data from
19 | \href{https://www.gurufocus.com/term/turnover/AAPL/}{gurufocus.com}.
20 | }
21 | \details{
22 | The Asset-Turnover-Ratio measures the value of a company's
23 | \emph{Net Sales Revenue} relative to the value of its \emph{Total Assets}. The ratio
24 | indicates how effectively a company is using its assets in order to generate
25 | sales.
26 | }
27 | \examples{
28 | df <- data.frame('symbol' = 'AAPL')
29 | res <- get_asset_turnover(df)
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/man/get_beneish_m.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/get_beneish_m.R
3 | \name{get_beneish_m}
4 | \alias{get_beneish_m}
5 | \title{Get Beneish M-Score}
6 | \usage{
7 | get_beneish_m(df)
8 | }
9 | \arguments{
10 | \item{df}{data.frame. Data frame with column 'symbol' containing at least one
11 | valid stock ticker symbol.}
12 | }
13 | \value{
14 | Input data.frame supplemented by the company's available
15 | \strong{Beneish M-Score} data.
16 | }
17 | \description{
18 | Wrapper function for fetching data from
19 | \href{https://www.gurufocus.com/term/mscore/AAPL/}{gurufocus.com}.
20 |
21 | The Beneish M-Score quantifies the likelihood of reported earnings
22 | manipulation. The M-Score is a probabilistic model that classifies the rated
23 | company either into the category "Unlikely Manipulator" (M-Score>=-1.78) or
24 | "Likely Manipulator" (M-Score>-1.78). The M-Score must not be applied among
25 | financial firms like banks and insurance companies due to their very specific
26 | business characteristics.
27 | }
28 | \details{
29 | The original formula for calculating the \strong{Beneish M-Score}
30 | consists of eight financial ratios:
31 | \deqn{M = -4.84+0.92xDSRI+0.528xGMI+0.404xAQI+0.892xSGI+0.115xDEPI-0.172xSGAI
32 | +4.679xTATA-0.327xLVGI}
33 |
34 | \itemize{
35 | \item DSRI: Days Sales in Receivables Index as earnings quality metric
36 | indicates whether earnings quality is rising or falling.
37 |
38 | \item GMI: Gross Margin Index as a fundamental momentum metric indicates
39 | whether a company's profitability and pricing power is rising or falling.
40 |
41 | \item AQI: Asset Quality Index can be used to determine whether a company
42 | is excessively capitalizing expenses.
43 |
44 | \item SGI: Sales Growth Index indicates whether a company's sales are
45 | rising or falling.
46 |
47 | \item DEPI: Depreciation Index indicates whether a company is depreciating
48 | assets at faster or slower rates.
49 |
50 | \item SGAI: Sales, General and Administrative (SGA) Expenses Index
51 | indicates whether a company's SGA Expenses are rising or falling.
52 |
53 | \item LVGI: Leverage Index indicates whether a company's leverage is rising
54 | or falling.
55 |
56 | \item TATA: Total Accruals to Total Assets indicates whether a change in
57 | accounting practices may resulted in
58 | }
59 |
60 | The formula was parameterized by multivariate linear discriminant analysis
61 | applied on a data set of 33 solvent and 33 insolvent companies
62 | (see \emph{references}).
63 | }
64 | \examples{
65 | df <- data.frame('symbol' = 'AAPL')
66 | res <- get_beneish_m(df)
67 |
68 | }
69 | \references{
70 | Beneish, Messod D. (1999): The Detection of Earnings Manipulation
71 | in Financial Analysts Journal, Volume 55, Issue 5, p. 24-36
72 | }
73 |
--------------------------------------------------------------------------------
/man/get_book_value_per_share.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/get_book_value_per_share.R
3 | \name{get_book_value_per_share}
4 | \alias{get_book_value_per_share}
5 | \title{Get Book Value per Share}
6 | \usage{
7 | get_book_value_per_share(df)
8 | }
9 | \arguments{
10 | \item{df}{data.frame. Data frame with column 'symbol' containing at least one
11 | valid stock ticker symbol.}
12 | }
13 | \value{
14 | Input data.frame supplemented by the company's available
15 | \strong{Book Value per Share} data.
16 | }
17 | \description{
18 | Wrapper function for fetching data from
19 | \href{https://www.gurufocus.com/term/Book+Value+Per+Share/AAPL/}{gurufocus.com}.
20 | }
21 | \details{
22 | Book value per common share (or, simply book value per share - BVPS) is a
23 | method to calculate the per-share book value of a company based on common
24 | shareholders' equity in the company. The book value of a company is the
25 | difference between that company's total assets and total liabilities, and not
26 | its share price in the market.
27 | }
28 | \examples{
29 | df <- data.frame('symbol' = 'AAPL')
30 | res <- get_book_value_per_share(df)
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/man/get_buyback_yield.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/get_buyback_yield.R
3 | \name{get_buyback_yield}
4 | \alias{get_buyback_yield}
5 | \title{Get Buyback Yield}
6 | \usage{
7 | get_buyback_yield(df)
8 | }
9 | \arguments{
10 | \item{df}{data.frame. Data frame with column 'symbol' containing at least one
11 | valid stock ticker symbol.}
12 | }
13 | \value{
14 | Input data.frame supplemented by the company's available
15 | \strong{Buyback Yield} data.
16 | }
17 | \description{
18 | Wrapper function for fetching data from
19 | \href{https://www.gurufocus.com/term/buyback_yield/AAPL/}{gurufocus.com}.
20 | }
21 | \details{
22 | The buyback yield gives the repurchased outstanding shares in relation to the
23 | market capitalization. Higher buyback yields may indicate the managements
24 | expectation that the stock is undervalued or its attempt to prevent a hostile
25 | takeover among other reasons.
26 | }
27 | \examples{
28 | df <- data.frame('symbol' = 'AAPL')
29 | res <- get_buyback_yield(df)
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/man/get_capex_to_sales.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/get_capex_to_sales.R
3 | \name{get_capex_to_sales}
4 | \alias{get_capex_to_sales}
5 | \title{Get CAPEX-Sales-Ratio}
6 | \usage{
7 | get_capex_to_sales(df)
8 | }
9 | \arguments{
10 | \item{df}{data.frame. Data frame with column 'symbol' containing at least one
11 | valid stock ticker symbol.}
12 | }
13 | \value{
14 | Input data.frame supplemented by the company's available
15 | \strong{CAPEX-Sales-Ratio} data.
16 | }
17 | \description{
18 | Wrapper function for fetching data from
19 | \href{https://www.gurufocus.com/term/capex_to_revenue/AAPL/}{gurufocus.com}.
20 | }
21 | \details{
22 | The CAPEX-Sales-Ratio measures a company's investments into property, plant,
23 | equipment and other capital assets (CAPEX) relative to its total sales. The
24 | measure indicates how aggressively a company is reinvesting its revenue into
25 | productive assets. The interpretation of the ratio depends on how effectively
26 | a company uses its assets to produce new income.
27 | }
28 | \examples{
29 | df <- data.frame('symbol' = 'AAPL')
30 | res <- get_capex_to_sales(df)
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/man/get_cash_conv_cycle.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/get_cash_conv_cycle.R
3 | \name{get_cash_conv_cycle}
4 | \alias{get_cash_conv_cycle}
5 | \title{Get Cash Conversion Cycle}
6 | \usage{
7 | get_cash_conv_cycle(df)
8 | }
9 | \arguments{
10 | \item{df}{data.frame. Data frame with column 'symbol' containing at least one
11 | valid stock ticker symbol.}
12 | }
13 | \value{
14 | Input data.frame supplemented by the company's available
15 | \strong{Cash Conversion Cycle} data.
16 | }
17 | \description{
18 | Wrapper function for fetching data from
19 | \href{https://www.gurufocus.com/term/CCC/AAPL/}{gurufocus.com}.
20 | }
21 | \details{
22 | The Cash Conversion Cycle measures the amount of days it takes for a company
23 | to convert its investments in inventory and other resources into cash flows
24 | from sales. The measure it calculated by Days Sales Outstanding +
25 | Days Inventory - Days Payable.
26 |
27 | A negative value indicates that it takes a company longer to pay its
28 | suppliers than it takes the company to sell its inventory and collect its
29 | money. It is difficult to compare the Cash Conversion Cycle between
30 | different industries.
31 | }
32 | \examples{
33 | df <- data.frame('symbol' = 'AAPL')
34 | res <- get_cash_conv_cycle(df)
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/man/get_cash_per_share.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/get_cash_per_share.R
3 | \name{get_cash_per_share}
4 | \alias{get_cash_per_share}
5 | \title{Get Cash-per-Share}
6 | \usage{
7 | get_cash_per_share(df)
8 | }
9 | \arguments{
10 | \item{df}{data.frame. Data frame with column 'symbol' containing at least one
11 | valid stock ticker symbol.}
12 | }
13 | \value{
14 | Input data.frame supplemented by the company's available
15 | \strong{Cash-per-Share} data.
16 | }
17 | \description{
18 | Wrapper function for fetching data from
19 | \href{https://www.gurufocus.com/term/cash_per_share/AAPL/}{gurufocus.com}.
20 | }
21 | \details{
22 | Cash-per-Share gives the cash, cash equivalents and marketable securities
23 | divided by the shares outstanding.
24 | }
25 | \examples{
26 | df <- data.frame('symbol' = 'AAPL')
27 | res <- get_cash_per_share(df)
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/man/get_cash_ratio.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/get_cash_ratio.R
3 | \name{get_cash_ratio}
4 | \alias{get_cash_ratio}
5 | \title{Get Cash-Ratio}
6 | \usage{
7 | get_cash_ratio(df)
8 | }
9 | \arguments{
10 | \item{df}{data.frame. Data frame with column 'symbol' containing at least one
11 | valid stock ticker symbol.}
12 | }
13 | \value{
14 | Input data.frame supplemented by the company's available
15 | \strong{Cash-Ratio} data.
16 | }
17 | \description{
18 | Wrapper function for fetching data from
19 | \href{https://www.gurufocus.com/term/cash_ratio/AAPL/}{gurufocus.com}.
20 | }
21 | \details{
22 | The Asset-Turnover-Ratio measures the value of a company's cash, cash
23 | equivalents, marketable securities relative to its current liabilities. The
24 | ratio indicates how liquid a company is.
25 |
26 | It differs from the Cash-to-Debt-Ratio by focusing on current liabilities due
27 | in the short-term (< 1 year).
28 | }
29 | \examples{
30 | df <- data.frame('symbol' = 'AAPL')
31 | res <- get_cash_ratio(df)
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/man/get_cash_to_debt.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/get_cash_to_debt.R
3 | \name{get_cash_to_debt}
4 | \alias{get_cash_to_debt}
5 | \title{Get Cash-Debt-Ratio}
6 | \usage{
7 | get_cash_to_debt(df)
8 | }
9 | \arguments{
10 | \item{df}{data.frame. Data frame with column 'symbol' containing at least one
11 | valid stock ticker symbol.}
12 | }
13 | \value{
14 | Input data.frame supplemented by the company's available
15 | \strong{Cash-Debt-Ratio} data.
16 | }
17 | \description{
18 | Wrapper function for fetching data from
19 | \href{https://www.gurufocus.com/term/turnover/AAPL/}{gurufocus.com}.
20 | }
21 | \details{
22 | The Cash-Debt-Ratio measures a company's cash, cash equivalents, marketable
23 | securities relative to its debt. A Cash-Debt-Ratio greater 1 indicates that a
24 | company can pay off its debt using its cash on hand.
25 |
26 | It differs from the Cash-Ratio by focusing on current as well as on
27 | non-current liabilities.
28 | }
29 | \examples{
30 | df <- data.frame('symbol' = 'AAPL')
31 | res <- get_cash_to_debt(df)
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/man/get_cogs_to_revenue.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/get_cogs_to_revenue.R
3 | \name{get_cogs_to_revenue}
4 | \alias{get_cogs_to_revenue}
5 | \title{Get Cost-of-Goods-Sold-to-Revenue-Ratio}
6 | \usage{
7 | get_cogs_to_revenue(df)
8 | }
9 | \arguments{
10 | \item{df}{data.frame. Data frame with column 'symbol' containing at least one
11 | valid stock ticker symbol.}
12 | }
13 | \value{
14 | Input data.frame supplemented by the company's available
15 | \strong{Cost-of-Goods-Sold-to-Revenue-Ratio} data.
16 | }
17 | \description{
18 | Wrapper function for fetching data from
19 | \href{https://www.gurufocus.com/term/cogs2rev/AAPL/}{gurufocus.com}.
20 | }
21 | \details{
22 | The Asset-Turnover-Ratio measures the direct cost attributed to the
23 | production of the products sold relative to the total revenue generated by
24 | the company over the same time period. Higher values may indicate
25 | inefficiencies in procurement and/or production processes.
26 | }
27 | \examples{
28 | df <- data.frame('symbol' = 'AAPL')
29 | res <- get_cogs_to_revenue(df)
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/man/get_current_ratio.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/get_current_ratio.R
3 | \name{get_current_ratio}
4 | \alias{get_current_ratio}
5 | \title{Get Current Ratio}
6 | \usage{
7 | get_current_ratio(df)
8 | }
9 | \arguments{
10 | \item{df}{data.frame. Data frame with column 'symbol' containing at least one
11 | valid stock ticker symbol.}
12 | }
13 | \value{
14 | Input data.frame supplemented by the company's available
15 | \strong{Current Ratio} data.
16 | }
17 | \description{
18 | Wrapper function for fetching data from
19 | \href{https://www.gurufocus.com/term/current_ratio/AAPL/}{gurufocus.com}.
20 | }
21 | \details{
22 | The Current Ratio measures a company's ability to its shot-term obligations.
23 | }
24 | \examples{
25 | df <- data.frame('symbol' = 'AAPL')
26 | res <- get_current_ratio(df)
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/man/get_days_inventory.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/get_days_inventory.R
3 | \name{get_days_inventory}
4 | \alias{get_days_inventory}
5 | \title{Get Days Inventory}
6 | \usage{
7 | get_days_inventory(df)
8 | }
9 | \arguments{
10 | \item{df}{data.frame. Data frame with column 'symbol' containing at least one
11 | valid stock ticker symbol.}
12 | }
13 | \value{
14 | Input data.frame supplemented by the company's available
15 | \strong{Days Inventory} data.
16 | }
17 | \description{
18 | Wrapper function for fetching data from
19 | \href{https://www.gurufocus.com/term/DaysInventory/AAPL/}{gurufocus.com}.
20 | }
21 | \details{
22 | The Asset-Turnover-Ratio indicates the average time in day that a company
23 | takes to turn its inventory, including goods that are work in progress,
24 | into sales.
25 | }
26 | \examples{
27 | df <- data.frame('symbol' = 'AAPL')
28 | res <- get_days_inventory(df)
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/man/get_days_sales_outstanding.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/get_days_sales_outstanding.R
3 | \name{get_days_sales_outstanding}
4 | \alias{get_days_sales_outstanding}
5 | \title{Get Days Sales Outstanding}
6 | \usage{
7 | get_days_sales_outstanding(df)
8 | }
9 | \arguments{
10 | \item{df}{data.frame. Data frame with column 'symbol' containing at least one
11 | valid stock ticker symbol.}
12 | }
13 | \value{
14 | Input data.frame supplemented by the company's available
15 | \strong{Days Sales Outstanding} data.
16 | }
17 | \description{
18 | Wrapper function for fetching data from
19 | \href{https://www.gurufocus.com/term/DaysSalesOutstanding/AAPL/}{gurufocus.com}.
20 | }
21 | \details{
22 | The Days Sales Outstanding is the average number of days it takes a company
23 | to receive payment for a sale. A higher Days Sales Outstanding indicates the
24 | company is getting its payments quickly. Generally DSO <45 days is considered
25 | low.
26 | }
27 | \examples{
28 | df <- data.frame('symbol' = 'AAPL')
29 | res <- get_days_sales_outstanding(df)
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/man/get_debt_to_assets.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/get_debt_to_assets.R
3 | \name{get_debt_to_assets}
4 | \alias{get_debt_to_assets}
5 | \title{Get Debt to Asset Ratio}
6 | \usage{
7 | get_debt_to_assets(df)
8 | }
9 | \arguments{
10 | \item{df}{data.frame. Data frame with column 'symbol' containing at least one
11 | valid stock ticker symbol.}
12 | }
13 | \value{
14 | Input data.frame supplemented by the company's available
15 | \strong{Debt to Asset Ratio} data.
16 | }
17 | \description{
18 | Wrapper function for fetching data from
19 | \href{https://www.gurufocus.com/term/turnover/AAPL/}{gurufocus.com}.
20 | }
21 | \details{
22 | The Asset-Turnover-Ratio is a leverage ratio that defines the total amount of
23 | debt relative to a company's assets. A ratio of about >= 1 means a company
24 | owns the same amount of liabilities or more as its assets and with that is
25 | highly leveraged. Lower ratios indicate that a company owns more asset than
26 | liabilities and can meet its obligations by selling assets if needed.
27 | }
28 | \examples{
29 | df <- data.frame('symbol' = 'AAPL')
30 | res <- get_debt_to_assets(df)
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/man/get_debt_to_ebitda.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/get_debt_to_ebitda.R
3 | \name{get_debt_to_ebitda}
4 | \alias{get_debt_to_ebitda}
5 | \title{Get Debt to EBITDA}
6 | \usage{
7 | get_debt_to_ebitda(df)
8 | }
9 | \arguments{
10 | \item{df}{data.frame. Data frame with column 'symbol' containing at least one
11 | valid stock ticker symbol.}
12 | }
13 | \value{
14 | Input data.frame supplemented by the company's available
15 | \strong{Debt to EBITDA} data.
16 | }
17 | \description{
18 | Wrapper function for fetching data from
19 | \href{https://www.gurufocus.com/term/debt2ebitda/AAPL/}{gurufocus.com}.
20 | }
21 | \details{
22 | The Debt to EBITDA is a ratio measuring the amount of income generated and
23 | available to pay down debt before covering interest, taxes, depreciation,
24 | and amortization expenses. Generally, net debt-to-EBITDA ratios of less than
25 | 3 are considered acceptable. The lower the ratio, the higher the probability
26 | of the firm successfully paying off its debt. Ratios higher than 3 or 4 serve
27 | as red flags and indicate that the company may be financially distressed in
28 | the future.
29 | }
30 | \examples{
31 | df <- data.frame('symbol' = 'AAPL')
32 | res <- get_debt_to_ebitda(df)
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/man/get_debt_to_equity.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/get_debt_to_equity.R
3 | \name{get_debt_to_equity}
4 | \alias{get_debt_to_equity}
5 | \title{Get Debt to Equity Ratio}
6 | \usage{
7 | get_debt_to_equity(df)
8 | }
9 | \arguments{
10 | \item{df}{data.frame. Data frame with column 'symbol' containing at least one
11 | valid stock ticker symbol.}
12 | }
13 | \value{
14 | Input data.frame supplemented by the company's available
15 | \strong{Debt to Equity Ratio} data.
16 | }
17 | \description{
18 | Wrapper function for fetching data from
19 | \href{https://www.gurufocus.com/term/deb2equity/AAPL/}{gurufocus.com}.
20 | }
21 | \details{
22 | The debt-to-equity (D/E) ratio compares a company's total liabilities to its
23 | shareholder equity and can be used to evaluate how much leverage a company is
24 | using. Higher-leverage ratios tend to indicate a company or stock with higher
25 | risk to shareholders.
26 | }
27 | \examples{
28 | df <- data.frame('symbol' = 'AAPL')
29 | res <- get_debt_to_equity(df)
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/man/get_debt_to_revenue.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/get_debt_to_revenue.R
3 | \name{get_debt_to_revenue}
4 | \alias{get_debt_to_revenue}
5 | \title{Get Debt-to-Revenue Ratio}
6 | \usage{
7 | get_debt_to_revenue(df)
8 | }
9 | \arguments{
10 | \item{df}{data.frame. Data frame with column 'symbol' containing at least one
11 | valid stock ticker symbol.}
12 | }
13 | \value{
14 | Input data.frame supplemented by the company's available
15 | \strong{Debt to Revenue Ratio} data.
16 | }
17 | \description{
18 | Wrapper function for fetching data from
19 | \href{https://www.gurufocus.com/term/debt2rev/AAPL/}{gurufocus.com}.
20 | }
21 | \details{
22 | The Debt-to-Revenue Ratio is a personal finance measure that compares the
23 | amount of debt you have to your overall income. Lenders, including issuers of
24 | mortgages, use it as a way to measure your ability to manage the payments you
25 | make each month and repay the money you have borrowed.
26 | }
27 | \examples{
28 | df <- data.frame('symbol' = 'AAPL')
29 | res <- get_debt_to_revenue(df)
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/man/get_diluted_eps.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/get_diluted_eps.R
3 | \name{get_diluted_eps}
4 | \alias{get_diluted_eps}
5 | \title{Get Diluted Earnings per Share}
6 | \usage{
7 | get_diluted_eps(df)
8 | }
9 | \arguments{
10 | \item{df}{data.frame. Data frame with column 'symbol' containing at least one
11 | valid stock ticker symbol.}
12 | }
13 | \value{
14 | Input data.frame supplemented by the company's available
15 | **Diluted Earnings per Share ** data.
16 | }
17 | \description{
18 | Wrapper function for fetching data from
19 | \href{https://www.gurufocus.com/term/per+share+eps/AAPL/}{gurufocus.com}.
20 | }
21 | \details{
22 | The Diluted Earnings per Share calculates a company's earnings per share if
23 | all convertible securities were converted. Dilutive securities aren't common
24 | stock, but instead securities that can be converted to common stock.
25 | }
26 | \examples{
27 | df <- data.frame('symbol' = 'AAPL')
28 | res <- get_diluted_eps(df)
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/man/get_dividend_per_share.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/get_dividend_per_share.R
3 | \name{get_dividend_per_share}
4 | \alias{get_dividend_per_share}
5 | \title{Get Dividend per Share}
6 | \usage{
7 | get_dividend_per_share(df)
8 | }
9 | \arguments{
10 | \item{df}{data.frame. Data frame with column 'symbol' containing at least one
11 | valid stock ticker symbol.}
12 | }
13 | \value{
14 | Input data.frame supplemented by the company's available
15 | \strong{Dividend per Share} data.
16 | }
17 | \description{
18 | Wrapper function for fetching data from
19 | \href{https://www.gurufocus.com/term/Dividends+Per+Share/AAPL/}{gurufocus.com}.
20 | }
21 | \details{
22 | Dividend per share (DPS) is the sum of declared dividends issued by a company
23 | for every ordinary share outstanding. The figure is calculated by dividing
24 | the total dividends paid out by a business, including interim dividends, over
25 | a period of time, usually a year, by the number of outstanding ordinary
26 | shares issued.
27 | }
28 | \examples{
29 | df <- data.frame('symbol' = 'AAPL')
30 | res <- get_dividend_per_share(df)
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/man/get_e10.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/get_e10.R
3 | \name{get_e10}
4 | \alias{get_e10}
5 | \title{Get E10}
6 | \usage{
7 | get_e10(df)
8 | }
9 | \arguments{
10 | \item{df}{data.frame. Data frame with column 'symbol' containing at least one
11 | valid stock ticker symbol.}
12 | }
13 | \value{
14 | Input data.frame supplemented by the company's available
15 | \strong{E10} data.
16 | }
17 | \description{
18 | Wrapper function for fetching data from
19 | \href{https://www.gurufocus.com/term/e10/AAPL/}{gurufocus.com}.
20 | }
21 | \details{
22 | E10 is a main component used to calculate Shiller PE Ratio. If the month end
23 | stock price for this stock is zero, result may not be accurate due to the
24 | exchange rate between different shares and the data will not be stored into
25 | our database. Selected historical data showed in the calculation section
26 | below is only for demonstration purpose.
27 | E10 is a concept invented by Prof. Robert Shiller, who uses E10 for his
28 | Shiller P/E calculation. E10 is the average of the inflation adjusted
29 | earnings of a company over the past 10 years
30 | }
31 | \examples{
32 | df <- data.frame('symbol' = 'AAPL')
33 | res <- get_e10(df)
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/man/get_ebit_per_share.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/get_ebit_per_share.R
3 | \name{get_ebit_per_share}
4 | \alias{get_ebit_per_share}
5 | \title{Get Earnings Before Interest and Taxes per Share}
6 | \usage{
7 | get_ebit_per_share(df)
8 | }
9 | \arguments{
10 | \item{df}{data.frame. Data frame with column 'symbol' containing at least one
11 | valid stock ticker symbol.}
12 | }
13 | \value{
14 | Input data.frame supplemented by the company's available
15 | \strong{Earnings Before Interest and Taxes per Share} data.
16 | }
17 | \description{
18 | Wrapper function for fetching data from
19 | \href{https://www.gurufocus.com/term/EBIT_per_share/AAPL/}{gurufocus.com}.
20 | }
21 | \details{
22 | EBIT per Share is the amount of Earnings Before Interest and Taxes (EBIT) per
23 | outstanding share of the company's stock.
24 | }
25 | \examples{
26 | df <- data.frame('symbol' = 'AAPL')
27 | res <- get_ebit_per_share(df)
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/man/get_ebitda_per_share.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/get_ebitda_per_share.R
3 | \name{get_ebitda_per_share}
4 | \alias{get_ebitda_per_share}
5 | \title{Get Earnings Before Interest, Tax and Depreciation Per Share}
6 | \usage{
7 | get_ebitda_per_share(df)
8 | }
9 | \arguments{
10 | \item{df}{data.frame. Data frame with column 'symbol' containing at least one
11 | valid stock ticker symbol.}
12 | }
13 | \value{
14 | Input data.frame supplemented by the company's available
15 | \strong{Get Earnings Before Interest, Tax and Depreciation Per Share} data.
16 | }
17 | \description{
18 | Wrapper function for fetching data from
19 | \href{https://www.gurufocus.com/term/EBITDA_per_share/AAPL/}{gurufocus.com}.
20 | }
21 | \details{
22 | EBITDA per Share is the amount of Earnings Before Interest, Taxes,
23 | Depreciation, and Amortization (EBITDA) per outstanding share of the
24 | company's stock.
25 | }
26 | \examples{
27 | df <- data.frame('symbol' = 'AAPL')
28 | res <- get_ebitda_per_share(df)
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/man/get_eff_interest_rate.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/get_eff_interest_rate.R
3 | \name{get_eff_interest_rate}
4 | \alias{get_eff_interest_rate}
5 | \title{Effective Annual Interest Rate}
6 | \usage{
7 | get_eff_interest_rate(df)
8 | }
9 | \arguments{
10 | \item{df}{data.frame. Data frame with column 'symbol' containing at least one
11 | valid stock ticker symbol.}
12 | }
13 | \value{
14 | Input data.frame supplemented by the company's available
15 | \strong{Effective Annual Interest Rate} data.
16 | }
17 | \description{
18 | Wrapper function for fetching data from
19 | \href{https://www.gurufocus.com/term/turnover/AAPL/}{gurufocus.com}.
20 | }
21 | \details{
22 | The Effective Annual Interest Rate is the interest rate on a loan restated
23 | from the nominal interest rate and expressed as if compound interest was
24 | payable annually. It makes interest rates between loans with different
25 | compounding periods more comparable.
26 | }
27 | \examples{
28 | df <- data.frame('symbol' = 'AAPL')
29 | res <- get_eff_interest_rate(df)
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/man/get_eps_ex_nri.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/get_eps_ex_nri.R
3 | \name{get_eps_ex_nri}
4 | \alias{get_eps_ex_nri}
5 | \title{Get Earnings per Share without Non-recurrent Items}
6 | \usage{
7 | get_eps_ex_nri(df)
8 | }
9 | \arguments{
10 | \item{df}{data.frame. Data frame with column 'symbol' containing at least one
11 | valid stock ticker symbol.}
12 | }
13 | \value{
14 | Input data.frame supplemented by the company's available
15 | \strong{Earnings per Share ex Non-recurrent Items} data.
16 | }
17 | \description{
18 | Wrapper function for fetching data from
19 | \href{https://www.gurufocus.com/term/eps_nri/AAPL/}{gurufocus.com}.
20 | }
21 | \details{
22 | The Earnings per Share without Non-recurrent Items is calculated by
23 | subtracting non-recurring items, the dividends of preferred stocks and
24 | non-operating income from the total net income. With that the measure gives
25 | a better impression about the real earnings power of a company.
26 | }
27 | \examples{
28 | df <- data.frame('symbol' = 'AAPL')
29 | res <- get_eps_ex_nri(df)
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/man/get_equity_to_assets.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/get_equity_to_assets.R
3 | \name{get_equity_to_assets}
4 | \alias{get_equity_to_assets}
5 | \title{Get Equity-to-Total-Assets Ratio}
6 | \usage{
7 | get_equity_to_assets(df)
8 | }
9 | \arguments{
10 | \item{df}{data.frame. Data frame with column 'symbol' containing at least one
11 | valid stock ticker symbol.}
12 | }
13 | \value{
14 | Input data.frame supplemented by the company's available
15 | \strong{Equity-to-Total-Assets Ratio} data.
16 | }
17 | \description{
18 | Wrapper function for fetching data from
19 | \href{https://www.gurufocus.com/term/equity2asset/AAPL/}{gurufocus.com}.
20 | }
21 | \details{
22 | The Asset-Turnover-Ratio measures the amount of equity the business or farm
23 | has when compared to the total assets owned by the business or farm. To
24 | determine the Equity-To-Asset ratio you divide the Net Worth by the Total
25 | Assets. This ratio is measured as a percentage.
26 | }
27 | \examples{
28 | df <- data.frame('symbol' = 'AAPL')
29 | res <- get_equity_to_assets(df)
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/man/get_ev_to_ebit.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/get_ev_to_ebit.R
3 | \name{get_ev_to_ebit}
4 | \alias{get_ev_to_ebit}
5 | \title{Get Enterprise Value to Earnings before Interest Ratio}
6 | \usage{
7 | get_ev_to_ebit(df)
8 | }
9 | \arguments{
10 | \item{df}{data.frame. Data frame with column 'symbol' containing at least one
11 | valid stock ticker symbol.}
12 | }
13 | \value{
14 | Input data.frame supplemented by the company's available
15 | \strong{Enterprise Value to Earnings before Interest Ratio} data.
16 | }
17 | \description{
18 | Wrapper function for fetching data from
19 | \href{https://www.gurufocus.com/term/ev2ebit/AAPL/}{gurufocus.com}.
20 | }
21 | \details{
22 | The enterprise value to earnings before interest, taxes, depreciation, and
23 | amortization ratio (EV/EBITDA) compares the value of a company—debt
24 | included—to the company's cash earnings less non-cash expenses.
25 | }
26 | \examples{
27 | df <- data.frame('symbol' = 'AAPL')
28 | res <- get_ev_to_ebit(df)
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/man/get_ev_to_ebitda.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/get_ev_to_ebitda.R
3 | \name{get_ev_to_ebitda}
4 | \alias{get_ev_to_ebitda}
5 | \title{Get
6 | Enterprise-Value-to-Earnings-before-Interest-and-Depreciation-Ratio}
7 | \usage{
8 | get_ev_to_ebitda(df)
9 | }
10 | \arguments{
11 | \item{df}{data.frame. Data frame with column 'symbol' containing at least one
12 | valid stock ticker symbol.}
13 | }
14 | \value{
15 | Input data.frame supplemented by the company's available
16 | \strong{Enterprise Value to Earnings before Interest and Depreciation} data.
17 | }
18 | \description{
19 | Wrapper function for fetching data from
20 | \href{https://www.gurufocus.com/term/ev2ebitda/AAPL/}{gurufocus.com}.
21 | }
22 | \details{
23 | The enterprise value to earnings before interest, taxes, depreciation, and
24 | amortization ratio (EV/EBITDA) compares the value of a company—debt
25 | included—to the company's cash earnings less non-cash expenses.
26 | }
27 | \examples{
28 | df <- data.frame('symbol' = 'AAPL')
29 | res <- get_ev_to_ebitda(df)
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/man/get_ev_to_revenue.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/get_ev_to_revenue.R
3 | \name{get_ev_to_revenue}
4 | \alias{get_ev_to_revenue}
5 | \title{Get Enterprise-Value-to-Revenue Ratio}
6 | \usage{
7 | get_ev_to_revenue(df)
8 | }
9 | \arguments{
10 | \item{df}{data.frame. Data frame with column 'symbol' containing at least one
11 | valid stock ticker symbol.}
12 | }
13 | \value{
14 | Input data.frame supplemented by the company's available
15 | \strong{Enterprise-Value-to-Revenue Ratio} data.
16 | }
17 | \description{
18 | Wrapper function for fetching data from
19 | \href{https://www.gurufocus.com/term/ev2rev/AAPL/}{gurufocus.com}.
20 | }
21 | \details{
22 | The Enterprise-Value-to-Revenue Ratio is calculated as the company's
23 | enterprise value relative to its revenue. Often used to value a company
24 | that does not generate income/profits yet.
25 | }
26 | \examples{
27 | df <- data.frame('symbol' = 'AAPL')
28 | res <- get_ev_to_revenue(df)
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/man/get_fcf_per_share.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/get_fcf_per_share.R
3 | \name{get_fcf_per_share}
4 | \alias{get_fcf_per_share}
5 | \title{Get Free Cash Flow per Share}
6 | \usage{
7 | get_fcf_per_share(df)
8 | }
9 | \arguments{
10 | \item{df}{data.frame. Data frame with column 'symbol' containing at least one
11 | valid stock ticker symbol.}
12 | }
13 | \value{
14 | Input data.frame supplemented by the company's available
15 | \strong{Free Cash Flow per Share} data.
16 | }
17 | \description{
18 | Wrapper function for fetching data from
19 | \href{https://www.gurufocus.com/term/turnover/AAPL/}{gurufocus.com}.
20 | }
21 | \details{
22 | Free cash flow per share (FCF) is a measure of a company's financial
23 | flexibility that is determined by dividing free cash flow by the total number
24 | of shares outstanding. This measure serves as a proxy for measuring changes
25 | in earnings per share.
26 | }
27 | \examples{
28 | df <- data.frame('symbol' = 'AAPL')
29 | res <- get_fcf_per_share(df)
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/man/get_financial_distress.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/get_financial_distress.R
3 | \name{get_financial_distress}
4 | \alias{get_financial_distress}
5 | \title{Get Probability of Financial Distress}
6 | \usage{
7 | get_financial_distress(df)
8 | }
9 | \arguments{
10 | \item{df}{data.frame. Data frame with column 'symbol' containing at least one
11 | valid stock ticker symbol.}
12 | }
13 | \value{
14 | Input data.frame supplemented by the company's available
15 | \strong{Probability of Financial Distress} data.
16 | }
17 | \description{
18 | Wrapper function for fetching data from
19 | \href{https://www.gurufocus.com/term/PFD/AAPL/}{gurufocus.com}.
20 | }
21 | \details{
22 | The Probability of Financial Distress measures the probability that a company
23 | will go bankrupt in the upcoming year given its current financial position.
24 | The measure is obtained by a logit probability model based on eight
25 | explanatory variables.
26 | }
27 | \examples{
28 | df <- data.frame('symbol' = 'AAPL')
29 | res <- get_financial_distress(df)
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/man/get_financial_strength.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/get_financial_strength.R
3 | \name{get_financial_strength}
4 | \alias{get_financial_strength}
5 | \title{Get Financial Strength Rank}
6 | \usage{
7 | get_financial_strength(df)
8 | }
9 | \arguments{
10 | \item{df}{data.frame. Data frame with column 'symbol' containing at least one
11 | valid stock ticker symbol.}
12 | }
13 | \value{
14 | Input data.frame supplemented by the company's available
15 | \strong{Financial Strength Rank} data.
16 | }
17 | \description{
18 | Wrapper function for fetching data from
19 | \href{https://www.gurufocus.com/term/rank_balancesheet/AAPL/}{gurufocus.com}.
20 | }
21 | \details{
22 | The Financial Strength Rank measures how strong a company's financial
23 | situation is. The rank is base on following factors:
24 | \itemize{
25 | \item Interest Coverage
26 |
27 | \item Debt-to-Revenue Ratio
28 |
29 | \item Altman Z-score
30 | }
31 | Companies with a rank of 3 or less are likely to be in financial distress.
32 | }
33 | \examples{
34 | df <- data.frame('symbol' = 'AAPL')
35 | res <- get_financial_strength(df)
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/man/get_free_floate.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/get_free_float.R
3 | \name{get_free_floate}
4 | \alias{get_free_floate}
5 | \title{Get Float Percentage of Total Shares Outstanding}
6 | \usage{
7 | get_free_floate(df)
8 | }
9 | \arguments{
10 | \item{df}{data.frame. Data frame with column 'symbol' containing at least one
11 | valid stock ticker symbol.}
12 | }
13 | \value{
14 | Input data.frame supplemented by the company's available
15 | \strong{Float Percentage of Total Shares Outstanding} data.
16 | }
17 | \description{
18 | Wrapper function for fetching data from
19 | \href{https://www.gurufocus.com/term/FloatPercentageOfTSO/AAPL/}{gurufocus.com}.
20 | }
21 | \details{
22 | The free float percentage, also known as float percentage of total shares
23 | outstanding, simply shows the percentage of shares outstanding that trade
24 | freely.
25 | }
26 | \examples{
27 | df <- data.frame('symbol' = 'AAPL')
28 | res <- get_free_floate(df)
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/man/get_goodwill_to_assets.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/get_goodwill_to_assets.R
3 | \name{get_goodwill_to_assets}
4 | \alias{get_goodwill_to_assets}
5 | \title{Get Goodwill to Assets Ratio}
6 | \usage{
7 | get_goodwill_to_assets(df)
8 | }
9 | \arguments{
10 | \item{df}{data.frame. Data frame with column 'symbol' containing at least one
11 | valid stock ticker symbol.}
12 | }
13 | \value{
14 | Input data.frame supplemented by the company's available
15 | \strong{Goodwill to Asset Ratio} data.
16 | }
17 | \description{
18 | Wrapper function for fetching data from
19 | \href{https://www.gurufocus.com/term/goodwill2asset/AAPL/}{gurufocus.com}.
20 | }
21 | \details{
22 | The Asset-Turnover-Ratio measures the proportion of a company's goodwill,
23 | which is an intangible asset, to its total assets and is a factor in that
24 | company's valuation. The ratio quantifies a company's brand value and other
25 | intangible aspects of its valuation.
26 | }
27 | \examples{
28 | df <- data.frame('symbol' = 'AAPL')
29 | res <- get_goodwill_to_assets(df)
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/man/get_greenblatt_earnings_yield.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/get_greenblatt_earnings_yield.R
3 | \name{get_greenblatt_earnings_yield}
4 | \alias{get_greenblatt_earnings_yield}
5 | \title{Get Earnings Yield (Formula by Joel Greenblatt)}
6 | \usage{
7 | get_greenblatt_earnings_yield(df)
8 | }
9 | \arguments{
10 | \item{df}{data.frame. Data frame with column \emph{symbol} containing at least one
11 | valid stock ticker symbol.}
12 | }
13 | \value{
14 | Input data.frame supplemented by the company's available
15 | \strong{Earnings Yield (Joel Greenblatt)} data.
16 | }
17 | \description{
18 | Fetching \emph{Earnings Yield (Formula by Joel Greenblatt)}
19 | from gurufocus.com.
20 | }
21 | \details{
22 | \emph{Joel Greenblatt's definition of Earnings Yield} has the same problems the
23 | regular earnings yield does. It does not consider the growth of the company.
24 | It only looks at one-year's business operation. For cyclical companies, the
25 | earnings yield is usually highest at the peak of the business cycle, although
26 | these earnings are rarely sustainable.
27 | }
28 | \examples{
29 | df <- data.frame('symbol' = 'AAPL')
30 | res <- get_greenblatt_earnings_yield(df)
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/man/get_gross_profit_to_assets.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/get_gross_profit_to_assets.R
3 | \name{get_gross_profit_to_assets}
4 | \alias{get_gross_profit_to_assets}
5 | \title{Get Gross Profit to Asset Ratio}
6 | \usage{
7 | get_gross_profit_to_assets(df)
8 | }
9 | \arguments{
10 | \item{df}{data.frame. Data frame with column 'symbol' containing at least one
11 | valid stock ticker symbol.}
12 | }
13 | \value{
14 | Input data.frame supplemented by the company's available
15 | \strong{Gross Profit to Asset Ratio} data.
16 | }
17 | \description{
18 | Wrapper function for fetching data from
19 | \href{https://www.gurufocus.com/term/turnover/AAPL/}{gurufocus.com}.
20 | }
21 | \details{
22 | The Asset-Turnover-Ratio is calculated as Gross Profits divided by the firm's
23 | Total Assets. The ratio determined how efficiently a firm uses its assets to
24 | generate gross profits.
25 | }
26 | \examples{
27 | df <- data.frame('symbol' = 'AAPL')
28 | res <- get_gross_profit_to_assets(df)
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/man/get_insider_ownership.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/get_insider_ownership.R
3 | \name{get_insider_ownership}
4 | \alias{get_insider_ownership}
5 | \title{Get Insider Ownership}
6 | \usage{
7 | get_insider_ownership(df)
8 | }
9 | \arguments{
10 | \item{df}{data.frame. Data frame with column 'symbol' containing at least one
11 | valid stock ticker symbol.}
12 | }
13 | \value{
14 | Input data.frame supplemented by the company's available
15 | \strong{Insider Ownership} data.
16 | }
17 | \description{
18 | Wrapper function for fetching data from
19 | \href{https://www.gurufocus.com/term/InsiderOwnership/AAPL/}{gurufocus.com}.
20 | }
21 | \details{
22 | The Insider Ownership is the percentage of shares that are owned by company
23 | insiders relative to the total shares outstanding. Insiders are a company's
24 | officers, directors, relatives or generally everyone with key information
25 | before made available to the public. High insider ownership can in many cases
26 | be interpreted as a signal of confidence. Larger companies have typically
27 | low(er) insider ownership.
28 | }
29 | \examples{
30 | df <- data.frame('symbol' = 'AAPL')
31 | res <- get_insider_ownership(df)
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/man/get_institutional_ownership.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/get_institutional_ownership.R
3 | \name{get_institutional_ownership}
4 | \alias{get_institutional_ownership}
5 | \title{Get Institutional Ownership Percentage}
6 | \usage{
7 | get_institutional_ownership(df)
8 | }
9 | \arguments{
10 | \item{df}{data.frame. Data frame with column 'symbol' containing at least one
11 | valid stock ticker symbol.}
12 | }
13 | \value{
14 | Input data.frame supplemented by the company's available
15 | \strong{Institutional Ownership} data.
16 | }
17 | \description{
18 | Wrapper function for fetching data from
19 | \href{https://www.gurufocus.com/term/InstitutionalOwnership/AAPL/}{gurufocus.com}.
20 | }
21 | \details{
22 | The Institutional Ownership is the percentage of shares that are owned by
23 | mutual or pension funds, insurance companies, investment firms, private
24 | foundations, endowments and other large entities that manage funds on behalf
25 | of others relative to the total shares outstanding.High institutional
26 | ownership can in many cases be interpreted as a signal of confidence.
27 | }
28 | \examples{
29 | df <- data.frame('symbol' = 'AAPL')
30 | res <- get_institutional_ownership(df)
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/man/get_interest_coverage.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/get_interest_coverage.R
3 | \name{get_interest_coverage}
4 | \alias{get_interest_coverage}
5 | \title{Get Interest Coverage}
6 | \usage{
7 | get_interest_coverage(df)
8 | }
9 | \arguments{
10 | \item{df}{data.frame. Data frame with column 'symbol' containing at least one
11 | valid stock ticker symbol.}
12 | }
13 | \value{
14 | Input data.frame supplemented by the company's available
15 | \strong{Interest Coverage} data.
16 | }
17 | \description{
18 | Wrapper function for fetching data from
19 | \href{https://www.gurufocus.com/term/turnover/AAPL/}{gurufocus.com}.
20 | }
21 | \details{
22 | The Interest Coverage measures how easily a company ca pay interest
23 | expenses on outstanding debt. It is calculated by diving a company's
24 | Operating Income by its Interest Expense. Higher a coverage are naturally
25 | better for the financial stability of a company.
26 | }
27 | \examples{
28 | df <- data.frame('symbol' = 'AAPL')
29 | res <- get_interest_coverage(df)
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/man/get_inventory_to_revenue.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/get_inventory_to_revenue.R
3 | \name{get_inventory_to_revenue}
4 | \alias{get_inventory_to_revenue}
5 | \title{Get Inventory to Revenue Ratio}
6 | \usage{
7 | get_inventory_to_revenue(df)
8 | }
9 | \arguments{
10 | \item{df}{data.frame. Data frame with column 'symbol' containing at least one
11 | valid stock ticker symbol.}
12 | }
13 | \value{
14 | Input data.frame supplemented by the company's available
15 | \strong{Inventory to Revenue Ratio} data.
16 | }
17 | \description{
18 | Wrapper function for fetching data from
19 | \href{https://www.gurufocus.com/term/inventory2rev/AAPL/}{gurufocus.com}.
20 | }
21 | \details{
22 | The Asset-Turnover-Ratio measures the percentage of inventories the company
23 | currently has on hand to support the current amount of revenue. The ratio
24 | indicated of a company to manage their inventory levels.
25 | }
26 | \examples{
27 | df <- data.frame('symbol' = 'AAPL')
28 | res <- get_inventory_to_revenue(df)
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/man/get_inventory_turnover.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/get_inventory_turnover.R
3 | \name{get_inventory_turnover}
4 | \alias{get_inventory_turnover}
5 | \title{Get Inventory Turnover}
6 | \usage{
7 | get_inventory_turnover(df)
8 | }
9 | \arguments{
10 | \item{df}{data.frame. Data frame with column 'symbol' containing at least one
11 | valid stock ticker symbol.}
12 | }
13 | \value{
14 | Input data.frame supplemented by the company's available
15 | \strong{Inventory Turnover} data.
16 | }
17 | \description{
18 | Wrapper function for fetching data from
19 | \href{https://www.gurufocus.com/term/InventoryTurnover/AAPL/}{gurufocus.com}.
20 | }
21 | \details{
22 | Inventory Turnover measures how fast the company turns over its inventory
23 | within a year. It is calculated as Cost of Goods Sold divided by Total
24 | Inventories.
25 | }
26 | \examples{
27 | df <- data.frame('symbol' = 'AAPL')
28 | res <- get_inventory_turnover(df)
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/man/get_liabilities_to_assets.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/get_liabilities_to_assets.R
3 | \name{get_liabilities_to_assets}
4 | \alias{get_liabilities_to_assets}
5 | \title{Get Liabilities to Assets Ratio}
6 | \usage{
7 | get_liabilities_to_assets(df)
8 | }
9 | \arguments{
10 | \item{df}{data.frame. Data frame with column 'symbol' containing at least one
11 | valid stock ticker symbol.}
12 | }
13 | \value{
14 | Input data.frame supplemented by the company's available
15 | \strong{Liabilities-to-Assets-Ratiop} data.
16 | }
17 | \description{
18 | Wrapper function for fetching data from
19 | \href{https://www.gurufocus.com/term/turnover/AAPL/}{gurufocus.com}.
20 | }
21 | \details{
22 | The Liabilities to Assets Ratio is a solvency ratio indicating how much of
23 | the company's assets are made of liabilities, calculated as total liabilities
24 | divided by total assets. The higher the ratio is, the more risk there is in
25 | the company.
26 | }
27 | \examples{
28 | df <- data.frame('symbol' = 'AAPL')
29 | res <- get_liabilities_to_assets(df)
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/man/get_ltd_to_total_assets.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/get_ltd_to_total_assets.R
3 | \name{get_ltd_to_total_assets}
4 | \alias{get_ltd_to_total_assets}
5 | \title{Get Long-Term Debt to Total Asset Ratio}
6 | \usage{
7 | get_ltd_to_total_assets(df)
8 | }
9 | \arguments{
10 | \item{df}{data.frame. Data frame with column 'symbol' containing at least one
11 | valid stock ticker symbol.}
12 | }
13 | \value{
14 | Input data.frame supplemented by the company's available
15 | \strong{Long-Term Debt to Total Asset Ratio} data.
16 | }
17 | \description{
18 | Wrapper function for fetching data from
19 | \href{https://www.gurufocus.com/term/ltd2asset/AAPL/}{gurufocus.com}.
20 | }
21 | \details{
22 | The Asset-Turnover-Ratio measures the percentage if a company's assets that
23 | are financed with loans and financial obligations lasting more than one year.
24 | The ratio gives an indication about a company's ability to meet financial
25 | requirements for outstanding loans.
26 | }
27 | \examples{
28 | df <- data.frame('symbol' = 'AAPL')
29 | res <- get_ltd_to_total_assets(df)
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/man/get_net_cash_per_share.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/get_net_cash_per_share.R
3 | \name{get_net_cash_per_share}
4 | \alias{get_net_cash_per_share}
5 | \title{Get Net Cash per Share}
6 | \usage{
7 | get_net_cash_per_share(df)
8 | }
9 | \arguments{
10 | \item{df}{data.frame. Data frame with column 'symbol' containing at least one
11 | valid stock ticker symbol.}
12 | }
13 | \value{
14 | Input data.frame supplemented by the company's available
15 | \strong{Net Cash per Share} data.
16 | }
17 | \description{
18 | Wrapper function for fetching data from
19 | \href{https://www.gurufocus.com/term/netcash/AAPL/}{gurufocus.com}.
20 | }
21 | \details{
22 | Net Cash per Share is calculated by taking all a company's cash, less all
23 | current liabilities and dividing that number by the total shares outstanding.
24 | }
25 | \examples{
26 | df <- data.frame('symbol' = 'AAPL')
27 | res <- get_net_cash_per_share(df)
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/man/get_net_net_working_capital.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/get_net_net_working_capital.R
3 | \name{get_net_net_working_capital}
4 | \alias{get_net_net_working_capital}
5 | \title{Get Net-Net Working Capital}
6 | \usage{
7 | get_net_net_working_capital(df)
8 | }
9 | \arguments{
10 | \item{df}{data.frame. Data frame with column 'symbol' containing at least one
11 | valid stock ticker symbol.}
12 | }
13 | \value{
14 | Input data.frame supplemented by the company's available
15 | \strong{Net-Net Working Capital} data.
16 | }
17 | \description{
18 | Wrapper function for fetching data from
19 | \href{https://www.gurufocus.com/term/NCAV/AAPL/}{gurufocus.com}.
20 | }
21 | \details{
22 | The Net-Net Working Capital technique was developed by Benjamin Graham, in
23 | which a company is valued based on its net-current assets per share (NCAVPS).
24 | The Net-Net Working Capital is calculated based on current assets, taking
25 | cash and cash equivalents at full value, then reducing accounts receivable
26 | for doubtful accounts and reducing inventories to liquidation values. Net-net
27 | value is calculated by deducting total liabilities from the adjusted current
28 | assets. Since the measure does not consider long-term assets or liabilities,
29 | it is unreliable for long-term investments.
30 | }
31 | \examples{
32 | df <- data.frame('symbol' = 'AAPL')
33 | res <- get_net_net_working_capital(df)
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/man/get_operating_cash_flow.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/get_operating_cash_flow.R
3 | \name{get_operating_cash_flow}
4 | \alias{get_operating_cash_flow}
5 | \title{Get Operating Cash Flow per Share}
6 | \usage{
7 | get_operating_cash_flow(df)
8 | }
9 | \arguments{
10 | \item{df}{data.frame. Data frame with column 'symbol' containing at least one
11 | valid stock ticker symbol.}
12 | }
13 | \value{
14 | Input data.frame supplemented by the company's available
15 | \strong{Operating Cash Flow per Share} data.
16 | }
17 | \description{
18 | Wrapper function for fetching data from
19 | \href{https://www.gurufocus.com/term/turnover/AAPL/}{gurufocus.com}.
20 | }
21 | \details{
22 | The Asset-Turnover-Ratio measures the value of a company's
23 | \emph{Net Sales Revenue} relative to the value of its \emph{Total Assets}. The ratio
24 | indicates how effectively a company is using its assets in order to generate
25 | sales.
26 | }
27 | \examples{
28 | df <- data.frame('symbol' = 'AAPL')
29 | res <- get_operating_cash_flow(df)
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/man/get_owners_eps.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/get_owners_eps.R
3 | \name{get_owners_eps}
4 | \alias{get_owners_eps}
5 | \title{Get Owners Earnings per Share}
6 | \usage{
7 | get_owners_eps(df)
8 | }
9 | \arguments{
10 | \item{df}{data.frame. Data frame with column 'symbol' containing at least one
11 | valid stock ticker symbol.}
12 | }
13 | \value{
14 | Input data.frame supplemented by the company's available
15 | \strong{Owners Earnings per Share} data.
16 | }
17 | \description{
18 | Wrapper function for fetching data from
19 | \href{https://www.gurufocus.com/term/Owner_Earnings/AAPL/}{gurufocus.com}.
20 | }
21 | \details{
22 | The Owners Earnings per Share is a measure invented by Warren Buffet and
23 | originally described in one of his famous annual shareholder letters as
24 | follows: "If we think through these questions, we can gain some insights
25 | about what may be called 'owner earnings.' These represent (a) reported
26 | earnings plus (b) depreciation, depletion, amortization, and certain other
27 | non-cash charges such as Company N's items (1) and (4) less the average
28 | annual amount of capitalized expenditures for plant and equipment, etc. that
29 | the business requires to fully maintain its long-term competitive position
30 | and its unit volume. (If the business requires additional working capital to
31 | maintain its competitive position and unit volume, the increment also should
32 | be included in (c). However, businesses following the LIFO inventory method
33 | usually do not require additional working capital if unit volume does not
34 | change.)"
35 | }
36 | \examples{
37 | df <- data.frame('symbol' = 'AAPL')
38 | res <- get_owners_eps(df)
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/man/get_pe_ratio.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/get_pe_ratio.R
3 | \name{get_pe_ratio}
4 | \alias{get_pe_ratio}
5 | \title{Get Price-Earnings Ratio}
6 | \usage{
7 | get_pe_ratio(df)
8 | }
9 | \arguments{
10 | \item{df}{data.frame. Data frame with column 'symbol' containing at least one
11 | valid stock ticker symbol.}
12 | }
13 | \value{
14 | Input data.frame supplemented by the company's available
15 | \strong{Price Earnings Ratio} data.
16 | }
17 | \description{
18 | Wrapper function for fetching data from
19 | \href{https://www.gurufocus.com/term/pe/AAPL/}{gurufocus.com}.
20 | }
21 | \details{
22 | The Price-Earnings Ratio calculated by the earnings divided by the market
23 | capitalization of a company.
24 | }
25 | \examples{
26 | df <- data.frame('symbol' = 'AAPL')
27 | res <- get_pe_ratio(df)
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/man/get_pe_ratio_nri.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/get_pe_ratio_nri.R
3 | \name{get_pe_ratio_nri}
4 | \alias{get_pe_ratio_nri}
5 | \title{Get Price-Earnings Ratio without Non-Recurring Items}
6 | \usage{
7 | get_pe_ratio_nri(df)
8 | }
9 | \arguments{
10 | \item{df}{data.frame. Data frame with column 'symbol' containing at least one
11 | valid stock ticker symbol.}
12 | }
13 | \value{
14 | Input data.frame supplemented by the company's available
15 | \strong{Price Earnings Ratio with Non-Recurring Items} data.
16 | }
17 | \description{
18 | Wrapper function for fetching data from
19 | \href{https://www.gurufocus.com/term/penri/AAPL/}{gurufocus.com}.
20 | }
21 | \details{
22 | The Asset-Turnover-Ratio gives the price to earnings ratio without the
23 | potentially misleading effects if non-recurring items (e.g. sale of a major
24 | asset). The ratio only considers regular operating income.
25 | }
26 | \examples{
27 | df <- data.frame('symbol' = 'AAPL')
28 | res <- get_pe_ratio_nri(df)
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/man/get_peg_ratio.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/get_peg_ratio.R
3 | \name{get_peg_ratio}
4 | \alias{get_peg_ratio}
5 | \title{Get Price-Earnings-Growth Ratio}
6 | \usage{
7 | get_peg_ratio(df)
8 | }
9 | \arguments{
10 | \item{df}{data.frame. Data frame with column 'symbol' containing at least one
11 | valid stock ticker symbol.}
12 | }
13 | \value{
14 | Input data.frame supplemented by the company's available
15 | \strong{Price-Earnings-Growth Ratio} data.
16 | }
17 | \description{
18 | Wrapper function for fetching data from
19 | \href{https://www.gurufocus.com/term/turnover/AAPL/}{gurufocus.com}.
20 | }
21 | \details{
22 | The Asset-Turnover-Ratio is defined by the Price-to-Earnings Ratio
23 | (without NRI) divided by the 5-Year EBITDA growth rate. A PEG Ratio >1 may
24 | indicate overvaluation of a stock, whereas as PEG Ratio <1 may indicate
25 | undervaluation.
26 | }
27 | \examples{
28 | df <- data.frame('symbol' = 'AAPL')
29 | res <- get_peg_ratio(df)
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/man/get_piotroski_f.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/get_piotroski_f.R
3 | \name{get_piotroski_f}
4 | \alias{get_piotroski_f}
5 | \title{Get Piotroski F-Score}
6 | \usage{
7 | get_piotroski_f(df)
8 | }
9 | \arguments{
10 | \item{df}{data.frame. Data frame with column 'symbol' containing at least one
11 | valid stock ticker symbol.}
12 | }
13 | \value{
14 | Input data.frame supplemented by the company's available
15 | \strong{Piotroski F-Score} data.
16 | }
17 | \description{
18 | Wrapper function for fetching data from
19 | \href{https://www.gurufocus.com/term/turnover/AAPL/}{gurufocus.com}.
20 | }
21 | \details{
22 | The Asset-Turnover-Ratio measures the value of a company's
23 | \emph{Net Sales Revenue} relative to the value of its \emph{Total Assets}. The ratio
24 | indicates how effectively a company is using its assets in order to generate
25 | sales.
26 | }
27 | \examples{
28 | df <- data.frame('symbol' = 'AAPL')
29 | res <- get_piotroski_f(df)
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/man/get_predictability.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/get_predictability.R
3 | \name{get_predictability}
4 | \alias{get_predictability}
5 | \title{Get Predictability Rank}
6 | \usage{
7 | get_predictability(df)
8 | }
9 | \arguments{
10 | \item{df}{data.frame. Data frame with column 'symbol' containing at least one
11 | valid stock ticker symbol.}
12 | }
13 | \value{
14 | Input data.frame supplemented by the company's available
15 | \strong{Predictability Rank} data.
16 | }
17 | \description{
18 | Wrapper function for fetching data from
19 | \href{https://www.gurufocus.com/term/predictability_rank/AAPL/}{gurufocus.com}.
20 | }
21 | \details{
22 | Gurufocus.com ranks the predictability of companies based on the consistency
23 | of their revenue per share and EBITDA (earning before interest, tax,
24 | depreciation and amortization) per share over the past ten fiscal years, and
25 | study the correlation between the stock performances and the predictability
26 | of the business.
27 | }
28 | \examples{
29 | df <- data.frame('symbol' = 'AAPL')
30 | res <- get_predictability(df)
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/man/get_price_to_book.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/get_price_to_book.R
3 | \name{get_price_to_book}
4 | \alias{get_price_to_book}
5 | \title{Get Price to Book Ratio}
6 | \usage{
7 | get_price_to_book(df)
8 | }
9 | \arguments{
10 | \item{df}{data.frame. Data frame with column 'symbol' containing at least one
11 | valid stock ticker symbol.}
12 | }
13 | \value{
14 | Input data.frame supplemented by the company's available
15 | \strong{Price to Book Ratio} data.
16 | }
17 | \description{
18 | Wrapper function for fetching data from
19 | \href{https://www.gurufocus.com/term/pb/AAPL/}{gurufocus.com}.
20 | }
21 | \details{
22 | The Asset-Turnover-Ratio measures the market price of a company to its book
23 | value.
24 | }
25 | \examples{
26 | df <- data.frame('symbol' = 'AAPL')
27 | res <- get_price_to_book(df)
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/man/get_price_to_fcf.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/get_price_to_fcf.R
3 | \name{get_price_to_fcf}
4 | \alias{get_price_to_fcf}
5 | \title{Get Price-to-Free-Cash-Flow-Ratio}
6 | \usage{
7 | get_price_to_fcf(df)
8 | }
9 | \arguments{
10 | \item{df}{data.frame. Data frame with column 'symbol' containing at least one
11 | valid stock ticker symbol.}
12 | }
13 | \value{
14 | Input data.frame supplemented by the company's available
15 | \strong{Price-to-Free-Cash-Flow-Ratio} data.
16 | }
17 | \description{
18 | Wrapper function for fetching data from
19 | \href{https://www.gurufocus.com/term/pfcf/AAPL/}{gurufocus.com}.
20 | }
21 | \details{
22 | The Price-to-Free-Cash-Flow-Ratio measures a company's value relative to its
23 | Free Cash Flows.
24 | }
25 | \examples{
26 | df <- data.frame('symbol' = 'AAPL')
27 | res <- get_price_to_fcf(df)
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/man/get_price_to_opcf.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/get_price_to_opcf.R
3 | \name{get_price_to_opcf}
4 | \alias{get_price_to_opcf}
5 | \title{Get Price-to-Operating-Cash-Flow-Ratio}
6 | \usage{
7 | get_price_to_opcf(df)
8 | }
9 | \arguments{
10 | \item{df}{data.frame. Data frame with column 'symbol' containing at least one
11 | valid stock ticker symbol.}
12 | }
13 | \value{
14 | Input data.frame supplemented by the company's available
15 | \strong{Price-to-Operating-Cash-Flow-Ratio} data.
16 | }
17 | \description{
18 | Wrapper function for fetching data from
19 | \href{https://www.gurufocus.com/term/pocf/AAPL/}{gurufocus.com}.
20 | }
21 | \details{
22 | The Price-to-Operating-Cash-Flow-Ratio measures a company's value relative to
23 | its Operating Cash Flows.
24 | }
25 | \examples{
26 | df <- data.frame('symbol' = 'AAPL')
27 | res <- get_price_to_opcf(df)
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/man/get_price_to_tangible_book.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/get_price_to_tangible_book.R
3 | \name{get_price_to_tangible_book}
4 | \alias{get_price_to_tangible_book}
5 | \title{Get Price-Tangible-Book-Ratio}
6 | \usage{
7 | get_price_to_tangible_book(df)
8 | }
9 | \arguments{
10 | \item{df}{data.frame. Data frame with column 'symbol' containing at least one
11 | valid stock ticker symbol.}
12 | }
13 | \value{
14 | Input data.frame supplemented by the company's available
15 | \strong{Price-Tangible-Book-Ratio} data.
16 | }
17 | \description{
18 | Wrapper function for fetching data from
19 | \href{https://www.gurufocus.com/term/p2tangible_book/AAPL/}{gurufocus.com}.
20 | }
21 | \details{
22 | The Price-Tangible-Book-Ratio measures a company's market value to its
23 | tangible assets. This ratio is applicable mainly to industrial or other
24 | capital-intensive companies (manufacturers, miner, ...) that own a high
25 | proportion of hard assets.
26 | }
27 | \examples{
28 | df <- data.frame('symbol' = 'AAPL')
29 | res <- get_price_to_tangible_book(df)
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/man/get_profitability.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/get_profitability.R
3 | \name{get_profitability}
4 | \alias{get_profitability}
5 | \title{Get Profitability Rank}
6 | \usage{
7 | get_profitability(df)
8 | }
9 | \arguments{
10 | \item{df}{data.frame. Data frame with column 'symbol' containing at least one
11 | valid stock ticker symbol.}
12 | }
13 | \value{
14 | Input data.frame supplemented by the company's available
15 | \strong{Profitability Rank} data.
16 | }
17 | \description{
18 | Wrapper function for fetching data from
19 | \href{https://www.gurufocus.com/term/rank_profitability/AAPL/}{gurufocus.com}.
20 | }
21 | \details{
22 | Gurufocus.com calculated the Profitability Rank by how profitable a company
23 | is and how likely the company's business will stay that way. The maximum rank
24 | is 10. A rank of 7 or higher means a higher profitability and may stay that
25 | way. A rank of 3 or lower indicates that the company has had trouble to make
26 | a profit.
27 | The Profitability Rank is based on the Operating Margin and its 5-year
28 | average, the Piotroski F-Score, the Consistency of the Profitability and the
29 | Predictability Rank (see get_predictability)
30 | }
31 | \examples{
32 | df <- data.frame('symbol' = 'AAPL')
33 | res <- get_profitability(df)
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/man/get_revenue_per_share.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/get_revenue_per_share.R
3 | \name{get_revenue_per_share}
4 | \alias{get_revenue_per_share}
5 | \title{Get Revenue per Share}
6 | \usage{
7 | get_revenue_per_share(df)
8 | }
9 | \arguments{
10 | \item{df}{data.frame. Data frame with column 'symbol' containing at least one
11 | valid stock ticker symbol.}
12 | }
13 | \value{
14 | Input data.frame supplemented by the company's available
15 | \strong{Revenue per Share} data.
16 | }
17 | \description{
18 | Wrapper function for fetching data from
19 | \href{https://www.gurufocus.com/term/per+share+rev/AAPL/}{gurufocus.com}.
20 | }
21 | \details{
22 | The Asset-Turnover-Ratio measures the value of a company's \emph{Revenue} relative
23 | to its market capitalization.
24 | }
25 | \examples{
26 | df <- data.frame('symbol' = 'AAPL')
27 | res <- get_revenue_per_share(df)
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/man/get_snoa.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/get_snoa.R
3 | \name{get_snoa}
4 | \alias{get_snoa}
5 | \title{Get Scaled Net Operating Assets}
6 | \usage{
7 | get_snoa(df)
8 | }
9 | \arguments{
10 | \item{df}{data.frame. Data frame with column 'symbol' containing at least one
11 | valid stock ticker symbol.}
12 | }
13 | \value{
14 | Input data.frame supplemented by the company's available
15 | \strong{Scaled Net Operating Assets} data.
16 | }
17 | \description{
18 | Wrapper function for fetching data from
19 | \href{https://www.gurufocus.com/term/SNOA/AAPL/}{gurufocus.com}.
20 | }
21 | \details{
22 | Scaled Net Operating Assets (SNOA) is calculated as the difference between
23 | operating assets and operating liabilities, scaled by lagged total assets.
24 | }
25 | \examples{
26 | df <- data.frame('symbol' = 'AAPL')
27 | res <- get_snoa(df)
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/man/get_table.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/get_table.R
3 | \name{get_table}
4 | \alias{get_table}
5 | \title{Get HTML table element}
6 | \usage{
7 | get_table(url, xpath, name, raw = FALSE)
8 | }
9 | \arguments{
10 | \item{url}{String. The Uniform Resource Locator of the resource of interest.}
11 |
12 | \item{xpath}{String. The XML path to an element of interest.}
13 |
14 | \item{name}{String. The prefix preceding every scraped output column.}
15 |
16 | \item{raw}{Logical. Controls whether 'gurufocus.com'-specific data processing
17 | shall be applied to the table.}
18 | }
19 | \value{
20 | The table to be found under the given XML path and URL.
21 | }
22 | \description{
23 | Get HTML table element
24 | }
25 | \examples{
26 | get_table(name = 'test',
27 | url = 'https://www.gurufocus.com/term/cash_per_share/AAPL/',
28 | xpath = '//*[@id="target_def_historical_data"]/div[2]/div/table')
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/man/get_tangible_book_per_share.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/get_tangible_book_per_share.R
3 | \name{get_tangible_book_per_share}
4 | \alias{get_tangible_book_per_share}
5 | \title{Get Tangible Book Value Per Share}
6 | \usage{
7 | get_tangible_book_per_share(df)
8 | }
9 | \arguments{
10 | \item{df}{data.frame. Data.frame with column \emph{symbol} containing at least one
11 | valid stock ticker symbol.}
12 | }
13 | \value{
14 | Input data.frame supplemented by the company's available
15 | \strong{Tangible Book Per Share} data.
16 | }
17 | \description{
18 | Fetching \emph{Tangible Book Value Per Share} from gurufocus.com
19 | }
20 | \details{
21 | The \emph{Tangible book value per share} is the value of a company's tangible
22 | assets divided by its current outstanding shares. The TBVPS determines the
23 | potential value per share of a company in the event that it must liquidate
24 | it's assets.
25 | Assets such as property and equipment are considered tangible assets.
26 | }
27 | \examples{
28 | df <- data.frame('symbol' = 'AAPL')
29 | res <- get_tangible_book_per_share(df)
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/man/get_text.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/get_text.R
3 | \name{get_text}
4 | \alias{get_text}
5 | \title{Get HTML text element}
6 | \usage{
7 | get_text(url, xpath)
8 | }
9 | \arguments{
10 | \item{url}{String. The Uniform Resource Locator of the resource of interest.}
11 |
12 | \item{xpath}{String. The XML path to an element of interest.}
13 | }
14 | \value{
15 | The string to be found under the given XML path and URL.
16 | }
17 | \description{
18 | Get HTML text element
19 | }
20 | \examples{
21 | get_text(url = 'https://www.gurufocus.com/stock/AAPL/summary',
22 | xpath = '//*[@id="stock-header"]/div/div[1]/div[1]/div[2]/div/h1/span[1]')
23 | }
24 |
--------------------------------------------------------------------------------
/man/get_total_debt_per_share.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/get_total_debt_per_share.R
3 | \name{get_total_debt_per_share}
4 | \alias{get_total_debt_per_share}
5 | \title{Get Total Debt Per Share}
6 | \usage{
7 | get_total_debt_per_share(df)
8 | }
9 | \arguments{
10 | \item{df}{data.frame. Data frame with column 'symbol' containing at least one
11 | valid stock ticker symbol.}
12 | }
13 | \value{
14 | Input data.frame supplemented by the company's available
15 | \strong{Total Debt per Share} data.
16 | }
17 | \description{
18 | Wrapper function for fetching data from
19 | \href{https://www.gurufocus.com/term/Total_Debt_Per_Share/AAPL/}{gurufocus.com}.
20 | }
21 | \details{
22 | Total Debt per Share is calculated as total debt divided by Shares
23 | Outstanding (EOP). Total debt is calculated as Long-Term Debt & Capital Lease
24 | Obligation plus Short-Term Debt & Capital Lease Obligation.
25 | }
26 | \examples{
27 | df <- data.frame('symbol' = 'AAPL')
28 | res <- get_total_debt_per_share(df)
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/man/get_yacktman_forward_return.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/get_yacktman_return.R
3 | \name{get_yacktman_forward_return}
4 | \alias{get_yacktman_forward_return}
5 | \title{Get Forward Rate of Return (Yacktman)}
6 | \usage{
7 | get_yacktman_forward_return(df)
8 | }
9 | \arguments{
10 | \item{df}{data.frame. Data frame with column 'symbol' containing at least one
11 | valid stock ticker symbol.}
12 | }
13 | \value{
14 | Input data.frame supplemented by the company's available
15 | \strong{Forward Rate of Return (Yacktman)} data.
16 | }
17 | \description{
18 | Wrapper function for fetching data from
19 | \href{https://www.gurufocus.com/term/RateOfReturn/AAPL/}{gurufocus.com}.
20 | }
21 | \details{
22 | Yacktman defines forward rate of return as the normalized free cash flow
23 | yield plus real growth plus inflation. 's forward rate of return for was
24 | 0.00\%. Unlike the Earnings Yield \%, the Forward Rate of Return uses the
25 | normalized Free Cash Flow of the past seven years, and considers growth.
26 | The forward rate of return can be thought of as the return that investors
27 | buying the stock today can expect from it in the future.
28 | }
29 | \examples{
30 | df <- data.frame('symbol' = 'AAPL')
31 | res <- get_yacktman_forward_return(df)
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/man/get_yoy_ebitda_growth.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/get_yoy_ebitda_growth.R
3 | \name{get_yoy_ebitda_growth}
4 | \alias{get_yoy_ebitda_growth}
5 | \title{Get Year-over-Year Earnings before Interest, Tax and
6 | Appreciation Growth-Rate}
7 | \usage{
8 | get_yoy_ebitda_growth(df)
9 | }
10 | \arguments{
11 | \item{df}{data.frame. Data.frame with column \emph{symbol} containing at least one
12 | valid ticker symbol of a listed stock.}
13 | }
14 | \value{
15 | Input data.frame supplemented by the company's available
16 | \strong{Year-over-Year Earnings before Interest, Tax and Appreciation Growth}
17 | data.
18 | }
19 | \description{
20 | Fetching
21 | \emph{Year-over-Year Earnings before Interest, Tax and Appreciation Growth-Rate}
22 | from gurufocus.com
23 | }
24 | \details{
25 | \emph{YoY EBITDA Growth} is the percentage change of EBITDA per share.
26 | }
27 | \examples{
28 | df <- data.frame('symbol' = 'AAPL')
29 | res <- get_yoy_ebitda_growth(df)
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/man/get_yoy_eps_growth.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/get_yoy_eps_growth.R
3 | \name{get_yoy_eps_growth}
4 | \alias{get_yoy_eps_growth}
5 | \title{Get Year-over-Year Earnings per Share Growth}
6 | \usage{
7 | get_yoy_eps_growth(df)
8 | }
9 | \arguments{
10 | \item{df}{data.frame. Data frame with column 'symbol' containing at least one
11 | valid stock ticker symbol.}
12 | }
13 | \value{
14 | Input data.frame supplemented by the company's available
15 | \strong{Year-over-Year Earnings per Share Growth} data.
16 | }
17 | \description{
18 | Wrapper function for fetching data from
19 | \href{https://www.gurufocus.com/term/growth_per_share_eps/AAPL/}{gurufocus.com}.
20 | }
21 | \details{
22 | YoY EPS Growth is the percentage change of Earnings per Share (Diluted) over
23 | the past twelve months.
24 | }
25 | \examples{
26 | df <- data.frame('symbol' = 'AAPL')
27 | res <- get_yoy_eps_growth(df)
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/man/get_yoy_revenue_growth.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/get_yoy_revenue_growth.R
3 | \name{get_yoy_revenue_growth}
4 | \alias{get_yoy_revenue_growth}
5 | \title{Get Year-over-Year Revenue Per Share Growth}
6 | \usage{
7 | get_yoy_revenue_growth(df)
8 | }
9 | \arguments{
10 | \item{df}{data.frame. Data frame with column 'symbol' containing at least one
11 | valid stock ticker symbol.}
12 | }
13 | \value{
14 | Input data.frame supplemented by the company's available
15 | \strong{Year-over-Year Revenue Per Share Growth} data.
16 | }
17 | \description{
18 | Wrapper function for fetching data from
19 | \href{https://www.gurufocus.com/term/growth_per_share_rev/AAPL/}{gurufocus.com}.
20 | }
21 | \details{
22 | YoY Rev. per Sh. Growth is the percentage change of Revenue per Share over
23 | the past twelve months
24 | }
25 | \examples{
26 | df <- data.frame('symbol' = 'AAPL')
27 | res <- get_yoy_revenue_growth(df)
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/man/input_merge.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/input_merge.R
3 | \name{input_merge}
4 | \alias{input_merge}
5 | \title{Merge original data frame with scraped data
6 |
7 | Internal function. Merges data.frame resulting from web scraping to the
8 | data.frame provided as input of a respective function.}
9 | \usage{
10 | input_merge(df = NULL, input = NULL)
11 | }
12 | \arguments{
13 | \item{df}{Data.frame. A data.frame to be merged to the original input.}
14 |
15 | \item{input}{Data.frame. A data.frame provided as original function input.}
16 | }
17 | \description{
18 | Merge original data frame with scraped data
19 |
20 | Internal function. Merges data.frame resulting from web scraping to the
21 | data.frame provided as input of a respective function.
22 | }
23 | \examples{
24 | df <- data.frame("symbol" = "STOCK", "eps_2016" = 99)
25 | input <- data.frame("symbol" = "STOCK", "eps_2016" = 99, "eps_2017" = 199)
26 | input_merge(df = df, input = input)
27 | }
28 |
--------------------------------------------------------------------------------
/man/regex_ttm.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/regex_ttm.R
3 | \name{regex_ttm}
4 | \alias{regex_ttm}
5 | \title{Text-processing of key figure from gurufocus.com}
6 | \usage{
7 | regex_ttm(string)
8 | }
9 | \arguments{
10 | \item{string}{String. The character string to be processed}
11 | }
12 | \value{
13 | The input data frame supplemented by the company's respective key figures
14 | of the last five fiscal years plus current years TTM.
15 | }
16 | \description{
17 | Internal \strong{'quant'}-function for processing the scraped character string
18 | of key figures provided by gurufocus.com
19 | }
20 |
--------------------------------------------------------------------------------
/man/sanity.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/sanity.R
3 | \name{sanity}
4 | \alias{sanity}
5 | \title{Apply sanity checks}
6 | \usage{
7 | sanity(df)
8 | }
9 | \arguments{
10 | \item{df}{Data.frame. A data.frame to be checked for sanity.}
11 | }
12 | \value{
13 | A \verb{"data.table" "data.frame"} object.
14 | }
15 | \description{
16 | Internal function. Applies a sanity check on given input parameter(s)
17 | }
18 |
--------------------------------------------------------------------------------
/man/scrape_key_fig.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/scrape_key_fig.R
3 | \name{scrape_key_fig}
4 | \alias{scrape_key_fig}
5 | \title{Scrape Key Figures from gurufocus.com
6 |
7 | Main internal \strong{'quant'}-function for scraping stock key figures from
8 | \href{https://www.gurufocus.com/dashboard}{gurufocus.com}}
9 | \usage{
10 | scrape_key_fig(df, url, pfx, xpath_txt, xpath_tbl)
11 | }
12 | \arguments{
13 | \item{df}{data.frame. Data frame with a column 'symbol' containing at least
14 | one valid stock ticker symbol.}
15 |
16 | \item{url}{String. The Uniform Resource Locator of the resource of interest.}
17 |
18 | \item{pfx}{String. Prefix for column names of scraped data sets.}
19 |
20 | \item{xpath_txt}{String. The XML path to a text element of interest.}
21 |
22 | \item{xpath_tbl}{String. The XML path to a table element of interest.}
23 | }
24 | \value{
25 | The input data frame supplemented by a company's respective key figure value
26 | of the last five fiscal years plus current years TTM.
27 | }
28 | \description{
29 | Scrape Key Figures from gurufocus.com
30 |
31 | Main internal \strong{'quant'}-function for scraping stock key figures from
32 | \href{https://www.gurufocus.com/dashboard}{gurufocus.com}
33 | }
34 |
--------------------------------------------------------------------------------
/man/scrape_ownership_fig.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/scrape_ownership_fig.R
3 | \name{scrape_ownership_fig}
4 | \alias{scrape_ownership_fig}
5 | \title{Get Key Figure from gurufocus.com}
6 | \usage{
7 | scrape_ownership_fig(df, url, pfx, xpath_txt, xpath_tbl)
8 | }
9 | \arguments{
10 | \item{df}{data.frame. Data frame with a column 'symbol' containing at least
11 | one valid stock ticker symbol.}
12 |
13 | \item{url}{String. The Uniform Resource Locator of the resource of interest.}
14 |
15 | \item{pfx}{String. Prefix for column names of scraped data sets.}
16 |
17 | \item{xpath_txt}{String. The XML path to a text element of interest.}
18 |
19 | \item{xpath_tbl}{String. The XML path to a table element of interest.}
20 | }
21 | \value{
22 | The input data frame supplemented by a company's respective key figure value
23 | of the last five fiscal years plus current years TTM.
24 | }
25 | \description{
26 | Function for fetching data from
27 | \href{https://www.gurufocus.com/term/InstitutionalOwnership/AAPL/}{gurufocus.com}.
28 | }
29 |
--------------------------------------------------------------------------------
/man/scrape_predictability.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/scrape_predictability.R
3 | \name{scrape_predictability}
4 | \alias{scrape_predictability}
5 | \title{Helper Function for Predictability}
6 | \usage{
7 | scrape_predictability(df, url, xpath_txt)
8 | }
9 | \arguments{
10 | \item{df}{data.frame}
11 |
12 | \item{url}{String}
13 |
14 | \item{xpath_txt}{String}
15 | }
16 | \value{
17 | data.frame
18 | }
19 | \description{
20 | Helper Function for Predictability
21 | }
22 |
--------------------------------------------------------------------------------
/man/scrape_profitability.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/scrape_profitability.R
3 | \name{scrape_profitability}
4 | \alias{scrape_profitability}
5 | \title{Helper Function for Profitability
6 |
7 | @usage scrape_profitability(df, url, xpath_txt)}
8 | \usage{
9 | scrape_profitability(df, url, xpath_txt)
10 | }
11 | \arguments{
12 | \item{df}{data.frame}
13 |
14 | \item{url}{String}
15 |
16 | \item{xpath_txt}{String}
17 | }
18 | \value{
19 | data.frame
20 | }
21 | \description{
22 | Helper Function for Profitability
23 |
24 | @usage scrape_profitability(df, url, xpath_txt)
25 | }
26 |
--------------------------------------------------------------------------------
/man/topicality.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/topicality.R
3 | \name{topicality}
4 | \alias{topicality}
5 | \title{Merge original data frame with scraped data
6 |
7 | Internal function. Merges data.frame resulting from web scraping to the
8 | data.frame provided as input of a respective function.}
9 | \usage{
10 | topicality(table)
11 | }
12 | \arguments{
13 | \item{table}{Data.frame}
14 | }
15 | \description{
16 | Merge original data frame with scraped data
17 |
18 | Internal function. Merges data.frame resulting from web scraping to the
19 | data.frame provided as input of a respective function.
20 | }
21 | \examples{
22 | df <- data.frame("symbol" = "STOCK", "eps_2016" = 99)
23 | topicality(df)
24 | }
25 |
--------------------------------------------------------------------------------
/misc/quant_demo.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OliverHennhoefer/quant/cf8ae4c85e47342c000de745abf3b0cb4fe47eac/misc/quant_demo.gif
--------------------------------------------------------------------------------
/quant_0.0.1.0000.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OliverHennhoefer/quant/cf8ae4c85e47342c000de745abf3b0cb4fe47eac/quant_0.0.1.0000.pdf
--------------------------------------------------------------------------------
/tests/testthat.R:
--------------------------------------------------------------------------------
1 | library(testthat)
2 | library(quant)
3 |
4 | test_check("quant")
5 |
--------------------------------------------------------------------------------
/tests/testthat/test-data_nasdaq100.R:
--------------------------------------------------------------------------------
1 | test_that("Nasdaq100 object check", {
2 | nasdaq <- quant::data_nasdaq100()
3 | testthat::expect_true(data.table::is.data.table(nasdaq))
4 | })
5 |
6 | test_that("Nasdaq100 column check", {
7 | nasdaq <- quant::data_nasdaq100()
8 | testthat::expect_equal(ncol(nasdaq), 4)
9 | })
10 |
11 | test_that("Nasdaq100 row check", {
12 | nasdaq <- quant::data_nasdaq100()
13 | testthat::expect_gt(nrow(nasdaq), 95)
14 | })
15 |
--------------------------------------------------------------------------------
/tests/testthat/test-data_sp500.R:
--------------------------------------------------------------------------------
1 | test_that("SP500 object check", {
2 | sp500 <- quant::data_sp500()
3 | testthat::expect_true(data.table::is.data.table(sp500))
4 | })
5 |
6 | test_that("SP500 column check", {
7 | sp500 <- quant::data_sp500()
8 | testthat::expect_equal(ncol(sp500), 4)
9 | })
10 |
11 | test_that("SP500 row check", {
12 | sp500 <- quant::data_sp500()
13 | testthat::expect_gt(nrow(sp500), 490) # index amount may vary temporarily
14 | })
15 |
--------------------------------------------------------------------------------
/tests/testthat/test-get_altman_z.R:
--------------------------------------------------------------------------------
1 | test_that("Altman Z check", {
2 | df <- data.frame("symbol" = "AAPL")
3 | altman <- quant::get_altman_z(df)
4 | testthat::expect_equal(dim(altman), c(1,7))
5 | })
6 |
--------------------------------------------------------------------------------
/tests/testthat/test-get_asset_turnover.R:
--------------------------------------------------------------------------------
1 | test_that("Asset Turnover check", {
2 | df <- data.frame("symbol" = "AAPL")
3 | asset_turnover <- quant::get_asset_turnover(df)
4 | testthat::expect_equal(dim(asset_turnover), c(1,7))
5 | })
6 |
--------------------------------------------------------------------------------
/tests/testthat/test-get_beneish_m.R:
--------------------------------------------------------------------------------
1 | test_that("Beneish M check", {
2 | df <- data.frame("symbol" = "AAPL")
3 | beneish_m <- quant::get_beneish_m(df)
4 | testthat::expect_equal(dim(beneish_m), c(1,7))
5 | })
6 |
--------------------------------------------------------------------------------
/tests/testthat/test-get_book_value_per_share.R:
--------------------------------------------------------------------------------
1 | test_that("Book Value per Share check", {
2 | df <- data.frame("symbol" = "AAPL")
3 | book_value_per_share <- quant::get_book_value_per_share(df)
4 | testthat::expect_equal(dim(book_value_per_share), c(1,7))
5 | })
6 |
--------------------------------------------------------------------------------
/tests/testthat/test-get_buyback_yield.R:
--------------------------------------------------------------------------------
1 | test_that("Buyback Yield check", {
2 | df <- data.frame("symbol" = "AAPL")
3 | buyback_yield <- quant::get_buyback_yield(df)
4 | testthat::expect_equal(dim(buyback_yield), c(1,7))
5 | })
6 |
--------------------------------------------------------------------------------
/tests/testthat/test-get_capex_to_sales.R:
--------------------------------------------------------------------------------
1 | test_that("CAPEX to Sales check", {
2 | df <- data.frame("symbol" = "AAPL")
3 | capex_to_sales <- quant::get_capex_to_sales(df)
4 | testthat::expect_equal(dim(capex_to_sales), c(1,7))
5 | })
6 |
--------------------------------------------------------------------------------
/tests/testthat/test-get_cash_conv_cycle.R:
--------------------------------------------------------------------------------
1 | test_that("Cash Conversion Cycle check", {
2 | df <- data.frame("symbol" = "AAPL")
3 | cash_conv_cycle <- quant::get_cash_conv_cycle(df)
4 | testthat::expect_equal(dim(cash_conv_cycle), c(1,7))
5 | })
6 |
--------------------------------------------------------------------------------
/tests/testthat/test-get_cash_per_share.R:
--------------------------------------------------------------------------------
1 | test_that("Cash per Share check", {
2 | df <- data.frame("symbol" = "AAPL")
3 | cash_per_share <- quant::get_cash_per_share(df)
4 | testthat::expect_equal(dim(cash_per_share), c(1,7))
5 | })
6 |
--------------------------------------------------------------------------------
/tests/testthat/test-get_cash_ratio.R:
--------------------------------------------------------------------------------
1 | test_that("Cash Ratio check", {
2 | df <- data.frame("symbol" = "AAPL")
3 | get_cash_ratio <- quant::get_cash_ratio(df)
4 | testthat::expect_equal(dim(get_cash_ratio), c(1,7))
5 | })
6 |
--------------------------------------------------------------------------------
/tests/testthat/test-get_cash_to_debt.R:
--------------------------------------------------------------------------------
1 | test_that("Cash to Debt check", {
2 | df <- data.frame("symbol" = "AAPL")
3 | cash_to_debt <- quant::get_cash_to_debt(df)
4 | testthat::expect_equal(dim(cash_to_debt), c(1,7))
5 | })
6 |
--------------------------------------------------------------------------------
/tests/testthat/test-get_cogs_to_revenue.R:
--------------------------------------------------------------------------------
1 | test_that("COGS to Revenue check", {
2 | df <- data.frame("symbol" = "AAPL")
3 | cogs_to_revenue <- quant::get_cogs_to_revenue(df)
4 | testthat::expect_equal(dim(cogs_to_revenue), c(1,7))
5 | })
6 |
--------------------------------------------------------------------------------
/tests/testthat/test-get_current_ratio.R:
--------------------------------------------------------------------------------
1 | test_that("Current Ratio check", {
2 | df <- data.frame("symbol" = "AAPL")
3 | current_ratio <- quant::get_current_ratio(df)
4 | testthat::expect_equal(dim(current_ratio), c(1,7))
5 | })
6 |
--------------------------------------------------------------------------------
/tests/testthat/test-get_days_inventory.R:
--------------------------------------------------------------------------------
1 | test_that("Days Inventory check", {
2 | df <- data.frame("symbol" = "AAPL")
3 | days_inventory <- quant::get_days_inventory(df)
4 | testthat::expect_equal(dim(days_inventory), c(1,7))
5 | })
6 |
--------------------------------------------------------------------------------
/tests/testthat/test-get_days_sales_outstanding.R:
--------------------------------------------------------------------------------
1 | test_that("Days to Sales Outstanding check", {
2 | df <- data.frame("symbol" = "AAPL")
3 | days_sales_outstanding <- quant::get_days_sales_outstanding(df)
4 | testthat::expect_equal(dim(days_sales_outstanding), c(1,7))
5 | })
6 |
--------------------------------------------------------------------------------
/tests/testthat/test-get_debt_to_assets.R:
--------------------------------------------------------------------------------
1 | test_that("Debt to Asset Ratio check", {
2 | df <- data.frame("symbol" = "AAPL")
3 | debt_to_assets <- quant::get_debt_to_assets(df)
4 | testthat::expect_equal(dim(debt_to_assets), c(1,7))
5 | })
6 |
--------------------------------------------------------------------------------
/tests/testthat/test-get_debt_to_ebitda.R:
--------------------------------------------------------------------------------
1 | test_that("Debt to EBITDA check", {
2 | df <- data.frame("symbol" = "AAPL")
3 | debt_to_ebitda <- quant::get_debt_to_ebitda(df)
4 | testthat::expect_equal(dim(debt_to_ebitda), c(1,7))
5 | })
6 |
--------------------------------------------------------------------------------
/tests/testthat/test-get_debt_to_equity.R:
--------------------------------------------------------------------------------
1 | test_that("Debt to Equity check", {
2 | df <- data.frame("symbol" = "AAPL")
3 | debt_to_equity <- quant::get_debt_to_equity(df)
4 | testthat::expect_equal(dim(debt_to_equity), c(1,7))
5 | })
6 |
--------------------------------------------------------------------------------
/tests/testthat/test-get_debt_to_revenue.R:
--------------------------------------------------------------------------------
1 | test_that("Debt to Revenue check", {
2 | df <- data.frame("symbol" = "AAPL")
3 | debt_to_revenue <- quant::get_debt_to_revenue(df)
4 | testthat::expect_equal(dim(debt_to_revenue), c(1,7))
5 | })
6 |
--------------------------------------------------------------------------------
/tests/testthat/test-get_diluted_eps.R:
--------------------------------------------------------------------------------
1 | test_that("Diluted EPS check", {
2 | df <- data.frame("symbol" = "AAPL")
3 | diluted_eps <- quant::get_diluted_eps(df)
4 | testthat::expect_equal(dim(diluted_eps), c(1,7))
5 | })
6 |
--------------------------------------------------------------------------------
/tests/testthat/test-get_dividend_per_share.R:
--------------------------------------------------------------------------------
1 | test_that("Dividend per Share check", {
2 | df <- data.frame("symbol" = "AAPL")
3 | dividend_per_share <- quant::get_dividend_per_share(df)
4 | testthat::expect_equal(dim(dividend_per_share), c(1,7))
5 | })
6 |
--------------------------------------------------------------------------------
/tests/testthat/test-get_e10.R:
--------------------------------------------------------------------------------
1 | test_that("E10 check", {
2 | df <- data.frame("symbol" = "AAPL")
3 | e10 <- quant::get_e10(df)
4 | testthat::expect_equal(dim(e10), c(1,7))
5 | })
6 |
--------------------------------------------------------------------------------
/tests/testthat/test-get_ebit_per_share.R:
--------------------------------------------------------------------------------
1 | test_that("EBIT per Share check", {
2 | df <- data.frame("symbol" = "AAPL")
3 | ebit_per_share <- quant::get_ebit_per_share(df)
4 | testthat::expect_equal(dim(ebit_per_share), c(1,7))
5 | })
6 |
--------------------------------------------------------------------------------
/tests/testthat/test-get_ebitda_per_share.R:
--------------------------------------------------------------------------------
1 | test_that("EBITDA per Share check", {
2 | df <- data.frame("symbol" = "AAPL")
3 | ebitda_per_share <- quant::get_ebitda_per_share(df)
4 | testthat::expect_equal(dim(ebitda_per_share), c(1,7))
5 | })
6 |
--------------------------------------------------------------------------------
/tests/testthat/test-get_eff_interest_rate.R:
--------------------------------------------------------------------------------
1 | test_that("Effective Interest Rate check", {
2 | df <- data.frame("symbol" = "AAPL")
3 | eff_interest_rate <- quant::get_eff_interest_rate(df)
4 | testthat::expect_equal(dim(eff_interest_rate), c(1,7))
5 | })
6 |
--------------------------------------------------------------------------------
/tests/testthat/test-get_eps_ex_nri.R:
--------------------------------------------------------------------------------
1 | test_that("EPS ex NRI check", {
2 | df <- data.frame("symbol" = "AAPL")
3 | eps_ex_nri <- quant::get_eps_ex_nri(df)
4 | testthat::expect_equal(dim(eps_ex_nri), c(1,7))
5 | })
6 |
--------------------------------------------------------------------------------
/tests/testthat/test-get_equity_to_assets.R:
--------------------------------------------------------------------------------
1 | test_that("Equity to Assets check", {
2 | df <- data.frame("symbol" = "AAPL")
3 | equity_to_assets <- quant::get_equity_to_assets(df)
4 | testthat::expect_equal(dim(equity_to_assets), c(1,7))
5 | })
6 |
--------------------------------------------------------------------------------
/tests/testthat/test-get_ev_to_ebit.R:
--------------------------------------------------------------------------------
1 | test_that("EV to EBIT check", {
2 | df <- data.frame("symbol" = "AAPL")
3 | ev_to_ebit <- quant::get_ev_to_ebit(df)
4 | testthat::expect_equal(dim(ev_to_ebit), c(1,7))
5 | })
6 |
--------------------------------------------------------------------------------
/tests/testthat/test-get_ev_to_ebitda.R:
--------------------------------------------------------------------------------
1 | test_that("EV to EBITDA check", {
2 | df <- data.frame("symbol" = "AAPL")
3 | ev_to_ebitda <- quant::get_ev_to_ebitda(df)
4 | testthat::expect_equal(dim(ev_to_ebitda), c(1,7))
5 | })
6 |
--------------------------------------------------------------------------------
/tests/testthat/test-get_ev_to_revenue.R:
--------------------------------------------------------------------------------
1 | test_that("EV to Revenue check", {
2 | df <- data.frame("symbol" = "AAPL")
3 | ev_to_revenue <- quant::get_ev_to_revenue(df)
4 | testthat::expect_equal(dim(ev_to_revenue), c(1,7))
5 | })
6 |
--------------------------------------------------------------------------------
/tests/testthat/test-get_fcf_per_share.R:
--------------------------------------------------------------------------------
1 | test_that("FCF per Share check", {
2 | df <- data.frame("symbol" = "AAPL")
3 | fcf_per_share <- quant::get_fcf_per_share(df)
4 | testthat::expect_equal(dim(fcf_per_share), c(1,7))
5 | })
6 |
--------------------------------------------------------------------------------
/tests/testthat/test-get_financial_distress.R:
--------------------------------------------------------------------------------
1 | test_that("Financial Distress check", {
2 | df <- data.frame("symbol" = "AAPL")
3 | financial_distress <- quant::get_financial_distress(df)
4 | testthat::expect_equal(dim(financial_distress), c(1,2))
5 | })
6 |
--------------------------------------------------------------------------------
/tests/testthat/test-get_financial_strength.R:
--------------------------------------------------------------------------------
1 | test_that("Financial Strength check", {
2 | df <- data.frame("symbol" = "AAPL")
3 | financial_strength <- quant::get_financial_strength(df)
4 | testthat::expect_equal(dim(financial_strength), c(1,2))
5 | })
6 |
--------------------------------------------------------------------------------