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

对期货平仓指令进行拓展 #116

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

对期货平仓指令进行拓展 #116

handsomu opened this issue May 3, 2017 · 2 comments
Assignees

Comments

@handsomu
Copy link
Contributor

handsomu commented May 3, 2017

  1. POSITION_EFFECT ENUM加入CLOSE_TODAY选项。
  2. buy_close, sell_close加入position_effect参数。默认为None,此时的平仓操作针对上期所情况按照先进先出原则,先平昨仓,后平今仓。(所以可能会发出多笔订单)设置为'close'代表平昨仓;'close_today'代表平今仓。其他值无效。
  3. 将现有发单函数 LimitOrder(10)这种创建限价单的方式进行拓展,只要用户在发单中指定了价格,自动按照限价单处理。
  4. 引入order(order_book_id, quantity, price) API,对于期货来说,quantity为+1代表buy_close 1张或 buy_open一张。按照先平仓,后开仓的顺序进行订单创建。对于股票来说,等同于order_shares,按照股数进行订单创建。
@wh1100717
Copy link
Member

wh1100717 commented May 8, 2017

  • POSITION_EFFECT ENUM 增加 CLOSE_TODAY Option

  • ✅ 引入调仓函数 order(order_book_id, quantity, price=None) API

    • 如果不传入 price 则认为执行的是 MarketOrder 类型订单,否则下 LimitOrder 订单

    • 期货

      • quantity > 0: 往 BUY 方向调仓 quantity 手
      • quantity < 0: 往 SELL 方向调仓 quantity 手
    • 股票

      • 相当于 order_shares 函数
  • ✅ 引入调仓函数 order_to(order_book_id, quantity, price=None) API

    • 基本逻辑和 order 函数一致。
    • 区别在于 quantity 表示调仓对应的最终仓位
  • ✅ 现有所有下单函数,增加 price option,具体行为和 order | order_to 一致

  • ✅ 平仓根据昨仓和今仓自动分成多个 Order, 对应返回的是 List[Order]

wh1100717 added a commit that referenced this issue May 8, 2017
@wh1100717
Copy link
Member

@handsomu 这个已经全部实现了 develop 分支可测试。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants