Unlimited learning, half price | 50% off

Last chance! 50% off unlimited learning

Sale ends in


ecd (version 0.9.2.4)

ecd.df2ts: Utility to standardize timeseries from data.frame to xts

Description

This utility converts the df input to an xts object with columns and statistics required for the fitting/plot utility in the ecd package. The require columns are Date, Close, logr. This utility can also be used to convert the input from Quandl.

Usage

ecd.df2ts(
  df,
  date_format = "%m/%d/%Y",
  dt = "Date",
  col_in = "Close",
  col_out = "Close",
  do.logr = TRUE,
  rnd.zero = 0.01
)

Arguments

df

Data.frame of the time serie

date_format

Character, date format of the input date column. It can be NULL to indicate no date conversion is needed. Default: "%m/%d/%Y".

dt

Character, the name of the input date column. Default: "Date"

col_in

Character, the name of the input closing price column. Default: "Close"

col_out

Character, the name of the output closing price column. Default: "Close"

do.logr

logical, if TRUE (default), produce xts object of logr; otherwise, just the col_out column.

rnd.zero

numeric, a small random factor (scaled to sd of logr) to avoid an unreal peak of zero log-returns.

Value

The xts object for the time series

Examples

Run this code
# NOT RUN {
ecd.df2ts(df)
# }

Run the code above in your browser using DataLab