knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  eval = FALSE
)

These are the endpoints currently available. The order in which they're presented here follows the order at Finnhub.io

Setup

library(tidyverse)
library(finnhubr)

The finnhubr package is a R-wrapper around the Finnhub.io API. To get started, go to Finnhub and signup for an API key. Some of the endpoint are free to use.

Once you have an API key, you need to make it available to the finnhubr package by registering it as an environment variable.

set_finnhub_key('insert-your-key')

Once registered, confirm your key is accessible in the current working environment.

finnhub_key()

Internal datasets

# For Technical Indicators
moving_average_codes
technical_indicator_codes

# For company_symbols()
supported_stock_exchanges

# For index calls
supported_indices

Stock Fundamentals

company_profile('NVDA')
company_profile2('NVDA')
# Internal data of supported indicies for company_symbols()
supported_stock_exchanges
company_symbols('US')
company_executive('NVDA')

general_news()
forex_news()
crypto_news()
merger_news()

company_news('NVDA', from = '2020-05-01', to = lubridate::today())

#-----------------------------
# These point to the same endpoint - Finnhub in the process of changing?
# New endpoint
press_releases('NVDA')
press_releases('NVDA', from = lubridate::today() - 365, to = lubridate::today())
# Old endpoint
major_developments('NVDA')
major_developments('NVDA', from = lubridate::today() - 365, to = lubridate::today())
#-----------------------------

news_sentiment('NVDA')

peers('NVDA')

#------------------------------
# Changing endpoints - can only query all endpoints?  Margin, valuation and price endpoints
# going away?  Margin, valuation and price metrics ARE included in all metrics.
all_metrics('NVDA')
valuation_metrics('NVDA')
margin_metrics('NVDA')
price_metrics('NVDA')
#------------------------------

#------------------------------
# Changed endpoint for investor ownership
# Old endpoint?
investor_ownership('NVDA')
# New endpoint
ownership('NVDA')
ownership('NVDA', limit = 50)
#------------------------------

fund_ownership('NVDA')

balance_sheet('BAC', freq = 'annual')
balance_sheet('CAT', freq = 'quarterly')

income_statement('BAC', freq = 'annual')
income_statement('BAC', freq = 'quarterly')
income_statement('BAC', freq = 'ttm')

cashflow_statement('BAC', freq = 'annual')
cashflow_statement('BAC', freq = 'quarterly')
cashflow_statement('BAC', freq = 'ttm')
cashflow_statement('BAC', freq = 'ytd')

reported_financials('BAC', freq = 'annual')
reported_financials('BAC', freq = 'quarterly')

filings('NVDA')

# International Filings - New Endpoint, no function yet

similarity_index('BAC', freq = 'annual')
similarity_index('BAC', freq = 'quarterly')

ipo_calendar()
ipo_calendar(from = lubridate::today() - 365, 
             to = lubridate::today())

stock_dividends('NVDA')

Stock Estimates

recommendation_trends('NVDA')

price_target('NVDA')

# Upgrade-Downgrade is only endpoint classified as UTC time as instruction 
# by finnhub helpdesk
upgrade_downgrade('NVDA', from = lubridate::today() - 720)

revenue_estimates('NVDA', freq = 'quarterly')
revenue_estimates('NVDA', freq = 'annual')

eps_estimates('NVDA', freq = 'quarterly')
eps_estimates('NVDA', freq = 'annual')
eps_surprises('NVDA')

earnings_calendar('NVDA')
earnings_calendar('NVDA', from = lubridate::today() - 720)
earnings_calendar('NVDA', international = 'false')

Stock Price

stock_quote('NVDA')

stock_candles('NVDA')
stock_candles('NVDA', resolution = '1')
stock_candles('NVDA', resolution = '5')
stock_candles('NVDA', resolution = '15')
stock_candles('NVDA', resolution = '30')
stock_candles('NVDA', resolution = '60')
stock_candles('NVDA', resolution = 'D')
stock_candles('NVDA', from = lubridate::today() - 365, resolution = 'W')
stock_candles('NVDA', from = lubridate::today() - 365, resolution = 'M')

# limit: Number of ticks returned.  Limit is 25000
# Unixtime not converted to YMDHMSss
tick_data('NVDA', limit = 2500)

bid_ask('NVDA')

stock_splits('AAPL')
stock_splits('AAPL', from = lubridate::today() - 720)

ETFs & Indicies

# Internal data for index calls
supported_indices

indices_constituents('^GSPC')
indices_constituents('^DJI')

historical_constituents('^GSPC')
historical_constituents('^DJI')

# Need an internal data set of supported ETFs.  List from etfdb.com?
etf_profile('SPY')
etf_profile('XLK')
etf_profile('IYW')

etf_holdings('SPY')
etf_holdings('XLK')
etf_holdings('IYW')

etf_industry_exposure('SPY')
etf_industry_exposure('XLK')
etf_industry_exposure('IYW')

etf_country_exposure('SPY')
etf_country_exposure('XLK')
etf_country_exposure('IYM')
etf_country_exposure('VIGI')

Forex

forex_exchanges()

forex_symbols(forex_exchange = 'oanda')
forex_symbols(forex_exchange = 'fxcm')
forex_symbols(forex_exchange = 'forex.com')
forex_symbols(forex_exchange = 'ic markets')
forex_symbols(forex_exchange = 'octafx')
forex_symbols(forex_exchange = 'fxpig')
forex_symbols(forex_exchange = 'pepperstone')
forex_symbols(forex_exchange = 'fxpro')
forex_symbols(forex_exchange = 'icmtrader')

forex_candles('OANDA:EUR_USD')
forex_candles('OANDA:EUR_USD', resolution = '1') # Not working?
forex_candles('OANDA:EUR_USD', resolution = '5')
forex_candles('OANDA:EUR_USD', resolution = '15')
forex_candles('OANDA:EUR_USD', resolution = '30')
forex_candles('OANDA:EUR_USD', resolution = '60')
forex_candles('OANDA:EUR_USD', resolution = 'D', from = today() - 365, to = today())
forex_candles('OANDA:EUR_USD', from = today() - 365, resolution = 'W')
forex_candles('OANDA:EUR_USD', from = today() - 365, resolution = 'M')

# All foreign exchange rates in chosen currency
forex_rates('USD')
forex_rates('EUR')

Cryptocurrency

crypto_exchanges()

crypto_symbols(exchange = 'COINBASE')

all_cryptos <- crypto_exchanges() %>% 
  dplyr::pull(crypto_exchange) %>% 
  purrr::map(crypto_symbols) %>% 
  dplyr::bind_rows()

crypto_candles('COINBASE:ETC-BTC')
crypto_candles('COINBASE:ETC-BTC', resolution = '1')
crypto_candles('COINBASE:ETC-BTC', resolution = '5')
crypto_candles('COINBASE:ETC-BTC', resolution = '15')
crypto_candles('COINBASE:ETC-BTC', resolution = '30')
crypto_candles('COINBASE:ETC-BTC', resolution = '60')
crypto_candles('COINBASE:ETC-BTC', resolution = 'D', from = today() - 365, to = today())
crypto_candles('COINBASE:ETC-BTC', from = today() - 365, resolution = 'W')
crypto_candles('COINBASE:ETC-BTC', from = today() - 365, resolution = 'M')

Technical Indicators

pattern_recognition('AAPL')

support_resistance('NVDA')
support_resistance('NVDA', resolution = '1') # Not working
support_resistance('NVDA', resolution = '5') # Not working
support_resistance('NVDA', resolution = '15') 
support_resistance('NVDA', resolution = '30') 
support_resistance('NVDA', resolution = '60') 
support_resistance('NVDA', resolution = 'D')
support_resistance('NVDA', resolution = 'W')
support_resistance('NVDA', resolution = 'M')

aggregate_indicators('NVDA')
aggregate_indicators('NVDA', resolution = '1') # Not working
aggregate_indicators('NVDA', resolution = '5')
aggregate_indicators('NVDA', resolution = '15') 
aggregate_indicators('NVDA', resolution = '30') 
aggregate_indicators('NVDA', resolution = '60')
aggregate_indicators('NVDA', resolution = 'D')
aggregate_indicators('NVDA', resolution = 'W')
aggregate_indicators('NVDA', resolution = 'M')

technical_indicators('NVDA')
technical_indicators('NVDA', indicator = 'SMA')
technical_indicators('NVDA', indicator = 'EMA')
technical_indicators('NVDA', indicator = 'TEMA')
technical_indicators('NVDA', indicator = 'RSI')
technical_indicators('NVDA', indicator = 'BBANDS')
technical_indicators('NVDA', resolution = 1, indicator = 'BBANDS')
technical_indicators('NVDA', resolution = 5)
technical_indicators('NVDA', resolution = 15)
technical_indicators('NVDA', resolution = 30)
technical_indicators('NVDA', resolution = 60)
technical_indicators('NVDA', resolution = 'D')
technical_indicators('NVDA', from = lubridate::today() - 365, resolution = 'W', indicator = 'BBANDS')

Alternative Data

# Premium endpoint, no access
transcripts_list('NVDA')

# Premium endpoint, no access
transcripts('AAPL_162777')

covid()

Economic

country_list()

economic_calendar()

economic_code()
us_unempoyment <- economic_code() %>% 
  dplyr::filter(stringr::str_detect(name, 'Unemployment'),
                country == 'United States')
us_unemployment

# Multiple codes at once
us_codes <- economic_code() %>%
 dplyr::filter(country == 'United States') %>%
 dplyr::slice(1:5) %>% # Top 5
 dplyr::pull(code)
us_codes

economic_data('MA-USA-857882') # Unemployment Rate - United States
# Multipe U.S. codes and joined back to economic_code() metadata
us_econ_data <- purrr::map(us_codes, economic_data) %>% 
 dplyr::bind_rows() %>% 
 dplyr::left_join(economic_code(), by = 'code')


threadingdata/finnhubr documentation built on Aug. 10, 2020, 12:48 a.m.