diff --git a/build_helpers/binance_update_lev_tiers.py b/build_helpers/binance_update_lev_tiers.py index c0f3a7c1c..6d5fa5c1d 100644 --- a/build_helpers/binance_update_lev_tiers.py +++ b/build_helpers/binance_update_lev_tiers.py @@ -6,21 +6,18 @@ from pathlib import Path import ccxt -key = os.environ.get('FREQTRADE__EXCHANGE__KEY') -secret = os.environ.get('FREQTRADE__EXCHANGE__SECRET') +key = os.environ.get("FREQTRADE__EXCHANGE__KEY") +secret = os.environ.get("FREQTRADE__EXCHANGE__SECRET") -proxy = os.environ.get('CI_WEB_PROXY') +proxy = os.environ.get("CI_WEB_PROXY") -exchange = ccxt.binance({ - 'apiKey': key, - 'secret': secret, - 'httpsProxy': proxy, - 'options': {'defaultType': 'swap'} - }) +exchange = ccxt.binance( + {"apiKey": key, "secret": secret, "httpsProxy": proxy, "options": {"defaultType": "swap"}} +) _ = exchange.load_markets() lev_tiers = exchange.fetch_leverage_tiers() # Assumes this is running in the root of the repository. -file = Path('freqtrade/exchange/binance_leverage_tiers.json') -json.dump(dict(sorted(lev_tiers.items())), file.open('w'), indent=2) +file = Path("freqtrade/exchange/binance_leverage_tiers.json") +json.dump(dict(sorted(lev_tiers.items())), file.open("w"), indent=2) diff --git a/build_helpers/freqtrade_client_version_align.py b/build_helpers/freqtrade_client_version_align.py index 31360facf..f86bee98c 100755 --- a/build_helpers/freqtrade_client_version_align.py +++ b/build_helpers/freqtrade_client_version_align.py @@ -5,13 +5,11 @@ from freqtrade_client import __version__ as client_version def main(): if ft_version != client_version: - print(f"Versions do not match: \n" - f"ft: {ft_version} \n" - f"client: {client_version}") + print(f"Versions do not match: \n" f"ft: {ft_version} \n" f"client: {client_version}") exit(1) print(f"Versions match: ft: {ft_version}, client: {client_version}") exit(0) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/build_helpers/pre_commit_update.py b/build_helpers/pre_commit_update.py index 91327ec9a..9d313efd2 100644 --- a/build_helpers/pre_commit_update.py +++ b/build_helpers/pre_commit_update.py @@ -6,28 +6,30 @@ from pathlib import Path import yaml -pre_commit_file = Path('.pre-commit-config.yaml') -require_dev = Path('requirements-dev.txt') -require = Path('requirements.txt') +pre_commit_file = Path(".pre-commit-config.yaml") +require_dev = Path("requirements-dev.txt") +require = Path("requirements.txt") -with require_dev.open('r') as rfile: +with require_dev.open("r") as rfile: requirements = rfile.readlines() -with require.open('r') as rfile: +with require.open("r") as rfile: requirements.extend(rfile.readlines()) # Extract types only -type_reqs = [r.strip('\n') for r in requirements if r.startswith( - 'types-') or r.startswith('SQLAlchemy')] +type_reqs = [ + r.strip("\n") for r in requirements if r.startswith("types-") or r.startswith("SQLAlchemy") +] -with pre_commit_file.open('r') as file: +with pre_commit_file.open("r") as file: f = yaml.load(file, Loader=yaml.SafeLoader) -mypy_repo = [repo for repo in f['repos'] if repo['repo'] - == 'https://github.com/pre-commit/mirrors-mypy'] +mypy_repo = [ + repo for repo in f["repos"] if repo["repo"] == "https://github.com/pre-commit/mirrors-mypy" +] -hooks = mypy_repo[0]['hooks'][0]['additional_dependencies'] +hooks = mypy_repo[0]["hooks"][0]["additional_dependencies"] errors = [] for hook in hooks: diff --git a/freqtrade/__init__.py b/freqtrade/__init__.py index d794b7c37..d1cef043d 100644 --- a/freqtrade/__init__.py +++ b/freqtrade/__init__.py @@ -1,21 +1,33 @@ -""" Freqtrade bot """ -__version__ = '2024.5-dev' +"""Freqtrade bot""" -if 'dev' in __version__: +__version__ = "2024.5-dev" + +if "dev" in __version__: from pathlib import Path + try: import subprocess + freqtrade_basedir = Path(__file__).parent - __version__ = __version__ + '-' + subprocess.check_output( - ['git', 'log', '--format="%h"', '-n 1'], - stderr=subprocess.DEVNULL, cwd=freqtrade_basedir).decode("utf-8").rstrip().strip('"') + __version__ = ( + __version__ + + "-" + + subprocess.check_output( + ["git", "log", '--format="%h"', "-n 1"], + stderr=subprocess.DEVNULL, + cwd=freqtrade_basedir, + ) + .decode("utf-8") + .rstrip() + .strip('"') + ) except Exception: # pragma: no cover # git not available, ignore try: # Try Fallback to freqtrade_commit file (created by CI while building docker image) - versionfile = Path('./freqtrade_commit') + versionfile = Path("./freqtrade_commit") if versionfile.is_file(): __version__ = f"docker-{__version__}-{versionfile.read_text()[:8]}" except Exception: