def setUpClass(cls): cls.ev_loop: asyncio.BaseEventLoop = asyncio.get_event_loop() cls.loopring_auth = LoopringAuth(conf.loopring_api_key) cls.loopring_orderbook_data_source = LoopringAPIOrderBookDataSource( trading_pairs=trading_pairs) cls.user_stream_tracker: LoopringUserStreamTracker = LoopringUserStreamTracker( cls.loopring_orderbook_data_source, cls.loopring_auth)
def __init__( self, trading_pairs: Optional[List[str]] = None, rest_api_url: str = "https://api3.loopring.io", websocket_url: str = "wss://ws.api3.loopring.io/v2/ws", token_configuration: LoopringAPITokenConfigurationDataSource = None, loopring_auth: str = ""): super().__init__( LoopringAPIOrderBookDataSource( trading_pairs=trading_pairs, rest_api_url=rest_api_url, websocket_url=websocket_url, token_configuration=token_configuration, ), trading_pairs) self._order_books: Dict[str, LoopringOrderBook] = {} self._saved_message_queues: Dict[ str, Deque[LoopringOrderBookMessage]] = defaultdict( lambda: deque(maxlen=1000)) self._order_book_snapshot_stream: asyncio.Queue = asyncio.Queue() self._order_book_diff_stream: asyncio.Queue = asyncio.Queue() self._order_book_trade_stream: asyncio.Queue = asyncio.Queue() self._ev_loop: asyncio.BaseEventLoop = asyncio.get_event_loop() self._loopring_auth = LoopringAuth(loopring_auth) self._token_configuration: LoopringAPITokenConfigurationDataSource = token_configuration self.token_configuration self._active_order_trackers: Dict[ str, LoopringActiveOrderTracker] = defaultdict( lambda: LoopringActiveOrderTracker(self._token_configuration))
def setUpClass(cls): cls.ev_loop: asyncio.BaseEventLoop = asyncio.get_event_loop() cls.order_book_data_source: LoopringAPIOrderBookDataSource = LoopringAPIOrderBookDataSource(trading_pairs)