[Mod] reduce duplicate code line

This commit is contained in:
vn.py 2019-06-30 17:17:46 +08:00 committed by GitHub
parent 85c72c51bd
commit 20a7648622
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -229,20 +229,22 @@ class BacktestingEngine:
progress = 0 progress = 0
while start < self.end: while start < self.end:
end = min(end, self.end) # Make sure end time stays within set range
if self.mode == BacktestingMode.BAR: if self.mode == BacktestingMode.BAR:
data = load_bar_data( data = load_bar_data(
self.symbol, self.symbol,
self.exchange, self.exchange,
self.interval, self.interval,
start, start,
min(end, self.end) end
) )
else: else:
data = load_tick_data( data = load_tick_data(
self.symbol, self.symbol,
self.exchange, self.exchange,
start, start,
min(end, self.end) end
) )
self.history_data.extend(data) self.history_data.extend(data)