Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
sammchardy committed Jan 27, 2018
2 parents 79c9b9c + e7c121c commit dc44f28
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions bigone/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,16 @@ def _create_uri(self, path):

def _request(self, method, path, signed, **kwargs):

kwargs['json'] = kwargs.get('data', {})
data = kwargs.get('data', None)

uri = self._create_uri(path)

if kwargs['json'] and method == 'get':
kwargs['params'] = kwargs['json']
del(kwargs['json'])
if method == 'get' and data:
kwargs['params'] = kwargs['data']
del(kwargs['data'])

if 'data' in kwargs:
if method == 'post' and data:
kwargs['json'] = kwargs['data']
del(kwargs['data'])

response = getattr(self.session, method)(uri, **kwargs)
Expand Down Expand Up @@ -552,12 +553,18 @@ def cancel_order(self, order_id):

return self._delete('orders/{}'.format(order_id), True)

def cancel_all_orders(self):
def cancel_orders(self, order_ids):
"""Cancel all orders
:param order_ids: List of order ids
:type order_ids: list
.. code:: python
res = client.call_all_orders()
res = client.cancel_orders([
"f1d90216-0be5-4258-99a9-6d354815608e",
"57ae31c2-bcb1-4744-a2aa-6a3f72430699"
])
:return: dict
Expand All @@ -569,7 +576,11 @@ def cancel_all_orders(self):
"""

return self._post('orders/cancel', True)
data = [
{'order_id': oid} for oid in order_ids
]

return self._post('orders/cancel', True, data=data)

# Trade endpoints

Expand Down

0 comments on commit dc44f28

Please sign in to comment.