rename ta_on_candle to process_only_new_candles
be more expressive
This commit is contained in:
@@ -71,7 +71,7 @@ class IStrategy(ABC):
|
||||
ticker_interval: str
|
||||
|
||||
# run "populate_indicators" only for new candle
|
||||
ta_on_candle: bool = False
|
||||
process_only_new_candles: bool = False
|
||||
|
||||
# Dict to determine if analysis is necessary
|
||||
_last_candle_seen_per_pair: Dict[str, datetime] = {}
|
||||
@@ -124,8 +124,8 @@ class IStrategy(ABC):
|
||||
|
||||
pair = str(metadata.get('pair'))
|
||||
|
||||
# always run if ta_on_candle is set to true
|
||||
if (not self.ta_on_candle or
|
||||
# always run if process_only_new_candles is set to true
|
||||
if (not self.process_only_new_candles or
|
||||
self._last_candle_seen_per_pair.get(pair, None) != dataframe.iloc[-1]['date']):
|
||||
# Defs that only make change on new candle data.
|
||||
logging.debug("TA Analysis Launched")
|
||||
|
@@ -65,14 +65,14 @@ class StrategyResolver(object):
|
||||
else:
|
||||
config['ticker_interval'] = self.strategy.ticker_interval
|
||||
|
||||
if 'ta_on_candle' in config:
|
||||
self.strategy.ta_on_candle = config['ta_on_candle']
|
||||
if 'process_only_new_candles' in config:
|
||||
self.strategy.process_only_new_candles = config['process_only_new_candles']
|
||||
logger.info(
|
||||
"Override ta_on_candle 'ta_on_candle' with value in config file: %s.",
|
||||
config['ta_on_candle']
|
||||
"Override process_only_new_candles 'process_only_new_candles' "
|
||||
"with value in config file: %s.", config['process_only_new_candles']
|
||||
)
|
||||
else:
|
||||
config['ta_on_candle'] = self.strategy.ta_on_candle
|
||||
config['process_only_new_candles'] = self.strategy.process_only_new_candles
|
||||
|
||||
# Sort and apply type conversions
|
||||
self.strategy.minimal_roi = OrderedDict(sorted(
|
||||
|
Reference in New Issue
Block a user