trade_history should paginate through results

this avoids huge results
This commit is contained in:
Matthias
2021-04-18 16:05:28 +02:00
parent b230558294
commit bd92ce938c
5 changed files with 20 additions and 11 deletions

View File

@@ -200,13 +200,19 @@ class FtRestClient():
"""
return self._get("logs", params={"limit": limit} if limit else 0)
def trades(self, limit=None):
"""Return trades history.
def trades(self, limit=None, offset=None):
"""Return trades history, sorted by id
:param limit: Limits trades to the X last trades. No limit to get all the trades.
:param limit: Limits trades to the X last trades. Max 500 trades.
:param offset: Offset by this amount of trades.
:return: json object
"""
return self._get("trades", params={"limit": limit} if limit else 0)
params = {}
if limit:
params['limit'] = limit
if offset:
params['offset'] = offset
return self._get("trades", params)
def trade(self, trade_id):
"""Return specific trade