Description Usage Arguments Details Value Author(s) See Also Examples
Calculates time series of ratio of 2 instruments using available data. Returned object will be ratios calculated using Bids, Asks, and Mids, or Opens, Closes, and Adjusteds.
1 | buildRatio(x, env = .GlobalEnv, silent = FALSE)
|
x |
vector of instrument names. e.g. c("SPY","DIA") |
env |
environment where xts data is stored |
silent |
silence warnings? |
x
should be a vector of 2 instrument names. An
attempt will be made to get
the data for both
instruments. If there are no xts data stored under
either of the names, it will try to return prebuilt data
with a call to .get_rate
.
If the data are not of the same frequency, or are not of the same type (OHLC, BBO, etc.) An attempt will be made to make them compatible. Preference is given to the first leg.
If the data in x[1]
is daily or slower and the
data in x[2]
is intraday (e.g. if you give it
daily OHLC and intraday Bid Ask Mid, it will use all of
the OHLC columns of x[1]
and only the the End of
Day Mid price of the BAM object.
If the data in x[1]
is intraday, and the data in
x[2]
is daily or slower, for each day, the
previous closing value of x[2]
will be filled
forward with na.locf
An xts object with columns of Bid, Ask, Mid OR Open, Close, Adjusted OR Price
Garrett See
redenominate
buildSpread
fn_SpreadBuilder
1 2 3 4 5 6 7 | ## Not run:
syms <- c("SPY","DIA")
getSymbols(syms)
rat <- buildRatio(syms)
summary(rat)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.