Skip to main content

Books BETA

接收訂閱期權商品最新最佳五檔委買委賣資訊

Parameters

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

Response

NameTypeDescription
symbol*string商品代碼
type*stringTicker 類型
exchange*string交易所
marketstring市場別
time*number時間
bidsobject[]最佳五檔委買
bids[0].pricenumber最佳五檔委買價格
bids[0].sizenumber最佳五檔委買數量
asksobject[]最佳五檔委賣
asks[0].pricenumber最佳五檔委賣價格
asks[0].sizenumber最佳五檔委賣數量

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': 'books',
'symbol': 'TXFG4',
})

if __name__ == '__main__':
main()

Receive data

{
"event": "data",
"data": {
"symbol": "TXFG4",
"type": "FUTURE",
"exchange": "TAIFEX",
"bids": [
{
"price": 23187,
"size": 13
},
{
"price": 23186,
"size": 15
},
{
"price": 23185,
"size": 21
},
{
"price": 23184,
"size": 11
},
{
"price": 23183,
"size": 15
}
],
"asks": [
{
"price": 23189,
"size": 5
},
{
"price": 23190,
"size": 14
},
{
"price": 23191,
"size": 17
},
{
"price": 23192,
"size": 19
},
{
"price": 23193,
"size": 15
}
],
"time": 1718942376775000
},
"id": "<CHANNEL_ID>",
"channel": "books"
}