Any site publishing its own trade analysis owes the reader the query. This is ours.
The source
UN Comtrade, through the public preview endpoint at comtradeapi.un.org/public/v1/preview/C/A/HS, which
requires no API key. Comtrade aggregates customs reporting submitted by national statistical authorities,
so the underlying figures are the reporting countries’ own.
The query
For each combination of reporter, partner, commodity chapter and year:
GET https://comtradeapi.un.org/public/v1/preview/C/A/HS
?reporterCode=<M49> # 276 Germany, 842 United States, 398 Kazakhstan, 51 Armenia, 417 Kyrgyzstan
&partnerCode=<M49> # 643 Russian Federation, or the transit economy
&period=<YYYY> # one year per call; the preview endpoint rejects multi-year periods
&cmdCode=<84|85> # machinery; electrical machinery
&flowCode=X # exports
Chapters 84 and 85 were chosen because they contain the majority of items appearing on published high-priority commodity code lists. Germany and the United States were chosen as reporters because they are the largest western exporters in these chapters; they are not the whole of the western total, and the charts are labelled accordingly rather than described as “EU and US”.
The filters applied to the response
Comtrade returns several rows per query at different levels of aggregation. We keep only rows where:
customsCodeisC00— the standard customs procedure, not a sub-procedure; andmotCodeis absent — the all-modes aggregate, not a per-mode breakdown.
Without those two filters the same trade is counted several times, which is the most common error in
casual use of this API. The value taken is primaryValue, in current US dollars.
What we do not do
We do not adjust for freight and insurance. Export values are typically reported free on board and import values cost, insurance and freight, so a genuine mirror comparison of the same flow has a built-in gap of roughly a few per cent. Our charts compare two different flows rather than two reports of one, so this particular adjustment does not apply — but it is why we do not present the comparison as a discrepancy measure.
We do not deflate for price changes. The figures are nominal, and part of any increase over a period of general inflation is price rather than volume.
We do not reconcile against partner reporting for the same flow. That is a separate analysis and a separate chart.
What the numbers cannot support
A country-level trade signature identifies a flow worth investigating. It does not identify a shipment, a company or an offence, and no honest use of it claims otherwise.
Specifically, this method cannot distinguish between re-routing, genuine demand growth in the transit economy, relocation of businesses and their supply chains, ordinary entrepôt trade, and statistical revision. The most recent year in any Comtrade series is the least settled and should be treated as provisional.
Prior work
The methodology of using partner-country data comparisons to estimate misinvoicing was developed and published at length by Global Financial Integrity, whose approach is documented publicly and whose critics have engaged with it in the literature. Anyone using this method seriously should read both sides of that exchange; the criticisms of the technique are substantive and are about exactly the confounders listed above.
Reproducing this
The ingest script is scripts/ingest/comtrade-mirror.mjs in this site’s repository. It writes
src/data/comtrade-mirror.json alongside a _meta.json recording the fetch timestamp, the record count
and the licence, and the sources page is generated from those metadata files so it cannot go
stale without the page saying so.