after_trading_cancel_order - 盘后固定价委托撤单(股票)

after_trading_cancel_order 是 PTrade 中用于盘后固定价委托撤单(股票)的接口。

提示

  • live-or-trading-module-only
  • broker-or-counter-dependent

原型

after_trading_cancel_order(order_param)

释义

after_trading_cancel_order 是 PTrade 中用于盘后固定价委托撤单(股票)的接口。

研究:不支持;回测:不支持;模拟:官方目录未明确;实盘:支持。

参数

参数 是否必填 官方原始定义
order_param order_param

返回值

None(NoneType)

示例

import time

def initialize(context):

g.security = "300001.SZ"

set_universe(g.security)

# 15:00-15:30期间使用run_daily进行盘后固定价委托、盘后固定价委托撤单

run_daily(context, order_test, time="15:15")

g.flag = False

def order_test(context):

snapshot = get_snapshot(g.security)

if snapshot is not None:

last_px = snapshot[g.security].get("last_px", 0)

if last_px > 0:

order_id = after_trading_order(g.security, 200, float(last_px))

time.sleep(5)

after_trading_cancel_order(order_id)

def handle_data(context, data):

if not g.flag:

snapshot = get_snapshot(g.security)

if snapshot is not None:

last_px = snapshot[g.security].get("last_px", 0)

if last_px > 0:

order_id = after_trading_order(g.security, 200, float(last_px))

time.sleep(5)

after_trading_cancel_order(order_id)

g.flag = True

详细说明

after_trading_cancel_order(order_param)

使用场景

该函数仅支持PTrade客户端可用、仅在股票交易模块可用,对接ATP柜台不支持该函数

接口说明

该接口用于盘后固定价委托取消订单,根据Order对象或order_id取消订单。

注意事项

参数详细说明

order_param: Order对象或者order_id(Order/str)

返回值

None(NoneType)