forked from freqtrade/freqtrade
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbacktest
executable file
·87 lines (74 loc) · 1.34 KB
/
backtest
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/bin/bash
#backtest
uptrend="20210715-20211118"
downtrend="20211118-20220515"
mm2021="20210515-20220515"
up="20210127-20210221"
down="20210509-20210524"
side="20210518-20210610"
__volume='user_data'
function __parse_strategy(){
__config="$__volume/configs/bt/basic.json";
__strategy_cmd="--strategy $1"
case $1 in
Heracles)
__config="$__volume/configs/bt/heracles.json";
shift
;;
GodStra)
__config="$__volume/configs/bt/godstra.json";
shift
;;
*)
shift
;;
esac;
}
__parse_args()
[[ -z ${__parsed_args} ]] && __parsed_args=true || return 0;
__cmd_prefix=;
__timerange=;
__args=();
while [[ $# -gt 0 ]]; do
case $1 in
--echo)
__cmd_prefix=echo;
shift
;;
--strategy)
__parse_strategy $2
shift
shift
;;
--uptrend)
__timerange="--timerange $uptrend"
shift
;;
--downtrend)
__timerange="--timerange $downtrend"
shift
;;
--up)
__timerange="--timerange $up"
shift
;;
--down)
__timerange="--timerange $down"
shift
;;
--side)
__timerange="--timerange $side"
shift
;;
--mm2021)
__timerange="--timerange $mm2021"
shift
;;
*)
__args+=($1);
shift
;;
esac;
done;
__parse_args
${__cmd_prefix} docker-compose run --rm freqtrade backtesting --config ${__config} ${__timerange} $__strategy_cmd ${__args[@]}