Aggregates
接收訂閱股票聚合數據的行情資訊
Parameters
Name | Type | Description |
---|---|---|
channel * | string | 訂閱頻道:trades , candles , books , aggregates , indices |
symbol * | string | 股票代碼 |
intradayOddLot | boolean | intradayOddLot true: 盤中零股, false: 股票, default: false |
Response
Name | Type | Description |
---|---|---|
date * | string | 日期 |
type * | string | Ticker 類型 |
exchange * | string | 交易所 |
market | string | 市場別 |
symbol * | string | 股票代碼 |
name * | string | 股票簡稱 |
referencePrice | number | 參考價 |
previousClose | number | 前一交易日收盤價 |
openPrice | number | 開盤價 |
openTime | number | 開盤價成交時間 |
highPrice | number | 最高價 |
highTime | number | 最高價成交時間 |
lowPrice | number | 最低價 |
lowTime | number | 最低價成交時間 |
closePrice | number | 收盤價(最後成交價) |
closeTime | number | 收盤價(最後成交價)成交時間 |
avgPrice | number | 當日成交均價 |
change | number | 最後一筆成交漲跌(含試撮) |
changePercent | number | 最後一筆成交漲跌幅(含試撮) |
amplitude | number | 當日振幅 |
lastPrice | number | 最後一筆成交價(含試撮) |
lastSize | number | 最後一筆成交數量(含試撮) |
bids | object[] | 最佳五檔委買 |
bids[0].price | number | 最佳五檔委買價格 |
bids[0].size | number | 最佳五檔委買數量 |
asks | object[] | 最佳五檔委賣 |
asks[0].price | number | 最佳五檔委賣價格 |
asks[0].size | number | 最佳五檔委賣數量 |
total | object | 統計資訊 |
total.tradeValue | number | 累計成交金額 |
total.tradeVolume | number | 累計成交量 |
total.tradeVolumeAtBid | number | 累計內盤成交量 |
total.tradeVolumeAtAsk | number | 累計外盤成交量 |
total.transaction | number | 累計成交筆數 |
total.time | number | 累計資訊時間 |
lastTrade | object | 最後一筆成交資訊 |
lastTrade.bid | number | 最後一筆成交買價 |
lastTrade.ask | number | 最後一筆成交賣價 |
lastTrade.price | number | 最後一筆成交價格 |
lastTrade.size | number | 最後一筆成交數量 |
lastTrade.time | number | 最後一筆成交時間 |
lastTrial | object | 最後一筆試撮資訊 |
lastTrial.bid | number | 最後一筆試撮買價 |
lastTrial.ask | number | 最後一筆試撮賣價 |
lastTrial.price | number | 最後一筆試撮價格 |
lastTrial.size | number | 最後一筆試撮數量 |
lastTrial.time | number | 最後一筆試撮時間 |
isLimitDownPrice | boolean | 最後成交價為跌停價:true |
isLimitUpPrice | boolean | 最後成交價為漲停價:true |
isLimitDownBid | boolean | 最佳一檔委買跌停價:true |
isLimitUpBid | boolean | 最佳一檔委買漲停價:true |
isLimitDownAsk | boolean | 最佳一檔委賣跌停價:true |
isLimitUpAsk | boolean | 最佳一檔委賣漲停價:true |
isLimitDownHalt | boolean | 暫緩撮合且瞬間趨跌:true |
isLimitUpHalt | boolean | 暫緩撮合且瞬間趨漲:true |
isTrial | boolean | 試撮階段:true |
isDelayedOpen | boolean | 延後開盤信號:true |
isDelayedClose | boolean | 延後收盤信號:true |
isContinuous | boolean | 最後成交為逐筆交易:true |
isOpen | boolean | 開盤信號:true |
isClose | boolean | 收盤信號:true |
lastUpdated | number | 最後更新時間 |
Example
Subscribe channel
- Python
- Node.js
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()
const { WebSocketClient } = require("@fugle/marketdata");
const client = new WebSocketClient({ apiKey: "YOUR_API_KEY" });
const stock = client.stock;
stock.connect().then(() => {
stock.subscribe({ channel: "aggregates", symbol: "0050" });
});
stock.on("message", (message) => {
const data = JSON.parse(message);
console.log(data);
});
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"
}