Learn R Programming

eodhd (version 1.0.4)

get_eod_historical_stock_market_data: Get historical data

Description

This function retrieves historical data from the API.

Usage

get_eod_historical_stock_market_data(
  api_token,
  symbol,
  from_date = NULL,
  to_date = NULL,
  period = "d",
  order = "a"
)

Value

A list containing the historical data.

Arguments

api_token

The API token for authentication.

symbol

consists of two parts: SYMBOL_NAME.EXCHANGE_ID, then you can use, for example, AAPL.MX for Mexican Stock Exchange. or AAPL.US for NASDAQ

from_date

Format: YYYY-MM-DD. The start date for earnings data, if not provided, today will be used.

to_date

Format: YYYY-MM-DD. The end date for earnings data, if not provided, today + 7 days will be used.

period

use 'd' for daily, 'w' for weekly, 'm' for monthly prices. By default, daily prices will be shown.

order

use ‘a’ for ascending dates (from old to new), ‘d’ for descending dates (from new to old).

Examples

Run this code
api_token <- "demo"
from_date <- "2017-09-10"
to_date <- "2017-09-12"
symbol <- "AAPL.MX"
period <- "d"
order <- "a"
result <- get_eod_historical_stock_market_data(api_token, symbol, from_date, to_date, period, order)

Run the code above in your browser using DataLab