I am building a portfolio simulator and finding ways to make it more 'realistic'. For example, giving the option to reinvest dividends, include capital gain taxes, commission/fees (fixed for now) etc. Regarding slippage/latency, however, I'd like to make a more dynamic model. Have you ever had experience for modeling slippage? For example, as a function of volume and volatility (already embedded in OHLCV data) rather than using the order book for the spread?

Thank you for your guidance :)

  • $\begingroup$ You say you want to analyze latency/slippage without order book data (and mention OHLCV data). Does that mean you could also use intraday trades without the order book? The answers you have so far are assuming OHLCV data, but if you can use intraday trades then much sharper results can be had. $\endgroup$
    – kurtosis
    Aug 14, 2020 at 16:53

2 Answers 2


I'm going to assume that by analyzing "slippage" you mean transactions costs.

Analyzing Latency

First, I will say that analyzing latency issues is incredibly hard. You probably do not even know where your strategy will be located: colocated? not colo but close by? You also do not know how fast your algorithm will respond to a signal: milliseconds? micros? nanos? For example, colocation at the CME of Trading Technologies software on a shared server can sometimes achieve response times in the 100-300 microsecond range. I know other software people have created that responds in the millisecond range.

I would not get too deep on analyzing latency apart from (maybe) comparing different software or brokers.

Estimating Bid-Ask Spreads

It might seem hopeless to analyze slippage, but that is not so. There are some excellent papers on estimating bid-ask spreads from daily close or OHLCV data.

Roll (1984)

First, you could use Roll's (1984) work on bid-ask spreads and estimate spreads as $\sqrt{-\textrm{cov}(r_t,r_{t-1})}$.

Zhang, Mykland, and Aït-Sahalia (2005)

You could also look at Zhang, Mykland, and Aït-Sahalia's (2005) TSRV work which estimates variances but has to correct for the "microstructure noise pollution" caused by bid-ask bounce. They have a subtractive correction: their adjusted "fast scale" estimator $\frac{\bar{n}_k}{n-\bar{n}_k}\sum_{i=1}^n r_i^2$. You could use that as something similar to the $2c^2$ in Roll's model.

Corwin and Schultz (2012)

Another approach would be to use Corwin and Schultz's (2012) method for estimating volatilities and bid-ask spreads from OHLCV data. Their method is a bit more involved, but has some economic reasoning behind it: they assume high prices are likely executed at the offer and low prices were likely executed at the bid.

They then look at highs and lows for one- and two-day periods. They estimate an average squared daily one-day "log-return" from low to high ($\log(H_t/L_t)$) and the squared two-day "log-return" from the two-day low to high. $$ \begin{align} \hat\beta &= \frac{1}{n/2}\sum_{j=1}^{n/2}\sum_{i=2j-1}^{2j} [\log(H_i/L_i)]^2, \\ \hat\gamma &= \frac{1}{n/2}\sum_{j=1}^{n/2} \left[\log\left(\frac{\max(H_{2j-1},H_{2j})}{\min(L_{2j-1},L_{2j})}\right)\right]^2. \end{align} $$ That lets them solve a system of equations since variance scales linearly with time while the bid-ask spread is assumed to be constant across both days: $$ \begin{align} \beta &= 2k_1\sigma^2 +4k_2 \sigma \alpha + 2\alpha^2, \quad \text{and}\\ \gamma &= 2k_1\sigma^2 +2\sqrt{2}k_2 \sigma \alpha + \alpha^2 \quad \text{where} \\ \alpha &= \log\left(\frac{2+S}{2-S}\right), \quad S = \text{spread}, \\ k_1 &= 4\log(2), ~\text{and} \quad k_2 = \sqrt{\frac{8}{\pi}}. \end{align} $$

Abdi and Ranaldo (2017)

Finally, you could try Abdi and Ranaldo's (2017) method. They assume, like Corwin and Schultz, that highs are at the offer and lows are at the bid. However, they also use close prices and presume there is some efficient price for lows, highs, and close prices $l_t^e, h_t^e, c_t^e$. They then assume the average of the efficient lows and highs $(l_t^e+h_+t^e)/2$ is a fair estimate of the efficient close (albeit with some noise of the efficient price process). Also, they point out the the observed high and low prices may be averaged since the plus-and-minus of a half spread cancels out. Thus $$ \eta_t = \frac{l_t^e + h_t^e}{2} = \frac{l_t + h_t}{2}. $$

They next note that $E(\frac{\eta_t + \eta_{t+1}}{2}) = E(c_t^e)$. Therefore, the variance of $\eta$ changes estimates the efficient price variance $\sigma_e^2$ and the variance of $c_t$ versus the average of $\eta$'s depends on both $\sigma_e^2$ and the spread $S$. That gives a system of equations which is easily solved (since it is already triangular): $$ \begin{align} E[(\eta_{t+1}-\eta_t)^2] &= \left(2-\frac{k_1}{2}\right)\sigma_e^2, \quad \text{and} \\ E\left[\left(c_t-\frac{\eta_t+\eta_{t+1}}{2}\right)^2\right] &= \frac{S^2}{4} + \left(\frac{1}{2} + \frac{k_1}{8}\right) \sigma_e^2 \end{align} $$ where $k_1=4\log(2)$, as in Corwin and Schultz's method.

Analyzing Slippage

Once you have estimates of bid-ask spreads and volatilities, you can easily try fitting your trading or returns to various price impact models. While I could write up plenty on those, I'll just self-plagiarize and suggest the answer here to guide you on using your spread and volatility estimates.


OHLCV data is not sufficient to estimate slippage as it depends on execution and intraday price action.

How to simulate slippage

Based on the size of your orders and trading frequency you can make some assumptions on the overall impact though. For example, if you are not trading frequently, don't have a huge portfolio, and trading liquid equities, don't worry about it.

  • $\begingroup$ This is not correct. You can estimate bid-ask spreads with daily data (as I discuss in my answer). The estimates will be noisier than using intraday data, to be sure; however, the task is not impossible. I also would not conclude a slippage analysis is pointless: I've seen a few hundred shares send a stock moving 10% and i've seen supposedly liquid stocks move 15% off of little volume. $\endgroup$
    – kurtosis
    Aug 14, 2020 at 7:45
  • $\begingroup$ Estimating the bid-ask spread is very different than analyzing slippage. As you mention, the actual liquidity behind certain markets is difficult to gauge prior to execution, despite whatever the bid-ask spread is. I do see the models you linked to though which look interesting, so I'll take a look. It seems that many require intraday data, no? Additionally, without intraday data, why not just estimate from your execution algo provider? $\endgroup$ Aug 14, 2020 at 12:10
  • 1
    $\begingroup$ Estimating the bid-ask spread without intraday data might be the hardest part. After that, you can make rough inferences. The models I mention here do not require intraday data; that is what makes them interesting. The price impact models merely require some information (like volatility and the bid-ask spread) and a decent reference price. So for an order worked over the entire day, you can compare to the all-day VWAP and use estimated spreads and trade sizing to infer your slippage. Like I said: it's not perfect, but I have found it can be good enough to be actionable. $\endgroup$
    – kurtosis
    Aug 14, 2020 at 16:32
  • $\begingroup$ Gotcha thanks. I wasn't sure of the price data requirements for the price impact models in your linked post. $\endgroup$ Aug 14, 2020 at 16:42
  • $\begingroup$ You are welcome. You have to make some assumptions, but you can still get useful information. $\endgroup$
    – kurtosis
    Aug 14, 2020 at 16:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.