Skip to main content

Candles BETA

接收訂閱期權商品最新分鐘K

Parameters

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

Response

NameTypeDescription
date*string日期
type*stringTicker 類型
exchange*string交易所
marketstring市場別
symbol*string商品代碼
timeframe*numberK線週期
open*numberK線開盤價
high*numberK線最高價
low*numberK線最低價
close*numberK線收盤價
volume*numberK線成交量(整股:成交張數;興櫃股票及盤中零股:成交股數;指數:成交金額)
average*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': 'candles',
'symbol': 'TXFG4'
})

if __name__ == '__main__':
main()

Receive data

{
"event": "data",
"data": {
"symbol": "TXFG4",
"type": "FUTURE",
"exchange": "TAIFEX",
"date": "2024-06-21T11:59:00.000+08:00",
"open": 23194,
"high": 23195,
"low": 23187,
"close": 23187,
"volume": 215,
"average": 23176.58
},
"id": "<CHANNEL_ID>",
"channel": "candles"
}