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
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__)

View File

@ -698,11 +698,7 @@ class IStrategy(ABC, HyperStrategyMixin):
lock_time = timeframe_to_next_date(self.timeframe, candle_date)
return PairLocks.is_pair_locked(pair, lock_time, side=side)
def analyze_ticker(
self,
dataframe: DataFrame,
metadata: dict
) -> DataFrame:
def analyze_ticker(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
"""
Parses the given candle (OHLCV) data and returns a populated DataFrame
add several TA indicators and entry order signal to it
@ -716,11 +712,7 @@ class IStrategy(ABC, HyperStrategyMixin):
dataframe = self.advise_exit(dataframe, metadata)
return dataframe
def _analyze_ticker_internal(
self,
dataframe: DataFrame,
metadata: dict
) -> DataFrame:
def _analyze_ticker_internal(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
"""
Parses the given candle (OHLCV) data and returns a populated DataFrame
add several TA indicators and buy signal to it
@ -753,20 +745,16 @@ class IStrategy(ABC, HyperStrategyMixin):
return dataframe
def analyze_pair(
self,
pair: str
) -> None:
def analyze_pair(self, pair: str) -> None:
"""
Fetch data for this pair from dataprovider and analyze.
Stores the dataframe into the dataprovider.
The analyzed dataframe is then accessible via `dp.get_analyzed_dataframe()`.
:param pair: Pair to analyze.
"""
candle_type = self.config.get('candle_type_def', CandleType.SPOT)
dataframe = self.dp.ohlcv(pair, self.timeframe, candle_type)
dataframe = self.dp.ohlcv(
pair, self.timeframe, candle_type=self.config.get('candle_type_def', CandleType.SPOT)
)
if not isinstance(dataframe, DataFrame) or dataframe.empty:
logger.warning('Empty candle (OHLCV) data for pair %s', pair)
return
@ -787,10 +775,7 @@ class IStrategy(ABC, HyperStrategyMixin):
logger.warning('Empty dataframe for pair %s', pair)
return
def analyze(
self,
pairs: List[str]
) -> None:
def analyze(self, pairs: List[str]) -> None:
"""
Analyze all pairs using analyze_pair().
:param pairs: List of pairs to analyze
@ -798,7 +783,7 @@ class IStrategy(ABC, HyperStrategyMixin):
for pair in pairs:
self.analyze_pair(pair)
@ staticmethod
@staticmethod
def preserve_df(dataframe: DataFrame) -> Tuple[int, float, datetime]:
""" keep some data for dataframes """
return len(dataframe), dataframe["close"].iloc[-1], dataframe["date"].iloc[-1]
@ -1219,9 +1204,6 @@ class IStrategy(ABC, HyperStrategyMixin):
dataframe = _create_and_merge_informative_pair(
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)
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.add_rpc_handler(RPC(get_patched_freqtradebot(mocker, default_conf)))
apiserver.start_api()
apiserver.cleanup()
assert apiserver._server.cleanup.call_count == 1