You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

IBAPI reqMktData查询ASX标的时拍卖成交量与失衡量返回值相同问题

IBAPI获取澳交所标的拍卖数据异常问题

第二次更新

实际上该问题可能源于澳交所(ASX)提供的数据流,因为TWS仅将数据直接透传给用户,这也解释了此前该问题未被发现的原因——它可能仅存在于澳大利亚证券交易所的数据源中。

更新

我已证实该故障属于TWS本身的问题,与API无关,已向盈透证券(IB)提交故障报告,将关闭此问询。

我在Python环境下使用IBAPI时执行了如下调用:
self.reqMktData(idnum, contract1, 'mdoff,225', False, False, [])

按照官方说明,该请求应返回拍卖价格、拍卖成交量、拍卖失衡量(对应tick类型34、35、36)。实际调用时确实收到了三类tick的返回值,但tick类型35(拍卖成交量)和36(拍卖失衡量)的返回值始终相同,明显不符合预期。除此之外其他返回数据均正常,拍卖价格、成交量数据与单独获取的订单簿数据完全匹配。

该问题仅出现在澳大利亚证券交易所的标的数据中,我测试过的所有ASX股票、所有时间段均复现了该现象,测试覆盖范围较广。

请问是否有其他用户遇到过同样的问题?

我附上了最小可复现代码(MWE),方便大家快速复现该现象,使用时可根据实际情况调整连接IP和端口号:

from ibapi.client import EClient
from ibapi.wrapper import EWrapper
from ibapi.contract import Contract
from ibapi.order import Order
from ibapi.order_state import OrderState

import threading
import time
from datetime import datetime
import queue
class IBapi(EWrapper, EClient):
        def __init__(self):
                EClient.__init__(self, self)
        def request_auction_data_single(self, idnum: int, contract1: Contract):
                self.reqMktData(idnum, contract1, 'mdoff,225', False, False, []) #225是对应拍卖价格、成交量、失衡量数据的tick id
                return None
        def tickPrice(self, reqId, tickType, price, attrib):
                # 该函数接收TWS返回的tick价格数据
                attrib_as_string = str(attrib)
                print("tickPrice triggered. reqId=%d, tickType=%d, price=%f, attribasstr=%s" % (reqId, tickType, price, attrib_as_string))
                return None
        def tickSize(self, reqId, tickType, size):
                # 该函数接收TWS返回的tick size数据
                print("tickSize  triggered. reqId=%d, tickType=%d, size=%d" % (reqId, tickType, size))
                return None
        def error(self, id, errorCode, errorString):
                errormessage = "TWS error. id = %d. errorcode = %d. msg = %s" % (id, errorCode, errorString)
                print(errormessage)
        def build_contract(self, mkt: str, scy: str, sectype: str, currency: str):
                cc1 = Contract()
                cc1.exchange = mkt
                cc1.symbol = scy
                cc1.secType = sectype
                cc1.currency = currency
                return cc1

def run_loop():
        app.run()

app = IBapi()
app.connect("127.0.0.1", 7496, 0)

# 启动线程运行API
api_thread = threading.Thread(target=run_loop, daemon=True)
api_thread.start()

time.sleep(1) # 等待与服务端连接建立完成

# 请求拍卖数据
id1 = app.reqIds(-1)
contract1 = app.build_contract("ASX","NAB","STK","AUD")
app.request_auction_data_single(id1, contract1)

只需在盘前拍卖时段运行该代码片段即可复现上述问题。

补充说明

我已在项目GitHub页面提交了issue,但该仓库访问受限,因此不附上相关链接。


内容的提问来源于stack exchange,提问作者Colin T Bowers

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.09.25 03:24:02