def __init__(self,
              coinzoom_api_key: str,
              coinzoom_secret_key: str,
              coinzoom_username: str,
              trading_pairs: Optional[List[str]] = None,
              trading_required: bool = True
              ):
     """
     :param coinzoom_api_key: The API key to connect to private CoinZoom APIs.
     :param coinzoom_secret_key: The API secret.
     :param coinzoom_username: The ZoomMe Username.
     :param trading_pairs: The market trading pairs which to track order book data.
     :param trading_required: Whether actual trading is needed.
     """
     super().__init__()
     self._trading_required = trading_required
     self._trading_pairs = trading_pairs
     self._coinzoom_auth = CoinzoomAuth(coinzoom_api_key, coinzoom_secret_key, coinzoom_username)
     self._order_book_tracker = CoinzoomOrderBookTracker(trading_pairs=trading_pairs)
     self._user_stream_tracker = CoinzoomUserStreamTracker(self._coinzoom_auth, trading_pairs)
     self._ev_loop = asyncio.get_event_loop()
     self._shared_client = None
     self._poll_notifier = asyncio.Event()
     self._last_timestamp = 0
     self._in_flight_orders = {}  # Dict[client_order_id:str, CoinzoomInFlightOrder]
     self._order_not_found_records = {}  # Dict[client_order_id:str, count:int]
     self._trading_rules = {}  # Dict[trading_pair:str, TradingRule]
     self._status_polling_task = None
     self._user_stream_event_listener_task = None
     self._trading_rules_polling_task = None
     self._last_poll_timestamp = 0
     self._throttler = Throttler(rate_limit = (8.0, 6))
 def setUpClass(cls):
     cls.ev_loop: asyncio.BaseEventLoop = asyncio.get_event_loop()
     cls.trading_pairs = ["BTC-USD"]
     cls.user_stream_tracker: CoinzoomUserStreamTracker = CoinzoomUserStreamTracker(
         coinzoom_auth=CoinzoomAuth(cls.api_key, cls.api_secret,
                                    cls.api_username),
         trading_pairs=cls.trading_pairs)
     cls.user_stream_tracker_task: asyncio.Task = safe_ensure_future(
         cls.user_stream_tracker.start())
 def __init__(self,
              client_config_map: "ClientConfigAdapter",
              coinzoom_api_key: str,
              coinzoom_secret_key: str,
              coinzoom_username: str,
              trading_pairs: Optional[List[str]] = None,
              trading_required: bool = True):
     """
     :param coinzoom_api_key: The API key to connect to private CoinZoom APIs.
     :param coinzoom_secret_key: The API secret.
     :param coinzoom_username: The ZoomMe Username.
     :param trading_pairs: The market trading pairs which to track order book data.
     :param trading_required: Whether actual trading is needed.
     """
     super().__init__(client_config_map)
     self._trading_required = trading_required
     self._trading_pairs = trading_pairs
     self._throttler = AsyncThrottler(Constants.RATE_LIMITS)
     self._coinzoom_auth = CoinzoomAuth(coinzoom_api_key,
                                        coinzoom_secret_key,
                                        coinzoom_username)
     self._set_order_book_tracker(
         CoinzoomOrderBookTracker(throttler=self._throttler,
                                  trading_pairs=trading_pairs))
     self._user_stream_tracker = CoinzoomUserStreamTracker(
         throttler=self._throttler,
         coinzoom_auth=self._coinzoom_auth,
         trading_pairs=trading_pairs)
     self._ev_loop = asyncio.get_event_loop()
     self._shared_client = None
     self._poll_notifier = asyncio.Event()
     self._last_timestamp = 0
     self._in_flight_orders = {
     }  # Dict[client_order_id:str, CoinzoomInFlightOrder]
     self._order_not_found_records = {
     }  # Dict[client_order_id:str, count:int]
     self._trading_rules = {}  # Dict[trading_pair:str, TradingRule]
     self._status_polling_task = None
     self._user_stream_event_listener_task = None
     self._trading_rules_polling_task = None
     self._last_poll_timestamp = 0
     self._real_time_balance_update = False
     self._update_balances_fetching = False
     self._update_balances_queued = False
     self._update_balances_finished = asyncio.Event()