【加蛋量化之实用程序 - 第08期】order函数增强版

欧阳
欧阳 This guy is lazy,Introduction has not been set

2 People liked this article · 2450 views

针对群里用户们提出的一些问题和需求,对原版的order命令进行了重新封装改进

制作了一个新的  order_grp  函数,支持按挡位下单,调用示例如下:

1. 以最新价买入100股

order_grp('600570.SS', 100, grp=0)

2. 以卖五价买入100股

order_grp('600570.SS', 100, grp=-5)

3. 以买五价卖出100股

order_grp('600570.SS', -100, grp=5)

当出现涨停或跌停,指定挡位价格不存在时(如涨停时卖五不存在),程序会自动以最新价进行下单,避免出现报错

下单后日志会显示标的,委托数量和委托价格

附件内含  order_grp 函数

List of attachments

order_grp.txt

0B

1.80

线上付款

Published on 2024-08-18 13:08

Disclaimers:

This document is written by 欧阳 Original published on 百果量化交流平台 ,The copyright belongs to the author。

Log in,More exciting content waiting for you to find,Contribute wonderful answers,Participate in comment interaction

go Sign in! No accountgoregister

9981
2024-11-24 19:27
请问,没有L2行情的用户,可以用吗?应为:get_snapshot 中 “bid_grp:委买档位(第一档包含委托队列(仅L2支持))(str:dict[int:list[float,int,int,{int:int,...}],int:list[float,int,int]...]);” 谢谢!
初见明月
2024-10-02 20:06
@初见明月 单引号怎么变斜杠了
初见明月
2024-10-02 17:52
大师,我问过kimi,这个自定义函数比较简单,可以放在策略中直接使用。复杂的话,可以做模块文件,可以直接加入函数库,还有其它方法,我暂时还不会,继续努力学习吧!
初见明月
2024-10-02 17:42
请问大师,grp可以设置-10or10吗?另,这个函数如何使用,是将定义的内容,粘贴到原本的策略主体中吗?比如,我用双均线策略5日上穿10日,然后原来的order改成order_grp(\600570.SS\,100,grp=-10),是这样使用吧?