Fixing bug in backtesting causing to much sells
This commit is contained in:
parent
529e4d0131
commit
07b7828f39
@ -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),
|
||||
|
Loading…
Reference in New Issue
Block a user