Skip to content

Commit

Permalink
Merge pull request #10025 from freqtrade/new_release
Browse files Browse the repository at this point in the history
New release
  • Loading branch information
xmatthias committed Mar 31, 2024
2 parents 1fc69ef + a6bfe1a commit ad56462
Show file tree
Hide file tree
Showing 145 changed files with 6,953 additions and 2,301 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 <noreply@github.com>
body: Update binance leverage tiers.
delete-branch: true
58 changes: 43 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ on:
types: [published]
pull_request:
schedule:
- cron: '0 5 * * 4'
- cron: '0 3 * * 4'

concurrency:
group: "${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}"
cancel-in-progress: true
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 @@ -124,8 +129,11 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ "macos-latest", "macos-13" ]
os: [ "macos-latest", "macos-13", "macos-14" ]
python-version: ["3.9", "3.10", "3.11", "3.12"]
exclude:
- os: "macos-14"
python-version: "3.9"

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -154,7 +162,7 @@ jobs:
run: |
cd build_helpers && ./install_ta-lib.sh ${HOME}/dependencies/; cd ..
- name: Installation - macOS
- name: Installation - macOS (Brew)
run: |
# brew update
# TODO: Should be the brew upgrade
Expand All @@ -177,11 +185,15 @@ jobs:
rm /usr/local/bin/python3.12-config || true
brew install hdf5 c-blosc libomp
- name: Installation (python)
run: |
python -m pip install --upgrade pip wheel
export LD_LIBRARY_PATH=${HOME}/dependencies/lib:$LD_LIBRARY_PATH
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 @@ -356,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 @@ -392,29 +404,30 @@ 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
if: (github.event_name != 'schedule')
if: github.event_name != 'schedule' && github.repository == 'freqtrade/freqtrade'
permissions:
repository-projects: read
steps:
Expand All @@ -437,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 @@ -461,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 @@ -478,20 +504,22 @@ 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/gh-action-pypi-publish@v1.8.11
uses: pypa/gh-action-pypi-publish@v1.8.14
with:
repository-url: https://test.pypi.org/legacy/

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@v1.8.11
uses: pypa/gh-action-pypi-publish@v1.8.14


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 <noreply@github.com>
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 <noreply@github.com>
body: Update versions of pre-commit hooks to latest version.
delete-branch: true
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ repos:
# stages: [push]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: "v1.8.0"
rev: "v1.9.0"
hooks:
- id: mypy
exclude: build_helpers
additional_dependencies:
- types-cachetools==5.3.0.7
- types-filelock==3.2.7
- types-requests==2.31.0.20240218
- types-requests==2.31.0.20240311
- types-tabulate==0.9.0.20240106
- types-python-dateutil==2.8.19.20240106
- SQLAlchemy==2.0.27
- types-python-dateutil==2.9.0.20240316
- SQLAlchemy==2.0.29
# stages: [push]

- repo: https://github.com/pycqa/isort
Expand All @@ -31,7 +31,7 @@ repos:

- repo: https://github.com/charliermarsh/ruff-pre-commit
# Ruff version.
rev: 'v0.2.2'
rev: 'v0.3.4'
hooks:
- id: ruff

Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ pytest tests/test_<file_name>.py::test_<method_name>
#### Run Ruff

```bash
ruff .
ruff check .
```

We receive a lot of code that fails the `ruff` checks.
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.11.8-slim-bookworm as base
FROM python:3.12.2-slim-bookworm as base

# Setup env
ENV LANG C.UTF-8
Expand Down
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()
Binary file not shown.
Binary file not shown.

0 comments on commit ad56462

Please sign in to comment.