说明 / 示例
# 12)指定手数交易 order_lots()
用法: order_lots(stockcode, lots[, style, price], ContextInfo[, accId])
释义: 指定手数交易,指定手数发送买/卖单。如有需要落单类型当做一个参量传入,如果忽略掉落单类型,那么默认以最新价下单。
参数:
stockcode:代码,string,如 ‘000002.SZ’
lots:手数,int
style:下单选价类型,string,默认为最新价 ‘LATEST’,可选值:
‘LATEST’:最新
‘FIX’:指定
‘HANG’:挂单
‘COMPETE’:对手
‘MARKET’:市价
‘SALE5’, ‘SALE4’, ‘SALE3’, ‘SALE2’, ‘SALE1’:卖5-1价
‘BUY1’, ‘BUY2’, ‘BUY3’, ‘BUY4’, ‘BUY5’:买1-5价
price:价格,double
ContextInfo:PythonObj,Python 对象,这里必须是 ContextInfo
accId:账号,string
返回: 无
示例:
```py
def handlebar(ContextInfo):
# 按最新价下 1 手买入
order_lots('000002.SZ', 1, ContextInfo, '600000248')
# 用对手价下 1 手卖出
order_lots('000002.SZ', -1, 'COMPETE', ContextInfo, '600000248')
# 用指定价 37.5 下 2 手卖出
order_lots('000002.SZ', -2, 'fix', 37.5, ContextInfo, '600000248')
```