def test_request(self): impl = WebsocketRequestImpl("") symbols = list() symbols.append("btcusdt") def callback(event): pass request = impl.subscribe_candlestick_event(symbols, CandlestickInterval.MIN1, callback) mock_connection = MockWebsocketConnection(request) request.subscription_handler(mock_connection) subscription = mock_connection.pop_output_message() self.assertTrue(subscription.find("market.btcusdt.kline.1min") != -1)
def test_request(self): impl = WebsocketRequestImpl("") symbols = list() symbols.append("btcusdt") def callback(event): pass request = impl.subscribe_trade_event(symbols, callback) mock_connection = MockWebsocketConnection(request) request.subscription_handler(mock_connection) subscription = mock_connection.pop_output_message() self.assertTrue(subscription.find("market.btcusdt.trade.detail") != -1)
def test_request(self): impl = WebsocketRequestImpl("12345") symbols = list() symbols.append("btcusdt") def callback(event): pass request = impl.subscribe_account_event(BalanceMode.AVAILABLE, callback) mock_connection = MockWebsocketConnection(request) request.subscription_handler(mock_connection) subscription = mock_connection.pop_output_message() self.assertTrue(subscription.find("accounts") != -1)