Skip to main content

Trades

接收訂閱股票最新成交資訊

Parameters

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

Response

NameTypeDescription
symbol*string股票代號
type*stringTicker 類型
exchange*string交易所
marketstring市場別
time*number時間
serial*number流水號
bidnumber成交買價
asknumber成交賣價
pricenumber成交價格
sizenumber成交單量
volumenumber成交總量
isLimitDownPriceboolean最後成交價為跌停價:true
isLimitUpPriceboolean最後成交價為漲停價:true
isLimitDownBidboolean最佳一檔委買跌停價:true
isLimitUpBidboolean最佳一檔委買漲停價:true
isLimitDownAskboolean最佳一檔委賣跌停價:true
isLimitUpAskboolean最佳一檔委賣漲停價:true
isLimitDownHaltboolean暫緩撮合且瞬間趨跌:true
isLimitUpHaltboolean暫緩撮合且瞬間趨漲:true
isTrialboolean試撮階段:true
isDelayedOpenboolean延後開盤信號:true
isDelayedCloseboolean延後收盤信號:true
isContinuousboolean最後成交為逐筆交易:true
isOpenboolean開盤信號:true
isCloseboolean收盤信號:true

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': 'trades',
'symbol': '2330'
})

if __name__ == '__main__':
main()

Receive data

{
"event": "data",
"data": {
"symbol": "2330",
"type": "EQUITY",
"exchange": "TWSE",
"market": "TSE",
"bid": 567,
"ask": 568,
"price": 568,
"size": 4778,
"volume": 54538,
"isClose": true,
"time": 1685338200000000,
"serial": 6652422
},
"id": "<CHANNEL_ID>",
"channel": "trades"
}