spread {bidask}  R Documentation 
Estimation of BidAsk Spreads from Open, High, Low, and Close Prices
Description
This function implements several methods to estimate bidask spreads from open, high, low, and close prices.
Usage
spread(x, width = nrow(x), method = "EDGE", sign = FALSE, na.rm = FALSE)
Arguments
x 

width 
integer width of the rolling window to use, or vector of endpoints defining the intervals to use. By default, the whole time series is used to compute a single spread estimate. 
method 
the estimator(s) to use. See details. 
sign 
whether signed estimates should be returned. 
na.rm 
whether missing values should be ignored. 
Details
The method EDGE
implements the Efficient Discrete Generalized Estimator described in Ardia, Guidotti, & Kroencke (2021).
The methods OHL
, OHLC
, CHL
, CHLO
implement the generalized estimators described in Ardia, Guidotti, & Kroencke (2021).
They can be combined by concatenating their identifiers, e.g., OHLC.CHLO
uses an average of the OHLC
and CHLO
estimators.
The method AR
implements the estimator described in Abdi & Ranaldo (2017). AR2
implements their 2period version.
The method CS
implements the estimator described in Corwin & Schultz (2012). CS2
implements their 2period version. Both versions are adjusted for overnight (closetoopen) returns as described in the paper.
The method ROLL
implements the estimator described in Roll (1984).
Value
Time series of spread estimates. A value of 0.01 corresponds to a spread of 1%.
Note
Please cite Ardia, Guidotti, & Kroencke (2021) when using this package in publication.
References
Ardia, D., Guidotti E., & Kroencke T. A. (2021). Efficient Estimation of BidAsk Spreads from Open, High, Low, and Close Prices. Available at SSRN: https://www.ssrn.com/abstract=3892335
Abdi, F., & Ranaldo, A. (2017). A simple estimation of bidask spreads from daily close, high, and low prices. Review of Financial Studies, 30 (12), 44374480. doi:10.1093/rfs/hhx084
Corwin, S. A., & Schultz, P. (2012). A simple way to estimate bidask spreads from daily high and low prices. Journal of Finance, 67 (2), 719760. doi:10.1111/j.15406261.2012.01729.x
Roll, R. (1984). A simple implicit measure of the effective bidask spread in an efficient market. Journal of Finance, 39 (4), 11271139. doi:10.1111/j.15406261.1984.tb03897.x
Examples
# simulate open, high, low, and close prices with spread 1%
x < sim(spread = 0.01)
# estimate the spread
spread(x)
# by default this is equivalent to
edge(x$Open, x$High, x$Low, x$Close)
# estimate the spread using a rolling window of 21 periods
spread(x, width = 21)
# estimate the spread for each month
ep < xts::endpoints(x, on = "months")
spread(x, width = ep)
# use multiple estimators
spread(x, method = c("EDGE", "AR", "CS", "ROLL", "OHLC", "OHL.CHL"))