Snapshot
UN Comtrade Database consists of around 19 million data series with detailed harmonized global trade data divided into categories and countries.
Latest updated
Get the latest updated indicators
te.getCmtUpdates(output_type = 'df')
data = te.getComtrade(category = 'updates').then(function(data){
console.log(data)
});
WebRequest request = WebRequest.Create("https://api.tradingeconomics.com/comtrade/updates?c=guest:guest");
By country
Get Comtrade snapshot of data by country or between countries
te.getCmtCountry(country = 'Portugal', output_type = 'df')
te.getCmtCountry(country = ['China','Portugal'], output_type = 'df')
data = te.getComtrade(country = 'Portugal').then(function(data){
console.log(data)
});
data = te.getComtrade(country = 'china', country1 = 'portugal').then(function(data){
console.log(data)
});
WebRequest request = WebRequest.Create("https://api.tradingeconomics.com/comtrade/country/portugal?c=guest:guest");
WebRequest request = WebRequest.Create("https://api.tradingeconomics.com/comtrade/country/china/portugal?c=guest:guest");
Import or Export by country
Get total type (import or export) by country for all main categories
te.getCmtCountryByCategory(country = 'India', type = 'import', output_type = 'df')
data = te.getCmtCountryByCategory(country = 'india', type = 'import').then(function(data){
console.log(data)
});
WebRequest request = WebRequest.Create("https://api.tradingeconomics.com/comtrade/import/india?c=guest:guest");
te.getCmtCountryByCategory(country = 'United States', type = 'export',
output_type = 'df')
data = te.getCmtCountryByCategory(country = 'United States',
type = 'export').then(function(data){
console.log(data)
});
WebRequest request = WebRequest.Create("https://api.tradingeconomics.com/comtrade/export/united%20states?c=guest:guest");
Import or Export by country and category
Get type (import or export) by country and specific category
/comtrade/import/{country}/{category}
te.getCmtCountryByCategory(country = 'United Kingdom', type = 'import',
category='Coffee, tea, mate and spices', output_type = 'df')
data = te.getCmtCountryByCategory(country = 'United kingdom', type = 'import',
category='Coffee, tea, mate and spices').then(function(data){
console.log(data)
});
WebRequest request = WebRequest.Create("https://api.tradingeconomics.com/comtrade/import/united%20kingdom/Coffee,%20tea,%20mate%20and%20spices?c=guest:guest");
/comtrade/export/{country}/{category}
te.getCmtCountryByCategory(country = 'India', type = 'export',
category='Live animals', output_type = 'df')
data = te.getCmtCountryByCategory(country = 'india', type = 'export',
category='Live animals').then(function(data){
console.log(data)
});
WebRequest request = WebRequest.Create("https://api.tradingeconomics.com/comtrade/export/india/live%20animals?c=guest:guest");
Total imports and exports by country
Get total type (export or export) by a specific country
/comtrade/import/{country}/totals
te.getCmtTotalByType(country = 'United States', type = 'import', output_type = 'df')
data = te.getComtradeTotalByType(country = 'United States', type = 'import').then(function(data){
console.log(data)
});
WebRequest request = WebRequest.Create("https://api.tradingeconomics.com/comtrade/import/united%20states/totals?c=guest:guest");
/comtrade/export/{country}/totals
te.getCmtTotalByType(country = 'India', type = 'export', output_type = 'df')
data = te.getComtradeTotalByType(country = 'India', type = 'export').then(function(data){
console.log(data)
});
WebRequest request = WebRequest.Create("https://api.tradingeconomics.com/comtrade/export/india/totals?c=guest:guest");
List Category
To also list the category column in the response fields
/comtrade/country/{country}?type={type}
te.getCmtSnapshotByType(country = 'portugal', type = 'export', output_type = 'df')
data = te.getCmtCountryFilterByType(country1 = 'portugal', type = 'export').then(function(data){
console.log(data)
});
WebRequest request = WebRequest.Create("https://api.tradingeconomics.com/comtrade/country/portugal?type=export&c=guest:guest");
Trade
Get snapshot of trade between two countries
/comtrade/country/{country_1}/{country_2}
te.getCmtTwoCountries(country1 ='portugal', country2 ='spain', output_type = 'df')
data = te.getComtrade(country = 'portugal', country1 = 'spain').then(function(data){
console.log(data)
});
WebRequest request = WebRequest.Create("https://api.tradingeconomics.com/comtrade/country/portugal/spain?c=guest:guest");
By type
Get snapshot of trade between two countries filtered by type (import or export)
/comtrade/country/{country_1}/{country_2}?type={type}
te.getCmtCountryFilterByType(country1 ='portugal', country2 ='spain',
type='import', output_type='df')
data = te.getComtrade(country = 'portugal', country1 = 'spain',
category='import').then(function(data){
console.log(data)
});
WebRequest request = WebRequest.Create("https://api.tradingeconomics.com/comtrade/country/portugal/spain?type=import&c=guest:guest");
Response fields
Field | Type | Description | Example |
---|---|---|---|
Symbol | string | Unique symbol used by Trading Economics | “MWIBEL85173” |
Country1 | string | First country name | “Malawi” |
Country2* | string | Second country name | “Belgium” |
Value | number | Trade Value | 17219 |
Date | number | Year of the updated series | 2022 |
Type | string | Trade type | “Re-Export” |
Category | string | Category name | “Pepper, genus piper, genus capsicum or pimenta” |
URL | string | Hyperlink at Trading Economics | “/portugal/exports/aruba” |
Title | string | Trade title | “Portugal exports to Aruba” |
StartDate | number | Start Year of the data series | “2023-04-05T00:03:00” |
lastupdate | string | Time when new data was inserted or changed | “2023-04-05T00:03:00” |
Notes
*Country2 is not used for ‘Import or Export by country’.