forked from jonathancornelissen/highfrequency
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakeReturns.Rd
27 lines (27 loc) · 954 Bytes
/
makeReturns.Rd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/dataHandling.R
\name{makeReturns}
\alias{makeReturns}
\title{Compute log returns}
\usage{
makeReturns(ts)
}
\arguments{
\item{ts}{a possibly multivariate matrix-like object containing prices in levels. If \code{ts} is an \code{xts} object, we return an \code{xts} object. Other types will result in a \code{matrix}}
}
\value{
Depending on input, either a \code{matrix} or an \code{xts} object containing the log returns.
}
\description{
Convenience function to calculate log-returns, also used extensively internally.
Accepts \code{xts} and \code{matrix}-like objects. If you use this with a \code{data.table} object, remember to not pass the \code{DT} column.
\deqn{
\mbox{log return}_t = (\log(\mbox{PRICE}_{t})-\log(\mbox{PRICE}_{t-1})).
}
}
\details{
Note: the first (row of) observation(s) is set to zero.
}
\author{
Jonathan Cornelissen, Kris Boudt, and Emil Sjoerup
}