The Trading Economics API streaming endpoint can be used to receive live calendar releases utilizing a persistent web socket connection. Streaming data from the API consists of making an authorization request and leaving the socket open to continually receive data. You can authorize using your API client credentials (key/secret). Then you will be able to subscribe to one or more of our streaming channels.

Get live calendar

Subscribe to the economic calendar 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 calendar

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"": """ + "calendar" + @""" }"));
            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}");
Consumer Inflation ExpectationsUnited StatesInflation ExpectationsUNITEDSTAINFEXP3.8%4.1%null2023-07-10T15:00:002023-06-30T00:00:00Jun324314%null13.9%nullUNITEDSTAINFEXPnullcalendar
3-Month Bill AuctionUnited States3 Month Bill YieldUNITEDSTA3MONBILYIE5.25%5.23%None2023-07-10T15:30:00None313669%None1NoneNoneUNITEDSTA3MONBILYIENonecalendar
6-Month Bill AuctionUnited States6 Month Bill YieldUNITEDSTA6MONBILYIE5.27%5.236%null2023-07-10T15:30:00null313670%null1nullnullUNITEDSTA6MONBILYIEnullcalendar

Response fields

eventstringSpecific event name in the calendar‘Retail Sales MoM’
countrystringCountry name‘United States’
categorystringIndicator category name‘Retail Sales MoM’
tickerstringUnique ticker used by Trading Economics‘RSTAMOM’
actualstringLatest released value‘-1%’
previousstringValue for the previous period after the revision (if revision is applicable)‘-0.2%’
revisedstringValue reported in the previous period after revision‘-0.4%’
datestringRelease time and date in UTC‘2023-04-14T12:30:00’
referenceDatestringThe date period for which released data refers to‘2023-03-31T00:00:00’
referencestringThe period for which released data refers to‘Mar’
calendarIdstringUnique calendar ID used by Trading Economics‘319965’
unitstringUnit of the data‘%’
currencystringCurrency of the data“C$”
importancenumber1 = low, 2 = medium, 3 = high3
teforecaststringTE own projections‘-0.9%’
forecaststringAverage forecast among a representative group of economists‘-0.4%’
symbolstringUnique symbol used by Trading Economics‘RSTAMOM’
sourcestringSource of the data‘Office for National Statistics’
topicstringTopic subscribed‘calendar’