after_trading_order - 盘后固定价委托(股票)

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

提示

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

原型

after_trading_order(security, amount, entrust_price)

释义

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

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

参数

参数 是否必填 官方原始定义
security security
amount amount
entrust_price entrust_price

返回值

Order对象中的id或者None。如果创建订单成功,则返回Order对象的id(str),失败则返回None(NoneType)。

示例

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:

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

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:

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

g.flag = True

详细说明

after_trading_order(security, amount, entrust_price)

使用场景

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

接口说明

该接口用于盘后固定价委托申报

注意事项

entrust_price为必传字段。

参数详细说明

security: 股票代码(str);

amount: 交易数量,正数表示买入,负数表示卖出(int);

entrust_price:买卖限价(float);

返回值

Order对象中的id或者None。如果创建订单成功,则返回Order对象的id(str),失败则返回None(NoneType)。