Description Usage Arguments Details Value Note Author(s) See Also Examples
Deletes data where the Bid-Ask spread is extremely wide, which is probably a bad print
1 | applyFilter(BAM, filter = 1e-04, verbose = TRUE)
|
BAM |
An xts object that has Bid, Ask, and |
filter |
a very small number that is the percentage of data to delete |
verbose |
TRUE/FALSE. If TRUE, the number of rows
that were removed will be printed to the standard output
connection via |
If you want to delete rows where the bid ask spread is wider than it is 98 pct of the time, use filter=0.02
Same as BAM only with fewer rows
If applyFilter is called with a filter value of 0, it may still filter the row with the widest Bid-Ask spread.
This is intended to clean data with extremely low bid prices, or extremely high ask prices, but currently does not filter out rows with high bid prices or low ask prices.
Garrett See
quantile
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ## Not run:
#Create psuedo-BAM data
getSymbols('SPY')
SPY <- cbind(Lo(SPY),Hi(SPY),Cl(SPY))
colnames(SPY) <- paste("SPY",c('Bid.Price','Ask.Price','Mid.Price'),sep='.')
#make some bad prints
SPY[length(SPY[,1])-4,1] <- 0
SPY[length(SPY[,1])-3,2] <- 10000
SPY[length(SPY[,1])-1,1] <- 0
tail(SPY) #look at the raw data
SPY <- applyFilter(SPY, filter=1e-02)
tail(SPY)
## End(Not run)
#
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.