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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
|
\name{spreads}
\alias{spreads}
\alias{midquotes}
\alias{spreadSeries} % removed
\alias{midquoteSeries} % removed
\title{Spreads and mid quotes}
\description{
Compute spreads and midquotes from price streams.
}
\usage{
spreads(x, which = c("Bid", "Ask"), tickSize = NULL)
midquotes(x, which = c("Bid", "Ask"))
}
\arguments{
\item{x}{
an object of class \code{timeSeries}.
}
\item{which}{
a vector with two character strings naming the column names of the
time series from which to compute the mid quotes and spreads. By
default these are the bid and ask prices with column names
\code{c("Bid", "Ask")}.
}
\item{tickSize}{
the default is \code{NULL} to simply compute price changes in
original price levels. If \code{ticksize} is supplied, the price
changes will be divided by the value of \code{inTicksOfSize} to
compute price changes in ticks.
}
}
\value{
all functions return an object of class \code{timeSeries}
}
\seealso{
\code{\link{returns}},
\code{\link{cumulated}},
\code{\link{drawdowns}},
\code{\link{splits}},
%\code{\link{spreads}},
\code{\link{midquotes}},
\code{\link{index2wealth}}
}
\examples{
## Load the Microsoft Data -
setRmetricsOptions(myFinCenter = "GMT")
data(MSFT)
X = MSFT[1:10, ]
head(X)
## Compute Open/Close Midquotes -
X.MID <- midquotes(X, which = c("Close", "Open"))
colnames(X.MID) <- "X.MID"
X.MID
## Compute Open/Close Spreads -
X.SPREAD <- spreads(X, which = c("Close", "Open"))
colnames(X.SPREAD) <- "X.SPREAD"
X.SPREAD
}
\keyword{chron}
|