Skip to content

Commit a16bcf2

Browse files
committed
Merge branch 'hotfix/tests'
2 parents 6f1ea83 + 96c60c4 commit a16bcf2

File tree

281 files changed

+1061
-433
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

281 files changed

+1061
-433
lines changed

.github/release-drafter.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ version-resolver:
2929
template: |
3030
## Changes
3131
32-
$CHANGES
32+
$CHANGES

.github/workflows/backtest.yml

Lines changed: 0 additions & 31 deletions
This file was deleted.

.github/workflows/release-drafter.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ jobs:
1313
# Drafts your next Release notes as Pull Requests are merged into "master"
1414
- uses: release-drafter/release-drafter@v5
1515
env:
16-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
16+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/tests.yml

Lines changed: 267 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,267 @@
1+
name: CI
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
Pre-Commit:
7+
runs-on: ubuntu-20.04
8+
steps:
9+
- uses: actions/checkout@v2
10+
with:
11+
fetch-depth: 0
12+
- name: Set up Python
13+
uses: actions/setup-python@v2
14+
with:
15+
python-version: 3.7
16+
- id: changed-files
17+
name: Get Changed Files
18+
uses: dorny/paths-filter@v2
19+
with:
20+
token: ${{ github.token }}
21+
list-files: shell
22+
filters: |
23+
repo:
24+
- added|modified:
25+
- '**'
26+
- name: Set Cache Key
27+
run: echo "PY=$(python --version --version | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
28+
- uses: actions/cache@v2
29+
with:
30+
path: ~/.cache/pre-commit
31+
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
32+
- name: Check ALL Files On Branch
33+
uses: pre-commit/[email protected]
34+
if: github.event_name != 'pull_request'
35+
- name: Check Changed Files On PR
36+
uses: pre-commit/[email protected]
37+
if: github.event_name == 'pull_request'
38+
with:
39+
extra_args: --files ${{ steps.changed-files.outputs.repo_files }}
40+
41+
Binance-Exchange-Data:
42+
runs-on: ubuntu-latest
43+
timeout-minutes: 90
44+
strategy:
45+
fail-fast: false
46+
47+
steps:
48+
- uses: actions/checkout@v2
49+
50+
- name: Backtesting Variables
51+
id: dotenv
52+
uses: falti/[email protected]
53+
with:
54+
log-variables: true
55+
path:
56+
user_data/backtesting-binance.env
57+
58+
- name: Download Cache
59+
continue-on-error: true
60+
uses: dawidd6/action-download-artifact@v2
61+
with:
62+
workflow: tests.yml
63+
name: exchange-data-${{ steps.dotenv.outputs.exchange }}
64+
path: user_data/data/${{ steps.dotenv.outputs.exchange }}
65+
66+
- name: Download Data
67+
env:
68+
START_DATE: ${{ steps.dotenv.outputs.start_date }}
69+
END_DATE: ${{ steps.dotenv.outputs.end_date }}
70+
EXCHANGE: ${{ steps.dotenv.outputs.exchange }}
71+
run: |
72+
docker-compose run --rm download-data
73+
74+
- name: Upload Cache
75+
if: always()
76+
uses: actions/upload-artifact@v2
77+
with:
78+
name: exchange-data-${{ steps.dotenv.outputs.exchange }}
79+
path: user_data/data/${{ steps.dotenv.outputs.exchange }}
80+
81+
# Kucoin-Exchange-Data:
82+
# runs-on: ubuntu-latest
83+
# timeout-minutes: 90
84+
# strategy:
85+
# fail-fast: false
86+
#
87+
# steps:
88+
# - uses: actions/checkout@v2
89+
#
90+
# - name: Backtesting Variables
91+
# id: dotenv
92+
# uses: falti/[email protected]
93+
# with:
94+
# log-variables: true
95+
# path:
96+
# user_data/backtesting-kucoin.env
97+
#
98+
# - name: Download Cache
99+
# continue-on-error: true
100+
# uses: dawidd6/action-download-artifact@v2
101+
# with:
102+
# workflow: tests.yml
103+
# name: exchange-data-${{ steps.dotenv.outputs.exchange }}
104+
# path: user_data/data/${{ steps.dotenv.outputs.exchange }}
105+
#
106+
# - name: Download Data
107+
# env:
108+
# START_DATE: ${{ steps.dotenv.outputs.start_date }}
109+
# END_DATE: ${{ steps.dotenv.outputs.end_date }}
110+
# EXCHANGE: ${{ steps.dotenv.outputs.exchange }}
111+
# run: |
112+
# docker-compose run --rm download-data
113+
#
114+
# - name: Upload Cache
115+
# if: always()
116+
# uses: actions/upload-artifact@v2
117+
# with:
118+
# name: exchange-data-${{ steps.dotenv.outputs.exchange }}
119+
# path: user_data/data/${{ steps.dotenv.outputs.exchange }}
120+
121+
Binance-Backtests:
122+
needs:
123+
- Pre-Commit
124+
- Binance-Exchange-Data
125+
strategy:
126+
fail-fast: false
127+
matrix:
128+
timerange:
129+
- 20210101-20210201
130+
- 20210201-20210301
131+
- 20210301-20210401
132+
- 20210401-20210501
133+
- 20210601-20210701
134+
opentrades:
135+
- 5
136+
runs-on: ubuntu-latest
137+
138+
steps:
139+
- uses: actions/checkout@v2
140+
141+
- name: Backtesting Variables
142+
id: dotenv
143+
uses: falti/[email protected]
144+
with:
145+
log-variables: true
146+
path:
147+
user_data/backtesting-binance.env
148+
149+
- name: Download Data Cache
150+
uses: actions/download-artifact@v2
151+
with:
152+
name: exchange-data-${{ steps.dotenv.outputs.exchange }}
153+
path: user_data/data/${{ steps.dotenv.outputs.exchange }}
154+
155+
- name: Build Backtest Image
156+
run: docker-compose build backtesting
157+
158+
- name: Run Backtest ${{ matrix.opentrades }} trades ${{ matrix.timerange }}
159+
env:
160+
MAX_OPEN_TRADES: ${{ matrix.opentrades }}
161+
STAKE_AMOUNT: unlimited
162+
TIMERANGE: ${{ matrix.timerange }}
163+
EXCHANGE: ${{ steps.dotenv.outputs.exchange }}
164+
run: docker-compose run -T --rm backtesting 1> backtest_${{ matrix.timerange }}_${{ matrix.opentrades }}.txt
165+
166+
- name: Show Backtest ${{ matrix.timerange }} ${{ matrix.opentrades }}
167+
run: cat backtest_${{ matrix.timerange }}_${{ matrix.opentrades }}.txt
168+
169+
- name: 'Upload Artifact'
170+
uses: actions/upload-artifact@v2
171+
with:
172+
name: backtest_result
173+
path: backtest_${{ matrix.timerange }}_${{ matrix.opentrades }}.txt
174+
175+
# Kucoin-Backtests:
176+
# needs:
177+
# - Pre-Commit
178+
# - Kucoin-Exchange-Data
179+
# strategy:
180+
# fail-fast: false
181+
# matrix:
182+
# timerange:
183+
# - 20210101-20210201
184+
# - 20210201-20210301
185+
# - 20210301-20210401
186+
# - 20210401-20210501
187+
# - 20210601-20210701
188+
# opentrades:
189+
# - 5
190+
# runs-on: ubuntu-latest
191+
#
192+
# steps:
193+
# - uses: actions/checkout@v2
194+
#
195+
# - name: Backtesting Variables
196+
# id: dotenv
197+
# uses: falti/[email protected]
198+
# with:
199+
# log-variables: true
200+
# path:
201+
# user_data/backtesting-kucoin.env
202+
#
203+
# - name: Download Data Cache
204+
# uses: actions/download-artifact@v2
205+
# with:
206+
# name: exchange-data-${{ steps.dotenv.outputs.exchange }}
207+
# path: user_data/data/${{ steps.dotenv.outputs.exchange }}
208+
#
209+
# - name: Build Backtest Image
210+
# run: docker-compose build backtesting
211+
#
212+
# - name: Run Backtest ${{ matrix.opentrades }} trades ${{ matrix.timerange }}
213+
# continue-on-error: true
214+
# env:
215+
# MAX_OPEN_TRADES: ${{ matrix.opentrades }}
216+
# STAKE_AMOUNT: unlimited
217+
# TIMERANGE: ${{ matrix.timerange }}
218+
# EXCHANGE: ${{ steps.dotenv.outputs.exchange }}
219+
# run: docker-compose run -T --rm backtesting 1> backtest_${{ matrix.timerange }}_${{ matrix.opentrades }}.txt
220+
#
221+
# - name: Show Backtest ${{ matrix.timerange }} ${{ matrix.opentrades }}
222+
# run: cat backtest_${{ matrix.timerange }}_${{ matrix.opentrades }}.txt
223+
#
224+
# - name: 'Upload Artifact'
225+
# uses: actions/upload-artifact@v2
226+
# with:
227+
# name: backtest_result
228+
# path: backtest_${{ matrix.timerange }}_${{ matrix.opentrades }}.txt
229+
230+
Test:
231+
runs-on: ubuntu-20.04
232+
needs:
233+
- Pre-Commit
234+
- Binance-Exchange-Data
235+
# - Kucoin-Exchange-Data
236+
237+
steps:
238+
- uses: actions/checkout@v2
239+
240+
- name: Backtesting Variables
241+
id: dotenv
242+
uses: falti/[email protected]
243+
with:
244+
log-variables: true
245+
path:
246+
user_data/backtesting-binance.env
247+
248+
- name: Download Data Cache
249+
uses: actions/download-artifact@v2
250+
with:
251+
name: exchange-data-${{ steps.dotenv.outputs.exchange }}
252+
path: user_data/data/${{ steps.dotenv.outputs.exchange }}
253+
254+
- name: Build Tests Image
255+
run: docker-compose build tests
256+
257+
- name: Run Tests
258+
run: |
259+
mkdir artifacts
260+
chmod 777 artifacts
261+
docker-compose run --rm tests
262+
263+
- name: Upload Artifacts
264+
uses: actions/upload-artifact@v2
265+
with:
266+
name: testrun-artifacts
267+
path: artifacts/

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,3 +133,12 @@ user_data/data/*.json
133133

134134
# IntelliJ
135135
.idea
136+
137+
user_data/data/*/*.json
138+
user_data/backtest_results
139+
user_data/hyperopt_results
140+
user_data/hyperopts
141+
user_data/logs
142+
user_data/notebooks
143+
user_data/plot
144+
artifacts/

.pre-commit-config.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
repos:
3+
- repo: https://github.com/pre-commit/pre-commit-hooks
4+
rev: v2.1.0
5+
hooks:
6+
- id: check-merge-conflict # Check for files that contain merge conflict strings.
7+
- id: trailing-whitespace # Trims trailing whitespace.
8+
args: [--markdown-linebreak-ext=md]
9+
- id: mixed-line-ending # Replaces or checks mixed line ending.
10+
args: [--fix=lf]
11+
- id: end-of-file-fixer # Makes sure files end in a newline and only a newline.
12+
exclude: user_data/.*
13+
- id: check-merge-conflict # Check for files that contain merge conflict strings.
14+
- id: check-ast # Simply check whether files parse as valid python.
15+
16+
# ----- Formatting ------------------------------------------------------------------------------------------------>
17+
- repo: https://github.com/asottile/pyupgrade
18+
rev: v2.23.0
19+
hooks:
20+
- id: pyupgrade
21+
name: Rewrite Code to be Py3.7+
22+
args: [--py37-plus]
23+
files: tests/.*\.py
24+
exclude: user_data/.*
25+
26+
- repo: https://github.com/asottile/reorder_python_imports
27+
rev: v2.6.0
28+
hooks:
29+
- id: reorder-python-imports
30+
args: [
31+
--py37-plus,
32+
]
33+
files: tests/.*\.py
34+
35+
- repo: https://github.com/psf/black
36+
rev: 21.7b0
37+
hooks:
38+
- id: black
39+
args: [-l 100]
40+
files: tests/.*\.py
41+
# <---- Formatting -------------------------------------------------------------------------------------------------

0 commit comments

Comments
 (0)