返回列表 发布新帖

没有拆单的情形,股票期权超价下单不能实现

116 1
发表于 2024-4-18 12:08:45 | 显示全部楼层 阅读模式
在做股票期权时,遇到需要超价2元下单的场景,看了官方的文档,目前只有算法下单函数algo_passorder支持超价下单。但是从实测的结果的来看,algo_passorder似乎并不支持只下1手时的超价下单。
参数设置如下:
userparam = {"OrderType":1, "MaxOrderCount":1, 'PlaceOrderInterval':10,'SuperPriceType':1,'SuperPriceValue':2}
algo_passorder(ContextInfo.SELL_OPEN, 1101, ContextInfo.account, ContextInfo.cur_contract, ContextInfo.ASK_1, -1, 1, 'test', 1, 'algo_order', userparam, ContextInfo)
委托回报提示消息,是以卖一价下单。通过委托界面,查看委托的价格,确实也是当时的卖一的盘口价,并没有加上超价。如果说超价2元,不好观察,不妨设置超价参数为20元,大一点的参数,发现委托价依然是盘口价格。这就说,超价设置没有生效。
所以我感觉,只有1手时,不存在拆单的情况,userparam = {"OrderType":1, "MaxOrderCount":1, 'PlaceOrderInterval':10,'SuperPriceType':1,'SuperPriceValue':2} ,这个参数设置不会生效。
麻烦官方的大佬们核实一下,给出超价下单的解决办法。

评论1

*******1932_ExQj5楼主
发表于 2024-4-18 12:59:08 | 显示全部楼层
#coding:gbk
import datetime
import pandas as pd

def init(ContextInfo):
    ContextInfo.order_count = 0
    ContextInfo.max_count = 5 # 委托风控参数
    ContextInfo.order_time_span = 30
    ContextInfo.BUY_OPEN = 50
    ContextInfo.SELL_OPEN = 50
   
    ContextInfo.BUY_OPEN = 50  
    ContextInfo.SELL_OPEN = 52
    ContextInfo.SELL_CLOSE = 51
    ContextInfo.BUY_CLOSE = 53
    ContextInfo.ASK_1 = 4
    ContextInfo.BID_1 = 6
   
    ContextInfo.account = 'xxxx'
    ContextInfo.start = '2024-04-01 09:25:00'
    ContextInfo.end = '2200-12-31 15:30:00'
    ContextInfo.set_commission(1, [1,0, 0, 2, 2, 2])
   
    ContextInfo.userparam = {"OrderType":1,"SingleNumMin":1,"SingleNumMax":1,"MaxOrderCount":3, 'PlaceOrderInterval':10,'SuperPriceType':1,'SuperPriceValue':20}

   
def handlebar(ContextInfo):
    if not ContextInfo.is_last_bar():
        pass
    else:
        algo_passorder(ContextInfo.BUY_OPEN, 1101, ContextInfo.account, '10006966.SHO', ContextInfo.BID_1, -1, 3, 'OPT_MM', 1, 'algo_order', ContextInfo.userparam, ContextInfo)
        ContextInfo.order_count += 1
        if ContextInfo.order_count > ContextInfo.max_count:
            stop(ContextInfo)
   
def stop(ContextInfo):
    print( '策略已经退出!')

为了省时间,大佬们可以拿这段代码去做测试。ContextInfo.account = 'xxxx'需要改一下。

回复

您需要登录后才可以回帖 登录 | 立即注册

主题

1

回帖

1

积分

0

客服专线

400-080-8112

用思考的速度交易,用真诚的态度合作,我们是认真的!
  • 关注公众号
  • 添加微信客服
Copyright © 2001-2024 迅投QMT社区 版权所有 All Rights Reserved. 蜀ICP备19002686号-2
关灯 快速发帖
扫一扫添加微信客服
QQ客服返回顶部
快速回复 返回顶部 返回列表