vn.py量化社区
By Traders, For Traders.
Member
avatar
加入于:
帖子: 2
声望: 0
  在阅读代码的时候,发现app/cta_strategy/template下面关于有两个地方注释和代码好像不一致,有哪位大神帮忙解答一下
  1. 注释好像要下平多单,但是实际代码是平空单(根据方法名称,平多单好像更合理)

      def sell(self, price: float, volume: float, stop: bool = False, lock: bool = False):
         """
         Send sell order to close a long position.
         """
         return self.send_order(Direction.SHORT, Offset.CLOSE, price, volume, stop, lock)
  2. 注释好像要下平空单,但是实际代码是平多单(根据方法名称,平空单好像更合理)

    def cover(self, price: float, volume: float, stop: bool = False, lock: bool = False):
     """
     Send cover order to close a short position.
     """
     return self.send_order(Direction.LONG, Offset.CLOSE, price, volume, stop, lock)
Administrator
avatar
加入于:
帖子: 4655
声望: 266

CTP买入开仓:long open,对应CTA的buy
CTP卖出平仓:short close,对应CTA的sell
CTP卖出开仓:short open,对应CTA的short
CTP买入平仓:long close,对应CTA的cover

Member
avatar
加入于:
帖子: 2
声望: 0

用Python的交易员 wrote:

CTP买入开仓:long open,对应CTA的buy
CTP卖出平仓:short close,对应CTA的sell
CTP卖出开仓:short open,对应CTA的short
CTP买入平仓:long close,对应CTA的cover
好的,谢谢

© 2015-2019 上海韦纳软件科技有限公司
备案服务号:沪ICP备18006526号-3

沪公网安备 31011502017034号