def test_sell(self, access_token): client = Client(access_token) order = client.sell(13000000, 0.001) self.assertEqual(order.result, "success") self.assertEqual(order.error_code, 0) self.assertIsInstance(order.order_id, str)
def test_get_balance(self, access_token): client = Client(access_token) balance = client.get_balance() self.assertIsInstance(balance.btc.balance, float) self.assertIsInstance(balance.krw.balance, float) self.assertIsInstance(balance.btg.balance, float)
def test_cancel_order(self, access_token): client = Client(access_token) orders = client.get_pending_orders() for order in orders: res = client.cancel_order(order) self.assertEqual(res.result, "success") self.assertEqual(res.error_code, 0)
def test_get_user_info(self, access_token): client = Client(access_token) user_info = client.get_user_info() self.assertIsInstance(user_info.mobileInfo["userName"], str) self.assertIsInstance(user_info.mobileInfo["phoneNumber"], str) self.assertIsInstance(user_info.bankInfo["depositor"], str) self.assertIsInstance(user_info.bankInfo["accountNumber"], str) self.assertIsInstance(user_info.emailInfo["email"], str)
def test_sell_with_mock(self, mock_request): _ = mock_request client = Client("access_token") order = client.sell(13000000, 0.001) self.assertEqual(order.result, "success") self.assertEqual(order.error_code, 0) self.assertIsInstance(order.order_id, str)
def test_get_balance_with_mock(self, mock_request): _ = mock_request client = Client("access_token") balance = client.get_balance() self.assertIsInstance(balance.btc.balance, float) self.assertIsInstance(balance.krw.balance, float) self.assertIsInstance(balance.btg.balance, float)
def test_get_orders(self): client = Client() orders = client.get_orders() for ask in orders.asks: self.assertIsInstance(ask.price, float) self.assertIsInstance(ask.quantity, float) for bid in orders.bids: self.assertIsInstance(bid.price, float) self.assertIsInstance(bid.quantity, float)
def test_get_trades(self): client = Client() trades = client.get_trades() for trade in trades: self.assertIsInstance(trade.id, int) self.assertIsInstance(trade.type, str) self.assertIsInstance(trade.timestamp, int) self.assertIsInstance(trade.price, float) self.assertIsInstance(trade.quantity, float)
def test_cancel_order_with_mock(self, mock_request): _ = mock_request client = Client("access_token") orders = client.get_pending_orders() for order in orders: res = client.cancel_order(order) self.assertEqual(res.result, "success") self.assertEqual(res.error_code, 0)
def test_get_user_info_with_mock(self, mock_request): _ = mock_request client = Client("access_token") user_info = client.get_user_info() self.assertIsInstance(user_info.mobileInfo["userName"], str) self.assertIsInstance(user_info.mobileInfo["phoneNumber"], str) self.assertIsInstance(user_info.bankInfo["depositor"], str) self.assertIsInstance(user_info.bankInfo["accountNumber"], str) self.assertIsInstance(user_info.emailInfo["email"], str)
def test_get_orders_with_mock(self, mock_request): _ = mock_request client = Client() orders = client.get_orders() for ask in orders.asks: self.assertIsInstance(ask.price, float) self.assertIsInstance(ask.quantity, float) for bid in orders.bids: self.assertIsInstance(bid.price, float) self.assertIsInstance(bid.quantity, float)
def test_get_trades_with_mock(self, mock_request): _ = mock_request client = Client() trades = client.get_trades() for trade in trades: self.assertIsInstance(trade.id, int) self.assertIsInstance(trade.type, str) self.assertIsInstance(trade.timestamp, int) self.assertIsInstance(trade.price, float) self.assertIsInstance(trade.quantity, float)
def test_get_complete_orders(self, access_token): client = Client(access_token) orders = client.get_complete_orders() for order in orders: self.assertIsInstance(order.order_id, str) self.assertIsInstance(order.timestamp, int) self.assertIsInstance(order.type, str) self.assertIsInstance(order.price, float) self.assertIsInstance(order.quantity, float) self.assertIsInstance(order.fee_rate, float) self.assertIsInstance(order.fee, float)
def test_get_complete_orders_with_mock(self, mock_request): _ = mock_request client = Client("access_token") orders = client.get_complete_orders() for order in orders: self.assertIsInstance(order.order_id, str) self.assertIsInstance(order.timestamp, int) self.assertIsInstance(order.type, str) self.assertIsInstance(order.price, float) self.assertIsInstance(order.quantity, float) self.assertIsInstance(order.fee_rate, float) self.assertIsInstance(order.fee, float)