fixed exchanges showing data from the future (not the kind that makes you rich 😂)

This commit is contained in:
Peter Willemsen 2022-02-01 23:01:54 +01:00
parent 5aa683006c
commit ac50efbe9e
No known key found for this signature in database
GPG Key ID: 5C9DD4BFB96A28F0

View File

@ -1290,6 +1290,10 @@ class Exchange:
p, _, new_data = res
if p == pair:
data.extend(new_data)
# Some exchanges show data past the current time and set all values to null.
current_time = arrow.utcnow().int_timestamp * 1000
data = filter(lambda item: item[0] < current_time, data)
# Sort data again after extending the result - above calls return in "async order"
data = sorted(data, key=lambda x: x[0])
return pair, timeframe, data