Skip to main content

Aggregates

接收訂閱股票聚合數據的行情資訊

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股票代碼
name*string股票簡稱
referencePricenumber參考價
previousClosenumber前一交易日收盤價
openPricenumber開盤價
openTimenumber開盤價成交時間
highPricenumber最高價
highTimenumber最高價成交時間
lowPricenumber最低價
lowTimenumber最低價成交時間
closePricenumber收盤價(最後成交價)
closeTimenumber收盤價(最後成交價)成交時間
avgPricenumber當日成交均價
changenumber最後一筆成交漲跌(含試撮)
changePercentnumber最後一筆成交漲跌幅(含試撮)
amplitudenumber當日振幅
lastPricenumber最後一筆成交價(含試撮)
lastSizenumber最後一筆成交數量(含試撮)
bidsobject[]最佳五檔委買
bids[0].pricenumber最佳五檔委買價格
bids[0].sizenumber最佳五檔委買數量
asksobject[]最佳五檔委賣
asks[0].pricenumber最佳五檔委賣價格
asks[0].sizenumber最佳五檔委賣數量
totalobject統計資訊
total.tradeValuenumber累計成交金額
total.tradeVolumenumber累計成交量
total.tradeVolumeAtBidnumber累計內盤成交量
total.tradeVolumeAtAsknumber累計外盤成交量
total.transactionnumber累計成交筆數
total.timenumber累計資訊時間
lastTradeobject最後一筆成交資訊
lastTrade.bidnumber最後一筆成交買價
lastTrade.asknumber最後一筆成交賣價
lastTrade.pricenumber最後一筆成交價格
lastTrade.sizenumber最後一筆成交數量
lastTrade.timenumber最後一筆成交時間
lastTrialobject最後一筆試撮資訊
lastTrial.bidnumber最後一筆試撮買價
lastTrial.asknumber最後一筆試撮賣價
lastTrial.pricenumber最後一筆試撮價格
lastTrial.sizenumber最後一筆試撮數量
lastTrial.timenumber最後一筆試撮時間
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
lastUpdatednumber最後更新時間

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

if __name__ == '__main__':
main()

Receive data

{
"event": "data",
"data": {
"date": "2023-05-29",
"type": "EQUITY",
"exchange": "TWSE",
"market": "TSE",
"symbol": "2330",
"name": "台積電",
"referencePrice": 566,
"previousClose": 566,
"openPrice": 574,
"openTime": 1685322000049353,
"highPrice": 574,
"highTime": 1685322000049353,
"lowPrice": 564,
"lowTime": 1685327142152580,
"closePrice": 568,
"closeTime": 1685338200000000,
"avgPrice": 568.77,
"change": 2,
"changePercent": 0.35,
"amplitude": 1.77,
"lastPrice": 568,
"lastSize": 4778,
"bids": [
{
"price": 567,
"size": 87
},
{
"price": 566,
"size": 2454
},
{
"price": 565,
"size": 611
},
{
"price": 564,
"size": 609
},
{
"price": 563,
"size": 636
}
],
"asks": [
{
"price": 568,
"size": 800
},
{
"price": 569,
"size": 806
},
{
"price": 570,
"size": 3643
},
{
"price": 571,
"size": 1041
},
{
"price": 572,
"size": 2052
}
],
"total": {
"tradeValue": 31019803000,
"tradeVolume": 54538,
"tradeVolumeAtBid": 19853,
"tradeVolumeAtAsk": 27900,
"transaction": 9530,
"time": 1685338200000000
},
"lastTrade": {
"bid": 567,
"ask": 568,
"price": 568,
"size": 4778,
"time": 1685338200000000,
"serial": 6652422
},
"lastTrial": {
"bid": 567,
"ask": 568,
"price": 568,
"size": 4772,
"time": 1685338196400347,
"serial": 6651941
},
"isClose": true,
"serial": 6652422,
"lastUpdated": 1685338200000000
},
"id": "<CHANNEL_ID>",
"channel": "aggregates"
}