Trend Analysis
POST /api/v1/tradeAnalytics/trendAnalysis
Request parameters
countryCode
string
Country ISO3 code
- Required:
Yes - Example:
USA
startDate
string
Start period in YYYY-MM format
- Required:
Yes - Example:
2024-01
endDate
string
End period in YYYY-MM format
- Required:
Yes - Example:
2024-12
hsCode
string
HS code
- Required:
No - Example:
28
sortType2
int
Aggregation period. 1 means monthly, 2 means quarterly, and 3 means half-yearly.
- Required:
Yes - Example:
3
ie
string
Trade flow. Use i for import and e for export.
- Required:
No - Example:
e
partnerIso3
string
Partner country ISO3 code(s), separated by commas.
- Required:
No - Example:
ITA,MEX
{
"countryCode": "USA",
"startDate": "2024-01",
"endDate": "2024-12",
"hsCode": "28",
"sortType2": 3,
"ie": "e",
"partnerIso3": "ITA,MEX"
}
curl https://api.tradedata.io/api/v1/tradeAnalytics/trendAnalysis \
-H "Authorization: Bearer yourTokenHere" \
-H "Content-Type: application/json" \
-d '{"countryCode": "USA", "startDate": "2024-01", "endDate": "2024-12", "hsCode": "28", "sortType2": 3, "ie": "e", "partnerIso3": "ITA,MEX"}'
import requests
response = requests.post(
"https://api.tradedata.io/api/v1/tradeAnalytics/trendAnalysis",
headers={
"Authorization": "Bearer yourTokenHere",
"Content-Type": "application/json",
},
json={
"countryCode": "USA",
"startDate": "2024-01",
"endDate": "2024-12",
"hsCode": "28",
"sortType2": 3,
"ie": "e",
"partnerIso3": "ITA,MEX",
},
)
print(response.json())
const response = await fetch("https://api.tradedata.io/api/v1/tradeAnalytics/trendAnalysis", {
method: "POST",
headers: {
"Authorization": "Bearer yourTokenHere",
"Content-Type": "application/json",
},
body: JSON.stringify({
"countryCode": "USA",
"startDate": "2024-01",
"endDate": "2024-12",
"hsCode": "28",
"sortType2": 3,
"ie": "e",
"partnerIso3": "ITA,MEX"
}),
});
const data = await response.json();
<?php
$ch = curl_init("https://api.tradedata.io/api/v1/tradeAnalytics/trendAnalysis");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer yourTokenHere",
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode([
"countryCode" => "USA",
"startDate" => "2024-01",
"endDate" => "2024-12",
"hsCode" => "28",
"sortType2" => 3,
"ie" => "e",
"partnerIso3" => "ITA,MEX"
]),
]);
echo curl_exec($ch);
Response parameters
code
int
Status code
- Example:
200
data
object
Result container
data.res
array
Trend statistics grouped by year
- Example:
-
data.res.year
int
Year
- Example:
2023
data.res.data
array
Period data list
- Example:
-
data.res.data.month
string
Month label
- Example:
Jan
data.res.data.m
int
Month number
- Example:
1
data.res.data.value
object
Trade value data
- Example:
-
data.res.data.value.value
int
Trade value
- Example:
349465358644
data.res.data.value.monthOnMonth
string
Month-over-month change
- Example:
39.48%
data.res.data.value.yearOnYear
string
Year-over-year change
- Example:
42.27%
data.res.data.quantity
object
Quantity data
- Example:
-
data.res.data.quantity.value
int
Quantity
- Example:
141100501723
data.res.data.quantity.monthOnMonth
string
Month-over-month change
- Example:
54.28%
data.res.data.quantity.yearOnYear
string
Year-over-year change
- Example:
28.85%
data.res.totalValue
int
Total trade value
- Example:
349465358644
data.res.totalQuantity
int
Total quantity
- Example:
141100501723
data.res.ratioValue
string
Value share
- Example:
9.83%
data.res.ratioQuantity
string
Quantity share
- Example:
10.26%
data.chartF
array
Trade value trend series
- Example:
204812210747
data.chartQ
array
Quantity trend series
- Example:
98773825706
data.chartY
array
Trend period labels
- Example:
2021-01
{
"code": 200,
"success": true,
"data": {
"res": [
{
"year": 2023,
"data": [
{
"month": "Jan",
"m": 1,
"value": {
"value": 349465358644,
"monthOnMonth": "39.48%",
"yearOnYear": "42.27%"
},
"quantity": {
"value": 141100501723,
"monthOnMonth": "54.28%",
"yearOnYear": "28.85%"
}
},
{
"month": "Feb",
"m": 2,
"value": {
"value": 0,
"monthOnMonth": "-",
"yearOnYear": "-"
},
"quantity": {
"value": 0,
"monthOnMonth": "-",
"yearOnYear": "-"
}
},
{
"month": "Mar",
"m": 3,
"value": {
"value": 0,
"monthOnMonth": "-",
"yearOnYear": "-"
},
"quantity": {
"value": 0,
"monthOnMonth": "-",
"yearOnYear": "-"
}
},
{
"month": "Apr",
"m": 4,
"value": {
"value": 0,
"monthOnMonth": "-",
"yearOnYear": "-"
},
"quantity": {
"value": 0,
"monthOnMonth": "-",
"yearOnYear": "-"
}
},
{
"month": "May",
"m": 5,
"value": {
"value": 0,
"monthOnMonth": "-",
"yearOnYear": "-"
},
"quantity": {
"value": 0,
"monthOnMonth": "-",
"yearOnYear": "-"
}
},
{
"month": "Jun",
"m": 6,
"value": {
"value": 0,
"monthOnMonth": "-",
"yearOnYear": "-"
},
"quantity": {
"value": 0,
"monthOnMonth": "-",
"yearOnYear": "-"
}
},
{
"month": "Jul",
"m": 7,
"value": {
"value": 0,
"monthOnMonth": "-",
"yearOnYear": "-"
},
"quantity": {
"value": 0,
"monthOnMonth": "-",
"yearOnYear": "-"
}
},
{
"month": "Aug",
"m": 8,
"value": {
"value": 0,
"monthOnMonth": "-",
"yearOnYear": "-"
},
"quantity": {
"value": 0,
"monthOnMonth": "-",
"yearOnYear": "-"
}
},
{
"month": "Sep",
"m": 9,
"value": {
"value": 0,
"monthOnMonth": "-",
"yearOnYear": "-"
},
"quantity": {
"value": 0,
"monthOnMonth": "-",
"yearOnYear": "-"
}
},
{
"month": "Oct",
"m": 10,
"value": {
"value": 0,
"monthOnMonth": "-",
"yearOnYear": "-"
},
"quantity": {
"value": 0,
"monthOnMonth": "-",
"yearOnYear": "-"
}
},
{
"month": "Nov",
"m": 11,
"value": {
"value": 0,
"monthOnMonth": "-",
"yearOnYear": "-"
},
"quantity": {
"value": 0,
"monthOnMonth": "-",
"yearOnYear": "-"
}
},
{
"month": "Dec",
"m": 12,
"value": {
"value": 0,
"monthOnMonth": "-",
"yearOnYear": "-"
},
"quantity": {
"value": 0,
"monthOnMonth": "-",
"yearOnYear": "-"
}
}
],
"totalValue": 349465358644,
"totalQuantity": 141100501723,
"ratioValue": "9.83%",
"ratioQuantity": "10.26%"
},
{
"year": 2022,
"data": [
{
"month": "Jan",
"m": 1,
"value": {
"value": 245632768872,
"monthOnMonth": "-4.24%",
"yearOnYear": "19.93%"
},
"quantity": {
"value": 109504981693,
"monthOnMonth": "3.58%",
"yearOnYear": "10.86%"
}
},
{
"month": "Feb",
"m": 2,
"value": {
"value": 232073817073,
"monthOnMonth": "-5.52%",
"yearOnYear": "19.74%"
},
"quantity": {
"value": 97177546761,
"monthOnMonth": "-11.26%",
"yearOnYear": "11.8%"
}
},
{
"month": "Mar",
"m": 3,
"value": {
"value": 293648586121,
"monthOnMonth": "26.53%",
"yearOnYear": "24.41%"
},
"quantity": {
"value": 110123203075,
"monthOnMonth": "13.32%",
"yearOnYear": "8.29%"
}
},
{
"month": "Apr",
"m": 4,
"value": {
"value": 269774361416,
"monthOnMonth": "-8.13%",
"yearOnYear": "19.66%"
},
"quantity": {
"value": 93172198252,
"monthOnMonth": "-15.39%",
"yearOnYear": "-3.6%"
}
},
{
"month": "May",
"m": 5,
"value": {
"value": 279078558194,
"monthOnMonth": "3.45%",
"yearOnYear": "21.55%"
},
"quantity": {
"value": 112396282474,
"monthOnMonth": "20.63%",
"yearOnYear": "14.51%"
}
},
{
"month": "Jun",
"m": 6,
"value": {
"value": 283356822828,
"monthOnMonth": "1.53%",
"yearOnYear": "17.33%"
},
"quantity": {
"value": 108786101511,
"monthOnMonth": "-3.21%",
"yearOnYear": "3.27%"
}
},
{
"month": "Jul",
"m": 7,
"value": {
"value": 267765037453,
"monthOnMonth": "-5.5%",
"yearOnYear": "13.18%"
},
"quantity": {
"value": 108065659955,
"monthOnMonth": "-0.66%",
"yearOnYear": "6.43%"
}
},
{
"month": "Aug",
"m": 8,
"value": {
"value": 280451570752,
"monthOnMonth": "4.74%",
"yearOnYear": "18.44%"
},
"quantity": {
"value": 107699675201,
"monthOnMonth": "-0.34%",
"yearOnYear": "5.02%"
}
},
{
"month": "Sep",
"m": 9,
"value": {
"value": 272418971006,
"monthOnMonth": "-2.86%",
"yearOnYear": "12.08%"
},
"quantity": {
"value": 102512077651,
"monthOnMonth": "-4.82%",
"yearOnYear": "3.62%"
}
},
{
"month": "Oct",
"m": 10,
"value": {
"value": 278904839361,
"monthOnMonth": "2.38%",
"yearOnYear": "11.78%"
},
"quantity": {
"value": 101510597636,
"monthOnMonth": "-0.98%",
"yearOnYear": "0.09%"
}
},
{
"month": "Nov",
"m": 11,
"value": {
"value": 253465560815,
"monthOnMonth": "-9.12%",
"yearOnYear": "-1.42%"
},
"quantity": {
"value": 92018303343,
"monthOnMonth": "-9.35%",
"yearOnYear": "-12.93%"
}
},
{
"month": "Dec",
"m": 12,
"value": {
"value": 250549880591,
"monthOnMonth": "-1.15%",
"yearOnYear": "-2.32%"
},
"quantity": {
"value": 91457717500,
"monthOnMonth": "-0.61%",
"yearOnYear": "-13.49%"
}
}
],
"totalValue": 3207120774482,
"totalQuantity": 1234424345052,
"ratioValue": "90.17%",
"ratioQuantity": "89.74%"
}
],
"chartF": [
204812210747,
193811524383,
236038667780,
225449187180,
229602055261,
241513758288,
236583358433,
236787893041,
243065418585,
249503771491,
257103912767,
256498336931,
245632768872,
232073817073,
293648586121,
269774361416,
279078558194,
283356822828,
267765037453,
280451570752,
272418971006,
278904839361,
253465560815,
250549880591,
349465358644
],
"chartQ": [
98773825706,
86923095495,
101690038635,
96650348460,
98158213724,
105340501979,
101538826603,
102550483904,
98934224728,
101421927263,
105677167143,
105718941660,
109504981693,
97177546761,
110123203075,
93172198252,
112396282474,
108786101511,
108065659955,
107699675201,
102512077651,
101510597636,
92018303343,
91457717500,
141100501723
],
"chartY": [
"2021-01",
"2021-02",
"2021-03",
"2021-04",
"2021-05",
"2021-06",
"2021-07",
"2021-08",
"2021-09",
"2021-10",
"2021-11",
"2021-12",
"2022-01",
"2022-02",
"2022-03",
"2022-04",
"2022-05",
"2022-06",
"2022-07",
"2022-08",
"2022-09",
"2022-10",
"2022-11",
"2022-12",
"2023-01"
]
},
"msg": "success",
"total": 0,
"pageSize": 0,
"current": 0,
"sumResult": null
}