mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-09-20 01:21:11 +00:00
ruff format: udpate build_helpers
This commit is contained in:
parent
15f32be176
commit
dc3a3d1cf9
|
@ -6,21 +6,18 @@ from pathlib import Path
|
||||||
import ccxt
|
import ccxt
|
||||||
|
|
||||||
|
|
||||||
key = os.environ.get('FREQTRADE__EXCHANGE__KEY')
|
key = os.environ.get("FREQTRADE__EXCHANGE__KEY")
|
||||||
secret = os.environ.get('FREQTRADE__EXCHANGE__SECRET')
|
secret = os.environ.get("FREQTRADE__EXCHANGE__SECRET")
|
||||||
|
|
||||||
proxy = os.environ.get('CI_WEB_PROXY')
|
proxy = os.environ.get("CI_WEB_PROXY")
|
||||||
|
|
||||||
exchange = ccxt.binance({
|
exchange = ccxt.binance(
|
||||||
'apiKey': key,
|
{"apiKey": key, "secret": secret, "httpsProxy": proxy, "options": {"defaultType": "swap"}}
|
||||||
'secret': secret,
|
)
|
||||||
'httpsProxy': proxy,
|
|
||||||
'options': {'defaultType': 'swap'}
|
|
||||||
})
|
|
||||||
_ = exchange.load_markets()
|
_ = exchange.load_markets()
|
||||||
|
|
||||||
lev_tiers = exchange.fetch_leverage_tiers()
|
lev_tiers = exchange.fetch_leverage_tiers()
|
||||||
|
|
||||||
# Assumes this is running in the root of the repository.
|
# Assumes this is running in the root of the repository.
|
||||||
file = Path('freqtrade/exchange/binance_leverage_tiers.json')
|
file = Path("freqtrade/exchange/binance_leverage_tiers.json")
|
||||||
json.dump(dict(sorted(lev_tiers.items())), file.open('w'), indent=2)
|
json.dump(dict(sorted(lev_tiers.items())), file.open("w"), indent=2)
|
||||||
|
|
|
@ -5,13 +5,11 @@ from freqtrade_client import __version__ as client_version
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
if ft_version != client_version:
|
if ft_version != client_version:
|
||||||
print(f"Versions do not match: \n"
|
print(f"Versions do not match: \n" f"ft: {ft_version} \n" f"client: {client_version}")
|
||||||
f"ft: {ft_version} \n"
|
|
||||||
f"client: {client_version}")
|
|
||||||
exit(1)
|
exit(1)
|
||||||
print(f"Versions match: ft: {ft_version}, client: {client_version}")
|
print(f"Versions match: ft: {ft_version}, client: {client_version}")
|
||||||
exit(0)
|
exit(0)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -6,28 +6,30 @@ from pathlib import Path
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
|
|
||||||
pre_commit_file = Path('.pre-commit-config.yaml')
|
pre_commit_file = Path(".pre-commit-config.yaml")
|
||||||
require_dev = Path('requirements-dev.txt')
|
require_dev = Path("requirements-dev.txt")
|
||||||
require = Path('requirements.txt')
|
require = Path("requirements.txt")
|
||||||
|
|
||||||
with require_dev.open('r') as rfile:
|
with require_dev.open("r") as rfile:
|
||||||
requirements = rfile.readlines()
|
requirements = rfile.readlines()
|
||||||
|
|
||||||
with require.open('r') as rfile:
|
with require.open("r") as rfile:
|
||||||
requirements.extend(rfile.readlines())
|
requirements.extend(rfile.readlines())
|
||||||
|
|
||||||
# Extract types only
|
# Extract types only
|
||||||
type_reqs = [r.strip('\n') for r in requirements if r.startswith(
|
type_reqs = [
|
||||||
'types-') or r.startswith('SQLAlchemy')]
|
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)
|
f = yaml.load(file, Loader=yaml.SafeLoader)
|
||||||
|
|
||||||
|
|
||||||
mypy_repo = [repo for repo in f['repos'] if repo['repo']
|
mypy_repo = [
|
||||||
== 'https://github.com/pre-commit/mirrors-mypy']
|
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 = []
|
errors = []
|
||||||
for hook in hooks:
|
for hook in hooks:
|
||||||
|
|
|
@ -1,21 +1,33 @@
|
||||||
""" Freqtrade bot """
|
"""Freqtrade bot"""
|
||||||
__version__ = '2024.5-dev'
|
|
||||||
|
|
||||||
if 'dev' in __version__:
|
__version__ = "2024.5-dev"
|
||||||
|
|
||||||
|
if "dev" in __version__:
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
freqtrade_basedir = Path(__file__).parent
|
freqtrade_basedir = Path(__file__).parent
|
||||||
|
|
||||||
__version__ = __version__ + '-' + subprocess.check_output(
|
__version__ = (
|
||||||
['git', 'log', '--format="%h"', '-n 1'],
|
__version__
|
||||||
stderr=subprocess.DEVNULL, cwd=freqtrade_basedir).decode("utf-8").rstrip().strip('"')
|
+ "-"
|
||||||
|
+ 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
|
except Exception: # pragma: no cover
|
||||||
# git not available, ignore
|
# git not available, ignore
|
||||||
try:
|
try:
|
||||||
# Try Fallback to freqtrade_commit file (created by CI while building docker image)
|
# 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():
|
if versionfile.is_file():
|
||||||
__version__ = f"docker-{__version__}-{versionfile.read_text()[:8]}"
|
__version__ = f"docker-{__version__}-{versionfile.read_text()[:8]}"
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user