Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get_open_orders: allow to get all orders for all markets #101

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions bittrex/bittrex.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand Down
15 changes: 10 additions & 5 deletions bittrex/test/bittrex_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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()
Expand Down