From 2178df677cf354a0f0b1165f0fd4e16135986f1c Mon Sep 17 00:00:00 2001 From: Dario Moceri Date: Mon, 29 Mar 2021 15:00:49 +0200 Subject: [PATCH 1/2] Added 'ids' parameter to get_order_history() --- CHANGELOG | 3 +++ bfxapi/rest/bfx_rest.py | 5 ++++- bfxapi/version.py | 2 +- setup.py | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 6ecf9e47..f4a992be 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +1.1.12 +-) Added 'ids' parameter to get_order_history() + 1.1.11 -) Removed pendingOrders from BfxWebsocket() (it was not used anywhere) -) Fixed issue in confirm_order_new() (the keys of the dict pending_orders are the cids of the orders, and not the ids) diff --git a/bfxapi/rest/bfx_rest.py b/bfxapi/rest/bfx_rest.py index d1d656ee..8f8f71a2 100644 --- a/bfxapi/rest/bfx_rest.py +++ b/bfxapi/rest/bfx_rest.py @@ -397,7 +397,7 @@ async def get_active_orders(self, symbol): raw_orders = await self.post(endpoint) return [Order.from_raw_order(ro) for ro in raw_orders] - async def get_order_history(self, symbol, start, end, limit=25, sort=-1): + async def get_order_history(self, symbol, start, end, limit=25, sort=-1, ids=None): """ Get all of the orders between the start and end period associated with API_KEY - Requires authentication. @@ -407,11 +407,14 @@ async def get_order_history(self, symbol, start, end, limit=25, sort=-1): @param start int: millisecond start time @param end int: millisecond end time @param limit int: max number of items in response + @param ids list of int: allows you to retrieve specific orders by order ID (ids: [ID1, ID2, ID3]) @return Array """ endpoint = "auth/r/orders/{}/hist".format(symbol) params = "?start={}&end={}&limit={}&sort={}".format( start, end, limit, sort) + if ids: + params += ",".join(str(id) for id in ids) raw_orders = await self.post(endpoint, params=params) return [Order.from_raw_order(ro) for ro in raw_orders] diff --git a/bfxapi/version.py b/bfxapi/version.py index 210e9722..6c219fb1 100644 --- a/bfxapi/version.py +++ b/bfxapi/version.py @@ -2,4 +2,4 @@ This module contains the current version of the bfxapi lib """ -__version__ = '1.1.11' +__version__ = '1.1.12' diff --git a/setup.py b/setup.py index fe244273..f74a6d2a 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ here = path.abspath(path.dirname(__file__)) setup( name='bitfinex-api-py', - version='1.1.11', + version='1.1.12', description='Official Bitfinex Python API', long_description='A Python reference implementation of the Bitfinex API for both REST and websocket interaction', long_description_content_type='text/markdown', From efca3071268dca81b1156e902c000263cdb813a9 Mon Sep 17 00:00:00 2001 From: Dario Moceri Date: Mon, 29 Mar 2021 16:37:40 +0200 Subject: [PATCH 2/2] fix --- bfxapi/rest/bfx_rest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bfxapi/rest/bfx_rest.py b/bfxapi/rest/bfx_rest.py index 8f8f71a2..d4e23f51 100644 --- a/bfxapi/rest/bfx_rest.py +++ b/bfxapi/rest/bfx_rest.py @@ -414,7 +414,7 @@ async def get_order_history(self, symbol, start, end, limit=25, sort=-1, ids=Non params = "?start={}&end={}&limit={}&sort={}".format( start, end, limit, sort) if ids: - params += ",".join(str(id) for id in ids) + params += "&id=" + ",".join(str(id) for id in ids) raw_orders = await self.post(endpoint, params=params) return [Order.from_raw_order(ro) for ro in raw_orders]