Skip to content

Commit

Permalink
Merge branch 'freqtrade:develop' into freqtrade-develop
Browse files Browse the repository at this point in the history
  • Loading branch information
stash86 authored Mar 31, 2024
2 parents 294ebcb + 2072a62 commit f4c0b15
Show file tree
Hide file tree
Showing 38 changed files with 5,159 additions and 1,482 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/binance-lev-tier-update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Binance Leverage tiers update

on:
schedule:
- cron: "0 3 * * 4"
# on demand
workflow_dispatch:

permissions:
contents: read

jobs:
auto-update:
runs-on: ubuntu-latest
environment:
name: develop
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Install ccxt
run: pip install ccxt

- name: Run leverage tier update
env:
CI_WEB_PROXY: ${{ secrets.CI_WEB_PROXY }}
FREQTRADE__EXCHANGE__KEY: ${{ secrets.BINANCE_EXCHANGE_KEY }}
FREQTRADE__EXCHANGE__SECRET: ${{ secrets.BINANCE_EXCHANGE_SECRET }}
run: python build_helpers/binance_update_lev_tiers.py


- uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.REPO_SCOPED_TOKEN }}
add-paths: freqtrade/exchange/binance_leverage_tiers.json
labels: |
Tech maintenance
Dependencies
branch: update/binance-leverage-tiers
title: Update Binance Leverage Tiers
commit-message: "chore: update pre-commit hooks"
committer: Freqtrade Bot <[email protected]>
body: Update binance leverage tiers.
delete-branch: true
40 changes: 31 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ concurrency:
permissions:
repository-projects: read
jobs:
build_linux:
build-linux:

runs-on: ${{ matrix.os }}
strategy:
Expand Down Expand Up @@ -60,11 +60,16 @@ jobs:
export TA_LIBRARY_PATH=${HOME}/dependencies/lib
export TA_INCLUDE_PATH=${HOME}/dependencies/include
pip install -r requirements-dev.txt
pip install -e ft_client/
pip install -e .
- name: Check for version alignment
run: |
python build_helpers/freqtrade_client_version_align.py
- name: Tests
run: |
pytest --random-order --cov=freqtrade --cov-config=.coveragerc
pytest --random-order --cov=freqtrade --cov=freqtrade_client --cov-config=.coveragerc
- name: Coveralls
if: (runner.os == 'Linux' && matrix.python-version == '3.10' && matrix.os == 'ubuntu-22.04')
Expand Down Expand Up @@ -188,6 +193,7 @@ jobs:
export TA_LIBRARY_PATH=${HOME}/dependencies/lib
export TA_INCLUDE_PATH=${HOME}/dependencies/include
pip install -r requirements-dev.txt
pip install -e ft_client/
pip install -e .
- name: Tests
Expand Down Expand Up @@ -362,7 +368,7 @@ jobs:
webhookUrl: ${{ secrets.DISCORD_WEBHOOK }}


build_linux_online:
build-linux-online:
# Run pytest with "live" checks
runs-on: ubuntu-22.04
steps:
Expand Down Expand Up @@ -398,25 +404,26 @@ jobs:
export TA_LIBRARY_PATH=${HOME}/dependencies/lib
export TA_INCLUDE_PATH=${HOME}/dependencies/include
pip install -r requirements-dev.txt
pip install -e ft_client/
pip install -e .
- name: Tests incl. ccxt compatibility tests
env:
CI_WEB_PROXY: http://152.67.78.211:13128
run: |
pytest --random-order --longrun --durations 20 -n auto --dist loadscope
pytest --random-order --longrun --durations 20 -n auto
# Notify only once - when CI completes (and after deploy) in case it's successfull
notify-complete:
needs: [
build_linux,
build-linux,
build-macos,
build-windows,
docs-check,
mypy-version-check,
pre-commit,
build_linux_online
build-linux-online
]
runs-on: ubuntu-22.04
# Discord notification can't handle schedule events
Expand All @@ -443,7 +450,7 @@ jobs:

build:
name: "Build"
needs: [ build_linux, build-macos, build-windows, docs-check, mypy-version-check, pre-commit ]
needs: [ build-linux, build-macos, build-windows, docs-check, mypy-version-check, pre-commit ]
runs-on: ubuntu-22.04

steps:
Expand All @@ -467,6 +474,19 @@ jobs:
dist
retention-days: 10

- name: Build Client distribution
run: |
pip install -U build
python -m build --sdist --wheel ft_client
- name: Upload artifacts 📦
uses: actions/upload-artifact@v4
with:
name: freqtrade-client-build
path: |
ft_client/dist
retention-days: 10

deploy-pypi:
name: "Deploy to PyPI"
needs: [ build ]
Expand All @@ -484,8 +504,10 @@ jobs:
- name: Download artifact 📦
uses: actions/download-artifact@v4
with:
name: freqtrade-build
name: freqtrade*-build
path: dist
merge-multiple: true


- name: Publish to PyPI (Test)
uses: pypa/[email protected]
Expand All @@ -497,7 +519,7 @@ jobs:


deploy-docker:
needs: [ build_linux, build-macos, build-windows, docs-check, mypy-version-check, pre-commit ]
needs: [ build-linux, build-macos, build-windows, docs-check, mypy-version-check, pre-commit ]
runs-on: ubuntu-22.04

if: (github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'release') && github.repository == 'freqtrade/freqtrade'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Docker Hub Description
uses: peter-evans/dockerhub-description@v4
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKERHUB_REPOSITORY: freqtradeorg/freqtrade
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: freqtradeorg/freqtrade
59 changes: 29 additions & 30 deletions .github/workflows/pre-commit-update.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: Pre-commit auto-update

on:
# every day at midnight
schedule:
- cron: "0 3 * * 2"
# on demand
Expand All @@ -14,32 +13,32 @@ jobs:
auto-update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.11"


- name: Install pre-commit
run: pip install pre-commit

- name: Run auto-update
run: pre-commit autoupdate

- name: Run pre-commit
run: pre-commit run --all-files

- uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.REPO_SCOPED_TOKEN }}
add-paths: .pre-commit-config.yaml
labels: |
Tech maintenance
Dependencies
branch: update/pre-commit-hooks
title: Update pre-commit hooks
commit-message: "chore: update pre-commit hooks"
committer: Freqtrade Bot <[email protected]>
body: Update versions of pre-commit hooks to latest version.
delete-branch: true
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.11"


- name: Install pre-commit
run: pip install pre-commit

- name: Run auto-update
run: pre-commit autoupdate

- name: Run pre-commit
run: pre-commit run --all-files

- uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.REPO_SCOPED_TOKEN }}
add-paths: .pre-commit-config.yaml
labels: |
Tech maintenance
Dependencies
branch: update/pre-commit-hooks
title: Update pre-commit hooks
commit-message: "chore: update pre-commit hooks"
committer: Freqtrade Bot <[email protected]>
body: Update versions of pre-commit hooks to latest version.
delete-branch: true
26 changes: 26 additions & 0 deletions build_helpers/binance_update_lev_tiers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env python3
import json
import os
from pathlib import Path

import ccxt


key = os.environ.get('FREQTRADE__EXCHANGE__KEY')
secret = os.environ.get('FREQTRADE__EXCHANGE__SECRET')

proxy = os.environ.get('CI_WEB_PROXY')

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)
18 changes: 18 additions & 0 deletions build_helpers/freqtrade_client_version_align.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env python3
from freqtrade_client import __version__ as client_version

from freqtrade import __version__ as ft_version


def main():
if ft_version != 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__':
main()
Loading

0 comments on commit f4c0b15

Please sign in to comment.