说明 / 示例
# 5)获取最新的委托或成交的委托号 get_last_order_id()
用法: get_last_order_id(accountID, strAccountType, strDatatype, strategyName) 或不区分策略 get_last_order_id(accountID, strAccountType, strDatatype)
释义: 获取最新的委托或成交的委托号。
参数:
accountID:string,资金账号。
strAccountType:string,账号类型,可选值:
‘FUTURE’:期货
‘STOCK’:股票
‘CREDIT’:信用
‘HUGANGTONG’:沪港通
‘SHENGANGTONG’:深港通
‘STOCK_OPTION’:期权
strDatatype:string,数据类型:
‘ORDER’:委托
‘DEAL’ :成交
strategyName,string,策略名,对应 passorder 下单函数中的参数 strategyName 的值。
返回: String,委托号,如果没找到返回 ‘-1’。
示例:
```py
def init(ContextInfo):
ContextInfo.accid = '6000000248'
def handlebar(ContextInfo):
orderid = get_last_order_id(ContextInfo.accid, 'stock', 'order')
print(orderid)
obj = get_value_by_order_id(orderid,ContextInfo.accid, 'stock', 'order')
print(obj.m_strInstrumentID)
```