Skip to main content

Trades

Subscribe to the latest contract trade information

Parameters

NameTypeDescription
channel*stringChannel:trades, books
symbol*stringContract code
afterHours*boolSubscription AfterHours Session true : AfterHours false : Regular default : false

Response

NameTypeDescription
symbol*stringContract code
type*stringTicker Type
exchange*stringExchange
marketstringMarket Type
tradesobjectList
>> pricenumberTrading Price
>> sizenumberTrading Volume
>> bidnumberBid Price
>> asknumberAsk Price
totalobjectList
>> tradeVolumenumberTotal Trading Volume
>> totalBidMatchnumberTotal Trading Bid Volume
>> totalAskMatchnumberTotal Trading Ask Volume
time*numberTime
serial*numberSerial Number
info

'*' Indicates mandatory disclosure fields.

Example

Subscribe channel

from fubon_neo.sdk import FubonSDK, Order

def handle_message(message):
print(f'market data message: {message}')

sdk = FubonSDK()
accounts = sdk.login("Your ID", "Your password", "Your cert path", "Your cert password")

sdk.init_realtime()

futopt = sdk.marketdata.websocket_client.futopt
futopt.on('message', handle_message)
futopt.connect()
futopt.subscribe({
'channel': 'trades',
'symbol': 'TXFA4'
#'afterHours' : True
})

Receive data

{
"event": "data",
"data": {
"symbol": "TXFA4",
"type": "FUTURE",
"exchange": "TAIFEX",
"trades": [
{
"price": 17540,
"size": 1,
"bid": 17539,
"ask": 17540
}
],
"total": {
"tradeVolume": 12174,
"totalBidMatch": 8760,
"totalAskMatch": 7907
},
"time": 1702956487023000,
"serial": 159250
},
"id": "<CHANNEL_ID>",
"channel": "trades"
}