Learn R Programming

rfinance

The goal of rfinance is to provide a user-friendly suit of tools to perform financial analysis on R.

Installation

You can install the released version of rfinance from CRAN with:

install.packages("rfinance")

Basic Usage

Historic Prices

Let's say that you want to download all historic prices from a given company. get_prices() will let you do just that and get it stored in a data.frame. You just need to specify the symbol. In the case of this example, Microsoft's symbol is MSFT.

library(rfinance)
df <- get_prices(symbol = 'MSFT')

Financial Statements

In most financial analysis, the financial statements released by firms are arguably the more important variables, and the harder to get.

rfinance provies a set of functions to get the different financial statements of any public company.

msft_statements <- get_statements("MSFT")

Tickers List

At this point it'd be natural to ask yourself what companies are available for this. rfinance includes a function to check just that. get_tickers() will give you an array of all the symbols available in the API.

symbols_list <- get_tickers()

Copy Link

Version

Install

install.packages('rfinance')

Monthly Downloads

6

Version

0.1.0

License

MIT + file LICENSE

Maintainer

Alejandro Jimenez Rico

Last Published

October 26th, 2021

Functions in rfinance (0.1.0)

build_yahoo_url

Build Yahoo URL
ConnectionHandler

ConnectionHandler class
get_handle

Gets a Handle Object
calculate_sharpe_ratio

Provided a returns time series, it will return Sharpe Ratio
get_dividends

Dividend payments history
date_to_unix

Date To Unix
log_out

Log Out
log_in

Log In
get_sp500

get_sp500
get_splits

Functions to call and retrieve financial data from remote databases, by using company tickers (symbols). It uses publicly available API to download all data.
get_statements

Get Statements
get_tickers

Download list of tickers from a given public index
%>%

Pipe operator
check_credentials

Check Credentials
get_prices

Download historic prices of a given company
calculate_alpha

Provided a returns time series, it will return Jensen's Alpha
adjust_for_splits

Adjust For Splits