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: 5 × 3
#>   ref_date   ticker   dividend
#>   <date>     <chr>       <dbl>
#> 1 2023-11-22 PETR4.SA     1.37
#> 2 2024-04-26 PETR4.SA     1.15
#> 3 2024-05-03 PETR4.SA     1.78
#> 4 2024-06-12 PETR4.SA     1.04
#> 5 2024-08-22 PETR4.SA     1.05