QMT · 内置 Python交易函数
can_cancel_order
查询委托是否可撤销
原型
can_cancel_order(orderId, accountID, strAccountType)
参数
rderId,string,委托号; accountID,string,资金账号; strAccountType,string,账号类型,有"FUTURE","STOCK","CREDIT","HUGANGTONG","SHENGANGTONG","STOCK_OPTION";
返回值
bool,是否可撤,True或False
示例
以下代码依据官方示例整理缩进,并将旧式 print 写法改为函数调用;账号使用占位值。
def init(ContextInfo):
ContextInfo.accid = 'YOUR_ACCOUNT_ID'
def handlebar(ContextInfo):
order_id = get_last_order_id(ContextInfo.accid, 'STOCK', 'ORDER')
print(can_cancel_order(order_id, ContextInfo.accid, 'STOCK'))
补充说明
can_cancel_order (orderId,accountID,strAccountType);
官方来源
迅投 QMT 官方函数检索表,条目 can_cancel_order。本页属于 QMT 内置 Python 接口;原站函数检索表同时收录其他语言,不能按网页路径将本条目误归为 VBA。网页核对日期:2026-10-11。