Imrpove code by reusing available properties
This commit is contained in:
@@ -474,8 +474,7 @@ class FreqtradeBot(LoggingMixin):
|
||||
Once that completes, the existing trade is modified to match new data.
|
||||
"""
|
||||
if self.strategy.max_buy_position_adjustment > -1:
|
||||
filled_buys = trade.select_filled_orders('buy')
|
||||
count_of_buys = len(filled_buys)
|
||||
count_of_buys = trade.nr_of_successful_buys
|
||||
if count_of_buys > self.strategy.max_buy_position_adjustment:
|
||||
logger.debug(f"Max adjustment buy for {trade.pair} has been reached.")
|
||||
return
|
||||
|
@@ -383,8 +383,7 @@ class Backtesting:
|
||||
if self.strategy.position_adjustment_enable:
|
||||
check_adjust_buy = True
|
||||
if self.strategy.max_buy_position_adjustment > -1:
|
||||
filled_buys = trade.select_filled_orders('buy')
|
||||
count_of_buys = len(filled_buys)
|
||||
count_of_buys = trade.nr_of_successful_buys
|
||||
check_adjust_buy = (count_of_buys <= self.strategy.max_buy_position_adjustment)
|
||||
if check_adjust_buy:
|
||||
trade = self._get_adjust_trade_entry_for_candle(trade, sell_row)
|
||||
|
@@ -98,7 +98,7 @@ class StrategyResolver(IResolver):
|
||||
("disable_dataframe_checks", False),
|
||||
("ignore_buying_expired_candle_after", 0),
|
||||
("position_adjustment_enable", False),
|
||||
("max_buy_position_adjustment", -1)
|
||||
("max_buy_position_adjustment", -1),
|
||||
]
|
||||
for attribute, default in attributes:
|
||||
StrategyResolver._override_attribute_helper(strategy, config,
|
||||
|
@@ -252,8 +252,8 @@ class RPC:
|
||||
]
|
||||
if self._config.get('position_adjustment_enable', False):
|
||||
max_buy = self._config['max_buy_position_adjustment'] + 1
|
||||
filled_buys = trade.select_filled_orders('buy')
|
||||
detail_trade.append(f"{len(filled_buys)}/{max_buy}")
|
||||
filled_buys = trade.nr_of_successful_buys
|
||||
detail_trade.append(f"{filled_buys}/{max_buy}")
|
||||
trades_list.append(detail_trade)
|
||||
profitcol = "Profit"
|
||||
if self._fiat_converter:
|
||||
|
Reference in New Issue
Block a user