Benford’s Law, or the First-Digit Law, is a principle used to evaluate the first digit distribution in sets of numerical data. Benford’s Law asserts that in many naturally occurring datasets, the first digit is likely to be small. For example, the number 1 appears as the leading digit about 30% of the time, while 9 appears as the leading digit less than 5% of the time. In the context of cryptocurrency trading, adherence to Benford’s Law can be used to scrutinize trading data for inconsistencies or abnormalities.
Benford’s Law probabilities can be calculated using:
This formula can be used to generate a table of the expected frequencies of the leading digits in a data set that follows Benford’s law:
Leading digit | Expected frequency |
---|---|
1 | 30.1% |
2 | 17.6% |
3 | 12.5% |
4 | 9.7% |
5 | 7.9% |
6 | 6.7% |
7 | 5.8% |
8 | 5.1% |
9 | 4.6% |
firstdigitdist
: This metric represents the distribution of the first digits across the given dataset. It returns an object with the digit (1-9) as keys and the count of occurrences as values. This distribution is then compared against the expected distribution as per Benford’s Law to detect anomalies.
benfordlawtest
: This metric is calculated using the Kolmogorov-Smirnov test. The K-S test is a type of statistical test that measures the agreement between the observed frequency distribution of first digits in the dataset and the expected distribution as per Benford’s Law. Typically, a lower test value (closer to 0) indicates closer conformity to Benford’s Law.
Cryptocurrency markets are known for their volatility and might not always follow expected distributions due to market speculation and the behavior of both retail and institutional traders.
{
"timestamp": "2023-12-25T18:59:00.000Z",
"marketvenueid": "okx",
"pairid": "doge-usdt",
"firstdigitdist": {
"1": 8,
"2": 6,
"3": 7,
"4": 2,
"5": 2,
"6": 1,
"7": 2,
"8": 3,
"9": 3
},
"benfordlawtest": 0.0809
}
The market surveillance data was analyzed for a 3-hour period on market okx-doge-usdt
. The analysis focused on the firstdigitdist
and benfordlawtest
metrics. The total number of executed trades equals tradecount
= 4645.
Steps taken:
Initial aggregation of first digit frequencies provided a foundational understanding of the distribution. The expected frequencies were then calculated based on Benford’s Law, omitting the detailed formula here. A comparative analysis between expected and observed distributions was conducted, highlighting discrepancies.
Digit | Expected Count (Benford’s Law) | Observed Count | Expected Ratio | Observed Ratio |
---|---|---|---|---|
1 | 1398 | 1208 | 0.301 | 0.260 |
2 | 818 | 981 | 0.176 | 0.211 |
3 | 580 | 464 | 0.125 | 0.100 |
4 | 450 | 455 | 0.097 | 0.098 |
5 | 368 | 366 | 0.079 | 0.079 |
6 | 311 | 277 | 0.067 | 0.060 |
7 | 269 | 269 | 0.058 | 0.058 |
8 | 238 | 175 | 0.051 | 0.038 |
9 | 213 | 450 | 0.046 | 0.097 |
tradecount |
4645 |
The ‘benfordlawtest’ equals 0.051 and indicates the divergence. The critical value is a ratio of 1.36 and a square root of tradecount
. The critical value serves as a benchmark. It helps to make conclusions about the convergence of two distributions on large datasets.
First Digit Distribution:
Benford’s Law Test:
In conclusion, while Benford’s Law provides an insightful tool for analyzing market data, it should be used in conjunction with other analysis methods to comprehensively understand market behavior and potential anomalies.
Visual aids, such as a bar graph representing the expected and actual frequency distribution of leading digits, can help in better visualizing the adherence or deviation from Benford’s Law.
Identifying Suspicious Patterns: Unusual first digit frequencies appearing concurrently across exchanges could indicate coordinated manipulation efforts.
Combining With Other Metrics: Benford’s Law is best used alongside other metrics like volume, volatility, orders to substantiate manipulation hypotheses.
Establishing Expected Ranges: Calculate historical test value ranges for a trading pair to better detect anomaly deviations.