|
| 1 | +name: Run PR docker-compose based tests |
| 2 | +on: pull_request |
| 3 | + |
| 4 | +jobs: |
| 5 | + pr_tests: |
| 6 | + name: Run PR tests |
| 7 | + runs-on: ubuntu-latest |
| 8 | + env: |
| 9 | + ACTIONS_ALLOW_UNSECURE_COMMANDS: true |
| 10 | + IMAGE: ghcr.io/azulinho/cryptobot |
| 11 | + TAG: pr |
| 12 | + steps: |
| 13 | + - name: Check out the repo |
| 14 | + uses: actions/checkout@v2 |
| 15 | + |
| 16 | + - name: local docker-compose build |
| 17 | + run: | |
| 18 | + set -e |
| 19 | + pip install docker-compose |
| 20 | + docker-compose build --no-cache |
| 21 | +
|
| 22 | + - name: Login to GitHub Container Registry |
| 23 | + uses: docker/login-action@v1 |
| 24 | + with: |
| 25 | + registry: ghcr.io |
| 26 | + username: ${{ github.actor }} |
| 27 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 28 | + |
| 29 | + - name: run backtesting strategies BuyMoonSellRecoveryStrategy.yaml |
| 30 | + run: | |
| 31 | + set -e |
| 32 | + echo BuyMoonSellRecoveryStrategy.yaml |
| 33 | + docker compose run \ |
| 34 | + --name cryptobot.automated-backtesting.$(whoami) --rm \ |
| 35 | + --entrypoint="/cryptobot/.venv/bin/python /cryptobot/app.py" \ |
| 36 | + cryptobot \ |
| 37 | + -c tests/BuyMoonSellRecoveryStrategy.yaml \ |
| 38 | + -m backtesting -s tests/fake.yaml |tail | tee result.txt |
| 39 | + grep ' wins:385 losses:97 stales:107 holds:1' result.txt |
| 40 | +
|
| 41 | + - name: run backtesting strategies BuyOnGrowthTrendAfterDropStrategy.yaml |
| 42 | + run: | |
| 43 | + set -e |
| 44 | + echo BuyOnGrowthTrendAfterDropStrategy.yaml |
| 45 | + docker compose run \ |
| 46 | + --name cryptobot.automated-backtesting.$(whoami) --rm \ |
| 47 | + --entrypoint="/cryptobot/.venv/bin/python /cryptobot/app.py" \ |
| 48 | + cryptobot \ |
| 49 | + -c tests/BuyOnGrowthTrendAfterDropStrategy.yaml \ |
| 50 | + -m backtesting -s tests/fake.yaml | tail | tee result.txt |
| 51 | + grep 'wins:19 losses:1 stales:77 holds:2' result.txt |
| 52 | +
|
| 53 | +
|
| 54 | + - name: run backtesting strategies BuyDropSellRecoveryStrategy.yaml |
| 55 | + run: | |
| 56 | + set -e |
| 57 | + echo BuyDropSellRecoveryStrategy.yaml |
| 58 | + docker compose run \ |
| 59 | + --name cryptobot.automated-backtesting.$(whoami) --rm \ |
| 60 | + --entrypoint="/cryptobot/.venv/bin/python /cryptobot/app.py" \ |
| 61 | + cryptobot \ |
| 62 | + -c tests/BuyDropSellRecoveryStrategy.yaml \ |
| 63 | + -m backtesting -s tests/fake.yaml | tail | tee result.txt |
| 64 | + grep 'wins:4 losses:9 stales:1 holds:0' result.txt |
| 65 | +
|
| 66 | + - name: run backtesting strategies BuyDropSellRecoveryStrategyWhenBTCisUp.yaml |
| 67 | + run: | |
| 68 | + set -e |
| 69 | + echo BuyDropSellRecoveryStrategyWhenBTCisUp.yaml |
| 70 | + docker compose run \ |
| 71 | + --name cryptobot.automated-backtesting.$(whoami) --rm \ |
| 72 | + --entrypoint="/cryptobot/.venv/bin/python /cryptobot/app.py" \ |
| 73 | + cryptobot \ |
| 74 | + -c tests/BuyDropSellRecoveryStrategyWhenBTCisUp.yaml \ |
| 75 | + -m backtesting -s tests/fake.yaml | tail |tee result.txt |
| 76 | + grep 'wins:207 losses:1 stales:648 holds:0' result.txt |
| 77 | +
|
| 78 | + - name: run backtesting strategies BuyDropSellRecoveryStrategyWhenBTCisDown.yaml |
| 79 | + run: | |
| 80 | + set -e |
| 81 | + echo BuyDropSellRecoveryStrategyWhenBTCisDown.yaml |
| 82 | + docker compose run \ |
| 83 | + --name cryptobot.automated-backtesting.$(whoami) --rm \ |
| 84 | + --entrypoint="/cryptobot/.venv/bin/python /cryptobot/app.py" \ |
| 85 | + cryptobot \ |
| 86 | + -c tests/BuyDropSellRecoveryStrategyWhenBTCisDown.yaml \ |
| 87 | + -m backtesting -s tests/fake.yaml | tail | tee result.txt |
| 88 | + grep 'wins:9 losses:0 stales:97 holds:0' result.txt |
| 89 | +
|
| 90 | + - name: run backtesting strategies BuyOnRecoveryAfterDropDuringGrowthTrendStrategy.yaml |
| 91 | + run: | |
| 92 | + set -e |
| 93 | + echo BuyOnRecoveryAfterDropDuringGrowthTrendStrategy.yaml |
| 94 | + docker compose run \ |
| 95 | + --name cryptobot.automated-backtesting.$(whoami) --rm \ |
| 96 | + --entrypoint="/cryptobot/.venv/bin/python /cryptobot/app.py" \ |
| 97 | + cryptobot \ |
| 98 | + -c tests/BuyOnRecoveryAfterDropDuringGrowthTrendStrategy.yaml \ |
| 99 | + -m backtesting -s tests/fake.yaml | tail | tee result.txt |
| 100 | + grep 'wins:116 losses:0 stales:358 holds:0' result.txt |
| 101 | +
|
| 102 | + - name: run backtesting strategies BuyOnRecoveryAfterDropFromAverageStrategy.yaml |
| 103 | + run: | |
| 104 | + set -e |
| 105 | + echo BuyOnRecoveryAfterDropFromAverageStrategy.yaml |
| 106 | + docker compose run \ |
| 107 | + --name cryptobot.automated-backtesting.$(whoami) --rm \ |
| 108 | + --entrypoint="/cryptobot/.venv/bin/python /cryptobot/app.py" \ |
| 109 | + cryptobot \ |
| 110 | + -c tests/BuyOnRecoveryAfterDropFromAverageStrategy.yaml \ |
| 111 | + -m backtesting -s tests/fake.yaml | tail | tee result.txt |
| 112 | + grep 'wins:187 losses:4 stales:598 holds:0' result.txt |
| 113 | +
|
| 114 | +
|
| 115 | + - name: run automated-backtesting |
| 116 | + run: | |
| 117 | + set -ex |
| 118 | + echo automated-tests |
| 119 | + LOGFILE=tests/price.log.gz |
| 120 | + CONFIG=tests/automated-backtesting.yaml |
| 121 | + MIN=1 |
| 122 | + FILTER="" |
| 123 | + docker compose run \ |
| 124 | + --name cryptobot.automated-backtesting.$(whoami) --rm \ |
| 125 | + --entrypoint="/cryptobot/.venv/bin/python /cryptobot/utils/automated-backtesting.py" \ |
| 126 | + cryptobot \ |
| 127 | + -l ${LOGFILE} -c ${CONFIG} -m ${MIN} \ |
| 128 | + -f "${FILTER}" -s "profit"| tail |
0 commit comments