All articles
Article6 min read

Time Bars vs Dollar Bars

Time bars ignore market activity and their returns are far from Gaussian. We build dollar bars on BTC/USDT with a rolling threshold and compare their returns with a Jarque-Bera test.

Everyone uses OHLCV data, computes returns from them, or tries to draw support and resistance on them. We fit our models with them and we assume that returns are Gaussian. Of course every quant knows that this assumption is wrong. Another weak point is that time bars don't take the activity of the market into account: a bar is a bar, whether the market is dead or on fire.

Can we find better data than time bars? In this article, we'll compare classic time bars with dollar bars on BTC/USDT.

Time bars aren't Gaussian

A lot of the assumptions we make rely on returns (and log returns) being Gaussian, but in practice, they are not. Let's see what happens with Bitcoin returns on different timeframes. We will use the Jarque-Bera test to compare them.

BTC/USDT log returns on time bars, log density scale. The fitted Gaussian misses both the peak and the tails.
Time barsnStdSkewExcess kurtosisJBp-valueLargest move
5m957,8590.23%−0.121084.66×1084.66 \times 10^8<10−300< 10^{-300}69σ
1h80,3810.76%−0.50384.73×1064.73 \times 10^6<10−300< 10^{-300}27σ
1d3,3483.5%−0.961636,282<10−300< 10^{-300}14σ

I plot the distribution on a log scale so we can see what happens in its tails. As you can see, the Gaussian does not fit the distribution at all, and it gets only a little better as the timeframe increases.

This is confirmed by the Jarque-Bera test: normality is rejected on every timeframe, and the lower the excess kurtosis, the closer to Gaussian the returns are.

Don't compare JB statistics across samples

JBJB scales with nn, and the three series don't have the same number of bars. Compare the skewness and the excess kurtosis instead.

By the way, a NIG distribution (Normal Inverse Gaussian, 4 parameters) fits these returns quite well, but we lose the properties and the simplicity of the Gaussian by using this kind of distribution.

Dollar volume is not constant

To create our dollar bars, we need to fix a dollar threshold. The problem is that the dollar volume traded isn't constant over time. Let's see how it evolves:

BTC/USDT daily dollar volume, with rolling means over 1, 7 and 30 days: the windows used below for the dollar bar thresholds.

Fixing a single threshold for the whole series can't be done: computing it would require the volume of the future, a lookahead bias. Instead, the threshold is rolling: it is the average dollar volume traded per 5 minutes (resp. 1 hour and 1 day) over the last few days. That is how we build our dollar bars:

  • ~5m dollar bars: 1-day rolling window;
  • ~1h dollar bars: 7-day rolling window;
  • ~1d dollar bars: 30-day rolling window.

Let's see if they are more Gaussian:

BTC/USDT log returns on dollar bars, log density scale. Still not Gaussian, but the tails are thinner.
BarsnStdSkewExcess kurtosisJBLargest move
Time 5m957,8590.23%−0.121084.66×1084.66 \times 10^869σ
Dollar ~5m821,6760.25%0.10313.38×1073.38 \times 10^740σ
Time 1h80,3810.76%−0.50384.73×1064.73 \times 10^627σ
Dollar ~1h80,1170.76%−0.06135.46×1055.46 \times 10^515σ
Time 1d3,3483.5%−0.961636,28214σ
Dollar ~1d3,4633.4%−0.233.61,9426.8σ

What we see is that dollar bars still aren't Gaussian: normality is rejected for all of them. But they are better than time bars on every timeframe: the skewness is closer to zero, the excess kurtosis is divided by 3 to 4, and the largest move in standard deviations is roughly halved. So what else do dollar bars bring?

Other benefits of dollar bars

First, dollar bars follow the activity of the market. In a low-activity market, there won't be a lot of bars, and that's what we want: one hour of a quiet market carries less information than one hour of a very active one.

From this property follows another good thing: no oversampling of low-activity periods. That's a real advantage for our models, because with time bars, a model doesn't see the difference between a dead market and a very active one.

Conclusion

Dollar bars don't make returns Gaussian, but they bring them closer to it, and they sample the market by activity rather than by the clock.

They have a cost though. They need a threshold, and to compute it, we need a rolling window whose size we choose arbitrarily. They are also harder to compute than classic time bars: the best way to build them is from trade data.

References

Want to try it on real data?

Angolin serves the full BTC history at 1d, 1h and 1m granularity.

More articles