Skip to main content

Trades BETA

接收訂閱期權商品最新成交資訊

Parameters

NameTypeDescription
channel*string訂閱頻道:trades, candles, books , aggregates
symbol*string期貨商品代碼
afterHoursbooleantrue: 夜盤, false: 日盤, default: false

Response

NameTypeDescription
symbol*string商品代號
type*stringTicker 類型
exchange*string交易所
marketstring市場別
tradesobject[]成交報價
trades[0].pricenumber成交價格
trades[0].sizenumber成交單量
trades[0].bidnumber成交買價
trades[0].asknumber成交賣價
totalobject成交量
total.tradeVolumenumber成交總量
total.totalBidMatchnumber累計委買成交筆數
total.totalAskMatchnumber累計委賣成交筆數
time*number時間
serial*number流水號

Example

Subscribe channel

from fugle_marketdata import WebSocketClient

def handle_message(message):
print(message)

def main():
client = WebSocketClient(api_key='YOUR_API_KEY')
futopt = client.futopt
futopt.on('message', handle_message)
futopt.connect()
futopt.subscribe({
'channel': 'trades',
'symbol': 'TXFG4',
'afterHours': True
})

if __name__ == '__main__':
main()

Receive data

{
"event": "data",
"data": {
"symbol": "TXFG4",
"type": "FUTURE_AH",
"exchange": "TAIFEX",
"trades": [
{
"price": 23379,
"size": 1,
"bid": 23379,
"ask": 23380
}
],
"total": {
"tradeVolume": 12431,
"totalBidMatch": 8191,
"totalAskMatch": 7964
},
"time": 1718880340342000,
"serial": 23143
},
"id": "<CHANNEL_ID>",
"channel": "trades"
}