stocks: Build Stocks Dataset

Description Usage Arguments Details Value

View source: R/stocks.R

Description

This function is the creator for an S3 class of structured dataset on stocks.

Usage

1
2
stocks(data = NULL, Names = NULL, date.col = 1, price.col = -1,
  rate.col = NULL, divRate.col = NULL)

Arguments

data

a data frame, the raw data that contains stock prices.

Names

a character vector, the symbols of the stocks.

date.col

an integer or a character string that specifies the date column in data.

price.col

a vector of integers or character strings that specifies the price columns in data.

rate.col

an integer or a string that specifies the column for risk free rate.

divRate.col

a vector of integers or strings that specifies the columns for dividend rates.

Details

This function builds a stocks dataset by organizing raw data into a structured form. If Names==NULL, the stocks will be automatically named as "S1", "S2", and so on. If the raw data does not have a date column, date.col should be set to NULL, and the data is regarded as in reverse chronological order.

Value

An object of class stocksData, which stores the structured data of stocks.


zhangkd5/riskCalc documentation built on May 4, 2019, 10:16 p.m.