knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
The goal of financer is to retrieve (free) financial information of companies from several websites using R.
You can install the development version of financer from GitHub with:
# install.packages("devtools") devtools::install_github("montecapital/financer")
This is a basic example which shows you how to retrieve information of Illumina Inc. Use Yahoo Finance for basic information:
library(financer) # tiker of Illumina Inc. tikr = "ILMN" # Overview ilmn.ovrw = yahoo_scrape("ILMN") ilmn.ovrw[[2]] # Key-statistics ilmn.stat = yahoo_scrape("ILMN", page = "key-statistics", ntable = "all") # Valuation measures ilmn.stat[[1]] # Analysis page ilmn.anal = yahoo_scrape("ILMN", page = "analysis", ntable = "all") # Expected revenues ilmn.anal[[2]]
Go to Morningstar for more detail information such as the 5-Year financial reports:
# NASDAQ: Stock exchange in which Illumina operates mrkt = "XNAS" # Get the Income Statement ilmn.is = morning_report(tikr, mrkt, "is") # Extract the revenue ilmn.is["Revenue",] # Get the Balance Sheet ilmn.bs = morning_report(tikr, mrkt, "bs") # Extract cash and cash equivalents ilmn.bs["Cash_and_cash_equivalents",] # Get the Cash Flow ilmn.cf = morning_report(tikr, mrkt, "cf") # Show the free cash flow ilmn.cf["Free_cash_flow",]
Or you can inspect the key ratios:
# get the key ratios ilmn.kr = morning_keyratios("ILMN", "XNAS") # print growth head(ilmn.kr[[4]])
If looking good, visit Quick FS for a 10-Year financial report. It requires a subscription, but the free version offers 500 requests a day:
# Illumina operates in the US country = "US" # check current quota quickfs_quota() # get the statements ilmn.fstat.long = quickfs_getstatement("ILMN", "US") ilmn.fstat.long$finances$finances_ts["revenue",] # financial statements "cost" 10 points quickfs_quota()
This is a personal project and doesn't come with any guarantee.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.