Skip to content
Docs
Get API key
Markets

Markets Streaming

Use the Trading Economics API streaming to obtain live market data.

The Trading Economics API streaming endpoint can be used to receive live market data 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 1 or more of our streaming channels.

Get live market

Subscribe to markets streaming data.

Python
import tradingeconomics as te
import json
te.login('you_private_key')

def on_message(ws, message):
    print(json.loads(message))

te.subscribe('EURUSD:CUR')
te.run(on_message)
Python
te.subscribe( ['EURUSD:CUR', 'AAPL:US', 'CL1:COM'] )
spchnchpricedtstatetypedhighdlowoprevtopic
“EURUSD:CUR”1.090.012051.112651689184474970opencurrency1.11331.10021.096511.1006“EURUSD:CUR”
“EURUSD:CUR”1.10.012081.112681689184480179opencurrency1.11331.10021.096511.1006“EURUSD:CUR”
“EURUSD:CUR”1.10.012061.112661689184482085opencurrency1.11331.10021.096511.1006“EURUSD:CUR”

Response fields

FieldTypeDescriptionExample
sstringUnique symbol used by Trading Economics“EURUSD:CUR”
pchnumberPercentage change since the previous value0.13
nchnumberAbsolute net change since the previous value0.0013
pricenumberLatest market price1.1057
dttimestampTimestamp of the last market price (epoch milliseconds)1681474172576
statestringMarket state (open or close)“open”
typestringMarket type“currency”
dhighnumberHighest value of the day1.1075
dlownumberLowest value of the day1.1042
onumberOpening price of the day1.0912
prevnumberPrevious closing price1.1044
topicstringTopic or subscription symbol“EURUSD:CUR”