Fixing bug in backtesting causing to much sells

This commit is contained in:
Jean-Baptiste LE STANG 2018-01-31 07:59:45 +01:00
parent 529e4d0131
commit 07b7828f39

View File

@ -84,7 +84,9 @@ def get_sell_trade_entry(pair, row, buy_subset, ticker, trade_count_lock, args):
# Increase trade_count_lock for every iteration
trade_count_lock[row2.date] = trade_count_lock.get(row2.date, 0) + 1
buy_signal = buy_subset[buy_subset.date == row2.date].empty
# Buy is on is in the buy_subset there is a row that matches the date
# of the sell event
buy_signal = not buy_subset[buy_subset.date == row2.date].empty
if(should_sell(trade, row2.close, row2.date, buy_signal, row2.sell)):
return row2, (pair,
trade.calc_profit_percent(rate=row2.close),