Skip to main content

Candles

接收訂閱股票最新分鐘K

Parameters

NameTypeDescription
channel*string訂閱頻道:trades, candles, books, aggregates, indices
symbol*string股票代碼
intradayOddLotbooleanintradayOddLot true: 盤中零股, false: 股票, default: false

Response

NameTypeDescription
date*string日期
type*stringTicker 類型
exchange*string交易所
marketstring市場別
symbol*string股票代號
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')
stock = client.stock
stock.on('message', handle_message)
stock.connect()
stock.subscribe({
'channel': 'candles',
'symbol': '2330'
})

if __name__ == '__main__':
main()

Receive data

{
"event": "data",
"data": {
"symbol": "2330",
"type": "EQUITY",
"exchange": "TWSE",
"market": "TSE",
"date": "2023-05-29T13:30:00.000+08:00",
"open": 568,
"high": 568,
"low": 568,
"close": 568,
"volume": 4778,
"average": 568.77
},
"id": "<CHANNEL_ID>",
"channel": "candles"
}