Using API
It’s easy to use the Trading Economics API. You can utilize direct endpoints or our packages.
Endpoints
In this documentation, the endpoint examples links will display just the method and the parameters. If you click on one of them, a new browser window will open with a data sample and the complete endpoint. To use them, just copy and paste in an internet browser or any other tool, changing the parameters to what you like.
Packages
After setting up the Authentication, you can start using the Trading Economics packages or any other server based language.
To use Trading Economics Python Package, just copy any method from the documentation, paste it in your code and change the parameters to what you like.
By default, Python package shows data as json.
te.getIndicatorData(country='mexico')
You can change the output type to dataframe:
te.getIndicatorData(country='mexico', output_type='df')
To use Trading Economics Node Package, just copy any method from the documentation, paste it in your code and change the parameters to what you like.
By default, Node package shows data as json.
data = te.getIndicatorData(country = 'mexico').then(function(data){
console.log(data)
});
To use Trading Economics API with any server based language, copy and paste an endpoint and change its parameters to what you like.
By default, Server based languages show data as json.
using System;
using System.IO;
using System.Net;
namespace Examples.System.Net
{
public class Indicators
{
public static void Main()
{
WebRequest request = WebRequest.Create("https://api.tradingeconomics.com/country/mexico?c=your_api_key");
WebResponse response = request.GetResponse();
Console.WriteLine(((HttpWebResponse)response).StatusDescription);
using (Stream dataStream = response.GetResponseStream())
{
StreamReader reader = new StreamReader(dataStream);
String responseFromServer = reader.ReadToEnd();
Console.WriteLine(responseFromServer);
}
response.Close();
}
}
}
Country | Category | Title | LatestValueDate | LatestValue | Source | SourceURL | Unit | URL | CategoryGroup | Adjustment | Frequency | HistoricalDataSymbol | CreateDate | FirstValueDate | PreviousValue | PreviousValueDate |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Mexico | Auto Exports | Mexico Auto Exports | 6/30/2023 12:00:00 AM | 286.29 | Instituto Nacional de Estadística y Geografía (INEGI) | https://www.inegi.org.mx/ | Thousand Units | /mexico/auto-exports | Trade | NSA | Monthly | MEXICOAUTEXP | 7/23/2019 12:20:00 PM | 1/31/1988 12:00:00 AM | 279.27 | 5/31/2023 12:00:00 AM |
Mexico | Balance of Trade | Mexico Balance of Trade | 5/31/2023 12:00:00 AM | -74.00 | Instituto Nacional de Estadística y Geografía (INEGI) | https://www.inegi.org.mx/ | USD Million | /mexico/balance-of-trade | Trade | NSA | Monthly | MXTBBAL | 7/25/2014 2:01:00 PM | 1/31/1980 12:00:00 AM | -1509.00 | 4/30/2023 12:00:00 AM |
Mexico | Banks Balance Sheet | Mexico Banks Balance Sheet | 4/30/2023 12:00:00 AM | 10335903.02 | Banco de México | https://www.banxico.org.mx | MXN Million | /mexico/banks-balance-sheet | Trade | NSA | Monthly | MEXICOBANBALSHE | 9/8/2014 3:29:00 PM | 12/31/2000 12:00:00 AM | 10169075.64 | 3/31/2023 12:00:00 AM |
GitHub
You can look for other examples on how to use our API in different programming languages, in our Github repository.