You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 9, 2022. It is now read-only.
I was using your library to load historical transactions from last 2 years, when I noticed that get_account_transactions is getting stuck in a specific case.
In my example:
first run of the loop
from 2019-03-01 to 2019-03-15, returned 47 transactions
algorithm takes startedDate from the oldest transactions and sets it as a new to parameter
second run of the loop
from 2019-03-01 to 2019-03-01 09:29:38, returned 1 transaction - the same transaction which was present in first run
algorithm takes startedDate from the oldest transactions - which is the same as before
I worked around it by manually subtracting 1 second from the timestamp, as below.
def get_account_transactions(self, from_date=None, to_date=None):
"""Get the account transactions."""
raw_transactions = []
params = {}
if to_date:
params['to'] = int(to_date.timestamp()) * 1000
if from_date:
params['from'] = int(from_date.timestamp()) * 1000
while True:
ret = self.client._get(_URL_GET_TRANSACTIONS_LAST, params=params)
ret_transactions = ret.json()
if not ret_transactions:
break
params['to'] = ret_transactions[-1]['startedDate']-1000 # fixed, because this loop was endlessly fetching the same transaction
raw_transactions.extend(ret_transactions)
return AccountTransactions(raw_transactions)
I'm not sure if it is possible to have more than one transaction with the same startedDate, but if yes, then this is not a proper solution.
Did you encounter case like that with your account?
Regards,
The text was updated successfully, but these errors were encountered:
Hi @tducret ,
First of all, thanks for the great library! :-)
I was using your library to load historical transactions from last 2 years, when I noticed that get_account_transactions is getting stuck in a specific case.
In my example:
I worked around it by manually subtracting 1 second from the timestamp, as below.
I'm not sure if it is possible to have more than one transaction with the same startedDate, but if yes, then this is not a proper solution.
Did you encounter case like that with your account?
Regards,
The text was updated successfully, but these errors were encountered: