Streaming Statistics
Robust, fast statistics describing activity across all exchanges and assets to feed into stat arb strategies or inform predictions of orderbook resilience and price level changes.

# Quantiles

The population quantile of the price or amount of the last 100 trades of the asset, at the given level. Currently the following levels are available [0.1, 0.25, 0.5, 0.75, 0.9, 0.99]. The general form of the channel is given according to the below:
1
{
2
action: 'subscribe',
3
channel: [exchange.symbol.quantile.level.price/amount]
4
}
Copied!
Some example subscriptions are given below:
1
# Subscribe to deribit's BTC-PERPETUAL trade amounts 0.99 quantile
2
channel = ['deribit.BTC-PERPETUAL.quantile.0.99.amount']
3
4
# Subscribe to bitmex's XBTUSD trade prices 0.50 quantile
5
channel = ['bitmex.XBTUSD.quantile.0.50.price']
6
7
# Use a pattern subscription to subscribe to all Bitmex instruments
8
# at a 0.75 quantile for both prices and amounts
9
channel = ['bitmex.*.quantile.0.50.*']
10
Copied!
The response will be in the format:
1
# Price 0.1 Quantile
2
{
3
"type":"delta.BTCUSDT.quantile.0.1.price",
4
"exchange":"delta",
5
"symbol":"BTCUSDT",
6
"value":-1.2000000000000004,
7
"sample_size":100,
8
"quantile":0.1
9
}
10
11
# Price 0.25 Quantile
12
{
13
"type":"delta.BTCUSDT.quantile.0.25.price",
14
"exchange":"delta",
15
"symbol":"BTCUSDT",
16
"value":-1.2000000000000004,
17
"sample_size":100,
18
"quantile":0.25
19
}
20
21
# Price 0.50 Quantile
22
{
23
"type":"delta.BTCUSDT.quantile.0.5.price",
24
"exchange":"delta",
25
"symbol":"BTCUSDT",
26
"value":-1.2000000000000004,
27
"sample_size":100,
28
"quantile":0.5
29
}
30
31
# Price 0.75 Quantile
32
{
33
"type":"delta.BTCUSDT.quantile.0.75.price",
34
"exchange":"delta",
35
"symbol":"BTCUSDT",
36
"value":-1.2000000000000004,
37
"sample_size":100,
38
"quantile":0.75
39
}
40
41
# Price 0.90 Quantile
42
{
43
"type":"delta.BTCUSDT.quantile.0.9.price",
44
"exchange":"delta",
45
"symbol":"BTCUSDT",
46
"value":-1.2000000000000004,
47
"sample_size":100,
48
"quantile":0.9
49
}
50
51
# Price 0.99 Quantile
52
{
53
"type":"delta.BTCUSDT.quantile.0.99.price",
54
"exchange":"delta",
55
"symbol":"BTCUSDT",
56
"value":-1.2000000000000004,
57
"sample_size":100,
58
"quantile":0.99
59
}
60
Copied!
For subscriptions to statistics for trade amounts, the response will be the same but with the type response specifying that it is a trade amount statistic, rather than a trade price statistic.

# Skew

Sample skewness of the past 100 trades of a given instrument by price or amount, helpful in better understanding the distribution of trade sizes to understand the liklihood of a price level change and its direction.
The general form of the channel is given according to the below:
1
{
2
action: 'subscribe',
3
channel: [exchange.symbol.skew.price/amount]
4
}
Copied!
Some example subscriptions are given below:
1
# Subscribe to deribit's BTC-PERPETUAL trade amounts skew
2
channel = ['deribit.BTC-PERPETUAL.skew.amount']
3
4
# Subscribe to bitmex's XBTUSD trade prices skew
5
channel = ['bitmex.XBTUSD.skew.price']
6
7
# Use a pattern subscription to subscribe to all Bitmex instruments price skew
8
channel = ['bitmex.*.skew.price']
9
Copied!
The result is given by individual JSON responses:
1
# Price Skew
2
{
3
"type":"delta.BTCUSDT.skew.price",
4
"exchange":"delta",
5
"symbol":"BTCUSDT",
6
"value":0,
7
"sample_size":100
8
}
9
10
# Amount Skew
11
{
12
"type":"delta.BTCUSDT.skew.amount",
13
"exchange":"delta",
14
"symbol":"BTCUSDT",
15
"value":-0.021506618576024247,
16
"sample_size":100
17
}
Copied!

# Kurtosis

Kurtosis gives the current kurtosis of the distribution implied by the past 100 trades by amount or price, for a given instrument or normalized asset across exchanges.
The general form of the channel is given according to the below:
1
{
2
action: 'subscribe',
3
channel: [exchange.symbol.kurtosis.price/amount]
4
}
Copied!
Some example subscriptions are given below:
1
# Subscribe to deribit's BTC-PERPETUAL trade amounts kurtosis
2
channel = ['deribit.BTC-PERPETUAL.kurtosis.amount']
3
4
# Subscribe to bitmex's XBTUSD trade prices kurtosis
5
channel = ['bitmex.XBTUSD.kurtosis.price']
6
7
# Use a pattern subscription to subscribe to all Bitmex instruments price kurtosis
8
channel = ['bitmex.*.kurtosis.price']
Copied!
The result is given by indivual JSON responses:
1
# Price Kurtosis
2
{
3
"type":"delta.BTCUSDT.kurtosis.price",
4
"exchange":"delta",
5
"symbol":"BTCUSDT",
6
"value":-1.2000000000000004,
7
"sample_size":100
8
}
9
10
# Amount Kurtosis
11
{
12
"type":"delta.BTCUSDT.kurtosis.amount",
13
"exchange":"delta",
14
"symbol":"BTCUSDT",
15
"value":-1.1351591435979114,
16
"sample_size":100
17
}
Copied!

# Averages

You can get the mean, median, and mode properties of the past 100 trades through a simple subscription:
1
# Subscribe to deribit's BTC-PERPETUAL trade amount mean
2
channel = ['deribit.BTC-PERPETUAL.mean.amount']
3
4
# Subscribe to bitmex's XBTUSD trade prices median
5
channel = ['bitmex.XBTUSD.median.price']
6
7
# Use a pattern subscription to subscribe to all Bitmex instruments price kurtosis
8
channel = ['bitmex.*.mode.price']
Copied!

# k-Means Clustering

This provides the price levels of the last 100 trades, spit into 10 categories based on the k-Means approach described in:
Optimal k-means Clustering in One Dimension by Dynamic Programming Haizhou Wang and Mingzhou Song
This can be used to provide indications of likely price support levels based on recent trades, or help in identifying sources of trades based on clustering around similar prices.
The general form of the channel is given according to the below:
1
{
2
action: 'subscribe',
3
channel: [exchange.symbol.kmeans.price/amount]
4
}
Copied!
Some example subscriptions are given below:
1
# Subscribe to deribit's BTC-PERPETUAL trade amounts k-means clustering
2
channel = ['deribit.BTC-PERPETUAL.kmeans.amount']
3
4
# Subscribe to bitmex's XBTUSD trade prices k-means clustering
5
channel = ['bitmex.XBTUSD.kmeans.price']
6
7
# Use a pattern subscription to subscribe to all Bitmex
8
# instruments price k-means clustering
9
channel = ['bitmex.*.kmeans.price']
Copied!
The result is given by individual JSON responses:
1
{
2
"type":"gate-io-futures.BTC_USDT.kmeans.amount",
3
"exchange":"gate-io-futures",
4
"symbol":"BTC_USDT",
5
"value":[
6
[10,10,10,...,10],
7
[20,20,20,...,20],
8
[30,30,30,...,30,40,40,...,40],
9
[50,50,50,50,60,60],
10
[70,80,87],
11
[100,100,...,100],
12
[113,120,120],
13
[150,150,160],
14
[200,200,200,200],
15
[442]
16
],
17
"sample_size":100
18
}
Copied!

# Sample Variance

Returns the sample variance of the price or amount of the last 100 trades for a given instrument, normalized currency pair across all exchanges, or any combination of exchange and asset.
The general form of the channel is given according to the below:
1
{
2
action: 'subscribe',
3
channel: [exchange.symbol.variance.price/amount]
4
}
Copied!
Some example subscriptions are given below:
1
# Subscribe to deribit's BTC-PERPETUAL trade amounts k-means clustering
2
channel = ['deribit.BTC-PERPETUAL.variance.amount']
3
4
# Subscribe to bitmex's XBTUSD trade prices k-means clustering
5
channel = ['bitmex.XBTUSD.variance.price']
6
7
# Use a pattern subscription to subscribe to all Bitmex instruments' price variance
8
channel = ['bitmex.*.variance.price']
Copied!
The result is given by individual JSON responses:
1
# Huobi DOGEUSDT price variance
2
{
3
"type":"huobi.DOGEUSDT.variance.price",
4
"exchange":"huobi",
5
"symbol":"DOGEUSDT",
6
"value":3.704643049932375e-8,
7
"sample_size":100
8
}
Copied!
Note that this implementation uses Bessel's correction to give an unbiased estimator, i.e. it calculates the sample variance:
$SampleVariance = Variance * (n/(n-1))$
Where n is the number of observations, i.e. 100 in all cases except for newly listed, illiquid assets that may not yet have had 100 trades in their history.
If you do not want the adjusted version, you can subscribe to the Unadjusted Standard Deviation below and simply square the result in order to get an unadjusted variance.

# Sample Standard Deviation

The sample standard deviation is the short-run standard deviation of price or trade amount, or volatility when related to returns. This can be expressed as an annualized percentage or as a simple standard deviation. As above, this is adjusted for Bessel's correction in order to give the sample standard deviation, however, the unadjusted version is also available below.
The standard deviation is calculated on the last 100 trades, but is annualized based on the time between those trades - i.e for more liquid instruments the sample period is shorter, for less liquid instruments there is a longer sample period. This helps adjust for the difference in liquidity to make the measure more robust.
The annualization is based on multiplying the sample standard deviation by the square root of one year (defined as 365.25 days, given 24x7 nature of trading in underlying assets) and dividing by the sample duration:
$AnnualizedStDev= SampleStDev*(AnnualizationFactor/SampleDuration)$
The annualized version is only available for the price and returns, not for amounts, as this is not a meaningful measure.
Some example subscriptions are given below:
1
# Subscribe to deribit's BTC-PERPETUAL price std deviation
2
channel = ['deribit.BTC-PERPETUAL.stdev.price']
3
4
# Subscribe to deribit's BTC-PERPETUAL volatility (%)
5
channel = ['deribit.BTC-PERPETUAL.stdev.returns']
6
7
# Subscribe to bitmex's XBTUSD trade amount standard deviation
8
channel = ['bitmex.XBTUSD.stdev.amount']
9
10
# Use a pattern subscription to subscribe to all Bitmex instruments'
11
# annualized volatility
12
channel = ['bitmex.*.stdev.returns.annualized']
Copied!
The result is given by individual JSON responses:
1
# Huobi DOGEUSDT linear swap Annualized Volatility
2
{
3
"type":"huobi-dm-linear-swap.DOGE-USDT.stdev.annualized",
4
"exchange":"huobi-dm-linear-swap",
5
"symbol":"DOGE-USDT",
6
"value":0.4784157628999617,
7
"sample_size":100,
8
"startTime":"2021-04-23T09:28:37.198Z",
9
"endTime":"2021-04-23T09:28:37.372Z",
10
"sampleDuration":174 # milliseconds
11
}
12
13
# Huobi DOGEUSDT linear swap sample period volatility
14
{
15
"type":"huobi-dm-linear-swap.DOGE-USDT.stdev.price",
16
"exchange":"huobi-dm-linear-swap",
17
"symbol":"DOGE-USDT",
18
"value":0.000035524512020846234,
19
"sample_size":100
20
}
21
22
# Huobi DOGEUSDT linear swap sample standard deviation of trade amounts
23
{
24
"type":"huobi-dm-linear-swap.DOGE-USDT.stdev.amount",
25
"exchange":"huobi-dm-linear-swap",
26
"symbol":"DOGE-USDT",
27
"value":66.46695550179105,
28
"sample_size":100
29
}
Copied!

# Unadjusted Standard Deviation / Volatility

This provides streaming updates to the volatility without adjusting for the sample size and is available on the same basis as the Sample Standard Deviation / Volatility:
Some example subscriptions are given below:
1
# Subscribe to deribit's BTC-PERPETUAL price standard deviation
2
channel = ['deribit.BTC-PERPETUAL.rawstdev.price']
3
4
# Subscribe to deribit's BTC-PERPETUAL volatility
5
channel = ['deribit.BTC-PERPETUAL.rawstdev.returns']
6
7
# Subscribe to bitmex's XBTUSD trade amount standard deviation
8
channel = ['bitmex.XBTUSD.rawstdev.amount']
9
10
# Use a pattern subscription to subscribe to all Bitmex instruments'
11
# annualized volatility
12
channel = ['bitmex.*.rawstdev.annualized']
Copied!
The result is given by individual JSON responses:
1
# ByBit XRPUSD Raw Annualized Volatility
2
{
3
"type":"bybit.XRPUSD.rawstdev.annualized",
4
"exchange":"bybit",
5
"symbol":"XRPUSD",
6
"value":1.8724994852874537,
7
"sample_size":100,
8
"startTime":"2021-04-23T09:47:58.749Z",
9
"endTime":"2021-04-23T09:47:59.915Z",
10
"sampleDuration":1166
11
}
12
13
# ByBit ETHUSD Raw Sample Volatility
14
{
15
"type":"bybit.ETHUSD.rawstdev.price",
16
"exchange":"bybit",
17
"symbol":"ETHUSD",
18
"value":0.13686723088050723,
19
"sample_size":100
20
}
21
22
# Huobi-DM LTC-CW Raw Standard Deviation of Trade Amounts
23
{
24
"type":"huobi-dm.LTC_CQ.rawstdev.amount",
25
"exchange":"huobi-dm",
26
"symbol":"LTC_CQ",
27
"value":56.64714828024464,
28
"sample_size":100
29
}
Copied!

# Median Absolute Deviation

The Median Absolute Deviation (MAD) is a robust measure of the variability of the trade price / amout sample. The MAD is defined as the median of the absolute deviations from the sample median.
${\displaystyle \operatorname {MAD} =\operatorname {median} (|X_{i}-{\tilde {X}}|)}$
Where:
${\displaystyle {\tilde {X}}=\operatorname {median} (X)}:$
Some example subscriptions are given below:
1
# Subscribe to deribit's BTC-PERPETUAL MAD
2
3
4
# Subscribe to deribit's BTC-PERPETUAL volatility
5
6
7
8
9
10
# Use a pattern subscription to subscribe to all Bitmex instruments' price MADs
11
Copied!
The result is given by individual JSON responses:
1
# Gate IO DOGEUSDT Sample MAD
2
{
3
4
"exchange":"gate-io",
5
"symbol":"DOGE_USDT",
6
"value":0.00007699999999999374,
7
"sample_size":100
8
}
9
10
# Gate IO DOGEUSDT Annualised MAD
11
{
12
13
"exchange":"gate-io",
14
"symbol":"DOGE_USDT",
15
"value":0.34777435343726754,
16
"sample_size":100,
17
"startTime":"2021-04-23T10:00:57.548Z",
18
"endTime":"2021-04-23T10:00:59.095Z",
19
"sampleDuration":1547
20
}
21
22
23
{
24
25
"exchange":"bybit",
26
"symbol":"BTCUSD",
27
"value":530,
28
"sample_size":100
29
}
Copied!

# Interquartile Range

The interquartile range is another measure of dispersion of the distribution of both trade prices and amounts. It is calcuated as the 3rd quartile minus the 1st quartile:
${\displaystyle \mathrm {IQR} =Q_{3}-Q_{1}}$
Some example subscriptions are given below:
1
# Subscribe to deribit's BTC-PERPETUAL IQR
2
channel = ['deribit.BTC-PERPETUAL.iqr.price']
3
4
# Subscribe to bitmex's XBTUSD trade amount IQR
5
channel = ['bitmex.XBTUSD.iqr.amount']
6
7
# Use a pattern subscription to subscribe to all Bitmex instruments' price MADs
8
channel = ['bitmex.*.iqr.price']
Copied!
The result is given by individual JSON responses:
1
# Trade price IQR for DOGEUSDT on Huobi
2
{
3
"type":"huobi.DOGEUSDT.iqr.price",
4
"exchange":"huobi",
5
"symbol":"DOGEUSDT",
6
"value":0.00002,
7
"sample_size":100
8
}
9
10
# Trade amount IQR for DOGEUSDT on Huobi
11
{
12
"type":"huobi.DOGEUSDT.iqr.amount",
13
"exchange":"huobi",
14
"symbol":"DOGEUSDT",
15
"value":914.35,
16
"sample_size":100
17
}
Copied!

# Correlation / Covariance

Coming Soon
Get the correlation between any two instruments on any exchange on a customizable frequency, from tick granularity through to daily correlation. You can also get the correlation of a normalized asset (the mid-price of a Combined Orderbook) with another asset, or individual instrument - for example, you could get the correlation of the BTC-PERPETUAL swap with the BTCUSD spot pair across all exchanges.
The Covariance is also available through a corresponding covariance channel.
1
# Subscribe to deribit's BTC-PERPETUAL correlation
2
# with BTCUSD spot across all exchanges
3
channel = ['deribit.BTC-PERPETUAL.correlation.BTCUSD spot']
4
5
# Subscribe to bitmex's XBTUSD correlation with deribit's ETH-PERPETUAL
6
channel = ['bitmex.XBTUSD.correlation.deribit.ETH-PERPETUAL']
7
8
# Get the covariance for bitmex XBTUSD with deribit's BTC-PERPETUAL
9
channel = ['bitmex.XBTUSD.covariance.BTC-PERPETUAL']
Copied!

# Beta

Get the beta of any instrument to BTCUSD, see Betas for more details.