Use namedtuple for sell_return

This commit is contained in:
Matthias
2018-07-12 22:21:52 +02:00
parent ad98c62329
commit a452864b41
5 changed files with 29 additions and 19 deletions

View File

@@ -164,8 +164,8 @@ class Backtesting(object):
buy_signal = sell_row.buy
sell = self.strategy.should_sell(trade, sell_row.open, sell_row.date, buy_signal,
sell_row.sell)
if sell[0]:
sell_row.sell)
if sell.sell_flag:
return BacktestResult(pair=pair,
profit_percent=trade.calc_profit_percent(rate=sell_row.open),
@@ -178,7 +178,7 @@ class Backtesting(object):
open_at_end=False,
open_rate=buy_row.open,
close_rate=sell_row.open,
sell_reason=sell[1]
sell_reason=sell.sell_type
)
if partial_ticker:
# no sell condition found - trade stil open at end of backtest period