Esempio n. 1
0
 def _push_order_callback(self, order: OrderData, is_traded: bool):
     """
     推送order回策略层,
     如果已经成交, 那么找到成交单数据并推送回去,
     如果没有成交 ,那么将order的状态推荐为正在提交中
     :param order_data: 报单
     :param is_traded: 是否成交
     :return:
     """
     if is_traded:
         """ 如果成交了那么同时推送"""
         trade = self.traded_order_mapping[order.order_id]
         order.status = Status.ALLTRADED
         self._push_order()
         self._push_trade(trade)
     else:
         order.status = Status.SUBMITTING
         self.order_id_pending_mapping[order.order_id] = order
         self._push_order(order)
         self.pending.appendleft(order)
Esempio n. 2
0
 def _auth_order_price(self, order: OrderData):
     """
     检查报单价格是否超过涨跌停
     :param order: 报单
     :return:
     """
     if order.price > self.current_tick.limit_up or order.price < self.current_tick.limit_down:
         self.log("价格超过涨跌停, 拒单")
         order.status = Status.REJECTED
         self._push_order(order)
         return False
     return True