Exemplo n.º 1
0
 def restore_tracking_states(self, saved_states: Dict[str, any]):
     """
     Restore in-flight orders from saved tracking states, this is st the connector can pick up on where it left off
     when it disconnects.
     :param saved_states: The saved tracking_states.
     """
     self._in_flight_orders.update({
         key: WazirxInFlightOrder.from_json(value)
         for key, value in saved_states.items()
     })
Exemplo n.º 2
0
 def start_tracking_order(self, order_id: str, exchange_order_id: str,
                          trading_pair: str, trade_type: TradeType,
                          price: Decimal, amount: Decimal,
                          order_type: OrderType):
     """
     Starts tracking an order by simply adding it into _in_flight_orders dictionary.
     """
     self._in_flight_orders[order_id] = WazirxInFlightOrder(
         client_order_id=order_id,
         exchange_order_id=exchange_order_id,
         trading_pair=trading_pair,
         order_type=order_type,
         trade_type=trade_type,
         price=price,
         amount=amount,
         creation_timestamp=self.current_timestamp)