The streaming service uses websockets (WebSockets provide a bidirectional, full-duplex communications channel that operates over HTTP through a single TCP/IP socket connection). At its core, the WebSocket protocol facilitates message passing between a client and server. You can connect to our streaming service using the examples listed on the black pane. You need to subscribe to one or more instruments.

Get live news

Subscribe to news streaming data

import tradingeconomics as te
import json

def on_message(ws, message):


Clone the repository

git clone

Access the folder

cd tradingeconomics-js/Examples/stream-nodejs/

Install dependencies

npm install

In app.js file, set-up your client key and secret. Then subscribe to news.

Client = new te_client({
    url: 'wss://',
    key: 'API_CLIENT_KEY', // <--
    secret: 'API_CLIENT_SECRET' // <--
    //reconnect: true

using System.Net.WebSockets;
using System.Text;

    using (var cws = new ClientWebSocket())
        await cws.ConnectAsync(new Uri($"wss://'your_private_key'"), CancellationToken.None);

        if (cws.State == WebSocketState.Open)
            var buffer = new ArraySegment<byte>(Encoding.UTF8.GetBytes(@"{""topic"": ""subscribe"", ""to"": """ + "news" + @""" }"));
            await cws.SendAsync(buffer, WebSocketMessageType.Binary, true, CancellationToken.None);

        await Task.Delay(1024);

        while (cws.State == WebSocketState.Open)
            var buffer = new ArraySegment<byte>(new byte[1024]);
            var result = await cws.ReceiveAsync(buffer, CancellationToken.None);
            if (result.MessageType == WebSocketMessageType.Close)
                await cws.CloseAsync(WebSocketCloseStatus.NormalClosure, string.Empty, CancellationToken.None);

            Console.WriteLine($"Receiving: {Encoding.UTF8.GetString(buffer.Array, 0, result.Count).Trim()}");
catch (Exception e)
    Console.WriteLine($"Error with message: {e.Message}");
Australia Markit Services PMI Slows Down“The IHS Markit Australia Services PMI decreased to 53.4 in February 2021, down from…”AustraliaServices Sentiment/australia/services-sentiment2news
Australia Composite PMI Revised Downwardly“The IHS Markit Australia Composite PMI decreased to 53.7 in February 2021, down from…”AustraliaComposite PMI/australia/composite-pmi1news
“NZX Tops 12,400”“New Zealand’s main stock index rose above the 12,400 level on Wednesday, extending…”New ZealandStock Market/new-zealand/stock-market1news

Response fields

titlestringTitle“French 10-Year Bond Yield Approaches 1-Month High”
countrystringcountry“The yield on the French 10-year OAT rose to 2.9% in mid-April…”
categorystringcategory“Government Bond 10Y”
importancenumberLowest 0 to 3 highest3
topicstringTopic subscribed“news”