Remove one branch - python does lazy evaluation
This commit is contained in:
parent
b2c2b42408
commit
0307ba7883
@ -337,7 +337,6 @@ class Backtesting(object):
|
|||||||
|
|
||||||
# Loop timerange and test per pair
|
# Loop timerange and test per pair
|
||||||
while tmp < end_date:
|
while tmp < end_date:
|
||||||
# print(f"time: {tmp}")
|
|
||||||
|
|
||||||
for i, pair in enumerate(ticker):
|
for i, pair in enumerate(ticker):
|
||||||
if pair not in indexes:
|
if pair not in indexes:
|
||||||
@ -358,9 +357,9 @@ class Backtesting(object):
|
|||||||
if row.buy == 0 or row.sell == 1:
|
if row.buy == 0 or row.sell == 1:
|
||||||
continue # skip rows where no buy signal or that would immediately sell off
|
continue # skip rows where no buy signal or that would immediately sell off
|
||||||
|
|
||||||
if not position_stacking:
|
if (not position_stacking and pair in lock_pair_until
|
||||||
if pair in lock_pair_until and row.date <= lock_pair_until[pair]:
|
and row.date <= lock_pair_until[pair]):
|
||||||
continue
|
continue
|
||||||
if max_open_trades > 0:
|
if max_open_trades > 0:
|
||||||
# Check if max_open_trades has already been reached for the given date
|
# Check if max_open_trades has already been reached for the given date
|
||||||
if not trade_count_lock.get(row.date, 0) < max_open_trades:
|
if not trade_count_lock.get(row.date, 0) < max_open_trades:
|
||||||
|
Loading…
Reference in New Issue
Block a user