Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CTP中午休市账户断线重连之后系统报错 #20

Closed
handsomu opened this issue May 2, 2017 · 6 comments
Closed

CTP中午休市账户断线重连之后系统报错 #20

handsomu opened this issue May 2, 2017 · 6 comments
Assignees
Labels

Comments

@handsomu
Copy link
Contributor

handsomu commented May 2, 2017

image

初步怀疑是策略引擎一直在运行,CTP在中午休市时断线重连之后获取到当日所有trade,重复触发position计算逻辑。

@wh1100717
Copy link
Member

@handsomu @Cuizi7 broker 在初始化的 account 的时候 已经初始化了对应的 backward_trade_set 触发trade event 的时候 应该判断一下 trade_id 是否在backward_trade_set 中 如果在的话 就不再触发该event。 不过这么来说,order怎么处理.... 😂😂😂

@Cuizi7
Copy link
Collaborator

Cuizi7 commented May 2, 2017

这块的 order 打算这么处理:

  • 维护一个订单对象的缓存
  • 发单的时候将订单对象缓存在上述缓存中
  • 收到订单回报的时候:
    • 若缓存中无该订单对象则创建并缓存之,若存在则读取之
    • 若订单对象的 order_status 为 pending_new (即首次收到该订单的回报)则发布 ORDER_PENDING_NEW 事件
    • 若订单回报中的 order_status 为订单对象的前置状态,则忽略该回报
    • 若订单回报中的 order_status 为订单对象的后置状态,则修改订单状态并发布对应事件

@Cuizi7
Copy link
Collaborator

Cuizi7 commented May 2, 2017

已尝试修复,明天交易时间我继续测试。

@hzliu
Copy link

hzliu commented May 13, 2017 via email

@Cuizi7
Copy link
Collaborator

Cuizi7 commented May 13, 2017

@hzliu 现在在初始化阶段和账户短线重连的时候都是用的我自己写的类似 fast_forward 的逻辑,因为最早写这段逻辑的时候 rqalpha 还没有现在的 fast_forward,纯属历史原因。

@Cuizi7
Copy link
Collaborator

Cuizi7 commented May 22, 2017

master 分支已修复。

@Cuizi7 Cuizi7 closed this as completed May 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants