Esempio n. 1
0
 def on_bar(self, bar: BarData) -> None:
     """ 处理ctpbee生成的bar """
     # 构建发单请求
     req = helper.generate_order_req_by_var(symbol=bar.symbol, exchange=bar.exchange, price=bar.high_price,
                                            direction=Direction.LONG, type=OrderType.LIMIT, volume=3,
                                            offset=Offset.OPEN)
     # 调用绑定的app进行发单
     id = self.app.send_order(req)
     print("返回id", id)
Esempio n. 2
0
    def on_bar(self, bar):
        """bar process function"""

        # self.app.recorder.get_all_positions()
        #
        # interval = bar.interval
        #
        req = helper.generate_order_req_by_var(symbol=bar.symbol,
                                               exchange=bar.exchange,
                                               price=bar.high_price,
                                               direction=Direction.LONG,
                                               type=OrderType.LIMIT,
                                               volume=3,
                                               offset=Offset.OPEN)
        # # 调用绑定的app进行发单
        id = self.app.send_order(req)