For more information please read our API Documentation.
pip3 install tradingeconomicsOpen the python command line, and type:
import tradingeconomics as teConnect with your API Key:
te.login('client_key')
Ready to get data:te.getIndicatorData(country='united states', indicators='gdp')
npm install tradingeconomicsTo start using the Trading Economics Node package:
const te = require('tradingeconomics');
Connect with your API Key:te.login('client_key');
Ready to get data:data = te.getIndicatorData(country = ['china', 'portugal']).then(function(data) {
console.log(data)
});
using System;
using System.IO;
using System.Net;
namespace Examples.System.Net
{
public class Indicators
{
public static void Main()
{
// replace guest:guest with your key
WebRequest request = WebRequest.Create(
"https://api.tradingeconomics.com/indicators?c=guest:guest");
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();
}
}
}
public static void getIndicatorsByCountry() throws IOException
{
//put country name here
String params = "united states";
params = params.replaceAll("\\s","%20");
//set the path
String path = "/country" + "/" + params;
System.out.println("Get a list of indicators by country");
constructUrl (path);
}
$url = 'https://api.tradingeconomics.com/indicators';
$headers = array(
"Accept: application/xml",
"Authorization: Client guest:guest"
);
$handle = curl_init();
curl_setopt($handle, CURLOPT_URL, $url);
curl_setopt($handle, CURLOPT_HTTPHEADER, $headers);
curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
$data = curl_exec($handle);
curl_close($handle);
//parse your data to satisfy your needs....
//showing result
echo($data);
install.packages("devtools")
Load the devtools and stringr packages:
library(devtools) library(stringr)Install the tradingeconomics package:
install_github("tradingeconomics/tradingeconomics/R/tradingeconomics")
To start using the Trading Economics R package, type in command window:
library(tradingeconomics)Connect with your API Key:
login('client_key')
Ready to get data:
getIndicatorData(country = c('united states','china'), indicator = c('gdp','inflation rate'), outType = 'df')