Skip to main content
Version: 1.0.0

Market Data Streaming

Authentication

In order to connect to GTN API PRICE STREAMING UAT, setup a webSocket connection should be established to this endpoint,

wss://price-uat.feedgma.com/websocket/price

In order to authenticate yourself you need to get a valid access token from Auth services and send it as a JSON object in the body of a normal message through the web socket connection.

Price streaming only support for customer token only.

{
"token": "auth_token"
}

Response contains allowed services and exchanges for the particular customer.

Additional Notes

After getting an access token user can send it in json format as shown in the site. 

  • If what user sends is not in json format, the websocket will simply disconnect. 

After getting authenticated, user can send the different message types (MTs q, t, e, p, o) as shown in the site to subscribe for that detail of specific symbol. 

  • User will be checked for authorization based on whether the exchange/symbol is allowed for the user as well as if the current subscription count has exceeded the maximum number of subscriptions allowed for the user. If either of the above is violated, user will get “Unauthorized exchange/symbol or subscription count exceeded” message.

  • If an incorrect request in valid json format is sent by the user, that message will be simply ignored. But for a request in invalid json format, the Websocket will simply disconnect. 

Request Parameters

Request ParameterDescription
RTRequest Type – sub / unsub
MTMessage Type – q / e / t / p / o
SYMSRequired symbols list (format - exchange~symbol or exchange~symbol~asset_class_id), if only exchange name is there (like in MT_EXCHANGE) only exchange name is required. Note: maximum list size is five. if you want to subscribe more than five symbols, put same message with remaining.
APMAdditional Parameter
{
"RT": request-type,
"MT": message-type,
"SYMS": symbol-list,
"APM": additional-parameters,
}

What is an Asset Class ?

An asset class is a group of investments that exhibit similar characteristics and are subject to the same laws and regulations. Equities, fixed income, options, commodities, and currencies are common examples of asset classes.

How to obtain the "asset_class_id" of a given symbol ?

ASSET_CLASS_ID can be obtained from here.

ASSET_CLASS_IDAsset Class
7Forex
8Index

Message Type

Message TypeDescription
qCurrent status of a particular symbol including details such as last traded price, total volume traded and turnover. 
tWhen a trade occurs for a particular symbol, details related to that trade such as price and quantity are sent under this message type. 
eA summary of a particular exchange including details such as total volume, turnover, market status (open/close) can be checked from this message type. 
pThis shows the order book including the buy and sell orders that have been placed at different prices for a given symbol (The levels of the order book include orders placed at different prices combining orders, if there are multiple orders at the same price) 
oThis also shows the order book as above (The levels of the order book include each order separately, doesn't combine orders with same price)

Sample for realtime & delayed for (q, e , t) -

{
"RT": "sub",
"MT": "q",
"SYMS": [
"ADSM~CHKWINAV~8",
"PFX~USDEUR~7"
]
}

Market data is delayed by 15 mins for delayed requests.

MT_SNAPSHOT (MT : q)

For Index and Forex -

{
"RT": "sub",
"MT": "q",
"SYMS": [
"ADSM~CHKWINAV~8",
"PFX~USDEUR~7"
]
}

If a symbol contain backslash ( \ ) character, it needs to be replaced by double backslash ( \ ) when included in the symbols list (Ex. for Futures).

{
"RT": "sub",
"MT": "q",
"SYMS": [
"COMEX~EHR\\K23"
]
}


Sample
{
"MT": "q",
"e": "NSDQ",
"s": "AAPL",
"sf": 1,
"a": 152.19,
"aq": 400,
"b": 152.11,
"bq": 300,
"hi": 155.04,
"lo": 152.28,
"cls": 152.95,
"op": 154.01,
"c": 0,
"pc": 0,
"pcls": 152.95,
"to": 24514616.6241,
"v": 159928,
"t": 200000,
"p": 152.95,
"q": 0,
"nt": 2853,
"ltd": 20220725,
"vw": 153.2853,
"max": 0,
"min": 0,
"h52": 182.94,
"l52": 129.04,
"hdt52": 20220104,
"ldt52": 20220616,
"mc": 2493974540300,
"lud": 20220725
}

Response Fields

Response ParameterDescriptionParameter Type
eExchangeString
sSymbolString
sfSnapshotFrame Long
aBest AskDouble
aqBest Ask QtyLong
bBest BidDouble
bqBest Bid QtyLong
hiHighDouble
loLowDouble
clsCloseDouble
opOpenDouble
cChangeDouble
pcPct ChangeDouble
pclsPrev ClosedDouble
toTurnoverDouble
vVolumeLong
tTrade TimeLong
pTrade PriceDouble
qTrade QtyLong
ntNo of TradesLong
ltdLast Traded DateLong
vwTrade VwapDouble
maxMax PriceDouble
minMin PriceDouble
h52Wk 52 HighDouble
l52Wk 52 LowDouble
hdt52Wk 52 High DateLong
ldt52Wk 52 Low DateLong
mcMarketcapDouble
ludLast Updated DateDouble

MT_EXCHANGE (MT : e)

Sample Request
{
"RT": "sub",
"MT": "e",
"SYMS": [ "TDWL", "LSE", "NSDQ"]
}

Sample Response
{
"MT": "e",
"e": "HKEX",
"sf": 1,
"to": 96382874365,
"v": 257900738400,
"nu": 0,
"nd": 0,
"nc": 0,
"st": 0,
"nt": 1594992,
"ms": "close",
"md": 20220726,
"mt": 80839,
"mc": 0
}

Response Fields

Response ParameterDescriptionParameter Type
eExchangeString
sfSnapshot FrameLong
toTurnoverDouble
vVolumeLong
nuNo UpsLong
ndNo DownsLong
ncNo ChangeLong
stSym TradedLong
ntNo of TradesLong
msMkt StatusString
mdMkt DateLong
mtMkt TimeLong
mcMarketcapDouble

MT_COMBINED_TRADE (MT : t)

Sample Request
{
"RT": "sub",
"MT": "t",
"SYMS": [
"TDWL~1010",
"NSDQ~AAPL",
"LSE~LLOY" ],
"APM": {
"BKL": "20"
}
}

Sample Response
{
"MT": "t",
"e": "DFM",
"s": "TABREED",
"t": 72415,
"tsq": 802,
"p": 2.72,
"q": 6750,
"pc": -1.449,
"c": -0.04,
"ts": 1
}

Response Fields

Response ParameterDescriptionParameter Type
eExchangeString
sSymbolString
sfSnapshot FrameLong
tsTrade SplitsLong
tTrade TimeLong
tsqTrade SequenceLong
pTrade PriceDouble
qTrade QtyLong
cChangeDouble
pcPct ChangeDouble

MT_DEPTH_PRICE (MT : p)

Sample Request
{
"RT": "sub",
"MT": "p",
"SYMS": [
"DFM~DIB",
"LSE~LLOY",
"HKEX~3800"
]
}

Sample Response
{
"MT": "p",
"e": "HKEX",
"s": "3800",
"sd": "b",
"l": 1,
"p": 3.6,
"q": 6705000,
"sp": 189,
"sd": "a",
"l": 10,
"p": 0.0,
"q": 0,
"sp": 0,
"sd": "b",
"l": 10,
"p": 0.0,
"q": 0,
"sp": 0,
"sd": "b",
"l": 11,
"p": 0.0,
"q": 0,
"sp": 0,
"sd": "a",
"l": 11,
"p": 0.0,
"q": 0,
"sp": 0
}

Response Fields

Response ParameterDescriptionParameter Type
eExchangeString
sSymbolString
sdMBP TypeString
lMBP POSLong
pMBP PriceDouble
qMBP QtyLong
spMBP SplitsLong

MT_DEPTH_ORDER (MT : o)

Sample Request
{
"RT": "sub",
"MT": "o",
"SYMS": [
"DFM~DIB",
"LSE~LLOY",
"HKEX~3800"
]
}

Sample Response
{
    "MT": "o",
    "e": "NSDQ",
    "s": "AMZN",
    "sd": "b",
    "l": 0,
    "p": 99.99,
    "q": 6,
    "sd": "a",
    "l": 0,
    "p": 100,
    "q": 100,
    "sd": "b",
    "l": 1,
    "p": 99.98,
    "q": 13,
    "sd": "a",
    "l": 1,
    "p": 100,
    "q": 100,
    "sd": "b",
    "l": 2,
    "p": 99.98,
    "q": 80,
    "sd": "a",
    "l": 2,
    "p": 100,
    "q": 60,
    "sd": "b",
    "l": 3,
    "p": 99.98,
    "q": 90,
    "sd": "a",
    "l": 3,
    "p": 100,
    "q": 300
}

Response Fields

Response ParameterDescriptionParameter Type
eExchangeString
sSymbolString
sdMBO TypeString
lMBO POSLong
pMBO PriceDouble
qMBO QtyLong

Sandbox environment

contains delayed data & 1 user can only have up to 50 subscriptions at a given time.

Currently, for the streaming API in the UAT canned feed environment, only a selected set of symbols are enabled for different exchanges as below. 

Exchange CodeExchangeSymbols
NSDQNASDAQ Stock ExchangeAAPL, BRK.A, GOOG, JPM, META, AMZN, BAC, PYPL, NVDA, SMMT, BYSI, RIVN, WBD, SOFI, VKTX, CSX, NKLA, TLRY, LYFT, GRAB, MARA, DKNG, PARA, HOOD, AFRM, LCID, MDGL, DOCU, KDP, VTRS, COSM, COIN, CSCO, FCEL, HBAN, AMD, AMRS, MRVL, QCOM, SIRI, PLUG, MSFT, AAL, EBAY, MU, JBLU, INTC
NYSEThe New York Stock ExchangeIBM, WMT, KO, TM, DIS, NKE, MCD, V, CVX, MA, F, T, CCL, PLTR, BAC, UBER, AMC, VZ, ATUS, NU, SNAP, FTCH, C, WFC, CVNA, LUMN, GOLD, PFE, CHPT, SWN, ET, SHOP, PCG, XOM, KMI, AJRD, RBLX, RIG, NYCB, HBI, GM, USB, NCLH, M, KEY, CLF, MRO, OXY, U, CRM, MDT, SQ, FCX, CTRA, HPE, JPM, DAL, BMY, MO, ORCL
AMEXNYSE AmericanFAX, ACU, AE, ADRA, TELL, AGE, AIM, AAU, ERH, ERC
LSELondon Stock ExchangeLLOY, BARC, GLEN, HSBA,RR., VOD,BP., WBI, SEE, BOO
XASXAustralian Stock ExchangePLS, LNK, ADD, BHP, RIO, CBA, CSL, NAB, WBC, FMG
XNZENewzealand Stock ExchangeMEL, AIA, CEN, SKC, SPK, GNE, FPH, MCY, BGP, IFT
HKEXHongkon Stock Exchange1765, 8083, 2048, 1773, 1797, 136, 493, 3800, 6169, 1610
SGXSingapore Stock ExchangeS51, BS6, YF8, Y92, Z74, C8R, N04, E5H, G13, 5WH
CNSGSEShanghai Stock Exchange600023, 600216, 600077, 601633, 603259, 601899, 600887, 600438, 600000, 601919
XTKSTokyo Stock Exchange7203, 9984, 6758, 9432, 6861, 8035, 4063, 9983, 9434, 7974
XSHEShenzhen Stock Exchange000002, 002415, 000001, 000009, 000012, 000021, 000027, 000028, 000032
HSTCHanoi Stock ExchangePVS, BII, AAV, AMC, AME, BLF, AMV, API, ACM, ADC, ALT, BKC
XKRXKorea Stock Exchange005930, 373220, 000660, 207940, 051910, 005380, 035420, 006400, 035720, 000270
XBKKThailand Stock ExchangePTT, AOT, PTTEP, ADVANC, CPALL, GULF, SCC, BDMS, DELTA, MAKRO
XTAITaiwan Stock Exchange2603, 2498, 3481, 2618, 2303, 2609, 2610, 3035, 2482, 6118
XKLSBorsa Malaysia Stock ExchangeYONGTAI, TOPGLOV, MTRONIC, WIDAD, SAPNRG, JADEM, DNEX, HIBISCS, MGRC, NWP
XIDXIndonesian Stock ExchangeARTO, BUMI, GOTO, ZINC, BBCA, BBRI, BUKA, SWAT, BMTR, UNTR
GTISEPCommodities (Brent Oil/Crude)EBROUSDBR.SP, EWTIUSDBR.SP
GTISPMCommodities (Metal)SXAUUSDOZ.SP, SXPDUSDOZ.SP, SXPTUSDOZ.SP, SXAGUSDOZ.SP
PFXForex USDAED, USDAUD, USDBDT, USDBHD, USDCAD, USDCHF, USDCNY, USDEGP, USDEUR, USDGBP, USDHKD, USDIDR, USDINR, USDJPY, USDJOD, USDKWD, USDLBP, USDLKR, USDMAD, USDMYR, USDNZD, USDOMR, USDPHP, USDPKR, USDQAR, USDRUB, USDSAR, USDSGD, USDKRW, USDTWD, USDTHB, USDTND, USDTRY, USDZAR, USDVND
S&PS&P IndexI:SP500
NSDQGINASDAQ general IndexI:NDX
DJIDow Jones IndexDJIA
XCHINYSE ChicagoKNOP, AAPL, GDX, MSGE, GAINZ, REVB, VVX, SPXL, NINE, IEFA
CHIXCHI-X Europe Stock ExchangeBPL, AZNL, SHELL, DGEL, GLENL, HSBAL, RIOL, GSKL, BARCL, LSEGL

But for the below markets all the symbols are enabled.

Exchange CodeExchange
TDWLSaudi Stock Exchange
DFMDubai Financial Market
DSMQatar Stock Exchange
CASEEgypt Stock Exchange
ADSMAbu Dhabi Stock Exchange
DIFXNASDAQ Dubai
MSMMuscat Stock Exchange

Web Socket Client example

export class WebsocketService {

websocket: WebSocket | undefined;
public webSocketMessage: string[] = [];

constructor() { }

openWebSocketConnection(url:string){
this.websocket = new WebSocket(url);

this.websocket.onopen = (e)=>{
console.log(e);
}

this.websocket.onmessage = (e) =>{
console.log(e);
this.webSocketMessage.push(e.data);
}

this.websocket.onclose= (e)=>{
console.log(e);
}
}

sendWebSocketMessage(msg: string){
if(this.websocket!= undefined)
this.websocket.send(JSON.stringify(msg));
}

closeWebSocketConnection(){
if(this.websocket!= undefined)
this.websocket.close();
}

}
Is this page helpful for you?