• goctp 委托追单


    委托追单

    以 http 协议提供服务,接收委托的参数。应用以 7*24 运行,接收到委托请求后按参数进行追单处理。

    https://www.bilibili.com/video/BV1HB4y15782/

    部署

    version: '3.7'
    services:
      # 启动: docker-compose --compatibility up -d
      after_single:
        image: haifengat/after_single
        container_name: after_single
        restart: on-failure:3
        ports:
          - 8765:80
        environment:
          - TZ=Asia/Shanghai
          - tradeFront=tcp://180.168.146.187:10101
          - quoteFront=tcp://180.168.146.187:10111
          - loginInfo=9999/008107/1/simnow_client_test/0000000000000000
          - firstOffset=0
          - cancelSeconds=3
          - reorderTimes=3
          - reorderOffset=2
      docker-compose up -d
      # 查看日志
      docker-compose logs -f
      • 1

      追单参数

      {
          "firstOffset"2,
          "cancelSeconds"3,
          "reorderTimes"3,
          "reorderOffset"2
      }
      • 1
      • firstOffset 首次发单偏移

      实际委托价格以委托参数中的 price 加上此参数×最小变动作为偏移量。如示例中价格 4090,cu最小变动(priceTick)为10,实际委托价=price+firstOffsetpriceTick,63460+210=63480

      • cancelSeconds 撤单秒数

      委托后 n 秒内未成交,对委托进行撤单处理。

      • reorderTimes 重发次数

      撤单成功后重新发送委托进行追单,追单次数由此参数控制,达到次数后以板价委托。buy 涨板价,sell 跌板价。

      • reorderOffset 重发偏移

      在重发追单时,以当前行情的对价加上此参数×最小变动的偏移量。

      委托请求格式

      {
          "instrument""cu2210",
          "direction""sell",
          "offset""close",
          "price"63460,
          "volume"1,
          "remark""策略A"
      }
      • 1
      • instrument 合约

      • direction 买卖,取值 buy sell

      • offset 开平,取值 open close

      • price 价格

      • volume 手数

      • remark 备注

      测试

      委托

      curl -i http://localhost:8765/order --header 'Content-Type: application/json' -d '{
          "instrument": "rb2210",
          "direction": "sell",
          "offset": "open",
          "price": 4090,
          "volume": 1,
          "remark": "追单测试"
      }'
      • 1

      修改追单参数

      修改追单参数,实现委托不成交然后追单。

      curl -i http://localhost:8765/config --header 'Content-Type: application/json' -d '{
          "firstOffset": -2,
          "cancelSeconds": 3,
          "reorderTimes": 3,
          "reorderOffset": -2
      }'
      • 1

      firstOffset 与 reorderOffset 改为负值委托价格会反向增加,实现挂单的效果。

    • 相关阅读:
      NetCore配置详解(2)
      【工具使用-VScode】VScode如何设置空格和tab键显示
      【c++】——类和对象(中)——赋值运算符重载
      alb和clb区别
      clip-path图片裁剪
      study
      马术头盔外贸出口美国站CPC认证安全标准
      在 Linux 中,可以使用分号 (;) 或者 && 运算符来执行多条命令
      pytorch --反向传播和优化器
      奥运奖牌查询易语言代码
    • 原文地址:https://blog.csdn.net/along1976/article/details/126571170