# rCumSum: Plot cummulative returns In highfrequency: Tools for Highfrequency Data Analysis

## Description

Plots cummulative returns at a certain alignment given a return series.

## Usage

 ```1 2``` ```rCumSum(x, period = 1, align.by="seconds",align.period = 1, plotit = FALSE, type = "l", cts = TRUE, makeReturns = FALSE) ```

## Arguments

 `x` Tick data in xts object. `period` Sampling period `align.by` Align the tick data to seconds|minutes|hours `align.period` Align the returns to this period first `plotit` T for plot `type` Line or points `cts` Create calendar time sampling if a non realizedObject is passed `makeReturns` Prices are passed make them into log returns

## Value

Cummulative return vector if plotit = F

## Author(s)

Scott Payseur <sco[email protected]>

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12``` ```data(sbux.xts) cumm <- list() cumm[[1]] <- rCumSum(sbux.xts, period=1, align.by="seconds", align.period=60) cumm[[2]] <- rCumSum(sbux.xts, period=10, align.by="seconds", align.period=60) cumm[[3]] <- rCumSum(sbux.xts, period=20, align.by="seconds", align.period=60) cumm[[4]] <- rCumSum(sbux.xts, period=30, align.by="seconds", align.period=60) plot(cumm[[1]], xlab="", ylab="Cumulative Ruturns", main="Starbucks (SBUX)", sub='20110701', type="p", col=16, lwd=2) lines(cumm[[2]], col=2, lwd=2) lines(cumm[[3]], col=3, lwd=2) lines(cumm[[4]], col=4, lwd=2) ```

### Example output

```Loading required package: xts

Attaching package: 'zoo'

The following objects are masked from 'package:base':

as.Date, as.Date.numeric

xts -> realizedObject [2010-07-01 13:30:00 :: 2010-07-01 20:00:00]
xts -> realizedObject [2010-07-01 13:30:00 :: 2010-07-01 20:00:00]
xts -> realizedObject [2010-07-01 13:30:00 :: 2010-07-01 20:00:00]
xts -> realizedObject [2010-07-01 13:30:00 :: 2010-07-01 20:00:00]
xts -> realizedObject [2010-07-01 13:30:00 :: 2010-07-01 20:00:00]
xts -> realizedObject [2010-07-01 13:30:00 :: 2010-07-01 20:00:00]
xts -> realizedObject [2010-07-01 13:30:00 :: 2010-07-01 20:00:00]
xts -> realizedObject [2010-07-01 13:30:00 :: 2010-07-01 20:00:00]
```

highfrequency documentation built on May 31, 2017, 4:34 a.m.