Added 'ids' parameter to get_order_history() (#121)

* Added 'ids' parameter to get_order_history()
* fix

Co-authored-by: Robert Kowalski <robert@bitfinex.com>
This commit is contained in:
Dario Moceri
2021-05-25 11:33:08 +02:00
committed by GitHub
parent a58c772e4b
commit 4a8d3e48b0
3 changed files with 6 additions and 2 deletions

View File

@@ -1,4 +1,5 @@
1.1.15 1.1.15
-) Added 'ids' parameter to get_order_history()
-) Added an example to show how it is possible to spawn multiple bfx ws instances to comply with the open subscriptions number constraint (max. 25) -) Added an example to show how it is possible to spawn multiple bfx ws instances to comply with the open subscriptions number constraint (max. 25)
-) Implemented Funding Trades (rest) -) Implemented Funding Trades (rest)

View File

@@ -397,7 +397,7 @@ class BfxRest:
raw_orders = await self.post(endpoint) raw_orders = await self.post(endpoint)
return [Order.from_raw_order(ro) for ro in raw_orders] 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 Get all of the orders between the start and end period associated with API_KEY
- Requires authentication. - Requires authentication.
@@ -407,11 +407,14 @@ class BfxRest:
@param start int: millisecond start time @param start int: millisecond start time
@param end int: millisecond end time @param end int: millisecond end time
@param limit int: max number of items in response @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 <models.Order> @return Array <models.Order>
""" """
endpoint = "auth/r/orders/{}/hist".format(symbol) endpoint = "auth/r/orders/{}/hist".format(symbol)
params = "?start={}&end={}&limit={}&sort={}".format( params = "?start={}&end={}&limit={}&sort={}".format(
start, end, limit, sort) start, end, limit, sort)
if ids:
params += "&id=" + ",".join(str(id) for id in ids)
raw_orders = await self.post(endpoint, params=params) raw_orders = await self.post(endpoint, params=params)
return [Order.from_raw_order(ro) for ro in raw_orders] return [Order.from_raw_order(ro) for ro in raw_orders]

View File

@@ -11,7 +11,7 @@ from os import path
here = path.abspath(path.dirname(__file__)) here = path.abspath(path.dirname(__file__))
setup( setup(
name='bitfinex-api-py', name='bitfinex-api-py',
version='1.1.14', version='1.1.15',
description='Official Bitfinex Python API', description='Official Bitfinex Python API',
long_description='A Python reference implementation of the Bitfinex API for both REST and websocket interaction', long_description='A Python reference implementation of the Bitfinex API for both REST and websocket interaction',
long_description_content_type='text/markdown', long_description_content_type='text/markdown',