mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-12-16 12:51:14 +00:00
use dt_ts to simplify exchange date math
This commit is contained in:
@@ -659,7 +659,7 @@ class Exchange:
|
|||||||
|
|
||||||
candle_limit = self.ohlcv_candle_limit(
|
candle_limit = self.ohlcv_candle_limit(
|
||||||
timeframe, self._config['candle_type_def'],
|
timeframe, self._config['candle_type_def'],
|
||||||
int(date_minus_candles(timeframe, startup_candles).timestamp() * 1000)
|
dt_ts(date_minus_candles(timeframe, startup_candles))
|
||||||
if timeframe else None)
|
if timeframe else None)
|
||||||
# Require one more candle - to account for the still open candle.
|
# Require one more candle - to account for the still open candle.
|
||||||
candle_count = startup_candles + 1
|
candle_count = startup_candles + 1
|
||||||
@@ -2043,7 +2043,7 @@ class Exchange:
|
|||||||
timeframe, candle_type, since_ms)
|
timeframe, candle_type, since_ms)
|
||||||
move_to = one_call * self.required_candle_call_count
|
move_to = one_call * self.required_candle_call_count
|
||||||
now = timeframe_to_next_date(timeframe)
|
now = timeframe_to_next_date(timeframe)
|
||||||
since_ms = int((now - timedelta(seconds=move_to // 1000)).timestamp() * 1000)
|
since_ms = dt_ts(now - timedelta(seconds=move_to // 1000))
|
||||||
|
|
||||||
if since_ms:
|
if since_ms:
|
||||||
return self._async_get_historic_ohlcv(
|
return self._async_get_historic_ohlcv(
|
||||||
@@ -2503,7 +2503,7 @@ class Exchange:
|
|||||||
)
|
)
|
||||||
|
|
||||||
if type(since) is datetime:
|
if type(since) is datetime:
|
||||||
since = int(since.timestamp()) * 1000 # * 1000 for ms
|
since = dt_ts(since)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
funding_history = self._api.fetch_funding_history(
|
funding_history = self._api.fetch_funding_history(
|
||||||
@@ -2833,7 +2833,7 @@ class Exchange:
|
|||||||
|
|
||||||
if not close_date:
|
if not close_date:
|
||||||
close_date = datetime.now(timezone.utc)
|
close_date = datetime.now(timezone.utc)
|
||||||
since_ms = int(timeframe_to_prev_date(timeframe, open_date).timestamp()) * 1000
|
since_ms = dt_ts(timeframe_to_prev_date(timeframe, open_date))
|
||||||
|
|
||||||
mark_comb: PairWithTimeframe = (pair, timeframe, mark_price_type)
|
mark_comb: PairWithTimeframe = (pair, timeframe, mark_price_type)
|
||||||
funding_comb: PairWithTimeframe = (pair, timeframe_ff, CandleType.FUNDING_RATE)
|
funding_comb: PairWithTimeframe = (pair, timeframe_ff, CandleType.FUNDING_RATE)
|
||||||
|
|||||||
Reference in New Issue
Block a user