ecd.data: Read sample data

ecd.dataR Documentation

Read sample data

Description

Read sample data by specifying the symbol. The two utilities, ecd.data and ecd.data.arr, serves for slightly different purpose. ecd.data works off the xts object that has two rows: the prices and log-returns indexed by the dates. ecd.data.arr and ecd.data.ts separate the data into list of three vectors: x is the log-return, p is the prices, and d is the dates. And allows for more sophisticated call for range of dates, and different ways of slice and lag. ecd.data.arr takes symbol as input, while ecd.data.ts takes an xts object.

Usage

ecd.data(symbol = "dji")

ecd.data.arr(
  symbol = "dji",
  start.date = "1950-01-01",
  end.date = "2015-12-31",
  on = "days",
  lag = 1,
  drop = 0,
  repeated = TRUE,
  cache = TRUE,
  do.kurtosis = FALSE
)

ecd.data.ts(
  ts,
  start.date = "1950-01-01",
  end.date = "2015-12-31",
  on = "days",
  lag = 1,
  drop = 0,
  repeated = TRUE,
  do.kurtosis = FALSE
)

Arguments

symbol

character, the symbol of the time series. Default: dji

start.date, end.date

Date or character of ISO format (YYYY-MM-DD), to specify the date range, default is from 1950-01-01 to 2015-12-31. Set start.date and end.date to NULL or "" if you wish to get the entire time series.

on

character, specify the calendar interval, days, weeks, months. Default is days.

lag

integer, specify the lags of return calculation, default is 1.

drop

integer, specify number of largest outliners to drop, default is 0.

repeated

logical, specify whether to use repeated sampling or unique sampling, default is TRUE. Using "repeated" sampling can reduce noise due to insufficient sample size. This is particularly useful for larger lags.

cache

logical, use R's options memory to cache xts data, default is TRUE.

do.kurtosis

logical, if specified, calculate mean, sd, var, skewness, and kurtosis, default is FALSE.

ts

xts, the time series

Value

ecd.data returns an xts object for the time series, with two columns - "Close" and "logr". ecd.data.arr and ecd.data.ts return a list of three vectors: x is the log-return, p is the prices, and d is the dates.

Examples

dji <- ecd.data()
wti <- ecd.data("wti")
spx <- ecd.data.arr("spx", lag=5)

ecd documentation built on May 10, 2022, 1:07 a.m.