Skip to main content

Candles

Receive the latest one-minute candlestick for subscribed futures/options contracts.

Parameters

NameTypeDescription
channel*stringSubscription channel: trades, books, aggregates, candles
symbol*stringContract symbol
afterHours*boolSubscribe to after-hours market data. true: after-hours session; false: regular session; default: false

Response

NameTypeDescription
date*stringDate
type*stringTicker type
exchange*stringExchange
marketstringMarket type
symbol*stringProduct symbol
timeframe*numberCandlestick timeframe
open*numberCandlestick opening price
high*numberCandlestick high price
low*numberCandlestick low price
close*numberCandlestick closing price
volume*numberCandlestick volume (board lots for regular-lot trades; shares for Emerging Stock and intraday odd-lot trades; transaction value for indices)
average*numberAverage trade price

Example

Subscribe channel

from fubon_neo.sdk import FubonSDK, Order, Mode

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") # Login is required to obtain market-data permissions

sdk.init_realtime(Mode.Normal) # Initialize the market-data connection

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

Subscribe to multiple products

To subscribe to multiple products at the same time, see Subscribe Channel.

Receive data

{
"event": "data",
"data": {
"symbol": "TXFA4",
"type": "FUTURE",
"exchange": "TAIFEX",
"date": "2023-12-28T12:01:00.000+08:00",
"open": 17861,
"high": 17862,
"low": 17859,
"close": 17862,
"volume": 22,
"average": 17820.19
},
"id": "<CHANNEL_ID>",
"channel": "candles"
}