The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.

IEX Stocks and Market Data via IEX API

Myriam Ibrahim

2021-04-23

The main goal of Riex is to efficiently retrieve financial and market data using IEX Cloud API. In addition, provide robust tool to:

Please make sure to review and acknowledge IEX Terms of Use before using Riex.

Effective June 1st, 2019, subscription will be required to access third party data.

For subscriptions details, visit IEX - Flexible, scalable pricing.

Additional details about usage calculations available in Data Weight - section as well as best practice about storing and sharing Private & Public Secret Key

Installation

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

install.packages("Riex")

Examples

Following are basic examples that will demonstrate how to use Riex to retrieve Stock and Market information via IEX Cloud API.

List of parameters and their valid values:

Load Riex

library(Riex)
#> Loading required package: xts
#> Loading required package: zoo
#> 
#> Attaching package: 'zoo'
#> The following objects are masked from 'package:base':
#> 
#>     as.Date, as.Date.numeric
#> Loading required package: TTR
#> Loading required package: tidyr
#> Loading required package: tibble
#> Registered S3 method overwritten by 'quantmod':
#>   method            from
#>   as.zoo.data.frame zoo
sk <- "[SECRET KEY]"
x <- "TSLA"
r <- "6m"

Chart

TSLA <- iex.chart(x, r, sk)

Load quantmod package

library(quantmod)

Generate Barchart

barChart(TSLA)
TSLA 6 Months Chart

TSLA 6 Months Chart

To check available themes to customize visualization

names(quantmod:::.chart.theme)

To apply a different Theme

barChart(TSLA, theme="white")

If you receive an error run:

par("mar")

In case response is similar to the following: [1] 5.1 4.1 4.1 2.1, then run:

par(mar=c(1,1,1,1))
barChart(TSLA)
chartSeries(TSLA)

When possible, results from functions matches OHLC standards for quantomd package to leverage its capabilities. Future enhancements to Riex will be geared toward enabling comprehensive financial analysis & modeling.

Refer to quantomd documentation for additional details about customizing visualization.

Most Active

Most_Active <- iex.most.active(sk)
Most_Active['companyName']

Book

iex.book("GM", sk)

Earnings

iex.earnings("GM", sk)

Financials

The following default functions retrieve income statement, balance sheet, and cash flow data from the most recent reported quarter. Upon further testing of IEX Cloud API, additional parameter “p” will be added to allow user to specify annual or quarterly financials.

Results are rendered in data frame format to allow further manipulation in case of multiple stocks

GM_BS <- iex.balance.sheet("GM", sk)
str(GM_BS)

Similarly, you can generate the previous quarter Income Statement and Cash Flow statement:

GM_IS <- iex.income("GM", sk)
GM_CF <- iex.cash.flow("GM", sk)

Key Stats

Function returns a data frame that includes 20 observations - e.g. PE ratio, number of employees and 52 Weeks high and low, ..etc.

iex.stats("TSLA", sk)

Crypto

Bitcoin <- crypto("BTCUSDT", sk)
Bitcoin

list of available crypto currency symbols in IEX as of April 26th, 2019 is included as dataset with Riex package and can be viewed using crypto_symbols.

crypto_symbols

for most current list, Visit IEX-Reference Data

Company Information

TSLA_Co <- iex.company(x, sk)

Account

Visit IEX Cloud API - Account Section for more details. The following functions provide Account and usage details based on Secret Token provided. Please make sure to monitor usage regularly as it impacts billing depending on your Account setup.

Account Metadata

Output includes Total Message Limit and Total Message Used in addition to useful info. - e.g. Tier Name

iex.account(sk)

Usage

Output includes Monthly Usage, Monthly Pay As You Go and Token Usage.

iex.usage(sk)

Key Usage

Key Usage includes the detailed usage by API Call type.

iex.key.usage (sk)

For example:

Type with “0” usage are included as well. For example, ACCOUNT_USAGE.

Daily Usage

Output includes Total usage per day. Date format is xyyyymmdd - e.g. X20190423

iex.daily.usage(sk)

Monthly Usage

Output includes Total usage per month.

iex.monthly.usage(sk)

Quote of the Day and Everyday !

“He who gives up [code] safety for [code] speed deserves neither.” - Hadley Wickham

Hadley Wickham Quote

Hadley Wickham Quote

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.