Compare exports/imports between equal windows
kyrodata_compare_tradeCompares Brazil's exports or imports between two equal-length windows (like-for-like), in value (USD FOB) and in volume (kg). mode changes the reading: quarterly, semestral, annual, ytd and rolling_3m/6m/12m look a year back and hold the season constant, while monthly and semestral_sequential compare against the period immediately before and cross one. codes and countryIds filter both windows alike and combine: together they isolate one product to one partner (1201 soybean to 160 China); omitted, every product and partner counts. The result carries both windows, the % change of each metric, the window label, whether it crosses a season, and the monthly series spanning both, capped at 24 months. This returns the FIGURES of a comparison — kyrodata_resolve_comparison_window only names the window, and kyrodata_list_trade_series hands over raw monthly points without comparing them. Credit class: comex (up to 2 comex tools per 60-second session = 1 credit).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| flow | Yes | Direction of the trade flow, from Brazil’s side: `export` leaves the country, `import` enters it. | |
| mode | Yes | Which pair of equal-length windows to compare. Against the same period a year earlier: `quarterly`, `semestral`, `annual`, `ytd` (January to the last published month) and `rolling_3m`/`6m`/`12m`. Against the period immediately before, which crosses a season: `monthly` and `semestral_sequential`. Use `ytd` when the question names no period. | |
| codes | No | Products to filter by, as HS codes — 4 digits (heading), 6 (subheading) or 8 (Brazilian NCM), up to 10. Omit for every product. kyrodata_resolve_entity turns a product name into its code. | |
| countryIds | No | Partner countries to filter by, as ids from kyrodata_resolve_entity. Omit for every partner. | |
| response_format | No | How much of the answer to return. `concise` (the default) carries the headline figures; `detailed` adds the row-level series behind them and counts against the export quota. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| data | Yes | Raw numbers behind the text. | |
| memo | Yes | true = identical call in the last 10 min, served again: 0 credits. | |
| rows | No | Table rows; detailed only, capped per tool. | |
| error | No | Failure message when status = error. | |
| links | Yes | screen = product page with these numbers. | |
| denied | No | When status = denied: reason, feature, upgradeUrl. | |
| status | Yes | ok = data; denied = plan; error = failure or timeout. | |
| window | No | Like-for-like window: from, to (YYYY-MM), label, months, crossesSeason. | |
| caveats | Yes | Reading caveats. | |
| credits | Yes | charged, balance (null = unlimited), resetAt, session {charged, endsAt} of the 60-s billing session. | |
| sources | Yes | Per source: label, nameable, asOf. | |
| dataVersion | Yes | Identity of the data that answered. |