Add "open_at_end" parameter
This commit is contained in:
parent
31025216f9
commit
b81588307f
@ -34,6 +34,7 @@ class BacktestResult(NamedTuple):
|
|||||||
open_time: datetime
|
open_time: datetime
|
||||||
close_time: datetime
|
close_time: datetime
|
||||||
trade_duration: float
|
trade_duration: float
|
||||||
|
open_at_end: bool
|
||||||
|
|
||||||
|
|
||||||
class Backtesting(object):
|
class Backtesting(object):
|
||||||
@ -140,7 +141,8 @@ class Backtesting(object):
|
|||||||
profit_abs=trade.calc_profit(rate=sell_row.close),
|
profit_abs=trade.calc_profit(rate=sell_row.close),
|
||||||
open_time=buy_row.date,
|
open_time=buy_row.date,
|
||||||
close_time=sell_row.date,
|
close_time=sell_row.date,
|
||||||
trade_duration=(sell_row.date - buy_row.date).seconds // 60
|
trade_duration=(sell_row.date - buy_row.date).seconds // 60,
|
||||||
|
open_at_end=False
|
||||||
)
|
)
|
||||||
if partial_ticker:
|
if partial_ticker:
|
||||||
# no sell condition found - trade stil open at end of backtest period
|
# no sell condition found - trade stil open at end of backtest period
|
||||||
@ -150,7 +152,8 @@ class Backtesting(object):
|
|||||||
profit_abs=trade.calc_profit(rate=sell_row.close),
|
profit_abs=trade.calc_profit(rate=sell_row.close),
|
||||||
open_time=buy_row.date,
|
open_time=buy_row.date,
|
||||||
close_time=sell_row.date,
|
close_time=sell_row.date,
|
||||||
trade_duration=(sell_row.date - buy_row.date).seconds // 60
|
trade_duration=(sell_row.date - buy_row.date).seconds // 60,
|
||||||
|
open_at_end=True
|
||||||
)
|
)
|
||||||
logger.info('Force_selling still open trade %s with %s perc - %s', btr.pair,
|
logger.info('Force_selling still open trade %s with %s perc - %s', btr.pair,
|
||||||
btr.profit_percent, btr.profit_abs)
|
btr.profit_percent, btr.profit_abs)
|
||||||
|
Loading…
Reference in New Issue
Block a user