spreads {timeSeries} | R Documentation |
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
x |
an object of class |
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
|
tickSize |
the default is |
Value
all functions return an object of class timeSeries
See Also
returns
,
cumulated
,
drawdowns
,
splits
,
midquotes
,
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
[Package timeSeries version 4032.109 Index]