Skip to content

Commit 18ced08

Browse files
committed
Merge branch 'hotfix/tests'
2 parents a16bcf2 + 025f507 commit 18ced08

File tree

19 files changed

+327
-381
lines changed

19 files changed

+327
-381
lines changed

.github/workflows/tests.yml

Lines changed: 79 additions & 152 deletions
Original file line numberDiff line numberDiff line change
@@ -38,90 +38,47 @@ jobs:
3838
with:
3939
extra_args: --files ${{ steps.changed-files.outputs.repo_files }}
4040

41-
Binance-Exchange-Data:
42-
runs-on: ubuntu-latest
43-
timeout-minutes: 90
41+
42+
Binance-Backtests:
4443
strategy:
4544
fail-fast: false
45+
matrix:
46+
timerange:
47+
- 20210101-20210201
48+
- 20210201-20210301
49+
- 20210301-20210401
50+
- 20210401-20210501
51+
- 20210601-20210701
52+
opentrades:
53+
- 5
54+
runs-on: ubuntu-latest
4655

4756
steps:
4857
- uses: actions/checkout@v2
49-
50-
- name: Backtesting Variables
51-
id: dotenv
52-
uses: falti/[email protected]
5358
with:
54-
log-variables: true
55-
path:
56-
user_data/backtesting-binance.env
59+
submodules: true
5760

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 }}
61+
- name: Build Backtest Image
62+
run: docker-compose build backtesting
6563

66-
- name: Download Data
64+
- name: Run Backtest ${{ matrix.opentrades }} trades ${{ matrix.timerange }}
6765
env:
68-
START_DATE: ${{ steps.dotenv.outputs.start_date }}
69-
END_DATE: ${{ steps.dotenv.outputs.end_date }}
66+
MAX_OPEN_TRADES: ${{ matrix.opentrades }}
67+
STAKE_AMOUNT: unlimited
68+
TIMERANGE: ${{ matrix.timerange }}
7069
EXCHANGE: ${{ steps.dotenv.outputs.exchange }}
71-
run: |
72-
docker-compose run --rm download-data
70+
run: docker-compose run -T --rm backtesting 1> backtest_${{ matrix.timerange }}_${{ matrix.opentrades }}.txt
71+
72+
- name: Show Backtest ${{ matrix.timerange }} ${{ matrix.opentrades }}
73+
run: cat backtest_${{ matrix.timerange }}_${{ matrix.opentrades }}.txt
7374

74-
- name: Upload Cache
75-
if: always()
75+
- name: 'Upload Artifact'
7676
uses: actions/upload-artifact@v2
7777
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 }}
78+
name: backtest_result
79+
path: backtest_${{ matrix.timerange }}_${{ matrix.opentrades }}.txt
12080

121-
Binance-Backtests:
122-
needs:
123-
- Pre-Commit
124-
- Binance-Exchange-Data
81+
Kucoin-Backtests:
12582
strategy:
12683
fail-fast: false
12784
matrix:
@@ -137,25 +94,14 @@ jobs:
13794

13895
steps:
13996
- uses: actions/checkout@v2
140-
141-
- name: Backtesting Variables
142-
id: dotenv
143-
uses: falti/[email protected]
14497
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 }}
98+
submodules: true
15499

155100
- name: Build Backtest Image
156101
run: docker-compose build backtesting
157102

158103
- name: Run Backtest ${{ matrix.opentrades }} trades ${{ matrix.timerange }}
104+
continue-on-error: true
159105
env:
160106
MAX_OPEN_TRADES: ${{ matrix.opentrades }}
161107
STAKE_AMOUNT: unlimited
@@ -172,89 +118,49 @@ jobs:
172118
name: backtest_result
173119
path: backtest_${{ matrix.timerange }}_${{ matrix.opentrades }}.txt
174120

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:
121+
Binance-Backest-Tests:
231122
runs-on: ubuntu-20.04
232123
needs:
233124
- Pre-Commit
234-
- Binance-Exchange-Data
235-
# - Kucoin-Exchange-Data
236125

237126
steps:
238127
- uses: actions/checkout@v2
128+
with:
129+
submodules: true
130+
131+
- name: Build Tests Image
132+
run: docker-compose build tests
133+
134+
- name: Run Tests
135+
env:
136+
EXTRA_ARGS: tests/backtests/binance/
137+
run: |
138+
mkdir artifacts
139+
chmod 777 artifacts
140+
docker-compose run --rm tests
239141
240-
- name: Backtesting Variables
241-
id: dotenv
242-
uses: falti/[email protected]
142+
- name: Upload Artifacts
143+
uses: actions/upload-artifact@v2
243144
with:
244-
log-variables: true
245-
path:
246-
user_data/backtesting-binance.env
145+
name: binance-testrun-artifacts
146+
path: artifacts/
147+
148+
Kucoin-Backest-Tests:
149+
runs-on: ubuntu-20.04
150+
needs:
151+
- Pre-Commit
247152

248-
- name: Download Data Cache
249-
uses: actions/download-artifact@v2
153+
steps:
154+
- uses: actions/checkout@v2
250155
with:
251-
name: exchange-data-${{ steps.dotenv.outputs.exchange }}
252-
path: user_data/data/${{ steps.dotenv.outputs.exchange }}
156+
submodules: true
253157

254158
- name: Build Tests Image
255159
run: docker-compose build tests
256160

257161
- name: Run Tests
162+
env:
163+
EXTRA_ARGS: tests/backtests/kucoin/
258164
run: |
259165
mkdir artifacts
260166
chmod 777 artifacts
@@ -263,5 +169,26 @@ jobs:
263169
- name: Upload Artifacts
264170
uses: actions/upload-artifact@v2
265171
with:
266-
name: testrun-artifacts
172+
name: kucoin-testrun-artifacts
267173
path: artifacts/
174+
175+
Remaining-Tests:
176+
runs-on: ubuntu-20.04
177+
needs:
178+
- Pre-Commit
179+
180+
steps:
181+
- uses: actions/checkout@v2
182+
with:
183+
submodules: true
184+
185+
- name: Build Tests Image
186+
run: docker-compose build tests
187+
188+
- name: Run Tests
189+
env:
190+
EXTRA_ARGS: --ignore tests/backtests/binance/ --ignore tests/backtests/kucoin/
191+
run: |
192+
mkdir artifacts
193+
chmod 777 artifacts
194+
docker-compose run --rm tests

.gitmodules

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[submodule "user_data/data"]
2+
path = user_data/data
3+
url = https://github.com/iterativv/NostalgiaForInfinityData.git
4+
branch = main

README.md

Lines changed: 59 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,35 @@
11
# NostalgiaForInfinity
2-
Trading strategy for the Freqtrade crypto bot
2+
Trading strategy for the [Freqtrade](https://www.freqtrade.io) crypto bot
3+
4+
## Clone The Repository
5+
If you plan to only clone the repository to use the strategy, a regular ``git clone`` will do.
6+
7+
However, if you plan on running additional strategies or run the test suite, you need to clone
8+
the repository and it's submodules.
9+
10+
### Newer versions of Git
11+
12+
```bash
13+
git clone --recurse-submodules https://github.com/iterativv/NostalgiaForInfinity.git checkout-path
14+
```
15+
16+
### Older versions of Git
17+
18+
```bash
19+
git clone --recursive https://github.com/iterativv/NostalgiaForInfinity.git checkout-path
20+
```
21+
22+
### Existing Checkouts
23+
```
24+
git submodule update --remote --recursive
25+
```
26+
327

428
## Change strategy
529

630
Add strategies to the [user_data/strategies](user_data/strategies) folder and also in the [docker-compose.yml](docker-compose.yml) file at `strategy-list` add your strategy in the list.
731

8-
## Test locally
32+
## BackTest locally
933

1034
Install [Docker Compose](https://docs.docker.com/compose/install/).
1135

@@ -15,15 +39,47 @@ Run the backtesting command:
1539
docker-compose run --rm backtesting
1640
```
1741

42+
## Test locally
43+
44+
Install [Docker Compose](https://docs.docker.com/compose/install/).
45+
46+
Run the tests command:
47+
48+
```bash
49+
docker-compose run --rm tests
50+
```
51+
1852
## Configure run
1953

2054
If you want to change `--max-open-trades` or `--stake-amount` or `--timerange` change the [.env](.env) file.
2155

2256

2357
## Update pairs or timeframe
2458

25-
If you want to update pairs [user_data/pairlists.json](user_data/pairlists.json) from `exchange:pair_whitelist` or timeframe from [docker-compose.yml](docker-compose.yml) from `download-data:timerange`, run the following after you changed.
59+
### From the [NostalgiaForInfinityData](https://github.com/iterativv/NostalgiaForInfinityData) repository
60+
```bash
61+
git submodule update --remote --checkout
62+
```
63+
64+
### Locally
65+
66+
If you want to update pairs [user_data/data/pairlists.json](user_data/data/pairlists.json) from `exchange:pair_whitelist` or timeframe from [docker-compose.yml](docker-compose.yml) from `download-data:timerange`, run the following after you changed.
2667

2768
```bash
2869
docker-compose run --rm download-data
2970
```
71+
72+
**Do note that this will update the data locally on the git submodule. But it should still work.**
73+
74+
### Updating Pairs or Timeframe - Long Term
75+
76+
To update either the pair list or the downloaded data time frames, please check
77+
[NostalgiaForInfinityData](https://github.com/iterativv/NostalgiaForInfinityData) and proceed from there.
78+
79+
Once the necessary changes are done in [NostalgiaForInfinityData](https://github.com/iterativv/NostalgiaForInfinityData) run the following:
80+
81+
```bash
82+
git submodule update --remote --merge
83+
```
84+
85+
Now commit the changes and push.

0 commit comments

Comments
 (0)