Skip to contents

This function will use the json api to retrieve dividends from Yahoo finance.

Usage

yf_get_dividends(ticker, first_date = Sys.Date() - 365, last_date = Sys.Date())

Arguments

ticker

a single ticker symbol

first_date

The first date of query (Date or character as YYYY-MM-DD)

last_date

The last date of query (Date or character as YYYY-MM-DD)

Value

a tibble with dividends

Examples

yf_get_dividends(ticker = "PETR4.SA")
#>  Be aware that YF does not provide a consistent dividend database. Use this function with caution.
#> # A tibble: 4 × 3
#>   ref_date   ticker   dividend
#>   <date>     <chr>       <dbl>
#> 1 2023-04-28 PETR4.SA     2.93
#> 2 2023-06-13 PETR4.SA     1.89
#> 3 2023-08-22 PETR4.SA     1.15
#> 4 2023-11-22 PETR4.SA     1.36