Reduce diff by avoiding unnecessary changes

This commit is contained in:
Matthias 2022-09-08 07:01:37 +02:00
parent a50923f796
commit 045c3f0f3a
3 changed files with 9 additions and 28 deletions

View File

@ -14,7 +14,7 @@ import pandas
import rapidjson import rapidjson
from freqtrade.constants import DECIMAL_PER_COIN_FALLBACK, DECIMALS_PER_COIN from freqtrade.constants import DECIMAL_PER_COIN_FALLBACK, DECIMALS_PER_COIN
from freqtrade.enums.signaltype import SignalTagType, SignalType from freqtrade.enums import SignalTagType, SignalType
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View File

@ -698,11 +698,7 @@ class IStrategy(ABC, HyperStrategyMixin):
lock_time = timeframe_to_next_date(self.timeframe, candle_date) lock_time = timeframe_to_next_date(self.timeframe, candle_date)
return PairLocks.is_pair_locked(pair, lock_time, side=side) return PairLocks.is_pair_locked(pair, lock_time, side=side)
def analyze_ticker( def analyze_ticker(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
self,
dataframe: DataFrame,
metadata: dict
) -> DataFrame:
""" """
Parses the given candle (OHLCV) data and returns a populated DataFrame Parses the given candle (OHLCV) data and returns a populated DataFrame
add several TA indicators and entry order signal to it add several TA indicators and entry order signal to it
@ -716,11 +712,7 @@ class IStrategy(ABC, HyperStrategyMixin):
dataframe = self.advise_exit(dataframe, metadata) dataframe = self.advise_exit(dataframe, metadata)
return dataframe return dataframe
def _analyze_ticker_internal( def _analyze_ticker_internal(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
self,
dataframe: DataFrame,
metadata: dict
) -> DataFrame:
""" """
Parses the given candle (OHLCV) data and returns a populated DataFrame Parses the given candle (OHLCV) data and returns a populated DataFrame
add several TA indicators and buy signal to it add several TA indicators and buy signal to it
@ -753,20 +745,16 @@ class IStrategy(ABC, HyperStrategyMixin):
return dataframe return dataframe
def analyze_pair( def analyze_pair(self, pair: str) -> None:
self,
pair: str
) -> None:
""" """
Fetch data for this pair from dataprovider and analyze. Fetch data for this pair from dataprovider and analyze.
Stores the dataframe into the dataprovider. Stores the dataframe into the dataprovider.
The analyzed dataframe is then accessible via `dp.get_analyzed_dataframe()`. The analyzed dataframe is then accessible via `dp.get_analyzed_dataframe()`.
:param pair: Pair to analyze. :param pair: Pair to analyze.
""" """
candle_type = self.config.get('candle_type_def', CandleType.SPOT) dataframe = self.dp.ohlcv(
pair, self.timeframe, candle_type=self.config.get('candle_type_def', CandleType.SPOT)
dataframe = self.dp.ohlcv(pair, self.timeframe, candle_type) )
if not isinstance(dataframe, DataFrame) or dataframe.empty: if not isinstance(dataframe, DataFrame) or dataframe.empty:
logger.warning('Empty candle (OHLCV) data for pair %s', pair) logger.warning('Empty candle (OHLCV) data for pair %s', pair)
return return
@ -787,10 +775,7 @@ class IStrategy(ABC, HyperStrategyMixin):
logger.warning('Empty dataframe for pair %s', pair) logger.warning('Empty dataframe for pair %s', pair)
return return
def analyze( def analyze(self, pairs: List[str]) -> None:
self,
pairs: List[str]
) -> None:
""" """
Analyze all pairs using analyze_pair(). Analyze all pairs using analyze_pair().
:param pairs: List of pairs to analyze :param pairs: List of pairs to analyze
@ -1219,9 +1204,6 @@ class IStrategy(ABC, HyperStrategyMixin):
dataframe = _create_and_merge_informative_pair( dataframe = _create_and_merge_informative_pair(
self, dataframe, metadata, inf_data, populate_fn) self, dataframe, metadata, inf_data, populate_fn)
# If in follower mode, get analyzed dataframe from leader df's in dp
# otherise run populate_indicators
return self.populate_indicators(dataframe, metadata) return self.populate_indicators(dataframe, metadata)
def advise_entry(self, dataframe: DataFrame, metadata: dict) -> DataFrame: def advise_entry(self, dataframe: DataFrame, metadata: dict) -> DataFrame:

View File

@ -406,7 +406,6 @@ def test_api_cleanup(default_conf, mocker, caplog):
apiserver = ApiServer(default_conf) apiserver = ApiServer(default_conf)
apiserver.add_rpc_handler(RPC(get_patched_freqtradebot(mocker, default_conf))) apiserver.add_rpc_handler(RPC(get_patched_freqtradebot(mocker, default_conf)))
apiserver.start_api()
apiserver.cleanup() apiserver.cleanup()
assert apiserver._server.cleanup.call_count == 1 assert apiserver._server.cleanup.call_count == 1