Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

fin-daily

Special Daily Time Series


Description

Special daily 'timeSeries' functions.

Usage

dummyDailySeries(x = rnorm(365), units = NULL, zone = "",
    FinCenter = "")
alignDailySeries(x, method = c("before", "after", "interp", "fillNA",
    "fmm", "periodic", "natural", "monoH.FC"),
    include.weekends = FALSE, units = NULL, zone = "",
    FinCenter = "", ...)
rollDailySeries(x, period = "7d", FUN, ...)

Arguments

FinCenter

a character with the the location of the financial center named as "continent/city".

FUN

the function to be applied.
[applySeries] -
a function to use for aggregation, by default colAvgs.

include.weekends

[alignDailySeries] -
a logical value. Should weekend dates be included or removed from the series.

method

[alignDailySeries] -
the method to be used for the alignment. A character string, one of "before", use the data from the row whose position is just before the unmatched position, or "after", use the data from the row whose position is just after the unmatched position, or "linear", interpolate linearly between "before" and "after".

period

[rollDailySeries] -
a character string specifying the rollling period composed by the length of the period and its unit, e.g. "7d" represents one week.

units

[allignDailySeries] -
an optional character string, which allows to overwrite the current column names of a timeSeries object. By default NULL which means that the column names are selected automatically.

x

an object of class timeSeries.

zone

the time zone or financial center where the data were recorded.

...

arguments passed to interpolating methods.

Details

dummyDailySeries Creates a dummy daily 'timeSeries' object,
alignDailySeries Aligns a daily 'timeSeries' to new positions,
rollDailySeries Rolls daily a 'timeSeries' on a given period,
ohlcDailyPlot Plots open high low close bar chart,
dummySeries Creates a dummy monthly 'timeSeries' object

Value

dummyDailySeries
creates from a numeric matrix with daily records of unknown dates a timeSeries object with dummy daily dates.

alignDailySeries
returns from a daily time series with missing holidays a weekly aligned daily timeSeries object

rollDailySeries

returns an object of class timeSeries with rolling values, computed from the function FUN.

Examples

## Use Microsofts' OHLCV Price Series -
   head(MSFT)
   end(MSFT)

## Cut out April Data from 2001 -
   Close <- MSFT[, "Close"]
   tsApril01 <- window(Close, start="2001-04-01", end="2001-04-30")
   tsApril01

## Align Daily Series with NA -
   tsRet <- returns(tsApril01, trim = TRUE)
   GoodFriday(2001)
   EasterMonday(2001)
   alignDailySeries(tsRet, method = "fillNA", include.weekends = FALSE)
   alignDailySeries(tsRet, method = "fillNA", include.weekends = TRUE)

## Align Daily Series by Interpolated Values -
   alignDailySeries(tsRet, method = "interp", include.weekend = FALSE)
   alignDailySeries(tsRet, method = "interp", include.weekend = TRUE)

timeSeries

Financial Time Series Objects (Rmetrics)

v3062.100
GPL (>= 2)
Authors
Diethelm Wuertz [aut] (original code), Tobias Setz [cre], Yohan Chalabi [ctb], Martin Maechler [ctb] (<https://orcid.org/0000-0002-8685-9910>)
Initial release
2020-01-24

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.