Skip to main content

Aggregates BETA

接收訂閱期權聚合數據的行情資訊

Parameters

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

Response

NameTypeDescription
date*string日期
type*string期權類型
exchange*string交易所
symbol*string商品代碼
name*string商品名稱
previousClosenumber昨日收盤價
openPricenumber開盤價
openTimenumber開盤價成交時間
highPricenumber最高價
highTimenumber最高價成交時間
lowPricenumber最低價
lowTimenumber最低價成交時間
closePricenumber收盤價(最後成交價)
closeTimenumber收盤價(最後成交價)成交時間
avgPricenumber當日成交均價
changenumber最後成交價漲跌
changePercnetnumber最後成交價漲跌幅
amplitudenumber當日振幅
lastPricenumber最後一筆成交價(含試撮)
lastSizenumber最後一筆成交數量(含試撮)
totalobject統計時間
total.tradeVolumenumber累計成交量
total.totalBidMatchnumber累計委買成交筆數
total.totalAskMatchnumber累計委賣成交筆數
lastTradeobject最後一筆成交資訊
lastTrade.pricenumber最後一筆成交價格
lastTrade.sizenumber最後一筆成交數量
lastTrade.timenumber最後一筆成交時間
lastTrade.serialnumber最後一筆成交流水號
serialnumber流水號
lastUpdatednumber最後異動時間

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': 'aggregates',
'symbol': 'TXFK4',
'afterHours': True
})

if __name__ == '__main__':
main()

Receive data

{
"event": "data",
"data": {
"date": "2024-10-23",
"type": "FUTURE_AH",
"exchange": "TAIFEX",
"symbol": "TXFK4",
"name": "臺股期貨114",
"previousClose": 23660,
"openPrice": 23611,
"openTime": 1729580400097000,
"highPrice": 23667,
"highTime": 1729581260165000,
"lowPrice": 23598,
"lowTime": 1729580555065000,
"closePrice": 23620,
"closeTime": 1729582381863000,
"avgPrice": 23631.9,
"change": -1,
"changePercent": 0,
"amplitude": 0.29,
"lastPrice": 23620,
"lastSize": 1,
"total": {
"tradeVolume": 2854,
"totalBidMatch": 2493,
"totalAskMatch": 2484,
"time": 1729582381863000
},
"lastTrade": {
"bid": 23620,
"ask": 23622,
"price": 23620,
"size": 1,
"time": 1729582381863000,
"serial": "00010204"
},
"serial": 158638,
"lastUpdated": 1729582383094000
},
"id": "<CHANNEL_ID>",
"channel": "aggregates"
}