Ensure start time does not roll back in candles

This commit is contained in:
Gavin.Chan
2018-02-16 14:54:57 +00:00
parent 86757c251d
commit 354d249d8f
+5 -2
View File
@@ -73,10 +73,13 @@ def candles(source, symbol, start_time, end_time, frequency, **kwargs):
data["start_time"].iloc[0] >= last_start_time):
break
start_time = data["end_time"].iloc[-1]
all_data.append(data)
if data["end_time"].iloc[-1] > start_time:
start_time = data["end_time"].iloc[-1]
else:
break
if len(all_data) == 0:
raise ValueError("Start time cannot be after end time.")
elif len(all_data) == 1: