diff --git a/bittrex/bittrex.py b/bittrex/bittrex.py index d16aa6e..3c44ced 100644 --- a/bittrex/bittrex.py +++ b/bittrex/bittrex.py @@ -398,17 +398,22 @@ def get_open_orders(self, market=None): Endpoint: 1.1 /market/getopenorders - 2.0 /key/market/getopenorders + 2.0 /key/market/getopenorders or /key/orders/getopenorders :param market: String literal for the market (ie. BTC-LTC) :type market: str :return: Open orders info in JSON :rtype : dict """ - return self._api_query(path_dict={ - API_V1_1: '/market/getopenorders', - API_V2_0: '/key/market/getopenorders' - }, options={'market': market, 'marketname': market} if market else None, protection=PROTECTION_PRV) + if market: + return self._api_query(path_dict={ + API_V1_1: '/market/getopenorders', + API_V2_0: '/key/market/getopenorders' + }, options={'market': market, 'marketname': market}, protection=PROTECTION_PRV) + else: + return self._api_query(path_dict={ + API_V2_0: '/key/orders/getopenorders' + }, protection=PROTECTION_PRV) def get_balances(self): """ diff --git a/bittrex/test/bittrex_tests.py b/bittrex/test/bittrex_tests.py index 48dd359..d0add91 100644 --- a/bittrex/test/bittrex_tests.py +++ b/bittrex/test/bittrex_tests.py @@ -206,9 +206,9 @@ def test_handles_invalid_key_or_secret(self): actual = self.bittrex.get_balance('BTC') test_auth_basic_failures(self, actual, 'invalid key, invalid secret') - def test_get_openorders(self): + def test_get_open_orders(self): actual = self.bittrex.get_open_orders('BTC-LTC') - test_basic_response(self, actual, "get_openorders") + test_basic_response(self, actual, "get_open_orders") self.assertTrue(isinstance(actual['result'], list), "result is not a list") def test_get_balances(self): @@ -313,10 +313,15 @@ def test_handles_invalid_key_or_secret(self): actual = self.bittrex.get_balance('BTC') test_auth_basic_failures(self, actual, 'invalid key, invalid secret') - def test_get_openorders(self): + def test_get_open_orders(self): actual = self.bittrex.get_open_orders('BTC-LTC') - test_basic_response(self, actual, "get_openorders") - self.assertTrue(isinstance(actual['result'], list), "result is not a list") + test_basic_response(self, actual, "get_open_orders") + self.assertIsInstance(actual['result'], list) + + def test_get_open_orders_empty_arg(self): + actual = self.bittrex.get_open_orders() + test_basic_response(self, actual, "get_open_orders") + self.assertIsInstance(actual['result'], list) def test_get_balances(self): actual = self.bittrex.get_balances()