Beispiel #1
0
    def test_get_balance(self, access_token, secret_key):
        client = Client(access_token, secret_key)

        balance = client.get_balance()
        self.assertIsInstance(balance.btc.balance, float)
        self.assertIsInstance(balance.krw.balance, float)
        self.assertIsInstance(balance.btg.balance, float)
Beispiel #2
0
    def test_sell(self, access_token, secret_key):
        client = Client(access_token, secret_key)
        order = client.sell(13910000.0, 0.001)

        self.assertEqual(order.result, "success")
        self.assertEqual(order.error_code, 0)
        self.assertIsInstance(order.order_id, str)
Beispiel #3
0
    def test_cancel_order(self, access_token, secret_key):
        client = Client(access_token, secret_key)

        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)
Beispiel #4
0
    def test_sell_with_mock(self, mock_request):
        _ = mock_request

        client = Client("access_token", "secret_key")
        order = client.sell(100000, 0.001)

        self.assertEqual(order.result, "success")
        self.assertEqual(order.error_code, 0)
        self.assertIsInstance(order.order_id, str)
Beispiel #5
0
    def test_get_balance_with_mock(self, mock_request):
        _ = mock_request

        client = Client("access_token", "secret_key")

        balance = client.get_balance()
        self.assertIsInstance(balance.btc.balance, float)
        self.assertIsInstance(balance.krw.balance, float)
        self.assertIsInstance(balance.btg.balance, float)
Beispiel #6
0
    def test_get_user_info(self, access_token, secret_key):
        client = Client(access_token, secret_key)

        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)
Beispiel #7
0
    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)
Beispiel #8
0
    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)
Beispiel #9
0
    def test_cancel_order_with_mock(self, mock_request):
        _ = mock_request

        client = Client("access_token", "secret_key")

        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)
Beispiel #10
0
    def test_get_user_info_with_mock(self, mock_request):
        _ = mock_request

        client = Client("access_token", "secret_key")

        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)
Beispiel #11
0
    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)
Beispiel #12
0
    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)
Beispiel #13
0
    def test_get_complete_orders(self, access_token, secret_key):
        client = Client(access_token, secret_key)

        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)
Beispiel #14
0
    def test_get_complete_orders_with_mock(self, mock_request):
        _ = mock_request

        client = Client("access_token", "secret_key")

        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)
Beispiel #15
0
    def test_client_without_auth(self):
        client = Client()

        self.assertRaises(NoAuthorizationError, client.get_user_info)