From 70332ce16f4341bee233555094331eb483068f2c Mon Sep 17 00:00:00 2001 From: Sam Germain Date: Fri, 22 Oct 2021 11:41:24 -0600 Subject: [PATCH] removed backtesting stuff, fixed mypy errors --- freqtrade/exchange/exchange.py | 6 +++--- freqtrade/exchange/gateio.py | 7 ++++--- freqtrade/optimize/backtesting.py | 5 ----- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/freqtrade/exchange/exchange.py b/freqtrade/exchange/exchange.py index 26d0bc809..171f65033 100644 --- a/freqtrade/exchange/exchange.py +++ b/freqtrade/exchange/exchange.py @@ -1808,7 +1808,7 @@ class Exchange: pair: str, amount: float, open_date: datetime, - close_date: datetime + close_date: Optional[datetime] ) -> float: """ calculates the sum of all funding fees that occurred for a pair during a futures trade @@ -1820,7 +1820,7 @@ class Exchange: fees: float = 0 if close_date: - close_date_timestamp = int(close_date.timestamp()) + close_date_timestamp: Optional[int] = int(close_date.timestamp()) funding_rate_history = self.get_funding_rate_history( pair, int(open_date.timestamp()), @@ -1846,7 +1846,7 @@ class Exchange: self, pair: str, start: int, - end: Optional[int] + end: Optional[int] = None ) -> Dict: ''' :param pair: quote/base currency pair diff --git a/freqtrade/exchange/gateio.py b/freqtrade/exchange/gateio.py index f025ed4dd..3c488a0a0 100644 --- a/freqtrade/exchange/gateio.py +++ b/freqtrade/exchange/gateio.py @@ -1,6 +1,6 @@ """ Gate.io exchange subclass """ import logging -from typing import Dict, List +from typing import Dict, List, Optional from freqtrade.exceptions import OperationalException from freqtrade.exchange import Exchange @@ -36,12 +36,13 @@ class Gateio(Exchange): def get_funding_rate_history( self, + pair: str, start: int, - end: int + end: Optional[int] = None ) -> Dict: ''' :param start: timestamp in ms of the beginning time :param end: timestamp in ms of the end time ''' # TODO-lev: Has a max limit into the past of 333 days - return super().get_funding_rate_history(start, end) + return super().get_funding_rate_history(pair, start, end) diff --git a/freqtrade/optimize/backtesting.py b/freqtrade/optimize/backtesting.py index a5f63c396..24a3e744a 100644 --- a/freqtrade/optimize/backtesting.py +++ b/freqtrade/optimize/backtesting.py @@ -3,7 +3,6 @@ """ This module contains the backtesting logic """ -import ccxt import logging from collections import defaultdict from copy import deepcopy @@ -127,10 +126,6 @@ class Backtesting: self.progress = BTProgress() self.abort = False - self.funding_rate_history = getattr(ccxt, self._exchange_name).load_funding_rate_history( - self.timerange.startts, - self.timerange.stopts - ) self.init_backtest() def __del__(self):