This commit is contained in:
Matthias 2023-05-14 10:34:06 +02:00
parent 6b735bc683
commit 261df527d9

View File

@ -3,10 +3,9 @@
import logging import logging
from collections import defaultdict from collections import defaultdict
from copy import deepcopy from copy import deepcopy
from datetime import datetime, timezone from datetime import timedelta
from typing import Any, Dict, List, NamedTuple from typing import Any, Dict, List, NamedTuple
import arrow
import numpy as np import numpy as np
import utils_find_1st as utf1st import utils_find_1st as utf1st
from pandas import DataFrame from pandas import DataFrame
@ -19,6 +18,7 @@ from freqtrade.exceptions import OperationalException
from freqtrade.exchange import timeframe_to_seconds from freqtrade.exchange import timeframe_to_seconds
from freqtrade.plugins.pairlist.pairlist_helpers import expand_pairlist from freqtrade.plugins.pairlist.pairlist_helpers import expand_pairlist
from freqtrade.strategy.interface import IStrategy from freqtrade.strategy.interface import IStrategy
from freqtrade.util import dt_now
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -80,8 +80,8 @@ class Edge:
self._stoploss_range_step self._stoploss_range_step
) )
self._timerange: TimeRange = TimeRange.parse_timerange("%s-" % arrow.now().shift( self._timerange: TimeRange = TimeRange.parse_timerange("%s-" % (
days=-1 * self._since_number_of_days).format('YYYYMMDD')) dt_now() - timedelta(days=self._since_number_of_days)).strftime('YYYYMMDD'))
if config.get('fee'): if config.get('fee'):
self.fee = config['fee'] self.fee = config['fee']
else: else:
@ -98,7 +98,7 @@ class Edge:
heartbeat = self.edge_config.get('process_throttle_secs') heartbeat = self.edge_config.get('process_throttle_secs')
if (self._last_updated > 0) and ( if (self._last_updated > 0) and (
self._last_updated + heartbeat > int(datetime.now(timezone.utc).timestamp())): self._last_updated + heartbeat > int(dt_now().timestamp())):
return False return False
data: Dict[str, Any] = {} data: Dict[str, Any] = {}
@ -190,7 +190,7 @@ class Edge:
# Fill missing, calculable columns, profit, duration , abs etc. # Fill missing, calculable columns, profit, duration , abs etc.
trades_df = self._fill_calculable_fields(DataFrame(trades)) trades_df = self._fill_calculable_fields(DataFrame(trades))
self._cached_pairs = self._process_expectancy(trades_df) self._cached_pairs = self._process_expectancy(trades_df)
self._last_updated = int(datetime.now(timezone.utc).timestamp()) self._last_updated = int(dt_now().timestamp())
return True return True