order_volume - 按指定量委托

函数原型:

  1. order_volume(symbol, volume, side, order_type,position_effect, price=0,order_duration=OrderDuration_Unknown, order_qualifier=OrderQualifier_Unknown,account='')

参数:

参数名 类型 说明
symbol str 标的代码
volume int 数量
side int 订单方向
order_type int 订单类型
position_effect int 开平仓类型
price int 价格
order_duration int 委托时间属性
order_qualifier int 委托成交属性
account account id or account name or None 帐户

示例:

  1. data = order_volume(symbol='SHSE.600000', volume=10000, side=OrderSide_Buy, order_type=OrderType_Limit, position_effect=PositionEffect_Open, price=11)

返回:

  1. status volume account_id created_at position_side symbol target_percent percent value side position_effect target_volume filled_amount filled_volume order_style filled_vwap price strategy_id target_value order_type
  2. -------- -------- ------------ ------------------- --------------- ----------- ---------------- --------- ------- ------ ----------------- --------------- --------------- --------------- ------------- ------------- ------- ------------- -------------- ------------
  3. 3 10000 strategy_id 2017-07-06 07:00:01 1 SHSE.600000 0.11 0.11 110000 1 1 10000 110000 10000 1 11 11 strategy_id 110000 1

order_value - 按指定价值委托

函数原型:

  1. order_value(symbol, value, side,order_type, position_effect, price=0, order_duration=OrderDuration_Unknown, order_qualifier=OrderQualifier_Unknown,account='')

参数:

参数名 类型 说明
symbol str 标的代码
value int 股票价值
side int 订单方向
order_type int 订单类型
position_effect int 开平仓类型
price int 价格
order_duration int 委托时间属性
order_qualifier int 委托成交属性
account account id or account name or None 帐户

示例:

  1. order_value(symbol='SHSE.600000', value=100000, price=11, side=OrderSide_Buy, order_type=OrderType_Limit, position_effect=PositionEffect_Open)

返回:

  1. status volume account_id created_at position_side symbol target_percent percent value side position_effect target_volume filled_amount filled_volume order_style filled_vwap price strategy_id target_value order_type
  2. -------- -------- ------------ ------------------- --------------- ----------- ---------------- --------- ------- ------ ----------------- --------------- --------------- --------------- ------------- ------------- ------- ------------- -------------- ------------
  3. 3 9000 strategy_id 2017-07-06 07:00:01 1 SHSE.600000 0.099 0.1 100000 1 1 9000 99000 9000 2 11 11 strategy_id 99000 1

order_percent - 按指定比例委托

函数原型:

  1. order_percent(symbol, percent, side,order_type, position_effect, price=0, order_duration=OrderDuration_Unknown, order_qualifier=OrderQualifier_Unknown, account='')

参数:

参数名 类型 说明
symbol str 标的代码
percent double 比例
side int 订单方向
order_type int 订单类型
position_effect int 开平仓类型
price int 价格
order_duration int 委托时间属性
order_qualifier int 委托成交属性
account account id or account name or None 帐户

示例:

  1. order_percent(symbol='SHSE.600000', percent=0.1, side=OrderSide_Buy, order_type=OrderType_Limit, position_effect=PositionEffect_Open, price=11)

返回:

  1. status volume account_id created_at position_side symbol target_percent percent value side position_effect target_volume filled_amount filled_volume order_style filled_vwap price strategy_id target_value order_type
  2. -------- -------- ------------ ------------------- --------------- ----------- ---------------- --------- ------- ------ ----------------- --------------- --------------- --------------- ------------- ------------- ------- ------------- -------------- ------------
  3. 3 9000 strategy_id 2017-07-06 07:00:01 1 SHSE.600000 0.099 0.1 100000 1 1 9000 99000 9000 3 11 11 strategy_id 99000 1

order_target_volume - 调仓到目标持仓量

函数原型:

  1. order_target_volume(symbol, volume, position_side, order_type, price=0, order_duration=OrderDuration_Unknown, order_qualifier=OrderQualifier_Unknown, account='')

参数:

参数名 类型 说明
symbol str 标的代码
volume int 期望的最终数量
position_side int 持仓方向
order_type int 订单类型
price int 价格
order_duration int 委托时间属性
order_qualifier int 委托成交属性
account account id or account name or None 帐户

示例:

  1. order_target_volume(symbol='SHSE.600000', volume=10000, position_side=PositionSide_Long, order_type=OrderType_Limit, price=11)

返回:

  1. status volume account_id created_at position_side symbol target_percent percent value side position_effect target_volume filled_amount filled_volume order_style filled_vwap price strategy_id target_value order_type
  2. -------- -------- ------------ ------------------- --------------- ----------- ---------------- --------- ------- ------ ----------------- --------------- --------------- --------------- ------------- ------------- ------- ------------- -------------- ------------
  3. 3 9000 strategy_id 2017-07-06 07:00:01 1 SHSE.600000 0.099 0.1 100000 1 1 9000 99000 9000 3 11 11 strategy_id 99000 1

order_target_value - 调仓到目标持仓额

函数原型:

  1. order_target_value(symbol, value, position_side, order_type, price=0, order_duration=OrderDuration_Unknown, order_qualifier=OrderQualifier_Unknown, account='')

参数:

参数名 类型 说明
symbol str 标的代码
value int 期望的股票最终价值
position_side int 持仓方向
order_type int 订单类型
price int 价格
order_duration int 委托时间属性
order_qualifier int 委托成交属性
account account id or account name or None 帐户

示例:

  1. order_target_value(symbol='SHSE.600000', value=100000, position_side=PositionSide_Long, order_type=OrderType_Limit, price=11)

返回:

  1. status volume account_id created_at position_side symbol target_percent percent value side position_effect target_volume filled_amount filled_volume order_style filled_vwap price strategy_id target_value order_type
  2. -------- -------- ------------ ------------------- --------------- ----------- ---------------- --------- ------- ------ ----------------- --------------- --------------- --------------- ------------- ------------- ------- ------------- -------------- ------------
  3. 3 9000 strategy_id 2017-07-06 07:00:01 1 SHSE.600000 0.099 0.1 100000 1 1 9000 99000 9000 3 11 11 strategy_id 99000 1

order_target_percent - 调仓到目标持仓比例

函数原型:

  1. order_target_percent(symbol, percent, position_side, order_type, price=0, order_duration=OrderDuration_Unknown, order_qualifier=OrderQualifier_Unknown, account='')

参数:

参数名 类型 说明
symbol str 标的代码
percent double 期望的最终比例
position_side int 持仓方向
order_type int 订单类型
order_duration int 委托时间属性
order_qualifier int 委托成交属性
price int 价格
account account id or account name or None 帐户

示例:

  1. order_target_percent(symbol='SHSE.600000', percent=0.5, position_side=PositionSide_Long, order_type=OrderType_Limit, price=11)

返回:

  1. status volume account_id created_at position_side symbol target_percent percent value side position_effect target_volume filled_amount filled_volume order_style filled_vwap price strategy_id target_value order_type
  2. -------- -------- ------------ ------------------- --------------- ----------- ---------------- --------- ------- ------ ----------------- --------------- --------------- --------------- ------------- ------------- ------- ------------- -------------- ------------
  3. 3 9000 strategy_id 2017-07-06 07:00:01 1 SHSE.600000 0.099 0.1 100000 1 1 9000 99000 9000 3 11 11 strategy_id 99000 1

order_batch - 批量委托接口

函数原型:

  1. order_batch(orders, combine=False, account='')

参数:

参数名 类型 说明
orders list[order] 委托对象列表
combine bool 是否是组合单, 默认不是
account account id or account name or None 帐户

示例:

  1. order_1 = {'symbol': 'SHSE.600000', 'percent': 0.2, 'price': 11, 'side': 1, 'order_type': 1}
  2. order_2 = {'symbol': 'SHSE.600004', 'percent': 0.2, 'price': 11, 'side': 1, 'order_type': 1}
  3. orders = [order_1, order_2]
  4. batch_orders = order_batch(orders, combine=True)
  5. for order in batch_orders:
  6. print(order)

返回:

  1. status volume account_id created_at position_side symbol target_percent percent value side position_effect target_volume filled_amount filled_volume order_style filled_vwap price strategy_id target_value order_type
  2. -------- -------- ------------ ------------------- --------------- ----------- ---------------- --------- ------- ------ ----------------- --------------- --------------- --------------- ------------- ------------- ------- ------------- -------------- ------------
  3. 3 9000 strategy_id 2017-07-06 07:00:01 1 SHSE.600000 0.099 0.1 100000 1 1 9000 99000 9000 3 11 11 strategy_id 99000 1

order_cancel - 撤销委托

函数原型:

  1. order_cancel(wait_cancel_orders)

参数:

参数名 类型 说明
wait_cancel_orders list[str] 委托对象列表 or 单独委托对象

示例:

  1. order_1 = {'symbol': 'SHSE.600000', 'cl_ord_id': 'cl_ord_id_1', 'price': 11, 'side': 1, 'order_type':1 }
  2. order_2 = {'symbol': 'SHSE.600004', 'cl_ord_id': 'cl_ord_id_2', 'price': 11, 'side': 1, 'order_type':1 }
  3. orders = [order_1, order_2]
  4. order_cancel(wait_cancel_orders=orders)

order_cancel_all - 撤销所有委托

函数原型:

  1. order_cancel_all()

示例:

  1. order_cancel_all()

order_close_all - 平当前所有可平持仓

函数原型:

  1. order_close_all()

示例:

  1. order_close_all()

get_unfinished_orders - 查询日内全部未结委托

函数原型:

  1. get_unfinished_orders()

返回值:

类型 说明
list[order] 委托对象 列表

示例:

  1. get_unfinished_orders()

返回:

  1. status volume account_id created_at position_side symbol target_percent percent value side position_effect target_volume filled_amount filled_volume order_style filled_vwap price strategy_id target_value order_type
  2. -------- -------- ------------ ------------------- --------------- ----------- ---------------- --------- ------- ------ ----------------- --------------- --------------- --------------- ------------- ------------- ------- ------------- -------------- ------------
  3. 3 9000 strategy_id 2017-07-06 07:00:01 1 SHSE.600000 0.099 0.1 100000 1 1 9000 99000 9000 3 11 11 strategy_id 99000 1

get_orders - 查询日内全部委托

函数原型:

  1. get_orders()

返回值:

类型 说明
list[order] 委托对象 列表

示例:

  1. get_orders()

返回:

  1. status volume account_id created_at position_side symbol target_percent percent value side position_effect target_volume filled_amount filled_volume order_style filled_vwap price strategy_id target_value order_type
  2. -------- -------- ------------ ------------------- --------------- ----------- ---------------- --------- ------- ------ ----------------- --------------- --------------- --------------- ------------- ------------- ------- ------------- -------------- ------------
  3. 3 9000 strategy_id 2017-07-06 07:00:01 1 SHSE.600000 0.099 0.1 100000 1 1 9000 99000 9000 3 11 11 strategy_id 99000 1