From ce2aa1dc698f30a84345f1b3a2bd6cf7cd928056 Mon Sep 17 00:00:00 2001 From: Matthias Date: Thu, 11 Nov 2021 12:06:18 +0100 Subject: [PATCH] Small formatting upgrades --- freqtrade/exceptions.py | 2 -- freqtrade/strategy/hyper.py | 2 +- freqtrade/strategy/interface.py | 2 +- freqtrade/wallets.py | 2 +- scripts/rest_client.py | 8 ++++---- tests/test_plotting.py | 1 - 6 files changed, 7 insertions(+), 10 deletions(-) diff --git a/freqtrade/exceptions.py b/freqtrade/exceptions.py index 056be8720..6b0039a3f 100644 --- a/freqtrade/exceptions.py +++ b/freqtrade/exceptions.py @@ -1,5 +1,3 @@ - - class FreqtradeException(Exception): """ Freqtrade base exception. Handled at the outermost level. diff --git a/freqtrade/strategy/hyper.py b/freqtrade/strategy/hyper.py index eaf41263a..278954bb2 100644 --- a/freqtrade/strategy/hyper.py +++ b/freqtrade/strategy/hyper.py @@ -292,7 +292,7 @@ class BooleanParameter(CategoricalParameter): load=load, **kwargs) -class HyperStrategyMixin(object): +class HyperStrategyMixin: """ A helper base class which allows HyperOptAuto class to reuse implementations of buy/sell strategy logic. diff --git a/freqtrade/strategy/interface.py b/freqtrade/strategy/interface.py index d11097ed2..47a226f16 100644 --- a/freqtrade/strategy/interface.py +++ b/freqtrade/strategy/interface.py @@ -30,7 +30,7 @@ logger = logging.getLogger(__name__) CUSTOM_SELL_MAX_LENGTH = 64 -class SellCheckTuple(object): +class SellCheckTuple: """ NamedTuple for Sell type + reason """ diff --git a/freqtrade/wallets.py b/freqtrade/wallets.py index 1a124d1bb..d10847099 100644 --- a/freqtrade/wallets.py +++ b/freqtrade/wallets.py @@ -73,7 +73,7 @@ class Wallets: tot_profit = Trade.get_total_closed_profit() else: tot_profit = LocalTrade.total_profit - tot_in_trades = sum([trade.stake_amount for trade in open_trades]) + tot_in_trades = sum(trade.stake_amount for trade in open_trades) current_stake = self.start_cap + tot_profit - tot_in_trades _wallets[self._config['stake_currency']] = Wallet( diff --git a/scripts/rest_client.py b/scripts/rest_client.py index ccb34d81f..b1234d329 100755 --- a/scripts/rest_client.py +++ b/scripts/rest_client.py @@ -39,7 +39,7 @@ class FtRestClient(): def _call(self, method, apipath, params: dict = None, data=None, files=None): if str(method).upper() not in ('GET', 'POST', 'PUT', 'DELETE'): - raise ValueError('invalid method <{0}>'.format(method)) + raise ValueError(f'invalid method <{method}>') basepath = f"{self._serverurl}/api/v1/{apipath}" hd = {"Accept": "application/json", @@ -124,7 +124,7 @@ class FtRestClient(): :param lock_id: ID for the lock to delete :return: json object """ - return self._delete("locks/{}".format(lock_id)) + return self._delete(f"locks/{lock_id}") def daily(self, days=None): """Return the profits for each day, and amount of trades. @@ -220,7 +220,7 @@ class FtRestClient(): :param trade_id: Specify which trade to get. :return: json object """ - return self._get("trade/{}".format(trade_id)) + return self._get(f"trade/{trade_id}") def delete_trade(self, trade_id): """Delete trade from the database. @@ -229,7 +229,7 @@ class FtRestClient(): :param trade_id: Deletes the trade with this ID from the database. :return: json object """ - return self._delete("trades/{}".format(trade_id)) + return self._delete(f"trades/{trade_id}") def whitelist(self): """Show the current whitelist. diff --git a/tests/test_plotting.py b/tests/test_plotting.py index 51301a464..8cbe7f863 100644 --- a/tests/test_plotting.py +++ b/tests/test_plotting.py @@ -1,4 +1,3 @@ - from copy import deepcopy from pathlib import Path from unittest.mock import MagicMock