Skip to content

Commit

Permalink
fixed {goodpractices} issues
Browse files Browse the repository at this point in the history
  • Loading branch information
msperlin committed Jun 21, 2024
1 parent 560f97d commit 7067d57
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 12 deletions.
2 changes: 2 additions & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Maintainer: Marcelo S. Perlin <marceloperlin@gmail.com>
Description: R port of eodhd API <https://eodhd.com/>, extended with a cache and quota system,
also offering functions for cleaning and aggregating the financial data.
License: MIT + file LICENSE
URL: https://github.com/msperlin/eodhd2
BugReports: https://github.com/msperlin/eodhd2/issues
Encoding: UTF-8
LazyData: true
Roxygen: list(markdown = TRUE)
Expand Down
7 changes: 5 additions & 2 deletions R/dividends.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#' Retrieves dividend data from the api
#'
#' This function will query the dividend end point <https://eodhd.com/financial-apis/api-splits-dividends> and return:
#' This function will query the dividend end point
#' <https://eodhd.com/financial-apis/api-splits-dividends> and return:
#' * dates (declaration, record, payment)
#' * value of dividend (adjusted and unajusted)
#' * currency of dividend
Expand Down Expand Up @@ -34,7 +35,9 @@ get_dividends <- function(ticker = "AAPL", exchange = "US",
df_div <- read_cache(f_out)

} else {
url <- glue::glue('https://eodhd.com/api/div/{ticker}.{exchange}?api_token={token}&fmt=json')
url <- glue::glue(
'https://eodhd.com/api/div/{ticker}.{exchange}?api_token={token}&fmt=json'
)

content <- query_api(url)

Expand Down
4 changes: 3 additions & 1 deletion R/exchanges.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ get_exchanges <- function(cache_folder = get_default_cache()) {
token <- get_token()

if (token == get_demo_token()) {
cli::cli_abort("You need a proper token (not \"{get_demo_token()}\") for retrieving the list of exchanges.")
cli::cli_abort(
"You need a proper token (not \"{get_demo_token()}\") for retrieving the list of exchanges."
)
}

f_out <-get_cache_file("cache", "exchange", cache_folder, "exchange-list")
Expand Down
12 changes: 8 additions & 4 deletions R/financials.R
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
#' Parses financial data from the API
#'
#' This function will organize the raw financial data from [eodhd2::get_fundamentals()], aggregating all information into a single dataframe,
#' including quarterly and yearly data from the Balance_sheet, Cashflow statement and Income statement. Whenever no financial data is found in
#' This function will organize the raw financial data from [eodhd2::get_fundamentals()],
#' aggregating all information into a single dataframe,
#' including quarterly and yearly data from the Balance_sheet,
#' Cashflow statement and Income statement. Whenever no financial data is found in
#' l_out, the function returns an empty dataframe.
#'
#' @param l_out A list with raw data (output from [eodhd2::get_fundamentals()])
#' @param type_table Format of table in output ("wide" or "long"). A "wide" table is a typical Excel column-oriented table where each columns is a data/year.
#' A long type of table row-oriented, where each each point of new information is a row of the table. The data is the same, it just changes the orientation of rows/columns.
#' @param type_table Format of table in output ("wide" or "long").
#' A "wide" table is a typical Excel column-oriented table where each columns is a data/year.
#' A long type of table row-oriented, where each each point of new information is
#' a row of the table. The data is the same, it just changes the orientation of rows/columns.
#' The default value is a "long" table.
#'
#' @export
Expand Down
2 changes: 1 addition & 1 deletion R/token.R
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ set_token <- function(token = get_demo_token()) {
#' get_demo_token()
get_demo_token <- function() {

token = "demo"
token <- "demo"

return(token)
}
Expand Down
3 changes: 2 additions & 1 deletion man/get_dividends.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions man/parse_financials.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7067d57

Please sign in to comment.