mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-11-29 08:33:07 +00:00
Compare commits
3358 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8371003c05 | ||
|
|
cff8498b42 | ||
|
|
fdf6121b6e | ||
|
|
3541f7bfce | ||
|
|
3a2443b5fa | ||
|
|
e488ce0d07 | ||
|
|
521e497ba3 | ||
|
|
c9ee678a52 | ||
|
|
078e25e383 | ||
|
|
a3b0f75289 | ||
|
|
66939bdcf6 | ||
|
|
184a6005a6 | ||
|
|
161c06fd4e | ||
|
|
5d7317ef77 | ||
|
|
aae14dd9fe | ||
|
|
30e3e434ab | ||
|
|
33645e45fd | ||
|
|
27d46ed06f | ||
|
|
02563019fc | ||
|
|
8c9119b471 | ||
|
|
2d02c3f2a4 | ||
|
|
a3e9d04383 | ||
|
|
7f851ad8d9 | ||
|
|
a1c684f67c | ||
|
|
f347e5934a | ||
|
|
e033df6a2f | ||
|
|
b254bdfea3 | ||
|
|
70a0346b0a | ||
|
|
7e23304187 | ||
|
|
926bf07df1 | ||
|
|
6e85280467 | ||
|
|
80ed1c3e14 | ||
|
|
1ae3fb4d2f | ||
|
|
3f2542fcbc | ||
|
|
f6278da23f | ||
|
|
a3ac05cc16 | ||
|
|
a97bb10877 | ||
|
|
bd4dd8403b | ||
|
|
52f0ed5310 | ||
|
|
f4c7edf551 | ||
|
|
82797e768f | ||
|
|
9176064047 | ||
|
|
aad10ceee3 | ||
|
|
58ceda4b90 | ||
|
|
f36bc80ad1 | ||
|
|
2b4d821d30 | ||
|
|
8a940eb0c1 | ||
|
|
9c2f21b07e | ||
|
|
055f3fd1fd | ||
|
|
40843566d0 | ||
|
|
e13045b599 | ||
|
|
7d2d0235a0 | ||
|
|
bff0a09537 | ||
|
|
c1c2717bc9 | ||
|
|
66415d48d4 | ||
|
|
d54b1dade3 | ||
|
|
1bf475fa1a | ||
|
|
099bbc5c7f | ||
|
|
6e3336cb30 | ||
|
|
eb6c7f8595 | ||
|
|
10a706851a | ||
|
|
8d4515935a | ||
|
|
9474cb1792 | ||
|
|
2f82122fc4 | ||
|
|
889929f782 | ||
|
|
fa1e9dd70d | ||
|
|
29a5e4fba1 | ||
|
|
a20f502159 | ||
|
|
8bcfe4a6aa | ||
|
|
854bb0056b | ||
|
|
90ed4c665b | ||
|
|
d1bf388b0e | ||
|
|
6feb68b18d | ||
|
|
09621b3ef1 | ||
|
|
f73f0b1653 | ||
|
|
f7f56f5eda | ||
|
|
c8806a16a1 | ||
|
|
4013701bdb | ||
|
|
4c823f12e3 | ||
|
|
1e58cd70ad | ||
|
|
bea4ad8eff | ||
|
|
d7957bd791 | ||
|
|
425ec53b28 | ||
|
|
797dc8a4da | ||
|
|
d12a2a5888 | ||
|
|
845e27542a | ||
|
|
c67b253099 | ||
|
|
154fff7d02 | ||
|
|
82fd6e6fb3 | ||
|
|
b3938a86c3 | ||
|
|
2f8ed7ed19 | ||
|
|
af36635769 | ||
|
|
495728f502 | ||
|
|
5dccd01fb7 | ||
|
|
5fcab1eee8 | ||
|
|
b60d7ad42f | ||
|
|
fa1f9bcdbd | ||
|
|
53abfdbcbf | ||
|
|
3519cebf66 | ||
|
|
a7246ba1ec | ||
|
|
60b47b6eec | ||
|
|
ca2880537d | ||
|
|
13274964a9 | ||
|
|
235a10ab86 | ||
|
|
5faebad863 | ||
|
|
90a9052377 | ||
|
|
d3de398395 | ||
|
|
83b88e7916 | ||
|
|
3faa2d0eb9 | ||
|
|
fab19ae3a7 | ||
|
|
e94dfdeff2 | ||
|
|
9713dc8d94 | ||
|
|
b748ed3435 | ||
|
|
7c7f7b9ece | ||
|
|
785cd2a640 | ||
|
|
c475729c13 | ||
|
|
989ab646a9 | ||
|
|
7461b5dc02 | ||
|
|
135487b2c9 | ||
|
|
b25f28d1ad | ||
|
|
cee8f3349e | ||
|
|
9559cb988e | ||
|
|
db34cb1b75 | ||
|
|
c9b0b4c7a4 | ||
|
|
c3fd894a6c | ||
|
|
9f2d397e1f | ||
|
|
7719d8fbea | ||
|
|
3883d18b8a | ||
|
|
2b3f2e5fa8 | ||
|
|
5ae554bdff | ||
|
|
6ac7dcf5e9 | ||
|
|
6da97fafa8 | ||
|
|
6d4fe94285 | ||
|
|
b27f3b8f2c | ||
|
|
ed29232478 | ||
|
|
3c0d184097 | ||
|
|
d846114d3c | ||
|
|
aabeece4c0 | ||
|
|
b614964ba9 | ||
|
|
888ea58df2 | ||
|
|
d0ccfa1925 | ||
|
|
ca054799d0 | ||
|
|
b37f34ff5b | ||
|
|
a75420f75f | ||
|
|
7daa5bc338 | ||
|
|
53499e01de | ||
|
|
bdda620397 | ||
|
|
b5a806dec7 | ||
|
|
4628024de6 | ||
|
|
f04873b0b0 | ||
|
|
5853b9904c | ||
|
|
5d5074ac9c | ||
|
|
84ef588163 | ||
|
|
d1cda3991c | ||
|
|
24aa596e3c | ||
|
|
3798f94d4c | ||
|
|
75dcc369c0 | ||
|
|
e1f89e3ad3 | ||
|
|
7e7c82cf4a | ||
|
|
71dd038664 | ||
|
|
55041878ae | ||
|
|
0dd274917f | ||
|
|
f3beaa3374 | ||
|
|
6d01653bfe | ||
|
|
455838648d | ||
|
|
3c7981160c | ||
|
|
4ac1ac7ef5 | ||
|
|
776fc56265 | ||
|
|
a8d56b2850 | ||
|
|
11059e532b | ||
|
|
da1fea6582 | ||
|
|
3315f994b6 | ||
|
|
560aea876e | ||
|
|
b24d359a27 | ||
|
|
90744ff5ab | ||
|
|
b48bf035f6 | ||
|
|
c13c11cfa1 | ||
|
|
6e615998c0 | ||
|
|
94afb7cb1d | ||
|
|
bfef3cf497 | ||
|
|
cba156dfff | ||
|
|
64db1f6736 | ||
|
|
a47a25ca88 | ||
|
|
88efa4065b | ||
|
|
f15e5e9d57 | ||
|
|
2ccdb67e4d | ||
|
|
1b8943ac54 | ||
|
|
9382b38c41 | ||
|
|
22fcf7b4dc | ||
|
|
20fc3b7978 | ||
|
|
9325880fe5 | ||
|
|
cac0e37b06 | ||
|
|
2c8e8d8ef6 | ||
|
|
6fbdd6bee9 | ||
|
|
e89fa44680 | ||
|
|
a9fbad0741 | ||
|
|
8cc48cf4b0 | ||
|
|
10ee23622a | ||
|
|
904e1647e1 | ||
|
|
caec345c0b | ||
|
|
18a53f4467 | ||
|
|
6dfde99cbe | ||
|
|
21418e2988 | ||
|
|
4475110df8 | ||
|
|
0ea44b0143 | ||
|
|
3327ebf2b1 | ||
|
|
26a2395aeb | ||
|
|
9d518b9d29 | ||
|
|
6ebb9017c7 | ||
|
|
a88464de3a | ||
|
|
fd7af587da | ||
|
|
84918ad424 | ||
|
|
2537b8cb0c | ||
|
|
78883663a0 | ||
|
|
b00406a7eb | ||
|
|
4d56e3b36e | ||
|
|
8e9a3e8fc8 | ||
|
|
1ffda29fd2 | ||
|
|
024aa3ab6b | ||
|
|
20abf67779 | ||
|
|
fb3a53b8af | ||
|
|
4c9295fe2d | ||
|
|
6a7163d3a9 | ||
|
|
de23f3928d | ||
|
|
8975e38b1d | ||
|
|
20a132651f | ||
|
|
88ba7e467d | ||
|
|
df7ceb4ccb | ||
|
|
47bb8ad0d4 | ||
|
|
304d15e236 | ||
|
|
d1c45cf3f8 | ||
|
|
04f28ed9bc | ||
|
|
ce84f74528 | ||
|
|
762604300f | ||
|
|
433fd2a7c3 | ||
|
|
09b77d9f14 | ||
|
|
5c39ebd0a0 | ||
|
|
004993583b | ||
|
|
443fd8f7dd | ||
|
|
b2fb28453f | ||
|
|
fc98cf0037 | ||
|
|
6db75bc244 | ||
|
|
d6ca562b03 | ||
|
|
3dbd83e35a | ||
|
|
8eeabd2372 | ||
|
|
ed9cb4219d | ||
|
|
ef92fd775c | ||
|
|
abaeab89aa | ||
|
|
243bcb2368 | ||
|
|
86f2693040 | ||
|
|
b6d1c5b17a | ||
|
|
039dfc302c | ||
|
|
56fd714de2 | ||
|
|
e51ac2c973 | ||
|
|
cadde3ab6d | ||
|
|
9987e64e8c | ||
|
|
98647b490c | ||
|
|
32118cc1cb | ||
|
|
63f41cf1c6 | ||
|
|
e5aed098b5 | ||
|
|
5e6e625694 | ||
|
|
a95454d338 | ||
|
|
ad75048678 | ||
|
|
402c761a23 | ||
|
|
66f9ece061 | ||
|
|
27b8617077 | ||
|
|
2ab989e274 | ||
|
|
5a11ca86bb | ||
|
|
25e6d6a7bf | ||
|
|
eb1040ddb7 | ||
|
|
a68445692b | ||
|
|
48935d2932 | ||
|
|
83ed0b38c1 | ||
|
|
90670e7401 | ||
|
|
a105e5664a | ||
|
|
b8442d536a | ||
|
|
6688a2c112 | ||
|
|
33cfeaf9b0 | ||
|
|
f487dac047 | ||
|
|
690eb2a52b | ||
|
|
20b52fcef9 | ||
|
|
0ac5e5035c | ||
|
|
c6b9c8eca0 | ||
|
|
ecbb77c17f | ||
|
|
bb8acc61db | ||
|
|
90cabd7c21 | ||
|
|
c6d2233978 | ||
|
|
6d5aca4f32 | ||
|
|
248ef5a0ea | ||
|
|
560acb7cea | ||
|
|
5fefa9e97c | ||
|
|
1c5f8070e5 | ||
|
|
506907ddc9 | ||
|
|
84f0f451a0 | ||
|
|
fa466a54cd | ||
|
|
3c668c2f8e | ||
|
|
779278ed50 | ||
|
|
96f70118ca | ||
|
|
4e62b62add | ||
|
|
9cfbe98a23 | ||
|
|
31a7e9feed | ||
|
|
20ad8a379d | ||
|
|
8f17b81329 | ||
|
|
76a93fabc7 | ||
|
|
98eed4f2ed | ||
|
|
2195ae59d6 | ||
|
|
4f88857442 | ||
|
|
01d53c0160 | ||
|
|
d98cd6f135 | ||
|
|
dc567f99d6 | ||
|
|
ffd7034c00 | ||
|
|
43c25c8a32 | ||
|
|
a71deeda94 | ||
|
|
89b4f45fe3 | ||
|
|
9835312033 | ||
|
|
1ff0d0f1fa | ||
|
|
1a73159200 | ||
|
|
c417877eb8 | ||
|
|
9ec4368c6f | ||
|
|
3f44d51355 | ||
|
|
95bd9e8e0b | ||
|
|
bc92503c92 | ||
|
|
5ba106d96b | ||
|
|
fc5764f9df | ||
|
|
342f3f450b | ||
|
|
0c6b5e01fb | ||
|
|
6507a26cc1 | ||
|
|
e72c6a0d94 | ||
|
|
834a0ed620 | ||
|
|
1af962899d | ||
|
|
11e787c884 | ||
|
|
1c19856d26 | ||
|
|
d73ba71ec6 | ||
|
|
dc07037edf | ||
|
|
21622ac313 | ||
|
|
ce190a7485 | ||
|
|
cf4c3642ce | ||
|
|
021fa1ca1a | ||
|
|
3a542bce62 | ||
|
|
c5e6a34f25 | ||
|
|
1537389617 | ||
|
|
b07d29b1af | ||
|
|
b2796f99b6 | ||
|
|
bbb05b5286 | ||
|
|
60f89c8c01 | ||
|
|
8513a5e2d6 | ||
|
|
69f8738d00 | ||
|
|
c32507252e | ||
|
|
2e2f084f66 | ||
|
|
e1c0c6af7d | ||
|
|
86de88ed48 | ||
|
|
1042f9847a | ||
|
|
a2964afd42 | ||
|
|
539b5627fd | ||
|
|
cbd10309f5 | ||
|
|
362a40db6f | ||
|
|
861a7834fc | ||
|
|
307ade6251 | ||
|
|
0b5354f13d | ||
|
|
707c5668a5 | ||
|
|
0277cd82ea | ||
|
|
9cea5cd442 | ||
|
|
a6fc743d85 | ||
|
|
fa968996ed | ||
|
|
4cd45b6535 | ||
|
|
2af9ffa7f2 | ||
|
|
39197458f4 | ||
|
|
35bbe12065 | ||
|
|
9add86144c | ||
|
|
03c8d65d07 | ||
|
|
75e6acd6ed | ||
|
|
95b4189d69 | ||
|
|
22dd91fc21 | ||
|
|
700370ac5c | ||
|
|
05de60a7fe | ||
|
|
cc41cdbf22 | ||
|
|
c05af1b63c | ||
|
|
33db37a915 | ||
|
|
e398c37526 | ||
|
|
655672c957 | ||
|
|
2282f4bd37 | ||
|
|
ce845ab092 | ||
|
|
b5b6458f12 | ||
|
|
56e13c8919 | ||
|
|
23d467eb0d | ||
|
|
c741b67c3c | ||
|
|
5a5741878c | ||
|
|
4463d58470 | ||
|
|
f0bbc75038 | ||
|
|
7c53dcb0af | ||
|
|
fda8f7e305 | ||
|
|
52b212db64 | ||
|
|
931d24b5a8 | ||
|
|
18dfa56752 | ||
|
|
26ab108890 | ||
|
|
1cc174c007 | ||
|
|
e26f563f4b | ||
|
|
ebd0a1722d | ||
|
|
f81c49ce6d | ||
|
|
ded2d3c293 | ||
|
|
2f7181e236 | ||
|
|
2275a1539e | ||
|
|
f2266ea9f4 | ||
|
|
82ff878e38 | ||
|
|
7200bc3fba | ||
|
|
a48c0ad868 | ||
|
|
e4cc5c479f | ||
|
|
014c18ead2 | ||
|
|
3bd873f3c6 | ||
|
|
6c4f424887 | ||
|
|
04257d8ecc | ||
|
|
b69f5afaaf | ||
|
|
5db883906a | ||
|
|
703924d6c4 | ||
|
|
330b8cf8a1 | ||
|
|
6e778ad710 | ||
|
|
f44e3dc319 | ||
|
|
d8b2d39f2f | ||
|
|
7c7ca1cb90 | ||
|
|
1058e5fb72 | ||
|
|
b2a9b87be3 | ||
|
|
3f9f29ba4e | ||
|
|
390db9503f | ||
|
|
3448f86263 | ||
|
|
3252654ed3 | ||
|
|
29745bb4ec | ||
|
|
641e3fdf7a | ||
|
|
2f76eaf358 | ||
|
|
0e4ef33d6a | ||
|
|
18c73ceb90 | ||
|
|
8431b54b21 | ||
|
|
5fc357ee10 | ||
|
|
de33ec4250 | ||
|
|
a9f7e9fb7a | ||
|
|
aa335d8485 | ||
|
|
82f7798f48 | ||
|
|
ce80bbe24c | ||
|
|
da195d0272 | ||
|
|
4eae02b723 | ||
|
|
081b21fe82 | ||
|
|
ed053d240e | ||
|
|
0ca3157a8b | ||
|
|
25447329a0 | ||
|
|
4934456751 | ||
|
|
0f4dcaa403 | ||
|
|
4b560880fd | ||
|
|
dc9fed4a5f | ||
|
|
88a24da272 | ||
|
|
e4655c9b07 | ||
|
|
1495c93083 | ||
|
|
21c6855705 | ||
|
|
a7d6dc9d3a | ||
|
|
ed7207d4c8 | ||
|
|
bb9235c715 | ||
|
|
45d12dbc83 | ||
|
|
189835b963 | ||
|
|
3163cbdf8a | ||
|
|
1e6f9f9fe2 | ||
|
|
3091869115 | ||
|
|
9e85376a2d | ||
|
|
a379c19e9a | ||
|
|
2bd4008cb2 | ||
|
|
d21ae4edd3 | ||
|
|
1da008b3af | ||
|
|
703458f365 | ||
|
|
4b0a4c936a | ||
|
|
216094a761 | ||
|
|
4efd8b96e5 | ||
|
|
b61f43835d | ||
|
|
017a94adc1 | ||
|
|
b20bea8492 | ||
|
|
54694dd3a4 | ||
|
|
8dd9b5c6fb | ||
|
|
16a50fbe4e | ||
|
|
32897ce769 | ||
|
|
51f074ba4b | ||
|
|
0ba804d051 | ||
|
|
611a594a46 | ||
|
|
8a7fe3f1d6 | ||
|
|
054484ad73 | ||
|
|
ac3e061508 | ||
|
|
ddf86d6342 | ||
|
|
ba29a2ffe4 | ||
|
|
b33e47a49e | ||
|
|
298e8b2332 | ||
|
|
78f8ba1226 | ||
|
|
17e03559dc | ||
|
|
2825206d37 | ||
|
|
cd20d5b5c5 | ||
|
|
ebf6dad3f6 | ||
|
|
683406b57d | ||
|
|
406dfe21f8 | ||
|
|
346d381ab8 | ||
|
|
d7980fa0b6 | ||
|
|
fc7b9846ae | ||
|
|
15e695a9bd | ||
|
|
110fbd3f06 | ||
|
|
f0428be91e | ||
|
|
0b03c6c786 | ||
|
|
150a497cb4 | ||
|
|
3d666ea68e | ||
|
|
ee733210ca | ||
|
|
86342efa7a | ||
|
|
05967442c3 | ||
|
|
d6b587678e | ||
|
|
668d42447f | ||
|
|
32c9b5f415 | ||
|
|
f42ce8fc2a | ||
|
|
6b142d716f | ||
|
|
26a7af85ea | ||
|
|
69b0767165 | ||
|
|
f862b4d0f0 | ||
|
|
a88bfa8ded | ||
|
|
fffd47e3d8 | ||
|
|
7a3c3c4ddf | ||
|
|
eafccb445c | ||
|
|
b040cbffdd | ||
|
|
153434561d | ||
|
|
36b2ed172c | ||
|
|
58d70b2079 | ||
|
|
e0e0bad7c1 | ||
|
|
0e9e6b3443 | ||
|
|
9199fd5964 | ||
|
|
8f9b5095b5 | ||
|
|
5b996920f2 | ||
|
|
bcec070ad7 | ||
|
|
c3d7411668 | ||
|
|
997c426228 | ||
|
|
7a52334c9f | ||
|
|
111f018c85 | ||
|
|
64da877161 | ||
|
|
f0e6a9e0e3 | ||
|
|
a373e48939 | ||
|
|
f2cd4fdafe | ||
|
|
9991c892ac | ||
|
|
8e7512161a | ||
|
|
5e09913e3d | ||
|
|
cceb00c406 | ||
|
|
585b8332ad | ||
|
|
066f324060 | ||
|
|
8e1e20bf0d | ||
|
|
0ac592ad40 | ||
|
|
17269c88be | ||
|
|
8204107315 | ||
|
|
9e7d367b5c | ||
|
|
12b9257c6d | ||
|
|
37f698d9c1 | ||
|
|
e7c17df844 | ||
|
|
28ec8b5bc2 | ||
|
|
200b8e48bf | ||
|
|
2a8ad9e35b | ||
|
|
be8ad0f022 | ||
|
|
a77efc3949 | ||
|
|
418ca00305 | ||
|
|
03f02294d1 | ||
|
|
0a7a1290e3 | ||
|
|
28f73ecb3d | ||
|
|
6ab7f93ce7 | ||
|
|
d1511a1085 | ||
|
|
0775ac081a | ||
|
|
646a9d12b2 | ||
|
|
e7be742c58 | ||
|
|
8d002a8f28 | ||
|
|
af3eea3805 | ||
|
|
4dc0631a4b | ||
|
|
a3415e52c0 | ||
|
|
1b337fe5e1 | ||
|
|
50350a09cd | ||
|
|
1bf8d8cff3 | ||
|
|
62d50f512d | ||
|
|
8c64be3cfd | ||
|
|
cc0a733f1f | ||
|
|
1b645d64c8 | ||
|
|
a374df7622 | ||
|
|
cbf710a4f8 | ||
|
|
f05818a86e | ||
|
|
cab748588c | ||
|
|
63ad95a474 | ||
|
|
e9da4d8505 | ||
|
|
26a2292f6d | ||
|
|
5fb14e769b | ||
|
|
c7c7a1c2aa | ||
|
|
1242263d25 | ||
|
|
31c598f88a | ||
|
|
6cb4830534 | ||
|
|
067267f4cf | ||
|
|
99db53417c | ||
|
|
737c07c5b6 | ||
|
|
097cdcb57a | ||
|
|
175591e524 | ||
|
|
e7ddd81251 | ||
|
|
a183162d8b | ||
|
|
a6bb7595e8 | ||
|
|
210d468a9b | ||
|
|
5f8fcebb88 | ||
|
|
f23f659ac5 | ||
|
|
99eeb2e605 | ||
|
|
f26171082c | ||
|
|
2acd2542ac | ||
|
|
f26c40082d | ||
|
|
b3dbb81838 | ||
|
|
5e5ef21f61 | ||
|
|
be4a4180ae | ||
|
|
f7322358cf | ||
|
|
671b98ecad | ||
|
|
ed04f7f39d | ||
|
|
cbb187e9b9 | ||
|
|
03cdfe8cae | ||
|
|
37f8139432 | ||
|
|
79891671e9 | ||
|
|
65489c894d | ||
|
|
b36a1d3260 | ||
|
|
8a1d02e185 | ||
|
|
8c2ff2f46e | ||
|
|
e492d47621 | ||
|
|
98baae9456 | ||
|
|
e3cf6188a1 | ||
|
|
8cf8ab089e | ||
|
|
ed1d450099 | ||
|
|
41494f28da | ||
|
|
19b1a6c638 | ||
|
|
471bd4d889 | ||
|
|
084efc98d7 | ||
|
|
1d2ef5c2ce | ||
|
|
fd45ebd0e9 | ||
|
|
258d4bd6ae | ||
|
|
b8aa727edf | ||
|
|
eac01960a7 | ||
|
|
a5bd4e329a | ||
|
|
5ce665f279 | ||
|
|
9aac080414 | ||
|
|
8b639b5026 | ||
|
|
7f119a28e7 | ||
|
|
5f88c4aad9 | ||
|
|
dfe3d78767 | ||
|
|
633996216a | ||
|
|
09b302abf7 | ||
|
|
c92f233c15 | ||
|
|
751157b4ea | ||
|
|
5f62a9e4d8 | ||
|
|
a8855bf795 | ||
|
|
c22b00b303 | ||
|
|
67c5115b41 | ||
|
|
ab4b1cc8fe | ||
|
|
716785c65f | ||
|
|
baa7fd6c79 | ||
|
|
9045f796e0 | ||
|
|
988c1744af | ||
|
|
cd6d276119 | ||
|
|
d085a2bd3e | ||
|
|
dddccf8f1a | ||
|
|
8b3fb3d6d5 | ||
|
|
80b450d4e6 | ||
|
|
0bc71403ff | ||
|
|
cb6b3e17a9 | ||
|
|
e7157faddd | ||
|
|
a33d408780 | ||
|
|
42474b7144 | ||
|
|
933564591d | ||
|
|
599e18b920 | ||
|
|
547d65b065 | ||
|
|
e4e8a611be | ||
|
|
2b190e5638 | ||
|
|
acab56793f | ||
|
|
2c976bdd24 | ||
|
|
3aee8d2b2a | ||
|
|
841c379797 | ||
|
|
b6a12044ba | ||
|
|
8e087cb639 | ||
|
|
bcb5913291 | ||
|
|
be53c0885d | ||
|
|
91047830fd | ||
|
|
6e0655b3b7 | ||
|
|
edc0d7f2c7 | ||
|
|
1d18e0a11a | ||
|
|
b167fb071a | ||
|
|
3b9899dfd4 | ||
|
|
f94d46316e | ||
|
|
569a547b3f | ||
|
|
6c306c0013 | ||
|
|
9b050523e9 | ||
|
|
f9a92c2879 | ||
|
|
ab194c7d75 | ||
|
|
904a9c5dc7 | ||
|
|
38243c52fd | ||
|
|
c8c48156dd | ||
|
|
f4d18034d9 | ||
|
|
17c11b2afa | ||
|
|
68904296e7 | ||
|
|
d4499338e0 | ||
|
|
6174a5dd55 | ||
|
|
e26bbc7de8 | ||
|
|
62c1ff776e | ||
|
|
baea06eac7 | ||
|
|
6ac73f7cde | ||
|
|
66619204ba | ||
|
|
1d7fb2ffac | ||
|
|
c42c5a1f85 | ||
|
|
5b62ad876e | ||
|
|
ec460ab9c9 | ||
|
|
2eb6513251 | ||
|
|
c449e39280 | ||
|
|
1c57a4ac35 | ||
|
|
334ac8b10c | ||
|
|
d801dec6aa | ||
|
|
08aedc18e1 | ||
|
|
e4bdb92521 | ||
|
|
11f7ab61b9 | ||
|
|
df9bfb6c2e | ||
|
|
ab9506df48 | ||
|
|
136ef077b2 | ||
|
|
e8a8f416f3 | ||
|
|
8c76f45030 | ||
|
|
96f550c6aa | ||
|
|
37ef5c38f0 | ||
|
|
66a273b31b | ||
|
|
52e24c3a25 | ||
|
|
7a2d917c66 | ||
|
|
025350ebff | ||
|
|
411e035005 | ||
|
|
800997437a | ||
|
|
75d5ff69ef | ||
|
|
a241c2af0d | ||
|
|
d1729a624d | ||
|
|
e51a720193 | ||
|
|
ff1d36434d | ||
|
|
904ae5af91 | ||
|
|
42e8e1c16a | ||
|
|
9fb493d2f4 | ||
|
|
031157f215 | ||
|
|
c65d217d1e | ||
|
|
0a13f7e1c7 | ||
|
|
173375de7c | ||
|
|
27d81bb68c | ||
|
|
044105e8e0 | ||
|
|
48f8a62335 | ||
|
|
71f99ba79c | ||
|
|
95492958f9 | ||
|
|
661c8251c5 | ||
|
|
83067c1edc | ||
|
|
c5ed004c9e | ||
|
|
04b51a982e | ||
|
|
e810597eec | ||
|
|
692d6afbd9 | ||
|
|
59fa02e11a | ||
|
|
6ef6a24841 | ||
|
|
eba55c2783 | ||
|
|
085aa3084e | ||
|
|
de2d04f06b | ||
|
|
12654cb810 | ||
|
|
4b15873ee1 | ||
|
|
748fe94603 | ||
|
|
86a5dfa62e | ||
|
|
0b4800835c | ||
|
|
5caeca7509 | ||
|
|
7ff61f12e9 | ||
|
|
ae35649366 | ||
|
|
a01b34a004 | ||
|
|
02b9da8aba | ||
|
|
ed0c7a6aaf | ||
|
|
25cb935eee | ||
|
|
c74d766275 | ||
|
|
37985310d5 | ||
|
|
c3b4a4dde1 | ||
|
|
d7262c0b4e | ||
|
|
870966dcd0 | ||
|
|
85beb3b6a9 | ||
|
|
bf69b055eb | ||
|
|
31c7189b8b | ||
|
|
eaf3fd80c5 | ||
|
|
1059586226 | ||
|
|
b610e8c7e6 | ||
|
|
e632720c02 | ||
|
|
1f042f5e32 | ||
|
|
54b63e89f8 | ||
|
|
3f65c31883 | ||
|
|
31ab32f0b9 | ||
|
|
bc5c91f681 | ||
|
|
076ef0407b | ||
|
|
b0150d548a | ||
|
|
60acbc97ab | ||
|
|
dd47bd04cd | ||
|
|
da57396d07 | ||
|
|
d3a3765819 | ||
|
|
f90676cfc5 | ||
|
|
ad2289c34c | ||
|
|
ca77dbe8da | ||
|
|
6c6efd7214 | ||
|
|
7f099d41fa | ||
|
|
60109aaa1f | ||
|
|
ef057c16cb | ||
|
|
39e728a7c2 | ||
|
|
28f0c00281 | ||
|
|
bc78316aa5 | ||
|
|
b8a6c55b10 | ||
|
|
6df1dd1ef2 | ||
|
|
c8638ce82f | ||
|
|
1a61d89bcc | ||
|
|
eb0b0350e0 | ||
|
|
4ec7fcd836 | ||
|
|
f6a66cd3de | ||
|
|
871019c8b9 | ||
|
|
581907305a | ||
|
|
54b0fbca59 | ||
|
|
1e44f93c31 | ||
|
|
3eca80217c | ||
|
|
6f01d7f8ea | ||
|
|
500d16620b | ||
|
|
6550e1fa99 | ||
|
|
80ad37ad93 | ||
|
|
3287cdd47a | ||
|
|
12e86ee4bd | ||
|
|
97d0f93d3c | ||
|
|
861f10dca6 | ||
|
|
2a1385f94b | ||
|
|
e9af6b393f | ||
|
|
2124661cee | ||
|
|
1593847203 | ||
|
|
e8a08011be | ||
|
|
691cec7956 | ||
|
|
241d947564 | ||
|
|
880834b902 | ||
|
|
f435384bf0 | ||
|
|
3149c12a14 | ||
|
|
6a9a2e7f88 | ||
|
|
5b87393a95 | ||
|
|
5a27b10579 | ||
|
|
a80e49bd81 | ||
|
|
ffed13b979 | ||
|
|
9f0f1096e1 | ||
|
|
9a42afe0be | ||
|
|
b6616d7a13 | ||
|
|
7be378aaa9 | ||
|
|
734a9d5d87 | ||
|
|
ce6b869f84 | ||
|
|
dc5f1b2878 | ||
|
|
a041b8bf72 | ||
|
|
4fa12ffda0 | ||
|
|
5dcf28cafb | ||
|
|
365a408df5 | ||
|
|
7204227022 | ||
|
|
dab4ab78fc | ||
|
|
a74b941b72 | ||
|
|
89bba6f776 | ||
|
|
82f86569ee | ||
|
|
9e988783de | ||
|
|
bba8e61409 | ||
|
|
dee9b84322 | ||
|
|
ad98d61939 | ||
|
|
14758dbe10 | ||
|
|
d89a7d5235 | ||
|
|
640423c362 | ||
|
|
fd9c02603c | ||
|
|
44289e4c58 | ||
|
|
6928c685a8 | ||
|
|
dd408aa5d6 | ||
|
|
dac88c6aed | ||
|
|
78fe5a46c1 | ||
|
|
7a96d3c9ae | ||
|
|
b7b1e66c6e | ||
|
|
5ed7771148 | ||
|
|
c2076d86a4 | ||
|
|
b37c5e4878 | ||
|
|
26a5800a7f | ||
|
|
01efebc42f | ||
|
|
ab117527c9 | ||
|
|
f20f5cebbe | ||
|
|
0c3a8ddfb9 | ||
|
|
669a6cf119 | ||
|
|
6fe7b13e37 | ||
|
|
9c180e587b | ||
|
|
a368646745 | ||
|
|
de2cc58b0c | ||
|
|
d803d86f4d | ||
|
|
5254059fe4 | ||
|
|
d706571e6f | ||
|
|
907baea8b2 | ||
|
|
062536438e | ||
|
|
4ff035537b | ||
|
|
466a3b87fc | ||
|
|
b947f3c2a5 | ||
|
|
069da224bc | ||
|
|
e82460bde6 | ||
|
|
61c037f2cf | ||
|
|
f98290ba6e | ||
|
|
73343b3387 | ||
|
|
3a6020dcd7 | ||
|
|
596a269dfd | ||
|
|
7329fce87c | ||
|
|
4059116787 | ||
|
|
1561322af2 | ||
|
|
44d0a6f2b8 | ||
|
|
60b99469b9 | ||
|
|
46b975a491 | ||
|
|
70ad909b16 | ||
|
|
2af3ce3ecc | ||
|
|
132a4da7cf | ||
|
|
73f5bff9c5 | ||
|
|
223f0cd4d3 | ||
|
|
c4cb098d14 | ||
|
|
2bc74882e9 | ||
|
|
2ba388074e | ||
|
|
33164ac78e | ||
|
|
86624411c6 | ||
|
|
5cdae17d19 | ||
|
|
bd4a23beeb | ||
|
|
5c2682e2c9 | ||
|
|
6382a4cd04 | ||
|
|
704121c197 | ||
|
|
9c7696a8ce | ||
|
|
9e7e051eb4 | ||
|
|
616fe08bce | ||
|
|
141c454187 | ||
|
|
17fce00a5e | ||
|
|
0b8d04d75e | ||
|
|
e5487441ba | ||
|
|
48d83715a5 | ||
|
|
8b4fea4b71 | ||
|
|
4c1f0c3c59 | ||
|
|
13ae339a2e | ||
|
|
73a03565e5 | ||
|
|
bf20f3b7d8 | ||
|
|
20dabd9c41 | ||
|
|
32df73c056 | ||
|
|
ef1885c38b | ||
|
|
f5351e60e7 | ||
|
|
bfec9d974b | ||
|
|
3a7553eef6 | ||
|
|
d0521d33ce | ||
|
|
9155598ca4 | ||
|
|
ea6b94fd0c | ||
|
|
2a95d6855b | ||
|
|
3929ad4e1f | ||
|
|
2f1d9696cd | ||
|
|
2e896462c1 | ||
|
|
e63377980e | ||
|
|
41f97a73c9 | ||
|
|
0773a65333 | ||
|
|
8201f70a80 | ||
|
|
45b83cc544 | ||
|
|
b3e028e853 | ||
|
|
74b2f11d4f | ||
|
|
514e073c57 | ||
|
|
59e881c59d | ||
|
|
2e1e080022 | ||
|
|
13255b370c | ||
|
|
e1edf36307 | ||
|
|
470efd6f40 | ||
|
|
6640f4a1b2 | ||
|
|
e408274fb3 | ||
|
|
4ce278a06e | ||
|
|
a135eaa993 | ||
|
|
87ff7be550 | ||
|
|
7441300270 | ||
|
|
b4f4fae0ca | ||
|
|
336808ec54 | ||
|
|
b26faa13bd | ||
|
|
562e4e63de | ||
|
|
ad5f7e1581 | ||
|
|
3cf95f9f6c | ||
|
|
f0710cafd0 | ||
|
|
73fa5bae96 | ||
|
|
a43d436f98 | ||
|
|
ff5ba64385 | ||
|
|
7e38a07490 | ||
|
|
8872158a6a | ||
|
|
db3e789294 | ||
|
|
4813ff338b | ||
|
|
fbd7dc1d6c | ||
|
|
f07b26f245 | ||
|
|
3acc10dd48 | ||
|
|
e5f06c201f | ||
|
|
bf20cde83d | ||
|
|
364859394b | ||
|
|
657f1b6c45 | ||
|
|
e350bcc2ef | ||
|
|
c2566f2436 | ||
|
|
cac314d4b3 | ||
|
|
b116cc75c4 | ||
|
|
bedbd964fc | ||
|
|
1c503f39b2 | ||
|
|
ca4d0067e4 | ||
|
|
8a0d90136c | ||
|
|
5b680f2ece | ||
|
|
1bc63288a3 | ||
|
|
45b2d24b79 | ||
|
|
10ca249293 | ||
|
|
d6b6ded8bd | ||
|
|
2d34c0f52d | ||
|
|
f3cfe147b5 | ||
|
|
a52366c45d | ||
|
|
88c91a8a54 | ||
|
|
14755779de | ||
|
|
20dd3f2d67 | ||
|
|
8a31b4c646 | ||
|
|
78cd75dfef | ||
|
|
b805e4e150 | ||
|
|
df43b1f533 | ||
|
|
6e938b59c8 | ||
|
|
4f17511fdc | ||
|
|
d8630ef847 | ||
|
|
47fabca1d9 | ||
|
|
c48876b196 | ||
|
|
16e10d99b9 | ||
|
|
0adcee9233 | ||
|
|
f41c659cb2 | ||
|
|
4c977b2e01 | ||
|
|
b152585d9b | ||
|
|
fd22c87295 | ||
|
|
93b213ae0b | ||
|
|
30eb23e1aa | ||
|
|
4ec83a2c24 | ||
|
|
9e23ca14d1 | ||
|
|
ebf5738a6e | ||
|
|
c649f9844e | ||
|
|
3208f30c30 | ||
|
|
5e731ec278 | ||
|
|
e55b2a1a1c | ||
|
|
ed8d805797 | ||
|
|
0ebf2e44be | ||
|
|
00a95945e1 | ||
|
|
9d739f98ac | ||
|
|
2588990f4b | ||
|
|
271846dfb6 | ||
|
|
c181fac6c7 | ||
|
|
0ac46eddca | ||
|
|
c735d35265 | ||
|
|
e957894852 | ||
|
|
369335b80c | ||
|
|
2ebddcf45c | ||
|
|
8564affdf0 | ||
|
|
a39d51d7d0 | ||
|
|
750dc8bf56 | ||
|
|
033742b708 | ||
|
|
84ba431d10 | ||
|
|
b6e26c82ea | ||
|
|
e8eb968a6f | ||
|
|
66605a1909 | ||
|
|
1e61263a28 | ||
|
|
bd08874f1f | ||
|
|
ff6a3465a7 | ||
|
|
5b58141f6b | ||
|
|
bf4e9a5dbb | ||
|
|
837d4d82b4 | ||
|
|
a8ffd29e18 | ||
|
|
92fda0f76c | ||
|
|
df62dd65d3 | ||
|
|
d72d388726 | ||
|
|
fda71085e0 | ||
|
|
1a765f1a17 | ||
|
|
06ab51b53d | ||
|
|
7de1631045 | ||
|
|
4c8411e835 | ||
|
|
f348956e4c | ||
|
|
a4dfd77d23 | ||
|
|
89e0c76a3f | ||
|
|
abc504412a | ||
|
|
36d5bb6f99 | ||
|
|
ad89d19955 | ||
|
|
e6e35c2584 | ||
|
|
ace70510f3 | ||
|
|
cb4d6efb29 | ||
|
|
f1cddfdc62 | ||
|
|
6fb96183c0 | ||
|
|
a5c83b66df | ||
|
|
a320d4ccba | ||
|
|
790e6146f5 | ||
|
|
89283ef486 | ||
|
|
96bd5a6dc1 | ||
|
|
f5d8741832 | ||
|
|
effcc988c1 | ||
|
|
7ac3fbfdc9 | ||
|
|
4c4134a272 | ||
|
|
b2682bcbf5 | ||
|
|
4111734637 | ||
|
|
6e27c47dee | ||
|
|
18cc3539ca | ||
|
|
76ad5bea0e | ||
|
|
13e80e449c | ||
|
|
023eb19615 | ||
|
|
3e4617be37 | ||
|
|
ed9ec402fd | ||
|
|
56de81a1f9 | ||
|
|
ccb41d1ef9 | ||
|
|
2374cda8d0 | ||
|
|
1b7a09c184 | ||
|
|
37925e7f6c | ||
|
|
762ae3a598 | ||
|
|
9f8a2acf46 | ||
|
|
4fdec9d6e5 | ||
|
|
640d58eb13 | ||
|
|
fa8c61382b | ||
|
|
b6ac898f8f | ||
|
|
57bcff1964 | ||
|
|
939a87ed2e | ||
|
|
16d6914b15 | ||
|
|
05e473642b | ||
|
|
0d592f6c55 | ||
|
|
476adf872a | ||
|
|
9584629f50 | ||
|
|
c1c49183b5 | ||
|
|
8069cd6689 | ||
|
|
1f79ca9539 | ||
|
|
1d8fc97053 | ||
|
|
19f3669fbd | ||
|
|
06024b0ab0 | ||
|
|
6e952a0aa8 | ||
|
|
57dee794d1 | ||
|
|
2c0bb71a6e | ||
|
|
ab8f638e44 | ||
|
|
d250b67f33 | ||
|
|
42b8241541 | ||
|
|
6cc98c1ea9 | ||
|
|
77c367ad1d | ||
|
|
26b3148904 | ||
|
|
27dc9ca799 | ||
|
|
63e87ef85b | ||
|
|
6697b677dc | ||
|
|
baad1a5166 | ||
|
|
7cf7982565 | ||
|
|
f3f6e9d365 | ||
|
|
4228137dff | ||
|
|
3c8d27d098 | ||
|
|
2c200873c1 | ||
|
|
ff1fa17dc3 | ||
|
|
08e6d8a780 | ||
|
|
4c1705fb1e | ||
|
|
31389b38f1 | ||
|
|
ff7a3cc885 | ||
|
|
4d1488498c | ||
|
|
10a22e7872 | ||
|
|
e72b6a440b | ||
|
|
b5ca4b7f35 | ||
|
|
c49f4b73dd | ||
|
|
80cbf08a58 | ||
|
|
5e23cc719d | ||
|
|
0680fe2a1a | ||
|
|
bba5f54722 | ||
|
|
85c4546333 | ||
|
|
c4105436eb | ||
|
|
23b5c0e833 | ||
|
|
cdd1bc425b | ||
|
|
2a9c06c40f | ||
|
|
434e0234c5 | ||
|
|
caf415dc97 | ||
|
|
e9337bf56e | ||
|
|
bcd02a871f | ||
|
|
e1c14bc86c | ||
|
|
69c23c00e0 | ||
|
|
1e19d7e463 | ||
|
|
5e0391aa2b | ||
|
|
2e91ee3849 | ||
|
|
9b32d617db | ||
|
|
2ec8376af9 | ||
|
|
86ef32318c | ||
|
|
4d062d41cb | ||
|
|
e78e42339d | ||
|
|
057ab1b7a6 | ||
|
|
613300c61d | ||
|
|
7d1f66ccf8 | ||
|
|
a7418449f9 | ||
|
|
d68e6f8362 | ||
|
|
c34ce15b14 | ||
|
|
1350d2cd1a | ||
|
|
9db2aca791 | ||
|
|
80d58b7930 | ||
|
|
568ecc201a | ||
|
|
cad7ed5570 | ||
|
|
57bb9281f6 | ||
|
|
5e53e9bcaa | ||
|
|
edfbb56749 | ||
|
|
652a04ac70 | ||
|
|
5e9ab3e261 | ||
|
|
be6fd3af9a | ||
|
|
e272cd485c | ||
|
|
f27528538d | ||
|
|
ad35a3d7ab | ||
|
|
211b9cbe04 | ||
|
|
946b8c29d7 | ||
|
|
33940ae66b | ||
|
|
d2589c4415 | ||
|
|
22733e44bf | ||
|
|
82d4051a39 | ||
|
|
0664a8c0e6 | ||
|
|
9b23376415 | ||
|
|
553a1b90ba | ||
|
|
7ea9da9605 | ||
|
|
9b98e608e6 | ||
|
|
885edc9768 | ||
|
|
e1b8485b51 | ||
|
|
764a35d035 | ||
|
|
e93bbd3831 | ||
|
|
8938c95e00 | ||
|
|
00ab6f572a | ||
|
|
73e9cbdea1 | ||
|
|
78381e9e7b | ||
|
|
95299d94c4 | ||
|
|
75252b6251 | ||
|
|
f95b0ccdab | ||
|
|
38f184e50d | ||
|
|
1f4e5b17b7 | ||
|
|
9ee7e28ef8 | ||
|
|
3ac5b91899 | ||
|
|
4b29c4cdbf | ||
|
|
89729aefe8 | ||
|
|
15aae8a58c | ||
|
|
096c69dc4f | ||
|
|
2c0d2c1532 | ||
|
|
eca8ddabe9 | ||
|
|
c57d5ef1cd | ||
|
|
6bbc0eefed | ||
|
|
8c5b299449 | ||
|
|
9806699592 | ||
|
|
543b19b376 | ||
|
|
f2e878d9ec | ||
|
|
b73426b91f | ||
|
|
628c4c996a | ||
|
|
642d20b2f7 | ||
|
|
f6a88c6e9b | ||
|
|
d1fa5f307b | ||
|
|
cd0e813a85 | ||
|
|
dc47a391da | ||
|
|
9f94678478 | ||
|
|
04fea69a28 | ||
|
|
d6a8821596 | ||
|
|
7617dd5029 | ||
|
|
e9d9df3473 | ||
|
|
b6ee3d99b1 | ||
|
|
9a2bd83827 | ||
|
|
f359f869ab | ||
|
|
d6fba7c2f3 | ||
|
|
498bcf213f | ||
|
|
33efb7ace6 | ||
|
|
d74ca78bd8 | ||
|
|
3c91ba134f | ||
|
|
9a83d84109 | ||
|
|
8ae4018e4d | ||
|
|
739901b606 | ||
|
|
03b5be91f7 | ||
|
|
272c977d08 | ||
|
|
75446d8195 | ||
|
|
52ff391c8a | ||
|
|
344a0a094f | ||
|
|
2710226326 | ||
|
|
381b0d3d07 | ||
|
|
52523bcd8b | ||
|
|
0d13e2cb2e | ||
|
|
014881e550 | ||
|
|
67b82638db | ||
|
|
09f18d07b0 | ||
|
|
9ef874e979 | ||
|
|
0aa73d5b35 | ||
|
|
ad2fa61765 | ||
|
|
e8106f3792 | ||
|
|
db3b974479 | ||
|
|
d62a4d3566 | ||
|
|
1b25b5f590 | ||
|
|
03add90c94 | ||
|
|
0f2e277f80 | ||
|
|
8664e7f7d3 | ||
|
|
cb37f43277 | ||
|
|
2a535b72ff | ||
|
|
cd2336887c | ||
|
|
448b09d7b6 | ||
|
|
704fea616b | ||
|
|
23665c7731 | ||
|
|
4025ec9900 | ||
|
|
6a397f579e | ||
|
|
c31f118d0c | ||
|
|
2f005d6be9 | ||
|
|
45f5394d79 | ||
|
|
7e214d8e4c | ||
|
|
ed10048394 | ||
|
|
43f2ef226c | ||
|
|
42b5a0977e | ||
|
|
3b1252207d | ||
|
|
4ac53f1549 | ||
|
|
21b807aa85 | ||
|
|
28e0398c68 | ||
|
|
637ec60644 | ||
|
|
11bb7e520c | ||
|
|
6ba9316e15 | ||
|
|
60e3e626e4 | ||
|
|
9db915853a | ||
|
|
5237723f22 | ||
|
|
eb07f1fee9 | ||
|
|
8d92f8b362 | ||
|
|
49f0a72121 | ||
|
|
5978b7bb93 | ||
|
|
e09408f9b7 | ||
|
|
83e596c06f | ||
|
|
0268bfdbd4 | ||
|
|
b994f5c273 | ||
|
|
e9de088209 | ||
|
|
d05db077e2 | ||
|
|
d2f2473070 | ||
|
|
47b6b56566 | ||
|
|
27cc73f47e | ||
|
|
cc91ccad3e | ||
|
|
0102413f58 | ||
|
|
665e0570ae | ||
|
|
9391c27b80 | ||
|
|
a75fb3d4be | ||
|
|
2d86510acf | ||
|
|
5c3b14069e | ||
|
|
fe483ad011 | ||
|
|
0ce070acac | ||
|
|
6c0a1fc42c | ||
|
|
d066ab2620 | ||
|
|
3a5bd4c03e | ||
|
|
93b2621651 | ||
|
|
6aa1ec2a4c | ||
|
|
cc9fc41318 | ||
|
|
fe40636ae1 | ||
|
|
577b1fd965 | ||
|
|
0f97a999fb | ||
|
|
cb6e136893 | ||
|
|
5c3fb4d5b3 | ||
|
|
7c6921c743 | ||
|
|
22af7f7881 | ||
|
|
6ffb8b7a70 | ||
|
|
95e725c2b6 | ||
|
|
b18ad7a834 | ||
|
|
cfa76fa600 | ||
|
|
d226fff111 | ||
|
|
0c6164df7e | ||
|
|
d8bc350445 | ||
|
|
242ff26e21 | ||
|
|
ab0adabd39 | ||
|
|
ba4db0da49 | ||
|
|
7aa42f8868 | ||
|
|
3245ebccd4 | ||
|
|
359b0ba088 | ||
|
|
5234f8bf28 | ||
|
|
9a3bad291a | ||
|
|
b1a3e213ae | ||
|
|
2fcddfc866 | ||
|
|
313091eb1c | ||
|
|
508a35fc20 | ||
|
|
9cedbc1345 | ||
|
|
e66fa1cec6 | ||
|
|
1cd8ed0c1a | ||
|
|
74a0f44230 | ||
|
|
dc825c249c | ||
|
|
15a4df4c49 | ||
|
|
f0cf8d6a81 | ||
|
|
7fff1f5ce1 | ||
|
|
c625058f41 | ||
|
|
50b4563912 | ||
|
|
69f29e8907 | ||
|
|
ee6ad51a44 | ||
|
|
e8657d2444 | ||
|
|
a42000e1dd | ||
|
|
c3e19507bf | ||
|
|
27238d97d5 | ||
|
|
e9a75e57b8 | ||
|
|
5cbc073dd1 | ||
|
|
b7da02aab4 | ||
|
|
f3e3a8fcbe | ||
|
|
44fe0478ea | ||
|
|
9dc9bc2346 | ||
|
|
9c1cce6fe2 | ||
|
|
cab394a058 | ||
|
|
9d9ace2b22 | ||
|
|
c2462ee87b | ||
|
|
39f41def54 | ||
|
|
76e45883bd | ||
|
|
19ce7180be | ||
|
|
b00467c8ef | ||
|
|
2cf045c53e | ||
|
|
e2a100c925 | ||
|
|
eda1ec652f | ||
|
|
0135784589 | ||
|
|
5e654620b7 | ||
|
|
16b4ae8396 | ||
|
|
a5f3b68bff | ||
|
|
f163240710 | ||
|
|
c5f455d660 | ||
|
|
c8d191a5c9 | ||
|
|
e6ec8f9f30 | ||
|
|
4d566e8bad | ||
|
|
e6ccc1427c | ||
|
|
52b186eabe | ||
|
|
67ff48ce3e | ||
|
|
045ca8739d | ||
|
|
64b404068f | ||
|
|
dda513c923 | ||
|
|
6c5eff4a7c | ||
|
|
6884ad2211 | ||
|
|
9e4effaa14 | ||
|
|
849d694c27 | ||
|
|
1d781ea9e0 | ||
|
|
acf3b751f0 | ||
|
|
9bdfaf3803 | ||
|
|
f8eb1cd58a | ||
|
|
3b4bbe7a18 | ||
|
|
2bd59de002 | ||
|
|
ac413c65dc | ||
|
|
c01953daf2 | ||
|
|
a9ecdc7764 | ||
|
|
869a5b4901 | ||
|
|
2081d7552f | ||
|
|
e298e77319 | ||
|
|
35580b135a | ||
|
|
f987e6e0f9 | ||
|
|
85f1291597 | ||
|
|
5ea739f943 | ||
|
|
94d2790ab5 | ||
|
|
9aa7db103d | ||
|
|
3398f31b87 | ||
|
|
0e39cc1187 | ||
|
|
e8e05b6876 | ||
|
|
a218946f52 | ||
|
|
2a79c1eed2 | ||
|
|
7dc3e67bba | ||
|
|
3c869a8032 | ||
|
|
edba5a0014 | ||
|
|
b4a0591429 | ||
|
|
adbc0159ae | ||
|
|
a5510d14e9 | ||
|
|
9f5d4a5252 | ||
|
|
42d2ecba68 | ||
|
|
ceb1f91d9d | ||
|
|
3430850421 | ||
|
|
c5726e88e8 | ||
|
|
867a3273ce | ||
|
|
2a236db18f | ||
|
|
242ac4d8f4 | ||
|
|
3e0edc7ee2 | ||
|
|
0bb1127cb6 | ||
|
|
9d2c6c8de2 | ||
|
|
9513115ce0 | ||
|
|
f2cbc5fb8f | ||
|
|
26d76cdb19 | ||
|
|
65a516e229 | ||
|
|
edda122ed0 | ||
|
|
3044b861bd | ||
|
|
13932f55f5 | ||
|
|
3d028f512e | ||
|
|
bb2d8fefd7 | ||
|
|
623e8f6984 | ||
|
|
865e0d3af9 | ||
|
|
45cfdbbda7 | ||
|
|
2b00a5d90a | ||
|
|
bd2ecf8ce3 | ||
|
|
972b8a1726 | ||
|
|
fe631ffd04 | ||
|
|
bde82e9654 | ||
|
|
df481eb642 | ||
|
|
6ff83abb61 | ||
|
|
4fdf8a75cd | ||
|
|
2e49125e87 | ||
|
|
7e56704767 | ||
|
|
95b89e059a | ||
|
|
ef8386c065 | ||
|
|
7af445adf3 | ||
|
|
ee68f743c7 | ||
|
|
e39d911177 | ||
|
|
48ac37a1b8 | ||
|
|
e8f37666ea | ||
|
|
e2e0015119 | ||
|
|
3343b34725 | ||
|
|
e107290230 | ||
|
|
1b66f01ec0 | ||
|
|
f9c7a2cacb | ||
|
|
5ce63cd54a | ||
|
|
03f3d0dc8b | ||
|
|
74578b8752 | ||
|
|
caec5ac941 | ||
|
|
88f823f899 | ||
|
|
9a6a89c238 | ||
|
|
e8614abc5d | ||
|
|
87ae2430df | ||
|
|
dc9fda76f3 | ||
|
|
3b15cce07a | ||
|
|
8cad90f9e6 | ||
|
|
9c60ab796d | ||
|
|
05789c4b92 | ||
|
|
962d487edb | ||
|
|
04335ddd89 | ||
|
|
8b6010255f | ||
|
|
ccdc0ed26d | ||
|
|
3f6c0ba6d6 | ||
|
|
fe9d7b033e | ||
|
|
12e893ff2d | ||
|
|
cda2a2586b | ||
|
|
bf4e3f55f4 | ||
|
|
51ad05efdb | ||
|
|
89f5cf8291 | ||
|
|
949ab2a17c | ||
|
|
08b090c707 | ||
|
|
c64beb3f76 | ||
|
|
aae9c3194f | ||
|
|
20c9c93b3e | ||
|
|
771519e311 | ||
|
|
f91557f549 | ||
|
|
514860ac3b | ||
|
|
9d7ebc65e7 | ||
|
|
6aab3fe25a | ||
|
|
7c0a49a6f9 | ||
|
|
292df115e8 | ||
|
|
9f53e9f5dd | ||
|
|
ee808abfea | ||
|
|
ab3e3797a5 | ||
|
|
7fc156648a | ||
|
|
f0c0f5618b | ||
|
|
7c36e571d2 | ||
|
|
040ba5662c | ||
|
|
2886fa288a | ||
|
|
736deaae32 | ||
|
|
c9e15c2f86 | ||
|
|
d48f03c32e | ||
|
|
1760a8dfbc | ||
|
|
f278fcfc3f | ||
|
|
816d942ded | ||
|
|
423805c9ca | ||
|
|
a7e45c5a73 | ||
|
|
d060d27745 | ||
|
|
75dc174c76 | ||
|
|
d977695d48 | ||
|
|
b6b7dcd61c | ||
|
|
43ef831bf7 | ||
|
|
cabe291006 | ||
|
|
6b3d25b54b | ||
|
|
68adfc6607 | ||
|
|
ba0d7aa09c | ||
|
|
50b572a657 | ||
|
|
9634e516a9 | ||
|
|
c38f3a2b9a | ||
|
|
44780837f1 | ||
|
|
c6bb68bd30 | ||
|
|
8923c02222 | ||
|
|
b4685151ce | ||
|
|
756f44fcbd | ||
|
|
51fbeed71f | ||
|
|
d66fb86449 | ||
|
|
40df303122 | ||
|
|
a504abf00c | ||
|
|
d9c2b7d460 | ||
|
|
0e62b8bd85 | ||
|
|
6d1c54ed92 | ||
|
|
b5789203f2 | ||
|
|
92011f8294 | ||
|
|
b3db1ec1a7 | ||
|
|
5f60fcb602 | ||
|
|
30a7be457c | ||
|
|
93198ed28b | ||
|
|
6af5135802 | ||
|
|
6b233eb862 | ||
|
|
75e3d22043 | ||
|
|
e5da5f7fe7 | ||
|
|
4fcfb1eaca | ||
|
|
bfc68ec792 | ||
|
|
ae8c5eb75f | ||
|
|
513e84880e | ||
|
|
626b9bbf64 | ||
|
|
da7da2ce52 | ||
|
|
3232251fea | ||
|
|
e603cca7a5 | ||
|
|
8f8acf5b06 | ||
|
|
565a543b7b | ||
|
|
5e12b05424 | ||
|
|
a4c8b5bf5d | ||
|
|
cbf09b5ad9 | ||
|
|
2c66b33fd1 | ||
|
|
067c122bf3 | ||
|
|
defa1c027d | ||
|
|
ea179a8e38 | ||
|
|
8a17615b5a | ||
|
|
95920f3b6b | ||
|
|
365b9c3e9c | ||
|
|
3f6eeda3f0 | ||
|
|
3121206afe | ||
|
|
240936eb19 | ||
|
|
1336781f8f | ||
|
|
661cd65bdd | ||
|
|
fb498795ad | ||
|
|
2ae398913d | ||
|
|
d711b8c0e9 | ||
|
|
395414ccde | ||
|
|
9f29ad77bd | ||
|
|
545e5c5bc6 | ||
|
|
1b374fcf7e | ||
|
|
518d7dfde8 | ||
|
|
f8ddb10607 | ||
|
|
0ef13be577 | ||
|
|
c559f95703 | ||
|
|
f7cb75ff93 | ||
|
|
29076acc69 | ||
|
|
99b2be90fd | ||
|
|
f8c72feea8 | ||
|
|
69c2b12879 | ||
|
|
3820a38e79 | ||
|
|
60bc9f4f5e | ||
|
|
a8842f38ca | ||
|
|
667a623310 | ||
|
|
067208bc9d | ||
|
|
70ebd09de4 | ||
|
|
782f4112cd | ||
|
|
447bcf98e1 | ||
|
|
d19b11a00f | ||
|
|
ad6de07d2b | ||
|
|
0e81d7204c | ||
|
|
91b0394433 | ||
|
|
b2ef8f4e14 | ||
|
|
81925dfadf | ||
|
|
098159ad41 | ||
|
|
fe12d2e3b7 | ||
|
|
df1f57392c | ||
|
|
949ca1abf8 | ||
|
|
e52d5e32aa | ||
|
|
aaeeb9c0c6 | ||
|
|
d2958fc0f5 | ||
|
|
f8235aec74 | ||
|
|
13ffb39245 | ||
|
|
75b2db4424 | ||
|
|
14aaf8976f | ||
|
|
fcb0ff1b60 | ||
|
|
31669fde03 | ||
|
|
17b3f01b28 | ||
|
|
cadf573170 | ||
|
|
a12876da92 | ||
|
|
eebf39a1df | ||
|
|
210f66e48b | ||
|
|
91e72ba081 | ||
|
|
be308ff914 | ||
|
|
4ee35438a7 | ||
|
|
11dab2b9ca | ||
|
|
f02adf2a45 | ||
|
|
9e24992835 | ||
|
|
e9e2a83436 | ||
|
|
af51ff4162 | ||
|
|
e8ee087e9d | ||
|
|
8cc477f353 | ||
|
|
c63856dac4 | ||
|
|
8d1a575a9b | ||
|
|
9e8ca8d4bf | ||
|
|
491d742bf9 | ||
|
|
dc35a8022b | ||
|
|
70b1a05d97 | ||
|
|
785c3e9e61 | ||
|
|
9ad9ce0da1 | ||
|
|
042e47543c | ||
|
|
71d612f6e4 | ||
|
|
a4ede02ced | ||
|
|
ea4db0ffb6 | ||
|
|
d785d76370 | ||
|
|
b6462cd51f | ||
|
|
611850bf91 | ||
|
|
ddfadbb69e | ||
|
|
045ac1019e | ||
|
|
ee7ba96e85 | ||
|
|
8e96ac8765 | ||
|
|
acf1e734ec | ||
|
|
0a478bc0dc | ||
|
|
9005447590 | ||
|
|
d300964691 | ||
|
|
407a3bca62 | ||
|
|
310e438706 | ||
|
|
8a2a8ab8b5 | ||
|
|
5e440a4cdc | ||
|
|
3a1b641db1 | ||
|
|
2cffc3228a | ||
|
|
7fa6d804ce | ||
|
|
a398eea244 | ||
|
|
0e87cc8c84 | ||
|
|
764bab8eb9 | ||
|
|
351740fc80 | ||
|
|
9143ea13ad | ||
|
|
4711d66cab | ||
|
|
09967d4ff8 | ||
|
|
e0335705b2 | ||
|
|
4ce3cc66d5 | ||
|
|
fce3d7586f | ||
|
|
cda912bd8c | ||
|
|
84a0f9ea42 | ||
|
|
08fa5136e1 | ||
|
|
7a79b292e4 | ||
|
|
a53e9e3a98 | ||
|
|
f7d5280f47 | ||
|
|
29c56f4447 | ||
|
|
c9207bcc00 | ||
|
|
132f28ad44 | ||
|
|
b2c215029d | ||
|
|
89257832d7 | ||
|
|
219d0b7fb0 | ||
|
|
4e308a1a3e | ||
|
|
3c15e3ebdd | ||
|
|
8655e521d7 | ||
|
|
05deb9e09b | ||
|
|
91886120a7 | ||
|
|
09286d4918 | ||
|
|
161db08745 | ||
|
|
8aaaab4163 | ||
|
|
53db382695 | ||
|
|
1b6051e4df | ||
|
|
8d206f8308 | ||
|
|
b94f3e80c4 | ||
|
|
2a842778e3 | ||
|
|
e525275d10 | ||
|
|
4fa92ec0fa | ||
|
|
69eff89049 | ||
|
|
12677f2d42 | ||
|
|
a94a89086f | ||
|
|
80a71323cc | ||
|
|
fd77f699df | ||
|
|
93cf2cd19b | ||
|
|
585536835a | ||
|
|
f5e437d8c7 | ||
|
|
14c4854987 | ||
|
|
3af5691b91 | ||
|
|
9f26c4ebdc | ||
|
|
11790fbf01 | ||
|
|
f3e6bcb20c | ||
|
|
e0e50115d2 | ||
|
|
b2a22f1afb | ||
|
|
9d3322df8c | ||
|
|
91d1061c73 | ||
|
|
0ffb184eba | ||
|
|
5b9711c002 | ||
|
|
096a6426db | ||
|
|
84baef922c | ||
|
|
51c3a31bb5 | ||
|
|
06fa07e73e | ||
|
|
4da2bfefb7 | ||
|
|
3b30aab8a7 | ||
|
|
c2e9685e04 | ||
|
|
d6f5f6b7ba | ||
|
|
a4ab42560f | ||
|
|
a76136c010 | ||
|
|
e35a349229 | ||
|
|
3d36747b92 | ||
|
|
c0784b7c33 | ||
|
|
828315f675 | ||
|
|
4c4ba08e85 | ||
|
|
94196c84e9 | ||
|
|
9d476b5ab2 | ||
|
|
0a07dfc5cf | ||
|
|
d69f7ae471 | ||
|
|
974d899b33 | ||
|
|
6948e0ba84 | ||
|
|
a325f1ce2b | ||
|
|
997eb7574a | ||
|
|
8873e0072c | ||
|
|
c29389f5f3 | ||
|
|
4b8eaaf7aa | ||
|
|
8d813fa728 | ||
|
|
28e318b646 | ||
|
|
2961efdc18 | ||
|
|
3c589bb877 | ||
|
|
d8dbea9d5b | ||
|
|
f960ea039e | ||
|
|
de80234165 | ||
|
|
906be7be7c | ||
|
|
482847a994 | ||
|
|
58d308fd05 | ||
|
|
59acd5ec7c | ||
|
|
ca739f71fb | ||
|
|
23a70932d2 | ||
|
|
1a34b9b61c | ||
|
|
8f92912852 | ||
|
|
2600cb7b64 | ||
|
|
200b6ea10f | ||
|
|
8c1efec43a | ||
|
|
dd30d74688 | ||
|
|
6f42d6658f | ||
|
|
c4cdd85e80 | ||
|
|
0bd71db5df | ||
|
|
feced71a6d | ||
|
|
444ee274d7 | ||
|
|
bb0b160001 | ||
|
|
241d510096 | ||
|
|
c042d08bb7 | ||
|
|
1ce63b5b42 | ||
|
|
dd0ba183f8 | ||
|
|
933a553dd4 | ||
|
|
af67bbde31 | ||
|
|
6310b40fc6 | ||
|
|
2463a4af2a | ||
|
|
51ad8f5ab4 | ||
|
|
615ce6aa69 | ||
|
|
43b41324e2 | ||
|
|
91b0db138a | ||
|
|
197ce0b670 | ||
|
|
002003292e | ||
|
|
0b367a14f1 | ||
|
|
e5dcd520ba | ||
|
|
90b75afdb1 | ||
|
|
2d60e4b18b | ||
|
|
c5d8499ad2 | ||
|
|
b77c0d2813 | ||
|
|
a636dda07d | ||
|
|
dc5719e1f4 | ||
|
|
d53f63023a | ||
|
|
0221607318 | ||
|
|
a1b5c7242e | ||
|
|
a225672c87 | ||
|
|
4b4fcc7034 | ||
|
|
85094a59e6 | ||
|
|
e02e64fc07 | ||
|
|
176beefa88 | ||
|
|
1a85e3b4cd | ||
|
|
5209ce5bfa | ||
|
|
2c5a499a8b | ||
|
|
6d89da45b0 | ||
|
|
eb328037b7 | ||
|
|
afba31c3f9 | ||
|
|
c4cbe79b48 | ||
|
|
8ba7657007 | ||
|
|
48d8376878 | ||
|
|
74e583a612 | ||
|
|
29619ccf1c | ||
|
|
ab092fc77f | ||
|
|
28d8fc871a | ||
|
|
ad6a249832 | ||
|
|
50c9679e23 | ||
|
|
8eb39178ea | ||
|
|
dd35ba5e81 | ||
|
|
3cc772c8e9 | ||
|
|
247d7475e1 | ||
|
|
51d59e673b | ||
|
|
ae39f6fba5 | ||
|
|
15cf5ac2d7 | ||
|
|
de99942499 | ||
|
|
ccf3c69874 | ||
|
|
8ad5afd3a1 | ||
|
|
0d4a2c6c3a | ||
|
|
02b2de5c73 | ||
|
|
2bc67b4a96 | ||
|
|
9df1c23c71 | ||
|
|
7a47d81b7b | ||
|
|
831e708897 | ||
|
|
757538f114 | ||
|
|
cc4900f66c | ||
|
|
7d02580a2b | ||
|
|
3d3b0938e5 | ||
|
|
9c5773ca0a | ||
|
|
092776442b | ||
|
|
0267976044 | ||
|
|
5864968ce9 | ||
|
|
33bc8a2404 | ||
|
|
dfce202034 | ||
|
|
ea46bb3b84 | ||
|
|
8418dfbaed | ||
|
|
caf4580346 | ||
|
|
a90ced1f38 | ||
|
|
6c0c77b3a1 | ||
|
|
16d4a4723f | ||
|
|
327e653fae | ||
|
|
81f773054d | ||
|
|
7e91a0f4a8 | ||
|
|
9d471f3c9a | ||
|
|
7e46a9833b | ||
|
|
988a0245c2 | ||
|
|
0376630f7a | ||
|
|
c7d0329754 | ||
|
|
bc2e920ae2 | ||
|
|
3721610a63 | ||
|
|
e060516cc7 | ||
|
|
20abd4b833 | ||
|
|
904381058c | ||
|
|
5e64d629a3 | ||
|
|
d71102c45a | ||
|
|
403f7668d5 | ||
|
|
930c25f7f1 | ||
|
|
187d029d20 | ||
|
|
9914198a6c | ||
|
|
c6444a10a8 | ||
|
|
383b24ab84 | ||
|
|
9cbab35de0 | ||
|
|
eeecdd4e5a | ||
|
|
2af663dccb | ||
|
|
0be7e2ef70 | ||
|
|
4d1ce8178c | ||
|
|
c5ccf44750 | ||
|
|
e4380b533b | ||
|
|
62262d0bb5 | ||
|
|
52d92cba90 | ||
|
|
0df5932593 | ||
|
|
d1838dceec | ||
|
|
c6bd143785 | ||
|
|
d51fd1a5d0 | ||
|
|
c4e30862ee | ||
|
|
3dd6fe2703 | ||
|
|
fe796c46c3 | ||
|
|
f200f52a16 | ||
|
|
d59608f764 | ||
|
|
b3e6e710d8 | ||
|
|
8ab07e0451 | ||
|
|
ad55faafa8 | ||
|
|
bbd58e772e | ||
|
|
e8b2ae0b85 | ||
|
|
13620df717 | ||
|
|
fb103dd162 | ||
|
|
3b65c986ee | ||
|
|
cad7d9135a | ||
|
|
b152d1a7ab | ||
|
|
aa8f44f68c | ||
|
|
1810d86555 | ||
|
|
39e8e507d9 | ||
|
|
3eb571f34c | ||
|
|
e8be357624 | ||
|
|
32605fa10a | ||
|
|
0b9b5f3993 | ||
|
|
86aa18efe6 | ||
|
|
76d22bc743 | ||
|
|
01cd30984b | ||
|
|
fceb411154 | ||
|
|
0413598d7b | ||
|
|
3ccfe88ad8 | ||
|
|
065ebd39ef | ||
|
|
bcccdda7c0 | ||
|
|
4c005e7086 | ||
|
|
2a141af42e | ||
|
|
472690a55f | ||
|
|
8cef567abc | ||
|
|
5d22d541f2 | ||
|
|
c3d14ab9b9 | ||
|
|
0488525888 | ||
|
|
b8713a515e | ||
|
|
b976f24672 | ||
|
|
8f1f416a52 | ||
|
|
0d9d23a888 | ||
|
|
a5fb3e08f7 | ||
|
|
59caff8fb1 | ||
|
|
f825e81d0e | ||
|
|
7bea0007c7 | ||
|
|
8dd8addd3a | ||
|
|
e14dd4974f | ||
|
|
7a97995d81 | ||
|
|
e64509f1b4 | ||
|
|
0ac5440fc2 | ||
|
|
fde3411c8b | ||
|
|
8066aba6fe | ||
|
|
5ba0aa8082 | ||
|
|
3e95b7d8a5 | ||
|
|
0f632201e0 | ||
|
|
ebca1e4357 | ||
|
|
a3620c60ad | ||
|
|
9f70ebecf1 | ||
|
|
0fd91e4450 | ||
|
|
fe088dc8c3 | ||
|
|
5a6e20a6aa | ||
|
|
02bfe2dad3 | ||
|
|
50edd4cfdd | ||
|
|
03e60b9ea4 | ||
|
|
0677472c56 | ||
|
|
c1bc1e3137 | ||
|
|
b691fb7f2d | ||
|
|
73ac98da80 | ||
|
|
14b43b504b | ||
|
|
a3c605f147 | ||
|
|
333413d298 | ||
|
|
9de8d7276e | ||
|
|
432b106d58 | ||
|
|
2c7a248307 | ||
|
|
113947132c | ||
|
|
0a253d66d0 | ||
|
|
ae0e001187 | ||
|
|
eab82fdec7 | ||
|
|
da755d1c83 | ||
|
|
1b2581f0cb | ||
|
|
56c8bdbaa2 | ||
|
|
23435512c4 | ||
|
|
6c3a0eb1d6 | ||
|
|
c85cd13ca1 | ||
|
|
e4b994381b | ||
|
|
de2a2473f5 | ||
|
|
e6b036b413 | ||
|
|
08a3d26328 | ||
|
|
bc299067aa | ||
|
|
908a0277e5 | ||
|
|
c2deb1db25 | ||
|
|
16716ad028 | ||
|
|
fef8fe8525 | ||
|
|
3d5268368f | ||
|
|
20b51da180 | ||
|
|
785a7a22bc | ||
|
|
1ac4a7e116 | ||
|
|
327e505273 | ||
|
|
bf1c197a37 | ||
|
|
3c3a902a69 | ||
|
|
0c14176cd7 | ||
|
|
7ee971c3e3 | ||
|
|
098a23adc6 | ||
|
|
10c69387fd | ||
|
|
4b8b2f7c5b | ||
|
|
e1b8ff798f | ||
|
|
05b1854946 | ||
|
|
f58668fd67 | ||
|
|
e8843c31e6 | ||
|
|
05be16e9e1 | ||
|
|
e9b77298a7 | ||
|
|
a0cecc6c52 | ||
|
|
cf6113068c | ||
|
|
0c2c094db6 | ||
|
|
60cf56e235 | ||
|
|
482f5f7a26 | ||
|
|
04382d4b44 | ||
|
|
44b2261c34 | ||
|
|
76b9d781ee | ||
|
|
bd0faaf702 | ||
|
|
e0cd34c9e1 | ||
|
|
6c41ca4b8c | ||
|
|
7add015a75 | ||
|
|
d6b6e59ab8 | ||
|
|
a213674a98 | ||
|
|
41f24898e5 | ||
|
|
d2ad32eef8 | ||
|
|
1fea6d394a | ||
|
|
dcddfce5bc | ||
|
|
e6528be63d | ||
|
|
08ca260e82 | ||
|
|
88eb93da52 | ||
|
|
b35efd96dc | ||
|
|
89db5c6bab | ||
|
|
790838d897 | ||
|
|
4d0cf9ec8e | ||
|
|
299f673a8e | ||
|
|
fa8904978b | ||
|
|
4a144d1c18 | ||
|
|
415c96204a | ||
|
|
7af24dc486 | ||
|
|
e01c0ab4d6 | ||
|
|
8b4827ad85 | ||
|
|
43d5ec2d4a | ||
|
|
75a0998ed2 | ||
|
|
fbd229810f | ||
|
|
d27e791f32 | ||
|
|
50d2950e6b | ||
|
|
96564d0dad | ||
|
|
3e5abd18ca | ||
|
|
545ff6f9f1 | ||
|
|
49b95fe008 | ||
|
|
b8704e12b7 | ||
|
|
639a4d5cf7 | ||
|
|
0e500de1a0 | ||
|
|
c5b244419d | ||
|
|
8ccfc0f316 | ||
|
|
e126c55a5a | ||
|
|
be26ba8f8f | ||
|
|
1493771087 | ||
|
|
192d7ad735 | ||
|
|
12679da5da | ||
|
|
ec49b22af3 | ||
|
|
d23179e25c | ||
|
|
7d62bb8c53 | ||
|
|
c4e55d78d5 | ||
|
|
07a1c48e8c | ||
|
|
7be25313a5 | ||
|
|
55e8092cbf | ||
|
|
e5170582de | ||
|
|
710443d200 | ||
|
|
2a20423be6 | ||
|
|
8096a1fb04 | ||
|
|
2fedae6060 | ||
|
|
b1b4048f97 | ||
|
|
107f00ff8f | ||
|
|
5144e98a82 | ||
|
|
210d70b0c7 | ||
|
|
3ae94520c3 | ||
|
|
cbe25178d7 | ||
|
|
a3b7e1f774 | ||
|
|
bbab5fef0c | ||
|
|
007703156b | ||
|
|
9cae2900d4 | ||
|
|
876cae2807 | ||
|
|
e955b1ae09 | ||
|
|
dadf8adb3e | ||
|
|
4238ee090d | ||
|
|
65f77306d3 | ||
|
|
efbc7cccb1 | ||
|
|
f0206a90b1 | ||
|
|
a8f3f2bc1a | ||
|
|
25822d1717 | ||
|
|
9887cb997e | ||
|
|
7e2be96516 | ||
|
|
2e1269c474 | ||
|
|
b499e74502 | ||
|
|
7536f6adbd | ||
|
|
4be02bc207 | ||
|
|
bbfbd87a9f | ||
|
|
7e103e34f8 | ||
|
|
94e6fb89b3 | ||
|
|
1bdffcc73b | ||
|
|
e993e010f4 | ||
|
|
bc1b5f477d | ||
|
|
6a43128019 | ||
|
|
c474e2ac86 | ||
|
|
7763b4cf5b | ||
|
|
322227bf67 | ||
|
|
27cb1a4174 | ||
|
|
c4fb0fd6ca | ||
|
|
87ff1e8cb0 | ||
|
|
61b24180f0 | ||
|
|
15d2cbd6df | ||
|
|
f7a2428deb | ||
|
|
6c2415d32f | ||
|
|
84d3868994 | ||
|
|
f89b2a18e0 | ||
|
|
8114d790a5 | ||
|
|
082065cd50 | ||
|
|
a65b5f8e02 | ||
|
|
d8f133aaf3 | ||
|
|
8e272e5774 | ||
|
|
ce2a5b2838 | ||
|
|
bcf2bc6f8c | ||
|
|
17800c8ca5 | ||
|
|
5c6039fd8b | ||
|
|
40fe2d2c16 | ||
|
|
1bcf2737fe | ||
|
|
fcdbe846e5 | ||
|
|
d055dc0c6e | ||
|
|
e19c192570 | ||
|
|
b80cef964e | ||
|
|
b43594e4eb | ||
|
|
0908863e07 | ||
|
|
b3644f7fa0 | ||
|
|
d41b8cc96e | ||
|
|
91fb9d0113 | ||
|
|
85ac217abc | ||
|
|
687381f42c | ||
|
|
c91add203d | ||
|
|
1e4f459a26 | ||
|
|
06ad04e5fa | ||
|
|
80bf5c9756 | ||
|
|
0d601fd111 | ||
|
|
01904d3c1e | ||
|
|
0c7d14fe50 | ||
|
|
cdeb649d0b | ||
|
|
79ae3c2f2e | ||
|
|
59818af69c | ||
|
|
44e0500958 | ||
|
|
db59d39e2c | ||
|
|
587d71efb5 | ||
|
|
c7a4a16eec | ||
|
|
0b517584aa | ||
|
|
5a11ffcad8 | ||
|
|
0a184d380e | ||
|
|
6b387d320e | ||
|
|
348513c151 | ||
|
|
0d5e94b147 | ||
|
|
88545d882c | ||
|
|
42ea0a19d2 | ||
|
|
c87d27048b | ||
|
|
700bab7279 | ||
|
|
c3db4ebbc3 | ||
|
|
8aa327cb8a | ||
|
|
4218d569de | ||
|
|
e50eee59cf | ||
|
|
4506832925 | ||
|
|
a0cdc63a5d | ||
|
|
79b4e2dc85 | ||
|
|
edd3fc8825 | ||
|
|
e8796e009c | ||
|
|
044be3b93e | ||
|
|
0436811cf0 | ||
|
|
152e138c17 | ||
|
|
4f5e212f87 | ||
|
|
21bf01a24c | ||
|
|
16a9e6b72f | ||
|
|
700bc087d3 | ||
|
|
8b99348e98 | ||
|
|
045f34e851 | ||
|
|
e5a8030dd7 | ||
|
|
6643b83afe | ||
|
|
98681b78b4 | ||
|
|
f8dd0b0cb3 | ||
|
|
f04d49886b | ||
|
|
3043a8d9c9 | ||
|
|
4459fdf1b1 | ||
|
|
086d690df7 | ||
|
|
05d93cda16 | ||
|
|
6fc6eaf742 | ||
|
|
596cee2dc1 | ||
|
|
1d5c3f34ae | ||
|
|
ca7080c2bb | ||
|
|
21f6493b02 | ||
|
|
a89112a133 | ||
|
|
353437bbd1 | ||
|
|
8e92fc62a3 | ||
|
|
c106534663 | ||
|
|
b92c6cdf35 | ||
|
|
ca5093901b | ||
|
|
ba7a0dde06 | ||
|
|
27798c1683 | ||
|
|
ee312ac230 | ||
|
|
7e82be53cd | ||
|
|
7017e46ba1 | ||
|
|
7166674d6c | ||
|
|
e1daf02735 | ||
|
|
56e6294873 | ||
|
|
1b15e5dd64 | ||
|
|
31a2aac627 | ||
|
|
158569f5e8 | ||
|
|
e83f8941a1 | ||
|
|
d6dbb21a34 | ||
|
|
90ada0649c | ||
|
|
e8429bd230 | ||
|
|
5a30f0462f | ||
|
|
11d39bb0d3 | ||
|
|
a517779dd7 | ||
|
|
eba7327058 | ||
|
|
1b156e0f34 | ||
|
|
c1ee5d69c9 | ||
|
|
1f8dc7f845 | ||
|
|
a07653a6cc | ||
|
|
c9a76be532 | ||
|
|
9d2b6db97b | ||
|
|
12d2db5e7b | ||
|
|
1add8ecd0c | ||
|
|
f23a8a8cd1 | ||
|
|
116d8e853e | ||
|
|
5b84cb39ac | ||
|
|
7f018839f8 | ||
|
|
3716c04ed4 | ||
|
|
7fbdf36c64 | ||
|
|
da5f77c96f | ||
|
|
451d4a400e | ||
|
|
4cbcb5f36f | ||
|
|
026784efac | ||
|
|
cc56d0e0fc | ||
|
|
559d5ebd1d | ||
|
|
3e61ada34a | ||
|
|
8758218b09 | ||
|
|
de38aea164 | ||
|
|
d8286d7a98 | ||
|
|
101ad71be1 | ||
|
|
db17b20e26 | ||
|
|
a581ca66bf | ||
|
|
5d6819bb28 | ||
|
|
7a0d86660e | ||
|
|
1a27ae8a81 | ||
|
|
f907a487c8 | ||
|
|
a75f08cf17 | ||
|
|
89ba649ddb | ||
|
|
63640518da | ||
|
|
a8dcfc05c5 | ||
|
|
dd379c4192 | ||
|
|
911e71cd9b | ||
|
|
b8fb38b92c | ||
|
|
144e053a4e | ||
|
|
a8efb1e1c8 | ||
|
|
0866b5f29f | ||
|
|
38712f8120 | ||
|
|
860e056366 | ||
|
|
c6fed4e493 | ||
|
|
8c40a406b6 | ||
|
|
6f950bbd66 | ||
|
|
aa2cce020e | ||
|
|
0e7ea1dada | ||
|
|
6973087d5b | ||
|
|
25755f6adf | ||
|
|
0d360167f3 | ||
|
|
ba4890d303 | ||
|
|
7cd36239a4 | ||
|
|
06afb3f155 | ||
|
|
557122921a | ||
|
|
475e76b272 | ||
|
|
b0c5286e8a | ||
|
|
bffa9fbfbd | ||
|
|
d217f32bbc | ||
|
|
195bf5a4cc | ||
|
|
813c008af2 | ||
|
|
765eff23f0 | ||
|
|
0eb109f8f7 | ||
|
|
fc3e3c468c | ||
|
|
4b7dfc64c6 | ||
|
|
488bb971ff | ||
|
|
907c2f1e6b | ||
|
|
3f04930f38 | ||
|
|
0300128cb8 | ||
|
|
bf2c0390e7 | ||
|
|
1cd8415723 | ||
|
|
1c53aa5687 | ||
|
|
c7643e142b | ||
|
|
9f5ca82f48 | ||
|
|
6db4e05aef | ||
|
|
2891d7cccb | ||
|
|
cae2185460 | ||
|
|
6347161975 | ||
|
|
b1a01345f9 | ||
|
|
e0a1e5417f | ||
|
|
6df0b39f81 | ||
|
|
68af6d4151 | ||
|
|
583d70ec9c | ||
|
|
2369161bb0 | ||
|
|
9035e0b695 | ||
|
|
4ef309bc6c | ||
|
|
114de8a025 | ||
|
|
442339cd27 | ||
|
|
e6cab6d710 | ||
|
|
472e7f80a0 | ||
|
|
2a682f858e | ||
|
|
c43edf98d4 | ||
|
|
a0415aea83 | ||
|
|
4a916125a0 | ||
|
|
89ff614e1d | ||
|
|
55079831a1 | ||
|
|
d047a9d836 | ||
|
|
cd4cf215e1 | ||
|
|
01b5ece642 | ||
|
|
36dd061be7 | ||
|
|
a77d75eb43 | ||
|
|
707118a636 | ||
|
|
ad9dc349e4 | ||
|
|
09cd7db9b1 | ||
|
|
1af988711b | ||
|
|
cedd38455f | ||
|
|
2965931a78 | ||
|
|
1afe6c1437 | ||
|
|
3240d4e70e | ||
|
|
941fb4ebbb | ||
|
|
ee113ab8ed | ||
|
|
24f86e9ff3 | ||
|
|
04ea66c977 | ||
|
|
9657b1a17f | ||
|
|
e08fda074a | ||
|
|
550fbad53e | ||
|
|
160894c031 | ||
|
|
578180f45b | ||
|
|
b64b6a2583 | ||
|
|
a4d8424268 | ||
|
|
a65c89f090 | ||
|
|
0cc2210f22 | ||
|
|
8df40a6ff9 | ||
|
|
9c64965808 | ||
|
|
0d8b572a17 | ||
|
|
1f3406b29b | ||
|
|
dc7f883751 | ||
|
|
db6ccef6bd | ||
|
|
676e730013 | ||
|
|
08105641d9 | ||
|
|
7322a34fa4 | ||
|
|
4801af4c77 | ||
|
|
d55f2be942 | ||
|
|
cd60d6d99a | ||
|
|
dc0326db27 | ||
|
|
50c7a2445b | ||
|
|
6636f0c71b | ||
|
|
1a41d4e6cd | ||
|
|
9961c0e15b | ||
|
|
5c5b0effc1 | ||
|
|
4dc3a0ca1d | ||
|
|
99cceeea70 | ||
|
|
839734a988 | ||
|
|
90b0f1daa8 | ||
|
|
792390e815 | ||
|
|
9f2e0b11d1 | ||
|
|
3380543878 | ||
|
|
ce317b62f9 | ||
|
|
6ad94684d5 | ||
|
|
fdbbefdddd | ||
|
|
3fe5388d4c | ||
|
|
7108a2e57d | ||
|
|
9c497bf15c | ||
|
|
d7c63347e1 | ||
|
|
adc12ed043 | ||
|
|
9ea887dbd0 | ||
|
|
9967df8f45 | ||
|
|
71b7b2482f | ||
|
|
5273540a93 | ||
|
|
f9fe266364 | ||
|
|
a9ed5da369 | ||
|
|
2e6ded06a9 | ||
|
|
7134273918 | ||
|
|
f75e97e9b0 | ||
|
|
a132517f0a | ||
|
|
3c1ae07f92 | ||
|
|
4ef8a74977 | ||
|
|
51113dae0e | ||
|
|
c04a8a1024 | ||
|
|
bd8edd61fd | ||
|
|
92113ce1c9 | ||
|
|
107c3beb20 | ||
|
|
4e45aa1564 | ||
|
|
e0e5cfa266 | ||
|
|
36dae7cc6c | ||
|
|
c68fe7a685 | ||
|
|
199426460a | ||
|
|
338f2a2322 | ||
|
|
f04089ef1e | ||
|
|
1add432673 | ||
|
|
f15f03428e | ||
|
|
e4e22167bb | ||
|
|
6b144150c7 | ||
|
|
ef15f2bdc6 | ||
|
|
39932627bd | ||
|
|
11f535e79f | ||
|
|
f463817c88 | ||
|
|
b6e8fecbf5 | ||
|
|
d6cf314481 | ||
|
|
fb88953be3 | ||
|
|
15984b5c43 | ||
|
|
c2f6897d8b | ||
|
|
28c796a234 | ||
|
|
d7bebc4385 | ||
|
|
7b367818fc | ||
|
|
9e4dd6f37f | ||
|
|
22144d89fc | ||
|
|
c5ef700eb7 | ||
|
|
17d614c66a | ||
|
|
7406edfd8f | ||
|
|
6451feee0e | ||
|
|
912b06b34b | ||
|
|
9fab7e6122 | ||
|
|
ea83b2b1d0 | ||
|
|
f6a88d71c6 | ||
|
|
4fed263885 | ||
|
|
db2e6f2d1c | ||
|
|
58477dcd82 | ||
|
|
536c8fa454 | ||
|
|
55bdd26439 | ||
|
|
89f44c10a1 | ||
|
|
8b028068bb | ||
|
|
f7766d305b | ||
|
|
1b7ee7cf5a | ||
|
|
09e037c96e | ||
|
|
bfb6dc4a8e | ||
|
|
196a1bcc26 | ||
|
|
73f1d9bb66 | ||
|
|
1988662607 | ||
|
|
3e2c808b4b | ||
|
|
dab4307e04 | ||
|
|
dd03e0acc6 | ||
|
|
e335e6c480 | ||
|
|
0e228acbfb | ||
|
|
201e02e73f | ||
|
|
71447e55aa | ||
|
|
8ad30e2625 | ||
|
|
104f1212e6 | ||
|
|
65a4862d1f | ||
|
|
236c392d28 | ||
|
|
b38c43141c | ||
|
|
9225cdea8a | ||
|
|
26a8cdcc03 | ||
|
|
3e0a71f69f | ||
|
|
4394701de3 | ||
|
|
b6484cb2b4 | ||
|
|
90ece09ee9 | ||
|
|
febcc3dddc | ||
|
|
2da7145132 | ||
|
|
6adc8f7ea7 | ||
|
|
5bbd3c6158 | ||
|
|
1fab884a2f | ||
|
|
04c35b465e | ||
|
|
7e952b028a | ||
|
|
b7686d06a7 | ||
|
|
c30c4ef266 | ||
|
|
469c0b6a55 | ||
|
|
c3e93e7593 | ||
|
|
7bbe8b2483 | ||
|
|
7b968a2401 | ||
|
|
253025c0fe | ||
|
|
7b074765ab | ||
|
|
1a5dbd29e0 | ||
|
|
b87b3dc38a | ||
|
|
6e1da13920 | ||
|
|
406e266bb4 | ||
|
|
2c9a519c5e | ||
|
|
98eeec3145 | ||
|
|
7cb753754b | ||
|
|
11dce91281 | ||
|
|
51aa469f67 | ||
|
|
58ced36445 | ||
|
|
11fd8a59af | ||
|
|
a39cdd3b2b | ||
|
|
53af8f331d | ||
|
|
9f54181494 | ||
|
|
6a5daab520 | ||
|
|
349c0619aa | ||
|
|
6dc2175e1f | ||
|
|
96a34f753b | ||
|
|
04e13eed7d | ||
|
|
5b24ac7898 | ||
|
|
34c7ac8926 | ||
|
|
3404bb1865 | ||
|
|
de95e50804 | ||
|
|
703fdb2bc6 | ||
|
|
5d93946365 | ||
|
|
e7b9bc6808 | ||
|
|
46b347b661 | ||
|
|
fc96da869a | ||
|
|
f93e6ad0f6 | ||
|
|
8d8b4a69b7 | ||
|
|
2cf07e2185 | ||
|
|
e6ae890def | ||
|
|
79cac36b34 | ||
|
|
9385a27ff0 | ||
|
|
f2e4689d0c | ||
|
|
70fabebcb3 | ||
|
|
c272e1ccdf | ||
|
|
fd5012c04e | ||
|
|
bfc57a6f6d | ||
|
|
540d4bef1e | ||
|
|
5149ff7b12 | ||
|
|
01cd68a5aa | ||
|
|
b700c64dc2 | ||
|
|
350c903793 | ||
|
|
39afe4c7bd | ||
|
|
b9435e3cea | ||
|
|
a7329e5cc9 | ||
|
|
a146c5bf78 | ||
|
|
557f849519 | ||
|
|
03dc6d92ae | ||
|
|
3c46870109 | ||
|
|
88dd18e045 | ||
|
|
6b426e78f6 | ||
|
|
70a3c2c648 | ||
|
|
6ea0895803 | ||
|
|
b1a14401c2 | ||
|
|
e0486ea68e | ||
|
|
0ac434da78 | ||
|
|
6e4b159611 | ||
|
|
bc4342b2d0 | ||
|
|
cb271f51d1 | ||
|
|
ea8b8eec1c | ||
|
|
b1964851c9 | ||
|
|
393e4ac90e | ||
|
|
0163edc868 | ||
|
|
3efdd55fb8 | ||
|
|
122cf4c897 | ||
|
|
938d7275ba | ||
|
|
8f9b9d31e2 | ||
|
|
d1fffab235 | ||
|
|
ebebf94750 | ||
|
|
b0ac98a7cd | ||
|
|
a132d6e141 | ||
|
|
a1043121fc | ||
|
|
5ba189ffb4 | ||
|
|
d2c2811249 | ||
|
|
99875afcc0 | ||
|
|
ae8660fe06 | ||
|
|
01c93a2ee3 | ||
|
|
d8549fe09a | ||
|
|
a12e093417 | ||
|
|
2f8088432c | ||
|
|
3cf6c6ee0c | ||
|
|
8993882dcb | ||
|
|
c6c2893e2c | ||
|
|
96a260b027 | ||
|
|
6bb2fad9b0 | ||
|
|
9d95ae9341 | ||
|
|
68743012e4 | ||
|
|
ef2950bca2 | ||
|
|
6f67ea44dc | ||
|
|
26c42bd559 | ||
|
|
c3c745ca19 | ||
|
|
2463f0257e | ||
|
|
e2b83624a3 | ||
|
|
e0310906c7 | ||
|
|
2741c5c330 | ||
|
|
175fc8591e | ||
|
|
3c62586878 | ||
|
|
8b95e12468 | ||
|
|
90a52e4602 | ||
|
|
5677c4882e | ||
|
|
6d17cd50fe | ||
|
|
1cd98665de | ||
|
|
cfcf97b616 | ||
|
|
6efebef714 | ||
|
|
600f660f5e | ||
|
|
003461ec96 | ||
|
|
00b4501c59 | ||
|
|
8142794447 | ||
|
|
ea2ef78ceb | ||
|
|
11dca0bd29 | ||
|
|
dccd6b4a91 | ||
|
|
46b1ecc77d | ||
|
|
8a319e90c6 | ||
|
|
652914a67b | ||
|
|
22f902f0f7 | ||
|
|
131b232155 | ||
|
|
52da64b6dc | ||
|
|
75306b7a6e | ||
|
|
867f9ae362 | ||
|
|
ab23db2fa1 | ||
|
|
349d556339 | ||
|
|
7bfd0ecbb5 | ||
|
|
0f43e0bb7d | ||
|
|
43c2cf8e1c | ||
|
|
00383b9438 | ||
|
|
f36ccdd9fa | ||
|
|
909df0d7bb | ||
|
|
0410654c2c | ||
|
|
0dbe9cb586 | ||
|
|
45e5867736 | ||
|
|
1ccc25b486 | ||
|
|
d6aa63bd97 | ||
|
|
cf1ad3fd8c | ||
|
|
2554ebf273 | ||
|
|
d642e03cd0 | ||
|
|
c8d75fbd8a | ||
|
|
db0644eddf | ||
|
|
a8c4bed4e8 | ||
|
|
a70830a7b7 | ||
|
|
4bb004c6f4 | ||
|
|
6467d3b58e | ||
|
|
194ab5aa92 | ||
|
|
c8b8806fed | ||
|
|
1a677c7441 | ||
|
|
2b78f73fe5 | ||
|
|
31d271084f | ||
|
|
2200a0223b | ||
|
|
1e056ee415 | ||
|
|
4ae743ecb6 | ||
|
|
6c03246ec8 | ||
|
|
f506644a8c | ||
|
|
b83a0f9a9c | ||
|
|
66c2bdd65a | ||
|
|
1be4c59481 | ||
|
|
32e4b0b1b2 | ||
|
|
dad55fe7a8 | ||
|
|
9147e6c5bf | ||
|
|
6c2301ec39 | ||
|
|
7e96d57627 | ||
|
|
de6112adb7 | ||
|
|
46214ce7cd | ||
|
|
ee619f2919 | ||
|
|
269699988b | ||
|
|
4cecf04639 | ||
|
|
e7b81e4d46 | ||
|
|
e1acf0a94d | ||
|
|
b9d7bb2d8e | ||
|
|
90f357db6f | ||
|
|
3c376c8e9b | ||
|
|
b24bbb2cb1 | ||
|
|
97f2c74dd8 | ||
|
|
5665426e6b | ||
|
|
6150679736 | ||
|
|
4804f45156 | ||
|
|
537c03504f | ||
|
|
91642b2bd9 | ||
|
|
f71eda1c2f | ||
|
|
c347013eef | ||
|
|
59bd081e92 | ||
|
|
6166e19405 | ||
|
|
21b31f11b8 | ||
|
|
dd2e05b33f | ||
|
|
40c0207377 | ||
|
|
dc12cacd50 | ||
|
|
99b08fbd13 | ||
|
|
bf2a39b76d | ||
|
|
b84b52202e | ||
|
|
eaf5547b88 | ||
|
|
ea44bbff9f | ||
|
|
cc0c96af50 | ||
|
|
ef3b244c1a | ||
|
|
45ecbc91e8 | ||
|
|
401caaabb4 | ||
|
|
22eb6cb5fa | ||
|
|
65dcb6acea | ||
|
|
b4630c403d | ||
|
|
86313b337a | ||
|
|
87329c689d | ||
|
|
ca3b8ef2e7 | ||
|
|
a0413b5d91 | ||
|
|
d6276a15d2 | ||
|
|
39f60c4740 | ||
|
|
17cf9d33cf | ||
|
|
fa7866291a | ||
|
|
59f905a573 | ||
|
|
060571290a | ||
|
|
30888cf5ca | ||
|
|
eb89b65b59 | ||
|
|
bf56e25404 | ||
|
|
34fa2011be | ||
|
|
a8e787fda8 | ||
|
|
ad692c185e | ||
|
|
d16ccd7e37 | ||
|
|
a92d5f3569 | ||
|
|
95ebd07735 | ||
|
|
6a0f527e0e | ||
|
|
65a82d7ee6 | ||
|
|
2898067318 | ||
|
|
6d2a1cfb44 | ||
|
|
bced53966e | ||
|
|
a429f83f5e | ||
|
|
2f0ad0d28c | ||
|
|
fc4ef2b430 | ||
|
|
e3b0474901 | ||
|
|
cc9f899cd6 | ||
|
|
a022b1a6c1 | ||
|
|
4971b9fc39 | ||
|
|
939bf66a80 | ||
|
|
309a54ba69 | ||
|
|
8568459c74 | ||
|
|
9a2eb46cea | ||
|
|
48e2bd5114 | ||
|
|
a2a70bd6d0 | ||
|
|
3e3fce5f38 | ||
|
|
7c8e26c717 | ||
|
|
8dad8f25cf | ||
|
|
ad85ac3dde | ||
|
|
d3e956f7cc | ||
|
|
3da1b24b6a | ||
|
|
42d2b24d48 | ||
|
|
8685fcd593 | ||
|
|
45aa93e73d | ||
|
|
676cd6ffee | ||
|
|
a9de2f80f2 | ||
|
|
86ec88b8fe | ||
|
|
6b87d94bb0 | ||
|
|
706b30f4d2 | ||
|
|
3bcc60333d | ||
|
|
bf6c435ae6 | ||
|
|
abc4840d16 | ||
|
|
a118003d0a | ||
|
|
ccc91403c5 | ||
|
|
9b0b1c3cc2 | ||
|
|
395aed5f97 | ||
|
|
278e5f4cc6 | ||
|
|
7fa5046575 | ||
|
|
9b8067cbc3 | ||
|
|
e252f0feba | ||
|
|
8e8ec2fba6 | ||
|
|
41e698c482 | ||
|
|
82127d8406 | ||
|
|
5a65b6caee | ||
|
|
ed6a92cd0f | ||
|
|
577ccd32f0 | ||
|
|
72657758d5 | ||
|
|
f9ba0483ca | ||
|
|
d82fb57223 | ||
|
|
5c10e9a7fa | ||
|
|
578ad903bc | ||
|
|
789b445815 | ||
|
|
c299d9249f | ||
|
|
795c2e4aa2 | ||
|
|
031a63d5c2 | ||
|
|
f5ef8f5bc0 | ||
|
|
30f7536cbe | ||
|
|
8abdbc41e1 | ||
|
|
7f229bbf39 | ||
|
|
d4947ba0ee | ||
|
|
2cee716181 | ||
|
|
a7383ad35d | ||
|
|
52cc2d224e | ||
|
|
5db10bdcc7 | ||
|
|
43119efaf0 | ||
|
|
16bf7aa3ab | ||
|
|
b2a623ee16 | ||
|
|
c40406d26e | ||
|
|
87ff5ad1e0 | ||
|
|
aa63f2be1f | ||
|
|
5cb90bdf77 | ||
|
|
4f557af6cb | ||
|
|
5f63797f17 | ||
|
|
bbb32ada4a | ||
|
|
fc33f19b06 | ||
|
|
7efab85b10 | ||
|
|
0ece168833 | ||
|
|
6be4c6af0e | ||
|
|
4f6df73156 | ||
|
|
cd20078bef | ||
|
|
5e0e8de4f6 | ||
|
|
ed5e76adac | ||
|
|
12265b245d | ||
|
|
37b1389f12 | ||
|
|
b679eb1a95 | ||
|
|
2f79cf1304 | ||
|
|
3fe0cb9281 | ||
|
|
9f828224bc | ||
|
|
2153e43969 | ||
|
|
c6d19a4afb | ||
|
|
016e8fde89 | ||
|
|
d87db70ed0 | ||
|
|
c3b9d69919 | ||
|
|
c3a9db6488 | ||
|
|
8bdbfbf194 | ||
|
|
f204af173d | ||
|
|
12ca103f9f | ||
|
|
c2ca899c7e | ||
|
|
902ffa6853 | ||
|
|
f03acce84c | ||
|
|
93ebf163cb | ||
|
|
f736646ac6 | ||
|
|
262113f9ee | ||
|
|
e75cdd4c27 | ||
|
|
559257ed33 | ||
|
|
71e671f053 | ||
|
|
9fbe573cca | ||
|
|
6856848efc | ||
|
|
ff6967de9e | ||
|
|
5c4170951a | ||
|
|
500eb17449 | ||
|
|
ffdc33d964 | ||
|
|
3e4dd5019d | ||
|
|
cb2f422e1c | ||
|
|
4559a38172 | ||
|
|
91dc2b96fc | ||
|
|
fb8555a6cc | ||
|
|
ebf1126351 | ||
|
|
3a81eb7d48 | ||
|
|
3ad4d937c5 | ||
|
|
c35e5ca7dd | ||
|
|
4a6c8f3cb2 | ||
|
|
e7c8e62d75 | ||
|
|
d6d16b4696 | ||
|
|
dc1968b968 | ||
|
|
4fef9448bf | ||
|
|
4bb5345e13 | ||
|
|
d294cab933 | ||
|
|
f139178136 | ||
|
|
4eb0ed9f2f | ||
|
|
7a598f32dc | ||
|
|
b776336ebf | ||
|
|
481df98f58 | ||
|
|
8cb1024ff6 | ||
|
|
41ff2a9276 | ||
|
|
acb99a03e3 | ||
|
|
4b2eb22989 | ||
|
|
a505826ec9 | ||
|
|
54d068de44 | ||
|
|
25d8e93a90 | ||
|
|
9712fb2d57 | ||
|
|
2b49a11b2a | ||
|
|
1bfc667515 | ||
|
|
4c5432be6f | ||
|
|
9dc2a30793 | ||
|
|
13e8f25ca9 | ||
|
|
ac1964edb1 | ||
|
|
dbb1bbf101 | ||
|
|
0ac80aacd1 | ||
|
|
7486cb7c64 | ||
|
|
e3cdc0a05b | ||
|
|
6913bce6a1 | ||
|
|
7010c835d2 | ||
|
|
2aa1b43f01 | ||
|
|
32cbb714f9 | ||
|
|
7f4fd6168a | ||
|
|
647534a4f8 | ||
|
|
31fa857319 | ||
|
|
a363d443bf | ||
|
|
75c522e082 | ||
|
|
ebeaf64fbb | ||
|
|
6afe232c4d | ||
|
|
05df7f3394 | ||
|
|
0cdbe714d2 | ||
|
|
9d6d60dcf0 | ||
|
|
65350ad552 | ||
|
|
b437c3cf0c | ||
|
|
5488c66f53 | ||
|
|
ef48193fad | ||
|
|
9ee1dd99eb | ||
|
|
0307ba7883 | ||
|
|
1a5b0969b9 | ||
|
|
3c399fbe3f | ||
|
|
a9a5c4a052 | ||
|
|
d5498c8712 | ||
|
|
09321ccc9c | ||
|
|
a3fe5f5757 | ||
|
|
dfed713647 | ||
|
|
92dc3c89af | ||
|
|
eb610441b5 | ||
|
|
67eeb145e1 | ||
|
|
a3835b1279 | ||
|
|
5f38d5ee63 | ||
|
|
53eaf85969 | ||
|
|
d54acca53a | ||
|
|
2959156070 | ||
|
|
b0ddb33acc | ||
|
|
62141d3d27 | ||
|
|
478c149bbb | ||
|
|
7b39a3084f | ||
|
|
a6daf0d991 | ||
|
|
54f11ad603 | ||
|
|
40df0dcf3d | ||
|
|
99d256422e | ||
|
|
389feda65f | ||
|
|
5a8f0f3557 | ||
|
|
b9b76977b6 | ||
|
|
27917c2d89 | ||
|
|
0cfdce0d5e | ||
|
|
ab0e657d77 | ||
|
|
34b40500c3 | ||
|
|
a3b0135557 | ||
|
|
8546db9dfd | ||
|
|
ab579587f2 | ||
|
|
ecd75e43b0 | ||
|
|
061f91ba41 | ||
|
|
97b31352c2 | ||
|
|
77d2479c75 | ||
|
|
f0b2798c37 | ||
|
|
8002936fe3 | ||
|
|
f440bb193d | ||
|
|
faa5883f09 | ||
|
|
7251e5bd62 | ||
|
|
7be90f71d3 | ||
|
|
19d3a0cbac | ||
|
|
0ddafeeabf | ||
|
|
b2ad402df4 | ||
|
|
e46dac3fbd | ||
|
|
5c8fbe2c6f | ||
|
|
f11a1b0122 | ||
|
|
8f4cca47e9 | ||
|
|
4fa736114c | ||
|
|
13ac1e1957 | ||
|
|
c28a0374f1 | ||
|
|
93229fc54b | ||
|
|
997190a050 | ||
|
|
707a5fca91 | ||
|
|
6d92b9b910 | ||
|
|
9b38c04579 | ||
|
|
06144a1fc4 | ||
|
|
0d152eb907 | ||
|
|
1a61bf7bff | ||
|
|
87a296f728 | ||
|
|
e98c0621d3 | ||
|
|
40c0b4ef2e | ||
|
|
44142706c3 | ||
|
|
208832e847 | ||
|
|
12066411db | ||
|
|
e5008fbf93 | ||
|
|
d4ffdaffc2 | ||
|
|
bb5a310aec | ||
|
|
ba558b2d75 | ||
|
|
82b344db1b | ||
|
|
f2599ffe90 | ||
|
|
50fc63251e | ||
|
|
b1ef39927c | ||
|
|
b4472a165e | ||
|
|
a87fc5f863 | ||
|
|
2f3f5f19cd | ||
|
|
e11eb4775e | ||
|
|
a15a3ae810 | ||
|
|
daeb172ba1 | ||
|
|
0e5b0ebda6 | ||
|
|
d5254dff7b | ||
|
|
146d6bf7fb | ||
|
|
0a8c1528cf | ||
|
|
941921dd0f | ||
|
|
0ca3a38ba6 | ||
|
|
1678a039ae | ||
|
|
e5406ed3cf | ||
|
|
4d9ca71c82 | ||
|
|
6045f07a9c | ||
|
|
9b22d5cab1 | ||
|
|
753b03d581 | ||
|
|
1e37d8ccb3 | ||
|
|
4038cdf70a | ||
|
|
d09b33ae93 | ||
|
|
0687051ffb | ||
|
|
8641da13b9 | ||
|
|
cc32566c92 | ||
|
|
955e2d2826 | ||
|
|
4e57969e4e | ||
|
|
52012003e9 | ||
|
|
3bdc7b9a88 | ||
|
|
a2a2489a97 | ||
|
|
b2c2b42408 | ||
|
|
f5744cc9bf | ||
|
|
56264ea52a | ||
|
|
1f50bc79bc | ||
|
|
c6d2c1e520 | ||
|
|
8aee009a0a | ||
|
|
5ccd618189 | ||
|
|
5161e1abb3 | ||
|
|
e15f2ef11a | ||
|
|
8dea640e9a | ||
|
|
4005b8d1d2 | ||
|
|
85ac99aee0 | ||
|
|
e085fd9e95 | ||
|
|
f26ed1c8c1 | ||
|
|
4cf7282027 | ||
|
|
0ae81d4115 | ||
|
|
226fc3d99b | ||
|
|
bd29b7d031 | ||
|
|
c8b0c9af0a | ||
|
|
01c4f243d4 | ||
|
|
fe9322ecd5 | ||
|
|
904b3008a9 | ||
|
|
66f1e0f4cd | ||
|
|
e8bfeae048 | ||
|
|
fd7278517d | ||
|
|
b13735e4cc | ||
|
|
a8be277ca0 | ||
|
|
1dfbf6eed6 | ||
|
|
29b9bb96f3 | ||
|
|
14167f826b | ||
|
|
96ea27322d | ||
|
|
71d3a7de40 | ||
|
|
fe3836b497 | ||
|
|
49559f1a1a | ||
|
|
042354d00f | ||
|
|
f0d3901b6b | ||
|
|
9d6f629f6a | ||
|
|
7b99d5ebcb | ||
|
|
8b2174d249 | ||
|
|
ffdca7eea7 | ||
|
|
684727b32e | ||
|
|
3a8b69d69b | ||
|
|
1bba9fcc53 | ||
|
|
f7fc9adc63 | ||
|
|
e60d1788b2 | ||
|
|
a7e13e96e4 | ||
|
|
e644493e02 | ||
|
|
06f4e627fc | ||
|
|
e0775546f6 | ||
|
|
0dc96210b6 | ||
|
|
a95f30ce45 | ||
|
|
83a2427a61 | ||
|
|
184b13f2fb | ||
|
|
9a632d9b7c | ||
|
|
c404e9ffd0 | ||
|
|
b1fe8c5325 | ||
|
|
7307084dfd | ||
|
|
40899d08dd | ||
|
|
00e6749d8b | ||
|
|
05466d318a | ||
|
|
6312d785d8 | ||
|
|
34ff946f4d | ||
|
|
158cb307f6 | ||
|
|
e35daf95c0 | ||
|
|
b448890210 | ||
|
|
be6836b0ef | ||
|
|
60afba5592 | ||
|
|
d043542094 | ||
|
|
89145a7711 | ||
|
|
7744989583 | ||
|
|
35d65bc7d7 | ||
|
|
7fdb099097 | ||
|
|
1f55356744 | ||
|
|
00821036bb | ||
|
|
6b89e86a97 | ||
|
|
65f5aa59e6 | ||
|
|
0eff324ce0 | ||
|
|
676c6a784d | ||
|
|
cc369f41f5 | ||
|
|
6c889895bd | ||
|
|
580ada8c4f | ||
|
|
aa15312670 | ||
|
|
df6f3f6f32 | ||
|
|
2b09e3ca3d | ||
|
|
9a61067367 | ||
|
|
c8617e70a8 | ||
|
|
38b959f1a9 | ||
|
|
50ea4c39da | ||
|
|
ff08416b12 | ||
|
|
8d173efe2d | ||
|
|
aa698a8412 | ||
|
|
e6bfedb58b | ||
|
|
37e6b262eb | ||
|
|
9373d0c915 | ||
|
|
a467d76832 | ||
|
|
937399606e | ||
|
|
c2076af43b | ||
|
|
4de4a70be7 | ||
|
|
8afce7e651 | ||
|
|
2bf7f2feae | ||
|
|
8386496456 | ||
|
|
7f9c76a6fc | ||
|
|
d4d37667e1 | ||
|
|
d4543be8eb | ||
|
|
e38a3051a1 | ||
|
|
c907e80c10 | ||
|
|
a241e950f2 | ||
|
|
39232cbcbb | ||
|
|
a7b60f6780 | ||
|
|
05ab1c2e0a | ||
|
|
8c7e8255bb | ||
|
|
f0e5113a7f | ||
|
|
a830bee9c7 | ||
|
|
bdc0134e88 | ||
|
|
190ecb7ada | ||
|
|
a77d513513 | ||
|
|
7b99daebd7 | ||
|
|
2d4a2fd10b | ||
|
|
a0e6cd93b6 | ||
|
|
b3f42dc51e | ||
|
|
b0cad30796 | ||
|
|
fc360608b7 | ||
|
|
01733c94fa | ||
|
|
68a9b14eca | ||
|
|
738ed93221 | ||
|
|
7166a474ae | ||
|
|
e632539b61 | ||
|
|
e7f6df46e8 | ||
|
|
a123246ac9 | ||
|
|
ddb9933c91 | ||
|
|
9f7f089d8a | ||
|
|
e1f48c2b46 | ||
|
|
d7017ce1e4 | ||
|
|
6666d31ee9 | ||
|
|
29aa159827 | ||
|
|
6bfc37309e | ||
|
|
71c530590e | ||
|
|
d596a877fa | ||
|
|
b9b15e5f32 | ||
|
|
d66e6510e3 | ||
|
|
a233a8cc82 | ||
|
|
d42ebab575 | ||
|
|
51af8c27f6 | ||
|
|
44acf2f471 | ||
|
|
ceb1e4c4f7 | ||
|
|
6db6c3b2cc | ||
|
|
2e02e24e70 | ||
|
|
95a3b5c41e | ||
|
|
3fe06b3548 | ||
|
|
1a83eed38f | ||
|
|
4fa1604230 | ||
|
|
edf2cd0b92 | ||
|
|
b5034cf535 | ||
|
|
29305dd070 | ||
|
|
3c99e3b7c7 | ||
|
|
9a226ec7e6 | ||
|
|
2959600f52 | ||
|
|
ff9231eec4 | ||
|
|
6b8f5963a8 | ||
|
|
a1841c35ae | ||
|
|
aa2d747d8f | ||
|
|
ee613b564c | ||
|
|
2bf5a3843d | ||
|
|
29e84c9e88 | ||
|
|
23666858e2 | ||
|
|
5151a4521f | ||
|
|
6b948cfc7e | ||
|
|
9054165e8a | ||
|
|
11cc33a982 | ||
|
|
e2bcaa4d75 | ||
|
|
94b2d48d02 | ||
|
|
0293a61895 | ||
|
|
7ffe65770e | ||
|
|
cb9849e192 | ||
|
|
299e640170 | ||
|
|
954963b40e | ||
|
|
779bcdd990 | ||
|
|
0ffefe44a7 | ||
|
|
deddbda26e | ||
|
|
1a92bf9e8e | ||
|
|
8741017819 | ||
|
|
35c2b961be | ||
|
|
0d980134e7 | ||
|
|
3ad0686bc7 | ||
|
|
df9410cd15 | ||
|
|
041e9957dd | ||
|
|
6b97af4a03 | ||
|
|
e234158cc9 | ||
|
|
c30fb7f590 | ||
|
|
5c840f333f | ||
|
|
b24a22b0b6 | ||
|
|
47cc04c0a3 | ||
|
|
ccad883256 | ||
|
|
3a2aa54d2a | ||
|
|
d423f58566 | ||
|
|
0bcf50f1b5 | ||
|
|
8d5cc42ef5 | ||
|
|
a772ab323e | ||
|
|
f55d75e7fc | ||
|
|
5865688c16 | ||
|
|
3e4c9c8713 | ||
|
|
36e95bc868 | ||
|
|
3e40f5c588 | ||
|
|
643262bc6a | ||
|
|
f1f311e456 | ||
|
|
c1a22dda46 | ||
|
|
d14134ddce | ||
|
|
48d33b070f | ||
|
|
0eb9dd5fe5 | ||
|
|
4705b7da0e | ||
|
|
c0f276a892 | ||
|
|
e666c6850e | ||
|
|
f9aa3c27be | ||
|
|
5fb8100fc5 | ||
|
|
41add9f8ca | ||
|
|
513b96b61c | ||
|
|
8730852d6e | ||
|
|
ca496c13b8 | ||
|
|
0467004144 | ||
|
|
e14739e102 | ||
|
|
0eaac1cd79 | ||
|
|
5f726d697b | ||
|
|
9c1c962aa7 | ||
|
|
c122eab77b | ||
|
|
617d2338c4 | ||
|
|
c56f288b56 | ||
|
|
51b4d5a57a | ||
|
|
43d30180e8 | ||
|
|
3b805813cd | ||
|
|
21cb4eafe5 | ||
|
|
fa4c8110e7 | ||
|
|
25529ad95f | ||
|
|
dba30bbfed | ||
|
|
4cd70138b6 | ||
|
|
0a2cacbba8 | ||
|
|
d213764d19 | ||
|
|
702153d087 | ||
|
|
8babf0d2b5 | ||
|
|
9c1d4183fd | ||
|
|
c4992bd5f3 | ||
|
|
2da0d479e7 | ||
|
|
628d9577a2 | ||
|
|
6b2f4b12fd | ||
|
|
bc7688a69f | ||
|
|
7b901e180a | ||
|
|
e67ffd2d87 | ||
|
|
045de94b49 | ||
|
|
8624d83be0 | ||
|
|
0634e135df | ||
|
|
962cfc5eb9 | ||
|
|
ca64d8a861 | ||
|
|
35250eb230 | ||
|
|
5dd0a72a52 | ||
|
|
735e78f01d | ||
|
|
ae7c4c33c0 | ||
|
|
c032dd0f45 | ||
|
|
ce46555e77 | ||
|
|
2f98dd0429 | ||
|
|
71f5392f89 | ||
|
|
6d63b8e71e | ||
|
|
f6ca97d1dc | ||
|
|
4e50ec81a0 | ||
|
|
386abc5eba | ||
|
|
04ea6dac83 | ||
|
|
f16913a76d | ||
|
|
03ff87d11c | ||
|
|
460e0711c6 | ||
|
|
b8eb3ecb1d | ||
|
|
2208a21a6c | ||
|
|
2d0aca0d20 | ||
|
|
b7a558b951 | ||
|
|
3c5deb9aaf | ||
|
|
4d64124eef | ||
|
|
e2cbb7e7da | ||
|
|
df79098adc | ||
|
|
13ba5ba0db | ||
|
|
2eb2ace539 | ||
|
|
064f6629ab | ||
|
|
786244c0d3 | ||
|
|
e1ae0d7e90 | ||
|
|
c36fa0c7e2 | ||
|
|
24c587518a | ||
|
|
4c1f2b2a5b | ||
|
|
6bcfe65877 | ||
|
|
28a70eba07 | ||
|
|
285db2f40b | ||
|
|
0fc5445003 | ||
|
|
e8ea2e6f05 | ||
|
|
b792f00553 | ||
|
|
4df44d8b32 | ||
|
|
58c296c1ff | ||
|
|
13de66d559 | ||
|
|
e5498ca20f | ||
|
|
0558b203fe | ||
|
|
38d09f9e78 | ||
|
|
768f62a24a | ||
|
|
7e62a4a79c | ||
|
|
761861f0b7 | ||
|
|
4e291795a6 | ||
|
|
7fe9d9520a | ||
|
|
4c2961f0d9 | ||
|
|
ef26484153 | ||
|
|
79aac473b3 | ||
|
|
5c3177cc79 | ||
|
|
6c75b8a36a | ||
|
|
ee0e381d65 | ||
|
|
8cb7a7e7a5 | ||
|
|
bcf5b5fdcb | ||
|
|
ef18ddd866 | ||
|
|
cee4116b80 | ||
|
|
0c53bd6dd4 | ||
|
|
aff334fdd6 | ||
|
|
185bd1e53c | ||
|
|
006635003e | ||
|
|
f2fd5205ef | ||
|
|
31be4d2454 | ||
|
|
5c18346cd5 | ||
|
|
e0b634ba3b | ||
|
|
a05155cb75 | ||
|
|
455b168366 | ||
|
|
06f486a8eb | ||
|
|
42722b2873 | ||
|
|
ecb5137dbe | ||
|
|
2531961bf8 | ||
|
|
417bf2c935 | ||
|
|
3673dba1e2 | ||
|
|
9b288c6933 | ||
|
|
5fac4f7b45 | ||
|
|
c7b6e19872 | ||
|
|
033e9e09fb | ||
|
|
3dcf3f8a82 | ||
|
|
403ed48c3e | ||
|
|
4d797c9232 | ||
|
|
ec6794b9ba | ||
|
|
634ce87bba | ||
|
|
98bca30dfb | ||
|
|
cc0fae8e4e | ||
|
|
8d8da71f20 | ||
|
|
9a097214a6 | ||
|
|
619945b861 | ||
|
|
71774bce6f | ||
|
|
9c54886f14 | ||
|
|
1252bacb7a | ||
|
|
a1b00f9053 | ||
|
|
e4369e06bc | ||
|
|
29b8b79732 | ||
|
|
2c7c19dfb1 | ||
|
|
b79d967371 | ||
|
|
69bb6ebaf6 | ||
|
|
57b2fb4645 | ||
|
|
bf5d2a68f5 | ||
|
|
7738ebbc0f | ||
|
|
6d7f788989 | ||
|
|
be754244a3 | ||
|
|
e0f426d863 | ||
|
|
e987a915e8 | ||
|
|
a79ff1c6c9 | ||
|
|
2dcb4134cc | ||
|
|
e309f75118 | ||
|
|
643402da1c | ||
|
|
a1d1abfffc | ||
|
|
b5758e67f9 | ||
|
|
2851833726 | ||
|
|
c1ef6940b0 | ||
|
|
2aba9c081c | ||
|
|
eb21170691 | ||
|
|
d9129cb9c5 | ||
|
|
4315c157c7 | ||
|
|
da5bef501e | ||
|
|
4fbba98168 | ||
|
|
87c82dea3d | ||
|
|
c08a2b6638 | ||
|
|
7bc874c7fd | ||
|
|
fac0e4e603 | ||
|
|
199e3d2234 | ||
|
|
5906d37818 | ||
|
|
e495ffec78 | ||
|
|
84ccb85184 | ||
|
|
686949b258 | ||
|
|
3e2f90a32a | ||
|
|
bb31e64752 | ||
|
|
481cf02db9 | ||
|
|
2f225e2340 | ||
|
|
eed1c2344d | ||
|
|
4241caef95 | ||
|
|
2103ae5fdf | ||
|
|
6055906eb1 | ||
|
|
e98edc1a1a | ||
|
|
62382809b2 | ||
|
|
0572336ff7 | ||
|
|
d8feceebb5 | ||
|
|
da4faacd6b | ||
|
|
39c28626aa | ||
|
|
5e8a7a03c3 | ||
|
|
dd2522d8d0 | ||
|
|
fe792882b5 | ||
|
|
d3ead2cd09 | ||
|
|
c879591f45 | ||
|
|
c315f63e4b | ||
|
|
2fb36b116d | ||
|
|
ca388a9acf | ||
|
|
32b02c9925 | ||
|
|
54d5bce445 | ||
|
|
b7afcf3416 | ||
|
|
8ed3658447 | ||
|
|
3aa614b983 | ||
|
|
3953092edd | ||
|
|
ef5a0b9afc |
@@ -1,6 +1,7 @@
|
||||
[run]
|
||||
omit =
|
||||
scripts/*
|
||||
freqtrade/tests/*
|
||||
freqtrade/templates/*
|
||||
freqtrade/vendor/*
|
||||
freqtrade/__main__.py
|
||||
tests/*
|
||||
|
||||
17
.dependabot/config.yml
Normal file
17
.dependabot/config.yml
Normal file
@@ -0,0 +1,17 @@
|
||||
version: 1
|
||||
|
||||
update_configs:
|
||||
- package_manager: "python"
|
||||
directory: "/"
|
||||
update_schedule: "weekly"
|
||||
allowed_updates:
|
||||
- match:
|
||||
update_type: "all"
|
||||
target_branch: "develop"
|
||||
|
||||
- package_manager: "docker"
|
||||
directory: "/"
|
||||
update_schedule: "daily"
|
||||
allowed_updates:
|
||||
- match:
|
||||
update_type: "all"
|
||||
1
.github/ISSUE_TEMPLATE.md
vendored
1
.github/ISSUE_TEMPLATE.md
vendored
@@ -5,6 +5,7 @@ If it hasn't been reported, please create a new issue.
|
||||
|
||||
## Step 2: Describe your environment
|
||||
|
||||
* Operating system: ____
|
||||
* Python Version: _____ (`python -V`)
|
||||
* CCXT version: _____ (`pip freeze | grep ccxt`)
|
||||
* Branch: Master | Develop
|
||||
|
||||
233
.github/workflows/ci.yml
vendored
Normal file
233
.github/workflows/ci.yml
vendored
Normal file
@@ -0,0 +1,233 @@
|
||||
name: Freqtrade CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- develop
|
||||
- github_actions_tests
|
||||
tags:
|
||||
pull_request:
|
||||
schedule:
|
||||
- cron: '0 5 * * 4'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ ubuntu-18.04, macos-latest ]
|
||||
python-version: [3.7]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v1
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
|
||||
- name: Cache_dependencies
|
||||
uses: actions/cache@v1
|
||||
id: cache
|
||||
with:
|
||||
path: ~/dependencies/
|
||||
key: ${{ runner.os }}-dependencies
|
||||
|
||||
- name: pip cache (linux)
|
||||
uses: actions/cache@preview
|
||||
if: startsWith(matrix.os, 'ubuntu')
|
||||
with:
|
||||
path: ~/.cache/pip
|
||||
key: test-${{ matrix.os }}-${{ matrix.python-version }}-pip
|
||||
|
||||
- name: pip cache (macOS)
|
||||
uses: actions/cache@preview
|
||||
if: startsWith(matrix.os, 'macOS')
|
||||
with:
|
||||
path: ~/Library/Caches/pip
|
||||
key: test-${{ matrix.os }}-${{ matrix.python-version }}-pip
|
||||
|
||||
- name: TA binary *nix
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
cd build_helpers && ./install_ta-lib.sh ${HOME}/dependencies/; cd ..
|
||||
|
||||
- name: Installation - *nix
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
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 .
|
||||
|
||||
- name: Tests
|
||||
run: |
|
||||
pytest --random-order --cov=freqtrade --cov-config=.coveragerc
|
||||
|
||||
- name: Coveralls
|
||||
if: startsWith(matrix.os, 'ubuntu')
|
||||
env:
|
||||
# Coveralls token. Not used as secret due to github not providing secrets to forked repositories
|
||||
COVERALLS_REPO_TOKEN: 6D1m0xupS3FgutfuGao8keFf9Hc0FpIXu
|
||||
run: |
|
||||
# Allow failure for coveralls
|
||||
coveralls -v || true
|
||||
|
||||
- name: Backtesting
|
||||
run: |
|
||||
cp config.json.example config.json
|
||||
freqtrade create-userdir --userdir user_data
|
||||
freqtrade backtesting --datadir tests/testdata --strategy SampleStrategy
|
||||
|
||||
- name: Hyperopt
|
||||
run: |
|
||||
cp config.json.example config.json
|
||||
freqtrade create-userdir --userdir user_data
|
||||
freqtrade hyperopt --datadir tests/testdata -e 5 --strategy SampleStrategy --hyperopt SampleHyperOpt
|
||||
|
||||
- name: Flake8
|
||||
run: |
|
||||
flake8
|
||||
|
||||
- name: Mypy
|
||||
run: |
|
||||
mypy freqtrade scripts
|
||||
|
||||
- name: Slack Notification
|
||||
uses: homoluctus/slatify@v1.8.0
|
||||
if: always() && ( github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false)
|
||||
with:
|
||||
type: ${{ job.status }}
|
||||
job_name: '*Freqtrade CI ${{ matrix.os }}*'
|
||||
mention: 'here'
|
||||
mention_if: 'failure'
|
||||
channel: '#notifications'
|
||||
url: ${{ secrets.SLACK_WEBHOOK }}
|
||||
|
||||
build_windows:
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ windows-latest ]
|
||||
python-version: [3.7]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v1
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
|
||||
- name: Pip cache (Windows)
|
||||
uses: actions/cache@preview
|
||||
if: startsWith(runner.os, 'Windows')
|
||||
with:
|
||||
path: ~\AppData\Local\pip\Cache
|
||||
key: ${{ runner.os }}-pip
|
||||
restore-keys: ${{ runner.os }}-pip
|
||||
|
||||
- name: Installation
|
||||
run: |
|
||||
./build_helpers/install_windows.ps1
|
||||
|
||||
- name: Tests
|
||||
run: |
|
||||
pytest --random-order --cov=freqtrade --cov-config=.coveragerc
|
||||
|
||||
- name: Backtesting
|
||||
run: |
|
||||
cp config.json.example config.json
|
||||
freqtrade create-userdir --userdir user_data
|
||||
freqtrade backtesting --datadir tests/testdata --strategy SampleStrategy
|
||||
|
||||
- name: Hyperopt
|
||||
run: |
|
||||
cp config.json.example config.json
|
||||
freqtrade create-userdir --userdir user_data
|
||||
freqtrade hyperopt --datadir tests/testdata -e 5 --strategy SampleStrategy --hyperopt SampleHyperOpt
|
||||
|
||||
- name: Flake8
|
||||
run: |
|
||||
flake8
|
||||
|
||||
- name: Mypy
|
||||
run: |
|
||||
mypy freqtrade scripts
|
||||
|
||||
- name: Slack Notification
|
||||
uses: homoluctus/slatify@v1.8.0
|
||||
if: always() && ( github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false)
|
||||
with:
|
||||
type: ${{ job.status }}
|
||||
job_name: '*Freqtrade CI windows*'
|
||||
mention: 'here'
|
||||
mention_if: 'failure'
|
||||
channel: '#notifications'
|
||||
url: ${{ secrets.SLACK_WEBHOOK }}
|
||||
|
||||
docs_check:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
|
||||
- name: Documentation syntax
|
||||
run: |
|
||||
./tests/test_docs.sh
|
||||
|
||||
- name: Slack Notification
|
||||
uses: homoluctus/slatify@v1.8.0
|
||||
if: failure() && ( github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false)
|
||||
with:
|
||||
type: ${{ job.status }}
|
||||
job_name: '*Freqtrade Docs*'
|
||||
channel: '#notifications'
|
||||
url: ${{ secrets.SLACK_WEBHOOK }}
|
||||
|
||||
deploy:
|
||||
needs: [ build, build_windows, docs_check ]
|
||||
runs-on: ubuntu-18.04
|
||||
if: (github.event_name == 'push' || github.event_name == 'schedule') && github.repository == 'freqtrade/freqtrade'
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
|
||||
- name: Extract branch name
|
||||
shell: bash
|
||||
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
|
||||
id: extract_branch
|
||||
|
||||
- name: Build and test and push docker image
|
||||
env:
|
||||
IMAGE_NAME: freqtradeorg/freqtrade
|
||||
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
||||
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
||||
BRANCH_NAME: ${{ steps.extract_branch.outputs.branch }}
|
||||
run: |
|
||||
build_helpers/publish_docker.sh
|
||||
|
||||
- name: Build raspberry image for ${{ steps.extract_branch.outputs.branch }}_pi
|
||||
uses: elgohr/Publish-Docker-Github-Action@2.7
|
||||
with:
|
||||
name: freqtradeorg/freqtrade:${{ steps.extract_branch.outputs.branch }}_pi
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
dockerfile: Dockerfile.pi
|
||||
# cache: true
|
||||
cache: ${{ github.event_name != 'schedule' }}
|
||||
tag_names: true
|
||||
|
||||
- name: Slack Notification
|
||||
uses: homoluctus/slatify@v1.8.0
|
||||
if: always() && ( github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false)
|
||||
with:
|
||||
type: ${{ job.status }}
|
||||
job_name: '*Freqtrade CI Deploy*'
|
||||
mention: 'here'
|
||||
mention_if: 'failure'
|
||||
channel: '#notifications'
|
||||
url: ${{ secrets.SLACK_WEBHOOK }}
|
||||
|
||||
18
.github/workflows/docker_update_readme.yml
vendored
Normal file
18
.github/workflows/docker_update_readme.yml
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
name: Update Docker Hub Description
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
dockerHubDescription:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Docker Hub Description
|
||||
uses: peter-evans/dockerhub-description@v2.1.0
|
||||
env:
|
||||
DOCKERHUB_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
||||
DOCKERHUB_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
||||
DOCKERHUB_REPOSITORY: freqtradeorg/freqtrade
|
||||
|
||||
15
.gitignore
vendored
15
.gitignore
vendored
@@ -1,12 +1,12 @@
|
||||
# Freqtrade rules
|
||||
freqtrade/tests/testdata/*.json
|
||||
hyperopt_conf.py
|
||||
config*.json
|
||||
*.sqlite
|
||||
.hyperopt
|
||||
logfile.txt
|
||||
hyperopt_trials.pickle
|
||||
user_data/
|
||||
user_data/*
|
||||
!user_data/strategy/sample_strategy.py
|
||||
!user_data/notebooks
|
||||
user_data/notebooks/*
|
||||
!user_data/notebooks/*example.ipynb
|
||||
freqtrade-plot.html
|
||||
freqtrade-profit-plot.html
|
||||
|
||||
@@ -80,7 +80,7 @@ docs/_build/
|
||||
target/
|
||||
|
||||
# Jupyter Notebook
|
||||
.ipynb_checkpoints
|
||||
*.ipynb_checkpoints
|
||||
|
||||
# pyenv
|
||||
.python-version
|
||||
@@ -92,3 +92,6 @@ target/
|
||||
|
||||
.pytest_cache/
|
||||
.mypy_cache/
|
||||
|
||||
#exceptions
|
||||
!*.gitkeep
|
||||
|
||||
33
.pyup.yml
33
.pyup.yml
@@ -1,33 +0,0 @@
|
||||
# autogenerated pyup.io config file
|
||||
# see https://pyup.io/docs/configuration/ for all available options
|
||||
|
||||
# configure updates globally
|
||||
# default: all
|
||||
# allowed: all, insecure, False
|
||||
update: all
|
||||
|
||||
# configure dependency pinning globally
|
||||
# default: True
|
||||
# allowed: True, False
|
||||
pin: True
|
||||
|
||||
schedule: "every day"
|
||||
|
||||
|
||||
search: False
|
||||
# Specify requirement files by hand, default is empty
|
||||
# default: empty
|
||||
# allowed: list
|
||||
requirements:
|
||||
- requirements.txt
|
||||
- requirements-dev.txt
|
||||
- requirements-plot.txt
|
||||
|
||||
|
||||
# configure the branch prefix the bot is using
|
||||
# default: pyup-
|
||||
branch_prefix: pyup/
|
||||
|
||||
# allow to close stale PRs
|
||||
# default: True
|
||||
close_prs: True
|
||||
49
.travis.yml
49
.travis.yml
@@ -10,45 +10,48 @@ services:
|
||||
env:
|
||||
global:
|
||||
- IMAGE_NAME=freqtradeorg/freqtrade
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- libelf-dev
|
||||
- libdw-dev
|
||||
- binutils-dev
|
||||
install:
|
||||
- cd build_helpers && ./install_ta-lib.sh; cd ..
|
||||
- export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
|
||||
- pip install --upgrade pytest-random-order
|
||||
- cd build_helpers && ./install_ta-lib.sh ${HOME}/dependencies/; cd ..
|
||||
- export LD_LIBRARY_PATH=${HOME}/dependencies/lib:$LD_LIBRARY_PATH
|
||||
- export TA_LIBRARY_PATH=${HOME}/dependencies/lib
|
||||
- export TA_INCLUDE_PATH=${HOME}/dependencies/lib/include
|
||||
- pip install -r requirements-dev.txt
|
||||
- pip install -e .
|
||||
jobs:
|
||||
|
||||
include:
|
||||
- stage: tests
|
||||
script:
|
||||
- pytest --cov=freqtrade --cov-config=.coveragerc freqtrade/tests/
|
||||
- pytest --random-order --cov=freqtrade --cov-config=.coveragerc
|
||||
# Allow failure for coveralls
|
||||
# - coveralls || true
|
||||
name: pytest
|
||||
- script:
|
||||
- cp config.json.example config.json
|
||||
- python freqtrade/main.py --datadir freqtrade/tests/testdata backtesting
|
||||
- freqtrade create-userdir --userdir user_data
|
||||
- freqtrade backtesting --datadir tests/testdata --strategy SampleStrategy
|
||||
name: backtest
|
||||
- script:
|
||||
- cp config.json.example config.json
|
||||
- python freqtrade/main.py --datadir freqtrade/tests/testdata hyperopt -e 5
|
||||
- freqtrade create-userdir --userdir user_data
|
||||
- freqtrade hyperopt --datadir tests/testdata -e 5 --strategy SampleStrategy --hyperopt SampleHyperOpt
|
||||
name: hyperopt
|
||||
- script: flake8 freqtrade
|
||||
- script: flake8
|
||||
name: flake8
|
||||
- script: mypy freqtrade
|
||||
- script:
|
||||
# Test Documentation boxes -
|
||||
# !!! <TYPE>: is not allowed!
|
||||
# !!! <TYPE> "title" - Title needs to be quoted!
|
||||
- grep -Er '^!{3}\s\S+:|^!{3}\s\S+\s[^"]' docs/*; test $? -ne 0
|
||||
name: doc syntax
|
||||
- script: mypy freqtrade scripts
|
||||
name: mypy
|
||||
|
||||
- stage: docker
|
||||
if: branch in (master, develop, feat/improve_travis) AND (type in (push, cron))
|
||||
script:
|
||||
- build_helpers/publish_docker.sh
|
||||
name: "Build and test and push docker image"
|
||||
|
||||
after_success:
|
||||
- coveralls
|
||||
# - stage: docker
|
||||
# if: branch in (master, develop, feat/improve_travis) AND (type in (push, cron))
|
||||
# script:
|
||||
# - build_helpers/publish_docker.sh
|
||||
# name: "Build and test and push docker image"
|
||||
|
||||
notifications:
|
||||
slack:
|
||||
@@ -56,4 +59,4 @@ notifications:
|
||||
cache:
|
||||
pip: True
|
||||
directories:
|
||||
- /usr/local/lib
|
||||
- $HOME/dependencies
|
||||
|
||||
@@ -11,7 +11,7 @@ Few pointers for contributions:
|
||||
- Create your PR against the `develop` branch, not `master`.
|
||||
- New features need to contain unit tests and must be PEP8 conformant (max-line-length = 100).
|
||||
|
||||
If you are unsure, discuss the feature on our [Slack](https://join.slack.com/t/highfrequencybot/shared_invite/enQtMjQ5NTM0OTYzMzY3LWMxYzE3M2MxNDdjMGM3ZTYwNzFjMGIwZGRjNTc3ZGU3MGE3NzdmZGMwNmU3NDM5ZTNmM2Y3NjRiNzk4NmM4OGE)
|
||||
If you are unsure, discuss the feature on our [Slack](https://join.slack.com/t/highfrequencybot/shared_invite/enQtNjU5ODcwNjI1MDU3LTU1MTgxMjkzNmYxNWE1MDEzYzQ3YmU4N2MwZjUyNjJjODRkMDVkNjg4YTAyZGYzYzlhOTZiMTE4ZjQ4YzM0OGE)
|
||||
or in a [issue](https://github.com/freqtrade/freqtrade/issues) before a PR.
|
||||
|
||||
## Getting started
|
||||
@@ -28,19 +28,19 @@ make it pass. It means you have introduced a regression.
|
||||
#### Test the whole project
|
||||
|
||||
```bash
|
||||
pytest freqtrade
|
||||
pytest
|
||||
```
|
||||
|
||||
#### Test only one file
|
||||
|
||||
```bash
|
||||
pytest freqtrade/tests/test_<file_name>.py
|
||||
pytest tests/test_<file_name>.py
|
||||
```
|
||||
|
||||
#### Test only one method from one file
|
||||
|
||||
```bash
|
||||
pytest freqtrade/tests/test_<file_name>.py::test_<method_name>
|
||||
pytest tests/test_<file_name>.py::test_<method_name>
|
||||
```
|
||||
|
||||
### 2. Test if your code is PEP8 compliant
|
||||
@@ -114,6 +114,6 @@ Contributors may be given commit privileges. Preference will be given to those w
|
||||
1. Access to resources for cross-platform development and testing.
|
||||
1. Time to devote to the project regularly.
|
||||
|
||||
Beeing a Committer does not grant write permission on `develop` or `master` for security reasons (Users trust FreqTrade with their Exchange API keys).
|
||||
Being a Committer does not grant write permission on `develop` or `master` for security reasons (Users trust FreqTrade with their Exchange API keys).
|
||||
|
||||
After beeing Committer for some time, a Committer may be named Core Committer and given full repository access.
|
||||
After being Committer for some time, a Committer may be named Core Committer and given full repository access.
|
||||
|
||||
10
Dockerfile
10
Dockerfile
@@ -1,7 +1,7 @@
|
||||
FROM python:3.7.2-slim-stretch
|
||||
FROM python:3.7.6-slim-stretch
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get -y install curl build-essential \
|
||||
&& apt-get -y install curl build-essential libssl-dev \
|
||||
&& apt-get clean \
|
||||
&& pip install --upgrade pip
|
||||
|
||||
@@ -16,11 +16,13 @@ RUN cd /tmp && /tmp/install_ta-lib.sh && rm -r /tmp/*ta-lib*
|
||||
ENV LD_LIBRARY_PATH /usr/local/lib
|
||||
|
||||
# Install dependencies
|
||||
COPY requirements.txt /freqtrade/
|
||||
COPY requirements.txt requirements-common.txt requirements-hyperopt.txt /freqtrade/
|
||||
RUN pip install numpy --no-cache-dir \
|
||||
&& pip install -r requirements.txt --no-cache-dir
|
||||
&& pip install -r requirements-hyperopt.txt --no-cache-dir
|
||||
|
||||
# Install and execute
|
||||
COPY . /freqtrade/
|
||||
RUN pip install -e . --no-cache-dir
|
||||
ENTRYPOINT ["freqtrade"]
|
||||
# Default to trade mode
|
||||
CMD [ "trade" ]
|
||||
|
||||
41
Dockerfile.pi
Normal file
41
Dockerfile.pi
Normal file
@@ -0,0 +1,41 @@
|
||||
FROM balenalib/raspberrypi3-debian:stretch
|
||||
|
||||
RUN [ "cross-build-start" ]
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get -y install wget curl build-essential libssl-dev libffi-dev \
|
||||
&& apt-get clean
|
||||
|
||||
# Prepare environment
|
||||
RUN mkdir /freqtrade
|
||||
WORKDIR /freqtrade
|
||||
|
||||
# Install TA-lib
|
||||
COPY build_helpers/ta-lib-0.4.0-src.tar.gz /freqtrade/
|
||||
RUN tar -xzf /freqtrade/ta-lib-0.4.0-src.tar.gz \
|
||||
&& cd /freqtrade/ta-lib/ \
|
||||
&& ./configure \
|
||||
&& make \
|
||||
&& make install \
|
||||
&& rm /freqtrade/ta-lib-0.4.0-src.tar.gz
|
||||
|
||||
ENV LD_LIBRARY_PATH /usr/local/lib
|
||||
|
||||
# Install berryconda
|
||||
RUN wget -q https://github.com/jjhelmus/berryconda/releases/download/v2.0.0/Berryconda3-2.0.0-Linux-armv7l.sh \
|
||||
&& bash ./Berryconda3-2.0.0-Linux-armv7l.sh -b \
|
||||
&& rm Berryconda3-2.0.0-Linux-armv7l.sh
|
||||
|
||||
# Install dependencies
|
||||
COPY requirements-common.txt /freqtrade/
|
||||
RUN ~/berryconda3/bin/conda install -y numpy pandas \
|
||||
&& ~/berryconda3/bin/pip install -r requirements-common.txt --no-cache-dir
|
||||
|
||||
# Install and execute
|
||||
COPY . /freqtrade/
|
||||
RUN ~/berryconda3/bin/pip install -e . --no-cache-dir
|
||||
|
||||
RUN [ "cross-build-end" ]
|
||||
|
||||
ENTRYPOINT ["/root/berryconda3/bin/python","./freqtrade/main.py"]
|
||||
CMD [ "trade" ]
|
||||
@@ -3,4 +3,4 @@ FROM freqtradeorg/freqtrade:develop
|
||||
RUN apt-get update \
|
||||
&& apt-get -y install git \
|
||||
&& apt-get clean \
|
||||
&& pip install git+https://github.com/berlinguyinca/technical
|
||||
&& pip install git+https://github.com/freqtrade/technical
|
||||
|
||||
@@ -2,4 +2,3 @@ include LICENSE
|
||||
include README.md
|
||||
include config.json.example
|
||||
recursive-include freqtrade *.py
|
||||
include freqtrade/tests/testdata/*.json
|
||||
|
||||
50
README.md
50
README.md
@@ -62,50 +62,50 @@ git checkout develop
|
||||
|
||||
For any other type of installation please refer to [Installation doc](https://www.freqtrade.io/en/latest/installation/).
|
||||
|
||||
|
||||
## Basic Usage
|
||||
|
||||
### Bot commands
|
||||
|
||||
```
|
||||
usage: main.py [-h] [-v] [--version] [-c PATH] [-d PATH] [-s NAME]
|
||||
[--strategy-path PATH] [--customhyperopt NAME]
|
||||
[--dynamic-whitelist [INT]] [--db-url PATH]
|
||||
usage: freqtrade [-h] [-v] [--logfile FILE] [--version] [-c PATH] [-d PATH]
|
||||
[-s NAME] [--strategy-path PATH] [--dynamic-whitelist [INT]]
|
||||
[--db-url PATH] [--sd-notify]
|
||||
{backtesting,edge,hyperopt} ...
|
||||
|
||||
Free, open source crypto trading bot
|
||||
|
||||
positional arguments:
|
||||
{backtesting,edge,hyperopt}
|
||||
backtesting backtesting module
|
||||
edge edge module
|
||||
hyperopt hyperopt module
|
||||
backtesting Backtesting module.
|
||||
edge Edge module.
|
||||
hyperopt Hyperopt module.
|
||||
|
||||
optional arguments:
|
||||
-h, --help show this help message and exit
|
||||
-v, --verbose verbose mode (-vv for more, -vvv to get all messages)
|
||||
--version show program\'s version number and exit
|
||||
-v, --verbose Verbose mode (-vv for more, -vvv to get all messages).
|
||||
--logfile FILE Log to the file specified
|
||||
--version show program's version number and exit
|
||||
-c PATH, --config PATH
|
||||
specify configuration file (default: config.json)
|
||||
Specify configuration file (default: None). Multiple
|
||||
--config options may be used.
|
||||
-d PATH, --datadir PATH
|
||||
path to backtest data
|
||||
Path to backtest data.
|
||||
-s NAME, --strategy NAME
|
||||
specify strategy class name (default: DefaultStrategy)
|
||||
--strategy-path PATH specify additional strategy lookup path
|
||||
--customhyperopt NAME
|
||||
specify hyperopt class name (default:
|
||||
DefaultHyperOpts)
|
||||
Specify strategy class name (default:
|
||||
DefaultStrategy).
|
||||
--strategy-path PATH Specify additional strategy lookup path.
|
||||
--dynamic-whitelist [INT]
|
||||
dynamically generate and update whitelist based on 24h
|
||||
BaseVolume (default: 20) DEPRECATED.
|
||||
Dynamically generate and update whitelist based on 24h
|
||||
BaseVolume (default: 20). DEPRECATED.
|
||||
--db-url PATH Override trades database URL, this is useful if
|
||||
dry_run is enabled or in custom deployments (default:
|
||||
None)
|
||||
None).
|
||||
--sd-notify Notify systemd service manager.
|
||||
```
|
||||
|
||||
### Telegram RPC commands
|
||||
|
||||
Telegram is not mandatory. However, this is a great way to control your bot. More details on our [documentation](https://www.freqtrade.io/en/latest/telegram-usage/)
|
||||
Telegram is not mandatory. However, this is a great way to control your bot. More details and the full command list on our [documentation](https://www.freqtrade.io/en/latest/telegram-usage/)
|
||||
|
||||
- `/start`: Starts the trader
|
||||
- `/stop`: Stops the trader
|
||||
@@ -128,12 +128,6 @@ The project is currently setup in two main branches:
|
||||
- `master` - This branch contains the latest stable release. The bot 'should' be stable on this branch, and is generally well tested.
|
||||
- `feat/*` - These are feature branches, which are being worked on heavily. Please don't use these unless you want to test a specific feature.
|
||||
|
||||
|
||||
## A note on Binance
|
||||
|
||||
For Binance, please add `"BNB/<STAKE>"` to your blacklist to avoid issues.
|
||||
Accounts having BNB accounts use this to pay for fees - if your first trade happens to be on `BNB`, further trades will consume this position and make the initial BNB order unsellable as the expected amount is not there anymore.
|
||||
|
||||
## Support
|
||||
|
||||
### Help / Slack
|
||||
@@ -141,7 +135,7 @@ Accounts having BNB accounts use this to pay for fees - if your first trade happ
|
||||
For any questions not covered by the documentation or for further
|
||||
information about the bot, we encourage you to join our slack channel.
|
||||
|
||||
- [Click here to join Slack channel](https://join.slack.com/t/highfrequencybot/shared_invite/enQtMjQ5NTM0OTYzMzY3LWMxYzE3M2MxNDdjMGM3ZTYwNzFjMGIwZGRjNTc3ZGU3MGE3NzdmZGMwNmU3NDM5ZTNmM2Y3NjRiNzk4NmM4OGE).
|
||||
- [Click here to join Slack channel](https://join.slack.com/t/highfrequencybot/shared_invite/enQtNjU5ODcwNjI1MDU3LTU1MTgxMjkzNmYxNWE1MDEzYzQ3YmU4N2MwZjUyNjJjODRkMDVkNjg4YTAyZGYzYzlhOTZiMTE4ZjQ4YzM0OGE).
|
||||
|
||||
### [Bugs / Issues](https://github.com/freqtrade/freqtrade/issues?q=is%3Aissue)
|
||||
|
||||
@@ -172,7 +166,7 @@ to understand the requirements before sending your pull-requests.
|
||||
Coding is not a neccessity to contribute - maybe start with improving our documentation?
|
||||
Issues labeled [good first issue](https://github.com/freqtrade/freqtrade/labels/good%20first%20issue) can be good first contributions, and will help get you familiar with the codebase.
|
||||
|
||||
**Note** before starting any major new feature work, *please open an issue describing what you are planning to do* or talk to us on [Slack](https://join.slack.com/t/highfrequencybot/shared_invite/enQtMjQ5NTM0OTYzMzY3LWMxYzE3M2MxNDdjMGM3ZTYwNzFjMGIwZGRjNTc3ZGU3MGE3NzdmZGMwNmU3NDM5ZTNmM2Y3NjRiNzk4NmM4OGE). This will ensure that interested parties can give valuable feedback on the feature, and let others know that you are working on it.
|
||||
**Note** before starting any major new feature work, *please open an issue describing what you are planning to do* or talk to us on [Slack](https://join.slack.com/t/highfrequencybot/shared_invite/enQtNjU5ODcwNjI1MDU3LTU1MTgxMjkzNmYxNWE1MDEzYzQ3YmU4N2MwZjUyNjJjODRkMDVkNjg4YTAyZGYzYzlhOTZiMTE4ZjQ4YzM0OGE). This will ensure that interested parties can give valuable feedback on the feature, and let others know that you are working on it.
|
||||
|
||||
**Important:** Always create your PR against the `develop` branch, not `master`.
|
||||
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import sys
|
||||
import warnings
|
||||
|
||||
from freqtrade.main import main, set_loggers
|
||||
set_loggers()
|
||||
from freqtrade.main import main
|
||||
|
||||
warnings.warn(
|
||||
"Deprecated - To continue to run the bot like this, please run `pip install -e .` again.",
|
||||
DeprecationWarning)
|
||||
main(sys.argv[1:])
|
||||
|
||||
BIN
build_helpers/TA_Lib-0.4.17-cp37-cp37m-win_amd64.whl
Normal file
BIN
build_helpers/TA_Lib-0.4.17-cp37-cp37m-win_amd64.whl
Normal file
Binary file not shown.
@@ -1,8 +1,14 @@
|
||||
if [ ! -f "/usr/local/lib/libta_lib.a" ]; then
|
||||
if [ -z "$1" ]; then
|
||||
INSTALL_LOC=/usr/local
|
||||
else
|
||||
INSTALL_LOC=${1}
|
||||
fi
|
||||
echo "Installing to ${INSTALL_LOC}"
|
||||
if [ ! -f "${INSTALL_LOC}/lib/libta_lib.a" ]; then
|
||||
tar zxvf ta-lib-0.4.0-src.tar.gz
|
||||
cd ta-lib \
|
||||
&& sed -i.bak "s|0.00000001|0.000000000000000001 |g" src/ta_func/ta_utility.h \
|
||||
&& ./configure \
|
||||
&& ./configure --prefix=${INSTALL_LOC}/ \
|
||||
&& make \
|
||||
&& which sudo && sudo make install || make install \
|
||||
&& cd ..
|
||||
|
||||
9
build_helpers/install_windows.ps1
Normal file
9
build_helpers/install_windows.ps1
Normal file
@@ -0,0 +1,9 @@
|
||||
# Downloads don't work automatically, since the URL is regenerated via javascript.
|
||||
# Downloaded from https://www.lfd.uci.edu/~gohlke/pythonlibs/#ta-lib
|
||||
# Invoke-WebRequest -Uri "https://download.lfd.uci.edu/pythonlibs/xxxxxxx/TA_Lib-0.4.17-cp37-cp37m-win_amd64.whl" -OutFile "TA_Lib-0.4.17-cp37-cp37m-win_amd64.whl"
|
||||
|
||||
python -m pip install --upgrade pip
|
||||
pip install build_helpers\TA_Lib-0.4.17-cp37-cp37m-win_amd64.whl
|
||||
|
||||
pip install -r requirements-dev.txt
|
||||
pip install -e .
|
||||
@@ -1,17 +1,17 @@
|
||||
#!/bin/sh
|
||||
# - export TAG=`if [ "$TRAVIS_BRANCH" == "develop" ]; then echo "latest"; else echo $TRAVIS_BRANCH ; fi`
|
||||
# Replace / with _ to create a valid tag
|
||||
TAG=$(echo "${TRAVIS_BRANCH}" | sed -e "s/\//_/")
|
||||
|
||||
# Replace / with _ to create a valid tag
|
||||
TAG=$(echo "${BRANCH_NAME}" | sed -e "s/\//_/g")
|
||||
echo "Running for ${TAG}"
|
||||
|
||||
# Add commit and commit_message to docker container
|
||||
echo "${TRAVIS_COMMIT} ${TRAVIS_COMMIT_MESSAGE}" > freqtrade_commit
|
||||
echo "${GITHUB_SHA}" > freqtrade_commit
|
||||
|
||||
if [ "${TRAVIS_EVENT_TYPE}" = "cron" ]; then
|
||||
echo "event ${TRAVIS_EVENT_TYPE}: full rebuild - skipping cache"
|
||||
if [ "${GITHUB_EVENT_NAME}" = "schedule" ]; then
|
||||
echo "event ${GITHUB_EVENT_NAME}: full rebuild - skipping cache"
|
||||
docker build -t freqtrade:${TAG} .
|
||||
else
|
||||
echo "event ${TRAVIS_EVENT_TYPE}: building with cache"
|
||||
echo "event ${GITHUB_EVENT_NAME}: building with cache"
|
||||
# Pull last build to avoid rebuilding the whole image
|
||||
docker pull ${IMAGE_NAME}:${TAG}
|
||||
docker build --cache-from ${IMAGE_NAME}:${TAG} -t freqtrade:${TAG} .
|
||||
@@ -23,7 +23,7 @@ if [ $? -ne 0 ]; then
|
||||
fi
|
||||
|
||||
# Run backtest
|
||||
docker run --rm -it -v $(pwd)/config.json.example:/freqtrade/config.json:ro freqtrade:${TAG} --datadir freqtrade/tests/testdata backtesting
|
||||
docker run --rm -v $(pwd)/config.json.example:/freqtrade/config.json:ro -v $(pwd)/tests:/tests freqtrade:${TAG} backtesting --datadir /tests/testdata --strategy DefaultStrategy
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "failed running backtest"
|
||||
@@ -38,12 +38,12 @@ if [ $? -ne 0 ]; then
|
||||
fi
|
||||
|
||||
# Tag as latest for develop builds
|
||||
if [ "${TRAVIS_BRANCH}" = "develop" ]; then
|
||||
if [ "${TAG}" = "develop" ]; then
|
||||
docker tag freqtrade:$TAG ${IMAGE_NAME}:latest
|
||||
fi
|
||||
|
||||
# Login
|
||||
echo "$DOCKER_PASS" | docker login -u $DOCKER_USER --password-stdin
|
||||
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "failed login"
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
"max_open_trades": 3,
|
||||
"stake_currency": "BTC",
|
||||
"stake_amount": 0.05,
|
||||
"tradable_balance_ratio": 0.99,
|
||||
"fiat_display_currency": "USD",
|
||||
"ticker_interval" : "5m",
|
||||
"dry_run": false,
|
||||
@@ -22,7 +23,10 @@
|
||||
"ask_strategy":{
|
||||
"use_order_book": false,
|
||||
"order_book_min": 1,
|
||||
"order_book_max": 9
|
||||
"order_book_max": 9,
|
||||
"use_sell_signal": true,
|
||||
"sell_profit_only": false,
|
||||
"ignore_roi_if_buy_signal": false
|
||||
},
|
||||
"exchange": {
|
||||
"name": "bittrex",
|
||||
@@ -30,7 +34,8 @@
|
||||
"secret": "your_exchange_secret",
|
||||
"ccxt_config": {"enableRateLimit": true},
|
||||
"ccxt_async_config": {
|
||||
"enableRateLimit": false
|
||||
"enableRateLimit": true,
|
||||
"rateLimit": 500
|
||||
},
|
||||
"pair_whitelist": [
|
||||
"ETH/BTC",
|
||||
@@ -40,7 +45,7 @@
|
||||
"ZEC/BTC",
|
||||
"XLM/BTC",
|
||||
"NXT/BTC",
|
||||
"POWR/BTC",
|
||||
"TRX/BTC",
|
||||
"ADA/BTC",
|
||||
"XMR/BTC"
|
||||
],
|
||||
@@ -48,16 +53,13 @@
|
||||
"DOGE/BTC"
|
||||
]
|
||||
},
|
||||
"experimental": {
|
||||
"use_sell_signal": false,
|
||||
"sell_profit_only": false,
|
||||
"ignore_roi_if_buy_signal": false
|
||||
},
|
||||
"pairlists": [
|
||||
{"method": "StaticPairList"}
|
||||
],
|
||||
"edge": {
|
||||
"enabled": false,
|
||||
"process_throttle_secs": 3600,
|
||||
"calculate_since_number_of_days": 7,
|
||||
"capital_available_percentage": 0.5,
|
||||
"allowed_risk": 0.01,
|
||||
"stoploss_range_min": -0.01,
|
||||
"stoploss_range_max": -0.1,
|
||||
@@ -69,7 +71,7 @@
|
||||
"remove_pumps": false
|
||||
},
|
||||
"telegram": {
|
||||
"enabled": true,
|
||||
"enabled": false,
|
||||
"token": "your_telegram_token",
|
||||
"chat_id": "your_telegram_chat_id"
|
||||
},
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
"max_open_trades": 3,
|
||||
"stake_currency": "BTC",
|
||||
"stake_amount": 0.05,
|
||||
"tradable_balance_ratio": 0.99,
|
||||
"fiat_display_currency": "USD",
|
||||
"ticker_interval" : "5m",
|
||||
"dry_run": true,
|
||||
@@ -11,8 +12,8 @@
|
||||
"sell": 30
|
||||
},
|
||||
"bid_strategy": {
|
||||
"ask_last_balance": 0.0,
|
||||
"use_order_book": false,
|
||||
"ask_last_balance": 0.0,
|
||||
"order_book_top": 1,
|
||||
"check_depth_of_market": {
|
||||
"enabled": false,
|
||||
@@ -22,7 +23,10 @@
|
||||
"ask_strategy":{
|
||||
"use_order_book": false,
|
||||
"order_book_min": 1,
|
||||
"order_book_max": 9
|
||||
"order_book_max": 9,
|
||||
"use_sell_signal": true,
|
||||
"sell_profit_only": false,
|
||||
"ignore_roi_if_buy_signal": false
|
||||
},
|
||||
"exchange": {
|
||||
"name": "binance",
|
||||
@@ -30,36 +34,37 @@
|
||||
"secret": "your_exchange_secret",
|
||||
"ccxt_config": {"enableRateLimit": true},
|
||||
"ccxt_async_config": {
|
||||
"enableRateLimit": false
|
||||
"enableRateLimit": true,
|
||||
"rateLimit": 200
|
||||
},
|
||||
"pair_whitelist": [
|
||||
"AST/BTC",
|
||||
"ETC/BTC",
|
||||
"ETH/BTC",
|
||||
"ALGO/BTC",
|
||||
"ATOM/BTC",
|
||||
"BAT/BTC",
|
||||
"BCH/BTC",
|
||||
"BRD/BTC",
|
||||
"EOS/BTC",
|
||||
"ETH/BTC",
|
||||
"IOTA/BTC",
|
||||
"LINK/BTC",
|
||||
"LTC/BTC",
|
||||
"MTH/BTC",
|
||||
"NCASH/BTC",
|
||||
"TNT/BTC",
|
||||
"NEO/BTC",
|
||||
"NXS/BTC",
|
||||
"XMR/BTC",
|
||||
"XLM/BTC",
|
||||
"XRP/BTC"
|
||||
"XRP/BTC",
|
||||
"XTZ/BTC"
|
||||
],
|
||||
"pair_blacklist": [
|
||||
"BNB/BTC"
|
||||
]
|
||||
},
|
||||
"experimental": {
|
||||
"use_sell_signal": false,
|
||||
"sell_profit_only": false,
|
||||
"ignore_roi_if_buy_signal": false
|
||||
},
|
||||
"pairlists": [
|
||||
{"method": "StaticPairList"}
|
||||
],
|
||||
"edge": {
|
||||
"enabled": false,
|
||||
"process_throttle_secs": 3600,
|
||||
"calculate_since_number_of_days": 7,
|
||||
"capital_available_percentage": 0.5,
|
||||
"allowed_risk": 0.01,
|
||||
"stoploss_range_min": -0.01,
|
||||
"stoploss_range_max": -0.1,
|
||||
|
||||
@@ -2,13 +2,17 @@
|
||||
"max_open_trades": 3,
|
||||
"stake_currency": "BTC",
|
||||
"stake_amount": 0.05,
|
||||
"tradable_balance_ratio": 0.99,
|
||||
"fiat_display_currency": "USD",
|
||||
"amount_reserve_percent" : 0.05,
|
||||
"amend_last_stake_amount": false,
|
||||
"last_stake_amount_min_ratio": 0.5,
|
||||
"dry_run": false,
|
||||
"ticker_interval": "5m",
|
||||
"trailing_stop": false,
|
||||
"trailing_stop_positive": 0.005,
|
||||
"trailing_stop_positive_offset": 0.0051,
|
||||
"trailing_only_offset_is_reached": false,
|
||||
"minimal_roi": {
|
||||
"40": 0.0,
|
||||
"30": 0.01,
|
||||
@@ -21,8 +25,8 @@
|
||||
"sell": 30
|
||||
},
|
||||
"bid_strategy": {
|
||||
"ask_last_balance": 0.0,
|
||||
"use_order_book": false,
|
||||
"ask_last_balance": 0.0,
|
||||
"order_book_top": 1,
|
||||
"check_depth_of_market": {
|
||||
"enabled": false,
|
||||
@@ -32,33 +36,45 @@
|
||||
"ask_strategy":{
|
||||
"use_order_book": false,
|
||||
"order_book_min": 1,
|
||||
"order_book_max": 9
|
||||
"order_book_max": 9,
|
||||
"use_sell_signal": true,
|
||||
"sell_profit_only": false,
|
||||
"ignore_roi_if_buy_signal": false
|
||||
},
|
||||
"order_types": {
|
||||
"buy": "limit",
|
||||
"sell": "limit",
|
||||
"emergencysell": "market",
|
||||
"stoploss": "market",
|
||||
"stoploss_on_exchange": "false",
|
||||
"stoploss_on_exchange": false,
|
||||
"stoploss_on_exchange_interval": 60
|
||||
},
|
||||
"order_time_in_force": {
|
||||
"buy": "gtc",
|
||||
"sell": "gtc",
|
||||
"sell": "gtc"
|
||||
},
|
||||
"pairlist": {
|
||||
"pairlists": [
|
||||
{"method": "StaticPairList"},
|
||||
{
|
||||
"method": "VolumePairList",
|
||||
"config": {
|
||||
"number_assets": 20,
|
||||
"sort_key": "quoteVolume"
|
||||
}
|
||||
"sort_key": "quoteVolume",
|
||||
"refresh_period": 1800
|
||||
},
|
||||
{"method": "PrecisionFilter"},
|
||||
{"method": "PriceFilter", "low_price_ratio": 0.01
|
||||
}
|
||||
],
|
||||
"exchange": {
|
||||
"name": "bittrex",
|
||||
"sandbox": false,
|
||||
"key": "your_exchange_key",
|
||||
"secret": "your_exchange_secret",
|
||||
"password": "",
|
||||
"ccxt_config": {"enableRateLimit": true},
|
||||
"ccxt_async_config": {
|
||||
"enableRateLimit": false,
|
||||
"rateLimit": 500,
|
||||
"aiohttp_trust_env": false
|
||||
},
|
||||
"pair_whitelist": [
|
||||
@@ -69,20 +85,20 @@
|
||||
"ZEC/BTC",
|
||||
"XLM/BTC",
|
||||
"NXT/BTC",
|
||||
"POWR/BTC",
|
||||
"TRX/BTC",
|
||||
"ADA/BTC",
|
||||
"XMR/BTC"
|
||||
],
|
||||
"pair_blacklist": [
|
||||
"DOGE/BTC"
|
||||
],
|
||||
"outdated_offset": 5
|
||||
"outdated_offset": 5,
|
||||
"markets_refresh_interval": 60
|
||||
},
|
||||
"edge": {
|
||||
"enabled": false,
|
||||
"process_throttle_secs": 3600,
|
||||
"calculate_since_number_of_days": 7,
|
||||
"capital_available_percentage": 0.5,
|
||||
"allowed_risk": 0.01,
|
||||
"stoploss_range_min": -0.01,
|
||||
"stoploss_range_max": -0.1,
|
||||
@@ -93,22 +109,25 @@
|
||||
"max_trade_duration_minute": 1440,
|
||||
"remove_pumps": false
|
||||
},
|
||||
"experimental": {
|
||||
"use_sell_signal": false,
|
||||
"sell_profit_only": false,
|
||||
"ignore_roi_if_buy_signal": false
|
||||
},
|
||||
"telegram": {
|
||||
"enabled": true,
|
||||
"token": "your_telegram_token",
|
||||
"chat_id": "your_telegram_chat_id"
|
||||
},
|
||||
"api_server": {
|
||||
"enabled": false,
|
||||
"listen_ip_address": "127.0.0.1",
|
||||
"listen_port": 8080,
|
||||
"username": "freqtrader",
|
||||
"password": "SuperSecurePassword"
|
||||
},
|
||||
"db_url": "sqlite:///tradesv3.sqlite",
|
||||
"initial_state": "running",
|
||||
"forcebuy_enable": false,
|
||||
"internals": {
|
||||
"process_throttle_secs": 5
|
||||
"process_throttle_secs": 5,
|
||||
"heartbeat_interval": 60
|
||||
},
|
||||
"strategy": "DefaultStrategy",
|
||||
"strategy_path": "/some/folder/"
|
||||
"strategy_path": "user_data/strategies/"
|
||||
}
|
||||
|
||||
95
config_kraken.json.example
Normal file
95
config_kraken.json.example
Normal file
@@ -0,0 +1,95 @@
|
||||
{
|
||||
"max_open_trades": 5,
|
||||
"stake_currency": "EUR",
|
||||
"stake_amount": 10,
|
||||
"tradable_balance_ratio": 0.99,
|
||||
"fiat_display_currency": "EUR",
|
||||
"ticker_interval" : "5m",
|
||||
"dry_run": true,
|
||||
"trailing_stop": false,
|
||||
"unfilledtimeout": {
|
||||
"buy": 10,
|
||||
"sell": 30
|
||||
},
|
||||
"bid_strategy": {
|
||||
"use_order_book": false,
|
||||
"ask_last_balance": 0.0,
|
||||
"order_book_top": 1,
|
||||
"check_depth_of_market": {
|
||||
"enabled": false,
|
||||
"bids_to_ask_delta": 1
|
||||
}
|
||||
},
|
||||
"ask_strategy":{
|
||||
"use_order_book": false,
|
||||
"order_book_min": 1,
|
||||
"order_book_max": 9,
|
||||
"use_sell_signal": true,
|
||||
"sell_profit_only": false,
|
||||
"ignore_roi_if_buy_signal": false
|
||||
|
||||
},
|
||||
"exchange": {
|
||||
"name": "kraken",
|
||||
"key": "",
|
||||
"secret": "",
|
||||
"ccxt_config": {"enableRateLimit": true},
|
||||
"ccxt_async_config": {
|
||||
"enableRateLimit": true,
|
||||
"rateLimit": 1000
|
||||
},
|
||||
"pair_whitelist": [
|
||||
"ADA/EUR",
|
||||
"ATOM/EUR",
|
||||
"BAT/EUR",
|
||||
"BCH/EUR",
|
||||
"BTC/EUR",
|
||||
"DAI/EUR",
|
||||
"DASH/EUR",
|
||||
"EOS/EUR",
|
||||
"ETC/EUR",
|
||||
"ETH/EUR",
|
||||
"LINK/EUR",
|
||||
"LTC/EUR",
|
||||
"QTUM/EUR",
|
||||
"REP/EUR",
|
||||
"WAVES/EUR",
|
||||
"XLM/EUR",
|
||||
"XMR/EUR",
|
||||
"XRP/EUR",
|
||||
"XTZ/EUR",
|
||||
"ZEC/EUR"
|
||||
],
|
||||
"pair_blacklist": [
|
||||
|
||||
]
|
||||
},
|
||||
"pairlists": [
|
||||
{"method": "StaticPairList"}
|
||||
],
|
||||
"edge": {
|
||||
"enabled": false,
|
||||
"process_throttle_secs": 3600,
|
||||
"calculate_since_number_of_days": 7,
|
||||
"allowed_risk": 0.01,
|
||||
"stoploss_range_min": -0.01,
|
||||
"stoploss_range_max": -0.1,
|
||||
"stoploss_range_step": -0.01,
|
||||
"minimum_winrate": 0.60,
|
||||
"minimum_expectancy": 0.20,
|
||||
"min_trade_number": 10,
|
||||
"max_trade_duration_minute": 1440,
|
||||
"remove_pumps": false
|
||||
},
|
||||
"telegram": {
|
||||
"enabled": false,
|
||||
"token": "your_telegram_token",
|
||||
"chat_id": "your_telegram_chat_id"
|
||||
},
|
||||
"initial_state": "running",
|
||||
"forcebuy_enable": false,
|
||||
"internals": {
|
||||
"process_throttle_secs": 5
|
||||
},
|
||||
"download_trades": true
|
||||
}
|
||||
20
docker-compose.develop.yml
Normal file
20
docker-compose.develop.yml
Normal file
@@ -0,0 +1,20 @@
|
||||
---
|
||||
version: '3'
|
||||
services:
|
||||
freqtrade_develop:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: "./Dockerfile.develop"
|
||||
volumes:
|
||||
- ".:/freqtrade"
|
||||
entrypoint:
|
||||
- "freqtrade"
|
||||
|
||||
freqtrade_bash:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: "./Dockerfile.develop"
|
||||
volumes:
|
||||
- ".:/freqtrade"
|
||||
entrypoint:
|
||||
- "/bin/bash"
|
||||
8
docker-compose.yml
Normal file
8
docker-compose.yml
Normal file
@@ -0,0 +1,8 @@
|
||||
---
|
||||
version: '3'
|
||||
services:
|
||||
freqtrade:
|
||||
image: freqtradeorg/freqtrade:master
|
||||
volumes:
|
||||
- "./user_data:/freqtrade/user_data"
|
||||
- "./config.json:/freqtrade/config.json"
|
||||
63
docs/advanced-hyperopt.md
Normal file
63
docs/advanced-hyperopt.md
Normal file
@@ -0,0 +1,63 @@
|
||||
# Advanced Hyperopt
|
||||
|
||||
This page explains some advanced Hyperopt topics that may require higher
|
||||
coding skills and Python knowledge than creation of an ordinal hyperoptimization
|
||||
class.
|
||||
|
||||
## Creating and using a custom loss function
|
||||
|
||||
To use a custom loss function class, make sure that the function `hyperopt_loss_function` is defined in your custom hyperopt loss class.
|
||||
For the sample below, you then need to add the command line parameter `--hyperopt-loss SuperDuperHyperOptLoss` to your hyperopt call so this function is being used.
|
||||
|
||||
A sample of this can be found below, which is identical to the Default Hyperopt loss implementation. A full sample can be found in [userdata/hyperopts](https://github.com/freqtrade/freqtrade/blob/develop/freqtrade/templates/sample_hyperopt_loss.py).
|
||||
|
||||
``` python
|
||||
from freqtrade.optimize.hyperopt import IHyperOptLoss
|
||||
|
||||
TARGET_TRADES = 600
|
||||
EXPECTED_MAX_PROFIT = 3.0
|
||||
MAX_ACCEPTED_TRADE_DURATION = 300
|
||||
|
||||
class SuperDuperHyperOptLoss(IHyperOptLoss):
|
||||
"""
|
||||
Defines the default loss function for hyperopt
|
||||
"""
|
||||
|
||||
@staticmethod
|
||||
def hyperopt_loss_function(results: DataFrame, trade_count: int,
|
||||
min_date: datetime, max_date: datetime,
|
||||
*args, **kwargs) -> float:
|
||||
"""
|
||||
Objective function, returns smaller number for better results
|
||||
This is the legacy algorithm (used until now in freqtrade).
|
||||
Weights are distributed as follows:
|
||||
* 0.4 to trade duration
|
||||
* 0.25: Avoiding trade loss
|
||||
* 1.0 to total profit, compared to the expected value (`EXPECTED_MAX_PROFIT`) defined above
|
||||
"""
|
||||
total_profit = results.profit_percent.sum()
|
||||
trade_duration = results.trade_duration.mean()
|
||||
|
||||
trade_loss = 1 - 0.25 * exp(-(trade_count - TARGET_TRADES) ** 2 / 10 ** 5.8)
|
||||
profit_loss = max(0, 1 - total_profit / EXPECTED_MAX_PROFIT)
|
||||
duration_loss = 0.4 * min(trade_duration / MAX_ACCEPTED_TRADE_DURATION, 1)
|
||||
result = trade_loss + profit_loss + duration_loss
|
||||
return result
|
||||
```
|
||||
|
||||
Currently, the arguments are:
|
||||
|
||||
* `results`: DataFrame containing the result
|
||||
The following columns are available in results (corresponds to the output-file of backtesting when used with `--export trades`):
|
||||
`pair, profit_percent, profit_abs, open_time, close_time, open_index, close_index, trade_duration, open_at_end, open_rate, close_rate, sell_reason`
|
||||
* `trade_count`: Amount of trades (identical to `len(results)`)
|
||||
* `min_date`: Start date of the hyperopting TimeFrame
|
||||
* `min_date`: End date of the hyperopting TimeFrame
|
||||
|
||||
This function needs to return a floating point number (`float`). Smaller numbers will be interpreted as better results. The parameters and balancing for this is up to you.
|
||||
|
||||
!!! Note
|
||||
This function is called once per iteration - so please make sure to have this as optimized as possible to not slow hyperopt down unnecessarily.
|
||||
|
||||
!!! Note
|
||||
Please keep the arguments `*args` and `**kwargs` in the interface to allow us to extend this interface later.
|
||||
92
docs/advanced-setup.md
Normal file
92
docs/advanced-setup.md
Normal file
@@ -0,0 +1,92 @@
|
||||
# Advanced Post-installation Tasks
|
||||
|
||||
This page explains some advanced tasks and configuration options that can be performed after the bot installation and may be uselful in some environments.
|
||||
|
||||
If you do not know what things mentioned here mean, you probably do not need it.
|
||||
|
||||
## Configure the bot running as a systemd service
|
||||
|
||||
Copy the `freqtrade.service` file to your systemd user directory (usually `~/.config/systemd/user`) and update `WorkingDirectory` and `ExecStart` to match your setup.
|
||||
|
||||
!!! Note
|
||||
Certain systems (like Raspbian) don't load service unit files from the user directory. In this case, copy `freqtrade.service` into `/etc/systemd/user/` (requires superuser permissions).
|
||||
|
||||
After that you can start the daemon with:
|
||||
|
||||
```bash
|
||||
systemctl --user start freqtrade
|
||||
```
|
||||
|
||||
For this to be persistent (run when user is logged out) you'll need to enable `linger` for your freqtrade user.
|
||||
|
||||
```bash
|
||||
sudo loginctl enable-linger "$USER"
|
||||
```
|
||||
|
||||
If you run the bot as a service, you can use systemd service manager as a software watchdog monitoring freqtrade bot
|
||||
state and restarting it in the case of failures. If the `internals.sd_notify` parameter is set to true in the
|
||||
configuration or the `--sd-notify` command line option is used, the bot will send keep-alive ping messages to systemd
|
||||
using the sd_notify (systemd notifications) protocol and will also tell systemd its current state (Running or Stopped)
|
||||
when it changes.
|
||||
|
||||
The `freqtrade.service.watchdog` file contains an example of the service unit configuration file which uses systemd
|
||||
as the watchdog.
|
||||
|
||||
!!! Note
|
||||
The sd_notify communication between the bot and the systemd service manager will not work if the bot runs in a Docker container.
|
||||
|
||||
## Advanced Logging
|
||||
|
||||
On many Linux systems the bot can be configured to send its log messages to `syslog` or `journald` system services. Logging to a remote `syslog` server is also available on Windows. The special values for the `--logfilename` command line option can be used for this.
|
||||
|
||||
### Logging to syslog
|
||||
|
||||
To send Freqtrade log messages to a local or remote `syslog` service use the `--logfilename` command line option with the value in the following format:
|
||||
|
||||
* `--logfilename syslog:<syslog_address>` -- send log messages to `syslog` service using the `<syslog_address>` as the syslog address.
|
||||
|
||||
The syslog address can be either a Unix domain socket (socket filename) or a UDP socket specification, consisting of IP address and UDP port, separated by the `:` character.
|
||||
|
||||
So, the following are the examples of possible usages:
|
||||
|
||||
* `--logfilename syslog:/dev/log` -- log to syslog (rsyslog) using the `/dev/log` socket, suitable for most systems.
|
||||
* `--logfilename syslog` -- same as above, the shortcut for `/dev/log`.
|
||||
* `--logfilename syslog:/var/run/syslog` -- log to syslog (rsyslog) using the `/var/run/syslog` socket. Use this on MacOS.
|
||||
* `--logfilename syslog:localhost:514` -- log to local syslog using UDP socket, if it listens on port 514.
|
||||
* `--logfilename syslog:<ip>:514` -- log to remote syslog at IP address and port 514. This may be used on Windows for remote logging to an external syslog server.
|
||||
|
||||
Log messages are send to `syslog` with the `user` facility. So you can see them with the following commands:
|
||||
|
||||
* `tail -f /var/log/user`, or
|
||||
* install a comprehensive graphical viewer (for instance, 'Log File Viewer' for Ubuntu).
|
||||
|
||||
On many systems `syslog` (`rsyslog`) fetches data from `journald` (and vice versa), so both `--logfilename syslog` or `--logfilename journald` can be used and the messages be viewed with both `journalctl` and a syslog viewer utility. You can combine this in any way which suites you better.
|
||||
|
||||
For `rsyslog` the messages from the bot can be redirected into a separate dedicated log file. To achieve this, add
|
||||
```
|
||||
if $programname startswith "freqtrade" then -/var/log/freqtrade.log
|
||||
```
|
||||
to one of the rsyslog configuration files, for example at the end of the `/etc/rsyslog.d/50-default.conf`.
|
||||
|
||||
For `syslog` (`rsyslog`), the reduction mode can be switched on. This will reduce the number of repeating messages. For instance, multiple bot Heartbeat messages will be reduced to a single message when nothing else happens with the bot. To achieve this, set in `/etc/rsyslog.conf`:
|
||||
```
|
||||
# Filter duplicated messages
|
||||
$RepeatedMsgReduction on
|
||||
```
|
||||
|
||||
### Logging to journald
|
||||
|
||||
This needs the `systemd` python package installed as the dependency, which is not available on Windows. Hence, the whole journald logging functionality is not available for a bot running on Windows.
|
||||
|
||||
To send Freqtrade log messages to `journald` system service use the `--logfilename` command line option with the value in the following format:
|
||||
|
||||
* `--logfilename journald` -- send log messages to `journald`.
|
||||
|
||||
Log messages are send to `journald` with the `user` facility. So you can see them with the following commands:
|
||||
|
||||
* `journalctl -f` -- shows Freqtrade log messages sent to `journald` along with other log messages fetched by `journald`.
|
||||
* `journalctl -f -u freqtrade.service` -- this command can be used when the bot is run as a `systemd` service.
|
||||
|
||||
There are many other options in the `journalctl` utility to filter the messages, see manual pages for this utility.
|
||||
|
||||
On many systems `syslog` (`rsyslog`) fetches data from `journald` (and vice versa), so both `--logfilename syslog` or `--logfilename journald` can be used and the messages be viewed with both `journalctl` and a syslog viewer utility. You can combine this in any way which suites you better.
|
||||
BIN
docs/assets/plot-dataframe.png
Normal file
BIN
docs/assets/plot-dataframe.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 211 KiB |
BIN
docs/assets/plot-dataframe2.png
Normal file
BIN
docs/assets/plot-dataframe2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 190 KiB |
BIN
docs/assets/plot-profit.png
Normal file
BIN
docs/assets/plot-profit.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 121 KiB |
@@ -1,164 +1,116 @@
|
||||
# Backtesting
|
||||
|
||||
This page explains how to validate your strategy performance by using
|
||||
Backtesting.
|
||||
This page explains how to validate your strategy performance by using Backtesting.
|
||||
|
||||
Backtesting requires historic data to be available.
|
||||
To learn how to get data for the pairs and exchange you're interested in, head over to the [Data Downloading](data-download.md) section of the documentation.
|
||||
|
||||
## Test your strategy with Backtesting
|
||||
|
||||
Now you have good Buy and Sell strategies, you want to test it against
|
||||
Now you have good Buy and Sell strategies and some historic data, you want to test it against
|
||||
real data. This is what we call
|
||||
[backtesting](https://en.wikipedia.org/wiki/Backtesting).
|
||||
|
||||
Backtesting will use the crypto-currencies (pair) from your config file
|
||||
and load static tickers located in
|
||||
[/freqtrade/tests/testdata](https://github.com/freqtrade/freqtrade/tree/develop/freqtrade/tests/testdata).
|
||||
If the 5 min and 1 min ticker for the crypto-currencies to test is not
|
||||
already in the `testdata` folder, backtesting will download them
|
||||
automatically. Testdata files will not be updated until you specify it.
|
||||
Backtesting will use the crypto-currencies (pairs) from your config file and load ticker data from `user_data/data/<exchange>` by default.
|
||||
If no data is available for the exchange / pair / ticker interval combination, backtesting will ask you to download them first using `freqtrade download-data`.
|
||||
For details on downloading, please refer to the [Data Downloading](data-download.md) section in the documentation.
|
||||
|
||||
The result of backtesting will confirm you if your bot has better odds of making a profit than a loss.
|
||||
The result of backtesting will confirm if your bot has better odds of making a profit than a loss.
|
||||
|
||||
The backtesting is very easy with freqtrade.
|
||||
!!! Tip "Using dynamic pairlists for backtesting"
|
||||
While using dynamic pairlists during backtesting is not possible, a dynamic pairlist using current data can be generated via the [`test-pairlist`](utils.md#test-pairlist) command, and needs to be specified as `"pair_whitelist"` attribute in the configuration.
|
||||
|
||||
### Run a backtesting against the currencies listed in your config file
|
||||
|
||||
#### With 5 min tickers (Per default)
|
||||
|
||||
```bash
|
||||
python3 ./freqtrade/main.py backtesting
|
||||
freqtrade backtesting
|
||||
```
|
||||
|
||||
#### With 1 min tickers
|
||||
|
||||
```bash
|
||||
python3 ./freqtrade/main.py backtesting --ticker-interval 1m
|
||||
```
|
||||
|
||||
#### Update cached pairs with the latest data
|
||||
|
||||
```bash
|
||||
python3 ./freqtrade/main.py backtesting --refresh-pairs-cached
|
||||
```
|
||||
|
||||
#### With live data (do not alter your testdata files)
|
||||
|
||||
```bash
|
||||
python3 ./freqtrade/main.py backtesting --live
|
||||
freqtrade backtesting --ticker-interval 1m
|
||||
```
|
||||
|
||||
#### Using a different on-disk ticker-data source
|
||||
|
||||
Assume you downloaded the history data from the Bittrex exchange and kept it in the `user_data/data/bittrex-20180101` directory.
|
||||
You can then use this data for backtesting as follows:
|
||||
|
||||
```bash
|
||||
python3 ./freqtrade/main.py backtesting --datadir freqtrade/tests/testdata-20180101
|
||||
freqtrade --datadir user_data/data/bittrex-20180101 backtesting
|
||||
```
|
||||
|
||||
#### With a (custom) strategy file
|
||||
|
||||
```bash
|
||||
python3 ./freqtrade/main.py -s TestStrategy backtesting
|
||||
freqtrade backtesting -s SampleStrategy
|
||||
```
|
||||
|
||||
Where `-s TestStrategy` refers to the class name within the strategy file `test_strategy.py` found in the `freqtrade/user_data/strategies` directory
|
||||
Where `-s SampleStrategy` refers to the class name within the strategy file `sample_strategy.py` found in the `freqtrade/user_data/strategies` directory.
|
||||
|
||||
#### Comparing multiple Strategies
|
||||
|
||||
```bash
|
||||
freqtrade backtesting --strategy-list SampleStrategy1 AwesomeStrategy --ticker-interval 5m
|
||||
```
|
||||
|
||||
Where `SampleStrategy1` and `AwesomeStrategy` refer to class names of strategies.
|
||||
|
||||
#### Exporting trades to file
|
||||
|
||||
```bash
|
||||
python3 ./freqtrade/main.py backtesting --export trades
|
||||
freqtrade backtesting --export trades
|
||||
```
|
||||
|
||||
The exported trades can be read using the following code for manual analysis, or can be used by the plotting script `plot_dataframe.py` in the scripts folder.
|
||||
|
||||
``` python
|
||||
import json
|
||||
from pathlib import Path
|
||||
import pandas as pd
|
||||
|
||||
filename=Path('user_data/backtest_data/backtest-result.json')
|
||||
|
||||
with filename.open() as file:
|
||||
data = json.load(file)
|
||||
|
||||
columns = ["pair", "profit", "opents", "closets", "index", "duration",
|
||||
"open_rate", "close_rate", "open_at_end", "sell_reason"]
|
||||
df = pd.DataFrame(data, columns=columns)
|
||||
|
||||
df['opents'] = pd.to_datetime(df['opents'],
|
||||
unit='s',
|
||||
utc=True,
|
||||
infer_datetime_format=True
|
||||
)
|
||||
df['closets'] = pd.to_datetime(df['closets'],
|
||||
unit='s',
|
||||
utc=True,
|
||||
infer_datetime_format=True
|
||||
)
|
||||
```
|
||||
|
||||
If you have some ideas for interesting / helpful backtest data analysis, feel free to submit a PR so the community can benefit from it.
|
||||
The exported trades can be used for [further analysis](#further-backtest-result-analysis), or can be used by the plotting script `plot_dataframe.py` in the scripts directory.
|
||||
|
||||
#### Exporting trades to file specifying a custom filename
|
||||
|
||||
```bash
|
||||
python3 ./freqtrade/main.py backtesting --export trades --export-filename=backtest_teststrategy.json
|
||||
freqtrade backtesting --export trades --export-filename=backtest_samplestrategy.json
|
||||
```
|
||||
|
||||
#### Running backtest with smaller testset
|
||||
Please also read about the [strategy startup period](strategy-customization.md#strategy-startup-period).
|
||||
|
||||
Use the `--timerange` argument to change how much of the testset
|
||||
you want to use. The last N ticks/timeframes will be used.
|
||||
#### Supplying custom fee value
|
||||
|
||||
Example:
|
||||
Sometimes your account has certain fee rebates (fee reductions starting with a certain account size or monthly volume), which are not visible to ccxt.
|
||||
To account for this in backtesting, you can use the `--fee` command line option to supply this value to backtesting.
|
||||
This fee must be a ratio, and will be applied twice (once for trade entry, and once for trade exit).
|
||||
|
||||
For example, if the buying and selling commission fee is 0.1% (i.e., 0.001 written as ratio), then you would run backtesting as the following:
|
||||
|
||||
```bash
|
||||
python3 ./freqtrade/main.py backtesting --timerange=-200
|
||||
freqtrade backtesting --fee 0.001
|
||||
```
|
||||
|
||||
#### Advanced use of timerange
|
||||
!!! Note
|
||||
Only supply this option (or the corresponding configuration parameter) if you want to experiment with different fee values. By default, Backtesting fetches the default fee from the exchange pair/market info.
|
||||
|
||||
Doing `--timerange=-200` will get the last 200 timeframes
|
||||
from your inputdata. You can also specify specific dates,
|
||||
or a range span indexed by start and stop.
|
||||
#### Running backtest with smaller testset by using timerange
|
||||
|
||||
Use the `--timerange` argument to change how much of the testset you want to use.
|
||||
|
||||
|
||||
For example, running backtesting with the `--timerange=20190501-` option will use all available data starting with May 1st, 2019 from your inputdata.
|
||||
|
||||
```bash
|
||||
freqtrade backtesting --timerange=20190501-
|
||||
```
|
||||
|
||||
You can also specify particular dates or a range span indexed by start and stop.
|
||||
|
||||
The full timerange specification:
|
||||
|
||||
- Use last 123 tickframes of data: `--timerange=-123`
|
||||
- Use first 123 tickframes of data: `--timerange=123-`
|
||||
- Use tickframes from line 123 through 456: `--timerange=123-456`
|
||||
- Use tickframes till 2018/01/31: `--timerange=-20180131`
|
||||
- Use tickframes since 2018/01/31: `--timerange=20180131-`
|
||||
- Use tickframes since 2018/01/31 till 2018/03/01 : `--timerange=20180131-20180301`
|
||||
- Use tickframes between POSIX timestamps 1527595200 1527618600:
|
||||
`--timerange=1527595200-1527618600`
|
||||
|
||||
#### Downloading new set of ticker data
|
||||
|
||||
To download new set of backtesting ticker data, you can use a download script.
|
||||
|
||||
If you are using Binance for example:
|
||||
|
||||
- create a folder `user_data/data/binance` and copy `pairs.json` in that folder.
|
||||
- update the `pairs.json` to contain the currency pairs you are interested in.
|
||||
|
||||
```bash
|
||||
mkdir -p user_data/data/binance
|
||||
cp freqtrade/tests/testdata/pairs.json user_data/data/binance
|
||||
```
|
||||
|
||||
Then run:
|
||||
|
||||
```bash
|
||||
python scripts/download_backtest_data.py --exchange binance
|
||||
```
|
||||
|
||||
This will download ticker data for all the currency pairs you defined in `pairs.json`.
|
||||
|
||||
- To use a different folder than the exchange specific default, use `--export user_data/data/some_directory`.
|
||||
- To change the exchange used to download the tickers, use `--exchange`. Default is `bittrex`.
|
||||
- To use `pairs.json` from some other folder, use `--pairs-file some_other_dir/pairs.json`.
|
||||
- To download ticker data for only 10 days, use `--days 10`.
|
||||
- Use `--timeframes` to specify which tickers to download. Default is `--timeframes 1m 5m` which will download 1-minute and 5-minute tickers.
|
||||
|
||||
For help about backtesting usage, please refer to [Backtesting commands](#backtesting-commands).
|
||||
|
||||
## Understand the backtesting result
|
||||
|
||||
The most important in the backtesting is to understand the result.
|
||||
@@ -189,12 +141,12 @@ A backtesting result will look like that:
|
||||
| ZEC/BTC | 22 | -0.46 | -10.18 | -0.00050971 | -5.09 | 2:22:00 | 7 | 15 |
|
||||
| TOTAL | 429 | 0.36 | 152.41 | 0.00762792 | 76.20 | 4:12:00 | 186 | 243 |
|
||||
========================================================= SELL REASON STATS =========================================================
|
||||
| Sell Reason | Count |
|
||||
|:-------------------|--------:|
|
||||
| trailing_stop_loss | 205 |
|
||||
| stop_loss | 166 |
|
||||
| sell_signal | 56 |
|
||||
| force_sell | 2 |
|
||||
| Sell Reason | Count | Profit | Loss |
|
||||
|:-------------------|--------:|---------:|-------:|
|
||||
| trailing_stop_loss | 205 | 150 | 55 |
|
||||
| stop_loss | 166 | 0 | 166 |
|
||||
| sell_signal | 56 | 36 | 20 |
|
||||
| force_sell | 2 | 0 | 2 |
|
||||
====================================================== LEFT OPEN TRADES REPORT ======================================================
|
||||
| pair | buy count | avg profit % | cum profit % | tot profit BTC | tot profit % | avg duration | profit | loss |
|
||||
|:---------|------------:|---------------:|---------------:|-----------------:|---------------:|:---------------|---------:|-------:|
|
||||
@@ -203,11 +155,13 @@ A backtesting result will look like that:
|
||||
| TOTAL | 2 | 0.78 | 1.57 | 0.00007855 | 0.78 | 4:00:00 | 2 | 0 |
|
||||
```
|
||||
|
||||
The 1st table will contain all trades the bot made.
|
||||
The 1st table contains all trades the bot made, including "left open trades".
|
||||
|
||||
The 2nd table will contain a recap of sell reasons.
|
||||
The 2nd table contains a recap of sell reasons.
|
||||
This table can tell you which area needs some additional work (i.e. all `sell_signal` trades are losses, so we should disable the sell-signal or work on improving that).
|
||||
|
||||
The 3rd table will contain all trades the bot had to `forcesell` at the end of the backtest period to present a full picture.
|
||||
The 3rd table contains all trades the bot had to `forcesell` at the end of the backtest period to present a full picture.
|
||||
This is necessary to simulate realistic behaviour, since the backtest period has to end at some point, while realistically, you could leave the bot running forever.
|
||||
These trades are also included in the first table, but are extracted separately for clarity.
|
||||
|
||||
The last line will give you the overall performance of your strategy,
|
||||
@@ -217,22 +171,16 @@ here:
|
||||
| TOTAL | 429 | 0.36 | 152.41 | 0.00762792 | 76.20 | 4:12:00 | 186 | 243 |
|
||||
```
|
||||
|
||||
We understand the bot has made `429` trades for an average duration of
|
||||
`4:12:00`, with a performance of `76.20%` (profit), that means it has
|
||||
The bot has made `429` trades for an average duration of `4:12:00`, with a performance of `76.20%` (profit), that means it has
|
||||
earned a total of `0.00762792 BTC` starting with a capital of 0.01 BTC.
|
||||
|
||||
The column `avg profit %` shows the average profit for all trades made while the column `cum profit %` sums all the profits/losses.
|
||||
The column `tot profit %` shows instead the total profit % in relation to allocated capital
|
||||
(`max_open_trades * stake_amount`). In the above results we have `max_open_trades=2 stake_amount=0.005` in config
|
||||
so `(76.20/100) * (0.005 * 2) =~ 0.00762792 BTC`.
|
||||
The column `avg profit %` shows the average profit for all trades made while the column `cum profit %` sums up all the profits/losses.
|
||||
The column `tot profit %` shows instead the total profit % in relation to allocated capital (`max_open_trades * stake_amount`).
|
||||
In the above results we have `max_open_trades=2` and `stake_amount=0.005` in config so `tot_profit %` will be `(76.20/100) * (0.005 * 2) =~ 0.00762792 BTC`.
|
||||
|
||||
As you will see your strategy performance will be influenced by your buy
|
||||
strategy, your sell strategy, and also by the `minimal_roi` and
|
||||
`stop_loss` you have set.
|
||||
Your strategy performance is influenced by your buy strategy, your sell strategy, and also by the `minimal_roi` and `stop_loss` you have set.
|
||||
|
||||
As for an example if your minimal_roi is only `"0": 0.01`. You cannot
|
||||
expect the bot to make more profit than 1% (because it will sell every
|
||||
time a trade will reach 1%).
|
||||
For example, if your `minimal_roi` is only `"0": 0.01` you cannot expect the bot to make more profit than 1% (because it will sell every time a trade reaches 1%).
|
||||
|
||||
```json
|
||||
"minimal_roi": {
|
||||
@@ -241,26 +189,52 @@ time a trade will reach 1%).
|
||||
```
|
||||
|
||||
On the other hand, if you set a too high `minimal_roi` like `"0": 0.55`
|
||||
(55%), there is a lot of chance that the bot will never reach this
|
||||
profit. Hence, keep in mind that your performance is a mix of your
|
||||
strategies, your configuration, and the crypto-currency you have set up.
|
||||
(55%), there is almost no chance that the bot will ever reach this profit.
|
||||
Hence, keep in mind that your performance is an integral mix of all different elements of the strategy, your configuration, and the crypto-currency pairs you have set up.
|
||||
|
||||
### Assumptions made by backtesting
|
||||
|
||||
Since backtesting lacks some detailed information about what happens within a candle, it needs to take a few assumptions:
|
||||
|
||||
- Buys happen at open-price
|
||||
- Sell signal sells happen at open-price of the following candle
|
||||
- Low happens before high for stoploss, protecting capital first.
|
||||
- ROI
|
||||
- sells are compared to high - but the ROI value is used (e.g. ROI = 2%, high=5% - so the sell will be at 2%)
|
||||
- sells are never "below the candle", so a ROI of 2% may result in a sell at 2.4% if low was at 2.4% profit
|
||||
- Forcesells caused by `<N>=-1` ROI entries use low as sell value, unless N falls on the candle open (e.g. `120: -1` for 1h candles)
|
||||
- Stoploss sells happen exactly at stoploss price, even if low was lower
|
||||
- Trailing stoploss
|
||||
- High happens first - adjusting stoploss
|
||||
- Low uses the adjusted stoploss (so sells with large high-low difference are backtested correctly)
|
||||
- Sell-reason does not explain if a trade was positive or negative, just what triggered the sell (this can look odd if negative ROI values are used)
|
||||
|
||||
Taking these assumptions, backtesting tries to mirror real trading as closely as possible. However, backtesting will **never** replace running a strategy in dry-run mode.
|
||||
Also, keep in mind that past results don't guarantee future success.
|
||||
|
||||
In addition to the above assumptions, strategy authors should carefully read the [Common Mistakes](strategy-customization.md#common-mistakes-when-developing-strategies) section, to avoid using data in backtesting which is not available in real market conditions.
|
||||
|
||||
### Further backtest-result analysis
|
||||
|
||||
To further analyze your backtest results, you can [export the trades](#exporting-trades-to-file).
|
||||
You can then load the trades to perform further analysis as shown in our [data analysis](data-analysis.md#backtesting) backtesting section.
|
||||
|
||||
## Backtesting multiple strategies
|
||||
|
||||
To backtest multiple strategies, a list of Strategies can be provided.
|
||||
To compare multiple strategies, a list of Strategies can be provided to backtesting.
|
||||
|
||||
This is limited to 1 ticker-interval per run, however, data is only loaded once from disk so if you have multiple
|
||||
strategies you'd like to compare, this should give a nice runtime boost.
|
||||
strategies you'd like to compare, this will give a nice runtime boost.
|
||||
|
||||
All listed Strategies need to be in the same folder.
|
||||
All listed Strategies need to be in the same directory.
|
||||
|
||||
``` bash
|
||||
freqtrade backtesting --timerange 20180401-20180410 --ticker-interval 5m --strategy-list Strategy001 Strategy002 --export trades
|
||||
```
|
||||
|
||||
This will save the results to `user_data/backtest_data/backtest-result-<strategy>.json`, injecting the strategy-name into the target filename.
|
||||
This will save the results to `user_data/backtest_results/backtest-result-<strategy>.json`, injecting the strategy-name into the target filename.
|
||||
There will be an additional table comparing win/losses of the different strategies (identical to the "Total" row in the first table).
|
||||
Detailed output for all strategies one after the other will be available, so make sure to scroll up.
|
||||
Detailed output for all strategies one after the other will be available, so make sure to scroll up to see the details per strategy.
|
||||
|
||||
```
|
||||
=========================================================== Strategy Summary ===========================================================
|
||||
|
||||
@@ -1,372 +0,0 @@
|
||||
# Optimization
|
||||
|
||||
This page explains where to customize your strategies, and add new
|
||||
indicators.
|
||||
|
||||
## Install a custom strategy file
|
||||
|
||||
This is very simple. Copy paste your strategy file into the folder
|
||||
`user_data/strategies`.
|
||||
|
||||
Let assume you have a class called `AwesomeStrategy` in the file `awesome-strategy.py`:
|
||||
|
||||
1. Move your file into `user_data/strategies` (you should have `user_data/strategies/awesome-strategy.py`
|
||||
2. Start the bot with the param `--strategy AwesomeStrategy` (the parameter is the class name)
|
||||
|
||||
```bash
|
||||
python3 ./freqtrade/main.py --strategy AwesomeStrategy
|
||||
```
|
||||
|
||||
## Change your strategy
|
||||
|
||||
The bot includes a default strategy file. However, we recommend you to
|
||||
use your own file to not have to lose your parameters every time the default
|
||||
strategy file will be updated on Github. Put your custom strategy file
|
||||
into the folder `user_data/strategies`.
|
||||
|
||||
Best copy the test-strategy and modify this copy to avoid having bot-updates override your changes.
|
||||
`cp user_data/strategies/test_strategy.py user_data/strategies/awesome-strategy.py`
|
||||
|
||||
### Anatomy of a strategy
|
||||
|
||||
A strategy file contains all the information needed to build a good strategy:
|
||||
|
||||
- Indicators
|
||||
- Buy strategy rules
|
||||
- Sell strategy rules
|
||||
- Minimal ROI recommended
|
||||
- Stoploss strongly recommended
|
||||
|
||||
The bot also include a sample strategy called `TestStrategy` you can update: `user_data/strategies/test_strategy.py`.
|
||||
You can test it with the parameter: `--strategy TestStrategy`
|
||||
|
||||
```bash
|
||||
python3 ./freqtrade/main.py --strategy AwesomeStrategy
|
||||
```
|
||||
|
||||
**For the following section we will use the [user_data/strategies/test_strategy.py](https://github.com/freqtrade/freqtrade/blob/develop/user_data/strategies/test_strategy.py)
|
||||
file as reference.**
|
||||
|
||||
!!! Note: Strategies and Backtesting
|
||||
To avoid problems and unexpected differences between Backtesting and dry/live modes, please be aware
|
||||
that during backtesting the full time-interval is passed to the `populate_*()` methods at once.
|
||||
It is therefore best to use vectorized operations (across the whole dataframe, not loops) and
|
||||
avoid index referencing (`df.iloc[-1]`), but instead use `df.shift()` to get to the previous candle.
|
||||
|
||||
### Customize Indicators
|
||||
|
||||
Buy and sell strategies need indicators. You can add more indicators by extending the list contained in the method `populate_indicators()` from your strategy file.
|
||||
|
||||
You should only add the indicators used in either `populate_buy_trend()`, `populate_sell_trend()`, or to populate another indicator, otherwise performance may suffer.
|
||||
|
||||
It's important to always return the dataframe without removing/modifying the columns `"open", "high", "low", "close", "volume"`, otherwise these fields would contain something unexpected.
|
||||
|
||||
Sample:
|
||||
|
||||
```python
|
||||
def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Adds several different TA indicators to the given DataFrame
|
||||
|
||||
Performance Note: For the best performance be frugal on the number of indicators
|
||||
you are using. Let uncomment only the indicator you are using in your strategies
|
||||
or your hyperopt configuration, otherwise you will waste your memory and CPU usage.
|
||||
:param dataframe: Raw data from the exchange and parsed by parse_ticker_dataframe()
|
||||
:param metadata: Additional information, like the currently traded pair
|
||||
:return: a Dataframe with all mandatory indicators for the strategies
|
||||
"""
|
||||
dataframe['sar'] = ta.SAR(dataframe)
|
||||
dataframe['adx'] = ta.ADX(dataframe)
|
||||
stoch = ta.STOCHF(dataframe)
|
||||
dataframe['fastd'] = stoch['fastd']
|
||||
dataframe['fastk'] = stoch['fastk']
|
||||
dataframe['blower'] = ta.BBANDS(dataframe, nbdevup=2, nbdevdn=2)['lowerband']
|
||||
dataframe['sma'] = ta.SMA(dataframe, timeperiod=40)
|
||||
dataframe['tema'] = ta.TEMA(dataframe, timeperiod=9)
|
||||
dataframe['mfi'] = ta.MFI(dataframe)
|
||||
dataframe['rsi'] = ta.RSI(dataframe)
|
||||
dataframe['ema5'] = ta.EMA(dataframe, timeperiod=5)
|
||||
dataframe['ema10'] = ta.EMA(dataframe, timeperiod=10)
|
||||
dataframe['ema50'] = ta.EMA(dataframe, timeperiod=50)
|
||||
dataframe['ema100'] = ta.EMA(dataframe, timeperiod=100)
|
||||
dataframe['ao'] = awesome_oscillator(dataframe)
|
||||
macd = ta.MACD(dataframe)
|
||||
dataframe['macd'] = macd['macd']
|
||||
dataframe['macdsignal'] = macd['macdsignal']
|
||||
dataframe['macdhist'] = macd['macdhist']
|
||||
hilbert = ta.HT_SINE(dataframe)
|
||||
dataframe['htsine'] = hilbert['sine']
|
||||
dataframe['htleadsine'] = hilbert['leadsine']
|
||||
dataframe['plus_dm'] = ta.PLUS_DM(dataframe)
|
||||
dataframe['plus_di'] = ta.PLUS_DI(dataframe)
|
||||
dataframe['minus_dm'] = ta.MINUS_DM(dataframe)
|
||||
dataframe['minus_di'] = ta.MINUS_DI(dataframe)
|
||||
return dataframe
|
||||
```
|
||||
|
||||
|
||||
!!! Note "Want more indicator examples?"
|
||||
Look into the [user_data/strategies/test_strategy.py](https://github.com/freqtrade/freqtrade/blob/develop/user_data/strategies/test_strategy.py).<br/>
|
||||
Then uncomment indicators you need.
|
||||
|
||||
### Buy signal rules
|
||||
|
||||
Edit the method `populate_buy_trend()` in your strategy file to update your buy strategy.
|
||||
|
||||
It's important to always return the dataframe without removing/modifying the columns `"open", "high", "low", "close", "volume"`, otherwise these fields would contain something unexpected.
|
||||
|
||||
This will method will also define a new column, `"buy"`, which needs to contain 1 for buys, and 0 for "no action".
|
||||
|
||||
Sample from `user_data/strategies/test_strategy.py`:
|
||||
|
||||
```python
|
||||
def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Based on TA indicators, populates the buy signal for the given dataframe
|
||||
:param dataframe: DataFrame populated with indicators
|
||||
:param metadata: Additional information, like the currently traded pair
|
||||
:return: DataFrame with buy column
|
||||
"""
|
||||
dataframe.loc[
|
||||
(
|
||||
(dataframe['adx'] > 30) &
|
||||
(dataframe['tema'] <= dataframe['bb_middleband']) &
|
||||
(dataframe['tema'] > dataframe['tema'].shift(1))
|
||||
),
|
||||
'buy'] = 1
|
||||
|
||||
return dataframe
|
||||
```
|
||||
|
||||
### Sell signal rules
|
||||
|
||||
Edit the method `populate_sell_trend()` into your strategy file to update your sell strategy.
|
||||
Please note that the sell-signal is only used if `use_sell_signal` is set to true in the configuration.
|
||||
|
||||
It's important to always return the dataframe without removing/modifying the columns `"open", "high", "low", "close", "volume"`, otherwise these fields would contain something unexpected.
|
||||
|
||||
This will method will also define a new column, `"sell"`, which needs to contain 1 for sells, and 0 for "no action".
|
||||
|
||||
Sample from `user_data/strategies/test_strategy.py`:
|
||||
|
||||
```python
|
||||
def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Based on TA indicators, populates the sell signal for the given dataframe
|
||||
:param dataframe: DataFrame populated with indicators
|
||||
:param metadata: Additional information, like the currently traded pair
|
||||
:return: DataFrame with buy column
|
||||
"""
|
||||
dataframe.loc[
|
||||
(
|
||||
(dataframe['adx'] > 70) &
|
||||
(dataframe['tema'] > dataframe['bb_middleband']) &
|
||||
(dataframe['tema'] < dataframe['tema'].shift(1))
|
||||
),
|
||||
'sell'] = 1
|
||||
return dataframe
|
||||
```
|
||||
|
||||
### Minimal ROI
|
||||
|
||||
This dict defines the minimal Return On Investment (ROI) a trade should reach before selling, independent from the sell signal.
|
||||
|
||||
It is of the following format, with the dict key (left side of the colon) being the minutes passed since the trade opened, and the value (right side of the colon) being the percentage.
|
||||
|
||||
```python
|
||||
minimal_roi = {
|
||||
"40": 0.0,
|
||||
"30": 0.01,
|
||||
"20": 0.02,
|
||||
"0": 0.04
|
||||
}
|
||||
```
|
||||
|
||||
The above configuration would therefore mean:
|
||||
|
||||
- Sell whenever 4% profit was reached
|
||||
- Sell when 2% profit was reached (in effect after 20 minutes)
|
||||
- Sell when 1% profit was reached (in effect after 30 minutes)
|
||||
- Sell when trade is non-loosing (in effect after 40 minutes)
|
||||
|
||||
The calculation does include fees.
|
||||
|
||||
To disable ROI completely, set it to an insanely high number:
|
||||
|
||||
```python
|
||||
minimal_roi = {
|
||||
"0": 100
|
||||
}
|
||||
```
|
||||
|
||||
While technically not completely disabled, this would sell once the trade reaches 10000% Profit.
|
||||
|
||||
### Stoploss
|
||||
|
||||
Setting a stoploss is highly recommended to protect your capital from strong moves against you.
|
||||
|
||||
Sample:
|
||||
|
||||
``` python
|
||||
stoploss = -0.10
|
||||
```
|
||||
|
||||
This would signify a stoploss of -10%.
|
||||
If your exchange supports it, it's recommended to also set `"stoploss_on_exchange"` in the order dict, so your stoploss is on the exchange and cannot be missed for network-problems (or other problems).
|
||||
|
||||
For more information on order_types please look [here](https://github.com/freqtrade/freqtrade/blob/develop/docs/configuration.md#understand-order_types).
|
||||
|
||||
### Ticker interval
|
||||
|
||||
This is the set of candles the bot should download and use for the analysis.
|
||||
Common values are `"1m"`, `"5m"`, `"15m"`, `"1h"`, however all values supported by your exchange should work.
|
||||
|
||||
Please note that the same buy/sell signals may work with one interval, but not the other.
|
||||
This setting is accessible within the strategy by using `self.ticker_interval`.
|
||||
|
||||
### Metadata dict
|
||||
|
||||
The metadata-dict (available for `populate_buy_trend`, `populate_sell_trend`, `populate_indicators`) contains additional information.
|
||||
Currently this is `pair`, which can be accessed using `metadata['pair']` - and will return a pair in the format `XRP/BTC`.
|
||||
|
||||
The Metadata-dict should not be modified and does not persist information across multiple calls.
|
||||
Instead, have a look at the section [Storing information](#Storing-information)
|
||||
|
||||
### Storing information
|
||||
|
||||
Storing information can be accomplished by crating a new dictionary within the strategy class.
|
||||
|
||||
The name of the variable can be choosen at will, but should be prefixed with `cust_` to avoid naming collisions with predefined strategy variables.
|
||||
|
||||
```python
|
||||
class Awesomestrategy(IStrategy):
|
||||
# Create custom dictionary
|
||||
cust_info = {}
|
||||
def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
# Check if the entry already exists
|
||||
if "crosstime" in self.cust_info[metadata["pair"]:
|
||||
self.cust_info[metadata["pair"]["crosstime"] += 1
|
||||
else:
|
||||
self.cust_info[metadata["pair"]["crosstime"] = 1
|
||||
```
|
||||
|
||||
!!! Warning:
|
||||
The data is not persisted after a bot-restart (or config-reload). Also, the amount of data should be kept smallish (no DataFrames and such), otherwise the bot will start to consume a lot of memory and eventually run out of memory and crash.
|
||||
|
||||
!!! Note:
|
||||
If the data is pair-specific, make sure to use pair as one of the keys in the dictionary.
|
||||
|
||||
### Additional data (DataProvider)
|
||||
|
||||
The strategy provides access to the `DataProvider`. This allows you to get additional data to use in your strategy.
|
||||
|
||||
!!!Note:
|
||||
The DataProvier is currently not available during backtesting / hyperopt, but this is planned for the future.
|
||||
|
||||
All methods return `None` in case of failure (do not raise an exception).
|
||||
|
||||
Please always check if the `DataProvider` is available to avoid failures during backtesting.
|
||||
|
||||
#### Possible options for DataProvider
|
||||
|
||||
- `available_pairs` - Property with tuples listing cached pairs with their intervals. (pair, interval)
|
||||
- `ohlcv(pair, ticker_interval)` - Currently cached ticker data for all pairs in the whitelist, returns DataFrame or empty DataFrame
|
||||
- `historic_ohlcv(pair, ticker_interval)` - Data stored on disk
|
||||
- `runmode` - Property containing the current runmode.
|
||||
|
||||
#### ohlcv / historic_ohlcv
|
||||
|
||||
``` python
|
||||
if self.dp:
|
||||
if dp.runmode == 'live':
|
||||
if ('ETH/BTC', ticker_interval) in self.dp.available_pairs:
|
||||
data_eth = self.dp.ohlcv(pair='ETH/BTC',
|
||||
ticker_interval=ticker_interval)
|
||||
else:
|
||||
# Get historic ohlcv data (cached on disk).
|
||||
history_eth = self.dp.historic_ohlcv(pair='ETH/BTC',
|
||||
ticker_interval='1h')
|
||||
```
|
||||
|
||||
!!! Warning: Warning about backtesting
|
||||
Be carefull when using dataprovider in backtesting. `historic_ohlcv()` provides the full time-range in one go,
|
||||
so please be aware of it and make sure to not "look into the future" to avoid surprises when running in dry/live mode).
|
||||
|
||||
#### Available Pairs
|
||||
|
||||
``` python
|
||||
if self.dp:
|
||||
for pair, ticker in self.dp.available_pairs:
|
||||
print(f"available {pair}, {ticker}")
|
||||
```
|
||||
|
||||
#### Get data for non-tradeable pairs
|
||||
|
||||
Data for additional, informative pairs (reference pairs) can be beneficial for some strategies.
|
||||
Ohlcv data for these pairs will be downloaded as part of the regular whitelist refresh process and is available via `DataProvider` just as other pairs (see above).
|
||||
These parts will **not** be traded unless they are also specified in the pair whitelist, or have been selected by Dynamic Whitelisting.
|
||||
|
||||
The pairs need to be specified as tuples in the format `("pair", "interval")`, with pair as the first and time interval as the second argument.
|
||||
|
||||
Sample:
|
||||
|
||||
``` python
|
||||
def informative_pairs(self):
|
||||
return [("ETH/USDT", "5m"),
|
||||
("BTC/TUSD", "15m"),
|
||||
]
|
||||
```
|
||||
|
||||
!!! Warning:
|
||||
As these pairs will be refreshed as part of the regular whitelist refresh, it's best to keep this list short.
|
||||
All intervals and all pairs can be specified as long as they are available (and active) on the used exchange.
|
||||
It is however better to use resampling to longer time-intervals when possible
|
||||
to avoid hammering the exchange with too many requests and risk beeing blocked.
|
||||
|
||||
### Additional data - Wallets
|
||||
|
||||
The strategy provides access to the `Wallets` object. This contains the current balances on the exchange.
|
||||
|
||||
!!!NOTE:
|
||||
Wallets is not available during backtesting / hyperopt.
|
||||
|
||||
Please always check if `Wallets` is available to avoid failures during backtesting.
|
||||
|
||||
``` python
|
||||
if self.wallets:
|
||||
free_eth = self.wallets.get_free('ETH')
|
||||
used_eth = self.wallets.get_used('ETH')
|
||||
total_eth = self.wallets.get_total('ETH')
|
||||
```
|
||||
|
||||
#### Possible options for Wallets
|
||||
|
||||
- `get_free(asset)` - currently available balance to trade
|
||||
- `get_used(asset)` - currently tied up balance (open orders)
|
||||
- `get_total(asset)` - total available balance - sum of the 2 above
|
||||
|
||||
### Where is the default strategy?
|
||||
|
||||
The default buy strategy is located in the file
|
||||
[freqtrade/default_strategy.py](https://github.com/freqtrade/freqtrade/blob/develop/freqtrade/strategy/default_strategy.py).
|
||||
|
||||
### Specify custom strategy location
|
||||
|
||||
If you want to use a strategy from a different folder you can pass `--strategy-path`
|
||||
|
||||
```bash
|
||||
python3 ./freqtrade/main.py --strategy AwesomeStrategy --strategy-path /some/folder
|
||||
```
|
||||
|
||||
### Further strategy ideas
|
||||
|
||||
To get additional Ideas for strategies, head over to our [strategy repository](https://github.com/freqtrade/freqtrade-strategies). Feel free to use them as they are - but results will depend on the current market situation, pairs used etc. - therefore please backtest the strategy for your exchange/desired pairs first, evaluate carefully, use at your own risk.
|
||||
Feel free to use any of them as inspiration for your own strategies.
|
||||
We're happy to accept Pull Requests containing new Strategies to that repo.
|
||||
|
||||
We also got a *strategy-sharing* channel in our [Slack community](https://join.slack.com/t/highfrequencybot/shared_invite/enQtMjQ5NTM0OTYzMzY3LWMxYzE3M2MxNDdjMGM3ZTYwNzFjMGIwZGRjNTc3ZGU3MGE3NzdmZGMwNmU3NDM5ZTNmM2Y3NjRiNzk4NmM4OGE) which is a great place to get and/or share ideas.
|
||||
|
||||
## Next step
|
||||
|
||||
Now you have a perfect strategy you probably want to backtest it.
|
||||
Your next step is to learn [How to use the Backtesting](backtesting.md).
|
||||
@@ -2,54 +2,143 @@
|
||||
|
||||
This page explains the different parameters of the bot and how to run it.
|
||||
|
||||
!!! Note
|
||||
If you've used `setup.sh`, don't forget to activate your virtual environment (`source .env/bin/activate`) before running freqtrade commands.
|
||||
|
||||
## Bot commands
|
||||
|
||||
```
|
||||
usage: main.py [-h] [-v] [--version] [-c PATH] [-d PATH] [-s NAME]
|
||||
[--strategy-path PATH] [--customhyperopt NAME]
|
||||
[--dynamic-whitelist [INT]] [--db-url PATH]
|
||||
{backtesting,edge,hyperopt} ...
|
||||
usage: freqtrade [-h] [-V]
|
||||
{trade,backtesting,edge,hyperopt,create-userdir,list-exchanges,list-timeframes,download-data,plot-dataframe,plot-profit}
|
||||
...
|
||||
|
||||
Free, open source crypto trading bot
|
||||
|
||||
positional arguments:
|
||||
{backtesting,edge,hyperopt}
|
||||
backtesting backtesting module
|
||||
edge edge module
|
||||
hyperopt hyperopt module
|
||||
{trade,backtesting,edge,hyperopt,create-userdir,list-exchanges,list-timeframes,download-data,plot-dataframe,plot-profit}
|
||||
trade Trade module.
|
||||
backtesting Backtesting module.
|
||||
edge Edge module.
|
||||
hyperopt Hyperopt module.
|
||||
create-userdir Create user-data directory.
|
||||
list-exchanges Print available exchanges.
|
||||
list-timeframes Print available ticker intervals (timeframes) for the
|
||||
exchange.
|
||||
download-data Download backtesting data.
|
||||
plot-dataframe Plot candles with indicators.
|
||||
plot-profit Generate plot showing profits.
|
||||
|
||||
optional arguments:
|
||||
-h, --help show this help message and exit
|
||||
-v, --verbose verbose mode (-vv for more, -vvv to get all messages)
|
||||
--version show program\'s version number and exit
|
||||
-c PATH, --config PATH
|
||||
specify configuration file (default: config.json)
|
||||
-d PATH, --datadir PATH
|
||||
path to backtest data
|
||||
-s NAME, --strategy NAME
|
||||
specify strategy class name (default: DefaultStrategy)
|
||||
--strategy-path PATH specify additional strategy lookup path
|
||||
--customhyperopt NAME
|
||||
specify hyperopt class name (default:
|
||||
DefaultHyperOpts)
|
||||
--dynamic-whitelist [INT]
|
||||
dynamically generate and update whitelist based on 24h
|
||||
BaseVolume (default: 20) DEPRECATED.
|
||||
--db-url PATH Override trades database URL, this is useful if
|
||||
dry_run is enabled or in custom deployments (default:
|
||||
None)
|
||||
-V, --version show program's version number and exit
|
||||
|
||||
```
|
||||
|
||||
### How to use a different config file?
|
||||
### Bot trading commands
|
||||
|
||||
The bot allows you to select which config file you want to use. Per
|
||||
default, the bot will load the file `./config.json`
|
||||
```
|
||||
usage: freqtrade trade [-h] [-v] [--logfile FILE] [-V] [-c PATH] [-d PATH]
|
||||
[--userdir PATH] [-s NAME] [--strategy-path PATH]
|
||||
[--db-url PATH] [--sd-notify] [--dry-run]
|
||||
|
||||
optional arguments:
|
||||
-h, --help show this help message and exit
|
||||
--db-url PATH Override trades database URL, this is useful in custom
|
||||
deployments (default: `sqlite:///tradesv3.sqlite` for
|
||||
Live Run mode, `sqlite:///tradesv3.dryrun.sqlite` for
|
||||
Dry Run).
|
||||
--sd-notify Notify systemd service manager.
|
||||
--dry-run Enforce dry-run for trading (removes Exchange secrets
|
||||
and simulates trades).
|
||||
|
||||
Common arguments:
|
||||
-v, --verbose Verbose mode (-vv for more, -vvv to get all messages).
|
||||
--logfile FILE Log to the file specified. Special values are:
|
||||
'syslog', 'journald'. See the documentation for more
|
||||
details.
|
||||
-V, --version show program's version number and exit
|
||||
-c PATH, --config PATH
|
||||
Specify configuration file (default: `config.json`).
|
||||
Multiple --config options may be used. Can be set to
|
||||
`-` to read config from stdin.
|
||||
-d PATH, --datadir PATH
|
||||
Path to directory with historical backtesting data.
|
||||
--userdir PATH, --user-data-dir PATH
|
||||
Path to userdata directory.
|
||||
|
||||
Strategy arguments:
|
||||
-s NAME, --strategy NAME
|
||||
Specify strategy class name which will be used by the
|
||||
bot.
|
||||
--strategy-path PATH Specify additional strategy lookup path.
|
||||
|
||||
```
|
||||
|
||||
### How to specify which configuration file be used?
|
||||
|
||||
The bot allows you to select which configuration file you want to use by means of
|
||||
the `-c/--config` command line option:
|
||||
|
||||
```bash
|
||||
python3 ./freqtrade/main.py -c path/far/far/away/config.json
|
||||
freqtrade trade -c path/far/far/away/config.json
|
||||
```
|
||||
|
||||
Per default, the bot loads the `config.json` configuration file from the current
|
||||
working directory.
|
||||
|
||||
### How to use multiple configuration files?
|
||||
|
||||
The bot allows you to use multiple configuration files by specifying multiple
|
||||
`-c/--config` options in the command line. Configuration parameters
|
||||
defined in the latter configuration files override parameters with the same name
|
||||
defined in the previous configuration files specified in the command line earlier.
|
||||
|
||||
For example, you can make a separate configuration file with your key and secret
|
||||
for the Exchange you use for trading, specify default configuration file with
|
||||
empty key and secret values while running in the Dry Mode (which does not actually
|
||||
require them):
|
||||
|
||||
```bash
|
||||
freqtrade trade -c ./config.json
|
||||
```
|
||||
|
||||
and specify both configuration files when running in the normal Live Trade Mode:
|
||||
|
||||
```bash
|
||||
freqtrade trade -c ./config.json -c path/to/secrets/keys.config.json
|
||||
```
|
||||
|
||||
This could help you hide your private Exchange key and Exchange secret on you local machine
|
||||
by setting appropriate file permissions for the file which contains actual secrets and, additionally,
|
||||
prevent unintended disclosure of sensitive private data when you publish examples
|
||||
of your configuration in the project issues or in the Internet.
|
||||
|
||||
See more details on this technique with examples in the documentation page on
|
||||
[configuration](configuration.md).
|
||||
|
||||
### Where to store custom data
|
||||
|
||||
Freqtrade allows the creation of a user-data directory using `freqtrade create-userdir --userdir someDirectory`.
|
||||
This directory will look as follows:
|
||||
|
||||
```
|
||||
user_data/
|
||||
├── backtest_results
|
||||
├── data
|
||||
├── hyperopts
|
||||
├── hyperopt_results
|
||||
├── plot
|
||||
└── strategies
|
||||
```
|
||||
|
||||
You can add the entry "user_data_dir" setting to your configuration, to always point your bot to this directory.
|
||||
Alternatively, pass in `--userdir` to every command.
|
||||
The bot will fail to start if the directory does not exist, but will create necessary subdirectories.
|
||||
|
||||
This directory should contain your custom strategies, custom hyperopts and hyperopt loss functions, backtesting historical data (downloaded using either backtesting command or the download script) and plot outputs.
|
||||
|
||||
It is recommended to use version control to keep track of changes to your strategies.
|
||||
|
||||
### How to use **--strategy**?
|
||||
|
||||
This parameter will allow you to load your custom strategy class.
|
||||
@@ -65,54 +154,29 @@ In `user_data/strategies` you have a file `my_awesome_strategy.py` which has
|
||||
a strategy class called `AwesomeStrategy` to load it:
|
||||
|
||||
```bash
|
||||
python3 ./freqtrade/main.py --strategy AwesomeStrategy
|
||||
freqtrade trade --strategy AwesomeStrategy
|
||||
```
|
||||
|
||||
If the bot does not find your strategy file, it will display in an error
|
||||
message the reason (File not found, or errors in your code).
|
||||
|
||||
Learn more about strategy file in [optimize your bot](https://github.com/freqtrade/freqtrade/blob/develop/docs/bot-optimization.md).
|
||||
Learn more about strategy file in
|
||||
[Strategy Customization](strategy-customization.md).
|
||||
|
||||
### How to use **--strategy-path**?
|
||||
|
||||
This parameter allows you to add an additional strategy lookup path, which gets
|
||||
checked before the default locations (The passed path must be a folder!):
|
||||
checked before the default locations (The passed path must be a directory!):
|
||||
|
||||
```bash
|
||||
python3 ./freqtrade/main.py --strategy AwesomeStrategy --strategy-path /some/folder
|
||||
freqtrade trade --strategy AwesomeStrategy --strategy-path /some/directory
|
||||
```
|
||||
|
||||
#### How to install a strategy?
|
||||
|
||||
This is very simple. Copy paste your strategy file into the folder
|
||||
This is very simple. Copy paste your strategy file into the directory
|
||||
`user_data/strategies` or use `--strategy-path`. And voila, the bot is ready to use it.
|
||||
|
||||
### How to use **--dynamic-whitelist**?
|
||||
|
||||
!!! danger "DEPRECATED"
|
||||
Dynamic-whitelist is deprecated. Please move your configurations to the configuration as outlined [here](/configuration/#dynamic-pairlists)
|
||||
|
||||
Per default `--dynamic-whitelist` will retrieve the 20 currencies based
|
||||
on BaseVolume. This value can be changed when you run the script.
|
||||
|
||||
**By Default**
|
||||
Get the 20 currencies based on BaseVolume.
|
||||
|
||||
```bash
|
||||
python3 ./freqtrade/main.py --dynamic-whitelist
|
||||
```
|
||||
|
||||
**Customize the number of currencies to retrieve**
|
||||
Get the 30 currencies based on BaseVolume.
|
||||
|
||||
```bash
|
||||
python3 ./freqtrade/main.py --dynamic-whitelist 30
|
||||
```
|
||||
|
||||
**Exception**
|
||||
`--dynamic-whitelist` must be greater than 0. If you enter 0 or a
|
||||
negative value (e.g -2), `--dynamic-whitelist` will use the default
|
||||
value (20).
|
||||
|
||||
### How to use **--db-url**?
|
||||
|
||||
When you run the bot in Dry-run mode, per default no transactions are
|
||||
@@ -121,7 +185,7 @@ using `--db-url`. This can also be used to specify a custom database
|
||||
in production mode. Example command:
|
||||
|
||||
```bash
|
||||
python3 ./freqtrade/main.py -c config.json --db-url sqlite:///tradesv3.dry_run.sqlite
|
||||
freqtrade trade -c config.json --db-url sqlite:///tradesv3.dry_run.sqlite
|
||||
```
|
||||
|
||||
## Backtesting commands
|
||||
@@ -129,59 +193,79 @@ python3 ./freqtrade/main.py -c config.json --db-url sqlite:///tradesv3.dry_run.s
|
||||
Backtesting also uses the config specified via `-c/--config`.
|
||||
|
||||
```
|
||||
usage: main.py backtesting [-h] [-i TICKER_INTERVAL] [--timerange TIMERANGE]
|
||||
[--eps] [--dmmp] [-l] [-r]
|
||||
usage: freqtrade backtesting [-h] [-v] [--logfile FILE] [-V] [-c PATH]
|
||||
[-d PATH] [--userdir PATH] [-s NAME]
|
||||
[--strategy-path PATH] [-i TICKER_INTERVAL]
|
||||
[--timerange TIMERANGE] [--max-open-trades INT]
|
||||
[--stake-amount STAKE_AMOUNT] [--fee FLOAT]
|
||||
[--eps] [--dmmp]
|
||||
[--strategy-list STRATEGY_LIST [STRATEGY_LIST ...]]
|
||||
[--export EXPORT] [--export-filename PATH]
|
||||
|
||||
optional arguments:
|
||||
-h, --help show this help message and exit
|
||||
-i TICKER_INTERVAL, --ticker-interval TICKER_INTERVAL
|
||||
specify ticker interval (1m, 5m, 30m, 1h, 1d)
|
||||
Specify ticker interval (`1m`, `5m`, `30m`, `1h`,
|
||||
`1d`).
|
||||
--timerange TIMERANGE
|
||||
specify what timerange of data to use.
|
||||
Specify what timerange of data to use.
|
||||
--max-open-trades INT
|
||||
Override the value of the `max_open_trades`
|
||||
configuration setting.
|
||||
--stake-amount STAKE_AMOUNT
|
||||
Override the value of the `stake_amount` configuration
|
||||
setting.
|
||||
--fee FLOAT Specify fee ratio. Will be applied twice (on trade
|
||||
entry and exit).
|
||||
--eps, --enable-position-stacking
|
||||
Allow buying the same pair multiple times (position
|
||||
stacking)
|
||||
stacking).
|
||||
--dmmp, --disable-max-market-positions
|
||||
Disable applying `max_open_trades` during backtest
|
||||
(same as setting `max_open_trades` to a very high
|
||||
number)
|
||||
-l, --live using live data
|
||||
-r, --refresh-pairs-cached
|
||||
refresh the pairs files in tests/testdata with the
|
||||
latest data from the exchange. Use it if you want to
|
||||
run your backtesting with up-to-date data.
|
||||
number).
|
||||
--strategy-list STRATEGY_LIST [STRATEGY_LIST ...]
|
||||
Provide a commaseparated list of strategies to
|
||||
backtest Please note that ticker-interval needs to be
|
||||
Provide a space-separated list of strategies to
|
||||
backtest. Please note that ticker-interval needs to be
|
||||
set either in config or via command line. When using
|
||||
this together with --export trades, the strategy-name
|
||||
is injected into the filename (so backtest-data.json
|
||||
becomes backtest-data-DefaultStrategy.json
|
||||
--export EXPORT export backtest results, argument are: trades Example
|
||||
--export=trades
|
||||
this together with `--export trades`, the strategy-
|
||||
name is injected into the filename (so `backtest-
|
||||
data.json` becomes `backtest-data-
|
||||
DefaultStrategy.json`
|
||||
--export EXPORT Export backtest results, argument are: trades.
|
||||
Example: `--export=trades`
|
||||
--export-filename PATH
|
||||
Save backtest results to this filename requires
|
||||
--export to be set as well Example --export-
|
||||
filename=user_data/backtest_data/backtest_today.json
|
||||
(default: user_data/backtest_data/backtest-
|
||||
result.json)
|
||||
Save backtest results to the file with this filename.
|
||||
Requires `--export` to be set as well. Example:
|
||||
`--export-filename=user_data/backtest_results/backtest
|
||||
_today.json`
|
||||
|
||||
Common arguments:
|
||||
-v, --verbose Verbose mode (-vv for more, -vvv to get all messages).
|
||||
--logfile FILE Log to the file specified.
|
||||
-V, --version show program's version number and exit
|
||||
-c PATH, --config PATH
|
||||
Specify configuration file (default: `config.json`).
|
||||
Multiple --config options may be used. Can be set to
|
||||
`-` to read config from stdin.
|
||||
-d PATH, --datadir PATH
|
||||
Path to directory with historical backtesting data.
|
||||
--userdir PATH, --user-data-dir PATH
|
||||
Path to userdata directory.
|
||||
|
||||
Strategy arguments:
|
||||
-s NAME, --strategy NAME
|
||||
Specify strategy class name which will be used by the
|
||||
bot.
|
||||
--strategy-path PATH Specify additional strategy lookup path.
|
||||
|
||||
```
|
||||
|
||||
### How to use **--refresh-pairs-cached** parameter?
|
||||
### Getting historic data for backtesting
|
||||
|
||||
The first time your run Backtesting, it will take the pairs you have
|
||||
set in your config file and download data from Bittrex.
|
||||
|
||||
If for any reason you want to update your data set, you use
|
||||
`--refresh-pairs-cached` to force Backtesting to update the data it has.
|
||||
|
||||
!!! Note
|
||||
Use it only if you want to update your data set. You will not be able to come back to the previous version.
|
||||
|
||||
To test your strategy with latest data, we recommend continuing using
|
||||
the parameter `-l` or `--live`.
|
||||
The first time your run Backtesting, you will need to download some historic data first.
|
||||
This can be accomplished by using `freqtrade download-data`.
|
||||
Check the corresponding [Data Downloading](data-download.md) section for more details
|
||||
|
||||
## Hyperopt commands
|
||||
|
||||
@@ -189,65 +273,148 @@ To optimize your strategy, you can use hyperopt parameter hyperoptimization
|
||||
to find optimal parameter values for your stategy.
|
||||
|
||||
```
|
||||
usage: freqtrade hyperopt [-h] [-i TICKER_INTERVAL] [--eps] [--dmmp]
|
||||
[--timerange TIMERANGE] [-e INT]
|
||||
[-s {all,buy,roi,stoploss} [{all,buy,roi,stoploss} ...]]
|
||||
usage: freqtrade hyperopt [-h] [-v] [--logfile FILE] [-V] [-c PATH] [-d PATH]
|
||||
[--userdir PATH] [-s NAME] [--strategy-path PATH]
|
||||
[-i TICKER_INTERVAL] [--timerange TIMERANGE]
|
||||
[--max-open-trades INT]
|
||||
[--stake-amount STAKE_AMOUNT] [--fee FLOAT]
|
||||
[--hyperopt NAME] [--hyperopt-path PATH] [--eps]
|
||||
[-e INT]
|
||||
[--spaces {all,buy,sell,roi,stoploss} [{all,buy,sell,roi,stoploss} ...]]
|
||||
[--dmmp] [--print-all] [--no-color] [--print-json]
|
||||
[-j JOBS] [--random-state INT] [--min-trades INT]
|
||||
[--continue] [--hyperopt-loss NAME]
|
||||
|
||||
optional arguments:
|
||||
-h, --help show this help message and exit
|
||||
-i TICKER_INTERVAL, --ticker-interval TICKER_INTERVAL
|
||||
specify ticker interval (1m, 5m, 30m, 1h, 1d)
|
||||
Specify ticker interval (`1m`, `5m`, `30m`, `1h`,
|
||||
`1d`).
|
||||
--timerange TIMERANGE
|
||||
Specify what timerange of data to use.
|
||||
--max-open-trades INT
|
||||
Override the value of the `max_open_trades`
|
||||
configuration setting.
|
||||
--stake-amount STAKE_AMOUNT
|
||||
Override the value of the `stake_amount` configuration
|
||||
setting.
|
||||
--fee FLOAT Specify fee ratio. Will be applied twice (on trade
|
||||
entry and exit).
|
||||
--hyperopt NAME Specify hyperopt class name which will be used by the
|
||||
bot.
|
||||
--hyperopt-path PATH Specify additional lookup path for Hyperopt and
|
||||
Hyperopt Loss functions.
|
||||
--eps, --enable-position-stacking
|
||||
Allow buying the same pair multiple times (position
|
||||
stacking)
|
||||
stacking).
|
||||
-e INT, --epochs INT Specify number of epochs (default: 100).
|
||||
--spaces {all,buy,sell,roi,stoploss} [{all,buy,sell,roi,stoploss} ...]
|
||||
Specify which parameters to hyperopt. Space-separated
|
||||
list. Default: `all`.
|
||||
--dmmp, --disable-max-market-positions
|
||||
Disable applying `max_open_trades` during backtest
|
||||
(same as setting `max_open_trades` to a very high
|
||||
number)
|
||||
--timerange TIMERANGE
|
||||
specify what timerange of data to use.
|
||||
--hyperopt PATH specify hyperopt file (default:
|
||||
freqtrade/optimize/default_hyperopt.py)
|
||||
-e INT, --epochs INT specify number of epochs (default: 100)
|
||||
-s {all,buy,roi,stoploss} [{all,buy,roi,stoploss} ...], --spaces {all,buy,roi,stoploss} [{all,buy,roi,stoploss} ...]
|
||||
Specify which parameters to hyperopt. Space separate
|
||||
list. Default: all
|
||||
number).
|
||||
--print-all Print all results, not only the best ones.
|
||||
--no-color Disable colorization of hyperopt results. May be
|
||||
useful if you are redirecting output to a file.
|
||||
--print-json Print best result detailization in JSON format.
|
||||
-j JOBS, --job-workers JOBS
|
||||
The number of concurrently running jobs for
|
||||
hyperoptimization (hyperopt worker processes). If -1
|
||||
(default), all CPUs are used, for -2, all CPUs but one
|
||||
are used, etc. If 1 is given, no parallel computing
|
||||
code is used at all.
|
||||
--random-state INT Set random state to some positive integer for
|
||||
reproducible hyperopt results.
|
||||
--min-trades INT Set minimal desired number of trades for evaluations
|
||||
in the hyperopt optimization path (default: 1).
|
||||
--continue Continue hyperopt from previous runs. By default,
|
||||
temporary files will be removed and hyperopt will
|
||||
start from scratch.
|
||||
--hyperopt-loss NAME Specify the class name of the hyperopt loss function
|
||||
class (IHyperOptLoss). Different functions can
|
||||
generate completely different results, since the
|
||||
target for optimization is different. Built-in
|
||||
Hyperopt-loss-functions are: DefaultHyperOptLoss,
|
||||
OnlyProfitHyperOptLoss, SharpeHyperOptLoss (default:
|
||||
`DefaultHyperOptLoss`).
|
||||
|
||||
Common arguments:
|
||||
-v, --verbose Verbose mode (-vv for more, -vvv to get all messages).
|
||||
--logfile FILE Log to the file specified.
|
||||
-V, --version show program's version number and exit
|
||||
-c PATH, --config PATH
|
||||
Specify configuration file (default: `config.json`).
|
||||
Multiple --config options may be used. Can be set to
|
||||
`-` to read config from stdin.
|
||||
-d PATH, --datadir PATH
|
||||
Path to directory with historical backtesting data.
|
||||
--userdir PATH, --user-data-dir PATH
|
||||
Path to userdata directory.
|
||||
|
||||
Strategy arguments:
|
||||
-s NAME, --strategy NAME
|
||||
Specify strategy class name which will be used by the
|
||||
bot.
|
||||
--strategy-path PATH Specify additional strategy lookup path.
|
||||
```
|
||||
|
||||
## Edge commands
|
||||
|
||||
To know your trade expectacny and winrate against historical data, you can use Edge.
|
||||
To know your trade expectancy and winrate against historical data, you can use Edge.
|
||||
|
||||
```
|
||||
usage: main.py edge [-h] [-i TICKER_INTERVAL] [--timerange TIMERANGE] [-r]
|
||||
[--stoplosses STOPLOSS_RANGE]
|
||||
usage: freqtrade edge [-h] [-v] [--logfile FILE] [-V] [-c PATH] [-d PATH]
|
||||
[--userdir PATH] [-s NAME] [--strategy-path PATH]
|
||||
[-i TICKER_INTERVAL] [--timerange TIMERANGE]
|
||||
[--max-open-trades INT] [--stake-amount STAKE_AMOUNT]
|
||||
[--fee FLOAT] [--stoplosses STOPLOSS_RANGE]
|
||||
|
||||
optional arguments:
|
||||
-h, --help show this help message and exit
|
||||
-i TICKER_INTERVAL, --ticker-interval TICKER_INTERVAL
|
||||
specify ticker interval (1m, 5m, 30m, 1h, 1d)
|
||||
Specify ticker interval (`1m`, `5m`, `30m`, `1h`,
|
||||
`1d`).
|
||||
--timerange TIMERANGE
|
||||
specify what timerange of data to use.
|
||||
-r, --refresh-pairs-cached
|
||||
refresh the pairs files in tests/testdata with the
|
||||
latest data from the exchange. Use it if you want to
|
||||
run your edge with up-to-date data.
|
||||
Specify what timerange of data to use.
|
||||
--max-open-trades INT
|
||||
Override the value of the `max_open_trades`
|
||||
configuration setting.
|
||||
--stake-amount STAKE_AMOUNT
|
||||
Override the value of the `stake_amount` configuration
|
||||
setting.
|
||||
--fee FLOAT Specify fee ratio. Will be applied twice (on trade
|
||||
entry and exit).
|
||||
--stoplosses STOPLOSS_RANGE
|
||||
defines a range of stoploss against which edge will
|
||||
assess the strategythe format is "min,max,step"
|
||||
(without any space).example:
|
||||
--stoplosses=-0.01,-0.1,-0.001
|
||||
Defines a range of stoploss values against which edge
|
||||
will assess the strategy. The format is "min,max,step"
|
||||
(without any space). Example:
|
||||
`--stoplosses=-0.01,-0.1,-0.001`
|
||||
|
||||
Common arguments:
|
||||
-v, --verbose Verbose mode (-vv for more, -vvv to get all messages).
|
||||
--logfile FILE Log to the file specified.
|
||||
-V, --version show program's version number and exit
|
||||
-c PATH, --config PATH
|
||||
Specify configuration file (default: `config.json`).
|
||||
Multiple --config options may be used. Can be set to
|
||||
`-` to read config from stdin.
|
||||
-d PATH, --datadir PATH
|
||||
Path to directory with historical backtesting data.
|
||||
--userdir PATH, --user-data-dir PATH
|
||||
Path to userdata directory.
|
||||
|
||||
Strategy arguments:
|
||||
-s NAME, --strategy NAME
|
||||
Specify strategy class name which will be used by the
|
||||
bot.
|
||||
--strategy-path PATH Specify additional strategy lookup path.
|
||||
```
|
||||
|
||||
To understand edge and how to read the results, please read the [edge documentation](edge.md).
|
||||
|
||||
## A parameter missing in the configuration?
|
||||
|
||||
All parameters for `main.py`, `backtesting`, `hyperopt` are referenced
|
||||
in [misc.py](https://github.com/freqtrade/freqtrade/blob/develop/freqtrade/misc.py#L84)
|
||||
|
||||
## Next step
|
||||
|
||||
The optimal strategy of the bot will change with time depending of the market trends. The next step is to
|
||||
[optimize your bot](bot-optimization.md).
|
||||
[Strategy Customization](strategy-customization.md).
|
||||
|
||||
@@ -1,76 +1,119 @@
|
||||
# Configure the bot
|
||||
|
||||
This page explains how to configure your `config.json` file.
|
||||
Freqtrade has many configurable features and possibilities.
|
||||
By default, these settings are configured via the configuration file (see below).
|
||||
|
||||
## Setup config.json
|
||||
## The Freqtrade configuration file
|
||||
|
||||
We recommend to copy and use the `config.json.example` as a template
|
||||
The bot uses a set of configuration parameters during its operation that all together conform the bot configuration. It normally reads its configuration from a file (Freqtrade configuration file).
|
||||
|
||||
Per default, the bot loads the configuration from the `config.json` file, located in the current working directory.
|
||||
|
||||
You can specify a different configuration file used by the bot with the `-c/--config` command line option.
|
||||
|
||||
In some advanced use cases, multiple configuration files can be specified and used by the bot or the bot can read its configuration parameters from the process standard input stream.
|
||||
|
||||
If you used the [Quick start](installation.md/#quick-start) method for installing
|
||||
the bot, the installation script should have already created the default configuration file (`config.json`) for you.
|
||||
|
||||
If default configuration file is not created we recommend you to copy and use the `config.json.example` as a template
|
||||
for your bot configuration.
|
||||
|
||||
The table below will list all configuration parameters.
|
||||
The Freqtrade configuration file is to be written in the JSON format.
|
||||
|
||||
Mandatory Parameters are marked as **Required**.
|
||||
Additionally to the standard JSON syntax, you may use one-line `// ...` and multi-line `/* ... */` comments in your configuration files and trailing commas in the lists of parameters.
|
||||
|
||||
| Command | Default | Description |
|
||||
|----------|---------|-------------|
|
||||
| `max_open_trades` | 3 | **Required.** Number of trades open your bot will have. If -1 then it is ignored (i.e. potentially unlimited open trades)
|
||||
| `stake_currency` | BTC | **Required.** Crypto-currency used for trading.
|
||||
| `stake_amount` | 0.05 | **Required.** Amount of crypto-currency your bot will use for each trade. Per default, the bot will use (0.05 BTC x 3) = 0.15 BTC in total will be always engaged. Set it to `"unlimited"` to allow the bot to use all available balance.
|
||||
| `amount_reserve_percent` | 0.05 | Reserve some amount in min pair stake amount. Default is 5%. The bot will reserve `amount_reserve_percent` + stop-loss value when calculating min pair stake amount in order to avoid possible trade refusals.
|
||||
| `ticker_interval` | [1m, 5m, 30m, 1h, 1d] | The ticker interval to use (1min, 5 min, 30 min, 1 hour or 1 day). Default is 5 minutes. [Strategy Override](#parameters-in-strategy).
|
||||
| `fiat_display_currency` | USD | **Required.** Fiat currency used to show your profits. More information below.
|
||||
| `dry_run` | true | **Required.** Define if the bot must be in Dry-run or production mode.
|
||||
| `process_only_new_candles` | false | If set to true indicators are processed only once a new candle arrives. If false each loop populates the indicators, this will mean the same candle is processed many times creating system load but can be useful of your strategy depends on tick data not only candle. [Strategy Override](#parameters-in-strategy).
|
||||
| `minimal_roi` | See below | Set the threshold in percent the bot will use to sell a trade. More information below. [Strategy Override](#parameters-in-strategy).
|
||||
| `stoploss` | -0.10 | Value of the stoploss in percent used by the bot. More information below. More details in the [stoploss documentation](stoploss.md). [Strategy Override](#parameters-in-strategy).
|
||||
| `trailing_stop` | false | Enables trailing stop-loss (based on `stoploss` in either configuration or strategy file). More details in the [stoploss documentation](stoploss.md). [Strategy Override](#parameters-in-strategy).
|
||||
| `trailing_stop_positive` | 0 | Changes stop-loss once profit has been reached. More details in the [stoploss documentation](stoploss.md). [Strategy Override](#parameters-in-strategy).
|
||||
| `trailing_stop_positive_offset` | 0 | Offset on when to apply `trailing_stop_positive`. Percentage value which should be positive. More details in the [stoploss documentation](stoploss.md). [Strategy Override](#parameters-in-strategy).
|
||||
| `unfilledtimeout.buy` | 10 | **Required.** How long (in minutes) the bot will wait for an unfilled buy order to complete, after which the order will be cancelled.
|
||||
| `unfilledtimeout.sell` | 10 | **Required.** How long (in minutes) the bot will wait for an unfilled sell order to complete, after which the order will be cancelled.
|
||||
| `bid_strategy.ask_last_balance` | 0.0 | **Required.** Set the bidding price. More information [below](#understand-ask_last_balance).
|
||||
| `bid_strategy.use_order_book` | false | Allows buying of pair using the rates in Order Book Bids.
|
||||
| `bid_strategy.order_book_top` | 0 | Bot will use the top N rate in Order Book Bids. Ie. a value of 2 will allow the bot to pick the 2nd bid rate in Order Book Bids.
|
||||
| `bid_strategy. check_depth_of_market.enabled` | false | Does not buy if the % difference of buy orders and sell orders is met in Order Book.
|
||||
| `bid_strategy. check_depth_of_market.bids_to_ask_delta` | 0 | The % difference of buy orders and sell orders found in Order Book. A value lesser than 1 means sell orders is greater, while value greater than 1 means buy orders is higher.
|
||||
| `ask_strategy.use_order_book` | false | Allows selling of open traded pair using the rates in Order Book Asks.
|
||||
| `ask_strategy.order_book_min` | 0 | Bot will scan from the top min to max Order Book Asks searching for a profitable rate.
|
||||
| `ask_strategy.order_book_max` | 0 | Bot will scan from the top min to max Order Book Asks searching for a profitable rate.
|
||||
| `order_types` | None | Configure order-types depending on the action (`"buy"`, `"sell"`, `"stoploss"`, `"stoploss_on_exchange"`). [More information below](#understand-order_types). [Strategy Override](#parameters-in-strategy).
|
||||
| `order_time_in_force` | None | Configure time in force for buy and sell orders. [More information below](#understand-order_time_in_force). [Strategy Override](#parameters-in-strategy).
|
||||
| `exchange.name` | bittrex | **Required.** Name of the exchange class to use. [List below](#user-content-what-values-for-exchangename).
|
||||
| `exchange.key` | key | API key to use for the exchange. Only required when you are in production mode.
|
||||
| `exchange.secret` | secret | API secret to use for the exchange. Only required when you are in production mode.
|
||||
| `exchange.pair_whitelist` | [] | List of currency to use by the bot. Can be overrided with `--dynamic-whitelist` param.
|
||||
| `exchange.pair_blacklist` | [] | List of currency the bot must avoid. Useful when using `--dynamic-whitelist` param.
|
||||
| `exchange.ccxt_rate_limit` | True | DEPRECATED!! Have CCXT handle Exchange rate limits. Depending on the exchange, having this to false can lead to temporary bans from the exchange.
|
||||
| `exchange.ccxt_config` | None | Additional CCXT parameters passed to the regular ccxt instance. Parameters may differ from exchange to exchange and are documented in the [ccxt documentation](https://ccxt.readthedocs.io/en/latest/manual.html#instantiation)
|
||||
| `exchange.ccxt_async_config` | None | Additional CCXT parameters passed to the async ccxt instance. Parameters may differ from exchange to exchange and are documented in the [ccxt documentation](https://ccxt.readthedocs.io/en/latest/manual.html#instantiation)
|
||||
| `edge` | false | Please refer to [edge configuration document](edge.md) for detailed explanation.
|
||||
| `experimental.use_sell_signal` | false | Use your sell strategy in addition of the `minimal_roi`. [Strategy Override](#parameters-in-strategy).
|
||||
| `experimental.sell_profit_only` | false | Waits until you have made a positive profit before taking a sell decision. [Strategy Override](#parameters-in-strategy).
|
||||
| `experimental.ignore_roi_if_buy_signal` | false | Does not sell if the buy-signal is still active. Takes preference over `minimal_roi` and `use_sell_signal`. [Strategy Override](#parameters-in-strategy).
|
||||
| `pairlist.method` | StaticPairList | Use Static whitelist. [More information below](#dynamic-pairlists).
|
||||
| `pairlist.config` | None | Additional configuration for dynamic pairlists. [More information below](#dynamic-pairlists).
|
||||
| `telegram.enabled` | true | **Required.** Enable or not the usage of Telegram.
|
||||
| `telegram.token` | token | Your Telegram bot token. Only required if `telegram.enabled` is `true`.
|
||||
| `telegram.chat_id` | chat_id | Your personal Telegram account id. Only required if `telegram.enabled` is `true`.
|
||||
| `webhook.enabled` | false | Enable usage of Webhook notifications
|
||||
| `webhook.url` | false | URL for the webhook. Only required if `webhook.enabled` is `true`. See the [webhook documentation](webhook-config.md) for more details.
|
||||
| `webhook.webhookbuy` | false | Payload to send on buy. Only required if `webhook.enabled` is `true`. See the [webhook documentationV](webhook-config.md) for more details.
|
||||
| `webhook.webhooksell` | false | Payload to send on sell. Only required if `webhook.enabled` is `true`. See the [webhook documentationV](webhook-config.md) for more details.
|
||||
| `webhook.webhookstatus` | false | Payload to send on status calls. Only required if `webhook.enabled` is `true`. See the [webhook documentationV](webhook-config.md) for more details.
|
||||
| `db_url` | `sqlite:///tradesv3.sqlite`| Declares database URL to use. NOTE: This defaults to `sqlite://` if `dry_run` is `True`.
|
||||
| `initial_state` | running | Defines the initial application state. More information below.
|
||||
| `forcebuy_enable` | false | Enables the RPC Commands to force a buy. More information below.
|
||||
| `strategy` | DefaultStrategy | Defines Strategy class to use.
|
||||
| `strategy_path` | null | Adds an additional strategy lookup path (must be a folder).
|
||||
| `internals.process_throttle_secs` | 5 | **Required.** Set the process throttle. Value in second.
|
||||
Do not worry if you are not familiar with JSON format -- simply open the configuration file with an editor of your choice, make some changes to the parameters you need, save your changes and, finally, restart the bot or, if it was previously stopped, run it again with the changes you made to the configuration. The bot validates syntax of the configuration file at startup and will warn you if you made any errors editing it, pointing out problematic lines.
|
||||
|
||||
### Parameters in strategy
|
||||
## Configuration parameters
|
||||
|
||||
The following parameters can be set in either configuration or strategy.
|
||||
Values in the configuration are always overwriting values set in the strategy.
|
||||
The table below will list all configuration parameters available.
|
||||
|
||||
Freqtrade can also load many options via command line (CLI) arguments (check out the commands `--help` output for details).
|
||||
The prevelance for all Options is as follows:
|
||||
|
||||
- CLI arguments override any other option
|
||||
- Configuration files are used in sequence (last file wins), and override Strategy configurations.
|
||||
- Strategy configurations are only used if they are not set via configuration or via command line arguments. These options are market with [Strategy Override](#parameters-in-the-strategy) in the below table.
|
||||
|
||||
Mandatory parameters are marked as **Required**, which means that they are required to be set in one of the possible ways.
|
||||
|
||||
| Parameter | Description |
|
||||
|------------|-------------|
|
||||
| `max_open_trades` | **Required.** Number of trades open your bot will have. If -1 then it is ignored (i.e. potentially unlimited open trades). [More information below](#configuring-amount-per-trade).<br> ***Datatype:*** *Positive integer or -1.*
|
||||
| `stake_currency` | **Required.** Crypto-currency used for trading. [Strategy Override](#parameters-in-the-strategy). <br> ***Datatype:*** *String*
|
||||
| `stake_amount` | **Required.** Amount of crypto-currency your bot will use for each trade. Set it to `"unlimited"` to allow the bot to use all available balance. [More information below](#configuring-amount-per-trade). [Strategy Override](#parameters-in-the-strategy). <br> ***Datatype:*** *Positive float or `"unlimited"`.*
|
||||
| `tradable_balance_ratio` | Ratio of the total account balance the bot is allowed to trade. [More information below](#configuring-amount-per-trade). <br>*Defaults to `0.99` 99%).*<br> ***Datatype:*** *Positive float between `0.1` and `1.0`.*
|
||||
| `amend_last_stake_amount` | Use reduced last stake amount if necessary. [More information below](#configuring-amount-per-trade). <br>*Defaults to `false`.* <br> ***Datatype:*** *Boolean*
|
||||
| `last_stake_amount_min_ratio` | Defines minimum stake amount that has to be left and executed. Applies only to the last stake amount when it's amended to a reduced value (i.e. if `amend_last_stake_amount` is set to `true`). [More information below](#configuring-amount-per-trade). <br>*Defaults to `0.5`.* <br> ***Datatype:*** *Float (as ratio)*
|
||||
| `amount_reserve_percent` | Reserve some amount in min pair stake amount. The bot will reserve `amount_reserve_percent` + stoploss value when calculating min pair stake amount in order to avoid possible trade refusals. <br>*Defaults to `0.05` (5%).* <br> ***Datatype:*** *Positive Float as ratio.*
|
||||
| `ticker_interval` | The ticker interval to use (e.g `1m`, `5m`, `15m`, `30m`, `1h` ...). [Strategy Override](#parameters-in-the-strategy). <br> ***Datatype:*** *String*
|
||||
| `fiat_display_currency` | Fiat currency used to show your profits. [More information below](#what-values-can-be-used-for-fiat_display_currency). <br> ***Datatype:*** *String*
|
||||
| `dry_run` | **Required.** Define if the bot must be in Dry Run or production mode. <br>*Defaults to `true`.* <br> ***Datatype:*** *Boolean*
|
||||
| `dry_run_wallet` | Define the starting amount in stake currency for the simulated wallet used by the bot running in the Dry Run mode.<br>*Defaults to `1000`.* <br> ***Datatype:*** *Float*
|
||||
| `process_only_new_candles` | Enable processing of indicators only when new candles arrive. If false each loop populates the indicators, this will mean the same candle is processed many times creating system load but can be useful of your strategy depends on tick data not only candle. [Strategy Override](#parameters-in-the-strategy). <br>*Defaults to `false`.* <br> ***Datatype:*** *Boolean*
|
||||
| `minimal_roi` | **Required.** Set the threshold in percent the bot will use to sell a trade. [More information below](#understand-minimal_roi). [Strategy Override](#parameters-in-the-strategy). <br> ***Datatype:*** *Dict*
|
||||
| `stoploss` | **Required.** Value of the stoploss in percent used by the bot. More details in the [stoploss documentation](stoploss.md). [Strategy Override](#parameters-in-the-strategy). <br> ***Datatype:*** *Float (as ratio)*
|
||||
| `trailing_stop` | Enables trailing stoploss (based on `stoploss` in either configuration or strategy file). More details in the [stoploss documentation](stoploss.md). [Strategy Override](#parameters-in-the-strategy). <br> ***Datatype:*** *Boolean*
|
||||
| `trailing_stop_positive` | Changes stoploss once profit has been reached. More details in the [stoploss documentation](stoploss.md). [Strategy Override](#parameters-in-the-strategy). <br> ***Datatype:*** *Float*
|
||||
| `trailing_stop_positive_offset` | Offset on when to apply `trailing_stop_positive`. Percentage value which should be positive. More details in the [stoploss documentation](stoploss.md). [Strategy Override](#parameters-in-the-strategy). <br>*Defaults to `0.0` (no offset).* <br> ***Datatype:*** *Float*
|
||||
| `trailing_only_offset_is_reached` | Only apply trailing stoploss when the offset is reached. [stoploss documentation](stoploss.md). [Strategy Override](#parameters-in-the-strategy). <br>*Defaults to `false`.* <br> ***Datatype:*** *Boolean*
|
||||
| `unfilledtimeout.buy` | **Required.** How long (in minutes) the bot will wait for an unfilled buy order to complete, after which the order will be cancelled. [Strategy Override](#parameters-in-the-strategy).<br> ***Datatype:*** *Integer*
|
||||
| `unfilledtimeout.sell` | **Required.** How long (in minutes) the bot will wait for an unfilled sell order to complete, after which the order will be cancelled. [Strategy Override](#parameters-in-the-strategy).<br> ***Datatype:*** *Integer*
|
||||
| `bid_strategy.ask_last_balance` | **Required.** Set the bidding price. More information [below](#buy-price-without-orderbook).
|
||||
| `bid_strategy.use_order_book` | Enable buying using the rates in [Order Book Bids](#buy-price-with-orderbook-enabled). <br> ***Datatype:*** *Boolean*
|
||||
| `bid_strategy.order_book_top` | Bot will use the top N rate in Order Book Bids to buy. I.e. a value of 2 will allow the bot to pick the 2nd bid rate in [Order Book Bids](#buy-price-with-orderbook-enabled). <br>*Defaults to `1`.* <br> ***Datatype:*** *Positive Integer*
|
||||
| `bid_strategy. check_depth_of_market.enabled` | Do not buy if the difference of buy orders and sell orders is met in Order Book. [Check market depth](#check-depth-of-market). <br>*Defaults to `false`.* <br> ***Datatype:*** *Boolean*
|
||||
| `bid_strategy. check_depth_of_market.bids_to_ask_delta` | The difference ratio of buy orders and sell orders found in Order Book. A value below 1 means sell order size is greater, while value greater than 1 means buy order size is higher. [Check market depth](#check-depth-of-market) <br> *Defaults to `0`.* <br> ***Datatype:*** *Float (as ratio)*
|
||||
| `ask_strategy.use_order_book` | Enable selling of open trades using [Order Book Asks](#sell-price-with-orderbook-enabled). <br> ***Datatype:*** *Boolean*
|
||||
| `ask_strategy.order_book_min` | Bot will scan from the top min to max Order Book Asks searching for a profitable rate. <br>*Defaults to `1`.* <br> ***Datatype:*** *Positive Integer*
|
||||
| `ask_strategy.order_book_max` | Bot will scan from the top min to max Order Book Asks searching for a profitable rate. <br>*Defaults to `1`.* <br> ***Datatype:*** *Positive Integer*
|
||||
| `ask_strategy.use_sell_signal` | Use sell signals produced by the strategy in addition to the `minimal_roi`. [Strategy Override](#parameters-in-the-strategy). <br>*Defaults to `true`.* <br> ***Datatype:*** *Boolean*
|
||||
| `ask_strategy.sell_profit_only` | Wait until the bot makes a positive profit before taking a sell decision. [Strategy Override](#parameters-in-the-strategy). <br>*Defaults to `false`.* <br> ***Datatype:*** *Boolean*
|
||||
| `ask_strategy.ignore_roi_if_buy_signal` | Do not sell if the buy signal is still active. This setting takes preference over `minimal_roi` and `use_sell_signal`. [Strategy Override](#parameters-in-the-strategy). <br>*Defaults to `false`.* <br> ***Datatype:*** *Boolean*
|
||||
| `order_types` | Configure order-types depending on the action (`"buy"`, `"sell"`, `"stoploss"`, `"stoploss_on_exchange"`). [More information below](#understand-order_types). [Strategy Override](#parameters-in-the-strategy).<br> ***Datatype:*** *Dict*
|
||||
| `order_time_in_force` | Configure time in force for buy and sell orders. [More information below](#understand-order_time_in_force). [Strategy Override](#parameters-in-the-strategy). <br> ***Datatype:*** *Dict*
|
||||
| `exchange.name` | **Required.** Name of the exchange class to use. [List below](#user-content-what-values-for-exchangename). <br> ***Datatype:*** *String*
|
||||
| `exchange.sandbox` | Use the 'sandbox' version of the exchange, where the exchange provides a sandbox for risk-free integration. See [here](sandbox-testing.md) in more details.<br> ***Datatype:*** *Boolean*
|
||||
| `exchange.key` | API key to use for the exchange. Only required when you are in production mode.<br>**Keep it in secret, do not disclose publicly.** <br> ***Datatype:*** *String*
|
||||
| `exchange.secret` | API secret to use for the exchange. Only required when you are in production mode.<br>**Keep it in secret, do not disclose publicly.** <br> ***Datatype:*** *String*
|
||||
| `exchange.password` | API password to use for the exchange. Only required when you are in production mode and for exchanges that use password for API requests.<br>**Keep it in secret, do not disclose publicly.** <br> ***Datatype:*** *String*
|
||||
| `exchange.pair_whitelist` | List of pairs to use by the bot for trading and to check for potential trades during backtesting. Not used by VolumePairList (see [below](#dynamic-pairlists)). <br> ***Datatype:*** *List*
|
||||
| `exchange.pair_blacklist` | List of pairs the bot must absolutely avoid for trading and backtesting (see [below](#dynamic-pairlists)). <br> ***Datatype:*** *List*
|
||||
| `exchange.ccxt_config` | Additional CCXT parameters passed to the regular ccxt instance. Parameters may differ from exchange to exchange and are documented in the [ccxt documentation](https://ccxt.readthedocs.io/en/latest/manual.html#instantiation) <br> ***Datatype:*** *Dict*
|
||||
| `exchange.ccxt_async_config` | Additional CCXT parameters passed to the async ccxt instance. Parameters may differ from exchange to exchange and are documented in the [ccxt documentation](https://ccxt.readthedocs.io/en/latest/manual.html#instantiation) <br> ***Datatype:*** *Dict*
|
||||
| `exchange.markets_refresh_interval` | The interval in minutes in which markets are reloaded. <br>*Defaults to `60` minutes.* <br> ***Datatype:*** *Positive Integer*
|
||||
| `edge.*` | Please refer to [edge configuration document](edge.md) for detailed explanation.
|
||||
| `experimental.block_bad_exchanges` | Block exchanges known to not work with freqtrade. Leave on default unless you want to test if that exchange works now. <br>*Defaults to `true`.* <br> ***Datatype:*** *Boolean*
|
||||
| `pairlists` | Define one or more pairlists to be used. [More information below](#dynamic-pairlists). <br>*Defaults to `StaticPairList`.* <br> ***Datatype:*** *List of Dicts*
|
||||
| `telegram.enabled` | Enable the usage of Telegram. <br> ***Datatype:*** *Boolean*
|
||||
| `telegram.token` | Your Telegram bot token. Only required if `telegram.enabled` is `true`. <br>**Keep it in secret, do not disclose publicly.** <br> ***Datatype:*** *String*
|
||||
| `telegram.chat_id` | Your personal Telegram account id. Only required if `telegram.enabled` is `true`. <br>**Keep it in secret, do not disclose publicly.** <br> ***Datatype:*** *String*
|
||||
| `webhook.enabled` | Enable usage of Webhook notifications <br> ***Datatype:*** *Boolean*
|
||||
| `webhook.url` | URL for the webhook. Only required if `webhook.enabled` is `true`. See the [webhook documentation](webhook-config.md) for more details. <br> ***Datatype:*** *String*
|
||||
| `webhook.webhookbuy` | Payload to send on buy. Only required if `webhook.enabled` is `true`. See the [webhook documentation](webhook-config.md) for more details. <br> ***Datatype:*** *String*
|
||||
| `webhook.webhooksell` | Payload to send on sell. Only required if `webhook.enabled` is `true`. See the [webhook documentation](webhook-config.md) for more details. <br> ***Datatype:*** *String*
|
||||
| `webhook.webhookstatus` | Payload to send on status calls. Only required if `webhook.enabled` is `true`. See the [webhook documentation](webhook-config.md) for more details. <br> ***Datatype:*** *String*
|
||||
| `api_server.enabled` | Enable usage of API Server. See the [API Server documentation](rest-api.md) for more details. <br> ***Datatype:*** *Boolean*
|
||||
| `api_server.listen_ip_address` | Bind IP address. See the [API Server documentation](rest-api.md) for more details. <br> ***Datatype:*** *IPv4*
|
||||
| `api_server.listen_port` | Bind Port. See the [API Server documentation](rest-api.md) for more details. <br>***Datatype:*** *Integer between 1024 and 65535*
|
||||
| `api_server.username` | Username for API server. See the [API Server documentation](rest-api.md) for more details. <br>**Keep it in secret, do not disclose publicly.**<br> ***Datatype:*** *String*
|
||||
| `api_server.password` | Password for API server. See the [API Server documentation](rest-api.md) for more details. <br>**Keep it in secret, do not disclose publicly.**<br> ***Datatype:*** *String*
|
||||
| `db_url` | Declares database URL to use. NOTE: This defaults to `sqlite:///tradesv3.dryrun.sqlite` if `dry_run` is `true`, and to `sqlite:///tradesv3.sqlite` for production instances. <br> ***Datatype:*** *String, SQLAlchemy connect string*
|
||||
| `initial_state` | Defines the initial application state. More information below. <br>*Defaults to `stopped`.* <br> ***Datatype:*** *Enum, either `stopped` or `running`*
|
||||
| `forcebuy_enable` | Enables the RPC Commands to force a buy. More information below. <br> ***Datatype:*** *Boolean*
|
||||
| `strategy` | **Required** Defines Strategy class to use. Recommended to be set via `--strategy NAME`. <br> ***Datatype:*** *ClassName*
|
||||
| `strategy_path` | Adds an additional strategy lookup path (must be a directory). <br> ***Datatype:*** *String*
|
||||
| `internals.process_throttle_secs` | Set the process throttle. Value in second. <br>*Defaults to `5` seconds.* <br> ***Datatype:*** *Positive Integer*
|
||||
| `internals.heartbeat_interval` | Print heartbeat message every N seconds. Set to 0 to disable heartbeat messages. <br>*Defaults to `60` seconds.* <br> ***Datatype:*** *Positive Integer or 0*
|
||||
| `internals.sd_notify` | Enables use of the sd_notify protocol to tell systemd service manager about changes in the bot state and issue keep-alive pings. See [here](installation.md#7-optional-configure-freqtrade-as-a-systemd-service) for more details. <br> ***Datatype:*** *Boolean*
|
||||
| `logfile` | Specifies logfile name. Uses a rolling strategy for log file rotation for 10 files with the 1MB limit per file. <br> ***Datatype:*** *String*
|
||||
| `user_data_dir` | Directory containing user data. <br> *Defaults to `./user_data/`*. <br> ***Datatype:*** *String*
|
||||
|
||||
### Parameters in the strategy
|
||||
|
||||
The following parameters can be set in either configuration file or strategy.
|
||||
Values set in the configuration file always overwrite values set in the strategy.
|
||||
|
||||
* `minimal_roi`
|
||||
* `ticker_interval`
|
||||
@@ -78,33 +121,92 @@ Values in the configuration are always overwriting values set in the strategy.
|
||||
* `trailing_stop`
|
||||
* `trailing_stop_positive`
|
||||
* `trailing_stop_positive_offset`
|
||||
* `trailing_only_offset_is_reached`
|
||||
* `process_only_new_candles`
|
||||
* `order_types`
|
||||
* `order_time_in_force`
|
||||
* `use_sell_signal` (experimental)
|
||||
* `sell_profit_only` (experimental)
|
||||
* `ignore_roi_if_buy_signal` (experimental)
|
||||
* `stake_currency`
|
||||
* `stake_amount`
|
||||
* `unfilledtimeout`
|
||||
* `use_sell_signal` (ask_strategy)
|
||||
* `sell_profit_only` (ask_strategy)
|
||||
* `ignore_roi_if_buy_signal` (ask_strategy)
|
||||
|
||||
### Understand stake_amount
|
||||
### Configuring amount per trade
|
||||
|
||||
`stake_amount` is an amount of crypto-currency your bot will use for each trade.
|
||||
The minimal value is 0.0005. If there is not enough crypto-currency in
|
||||
the account an exception is generated.
|
||||
To allow the bot to trade all the available `stake_currency` in your account set
|
||||
There are several methods to configure how much of the stake currency the bot will use to enter a trade. All methods respect the [available balance configuration](#available-balance) as explained below.
|
||||
|
||||
#### Available balance
|
||||
|
||||
By default, the bot assumes that the `complete amount - 1%` is at it's disposal, and when using [dynamic stake amount](#dynamic-stake-amount), it will split the complete balance into `max_open_trades` buckets per trade.
|
||||
Freqtrade will reserve 1% for eventual fees when entering a trade and will therefore not touch that by default.
|
||||
|
||||
You can configure the "untouched" amount by using the `tradable_balance_ratio` setting.
|
||||
|
||||
For example, if you have 10 ETH available in your wallet on the exchange and `tradable_balance_ratio=0.5` (which is 50%), then the bot will use a maximum amount of 5 ETH for trading and considers this as available balance. The rest of the wallet is untouched by the trades.
|
||||
|
||||
!!! Warning
|
||||
The `tradable_balance_ratio` setting applies to the current balance (free balance + tied up in trades). Therefore, assuming the starting balance of 1000, a configuration with `tradable_balance_ratio=0.99` will not guarantee that 10 currency units will always remain available on the exchange. For example, the free amount may reduce to 5 units if the total balance is reduced to 500 (either by a losing streak, or by withdrawing balance).
|
||||
|
||||
#### Amend last stake amount
|
||||
|
||||
Assuming we have the tradable balance of 1000 USDT, `stake_amount=400`, and `max_open_trades=3`.
|
||||
The bot would open 2 trades, and will be unable to fill the last trading slot, since the requested 400 USDT are no longer available, since 800 USDT are already tied in other trades.
|
||||
|
||||
To overcome this, the option `amend_last_stake_amount` can be set to `True`, which will enable the bot to reduce stake_amount to the available balance in order to fill the last trade slot.
|
||||
|
||||
In the example above this would mean:
|
||||
|
||||
- Trade1: 400 USDT
|
||||
- Trade2: 400 USDT
|
||||
- Trade3: 200 USDT
|
||||
|
||||
!!! Note
|
||||
This option only applies with [Static stake amount](#static-stake-amount) - since [Dynamic stake amount](#dynamic-stake-amount) divides the balances evenly.
|
||||
|
||||
!!! Note
|
||||
The minimum last stake amount can be configured using `amend_last_stake_amount` - which defaults to 0.5 (50%). This means that the minimum stake amount that's ever used is `stake_amount * 0.5`. This avoids very low stake amounts, that are close to the minimum tradable amount for the pair and can be refused by the exchange.
|
||||
|
||||
#### Static stake amount
|
||||
|
||||
The `stake_amount` configuration statically configures the amount of stake-currency your bot will use for each trade.
|
||||
|
||||
The minimal configuration value is 0.0001, however, please check your exchange's trading minimums for the stake currency you're using to avoid problems.
|
||||
|
||||
This setting works in combination with `max_open_trades`. The maximum capital engaged in trades is `stake_amount * max_open_trades`.
|
||||
For example, the bot will at most use (0.05 BTC x 3) = 0.15 BTC, assuming a configuration of `max_open_trades=3` and `stake_amount=0.05`.
|
||||
|
||||
!!! Note
|
||||
This setting respects the [available balance configuration](#available-balance).
|
||||
|
||||
#### Dynamic stake amount
|
||||
|
||||
Alternatively, you can use a dynamic stake amount, which will use the available balance on the exchange, and divide that equally by the amount of allowed trades (`max_open_trades`).
|
||||
|
||||
To configure this, set `stake_amount="unlimited"`. We also recommend to set `tradable_balance_ratio=0.99` (99%) - to keep a minimum balance for eventual fees.
|
||||
|
||||
In this case a trade amount is calculated as:
|
||||
|
||||
```python
|
||||
currency_balance / (max_open_trades - current_open_trades)
|
||||
```
|
||||
|
||||
To allow the bot to trade all the available `stake_currency` in your account (minus `tradable_balance_ratio`) set
|
||||
|
||||
```json
|
||||
"stake_amount" : "unlimited",
|
||||
"tradable_balance_ratio": 0.99,
|
||||
```
|
||||
|
||||
In this case a trade amount is calclulated as:
|
||||
!!! Note
|
||||
This configuration will allow increasing / decreasing stakes depending on the performance of the bot (lower stake if bot is loosing, higher stakes if the bot has a winning record, since higher balances are available).
|
||||
|
||||
```python
|
||||
currency_balanse / (max_open_trades - current_open_trades)
|
||||
```
|
||||
!!! Note "When using Dry-Run Mode"
|
||||
When using `"stake_amount" : "unlimited",` in combination with Dry-Run, the balance will be simulated starting with a stake of `dry_run_wallet` which will evolve over time. It is therefore important to set `dry_run_wallet` to a sensible value (like 0.05 or 0.01 for BTC and 1000 or 100 for USDT, for example), otherwise it may simulate trades with 100 BTC (or more) or 0.05 USDT (or less) at once - which may not correspond to your real available balance or is less than the exchange minimal limit for the order amount for the stake currency.
|
||||
|
||||
### Understand minimal_roi
|
||||
|
||||
`minimal_roi` is a JSON object where the key is a duration
|
||||
The `minimal_roi` configuration parameter is a JSON object where the key is a duration
|
||||
in minutes and the value is the minimum ROI in percent.
|
||||
See the example below:
|
||||
|
||||
@@ -117,89 +219,138 @@ See the example below:
|
||||
},
|
||||
```
|
||||
|
||||
Most of the strategy files already include the optimal `minimal_roi`
|
||||
value. This parameter is optional. If you use it, it will take over the
|
||||
Most of the strategy files already include the optimal `minimal_roi` value.
|
||||
This parameter can be set in either Strategy or Configuration file. If you use it in the configuration file, it will override the
|
||||
`minimal_roi` value from the strategy file.
|
||||
If it is not set in either Strategy or Configuration, a default of 1000% `{"0": 10}` is used, and minimal roi is disabled unless your trade generates 1000% profit.
|
||||
|
||||
!!! Note "Special case to forcesell after a specific time"
|
||||
A special case presents using `"<N>": -1` as ROI. This forces the bot to sell a trade after N Minutes, no matter if it's positive or negative, so represents a time-limited force-sell.
|
||||
|
||||
### Understand stoploss
|
||||
|
||||
`stoploss` is loss in percentage that should trigger a sale.
|
||||
For example value `-0.10` will cause immediate sell if the
|
||||
profit dips below -10% for a given trade. This parameter is optional.
|
||||
|
||||
Most of the strategy files already include the optimal `stoploss`
|
||||
value. This parameter is optional. If you use it, it will take over the
|
||||
`stoploss` value from the strategy file.
|
||||
Go to the [stoploss documentation](stoploss.md) for more details.
|
||||
|
||||
### Understand trailing stoploss
|
||||
|
||||
Go to the [trailing stoploss Documentation](stoploss.md) for details on trailing stoploss.
|
||||
Go to the [trailing stoploss Documentation](stoploss.md#trailing-stop-loss) for details on trailing stoploss.
|
||||
|
||||
### Understand initial_state
|
||||
|
||||
`initial_state` is an optional field that defines the initial application state.
|
||||
The `initial_state` configuration parameter is an optional field that defines the initial application state.
|
||||
Possible values are `running` or `stopped`. (default=`running`)
|
||||
If the value is `stopped` the bot has to be started with `/start` first.
|
||||
|
||||
### Understand forcebuy_enable
|
||||
|
||||
`forcebuy_enable` enables the usage of forcebuy commands via Telegram.
|
||||
The `forcebuy_enable` configuration parameter enables the usage of forcebuy commands via Telegram.
|
||||
This is disabled for security reasons by default, and will show a warning message on startup if enabled.
|
||||
You send `/forcebuy ETH/BTC` to the bot, who buys the pair and holds it until a regular sell-signal appears (ROI, stoploss, /forcesell).
|
||||
For example, you can send `/forcebuy ETH/BTC` Telegram command when this feature if enabled to the bot,
|
||||
who then buys the pair and holds it until a regular sell-signal (ROI, stoploss, /forcesell) appears.
|
||||
|
||||
This can be dangerous with some strategies, so use with care.
|
||||
|
||||
Can be dangerous with some strategies, so use with care
|
||||
See [the telegram documentation](telegram-usage.md) for details on usage.
|
||||
|
||||
### Understand process_throttle_secs
|
||||
|
||||
`process_throttle_secs` is an optional field that defines in seconds how long the bot should wait
|
||||
The `process_throttle_secs` configuration parameter is an optional field that defines in seconds how long the bot should wait
|
||||
before asking the strategy if we should buy or a sell an asset. After each wait period, the strategy is asked again for
|
||||
every opened trade wether or not we should sell, and for all the remaining pairs (either the dynamic list of pairs or
|
||||
the static list of pairs) if we should buy.
|
||||
|
||||
### Understand ask_last_balance
|
||||
|
||||
`ask_last_balance` sets the bidding price. Value `0.0` will use `ask` price, `1.0` will
|
||||
use the `last` price and values between those interpolate between ask and last
|
||||
price. Using `ask` price will guarantee quick success in bid, but bot will also
|
||||
end up paying more then would probably have been necessary.
|
||||
|
||||
### Understand order_types
|
||||
|
||||
`order_types` contains a dict mapping order-types to market-types as well as stoploss on or off exchange type and stoploss on exchange update interval in seconds. This allows to buy using limit orders, sell using limit-orders, and create stoploss orders using market. It also allows to set the stoploss "on exchange" which means stoploss order would be placed immediately once the buy order is fulfilled. In case stoploss on exchange and `trailing_stop` are both set, then the bot will use `stoploss_on_exchange_interval` to check it periodically and update it if necessary (e.x. in case of trailing stoploss).
|
||||
This can be set in the configuration or in the strategy. Configuration overwrites strategy configurations.
|
||||
The `order_types` configuration parameter maps actions (`buy`, `sell`, `stoploss`) to order-types (`market`, `limit`, ...) as well as configures stoploss to be on the exchange and defines stoploss on exchange update interval in seconds.
|
||||
|
||||
If this is configured, all 4 values (`"buy"`, `"sell"`, `"stoploss"` and `"stoploss_on_exchange"`) need to be present, otherwise the bot warn about it and will fail to start.
|
||||
The below is the default which is used if this is not configured in either Strategy or configuration.
|
||||
This allows to buy using limit orders, sell using
|
||||
limit-orders, and create stoplosses using using market orders. It also allows to set the
|
||||
stoploss "on exchange" which means stoploss order would be placed immediately once
|
||||
the buy order is fulfilled.
|
||||
If `stoploss_on_exchange` and `trailing_stop` are both set, then the bot will use `stoploss_on_exchange_interval` to check and update the stoploss on exchange periodically.
|
||||
`order_types` can be set in the configuration file or in the strategy.
|
||||
`order_types` set in the configuration file overwrites values set in the strategy as a whole, so you need to configure the whole `order_types` dictionary in one place.
|
||||
|
||||
If this is configured, the following 4 values (`buy`, `sell`, `stoploss` and
|
||||
`stoploss_on_exchange`) need to be present, otherwise the bot will fail to start.
|
||||
|
||||
`emergencysell` is an optional value, which defaults to `market` and is used when creating stoploss on exchange orders fails.
|
||||
The below is the default which is used if this is not configured in either strategy or configuration file.
|
||||
|
||||
Since `stoploss_on_exchange` uses limit orders, the exchange needs 2 prices, the stoploss_price and the Limit price.
|
||||
`stoploss` defines the stop-price - and limit should be slightly below this. This defaults to 0.99 / 1%.
|
||||
Calculation example: we bought the asset at 100$.
|
||||
Stop-price is 95$, then limit would be `95 * 0.99 = 94.05$` - so the stoploss will happen between 95$ and 94.05$.
|
||||
|
||||
Syntax for Strategy:
|
||||
|
||||
```python
|
||||
order_types = {
|
||||
"buy": "limit",
|
||||
"sell": "limit",
|
||||
"emergencysell": "market",
|
||||
"stoploss": "market",
|
||||
"stoploss_on_exchange": False,
|
||||
"stoploss_on_exchange_interval": 60,
|
||||
"stoploss_on_exchange_limit_ratio": 0.99,
|
||||
}
|
||||
```
|
||||
|
||||
Configuration:
|
||||
|
||||
```json
|
||||
"order_types": {
|
||||
"buy": "limit",
|
||||
"sell": "limit",
|
||||
"emergencysell": "market",
|
||||
"stoploss": "market",
|
||||
"stoploss_on_exchange": False,
|
||||
"stoploss_on_exchange": false,
|
||||
"stoploss_on_exchange_interval": 60
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
!!! Note
|
||||
Not all exchanges support "market" orders.
|
||||
The following message will be shown if your exchange does not support market orders: `"Exchange <yourexchange> does not support market orders."`
|
||||
The following message will be shown if your exchange does not support market orders:
|
||||
`"Exchange <yourexchange> does not support market orders."`
|
||||
|
||||
!!! Note
|
||||
stoploss on exchange interval is not mandatory. Do not change it's value if you are unsure of what you are doing. For more information about how stoploss works please read [the stoploss documentation](stoploss.md).
|
||||
Stoploss on exchange interval is not mandatory. Do not change its value if you are
|
||||
unsure of what you are doing. For more information about how stoploss works please
|
||||
refer to [the stoploss documentation](stoploss.md).
|
||||
|
||||
!!! Note
|
||||
If `stoploss_on_exchange` is enabled and the stoploss is cancelled manually on the exchange, then the bot will create a new order.
|
||||
|
||||
!!! Warning "Warning: stoploss_on_exchange failures"
|
||||
If stoploss on exchange creation fails for some reason, then an "emergency sell" is initiated. By default, this will sell the asset using a market order. The order-type for the emergency-sell can be changed by setting the `emergencysell` value in the `order_types` dictionary - however this is not advised.
|
||||
|
||||
### Understand order_time_in_force
|
||||
`order_time_in_force` defines the policy by which the order is executed on the exchange. Three commonly used time in force are:<br/>
|
||||
**GTC (Goog Till Canceled):**
|
||||
This is most of the time the default time in force. It means the order will remain on exchange till it is canceled by user. It can be fully or partially fulfilled. If partially fulfilled, the remaining will stay on the exchange till cancelled.<br/>
|
||||
|
||||
The `order_time_in_force` configuration parameter defines the policy by which the order
|
||||
is executed on the exchange. Three commonly used time in force are:
|
||||
|
||||
**GTC (Good Till Canceled):**
|
||||
|
||||
This is most of the time the default time in force. It means the order will remain
|
||||
on exchange till it is canceled by user. It can be fully or partially fulfilled.
|
||||
If partially fulfilled, the remaining will stay on the exchange till cancelled.
|
||||
|
||||
**FOK (Full Or Kill):**
|
||||
It means if the order is not executed immediately AND fully then it is canceled by the exchange.<br/>
|
||||
|
||||
It means if the order is not executed immediately AND fully then it is canceled by the exchange.
|
||||
|
||||
**IOC (Immediate Or Canceled):**
|
||||
It is the same as FOK (above) except it can be partially fulfilled. The remaining part is automatically cancelled by the exchange.
|
||||
<br/>
|
||||
`order_time_in_force` contains a dict buy and sell time in force policy. This can be set in the configuration or in the strategy. Configuration overwrites strategy configurations.<br/>
|
||||
possible values are: `gtc` (default), `fok` or `ioc`.<br/>
|
||||
|
||||
It is the same as FOK (above) except it can be partially fulfilled. The remaining part
|
||||
is automatically cancelled by the exchange.
|
||||
|
||||
The `order_time_in_force` parameter contains a dict with buy and sell time in force policy values.
|
||||
This can be set in the configuration file or in the strategy.
|
||||
Values set in the configuration file overwrites values set in the strategy.
|
||||
|
||||
The possible values are: `gtc` (default), `fok` or `ioc`.
|
||||
|
||||
``` python
|
||||
"order_time_in_force": {
|
||||
"buy": "gtc",
|
||||
@@ -208,11 +359,12 @@ possible values are: `gtc` (default), `fok` or `ioc`.<br/>
|
||||
```
|
||||
|
||||
!!! Warning
|
||||
This is an ongoing work. For now it is supported only for binance and only for buy orders. Please don't change the default value unless you know what you are doing.
|
||||
This is an ongoing work. For now it is supported only for binance and only for buy orders.
|
||||
Please don't change the default value unless you know what you are doing.
|
||||
|
||||
### What values for exchange.name?
|
||||
### Exchange configuration
|
||||
|
||||
Freqtrade is based on [CCXT library](https://github.com/ccxt/ccxt) that supports 115 cryptocurrency
|
||||
Freqtrade is based on [CCXT library](https://github.com/ccxt/ccxt) that supports over 100 cryptocurrency
|
||||
exchange markets and trading APIs. The complete up-to-date list can be found in the
|
||||
[CCXT repo homepage](https://github.com/ccxt/ccxt/tree/master/python). However, the bot was tested
|
||||
with only Bittrex and Binance.
|
||||
@@ -224,35 +376,217 @@ The bot was tested with the following exchanges:
|
||||
|
||||
Feel free to test other exchanges and submit your PR to improve the bot.
|
||||
|
||||
### What values for fiat_display_currency?
|
||||
#### Sample exchange configuration
|
||||
|
||||
A exchange configuration for "binance" would look as follows:
|
||||
|
||||
```json
|
||||
"exchange": {
|
||||
"name": "binance",
|
||||
"key": "your_exchange_key",
|
||||
"secret": "your_exchange_secret",
|
||||
"ccxt_config": {"enableRateLimit": true},
|
||||
"ccxt_async_config": {
|
||||
"enableRateLimit": true,
|
||||
"rateLimit": 200
|
||||
},
|
||||
```
|
||||
|
||||
This configuration enables binance, as well as rate limiting to avoid bans from the exchange.
|
||||
`"rateLimit": 200` defines a wait-event of 0.2s between each call. This can also be completely disabled by setting `"enableRateLimit"` to false.
|
||||
|
||||
!!! Note
|
||||
Optimal settings for rate limiting depend on the exchange and the size of the whitelist, so an ideal parameter will vary on many other settings.
|
||||
We try to provide sensible defaults per exchange where possible, if you encounter bans please make sure that `"enableRateLimit"` is enabled and increase the `"rateLimit"` parameter step by step.
|
||||
|
||||
#### Advanced Freqtrade Exchange configuration
|
||||
|
||||
Advanced options can be configured using the `_ft_has_params` setting, which will override Defaults and exchange-specific behaviours.
|
||||
|
||||
Available options are listed in the exchange-class as `_ft_has_default`.
|
||||
|
||||
For example, to test the order type `FOK` with Kraken, and modify candle_limit to 200 (so you only get 200 candles per call):
|
||||
|
||||
```json
|
||||
"exchange": {
|
||||
"name": "kraken",
|
||||
"_ft_has_params": {
|
||||
"order_time_in_force": ["gtc", "fok"],
|
||||
"ohlcv_candle_limit": 200
|
||||
}
|
||||
```
|
||||
|
||||
!!! Warning
|
||||
Please make sure to fully understand the impacts of these settings before modifying them.
|
||||
|
||||
### What values can be used for fiat_display_currency?
|
||||
|
||||
The `fiat_display_currency` configuration parameter sets the base currency to use for the
|
||||
conversion from coin to fiat in the bot Telegram reports.
|
||||
|
||||
The valid values are:
|
||||
|
||||
`fiat_display_currency` set the base currency to use for the conversion from coin to fiat in Telegram.
|
||||
The valid values are:<br/>
|
||||
```json
|
||||
"AUD", "BRL", "CAD", "CHF", "CLP", "CNY", "CZK", "DKK", "EUR", "GBP", "HKD", "HUF", "IDR", "ILS", "INR", "JPY", "KRW", "MXN", "MYR", "NOK", "NZD", "PHP", "PKR", "PLN", "RUB", "SEK", "SGD", "THB", "TRY", "TWD", "ZAR", "USD"
|
||||
```
|
||||
In addition to FIAT currencies, a range of cryto currencies are supported.
|
||||
|
||||
In addition to fiat currencies, a range of cryto currencies are supported.
|
||||
|
||||
The valid values are:
|
||||
|
||||
```json
|
||||
"BTC", "ETH", "XRP", "LTC", "BCH", "USDT"
|
||||
```
|
||||
|
||||
## Switch to dry-run mode
|
||||
## Prices used for orders
|
||||
|
||||
We recommend starting the bot in dry-run mode to see how your bot will
|
||||
behave and how is the performance of your strategy. In Dry-run mode the
|
||||
Prices for regular orders can be controlled via the parameter structures `bid_strategy` for buying and `ask_strategy` for selling.
|
||||
Prices are always retrieved right before an order is placed, either by querying the exchange tickers or by using the orderbook data.
|
||||
|
||||
!!! Note
|
||||
Orderbook data used by Freqtrade are the data retrieved from exchange by the ccxt's function `fetch_order_book()`, i.e. are usually data from the L2-aggregated orderbook, while the ticker data are the structures returned by the ccxt's `fetch_ticker()`/`fetch_tickers()` functions. Refer to the ccxt library [documentation](https://github.com/ccxt/ccxt/wiki/Manual#market-data) for more details.
|
||||
|
||||
### Buy price
|
||||
|
||||
#### Check depth of market
|
||||
|
||||
When check depth of market is enabled (`bid_strategy.check_depth_of_market.enabled=True`), the buy signals are filtered based on the orderbook depth (sum of all amounts) for each orderbook side.
|
||||
|
||||
Orderbook `bid` (buy) side depth is then divided by the orderbook `ask` (sell) side depth and the resulting delta is compared to the value of the `bid_strategy.check_depth_of_market.bids_to_ask_delta` parameter. The buy order is only executed if the orderbook delta is greater than or equal to the configured delta value.
|
||||
|
||||
!!! Note
|
||||
A delta value below 1 means that `ask` (sell) orderbook side depth is greater than the depth of the `bid` (buy) orderbook side, while a value greater than 1 means opposite (depth of the buy side is higher than the depth of the sell side).
|
||||
|
||||
#### Buy price with Orderbook enabled
|
||||
|
||||
When buying with the orderbook enabled (`bid_strategy.use_order_book=True`), Freqtrade fetches the `bid_strategy.order_book_top` entries from the orderbook and then uses the entry specified as `bid_strategy.order_book_top` on the `bid` (buy) side of the orderbook. 1 specifies the topmost entry in the orderbook, while 2 would use the 2nd entry in the orderbook, and so on.
|
||||
|
||||
#### Buy price without Orderbook enabled
|
||||
|
||||
When not using orderbook (`bid_strategy.use_order_book=False`), Freqtrade uses the best `ask` (sell) price from the ticker if it's below the `last` traded price from the ticker. Otherwise (when the `ask` price is not below the `last` price), it calculates a rate between `ask` and `last` price.
|
||||
|
||||
The `bid_strategy.ask_last_balance` configuration parameter controls this. A value of `0.0` will use `ask` price, while `1.0` will use the `last` price and values between those interpolate between ask and last price.
|
||||
|
||||
Using `ask` price often guarantees quicker success in the bid, but the bot can also end up paying more than what would have been necessary.
|
||||
|
||||
### Sell price
|
||||
|
||||
#### Sell price with Orderbook enabled
|
||||
|
||||
When selling with the orderbook enabled (`ask_strategy.use_order_book=True`), Freqtrade fetches the `ask_strategy.order_book_max` entries in the orderbook. Then each of the orderbook steps between `ask_strategy.order_book_min` and `ask_strategy.order_book_max` on the `ask` orderbook side are validated for a profitable sell-possibility based on the strategy configuration and the sell order is placed at the first profitable spot.
|
||||
|
||||
The idea here is to place the sell order early, to be ahead in the queue.
|
||||
|
||||
A fixed slot (mirroring `bid_strategy.order_book_top`) can be defined by setting `ask_strategy.order_book_min` and `ask_strategy.order_book_max` to the same number.
|
||||
|
||||
!!! Warning "Orderbook and stoploss_on_exchange"
|
||||
Using `ask_strategy.order_book_max` higher than 1 may increase the risk, since an eventual [stoploss on exchange](#understand-order_types) will be needed to be cancelled as soon as the order is placed.
|
||||
|
||||
#### Sell price without Orderbook enabled
|
||||
|
||||
When not using orderbook (`ask_strategy.use_order_book=False`), the `bid` price from the ticker will be used as the sell price.
|
||||
|
||||
## Pairlists
|
||||
|
||||
Pairlists define the list of pairs that the bot should trade.
|
||||
There are [`StaticPairList`](#static-pair-list) and dynamic Whitelists available.
|
||||
|
||||
[`PrecisionFilter`](#precision-filter) and [`PriceFilter`](#price-pair-filter) act as filters, removing low-value pairs.
|
||||
|
||||
All pairlists can be chained, and a combination of all pairlists will become your new whitelist. Pairlists are executed in the sequence they are configured. You should always configure either `StaticPairList` or `DynamicPairList` as starting pairlists.
|
||||
|
||||
Inactive markets and blacklisted pairs are always removed from the resulting `pair_whitelist`.
|
||||
|
||||
### Available Pairlists
|
||||
|
||||
* [`StaticPairList`](#static-pair-list) (default, if not configured differently)
|
||||
* [`VolumePairList`](#volume-pair-list)
|
||||
* [`PrecisionFilter`](#precision-filter)
|
||||
* [`PriceFilter`](#price-pair-filter)
|
||||
|
||||
!!! Tip "Testing pairlists"
|
||||
Pairlist configurations can be quite tricky to get right. Best use the [`test-pairlist`](utils.md#test-pairlist) subcommand to test your configuration quickly.
|
||||
|
||||
#### Static Pair List
|
||||
|
||||
By default, the `StaticPairList` method is used, which uses a statically defined pair whitelist from the configuration.
|
||||
|
||||
It uses configuration from `exchange.pair_whitelist` and `exchange.pair_blacklist`.
|
||||
|
||||
```json
|
||||
"pairlists": [
|
||||
{"method": "StaticPairList"}
|
||||
],
|
||||
```
|
||||
|
||||
#### Volume Pair List
|
||||
|
||||
`VolumePairList` selects `number_assets` top pairs based on `sort_key`, which can be one of `askVolume`, `bidVolume` and `quoteVolume` and defaults to `quoteVolume`.
|
||||
|
||||
`VolumePairList` considers outputs of previous pairlists unless it's the first configured pairlist, it does not consider `pair_whitelist`, but selects the top assets from all available markets (with matching stake-currency) on the exchange.
|
||||
|
||||
`refresh_period` allows setting the period (in seconds), at which the pairlist will be refreshed. Defaults to 1800s (30 minutes).
|
||||
|
||||
```json
|
||||
"pairlists": [{
|
||||
"method": "VolumePairList",
|
||||
"number_assets": 20,
|
||||
"sort_key": "quoteVolume",
|
||||
"refresh_period": 1800,
|
||||
],
|
||||
```
|
||||
|
||||
#### Precision Filter
|
||||
|
||||
Filters low-value coins which would not allow setting a stoploss.
|
||||
|
||||
#### Price Pair Filter
|
||||
|
||||
The `PriceFilter` allows filtering of pairs by price.
|
||||
Currently, only `low_price_ratio` is implemented, where a raise of 1 price unit (pip) is below the `low_price_ratio` ratio.
|
||||
This option is disabled by default, and will only apply if set to <> 0.
|
||||
|
||||
Calculation example:
|
||||
Min price precision is 8 decimals. If price is 0.00000011 - one step would be 0.00000012 - which is almost 10% higher than the previous value.
|
||||
|
||||
These pairs are dangerous since it may be impossible to place the desired stoploss - and often result in high losses.
|
||||
|
||||
### Full Pairlist example
|
||||
|
||||
The below example blacklists `BNB/BTC`, uses `VolumePairList` with `20` assets, sorting by `quoteVolume` and applies both [`PrecisionFilter`](#precision-filter) and [`PriceFilter`](#price-pair-filter), filtering all assets where 1 priceunit is > 1%.
|
||||
|
||||
```json
|
||||
"exchange": {
|
||||
"pair_whitelist": [],
|
||||
"pair_blacklist": ["BNB/BTC"]
|
||||
},
|
||||
"pairlists": [
|
||||
{
|
||||
"method": "VolumePairList",
|
||||
"number_assets": 20,
|
||||
"sort_key": "quoteVolume",
|
||||
},
|
||||
{"method": "PrecisionFilter"},
|
||||
{"method": "PriceFilter", "low_price_ratio": 0.01}
|
||||
],
|
||||
```
|
||||
|
||||
## Switch to Dry-run mode
|
||||
|
||||
We recommend starting the bot in the Dry-run mode to see how your bot will
|
||||
behave and what is the performance of your strategy. In the Dry-run mode the
|
||||
bot does not engage your money. It only runs a live simulation without
|
||||
creating trades.
|
||||
creating trades on the exchange.
|
||||
|
||||
1. Edit your `config.json` file
|
||||
2. Switch dry-run to true and specify db_url for a persistent db
|
||||
1. Edit your `config.json` configuration file.
|
||||
2. Switch `dry-run` to `true` and specify `db_url` for a persistence database.
|
||||
|
||||
```json
|
||||
"dry_run": true,
|
||||
"db_url": "sqlite:///tradesv3.dryrun.sqlite",
|
||||
```
|
||||
|
||||
3. Remove your Exchange API key (change them by fake api credentials)
|
||||
3. Remove your Exchange API key and secret (change them by empty values or fake credentials):
|
||||
|
||||
```json
|
||||
"exchange": {
|
||||
@@ -263,37 +597,14 @@ creating trades.
|
||||
}
|
||||
```
|
||||
|
||||
Once you will be happy with your bot performance, you can switch it to
|
||||
production mode.
|
||||
Once you will be happy with your bot performance running in the Dry-run mode, you can switch it to production mode.
|
||||
|
||||
### Dynamic Pairlists
|
||||
|
||||
Dynamic pairlists select pairs for you based on the logic configured.
|
||||
The bot runs against all pairs (with that stake) on the exchange, and a number of assets (`number_assets`) is selected based on the selected criteria.
|
||||
|
||||
By default, a Static Pairlist is used (configured as `"pair_whitelist"` under the `"exchange"` section of this configuration).
|
||||
|
||||
**Available Pairlist methods:**
|
||||
|
||||
* `"StaticPairList"`
|
||||
* uses configuration from `exchange.pair_whitelist` and `exchange.pair_blacklist`
|
||||
* `"VolumePairList"`
|
||||
* Formerly available as `--dynamic-whitelist [<number_assets>]`
|
||||
* Selects `number_assets` top pairs based on `sort_key`, which can be one of `askVolume`, `bidVolume` and `quoteVolume`, defaults to `quoteVolume`.
|
||||
|
||||
```json
|
||||
"pairlist": {
|
||||
"method": "VolumePairList",
|
||||
"config": {
|
||||
"number_assets": 20,
|
||||
"sort_key": "quoteVolume"
|
||||
}
|
||||
},
|
||||
```
|
||||
!!! Note
|
||||
A simulated wallet is available during dry-run mode, and will assume a starting capital of `dry_run_wallet` (defaults to 1000).
|
||||
|
||||
## Switch to production mode
|
||||
|
||||
In production mode, the bot will engage your money. Be careful a wrong
|
||||
In production mode, the bot will engage your money. Be careful, since a wrong
|
||||
strategy can lose all your money. Be aware of what you are doing when
|
||||
you run it in production mode.
|
||||
|
||||
@@ -316,12 +627,14 @@ you run it in production mode.
|
||||
"secret": "08a9dc6db3d7b53e1acebd9275677f4b0a04f1a5",
|
||||
...
|
||||
}
|
||||
|
||||
```
|
||||
!!! Note
|
||||
If you have an exchange API key yet, [see our tutorial](/pre-requisite).
|
||||
|
||||
### Using proxy with FreqTrade
|
||||
!!! Note
|
||||
If you have an exchange API key yet, [see our tutorial](installation.md#setup-your-exchange-account).
|
||||
|
||||
You should also make sure to read the [Exchanges](exchanges.md) section of the documentation to be aware of potential configuration details specific to your exchange.
|
||||
|
||||
### Using proxy with Freqtrade
|
||||
|
||||
To use a proxy with freqtrade, add the kwarg `"aiohttp_trust_env"=true` to the `"ccxt_async_kwargs"` dict in the exchange section of the configuration.
|
||||
|
||||
@@ -341,14 +654,13 @@ export HTTPS_PROXY="http://addr:port"
|
||||
freqtrade
|
||||
```
|
||||
|
||||
|
||||
### Embedding Strategies
|
||||
## Embedding Strategies
|
||||
|
||||
FreqTrade provides you with with an easy way to embed the strategy into your configuration file.
|
||||
This is done by utilizing BASE64 encoding and providing this string at the strategy configuration field,
|
||||
in your chosen config file.
|
||||
|
||||
#### Encoding a string as BASE64
|
||||
### Encoding a string as BASE64
|
||||
|
||||
This is a quick example, how to generate the BASE64 string in python
|
||||
|
||||
|
||||
115
docs/data-analysis.md
Normal file
115
docs/data-analysis.md
Normal file
@@ -0,0 +1,115 @@
|
||||
# Analyzing bot data with Jupyter notebooks
|
||||
|
||||
You can analyze the results of backtests and trading history easily using Jupyter notebooks. Sample notebooks are located at `user_data/notebooks/`.
|
||||
|
||||
## Pro tips
|
||||
|
||||
* See [jupyter.org](https://jupyter.org/documentation) for usage instructions.
|
||||
* Don't forget to start a Jupyter notebook server from within your conda or venv environment or use [nb_conda_kernels](https://github.com/Anaconda-Platform/nb_conda_kernels)*
|
||||
* Copy the example notebook before use so your changes don't get clobbered with the next freqtrade update.
|
||||
|
||||
### Using virtual environment with system-wide Jupyter installation
|
||||
|
||||
Sometimes it can be desired to use a system-wide installation of Jupyter notebook, and use a jupyter kernel from the virtual environment.
|
||||
This prevents you from installing the full jupyter suite multiple times per system, and provides an easy way to switch between tasks (freqtrade / other analytics tasks).
|
||||
|
||||
For this to work, first activate your virtual environment and run the following commands:
|
||||
|
||||
``` bash
|
||||
# Activate virtual environment
|
||||
source .env/bin/activate
|
||||
|
||||
pip install ipykernel
|
||||
ipython kernel install --user --name=freqtrade
|
||||
# Restart jupyter (lab / notebook)
|
||||
# select kernel "freqtrade" in the notebook
|
||||
```
|
||||
|
||||
!!! Note
|
||||
This section is provided for completeness, the Freqtrade Team won't provide full support for problems with this setup and will recommend to install Jupyter in the virtual environment directly, as that is the easiest way to get jupyter notebooks up and running. For help with this setup please refer to the [Project Jupyter](https://jupyter.org/) [documentation](https://jupyter.org/documentation) or [help channels](https://jupyter.org/community).
|
||||
|
||||
|
||||
## Fine print
|
||||
|
||||
Some tasks don't work especially well in notebooks. For example, anything using asynchronous execution is a problem for Jupyter. Also, freqtrade's primary entry point is the shell cli, so using pure python in a notebook bypasses arguments that provide required objects and parameters to helper functions. You may need to set those values or create expected objects manually.
|
||||
|
||||
## Recommended workflow
|
||||
|
||||
| Task | Tool |
|
||||
--- | ---
|
||||
Bot operations | CLI
|
||||
Repetitive tasks | Shell scripts
|
||||
Data analysis & visualization | Notebook
|
||||
|
||||
1. Use the CLI to
|
||||
* download historical data
|
||||
* run a backtest
|
||||
* run with real-time data
|
||||
* export results
|
||||
|
||||
1. Collect these actions in shell scripts
|
||||
* save complicated commands with arguments
|
||||
* execute multi-step operations
|
||||
* automate testing strategies and preparing data for analysis
|
||||
|
||||
1. Use a notebook to
|
||||
* visualize data
|
||||
* munge and plot to generate insights
|
||||
|
||||
## Example utility snippets
|
||||
|
||||
### Change directory to root
|
||||
|
||||
Jupyter notebooks execute from the notebook directory. The following snippet searches for the project root, so relative paths remain consistent.
|
||||
|
||||
```python
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
# Change directory
|
||||
# Modify this cell to insure that the output shows the correct path.
|
||||
# Define all paths relative to the project root shown in the cell output
|
||||
project_root = "somedir/freqtrade"
|
||||
i=0
|
||||
try:
|
||||
os.chdirdir(project_root)
|
||||
assert Path('LICENSE').is_file()
|
||||
except:
|
||||
while i<4 and (not Path('LICENSE').is_file()):
|
||||
os.chdir(Path(Path.cwd(), '../'))
|
||||
i+=1
|
||||
project_root = Path.cwd()
|
||||
print(Path.cwd())
|
||||
```
|
||||
|
||||
### Load multiple configuration files
|
||||
|
||||
This option can be useful to inspect the results of passing in multiple configs.
|
||||
This will also run through the whole Configuration initialization, so the configuration is completely initialized to be passed to other methods.
|
||||
|
||||
``` python
|
||||
import json
|
||||
from freqtrade.configuration import Configuration
|
||||
|
||||
# Load config from multiple files
|
||||
config = Configuration.from_files(["config1.json", "config2.json"])
|
||||
|
||||
# Show the config in memory
|
||||
print(json.dumps(config['original_config'], indent=2))
|
||||
```
|
||||
|
||||
For Interactive environments, have an additional configuration specifying `user_data_dir` and pass this in last, so you don't have to change directories while running the bot.
|
||||
Best avoid relative paths, since this starts at the storage location of the jupyter notebook, unless the directory is changed.
|
||||
|
||||
``` json
|
||||
{
|
||||
"user_data_dir": "~/.freqtrade/"
|
||||
}
|
||||
```
|
||||
|
||||
### Further Data analysis documentation
|
||||
|
||||
* [Strategy debugging](strategy_analysis_example.md) - also available as Jupyter notebook (`user_data/notebooks/strategy_analysis_example.ipynb`)
|
||||
* [Plotting](plotting.md)
|
||||
|
||||
Feel free to submit an issue or Pull Request enhancing this document if you would like to share ideas on how to best analyze the data.
|
||||
86
docs/data-download.md
Normal file
86
docs/data-download.md
Normal file
@@ -0,0 +1,86 @@
|
||||
# Data Downloading
|
||||
|
||||
## Getting data for backtesting and hyperopt
|
||||
|
||||
To download data (candles / OHLCV) needed for backtesting and hyperoptimization use the `freqtrade download-data` command.
|
||||
|
||||
If no additional parameter is specified, freqtrade will download data for `"1m"` and `"5m"` timeframes for the last 30 days.
|
||||
Exchange and pairs will come from `config.json` (if specified using `-c/--config`).
|
||||
Otherwise `--exchange` becomes mandatory.
|
||||
|
||||
!!! Tip "Tip: Updating existing data"
|
||||
If you already have backtesting data available in your data-directory and would like to refresh this data up to today, use `--days xx` with a number slightly higher than the missing number of days. Freqtrade will keep the available data and only download the missing data.
|
||||
Be carefull though: If the number is too small (which would result in a few missing days), the whole dataset will be removed and only xx days will be downloaded.
|
||||
|
||||
### Pairs file
|
||||
|
||||
In alternative to the whitelist from `config.json`, a `pairs.json` file can be used.
|
||||
|
||||
If you are using Binance for example:
|
||||
|
||||
- create a directory `user_data/data/binance` and copy or create the `pairs.json` file in that directory.
|
||||
- update the `pairs.json` file to contain the currency pairs you are interested in.
|
||||
|
||||
```bash
|
||||
mkdir -p user_data/data/binance
|
||||
cp freqtrade/tests/testdata/pairs.json user_data/data/binance
|
||||
```
|
||||
|
||||
The format of the `pairs.json` file is a simple json list.
|
||||
Mixing different stake-currencies is allowed for this file, since it's only used for downloading.
|
||||
|
||||
``` json
|
||||
[
|
||||
"ETH/BTC",
|
||||
"ETH/USDT",
|
||||
"BTC/USDT",
|
||||
"XRP/ETH"
|
||||
]
|
||||
```
|
||||
|
||||
### Start download
|
||||
|
||||
Then run:
|
||||
|
||||
```bash
|
||||
freqtrade download-data --exchange binance
|
||||
```
|
||||
|
||||
This will download ticker data for all the currency pairs you defined in `pairs.json`.
|
||||
|
||||
### Other Notes
|
||||
|
||||
- To use a different directory than the exchange specific default, use `--datadir user_data/data/some_directory`.
|
||||
- To change the exchange used to download the tickers, please use a different configuration file (you'll probably need to adjust ratelimits etc.)
|
||||
- To use `pairs.json` from some other directory, use `--pairs-file some_other_dir/pairs.json`.
|
||||
- To download ticker data for only 10 days, use `--days 10` (defaults to 30 days).
|
||||
- Use `--timeframes` to specify which tickers to download. Default is `--timeframes 1m 5m` which will download 1-minute and 5-minute tickers.
|
||||
- To use exchange, timeframe and list of pairs as defined in your configuration file, use the `-c/--config` option. With this, the script uses the whitelist defined in the config as the list of currency pairs to download data for and does not require the pairs.json file. You can combine `-c/--config` with most other options.
|
||||
|
||||
### Trades (tick) data
|
||||
|
||||
By default, `download-data` subcommand downloads Candles (OHLCV) data. Some exchanges also provide historic trade-data via their API.
|
||||
This data can be useful if you need many different timeframes, since it is only downloaded once, and then resampled locally to the desired timeframes.
|
||||
|
||||
Since this data is large by default, the files use gzip by default. They are stored in your data-directory with the naming convention of `<pair>-trades.json.gz` (`ETH_BTC-trades.json.gz`). Incremental mode is also supported, as for historic OHLCV data, so downloading the data once per week with `--days 8` will create an incremental data-repository.
|
||||
|
||||
To use this mode, simply add `--dl-trades` to your call. This will swap the download method to download trades, and resamples the data locally.
|
||||
|
||||
Example call:
|
||||
|
||||
```bash
|
||||
freqtrade download-data --exchange binance --pairs XRP/ETH ETH/BTC --days 20 --dl-trades
|
||||
```
|
||||
|
||||
!!! Note
|
||||
While this method uses async calls, it will be slow, since it requires the result of the previous call to generate the next request to the exchange.
|
||||
|
||||
!!! Warning
|
||||
The historic trades are not available during Freqtrade dry-run and live trade modes because all exchanges tested provide this data with a delay of few 100 candles, so it's not suitable for real-time trading.
|
||||
|
||||
!!! Note "Kraken user"
|
||||
Kraken users should read [this](exchanges.md#historic-kraken-data) before starting to download data.
|
||||
|
||||
## Next step
|
||||
|
||||
Great, you now have backtest data downloaded, so you can now start [backtesting](backtesting.md) your strategy.
|
||||
26
docs/deprecated.md
Normal file
26
docs/deprecated.md
Normal file
@@ -0,0 +1,26 @@
|
||||
# Deprecated features
|
||||
|
||||
This page contains description of the command line arguments, configuration parameters
|
||||
and the bot features that were declared as DEPRECATED by the bot development team
|
||||
and are no longer supported. Please avoid their usage in your configuration.
|
||||
|
||||
## Removed features
|
||||
|
||||
### the `--refresh-pairs-cached` command line option
|
||||
|
||||
`--refresh-pairs-cached` in the context of backtesting, hyperopt and edge allows to refresh candle data for backtesting.
|
||||
Since this leads to much confusion, and slows down backtesting (while not being part of backtesting) this has been singled out
|
||||
as a seperate freqtrade subcommand `freqtrade download-data`.
|
||||
|
||||
This command line option was deprecated in 2019.7-dev (develop branch) and removed in 2019.9 (master branch).
|
||||
|
||||
### The **--dynamic-whitelist** command line option
|
||||
|
||||
This command line option was deprecated in 2018 and removed freqtrade 2019.6-dev (develop branch)
|
||||
and in freqtrade 2019.7 (master branch).
|
||||
|
||||
### the `--live` command line option
|
||||
|
||||
`--live` in the context of backtesting allowed to download the latest tick data for backtesting.
|
||||
Did only download the latest 500 candles, so was ineffective in getting good backtest data.
|
||||
Removed in 2019-7-dev (develop branch) and in freqtrade 2019-8 (master branch)
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
This page is intended for developers of FreqTrade, people who want to contribute to the FreqTrade codebase or documentation, or people who want to understand the source code of the application they're running.
|
||||
|
||||
All contributions, bug reports, bug fixes, documentation improvements, enhancements and ideas are welcome. We [track issues](https://github.com/freqtrade/freqtrade/issues) on [GitHub](https://github.com) and also have a dev channel in [slack](https://join.slack.com/t/highfrequencybot/shared_invite/enQtMjQ5NTM0OTYzMzY3LWMxYzE3M2MxNDdjMGM3ZTYwNzFjMGIwZGRjNTc3ZGU3MGE3NzdmZGMwNmU3NDM5ZTNmM2Y3NjRiNzk4NmM4OGE) where you can ask questions.
|
||||
All contributions, bug reports, bug fixes, documentation improvements, enhancements and ideas are welcome. We [track issues](https://github.com/freqtrade/freqtrade/issues) on [GitHub](https://github.com) and also have a dev channel in [slack](https://join.slack.com/t/highfrequencybot/shared_invite/enQtNjU5ODcwNjI1MDU3LTU1MTgxMjkzNmYxNWE1MDEzYzQ3YmU4N2MwZjUyNjJjODRkMDVkNjg4YTAyZGYzYzlhOTZiMTE4ZjQ4YzM0OGE) where you can ask questions.
|
||||
|
||||
## Documentation
|
||||
|
||||
@@ -12,11 +12,79 @@ Special fields for the documentation (like Note boxes, ...) can be found [here](
|
||||
|
||||
## Developer setup
|
||||
|
||||
To configure a development environment, use best use the `setup.sh` script and answer "y" when asked "Do you want to install dependencies for dev [y/N]? ".
|
||||
Alternatively (if your system is not supported by the setup.sh script), follow the manual installation process and run `pip3 install -r requirements-dev.txt`.
|
||||
To configure a development environment, best use the `setup.sh` script and answer "y" when asked "Do you want to install dependencies for dev [y/N]? ".
|
||||
Alternatively (if your system is not supported by the setup.sh script), follow the manual installation process and run `pip3 install -e .[all]`.
|
||||
|
||||
This will install all required tools for development, including `pytest`, `flake8`, `mypy`, and `coveralls`.
|
||||
|
||||
### Tests
|
||||
|
||||
New code should be covered by basic unittests. Depending on the complexity of the feature, Reviewers may request more in-depth unittests.
|
||||
If necessary, the Freqtrade team can assist and give guidance with writing good tests (however please don't expect anyone to write the tests for you).
|
||||
|
||||
#### Checking log content in tests
|
||||
|
||||
Freqtrade uses 2 main methods to check log content in tests, `log_has()` and `log_has_re()` (to check using regex, in case of dynamic log-messages).
|
||||
These are available from `conftest.py` and can be imported in any test module.
|
||||
|
||||
A sample check looks as follows:
|
||||
|
||||
``` python
|
||||
from tests.conftest import log_has, log_has_re
|
||||
|
||||
def test_method_to_test(caplog):
|
||||
method_to_test()
|
||||
|
||||
assert log_has("This event happened", caplog)
|
||||
# Check regex with trailing number ...
|
||||
assert log_has_re(r"This dynamic event happened and produced \d+", caplog)
|
||||
|
||||
```
|
||||
|
||||
### Local docker usage
|
||||
|
||||
The fastest and easiest way to start up is to use docker-compose.develop which gives developers the ability to start the bot up with all the required dependencies, *without* needing to install any freqtrade specific dependencies on your local machine.
|
||||
|
||||
#### Install
|
||||
|
||||
* [git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)
|
||||
* [docker](https://docs.docker.com/install/)
|
||||
* [docker-compose](https://docs.docker.com/compose/install/)
|
||||
|
||||
#### Starting the bot
|
||||
##### Use the develop dockerfile
|
||||
|
||||
``` bash
|
||||
rm docker-compose.yml && mv docker-compose.develop.yml docker-compose.yml
|
||||
```
|
||||
|
||||
#### Docker Compose
|
||||
|
||||
##### Starting
|
||||
|
||||
``` bash
|
||||
docker-compose up
|
||||
```
|
||||
|
||||

|
||||
|
||||
##### Rebuilding
|
||||
|
||||
``` bash
|
||||
docker-compose build
|
||||
```
|
||||
|
||||
##### Execing (effectively SSH into the container)
|
||||
|
||||
The `exec` command requires that the container already be running, if you want to start it
|
||||
that can be effected by `docker-compose up` or `docker-compose run freqtrade_develop`
|
||||
|
||||
``` bash
|
||||
docker-compose exec freqtrade_develop /bin/bash
|
||||
```
|
||||
|
||||

|
||||
|
||||
## Modules
|
||||
|
||||
### Dynamic Pairlist
|
||||
@@ -32,22 +100,22 @@ This is a simple provider, which however serves as a good example on how to star
|
||||
|
||||
Next, modify the classname of the provider (ideally align this with the Filename).
|
||||
|
||||
The base-class provides the an instance of the bot (`self._freqtrade`), as well as the configuration (`self._config`), and initiates both `_blacklist` and `_whitelist`.
|
||||
The base-class provides an instance of the exchange (`self._exchange`) the pairlist manager (`self._pairlistmanager`), as well as the main configuration (`self._config`), the pairlist dedicated configuration (`self._pairlistconfig`) and the absolute position within the list of pairlists.
|
||||
|
||||
```python
|
||||
self._freqtrade = freqtrade
|
||||
self._exchange = exchange
|
||||
self._pairlistmanager = pairlistmanager
|
||||
self._config = config
|
||||
self._whitelist = self._config['exchange']['pair_whitelist']
|
||||
self._blacklist = self._config['exchange'].get('pair_blacklist', [])
|
||||
self._pairlistconfig = pairlistconfig
|
||||
self._pairlist_pos = pairlist_pos
|
||||
```
|
||||
|
||||
|
||||
Now, let's step through the methods which require actions:
|
||||
|
||||
#### configuration
|
||||
#### Pairlist configuration
|
||||
|
||||
Configuration for PairListProvider is done in the bot configuration file in the element `"pairlist"`.
|
||||
This Pairlist-object may contain a `"config"` dict with additional configurations for the configured pairlist.
|
||||
This Pairlist-object may contain configurations with additional configurations for the configured pairlist.
|
||||
By convention, `"number_assets"` is used to specify the maximum number of pairs to keep in the whitelist. Please follow this to ensure a consistent user experience.
|
||||
|
||||
Additional elements can be configured as needed. `VolumePairList` uses `"sort_key"` to specify the sorting value - however feel free to specify whatever is necessary for your great algorithm to be successfull and dynamic.
|
||||
@@ -57,61 +125,170 @@ Additional elements can be configured as needed. `VolumePairList` uses `"sort_ke
|
||||
Returns a description used for Telegram messages.
|
||||
This should contain the name of the Provider, as well as a short description containing the number of assets. Please follow the format `"PairlistName - top/bottom X pairs"`.
|
||||
|
||||
#### refresh_pairlist
|
||||
#### filter_pairlist
|
||||
|
||||
Override this method and run all calculations needed in this method.
|
||||
This is called with each iteration of the bot - so consider implementing caching for compute/network heavy calculations.
|
||||
|
||||
Assign the resulting whiteslist to `self._whitelist` and `self._blacklist` respectively. These will then be used to run the bot in this iteration. Pairs with open trades will be added to the whitelist to have the sell-methods run correctly.
|
||||
It get's passed a pairlist (which can be the result of previous pairlists) as well as `tickers`, a pre-fetched version of `get_tickers()`.
|
||||
|
||||
Please also run `self._validate_whitelist(pairs)` and to check and remove pairs with inactive markets. This function is available in the Parent class (`StaticPairList`) and should ideally not be overwritten.
|
||||
It must return the resulting pairlist (which may then be passed into the next pairlist filter).
|
||||
|
||||
Validations are optional, the parent class exposes a `_verify_blacklist(pairlist)` and `_whitelist_for_active_markets(pairlist)` to do default filters. Use this if you limit your result to a certain number of pairs - so the endresult is not shorter than expected.
|
||||
|
||||
##### sample
|
||||
|
||||
``` python
|
||||
def refresh_pairlist(self) -> None:
|
||||
def filter_pairlist(self, pairlist: List[str], tickers: Dict) -> List[str]:
|
||||
# Generate dynamic whitelist
|
||||
pairs = self._gen_pair_whitelist(self._config['stake_currency'], self._sort_key)
|
||||
# Validate whitelist to only have active market pairs
|
||||
self._whitelist = self._validate_whitelist(pairs)[:self._number_pairs]
|
||||
pairs = self._calculate_pairlist(pairlist, tickers)
|
||||
return pairs
|
||||
```
|
||||
|
||||
#### _gen_pair_whitelist
|
||||
|
||||
This is a simple method used by `VolumePairList` - however serves as a good example.
|
||||
It implements caching (`@cached(TTLCache(maxsize=1, ttl=1800))`) as well as a configuration option to allow different (but similar) strategies to work with the same PairListProvider.
|
||||
In VolumePairList, this implements different methods of sorting, does early validation so only the expected number of pairs is returned.
|
||||
|
||||
## Implement a new Exchange (WIP)
|
||||
|
||||
!!! Note
|
||||
This section is a Work in Progress and is not a complete guide on how to test a new exchange with FreqTrade.
|
||||
|
||||
Most exchanges supported by CCXT should work out of the box.
|
||||
|
||||
### Stoploss On Exchange
|
||||
|
||||
Check if the new exchange supports Stoploss on Exchange orders through their API.
|
||||
|
||||
Since CCXT does not provide unification for Stoploss On Exchange yet, we'll need to implement the exchange-specific parameters ourselfs. Best look at `binance.py` for an example implementation of this. You'll need to dig through the documentation of the Exchange's API on how exactly this can be done. [CCXT Issues](https://github.com/ccxt/ccxt/issues) may also provide great help, since others may have implemented something similar for their projects.
|
||||
|
||||
### Incomplete candles
|
||||
|
||||
While fetching OHLCV data, we're may end up getting incomplete candles (Depending on the exchange).
|
||||
To demonstrate this, we'll use daily candles (`"1d"`) to keep things simple.
|
||||
We query the api (`ct.fetch_ohlcv()`) for the timeframe and look at the date of the last entry. If this entry changes or shows the date of a "incomplete" candle, then we should drop this since having incomplete candles is problematic because indicators assume that only complete candles are passed to them, and will generate a lot of false buy signals. By default, we're therefore removing the last candle assuming it's incomplete.
|
||||
|
||||
To check how the new exchange behaves, you can use the following snippet:
|
||||
|
||||
``` python
|
||||
import ccxt
|
||||
from datetime import datetime
|
||||
from freqtrade.data.converter import parse_ticker_dataframe
|
||||
ct = ccxt.binance()
|
||||
timeframe = "1d"
|
||||
pair = "XLM/BTC" # Make sure to use a pair that exists on that exchange!
|
||||
raw = ct.fetch_ohlcv(pair, timeframe=timeframe)
|
||||
|
||||
# convert to dataframe
|
||||
df1 = parse_ticker_dataframe(raw, timeframe, pair=pair, drop_incomplete=False)
|
||||
|
||||
print(df1.tail(1))
|
||||
print(datetime.utcnow())
|
||||
```
|
||||
|
||||
``` output
|
||||
date open high low close volume
|
||||
499 2019-06-08 00:00:00+00:00 0.000007 0.000007 0.000007 0.000007 26264344.0
|
||||
2019-06-09 12:30:27.873327
|
||||
```
|
||||
|
||||
The output will show the last entry from the Exchange as well as the current UTC date.
|
||||
If the day shows the same day, then the last candle can be assumed as incomplete and should be dropped (leave the setting `"ohlcv_partial_candle"` from the exchange-class untouched / True). Otherwise, set `"ohlcv_partial_candle"` to `False` to not drop Candles (shown in the example above).
|
||||
Another way is to run this command multiple times in a row and observe if the volume is changing (while the date remains the same).
|
||||
|
||||
## Updating example notebooks
|
||||
|
||||
To keep the jupyter notebooks aligned with the documentation, the following should be ran after updating a example notebook.
|
||||
|
||||
``` bash
|
||||
jupyter nbconvert --ClearOutputPreprocessor.enabled=True --inplace freqtrade/templates/strategy_analysis_example.ipynb
|
||||
jupyter nbconvert --ClearOutputPreprocessor.enabled=True --to markdown freqtrade/templates/strategy_analysis_example.ipynb --stdout > docs/strategy_analysis_example.md
|
||||
```
|
||||
|
||||
## Continuous integration
|
||||
|
||||
This documents some decisions taken for the CI Pipeline.
|
||||
|
||||
* CI runs on all OS variants, Linux (ubuntu), macOS and Windows.
|
||||
* Docker images are build for the branches `master` and `develop`.
|
||||
* Raspberry PI Docker images are postfixed with `_pi` - so tags will be `:master_pi` and `develop_pi`.
|
||||
* Docker images contain a file, `/freqtrade/freqtrade_commit` containing the commit this image is based of.
|
||||
* Full docker image rebuilds are run once a week via schedule.
|
||||
* Deployments run on ubuntu.
|
||||
* ta-lib binaries are contained in the build_helpers directory to avoid fails related to external unavailability.
|
||||
* All tests must pass for a PR to be merged to `master` or `develop`.
|
||||
|
||||
## Creating a release
|
||||
|
||||
This part of the documentation is aimed at maintainers, and shows how to create a release.
|
||||
|
||||
### create release branch
|
||||
### Create release branch
|
||||
|
||||
First, pick a commit that's about one week old (to not include latest additions to releases).
|
||||
|
||||
``` bash
|
||||
# make sure you're in develop branch
|
||||
git checkout develop
|
||||
|
||||
# create new branch
|
||||
git checkout -b new_release
|
||||
git checkout -b new_release <commitid>
|
||||
```
|
||||
|
||||
* edit `freqtrade/__init__.py` and add the desired version (for example `0.18.0`)
|
||||
* Commit this part
|
||||
* push that branch to the remote and create a PR
|
||||
Determine if crucial bugfixes have been made between this commit and the current state, and eventually cherry-pick these.
|
||||
|
||||
### create changelog from git commits
|
||||
* Edit `freqtrade/__init__.py` and add the version matching the current date (for example `2019.7` for July 2019). Minor versions can be `2019.7-1` should we need to do a second release that month.
|
||||
* Commit this part
|
||||
* push that branch to the remote and create a PR against the master branch
|
||||
|
||||
### Create changelog from git commits
|
||||
|
||||
!!! Note
|
||||
Make sure that the master branch is uptodate!
|
||||
|
||||
``` bash
|
||||
# Needs to be done before merging / pulling that branch.
|
||||
git log --oneline --no-decorate --no-merges master..develop
|
||||
git log --oneline --no-decorate --no-merges master..new_release
|
||||
```
|
||||
|
||||
To keep the release-log short, best wrap the full git changelog into a collapsible details secction.
|
||||
|
||||
```markdown
|
||||
<details>
|
||||
<summary>Expand full changelog</summary>
|
||||
|
||||
... Full git changelog
|
||||
|
||||
</details>
|
||||
```
|
||||
|
||||
### Create github release / tag
|
||||
|
||||
Once the PR against master is merged (best right after merging):
|
||||
|
||||
* Use the button "Draft a new release" in the Github UI (subsection releases).
|
||||
* Use the version-number specified as tag.
|
||||
* Use "master" as reference (this step comes after the above PR is merged).
|
||||
* use the above changelog as release comment (as codeblock)
|
||||
* Use the above changelog as release comment (as codeblock)
|
||||
|
||||
### After-release
|
||||
|
||||
* update version in develop to next valid version and postfix that with `-dev` (`0.18.0 -> 0.18.1-dev`)
|
||||
* Update version in develop by postfixing that with `-dev` (`2019.6 -> 2019.6-dev`).
|
||||
* Create a PR against develop to update that branch.
|
||||
|
||||
## Releases
|
||||
|
||||
### pypi
|
||||
|
||||
To create a pypi release, please run the following commands:
|
||||
|
||||
Additional requirement: `wheel`, `twine` (for uploading), account on pypi with proper permissions.
|
||||
|
||||
``` bash
|
||||
python setup.py sdist bdist_wheel
|
||||
|
||||
# For pypi test (to check if some change to the installation did work)
|
||||
twine upload --repository-url https://test.pypi.org/legacy/ dist/*
|
||||
|
||||
# For production:
|
||||
twine upload dist/*
|
||||
```
|
||||
|
||||
Please don't push non-releases to the productive / real pypi instance.
|
||||
|
||||
210
docs/docker.md
Normal file
210
docs/docker.md
Normal file
@@ -0,0 +1,210 @@
|
||||
# Using FreqTrade with Docker
|
||||
|
||||
## Install Docker
|
||||
|
||||
Start by downloading and installing Docker CE for your platform:
|
||||
|
||||
* [Mac](https://docs.docker.com/docker-for-mac/install/)
|
||||
* [Windows](https://docs.docker.com/docker-for-windows/install/)
|
||||
* [Linux](https://docs.docker.com/install/)
|
||||
|
||||
Once you have Docker installed, simply prepare the config file (e.g. `config.json`) and run the image for `freqtrade` as explained below.
|
||||
|
||||
## Download the official FreqTrade docker image
|
||||
|
||||
Pull the image from docker hub.
|
||||
|
||||
Branches / tags available can be checked out on [Dockerhub](https://hub.docker.com/r/freqtradeorg/freqtrade/tags/).
|
||||
|
||||
```bash
|
||||
docker pull freqtradeorg/freqtrade:develop
|
||||
# Optionally tag the repository so the run-commands remain shorter
|
||||
docker tag freqtradeorg/freqtrade:develop freqtrade
|
||||
```
|
||||
|
||||
To update the image, simply run the above commands again and restart your running container.
|
||||
|
||||
Should you require additional libraries, please [build the image yourself](#build-your-own-docker-image).
|
||||
|
||||
!!! Note "Docker image update frequency"
|
||||
The official docker images with tags `master`, `develop` and `latest` are automatically rebuild once a week to keep the base image uptodate.
|
||||
In addition to that, every merge to `develop` will trigger a rebuild for `develop` and `latest`.
|
||||
|
||||
### Prepare the configuration files
|
||||
|
||||
Even though you will use docker, you'll still need some files from the github repository.
|
||||
|
||||
#### Clone the git repository
|
||||
|
||||
Linux/Mac/Windows with WSL
|
||||
|
||||
```bash
|
||||
git clone https://github.com/freqtrade/freqtrade.git
|
||||
```
|
||||
|
||||
Windows with docker
|
||||
|
||||
```bash
|
||||
git clone --config core.autocrlf=input https://github.com/freqtrade/freqtrade.git
|
||||
```
|
||||
|
||||
#### Copy `config.json.example` to `config.json`
|
||||
|
||||
```bash
|
||||
cd freqtrade
|
||||
cp -n config.json.example config.json
|
||||
```
|
||||
|
||||
> To understand the configuration options, please refer to the [Bot Configuration](configuration.md) page.
|
||||
|
||||
#### Create your database file
|
||||
|
||||
Production
|
||||
|
||||
```bash
|
||||
touch tradesv3.sqlite
|
||||
````
|
||||
|
||||
Dry-Run
|
||||
|
||||
```bash
|
||||
touch tradesv3.dryrun.sqlite
|
||||
```
|
||||
|
||||
!!! Note
|
||||
Make sure to use the path to this file when starting the bot in docker.
|
||||
|
||||
### Build your own Docker image
|
||||
|
||||
Best start by pulling the official docker image from dockerhub as explained [here](#download-the-official-docker-image) to speed up building.
|
||||
|
||||
To add additional libraries to your docker image, best check out [Dockerfile.technical](https://github.com/freqtrade/freqtrade/blob/develop/Dockerfile.technical) which adds the [technical](https://github.com/freqtrade/technical) module to the image.
|
||||
|
||||
```bash
|
||||
docker build -t freqtrade -f Dockerfile.technical .
|
||||
```
|
||||
|
||||
If you are developing using Docker, use `Dockerfile.develop` to build a dev Docker image, which will also set up develop dependencies:
|
||||
|
||||
```bash
|
||||
docker build -f Dockerfile.develop -t freqtrade-dev .
|
||||
```
|
||||
|
||||
!!! Note
|
||||
For security reasons, your configuration file will not be included in the image, you will need to bind mount it. It is also advised to bind mount an SQLite database file (see the "5. Run a restartable docker image" section) to keep it between updates.
|
||||
|
||||
#### Verify the Docker image
|
||||
|
||||
After the build process you can verify that the image was created with:
|
||||
|
||||
```bash
|
||||
docker images
|
||||
```
|
||||
|
||||
The output should contain the freqtrade image.
|
||||
|
||||
### Run the Docker image
|
||||
|
||||
You can run a one-off container that is immediately deleted upon exiting with the following command (`config.json` must be in the current working directory):
|
||||
|
||||
```bash
|
||||
docker run --rm -v `pwd`/config.json:/freqtrade/config.json -it freqtrade
|
||||
```
|
||||
|
||||
!!! Warning
|
||||
In this example, the database will be created inside the docker instance and will be lost when you will refresh your image.
|
||||
|
||||
#### Adjust timezone
|
||||
|
||||
By default, the container will use UTC timezone.
|
||||
Should you find this irritating please add the following to your docker commands:
|
||||
|
||||
##### Linux
|
||||
|
||||
``` bash
|
||||
-v /etc/timezone:/etc/timezone:ro
|
||||
|
||||
# Complete command:
|
||||
docker run --rm -v /etc/timezone:/etc/timezone:ro -v `pwd`/config.json:/freqtrade/config.json -it freqtrade
|
||||
```
|
||||
|
||||
##### MacOS
|
||||
|
||||
There is known issue in OSX Docker versions after 17.09.1, whereby `/etc/localtime` cannot be shared causing Docker to not start. A work-around for this is to start with the following cmd.
|
||||
|
||||
```bash
|
||||
docker run --rm -e TZ=`ls -la /etc/localtime | cut -d/ -f8-9` -v `pwd`/config.json:/freqtrade/config.json -it freqtrade
|
||||
```
|
||||
|
||||
More information on this docker issue and work-around can be read [here](https://github.com/docker/for-mac/issues/2396).
|
||||
|
||||
### Run a restartable docker image
|
||||
|
||||
To run a restartable instance in the background (feel free to place your configuration and database files wherever it feels comfortable on your filesystem).
|
||||
|
||||
#### Move your config file and database
|
||||
|
||||
The following will assume that you place your configuration / database files to `~/.freqtrade`, which is a hidden directory in your home directory. Feel free to use a different directory and replace the directory in the upcomming commands.
|
||||
|
||||
```bash
|
||||
mkdir ~/.freqtrade
|
||||
mv config.json ~/.freqtrade
|
||||
mv tradesv3.sqlite ~/.freqtrade
|
||||
```
|
||||
|
||||
#### Run the docker image
|
||||
|
||||
```bash
|
||||
docker run -d \
|
||||
--name freqtrade \
|
||||
-v ~/.freqtrade/config.json:/freqtrade/config.json \
|
||||
-v ~/.freqtrade/user_data/:/freqtrade/user_data \
|
||||
-v ~/.freqtrade/tradesv3.sqlite:/freqtrade/tradesv3.sqlite \
|
||||
freqtrade trade --db-url sqlite:///tradesv3.sqlite --strategy MyAwesomeStrategy
|
||||
```
|
||||
|
||||
!!! Note
|
||||
When using docker, it's best to specify `--db-url` explicitly to ensure that the database URL and the mounted database file match.
|
||||
|
||||
!!! Note
|
||||
All available bot command line parameters can be added to the end of the `docker run` command.
|
||||
|
||||
!!! Note
|
||||
You can define a [restart policy](https://docs.docker.com/config/containers/start-containers-automatically/) in docker. It can be useful in some cases to use the `--restart unless-stopped` flag (crash of freqtrade or reboot of your system).
|
||||
|
||||
### Monitor your Docker instance
|
||||
|
||||
You can use the following commands to monitor and manage your container:
|
||||
|
||||
```bash
|
||||
docker logs freqtrade
|
||||
docker logs -f freqtrade
|
||||
docker restart freqtrade
|
||||
docker stop freqtrade
|
||||
docker start freqtrade
|
||||
```
|
||||
|
||||
For more information on how to operate Docker, please refer to the [official Docker documentation](https://docs.docker.com/).
|
||||
|
||||
!!! Note
|
||||
You do not need to rebuild the image for configuration changes, it will suffice to edit `config.json` and restart the container.
|
||||
|
||||
### Backtest with docker
|
||||
|
||||
The following assumes that the download/setup of the docker image have been completed successfully.
|
||||
Also, backtest-data should be available at `~/.freqtrade/user_data/`.
|
||||
|
||||
```bash
|
||||
docker run -d \
|
||||
--name freqtrade \
|
||||
-v /etc/localtime:/etc/localtime:ro \
|
||||
-v ~/.freqtrade/config.json:/freqtrade/config.json \
|
||||
-v ~/.freqtrade/tradesv3.sqlite:/freqtrade/tradesv3.sqlite \
|
||||
-v ~/.freqtrade/user_data/:/freqtrade/user_data/ \
|
||||
freqtrade backtesting --strategy AwsomelyProfitableStrategy
|
||||
```
|
||||
|
||||
Head over to the [Backtesting Documentation](backtesting.md) for more details.
|
||||
|
||||
!!! Note
|
||||
Additional bot command line parameters can be appended after the image name (`freqtrade` in the above example).
|
||||
220
docs/edge.md
220
docs/edge.md
@@ -3,165 +3,168 @@
|
||||
This page explains how to use Edge Positioning module in your bot in order to enter into a trade only if the trade has a reasonable win rate and risk reward ratio, and consequently adjust your position size and stoploss.
|
||||
|
||||
!!! Warning
|
||||
Edge positioning is not compatible with dynamic whitelist. it overrides dynamic whitelist.
|
||||
Edge positioning is not compatible with dynamic (volume-based) whitelist.
|
||||
|
||||
!!! Note
|
||||
Edge won't consider anything else than buy/sell/stoploss signals. So trailing stoploss, ROI, and everything else will be ignored in its calculation.
|
||||
Edge does not consider anything else than buy/sell/stoploss signals. So trailing stoploss, ROI, and everything else are ignored in its calculation.
|
||||
|
||||
## Introduction
|
||||
Trading is all about probability. No one can claim that he has a strategy working all the time. You have to assume that sometimes you lose.<br/><br/>
|
||||
But it doesn't mean there is no rule, it only means rules should work "most of the time". Let's play a game: we toss a coin, heads: I give you 10$, tails: You give me 10$. Is it an interesting game ? no, it is quite boring, isn't it?<br/><br/>
|
||||
But let's say the probability that we have heads is 80%, and the probability that we have tails is 20%. Now it is becoming interesting ...
|
||||
That means 10$ x 80% versus 10$ x 20%. 8$ versus 2$. That means over time you will win 8$ risking only 2$ on each toss of coin.<br/><br/>
|
||||
Let's complicate it more: you win 80% of the time but only 2$, I win 20% of the time but 8$. The calculation is: 80% * 2$ versus 20% * 8$. It is becoming boring again because overtime you win $1.6$ (80% x 2$) and me $1.6 (20% * 8$) too.<br/><br/>
|
||||
The question is: How do you calculate that? how do you know if you wanna play?
|
||||
|
||||
Trading is all about probability. No one can claim that he has a strategy working all the time. You have to assume that sometimes you lose.
|
||||
|
||||
But it doesn't mean there is no rule, it only means rules should work "most of the time". Let's play a game: we toss a coin, heads: I give you 10$, tails: you give me 10$. Is it an interesting game? No, it's quite boring, isn't it?
|
||||
|
||||
But let's say the probability that we have heads is 80% (because our coin has the displaced distribution of mass or other defect), and the probability that we have tails is 20%. Now it is becoming interesting...
|
||||
|
||||
That means 10$ X 80% versus 10$ X 20%. 8$ versus 2$. That means over time you will win 8$ risking only 2$ on each toss of coin.
|
||||
|
||||
Let's complicate it more: you win 80% of the time but only 2$, I win 20% of the time but 8$. The calculation is: 80% X 2$ versus 20% X 8$. It is becoming boring again because overtime you win $1.6$ (80% X 2$) and me $1.6 (20% X 8$) too.
|
||||
|
||||
The question is: How do you calculate that? How do you know if you wanna play?
|
||||
|
||||
The answer comes to two factors:
|
||||
|
||||
- Win Rate
|
||||
- Risk Reward Ratio
|
||||
|
||||
|
||||
### Win Rate
|
||||
Means over X trades what is the percentage of winning trades to total number of trades (note that we don't consider how much you gained but only If you won or not).
|
||||
|
||||
Win Rate (*W*) is is the mean over some amount of trades (*N*) what is the percentage of winning trades to total number of trades (note that we don't consider how much you gained but only if you won or not).
|
||||
|
||||
`W = (Number of winning trades) / (Total number of trades)`
|
||||
```
|
||||
W = (Number of winning trades) / (Total number of trades) = (Number of winning trades) / N
|
||||
```
|
||||
|
||||
Complementary Loss Rate (*L*) is defined as
|
||||
|
||||
```
|
||||
L = (Number of losing trades) / (Total number of trades) = (Number of losing trades) / N
|
||||
```
|
||||
|
||||
or, which is the same, as
|
||||
|
||||
```
|
||||
L = 1 – W
|
||||
```
|
||||
|
||||
### Risk Reward Ratio
|
||||
Risk Reward Ratio is a formula used to measure the expected gains of a given investment against the risk of loss. It is basically what you potentially win divided by what you potentially lose:
|
||||
|
||||
`R = Profit / Loss`
|
||||
Risk Reward Ratio (*R*) is a formula used to measure the expected gains of a given investment against the risk of loss. It is basically what you potentially win divided by what you potentially lose:
|
||||
|
||||
```
|
||||
R = Profit / Loss
|
||||
```
|
||||
|
||||
Over time, on many trades, you can calculate your risk reward by dividing your average profit on winning trades by your average loss on losing trades:
|
||||
|
||||
`Average profit = (Sum of profits) / (Number of winning trades)`
|
||||
```
|
||||
Average profit = (Sum of profits) / (Number of winning trades)
|
||||
|
||||
`Average loss = (Sum of losses) / (Number of losing trades)`
|
||||
Average loss = (Sum of losses) / (Number of losing trades)
|
||||
|
||||
`R = (Average profit) / (Average loss)`
|
||||
R = (Average profit) / (Average loss)
|
||||
```
|
||||
|
||||
### Expectancy
|
||||
|
||||
At this point we can combine W and R to create an expectancy ratio. This is a simple process of multiplying the risk reward ratio by the percentage of winning trades, and subtracting the percentage of losing trades, which is calculated as follows:
|
||||
At this point we can combine *W* and *R* to create an expectancy ratio. This is a simple process of multiplying the risk reward ratio by the percentage of winning trades and subtracting the percentage of losing trades, which is calculated as follows:
|
||||
|
||||
Expectancy Ratio = (Risk Reward Ratio x Win Rate) – Loss Rate
|
||||
```
|
||||
Expectancy Ratio = (Risk Reward Ratio X Win Rate) – Loss Rate = (R X W) – L
|
||||
```
|
||||
|
||||
So lets say your Win rate is 28% and your Risk Reward Ratio is 5:
|
||||
|
||||
`Expectancy = (5 * 0.28) - 0.72 = 0.68`
|
||||
```
|
||||
Expectancy = (5 X 0.28) – 0.72 = 0.68
|
||||
```
|
||||
|
||||
Superficially, this means that on average you expect this strategy’s trades to return .68 times the size of your losers. This is important for two reasons: First, it may seem obvious, but you know right away that you have a positive return. Second, you now have a number you can compare to other candidate systems to make decisions about which ones you employ.
|
||||
Superficially, this means that on average you expect this strategy’s trades to return .68 times the size of your loses. This is important for two reasons: First, it may seem obvious, but you know right away that you have a positive return. Second, you now have a number you can compare to other candidate systems to make decisions about which ones you employ.
|
||||
|
||||
It is important to remember that any system with an expectancy greater than 0 is profitable using past data. The key is finding one that will be profitable in the future.
|
||||
|
||||
You can also use this number to evaluate the effectiveness of modifications to this system.
|
||||
You can also use this value to evaluate the effectiveness of modifications to this system.
|
||||
|
||||
**NOTICE:** It's important to keep in mind that Edge is testing your expectancy using historical data, there's no guarantee that you will have a similar edge in the future. It's still vital to do this testing in order to build confidence in your methodology, but be wary of "curve-fitting" your approach to the historical data as things are unlikely to play out the exact same way for future trades.
|
||||
|
||||
## How does it work?
|
||||
If enabled in config, Edge will go through historical data with a range of stoplosses in order to find buy and sell/stoploss signals. It then calculates win rate and expectancy over X trades for each stoploss. Here is an example:
|
||||
|
||||
If enabled in config, Edge will go through historical data with a range of stoplosses in order to find buy and sell/stoploss signals. It then calculates win rate and expectancy over *N* trades for each stoploss. Here is an example:
|
||||
|
||||
| Pair | Stoploss | Win Rate | Risk Reward Ratio | Expectancy |
|
||||
|----------|:-------------:|-------------:|------------------:|-----------:|
|
||||
| XZC/ETH | -0.03 | 0.52 |1.359670 | 0.228 |
|
||||
| XZC/ETH | -0.01 | 0.50 |1.176384 | 0.088 |
|
||||
| XZC/ETH | -0.02 | 0.51 |1.115941 | 0.079 |
|
||||
| XZC/ETH | -0.03 | 0.52 |1.359670 | 0.228 |
|
||||
| XZC/ETH | -0.04 | 0.51 |1.234539 | 0.117 |
|
||||
|
||||
The goal here is to find the best stoploss for the strategy in order to have the maximum expectancy. In the above example stoploss at 3% leads to the maximum expectancy according to historical data.
|
||||
|
||||
Edge then forces stoploss to your strategy dynamically.
|
||||
Edge module then forces stoploss value it evaluated to your strategy dynamically.
|
||||
|
||||
### Position size
|
||||
Edge dictates the stake amount for each trade to the bot according to the following factors:
|
||||
|
||||
Edge also dictates the stake amount for each trade to the bot according to the following factors:
|
||||
|
||||
- Allowed capital at risk
|
||||
- Stoploss
|
||||
|
||||
Allowed capital at risk is calculated as follows:
|
||||
|
||||
**allowed capital at risk** = **capital_available_percentage** X **allowed risk per trade**
|
||||
```
|
||||
Allowed capital at risk = (Capital available_percentage) X (Allowed risk per trade)
|
||||
```
|
||||
|
||||
**Stoploss** is calculated as described above against historical data.
|
||||
Stoploss is calculated as described above against historical data.
|
||||
|
||||
Your position size then will be:
|
||||
|
||||
**position size** = **allowed capital at risk** / **stoploss**
|
||||
```
|
||||
Position size = (Allowed capital at risk) / Stoploss
|
||||
```
|
||||
|
||||
Example:<br/>
|
||||
Let's say the stake currency is ETH and you have 10 ETH on the exchange, your **capital_available_percentage** is 50% and you would allow 1% of risk for each trade. thus your available capital for trading is **10 x 0.5 = 5 ETH** and allowed capital at risk would be **5 x 0.01 = 0.05 ETH**. <br/>
|
||||
Let's assume Edge has calculated that for **XLM/ETH** market your stoploss should be at 2%. So your position size will be **0.05 / 0.02 = 2.5ETH**.<br/>
|
||||
Bot takes a position of 2.5ETH on XLM/ETH (call it trade 1). Up next, you receive another buy signal while trade 1 is still open. This time on BTC/ETH market. Edge calculated stoploss for this market at 4%. So your position size would be 0.05 / 0.04 = 1.25ETH (call it trade 2).<br/>
|
||||
Note that available capital for trading didn’t change for trade 2 even if you had already trade 1. The available capital doesn’t mean the free amount on your wallet.<br/>
|
||||
Now you have two trades open. The Bot receives yet another buy signal for another market: **ADA/ETH**. This time the stoploss is calculated at 1%. So your position size is **0.05 / 0.01 = 5ETH**. But there are already 4ETH blocked in two previous trades. So the position size for this third trade would be 1ETH.<br/>
|
||||
Available capital doesn’t change before a position is sold. Let’s assume that trade 1 receives a sell signal and it is sold with a profit of 1ETH. Your total capital on exchange would be 11 ETH and the available capital for trading becomes 5.5ETH. <br/>
|
||||
So the Bot receives another buy signal for trade 4 with a stoploss at 2% then your position size would be **0.055 / 0.02 = 2.75**.
|
||||
Example:
|
||||
|
||||
Let's say the stake currency is ETH and you have 10 ETH on the exchange, your capital available percentage is 50% and you would allow 1% of risk for each trade. thus your available capital for trading is **10 x 0.5 = 5 ETH** and allowed capital at risk would be **5 x 0.01 = 0.05 ETH**.
|
||||
|
||||
Let's assume Edge has calculated that for **XLM/ETH** market your stoploss should be at 2%. So your position size will be **0.05 / 0.02 = 2.5 ETH**.
|
||||
|
||||
Bot takes a position of 2.5 ETH on XLM/ETH (call it trade 1). Up next, you receive another buy signal while trade 1 is still open. This time on **BTC/ETH** market. Edge calculated stoploss for this market at 4%. So your position size would be 0.05 / 0.04 = 1.25 ETH (call it trade 2).
|
||||
|
||||
Note that available capital for trading didn’t change for trade 2 even if you had already trade 1. The available capital doesn’t mean the free amount on your wallet.
|
||||
|
||||
Now you have two trades open. The bot receives yet another buy signal for another market: **ADA/ETH**. This time the stoploss is calculated at 1%. So your position size is **0.05 / 0.01 = 5 ETH**. But there are already 3.75 ETH blocked in two previous trades. So the position size for this third trade would be **5 – 3.75 = 1.25 ETH**.
|
||||
|
||||
Available capital doesn’t change before a position is sold. Let’s assume that trade 1 receives a sell signal and it is sold with a profit of 1 ETH. Your total capital on exchange would be 11 ETH and the available capital for trading becomes 5.5 ETH.
|
||||
|
||||
So the Bot receives another buy signal for trade 4 with a stoploss at 2% then your position size would be **0.055 / 0.02 = 2.75 ETH**.
|
||||
|
||||
## Configurations
|
||||
Edge has following configurations:
|
||||
|
||||
#### enabled
|
||||
If true, then Edge will run periodically.<br/>
|
||||
(default to false)
|
||||
|
||||
#### process_throttle_secs
|
||||
How often should Edge run in seconds? <br/>
|
||||
(default to 3600 so one hour)
|
||||
|
||||
#### calculate_since_number_of_days
|
||||
Number of days of data against which Edge calculates Win Rate, Risk Reward and Expectancy
|
||||
Note that it downloads historical data so increasing this number would lead to slowing down the bot.<br/>
|
||||
(default to 7)
|
||||
|
||||
#### capital_available_percentage
|
||||
This is the percentage of the total capital on exchange in stake currency. <br/>
|
||||
As an example if you have 10 ETH available in your wallet on the exchange and this value is 0.5 (which is 50%), then the bot will use a maximum amount of 5 ETH for trading and considers it as available capital.<br/>
|
||||
(default to 0.5)
|
||||
|
||||
#### allowed_risk
|
||||
Percentage of allowed risk per trade.<br/>
|
||||
(default to 0.01 [1%])
|
||||
|
||||
#### stoploss_range_min
|
||||
Minimum stoploss.<br/>
|
||||
(default to -0.01)
|
||||
|
||||
#### stoploss_range_max
|
||||
Maximum stoploss.<br/>
|
||||
(default to -0.10)
|
||||
|
||||
#### stoploss_range_step
|
||||
As an example if this is set to -0.01 then Edge will test the strategy for [-0.01, -0,02, -0,03 ..., -0.09, -0.10] ranges.
|
||||
Note than having a smaller step means having a bigger range which could lead to slow calculation. <br/>
|
||||
if you set this parameter to -0.001, you then slow down the Edge calculation by a factor of 10. <br/>
|
||||
(default to -0.01)
|
||||
|
||||
#### minimum_winrate
|
||||
It filters pairs which don't have at least minimum_winrate.
|
||||
This comes handy if you want to be conservative and don't comprise win rate in favor of risk reward ratio.<br/>
|
||||
(default to 0.60)
|
||||
|
||||
#### minimum_expectancy
|
||||
It filters paris which have an expectancy lower than this number .
|
||||
Having an expectancy of 0.20 means if you put 10$ on a trade you expect a 12$ return.<br/>
|
||||
(default to 0.20)
|
||||
|
||||
#### min_trade_number
|
||||
When calculating W and R and E (expectancy) against historical data, you always want to have a minimum number of trades. The more this number is the more Edge is reliable. Having a win rate of 100% on a single trade doesn't mean anything at all. But having a win rate of 70% over past 100 trades means clearly something. <br/>
|
||||
(default to 10, it is highly recommended not to decrease this number)
|
||||
|
||||
#### max_trade_duration_minute
|
||||
Edge will filter out trades with long duration. If a trade is profitable after 1 month, it is hard to evaluate the strategy based on it. But if most of trades are profitable and they have maximum duration of 30 minutes, then it is clearly a good sign.<br/>
|
||||
**NOTICE:** While configuring this value, you should take into consideration your ticker interval. as an example filtering out trades having duration less than one day for a strategy which has 4h interval does not make sense. default value is set assuming your strategy interval is relatively small (1m or 5m, etc).<br/>
|
||||
(default to 1 day, 1440 = 60 * 24)
|
||||
|
||||
#### remove_pumps
|
||||
Edge will remove sudden pumps in a given market while going through historical data. However, given that pumps happen very often in crypto markets, we recommend you keep this off.<br/>
|
||||
(default to false)
|
||||
Edge module has following configuration options:
|
||||
|
||||
| Parameter | Description |
|
||||
|------------|-------------|
|
||||
| `enabled` | If true, then Edge will run periodically. <br>*Defaults to `false`.* <br> ***Datatype:*** *Boolean*
|
||||
| `process_throttle_secs` | How often should Edge run in seconds. <br>*Defaults to `3600` (once per hour).* <br> ***Datatype:*** *Integer*
|
||||
| `calculate_since_number_of_days` | Number of days of data against which Edge calculates Win Rate, Risk Reward and Expectancy. <br> **Note** that it downloads historical data so increasing this number would lead to slowing down the bot. <br>*Defaults to `7`.* <br> ***Datatype:*** *Integer*
|
||||
| `capital_available_percentage` | **DEPRECATED - [replaced with `tradable_balance_ratio`](configuration.md#Available balance)** This is the percentage of the total capital on exchange in stake currency. <br>As an example if you have 10 ETH available in your wallet on the exchange and this value is 0.5 (which is 50%), then the bot will use a maximum amount of 5 ETH for trading and considers it as available capital. <br>*Defaults to `0.5`.* <br> ***Datatype:*** *Float*
|
||||
| `allowed_risk` | Ratio of allowed risk per trade. <br>*Defaults to `0.01` (1%)).* <br> ***Datatype:*** *Float*
|
||||
| `stoploss_range_min` | Minimum stoploss. <br>*Defaults to `-0.01`.* <br> ***Datatype:*** *Float*
|
||||
| `stoploss_range_max` | Maximum stoploss. <br>*Defaults to `-0.10`.* <br> ***Datatype:*** *Float*
|
||||
| `stoploss_range_step` | As an example if this is set to -0.01 then Edge will test the strategy for `[-0.01, -0,02, -0,03 ..., -0.09, -0.10]` ranges. <br> **Note** than having a smaller step means having a bigger range which could lead to slow calculation. <br> If you set this parameter to -0.001, you then slow down the Edge calculation by a factor of 10. <br>*Defaults to `-0.001`.* <br> ***Datatype:*** *Float*
|
||||
| `minimum_winrate` | It filters out pairs which don't have at least minimum_winrate. <br>This comes handy if you want to be conservative and don't comprise win rate in favour of risk reward ratio. <br>*Defaults to `0.60`.* <br> ***Datatype:*** *Float*
|
||||
| `minimum_expectancy` | It filters out pairs which have the expectancy lower than this number. <br>Having an expectancy of 0.20 means if you put 10$ on a trade you expect a 12$ return. <br>*Defaults to `0.20`.* <br> ***Datatype:*** *Float*
|
||||
| `min_trade_number` | When calculating *W*, *R* and *E* (expectancy) against historical data, you always want to have a minimum number of trades. The more this number is the more Edge is reliable. <br>Having a win rate of 100% on a single trade doesn't mean anything at all. But having a win rate of 70% over past 100 trades means clearly something. <br>*Defaults to `10` (it is highly recommended not to decrease this number).* <br> ***Datatype:*** *Integer*
|
||||
| `max_trade_duration_minute` | Edge will filter out trades with long duration. If a trade is profitable after 1 month, it is hard to evaluate the strategy based on it. But if most of trades are profitable and they have maximum duration of 30 minutes, then it is clearly a good sign.<br>**NOTICE:** While configuring this value, you should take into consideration your ticker interval. As an example filtering out trades having duration less than one day for a strategy which has 4h interval does not make sense. Default value is set assuming your strategy interval is relatively small (1m or 5m, etc.).<br>*Defaults to `1440` (one day).* <br> ***Datatype:*** *Integer*
|
||||
| `remove_pumps` | Edge will remove sudden pumps in a given market while going through historical data. However, given that pumps happen very often in crypto markets, we recommend you keep this off.<br>*Defaults to `false`.* <br> ***Datatype:*** *Boolean*
|
||||
|
||||
## Running Edge independently
|
||||
|
||||
You can run Edge independently in order to see in details the result. Here is an example:
|
||||
|
||||
``` bash
|
||||
python3 ./freqtrade/main.py edge
|
||||
freqtrade edge
|
||||
```
|
||||
|
||||
An example of its output:
|
||||
@@ -185,28 +188,27 @@ An example of its output:
|
||||
| NEBL/BTC | -0.03 | 0.63 | 1.29 | 0.58 | 0.44 | 19 | 59 |
|
||||
|
||||
### Update cached pairs with the latest data
|
||||
```bash
|
||||
python3 ./freqtrade/main.py edge --refresh-pairs-cached
|
||||
```
|
||||
|
||||
Edge requires historic data the same way as backtesting does.
|
||||
Please refer to the [Data Downloading](data-download.md) section of the documentation for details.
|
||||
|
||||
### Precising stoploss range
|
||||
|
||||
```bash
|
||||
python3 ./freqtrade/main.py edge --stoplosses=-0.01,-0.1,-0.001 #min,max,step
|
||||
freqtrade edge --stoplosses=-0.01,-0.1,-0.001 #min,max,step
|
||||
```
|
||||
|
||||
### Advanced use of timerange
|
||||
|
||||
```bash
|
||||
python3 ./freqtrade/main.py edge --timerange=20181110-20181113
|
||||
freqtrade edge --timerange=20181110-20181113
|
||||
```
|
||||
|
||||
Doing --timerange=-200 will get the last 200 timeframes from your inputdata. You can also specify specific dates, or a range span indexed by start and stop.
|
||||
Doing `--timerange=-20190901` will get all available data until September 1st (excluding September 1st 2019).
|
||||
|
||||
The full timerange specification:
|
||||
|
||||
* Use last 123 tickframes of data: --timerange=-123
|
||||
* Use first 123 tickframes of data: --timerange=123-
|
||||
* Use tickframes from line 123 through 456: --timerange=123-456
|
||||
* Use tickframes till 2018/01/31: --timerange=-20180131
|
||||
* Use tickframes since 2018/01/31: --timerange=20180131-
|
||||
* Use tickframes since 2018/01/31 till 2018/03/01 : --timerange=20180131-20180301
|
||||
* Use tickframes between POSIX timestamps 1527595200 1527618600: --timerange=1527595200-1527618600
|
||||
* Use tickframes till 2018/01/31: `--timerange=-20180131`
|
||||
* Use tickframes since 2018/01/31: `--timerange=20180131-`
|
||||
* Use tickframes since 2018/01/31 till 2018/03/01 : `--timerange=20180131-20180301`
|
||||
* Use tickframes between POSIX timestamps 1527595200 1527618600: `--timerange=1527595200-1527618600`
|
||||
|
||||
84
docs/exchanges.md
Normal file
84
docs/exchanges.md
Normal file
@@ -0,0 +1,84 @@
|
||||
# Exchange-specific Notes
|
||||
|
||||
This page combines common gotchas and informations which are exchange-specific and most likely don't apply to other exchanges.
|
||||
|
||||
## Binance
|
||||
|
||||
!!! Tip "Stoploss on Exchange"
|
||||
Binance is currently the only exchange supporting `stoploss_on_exchange`. It provides great advantages, so we recommend to benefit from it.
|
||||
|
||||
### Blacklists
|
||||
|
||||
For Binance, please add `"BNB/<STAKE>"` to your blacklist to avoid issues.
|
||||
Accounts having BNB accounts use this to pay for fees - if your first trade happens to be on `BNB`, further trades will consume this position and make the initial BNB order unsellable as the expected amount is not there anymore.
|
||||
|
||||
### Binance sites
|
||||
|
||||
Binance has been split into 3, and users must use the correct ccxt exchange ID for their exchange, otherwise API keys are not recognized.
|
||||
|
||||
* [binance.com](https://www.binance.com/) - International users. Use exchange id: `binance`.
|
||||
* [binance.us](https://www.binance.us/) - US based users. Use exchange id: `binanceus`.
|
||||
* [binance.je](https://www.binance.je/) - Binance Jersey, trading fiat currencies. Use exchange id: `binanceje`.
|
||||
|
||||
## Kraken
|
||||
|
||||
### Historic Kraken data
|
||||
|
||||
The Kraken API does only provide 720 historic candles, which is sufficient for Freqtrade dry-run and live trade modes, but is a problem for backtesting.
|
||||
To download data for the Kraken exchange, using `--dl-trades` is mandatory, otherwise the bot will download the same 720 candles over and over, and you'll not have enough backtest data.
|
||||
|
||||
## Bittrex
|
||||
|
||||
### Restricted markets
|
||||
|
||||
Bittrex split its exchange into US and International versions.
|
||||
The International version has more pairs available, however the API always returns all pairs, so there is currently no automated way to detect if you're affected by the restriction.
|
||||
|
||||
If you have restricted pairs in your whitelist, you'll get a warning message in the log on Freqtrade startup for each restricted pair.
|
||||
|
||||
The warning message will look similar to the following:
|
||||
|
||||
``` output
|
||||
[...] Message: bittrex {"success":false,"message":"RESTRICTED_MARKET","result":null,"explanation":null}"
|
||||
```
|
||||
|
||||
If you're an "International" customer on the Bittrex exchange, then this warning will probably not impact you.
|
||||
If you're a US customer, the bot will fail to create orders for these pairs, and you should remove them from your whitelist.
|
||||
|
||||
You can get a list of restricted markets by using the following snippet:
|
||||
|
||||
``` python
|
||||
import ccxt
|
||||
ct = ccxt.bittrex()
|
||||
_ = ct.load_markets()
|
||||
res = [ f"{x['MarketCurrency']}/{x['BaseCurrency']}" for x in ct.publicGetMarkets()['result'] if x['IsRestricted']]
|
||||
print(res)
|
||||
```
|
||||
|
||||
## Random notes for other exchanges
|
||||
|
||||
* The Ocean (exchange id: `theocean`) exchange uses Web3 functionality and requires `web3` python package to be installed:
|
||||
```shell
|
||||
$ pip3 install web3
|
||||
```
|
||||
|
||||
### Send incomplete candles to the strategy
|
||||
|
||||
Most exchanges return incomplete candles via their ohlcv / klines interface.
|
||||
By default, Freqtrade assumes that incomplete candles are returned and removes the last candle assuming it's an incomplete candle.
|
||||
|
||||
Whether your exchange returns incomplete candles or not can be checked using [the helper script](developer.md#Incomplete-candles) from the Contributor documentation.
|
||||
|
||||
If the exchange does return incomplete candles and you would like to have incomplete candles in your strategy, you can set the following parameter in the configuration file.
|
||||
|
||||
``` json
|
||||
{
|
||||
|
||||
"exchange": {
|
||||
"_ft_has_params": {"ohlcv_partial_candle": false}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
!!! Warning "Danger of repainting"
|
||||
Changing this parameter makes the strategy responsible to avoid repainting and handle this accordingly. Doing this is therefore not recommended, and should only be performed by experienced users who are fully aware of the impact this setting has.
|
||||
113
docs/faq.md
113
docs/faq.md
@@ -1,12 +1,25 @@
|
||||
# freqtrade FAQ
|
||||
# Freqtrade FAQ
|
||||
|
||||
#### I have waited 5 minutes, why hasn't the bot made any trades yet?!
|
||||
## Freqtrade common issues
|
||||
|
||||
### The bot does not start
|
||||
|
||||
Running the bot with `freqtrade trade --config config.json` does show the output `freqtrade: command not found`.
|
||||
|
||||
This could have the following reasons:
|
||||
|
||||
* The virtual environment is not active
|
||||
* run `source .env/bin/activate` to activate the virtual environment
|
||||
* The installation did not work correctly.
|
||||
* Please check the [Installation documentation](installation.md).
|
||||
|
||||
### I have waited 5 minutes, why hasn't the bot made any trades yet?!
|
||||
|
||||
Depending on the buy strategy, the amount of whitelisted coins, the
|
||||
situation of the market etc, it can take up to hours to find good entry
|
||||
position for a trade. Be patient!
|
||||
|
||||
#### I have made 12 trades already, why is my total profit negative?!
|
||||
### I have made 12 trades already, why is my total profit negative?!
|
||||
|
||||
I understand your disappointment but unfortunately 12 trades is just
|
||||
not enough to say anything. If you run backtesting, you can see that our
|
||||
@@ -17,54 +30,116 @@ of course constantly aim to improve the bot but it will _always_ be a
|
||||
gamble, which should leave you with modest wins on monthly basis but
|
||||
you can't say much from few trades.
|
||||
|
||||
#### I’d like to change the stake amount. Can I just stop the bot with
|
||||
/stop and then change the config.json and run it again?
|
||||
### I’d like to change the stake amount. Can I just stop the bot with /stop and then change the config.json and run it again?
|
||||
|
||||
Not quite. Trades are persisted to a database but the configuration is
|
||||
currently only read when the bot is killed and restarted. `/stop` more
|
||||
like pauses. You can stop your bot, adjust settings and start it again.
|
||||
|
||||
#### I want to improve the bot with a new strategy
|
||||
### I want to improve the bot with a new strategy
|
||||
|
||||
That's great. We have a nice backtesting and hyperoptimizing setup. See
|
||||
That's great. We have a nice backtesting and hyperoptimization setup. See
|
||||
the tutorial [here|Testing-new-strategies-with-Hyperopt](bot-usage.md#hyperopt-commands).
|
||||
|
||||
#### Is there a setting to only SELL the coins being held and not
|
||||
perform anymore BUYS?
|
||||
### Is there a setting to only SELL the coins being held and not perform anymore BUYS?
|
||||
|
||||
You can use the `/forcesell all` command from Telegram.
|
||||
|
||||
### I get the message "RESTRICTED_MARKET"
|
||||
|
||||
Currently known to happen for US Bittrex users.
|
||||
|
||||
Read [the Bittrex section about restricted markets](exchanges.md#restricted-markets) for more information.
|
||||
|
||||
### How do I search the bot logs for something?
|
||||
|
||||
By default, the bot writes its log into stderr stream. This is implemented this way so that you can easily separate the bot's diagnostics messages from Backtesting, Edge and Hyperopt results, output from other various Freqtrade utility subcommands, as well as from the output of your custom `print()`'s you may have inserted into your strategy. So if you need to search the log messages with the grep utility, you need to redirect stderr to stdout and disregard stdout.
|
||||
|
||||
* In unix shells, this normally can be done as simple as:
|
||||
```shell
|
||||
$ freqtrade --some-options 2>&1 >/dev/null | grep 'something'
|
||||
```
|
||||
(note, `2>&1` and `>/dev/null` should be written in this order)
|
||||
|
||||
* Bash interpreter also supports so called process substitution syntax, you can grep the log for a string with it as:
|
||||
```shell
|
||||
$ freqtrade --some-options 2> >(grep 'something') >/dev/null
|
||||
```
|
||||
or
|
||||
```shell
|
||||
$ freqtrade --some-options 2> >(grep -v 'something' 1>&2)
|
||||
```
|
||||
|
||||
* You can also write the copy of Freqtrade log messages to a file with the `--logfile` option:
|
||||
```shell
|
||||
$ freqtrade --logfile /path/to/mylogfile.log --some-options
|
||||
```
|
||||
and then grep it as:
|
||||
```shell
|
||||
$ cat /path/to/mylogfile.log | grep 'something'
|
||||
```
|
||||
or even on the fly, as the bot works and the logfile grows:
|
||||
```shell
|
||||
$ tail -f /path/to/mylogfile.log | grep 'something'
|
||||
```
|
||||
from a separate terminal window.
|
||||
|
||||
On Windows, the `--logfilename` option is also supported by Freqtrade and you can use the `findstr` command to search the log for the string of interest:
|
||||
```
|
||||
> type \path\to\mylogfile.log | findstr "something"
|
||||
```
|
||||
|
||||
## Hyperopt module
|
||||
|
||||
### How many epoch do I need to get a good Hyperopt result?
|
||||
Per default Hyperopts without `-e` or `--epochs` parameter will only
|
||||
run 100 epochs, means 100 evals of your triggers, guards, .... Too few
|
||||
|
||||
Per default Hyperopt called without the `-e`/`--epochs` command line option will only
|
||||
run 100 epochs, means 100 evals of your triggers, guards, ... Too few
|
||||
to find a great result (unless if you are very lucky), so you probably
|
||||
have to run it for 10.000 or more. But it will take an eternity to
|
||||
compute.
|
||||
|
||||
We recommend you to run it at least 10.000 epochs:
|
||||
|
||||
```bash
|
||||
python3 ./freqtrade/main.py hyperopt -e 10000
|
||||
freqtrade hyperopt -e 10000
|
||||
```
|
||||
|
||||
or if you want intermediate result to see
|
||||
|
||||
```bash
|
||||
for i in {1..100}; do python3 ./freqtrade/main.py hyperopt -e 100; done
|
||||
for i in {1..100}; do freqtrade hyperopt -e 100; done
|
||||
```
|
||||
|
||||
#### Why it is so long to run hyperopt?
|
||||
### Why it is so long to run hyperopt?
|
||||
|
||||
Finding a great Hyperopt results takes time.
|
||||
|
||||
If you wonder why it takes a while to find great hyperopt results
|
||||
|
||||
This answer was written during the under the release 0.15.1, when we had
|
||||
:
|
||||
This answer was written during the under the release 0.15.1, when we had:
|
||||
|
||||
- 8 triggers
|
||||
- 9 guards: let's say we evaluate even 10 values from each
|
||||
- 1 stoploss calculation: let's say we want 10 values from that too to
|
||||
be evaluated
|
||||
- 1 stoploss calculation: let's say we want 10 values from that too to be evaluated
|
||||
|
||||
The following calculation is still very rough and not very precise
|
||||
but it will give the idea. With only these triggers and guards there is
|
||||
already 8*10^9*10 evaluations. A roughly total of 80 billion evals.
|
||||
already 8\*10^9\*10 evaluations. A roughly total of 80 billion evals.
|
||||
Did you run 100 000 evals? Congrats, you've done roughly 1 / 100 000 th
|
||||
of the search space.
|
||||
|
||||
## Edge module
|
||||
|
||||
### Edge implements interesting approach for controlling position size, is there any theory behind it?
|
||||
|
||||
The Edge module is mostly a result of brainstorming of [@mishaker](https://github.com/mishaker) and [@creslinux](https://github.com/creslinux) freqtrade team members.
|
||||
|
||||
You can find further info on expectancy, winrate, risk management and position size in the following sources:
|
||||
|
||||
- https://www.tradeciety.com/ultimate-math-guide-for-traders/
|
||||
- http://www.vantharp.com/tharp-concepts/expectancy.asp
|
||||
- https://samuraitradingacademy.com/trading-expectancy/
|
||||
- https://www.learningmarkets.com/determining-expectancy-in-your-trading/
|
||||
- http://www.lonestocktrader.com/make-money-trading-positive-expectancy/
|
||||
- https://www.babypips.com/trading/trade-expectancy-matter
|
||||
|
||||
315
docs/hyperopt.md
315
docs/hyperopt.md
@@ -6,35 +6,67 @@ algorithms included in the `scikit-optimize` package to accomplish this. The
|
||||
search will burn all your CPU cores, make your laptop sound like a fighter jet
|
||||
and still take a long time.
|
||||
|
||||
In general, the search for best parameters starts with a few random combinations and then uses Bayesian search with a
|
||||
ML regressor algorithm (currently ExtraTreesRegressor) to quickly find a combination of parameters in the search hyperspace
|
||||
that minimizes the value of the [loss function](#loss-functions).
|
||||
|
||||
Hyperopt requires historic data to be available, just as backtesting does.
|
||||
To learn how to get data for the pairs and exchange you're interested in, head over to the [Data Downloading](data-download.md) section of the documentation.
|
||||
|
||||
!!! Bug
|
||||
Hyperopt will crash when used with only 1 CPU Core as found out in [Issue #1133](https://github.com/freqtrade/freqtrade/issues/1133)
|
||||
Hyperopt can crash when used with only 1 CPU Core as found out in [Issue #1133](https://github.com/freqtrade/freqtrade/issues/1133)
|
||||
|
||||
## Prepare Hyperopting
|
||||
|
||||
Before we start digging into Hyperopt, we recommend you to take a look at
|
||||
an example hyperopt file located into [user_data/hyperopts/](https://github.com/freqtrade/freqtrade/blob/develop/user_data/hyperopts/test_hyperopt.py)
|
||||
the sample hyperopt file located in [user_data/hyperopts/](https://github.com/freqtrade/freqtrade/blob/develop/freqtrade/templates/sample_hyperopt.py).
|
||||
|
||||
Configuring hyperopt is similar to writing your own strategy, and many tasks will be similar and a lot of code can be copied across from the strategy.
|
||||
|
||||
The simplest way to get started is to use `freqtrade new-hyperopt --hyperopt AwesomeHyperopt`.
|
||||
This will create a new hyperopt file from a template, which will be located under `user_data/hyperopts/AwesomeHyperopt.py`.
|
||||
|
||||
### Checklist on all tasks / possibilities in hyperopt
|
||||
|
||||
Depending on the space you want to optimize, only some of the below are required.
|
||||
Depending on the space you want to optimize, only some of the below are required:
|
||||
|
||||
* fill `populate_indicators` - probably a copy from your strategy
|
||||
* fill `buy_strategy_generator` - for buy signal optimization
|
||||
* fill `indicator_space` - for buy signal optimzation
|
||||
* fill `sell_strategy_generator` - for sell signal optimization
|
||||
* fill `sell_indicator_space` - for sell signal optimzation
|
||||
* fill `roi_space` - for ROI optimization
|
||||
* fill `generate_roi_table` - for ROI optimization (if you need more than 3 entries)
|
||||
* fill `stoploss_space` - stoploss optimization
|
||||
* Optional but recommended
|
||||
|
||||
!!! Note
|
||||
`populate_indicators` needs to create all indicators any of thee spaces may use, otherwise hyperopt will not work.
|
||||
|
||||
Optional - can also be loaded from a strategy:
|
||||
|
||||
* copy `populate_indicators` from your strategy - otherwise default-strategy will be used
|
||||
* copy `populate_buy_trend` from your strategy - otherwise default-strategy will be used
|
||||
* copy `populate_sell_trend` from your strategy - otherwise default-strategy will be used
|
||||
|
||||
!!! Note
|
||||
Assuming the optional methods are not in your hyperopt file, please use `--strategy AweSomeStrategy` which contains these methods so hyperopt can use these methods instead.
|
||||
|
||||
Rarely you may also need to override:
|
||||
|
||||
* `roi_space` - for custom ROI optimization (if you need the ranges for the ROI parameters in the optimization hyperspace that differ from default)
|
||||
* `generate_roi_table` - for custom ROI optimization (if you need the ranges for the values in the ROI table that differ from default or the number of entries (steps) in the ROI table which differs from the default 4 steps)
|
||||
* `stoploss_space` - for custom stoploss optimization (if you need the range for the stoploss parameter in the optimization hyperspace that differs from default)
|
||||
* `trailing_space` - for custom trailing stop optimization (if you need the ranges for the trailing stop parameters in the optimization hyperspace that differ from default)
|
||||
|
||||
!!! Tip "Quickly optimize ROI, stoploss and trailing stoploss"
|
||||
You can quickly optimize the spaces `roi`, `stoploss` and `trailing` without changing anything (i.e. without creation of a "complete" Hyperopt class with dimensions, parameters, triggers and guards, as described in this document) from the default hyperopt template by relying on your strategy to do most of the calculations.
|
||||
|
||||
``` python
|
||||
# Have a working strategy at hand.
|
||||
freqtrade new-hyperopt --hyperopt EmptyHyperopt
|
||||
|
||||
freqtrade hyperopt --hyperopt EmptyHyperopt --spaces roi stoploss trailing --strategy MyWorkingStrategy --config config.json -e 100
|
||||
```
|
||||
|
||||
### 1. Install a Custom Hyperopt File
|
||||
|
||||
Put your hyperopt file into the folder`user_data/hyperopts`.
|
||||
Put your hyperopt file into the directory `user_data/hyperopts`.
|
||||
|
||||
Let assume you want a hyperopt file `awesome_hyperopt.py`:
|
||||
Copy the file `user_data/hyperopts/sample_hyperopt.py` into `user_data/hyperopts/awesome_hyperopt.py`
|
||||
@@ -56,9 +88,9 @@ multiple guards. The constructed strategy will be something like
|
||||
"*buy exactly when close price touches lower bollinger band, BUT only if
|
||||
ADX > 10*".
|
||||
|
||||
If you have updated the buy strategy, ie. changed the contents of
|
||||
`populate_buy_trend()` method you have to update the `guards` and
|
||||
`triggers` hyperopts must use.
|
||||
If you have updated the buy strategy, i.e. changed the contents of
|
||||
`populate_buy_trend()` method, you have to update the `guards` and
|
||||
`triggers` your hyperopt must use correspondingly.
|
||||
|
||||
#### Sell optimization
|
||||
|
||||
@@ -71,6 +103,11 @@ Place the corresponding settings into the following methods
|
||||
The configuration and rules are the same than for buy signals.
|
||||
To avoid naming collisions in the search-space, please prefix all sell-spaces with `sell-`.
|
||||
|
||||
#### Using ticker-interval as part of the Strategy
|
||||
|
||||
The Strategy exposes the ticker-interval as `self.ticker_interval`. The same value is available as class-attribute `HyperoptName.ticker_interval`.
|
||||
In the case of the linked sample-value this would be `SampleHyperOpt.ticker_interval`.
|
||||
|
||||
## Solving a Mystery
|
||||
|
||||
Let's say you are curious: should you use MACD crossings or lower Bollinger
|
||||
@@ -122,6 +159,7 @@ So let's write the buy strategy using these values:
|
||||
dataframe['macd'], dataframe['macdsignal']
|
||||
))
|
||||
|
||||
if conditions:
|
||||
dataframe.loc[
|
||||
reduce(lambda x, y: x & y, conditions),
|
||||
'buy'] = 1
|
||||
@@ -136,34 +174,50 @@ with different value combinations. It will then use the given historical data an
|
||||
buys based on the buy signals generated with the above function and based on the results
|
||||
it will end with telling you which paramter combination produced the best profits.
|
||||
|
||||
The search for best parameters starts with a few random combinations and then uses a
|
||||
regressor algorithm (currently ExtraTreesRegressor) to quickly find a parameter combination
|
||||
that minimizes the value of the objective function `calculate_loss` in `hyperopt.py`.
|
||||
|
||||
The above setup expects to find ADX, RSI and Bollinger Bands in the populated indicators.
|
||||
When you want to test an indicator that isn't used by the bot currently, remember to
|
||||
add it to the `populate_indicators()` method in `hyperopt.py`.
|
||||
add it to the `populate_indicators()` method in your custom hyperopt file.
|
||||
|
||||
## Loss-functions
|
||||
|
||||
Each hyperparameter tuning requires a target. This is usually defined as a loss function (sometimes also called objective function), which should decrease for more desirable results, and increase for bad results.
|
||||
|
||||
By default, FreqTrade uses a loss function, which has been with freqtrade since the beginning and optimizes mostly for short trade duration and avoiding losses.
|
||||
|
||||
A different loss function can be specified by using the `--hyperopt-loss <Class-name>` argument.
|
||||
This class should be in its own file within the `user_data/hyperopts/` directory.
|
||||
|
||||
Currently, the following loss functions are builtin:
|
||||
|
||||
* `DefaultHyperOptLoss` (default legacy Freqtrade hyperoptimization loss function)
|
||||
* `OnlyProfitHyperOptLoss` (which takes only amount of profit into consideration)
|
||||
* `SharpeHyperOptLoss` (optimizes Sharpe Ratio calculated on the trade returns)
|
||||
|
||||
Creation of a custom loss function is covered in the [Advanced Hyperopt](advanced-hyperopt.md) part of the documentation.
|
||||
|
||||
## Execute Hyperopt
|
||||
|
||||
Once you have updated your hyperopt configuration you can run it.
|
||||
Because hyperopt tries a lot of combinations to find the best parameters it will take time you will have the result (more than 30 mins).
|
||||
Because hyperopt tries a lot of combinations to find the best parameters it will take time to get a good result. More time usually results in better results.
|
||||
|
||||
We strongly recommend to use `screen` or `tmux` to prevent any connection loss.
|
||||
|
||||
```bash
|
||||
python3 ./freqtrade/main.py --hyperopt <hyperoptname> -c config.json hyperopt -e 5000 --spaces all
|
||||
freqtrade hyperopt --config config.json --hyperopt <hyperoptname> -e 5000 --spaces all
|
||||
```
|
||||
|
||||
Use `<hyperoptname>` as the name of the custom hyperopt used.
|
||||
|
||||
The `-e` flag will set how many evaluations hyperopt will do. We recommend
|
||||
The `-e` option will set how many evaluations hyperopt will do. We recommend
|
||||
running at least several thousand evaluations.
|
||||
|
||||
The `--spaces all` flag determines that all possible parameters should be optimized. Possibilities are listed below.
|
||||
The `--spaces all` option determines that all possible parameters should be optimized. Possibilities are listed below.
|
||||
|
||||
!!! Note
|
||||
By default, hyperopt will erase previous results and start from scratch. Continuation can be archived by using `--continue`.
|
||||
|
||||
!!! Warning
|
||||
When switching parameters or changing configuration options, the file `user_data/hyperopt_results.pickle` should be removed. It's used to be able to continue interrupted calculations, but does not detect changes to settings or the hyperopt file.
|
||||
When switching parameters or changing configuration options, make sure to not use the argument `--continue` so temporary results can be removed.
|
||||
|
||||
### Execute Hyperopt with Different Ticker-Data Source
|
||||
|
||||
@@ -173,17 +227,24 @@ use data from directory `user_data/data`.
|
||||
|
||||
### Running Hyperopt with Smaller Testset
|
||||
|
||||
Use the `--timerange` argument to change how much of the testset
|
||||
you want to use. The last N ticks/timeframes will be used.
|
||||
Example:
|
||||
Use the `--timerange` argument to change how much of the testset you want to use.
|
||||
For example, to use one month of data, pass the following parameter to the hyperopt call:
|
||||
|
||||
```bash
|
||||
python3 ./freqtrade/main.py hyperopt --timerange -200
|
||||
freqtrade hyperopt --timerange 20180401-20180501
|
||||
```
|
||||
|
||||
### Running Hyperopt using methods from a strategy
|
||||
|
||||
Hyperopt can reuse `populate_indicators`, `populate_buy_trend`, `populate_sell_trend` from your strategy, assuming these methods are **not** in your custom hyperopt file, and a strategy is provided.
|
||||
|
||||
```bash
|
||||
freqtrade hyperopt --strategy SampleStrategy --customhyperopt SampleHyperopt
|
||||
```
|
||||
|
||||
### Running Hyperopt with Smaller Search Space
|
||||
|
||||
Use the `--spaces` argument to limit the search space used by hyperopt.
|
||||
Use the `--spaces` option to limit the search space used by hyperopt.
|
||||
Letting Hyperopt optimize everything is a huuuuge search space. Often it
|
||||
might make more sense to start by just searching for initial buy algorithm.
|
||||
Or maybe you just want to optimize your stoploss or roi table for that awesome
|
||||
@@ -191,12 +252,47 @@ new buy strategy you have.
|
||||
|
||||
Legal values are:
|
||||
|
||||
- `all`: optimize everything
|
||||
- `buy`: just search for a new buy strategy
|
||||
- `sell`: just search for a new sell strategy
|
||||
- `roi`: just optimize the minimal profit table for your strategy
|
||||
- `stoploss`: search for the best stoploss value
|
||||
- space-separated list of any of the above values for example `--spaces roi stoploss`
|
||||
* `all`: optimize everything
|
||||
* `buy`: just search for a new buy strategy
|
||||
* `sell`: just search for a new sell strategy
|
||||
* `roi`: just optimize the minimal profit table for your strategy
|
||||
* `stoploss`: search for the best stoploss value
|
||||
* `trailing`: search for the best trailing stop values
|
||||
* `default`: `all` except `trailing`
|
||||
* space-separated list of any of the above values for example `--spaces roi stoploss`
|
||||
|
||||
The default Hyperopt Search Space, used when no `--space` command line option is specified, does not include the `trailing` hyperspace. We recommend you to run optimization for the `trailing` hyperspace separately, when the best parameters for other hyperspaces were found, validated and pasted into your custom strategy.
|
||||
|
||||
### Position stacking and disabling max market positions
|
||||
|
||||
In some situations, you may need to run Hyperopt (and Backtesting) with the
|
||||
`--eps`/`--enable-position-staking` and `--dmmp`/`--disable-max-market-positions` arguments.
|
||||
|
||||
By default, hyperopt emulates the behavior of the Freqtrade Live Run/Dry Run, where only one
|
||||
open trade is allowed for every traded pair. The total number of trades open for all pairs
|
||||
is also limited by the `max_open_trades` setting. During Hyperopt/Backtesting this may lead to
|
||||
some potential trades to be hidden (or masked) by previosly open trades.
|
||||
|
||||
The `--eps`/`--enable-position-stacking` argument allows emulation of buying the same pair multiple times,
|
||||
while `--dmmp`/`--disable-max-market-positions` disables applying `max_open_trades`
|
||||
during Hyperopt/Backtesting (which is equal to setting `max_open_trades` to a very high
|
||||
number).
|
||||
|
||||
!!! Note
|
||||
Dry/live runs will **NOT** use position stacking - therefore it does make sense to also validate the strategy without this as it's closer to reality.
|
||||
|
||||
You can also enable position stacking in the configuration file by explicitly setting
|
||||
`"position_stacking"=true`.
|
||||
|
||||
### Reproducible results
|
||||
|
||||
The search for optimal parameters starts with a few (currently 30) random combinations in the hyperspace of parameters, random Hyperopt epochs. These random epochs are marked with a leading asterisk sign at the Hyperopt output.
|
||||
|
||||
The initial state for generation of these random values (random state) is controlled by the value of the `--random-state` command line option. You can set it to some arbitrary value of your choice to obtain reproducible results.
|
||||
|
||||
If you have not set this value explicitly in the command line options, Hyperopt seeds the random state with some random value for you. The random state value for each Hyperopt run is shown in the log, so you can copy and paste it into the `--random-state` command line option to repeat the set of the initial random epochs used.
|
||||
|
||||
If you have not changed anything in the command line options, configuration, timerange, Strategy and Hyperopt classes, historical data and the Loss Function -- you should obtain same hyperoptimization results with same random state value used.
|
||||
|
||||
## Understand the Hyperopt Result
|
||||
|
||||
@@ -205,8 +301,10 @@ Given the following result from hyperopt:
|
||||
|
||||
```
|
||||
Best result:
|
||||
135 trades. Avg profit 0.57%. Total profit 0.03871918 BTC (0.7722Σ%). Avg duration 180.4 mins.
|
||||
with values:
|
||||
|
||||
44/100: 135 trades. Avg profit 0.57%. Total profit 0.03871918 BTC (0.7722Σ%). Avg duration 180.4 mins. Objective: 1.94367
|
||||
|
||||
Buy hyperspace params:
|
||||
{ 'adx-value': 44,
|
||||
'rsi-value': 29,
|
||||
'adx-enabled': False,
|
||||
@@ -225,12 +323,11 @@ method, what those values match to.
|
||||
|
||||
So for example you had `rsi-value: 29.0` so we would look at `rsi`-block, that translates to the following code block:
|
||||
|
||||
```
|
||||
``` python
|
||||
(dataframe['rsi'] < 29.0)
|
||||
```
|
||||
|
||||
Translating your whole hyperopt result as the new buy-signal
|
||||
would then look like:
|
||||
Translating your whole hyperopt result as the new buy-signal would then look like:
|
||||
|
||||
```python
|
||||
def populate_buy_trend(self, dataframe: DataFrame) -> DataFrame:
|
||||
@@ -243,53 +340,135 @@ def populate_buy_trend(self, dataframe: DataFrame) -> DataFrame:
|
||||
return dataframe
|
||||
```
|
||||
|
||||
By default, hyperopt prints colorized results -- epochs with positive profit are printed in the green color. This highlighting helps you find epochs that can be interesting for later analysis. Epochs with zero total profit or with negative profits (losses) are printed in the normal color. If you do not need colorization of results (for instance, when you are redirecting hyperopt output to a file) you can switch colorization off by specifying the `--no-color` option in the command line.
|
||||
|
||||
You can use the `--print-all` command line option if you would like to see all results in the hyperopt output, not only the best ones. When `--print-all` is used, current best results are also colorized by default -- they are printed in bold (bright) style. This can also be switched off with the `--no-color` command line option.
|
||||
|
||||
### Understand Hyperopt ROI results
|
||||
|
||||
If you are optimizing ROI, you're result will look as follows and include a ROI table.
|
||||
If you are optimizing ROI (i.e. if optimization search-space contains 'all', 'default' or 'roi'), your result will look as follows and include a ROI table:
|
||||
|
||||
```
|
||||
Best result:
|
||||
135 trades. Avg profit 0.57%. Total profit 0.03871918 BTC (0.7722Σ%). Avg duration 180.4 mins.
|
||||
with values:
|
||||
{ 'adx-value': 44,
|
||||
'rsi-value': 29,
|
||||
'adx-enabled': false,
|
||||
'rsi-enabled': True,
|
||||
'trigger': 'bb_lower',
|
||||
'roi_t1': 40,
|
||||
'roi_t2': 57,
|
||||
'roi_t3': 21,
|
||||
'roi_p1': 0.03634636907306948,
|
||||
'roi_p2': 0.055237357937802885,
|
||||
'roi_p3': 0.015163796015548354,
|
||||
'stoploss': -0.37996664668703606
|
||||
}
|
||||
|
||||
44/100: 135 trades. Avg profit 0.57%. Total profit 0.03871918 BTC (0.7722Σ%). Avg duration 180.4 mins. Objective: 1.94367
|
||||
|
||||
ROI table:
|
||||
{ 0: 0.10674752302642071,
|
||||
21: 0.09158372701087236,
|
||||
78: 0.03634636907306948,
|
||||
{ 0: 0.10674,
|
||||
21: 0.09158,
|
||||
78: 0.03634,
|
||||
118: 0}
|
||||
```
|
||||
|
||||
This would translate to the following ROI table:
|
||||
In order to use this best ROI table found by Hyperopt in backtesting and for live trades/dry-run, copy-paste it as the value of the `minimal_roi` attribute of your custom strategy:
|
||||
|
||||
``` python
|
||||
```
|
||||
# Minimal ROI designed for the strategy.
|
||||
# This attribute will be overridden if the config file contains "minimal_roi"
|
||||
minimal_roi = {
|
||||
"118": 0,
|
||||
"78": 0.0363463,
|
||||
"21": 0.0915,
|
||||
"0": 0.106
|
||||
0: 0.10674,
|
||||
21: 0.09158,
|
||||
78: 0.03634,
|
||||
118: 0
|
||||
}
|
||||
```
|
||||
As stated in the comment, you can also use it as the value of the `minimal_roi` setting in the configuration file.
|
||||
|
||||
### Validate backtest result
|
||||
#### Default ROI Search Space
|
||||
|
||||
If you are optimizing ROI, Freqtrade creates the 'roi' optimization hyperspace for you -- it's the hyperspace of components for the ROI tables. By default, each ROI table generated by the Freqtrade consists of 4 rows (steps). Hyperopt implements adaptive ranges for ROI tables with ranges for values in the ROI steps that depend on the ticker_interval used. By default the values vary in the following ranges (for some of the most used ticker intervals, values are rounded to 5 digits after the decimal point):
|
||||
|
||||
| # step | 1m | | 5m | | 1h | | 1d | |
|
||||
|---|---|---|---|---|---|---|---|---|
|
||||
| 1 | 0 | 0.01161...0.11992 | 0 | 0.03...0.31 | 0 | 0.06883...0.71124 | 0 | 0.12178...1.25835 |
|
||||
| 2 | 2...8 | 0.00774...0.04255 | 10...40 | 0.02...0.11 | 120...480 | 0.04589...0.25238 | 2880...11520 | 0.08118...0.44651 |
|
||||
| 3 | 4...20 | 0.00387...0.01547 | 20...100 | 0.01...0.04 | 240...1200 | 0.02294...0.09177 | 5760...28800 | 0.04059...0.16237 |
|
||||
| 4 | 6...44 | 0.0 | 30...220 | 0.0 | 360...2640 | 0.0 | 8640...63360 | 0.0 |
|
||||
|
||||
These ranges should be sufficient in most cases. The minutes in the steps (ROI dict keys) are scaled linearly depending on the ticker interval used. The ROI values in the steps (ROI dict values) are scaled logarithmically depending on the ticker interval used.
|
||||
|
||||
If you have the `generate_roi_table()` and `roi_space()` methods in your custom hyperopt file, remove them in order to utilize these adaptive ROI tables and the ROI hyperoptimization space generated by Freqtrade by default.
|
||||
|
||||
Override the `roi_space()` method if you need components of the ROI tables to vary in other ranges. Override the `generate_roi_table()` and `roi_space()` methods and implement your own custom approach for generation of the ROI tables during hyperoptimization if you need a different structure of the ROI tables or other amount of rows (steps). A sample for these methods can be found in [user_data/hyperopts/sample_hyperopt_advanced.py](https://github.com/freqtrade/freqtrade/blob/develop/freqtrade/templates/sample_hyperopt_advanced.py).
|
||||
|
||||
### Understand Hyperopt Stoploss results
|
||||
|
||||
If you are optimizing stoploss values (i.e. if optimization search-space contains 'all', 'default' or 'stoploss'), your result will look as follows and include stoploss:
|
||||
|
||||
```
|
||||
Best result:
|
||||
|
||||
44/100: 135 trades. Avg profit 0.57%. Total profit 0.03871918 BTC (0.7722Σ%). Avg duration 180.4 mins. Objective: 1.94367
|
||||
|
||||
Buy hyperspace params:
|
||||
{ 'adx-value': 44,
|
||||
'rsi-value': 29,
|
||||
'adx-enabled': False,
|
||||
'rsi-enabled': True,
|
||||
'trigger': 'bb_lower'}
|
||||
Stoploss: -0.27996
|
||||
```
|
||||
|
||||
In order to use this best stoploss value found by Hyperopt in backtesting and for live trades/dry-run, copy-paste it as the value of the `stoploss` attribute of your custom strategy:
|
||||
|
||||
```
|
||||
# Optimal stoploss designed for the strategy
|
||||
# This attribute will be overridden if the config file contains "stoploss"
|
||||
stoploss = -0.27996
|
||||
```
|
||||
As stated in the comment, you can also use it as the value of the `stoploss` setting in the configuration file.
|
||||
|
||||
#### Default Stoploss Search Space
|
||||
|
||||
If you are optimizing stoploss values, Freqtrade creates the 'stoploss' optimization hyperspace for you. By default, the stoploss values in that hyperspace vary in the range -0.35...-0.02, which is sufficient in most cases.
|
||||
|
||||
If you have the `stoploss_space()` method in your custom hyperopt file, remove it in order to utilize Stoploss hyperoptimization space generated by Freqtrade by default.
|
||||
|
||||
Override the `stoploss_space()` method and define the desired range in it if you need stoploss values to vary in other range during hyperoptimization. A sample for this method can be found in [user_data/hyperopts/sample_hyperopt_advanced.py](https://github.com/freqtrade/freqtrade/blob/develop/freqtrade/templates/sample_hyperopt_advanced.py).
|
||||
|
||||
### Understand Hyperopt Trailing Stop results
|
||||
|
||||
If you are optimizing trailing stop values (i.e. if optimization search-space contains 'all' or 'trailing'), your result will look as follows and include trailing stop parameters:
|
||||
|
||||
```
|
||||
Best result:
|
||||
|
||||
45/100: 606 trades. Avg profit 1.04%. Total profit 0.31555614 BTC ( 630.48Σ%). Avg duration 150.3 mins. Objective: -1.10161
|
||||
|
||||
Trailing stop:
|
||||
{ 'trailing_only_offset_is_reached': True,
|
||||
'trailing_stop': True,
|
||||
'trailing_stop_positive': 0.02001,
|
||||
'trailing_stop_positive_offset': 0.06038}
|
||||
```
|
||||
|
||||
In order to use these best trailing stop parameters found by Hyperopt in backtesting and for live trades/dry-run, copy-paste them as the values of the corresponding attributes of your custom strategy:
|
||||
|
||||
```
|
||||
# Trailing stop
|
||||
# These attributes will be overridden if the config file contains corresponding values.
|
||||
trailing_stop = True
|
||||
trailing_stop_positive = 0.02001
|
||||
trailing_stop_positive_offset = 0.06038
|
||||
trailing_only_offset_is_reached = True
|
||||
```
|
||||
As stated in the comment, you can also use it as the values of the corresponding settings in the configuration file.
|
||||
|
||||
#### Default Trailing Stop Search Space
|
||||
|
||||
If you are optimizing trailing stop values, Freqtrade creates the 'trailing' optimization hyperspace for you. By default, the `trailing_stop` parameter is always set to True in that hyperspace, the value of the `trailing_only_offset_is_reached` vary between True and False, the values of the `trailing_stop_positive` and `trailing_stop_positive_offset` parameters vary in the ranges 0.02...0.35 and 0.01...0.1 correspondingly, which is sufficient in most cases.
|
||||
|
||||
Override the `trailing_space()` method and define the desired range in it if you need values of the trailing stop parameters to vary in other ranges during hyperoptimization. A sample for this method can be found in [user_data/hyperopts/sample_hyperopt_advanced.py](https://github.com/freqtrade/freqtrade/blob/develop/user_data/hyperopts/sample_hyperopt_advanced.py).
|
||||
|
||||
## Show details of Hyperopt results
|
||||
|
||||
After you run Hyperopt for the desired amount of epochs, you can later list all results for analysis, select only best or profitable once, and show the details for any of the epochs previously evaluated. This can be done with the `hyperopt-list` and `hyperopt-show` subcommands. The usage of these subcommands is described in the [Utils](utils.md#list-hyperopt-results) chapter.
|
||||
|
||||
## Validate backtesting results
|
||||
|
||||
Once the optimized strategy has been implemented into your strategy, you should backtest this strategy to make sure everything is working as expected.
|
||||
To archive the same results (number of trades, ...) than during hyperopt, please use the command line flag `--disable-max-market-positions`.
|
||||
This setting is the default for hyperopt for speed reasons. You can overwrite this in the configuration by setting `"position_stacking"=false` or by changing the relevant line in your hyperopt file [here](https://github.com/freqtrade/freqtrade/blob/develop/freqtrade/optimize/hyperopt.py#L283).
|
||||
|
||||
!!! Note:
|
||||
Dry/live runs will **NOT** use position stacking - therefore it does make sense to also validate the strategy without this as it's closer to reality.
|
||||
To achieve same results (number of trades, their durations, profit, etc.) than during Hyperopt, please use same set of arguments `--dmmp`/`--disable-max-market-positions` and `--eps`/`--enable-position-stacking` for Backtesting.
|
||||
|
||||
## Next Step
|
||||
|
||||
|
||||
@@ -11,37 +11,38 @@
|
||||
<a class="github-button" href="https://github.com/freqtrade/freqtrade/archive/master.zip" data-icon="octicon-cloud-download" data-size="large" aria-label="Download freqtrade/freqtrade on GitHub">Download</a>
|
||||
<!-- Place this tag where you want the button to render. -->
|
||||
<a class="github-button" href="https://github.com/freqtrade" data-size="large" aria-label="Follow @freqtrade on GitHub">Follow @freqtrade</a>
|
||||
|
||||
## Introduction
|
||||
Freqtrade is a cryptocurrency trading bot written in Python.
|
||||
|
||||
Freqtrade is a crypto-currency algorithmic trading software developed in python (3.6+) and supported on Windows, macOS and Linux.
|
||||
|
||||
!!! Danger "DISCLAIMER"
|
||||
This software is for educational purposes only. Do not risk money which you are afraid to lose. USE THE SOFTWARE AT YOUR OWN RISK. THE AUTHORS AND ALL AFFILIATES ASSUME NO RESPONSIBILITY FOR YOUR TRADING RESULTS.
|
||||
|
||||
Always start by running a trading bot in Dry-run and do not engage money before you understand how it works and what profit/loss you should expect.
|
||||
|
||||
We strongly recommend you to have coding and Python knowledge. Do not hesitate to read the source code and understand the mechanism of this bot.
|
||||
|
||||
We strongly recommend you to have basic coding skills and Python knowledge. Do not hesitate to read the source code and understand the mechanisms of this bot, algorithms and techniques implemented in it.
|
||||
|
||||
## Features
|
||||
- Based on Python 3.6+: For botting on any operating system - Windows, macOS and Linux
|
||||
- Persistence: Persistence is achieved through sqlite
|
||||
- Dry-run: Run the bot without playing money.
|
||||
- Backtesting: Run a simulation of your buy/sell strategy.
|
||||
- Strategy Optimization by machine learning: Use machine learning to optimize your buy/sell strategy parameters with real exchange data.
|
||||
- Edge position sizing Calculate your win rate, risk reward ratio, the best stoploss and adjust your position size before taking a position for each specific market. Learn more
|
||||
- Whitelist crypto-currencies: Select which crypto-currency you want to trade or use dynamic whitelists.
|
||||
- Blacklist crypto-currencies: Select which crypto-currency you want to avoid.
|
||||
- Manageable via Telegram: Manage the bot with Telegram
|
||||
- Display profit/loss in fiat: Display your profit/loss in 33 fiat.
|
||||
- Daily summary of profit/loss: Provide a daily summary of your profit/loss.
|
||||
- Performance status report: Provide a performance status of your current trades.
|
||||
|
||||
- Develop your Strategy: Write your strategy in python, using [pandas](https://pandas.pydata.org/). Example strategies to inspire you are available in the [strategy repository](https://github.com/freqtrade/freqtrade-strategies).
|
||||
- Download market data: Download historical data of the exchange and the markets your may want to trade with.
|
||||
- Backtest: Test your strategy on downloaded historical data.
|
||||
- Optimize: Find the best parameters for your strategy using hyperoptimization which employs machining learning methods. You can optimize buy, sell, take profit (ROI), stop-loss and trailing stop-loss parameters for your strategy.
|
||||
- Select markets: Create your static list or use an automatic one based on top traded volumes and/or prices (not available during backtesting). You can also explicitly blacklist markets you don't want to trade.
|
||||
- Run: Test your strategy with simulated money (Dry-Run mode) or deploy it with real money (Live-Trade mode).
|
||||
- Run using Edge (optional module): The concept is to find the best historical [trade expectancy](edge.md#expectancy) by markets based on variation of the stop-loss and then allow/reject markets to trade. The sizing of the trade is based on a risk of a percentage of your capital.
|
||||
- Control/Monitor: Use Telegram or a REST API (start/stop the bot, show profit/loss, daily summary, current open trades results, etc.).
|
||||
- Analyse: Further analysis can be performed on either Backtesting data or Freqtrade trading history (SQL database), including automated standard plots, and methods to load the data into [interactive environments](data-analysis.md).
|
||||
|
||||
## Requirements
|
||||
|
||||
### Up to date clock
|
||||
The clock must be accurate, syncronized to a NTP server very frequently to avoid problems with communication to the exchanges.
|
||||
|
||||
The clock on the system running the bot must be accurate, synchronized to a NTP server frequently enough to avoid problems with communication to the exchanges.
|
||||
|
||||
### Hardware requirements
|
||||
|
||||
To run this bot we recommend you a cloud instance with a minimum of:
|
||||
|
||||
- 2GB RAM
|
||||
@@ -49,19 +50,21 @@ To run this bot we recommend you a cloud instance with a minimum of:
|
||||
- 2vCPU
|
||||
|
||||
### Software requirements
|
||||
|
||||
- Python 3.6.x
|
||||
- pip
|
||||
- pip (pip3)
|
||||
- git
|
||||
- TA-Lib
|
||||
- virtualenv (Recommended)
|
||||
- Docker (Recommended)
|
||||
|
||||
|
||||
## Support
|
||||
Help / Slack
|
||||
For any questions not covered by the documentation or for further information about the bot, we encourage you to join our slack channel.
|
||||
|
||||
Click [here](https://join.slack.com/t/highfrequencybot/shared_invite/enQtMjQ5NTM0OTYzMzY3LWMxYzE3M2MxNDdjMGM3ZTYwNzFjMGIwZGRjNTc3ZGU3MGE3NzdmZGMwNmU3NDM5ZTNmM2Y3NjRiNzk4NmM4OGE) to join Slack channel.
|
||||
### Help / Slack
|
||||
For any questions not covered by the documentation or for further information about the bot, we encourage you to join our passionate Slack community.
|
||||
|
||||
Click [here](https://join.slack.com/t/highfrequencybot/shared_invite/enQtNjU5ODcwNjI1MDU3LTU1MTgxMjkzNmYxNWE1MDEzYzQ3YmU4N2MwZjUyNjJjODRkMDVkNjg4YTAyZGYzYzlhOTZiMTE4ZjQ4YzM0OGE) to join the Freqtrade Slack channel.
|
||||
|
||||
## Ready to try?
|
||||
|
||||
Begin by reading our installation guide [here](installation).
|
||||
@@ -1,72 +1,57 @@
|
||||
# Installation
|
||||
|
||||
This page explains how to prepare your environment for running the bot.
|
||||
|
||||
## Prerequisite
|
||||
Before running your bot in production you will need to setup few
|
||||
external API. In production mode, the bot required valid Bittrex API
|
||||
credentials and a Telegram bot (optional but recommended).
|
||||
|
||||
- [Setup your exchange account](#setup-your-exchange-account)
|
||||
- [Backtesting commands](#setup-your-telegram-bot)
|
||||
### Requirements
|
||||
|
||||
Click each one for install guide:
|
||||
|
||||
* [Python >= 3.6.x](http://docs.python-guide.org/en/latest/starting/installation/)
|
||||
* [pip](https://pip.pypa.io/en/stable/installing/)
|
||||
* [git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)
|
||||
* [virtualenv](https://virtualenv.pypa.io/en/stable/installation/) (Recommended)
|
||||
* [TA-Lib](https://mrjbq7.github.io/ta-lib/install.html) (install instructions below)
|
||||
|
||||
### API keys
|
||||
|
||||
Before running your bot in production you will need to setup few
|
||||
external API. In production mode, the bot will require valid Exchange API
|
||||
credentials. We also recommend a [Telegram bot](telegram-usage.md#setup-your-telegram-bot) (optional but recommended).
|
||||
|
||||
### Setup your exchange account
|
||||
*To be completed, please feel free to complete this section.*
|
||||
|
||||
### Setup your Telegram bot
|
||||
The only things you need is a working Telegram bot and its API token.
|
||||
Below we explain how to create your Telegram Bot, and how to get your
|
||||
Telegram user id.
|
||||
You will need to create API Keys (Usually you get `key` and `secret`) from the Exchange website and insert this into the appropriate fields in the configuration or when asked by the installation script.
|
||||
|
||||
### 1. Create your Telegram bot
|
||||
|
||||
**1.1. Start a chat with https://telegram.me/BotFather**
|
||||
|
||||
**1.2. Send the message `/newbot`. ** *BotFather response:*
|
||||
```
|
||||
Alright, a new bot. How are we going to call it? Please choose a name for your bot.
|
||||
```
|
||||
|
||||
**1.3. Choose the public name of your bot (e.x. `Freqtrade bot`)**
|
||||
*BotFather response:*
|
||||
```
|
||||
Good. Now let's choose a username for your bot. It must end in `bot`. Like this, for example: TetrisBot or tetris_bot.
|
||||
```
|
||||
**1.4. Choose the name id of your bot (e.x "`My_own_freqtrade_bot`")**
|
||||
|
||||
**1.5. Father bot will return you the token (API key)**<br/>
|
||||
Copy it and keep it you will use it for the config parameter `token`.
|
||||
*BotFather response:*
|
||||
```hl_lines="4"
|
||||
Done! Congratulations on your new bot. You will find it at t.me/My_own_freqtrade_bot. You can now add a description, about section and profile picture for your bot, see /help for a list of commands. By the way, when you've finished creating your cool bot, ping our Bot Support if you want a better username for it. Just make sure the bot is fully operational before you do this.
|
||||
|
||||
Use this token to access the HTTP API:
|
||||
521095879:AAEcEZEL7ADJ56FtG_qD0bQJSKETbXCBCi0
|
||||
|
||||
For a description of the Bot API, see this page: https://core.telegram.org/bots/api
|
||||
```
|
||||
**1.6. Don't forget to start the conversation with your bot, by clicking /START button**
|
||||
|
||||
### 2. Get your user id
|
||||
**2.1. Talk to https://telegram.me/userinfobot**
|
||||
|
||||
**2.2. Get your "Id", you will use it for the config parameter
|
||||
`chat_id`.**
|
||||
<hr/>
|
||||
## Quick start
|
||||
Freqtrade provides a Linux/MacOS script to install all dependencies and help you to configure the bot.
|
||||
|
||||
Freqtrade provides the Linux/MacOS Easy Installation script to install all dependencies and help you configure the bot.
|
||||
|
||||
!!! Note
|
||||
Windows installation is explained [here](#windows).
|
||||
|
||||
The easiest way to install and run Freqtrade is to clone the bot GitHub repository and then run the Easy Installation script, if it's available for your platform.
|
||||
|
||||
!!! Note "Version considerations"
|
||||
When cloning the repository the default working branch has the name `develop`. This branch contains all last features (can be considered as relatively stable, thanks to automated tests). The `master` branch contains the code of the last release (done usually once per month on an approximately one week old snapshot of the `develop` branch to prevent packaging bugs, so potentially it's more stable).
|
||||
|
||||
!!! Note
|
||||
Python3.6 or higher and the corresponding `pip` are assumed to be available. The install-script will warn you and stop if that's not the case. `git` is also needed to clone the Freqtrade repository.
|
||||
|
||||
This can be achieved with the following commands:
|
||||
|
||||
```bash
|
||||
git clone git@github.com:freqtrade/freqtrade.git
|
||||
cd freqtrade
|
||||
git checkout develop
|
||||
git checkout master # Optional, see (1)
|
||||
./setup.sh --install
|
||||
```
|
||||
!!! Note
|
||||
Windows installation is explained [here](#windows).
|
||||
<hr/>
|
||||
## Easy Installation - Linux Script
|
||||
(1) This command switches the cloned repository to the use of the `master` branch. It's not needed if you wish to stay on the `develop` branch. You may later switch between branches at any time with the `git checkout master`/`git checkout develop` commands.
|
||||
|
||||
If you are on Debian, Ubuntu or MacOS a freqtrade provides a script to Install, Update, Configure, and Reset your bot.
|
||||
## Easy Installation Script (Linux/MacOS)
|
||||
|
||||
If you are on Debian, Ubuntu or MacOS Freqtrade provides the script to install, update, configure and reset the codebase of your bot.
|
||||
|
||||
```bash
|
||||
$ ./setup.sh
|
||||
@@ -79,208 +64,25 @@ usage:
|
||||
|
||||
** --install **
|
||||
|
||||
This script will install everything you need to run the bot:
|
||||
With this option, the script will install everything you need to run the bot:
|
||||
|
||||
* Mandatory software as: `Python3`, `ta-lib`, `wget`
|
||||
* Mandatory software as: `ta-lib`
|
||||
* Setup your virtualenv
|
||||
* Configure your `config.json` file
|
||||
|
||||
This script is a combination of `install script` `--reset`, `--config`
|
||||
This option is a combination of installation tasks, `--reset` and `--config`.
|
||||
|
||||
** --update **
|
||||
|
||||
Update parameter will pull the last version of your current branch and update your virtualenv.
|
||||
This option will pull the last version of your current branch and update your virtualenv. Run the script with this option periodically to update your bot.
|
||||
|
||||
** --reset **
|
||||
|
||||
Reset parameter will hard reset your branch (only if you are on `master` or `develop`) and recreate your virtualenv.
|
||||
This option will hard reset your branch (only if you are on either `master` or `develop`) and recreate your virtualenv.
|
||||
|
||||
** --config **
|
||||
|
||||
Config parameter is a `config.json` configurator. This script will ask you questions to setup your bot and create your `config.json`.
|
||||
|
||||
------
|
||||
|
||||
## Automatic Installation - Docker
|
||||
|
||||
Start by downloading Docker for your platform:
|
||||
|
||||
* [Mac](https://www.docker.com/products/docker#/mac)
|
||||
* [Windows](https://www.docker.com/products/docker#/windows)
|
||||
* [Linux](https://www.docker.com/products/docker#/linux)
|
||||
|
||||
Once you have Docker installed, simply create the config file (e.g. `config.json`) and then create a Docker image for `freqtrade` using the Dockerfile in this repo.
|
||||
|
||||
### 1. Prepare the Bot
|
||||
|
||||
**1.1. Clone the git repository**
|
||||
|
||||
Linux/Mac/Windows with WSL
|
||||
```bash
|
||||
git clone https://github.com/freqtrade/freqtrade.git
|
||||
```
|
||||
|
||||
Windows with docker
|
||||
```bash
|
||||
git clone --config core.autocrlf=input https://github.com/freqtrade/freqtrade.git
|
||||
```
|
||||
|
||||
**1.2. (Optional) Checkout the develop branch**
|
||||
|
||||
```bash
|
||||
git checkout develop
|
||||
```
|
||||
|
||||
**1.3. Go into the new directory**
|
||||
|
||||
```bash
|
||||
cd freqtrade
|
||||
```
|
||||
|
||||
**1.4. Copy `config.json.example` to `config.json`**
|
||||
|
||||
```bash
|
||||
cp -n config.json.example config.json
|
||||
```
|
||||
|
||||
> To edit the config please refer to the [Bot Configuration](configuration.md) page.
|
||||
|
||||
**1.5. Create your database file *(optional - the bot will create it if it is missing)**
|
||||
|
||||
Production
|
||||
|
||||
```bash
|
||||
touch tradesv3.sqlite
|
||||
````
|
||||
|
||||
Dry-Run
|
||||
|
||||
```bash
|
||||
touch tradesv3.dryrun.sqlite
|
||||
```
|
||||
|
||||
### 2. Download or build the docker image
|
||||
|
||||
Either use the prebuilt image from docker hub - or build the image yourself if you would like more control on which version is used.
|
||||
|
||||
Branches / tags available can be checked out on [Dockerhub](https://hub.docker.com/r/freqtradeorg/freqtrade/tags/).
|
||||
|
||||
**2.1. Download the docker image**
|
||||
|
||||
Pull the image from docker hub and (optionally) change the name of the image
|
||||
|
||||
```bash
|
||||
docker pull freqtradeorg/freqtrade:develop
|
||||
# Optionally tag the repository so the run-commands remain shorter
|
||||
docker tag freqtradeorg/freqtrade:develop freqtrade
|
||||
```
|
||||
|
||||
To update the image, simply run the above commands again and restart your running container.
|
||||
|
||||
**2.2. Build the Docker image**
|
||||
|
||||
```bash
|
||||
cd freqtrade
|
||||
docker build -t freqtrade .
|
||||
```
|
||||
|
||||
If you are developing using Docker, use `Dockerfile.develop` to build a dev Docker image, which will also set up develop dependencies:
|
||||
|
||||
```bash
|
||||
docker build -f ./Dockerfile.develop -t freqtrade-dev .
|
||||
```
|
||||
|
||||
For security reasons, your configuration file will not be included in the image, you will need to bind mount it. It is also advised to bind mount an SQLite database file (see the "5. Run a restartable docker image" section) to keep it between updates.
|
||||
|
||||
### 3. Verify the Docker image
|
||||
|
||||
After the build process you can verify that the image was created with:
|
||||
|
||||
```bash
|
||||
docker images
|
||||
```
|
||||
|
||||
### 4. Run the Docker image
|
||||
|
||||
You can run a one-off container that is immediately deleted upon exiting with the following command (`config.json` must be in the current working directory):
|
||||
|
||||
```bash
|
||||
docker run --rm -v /etc/localtime:/etc/localtime:ro -v `pwd`/config.json:/freqtrade/config.json -it freqtrade
|
||||
```
|
||||
|
||||
There is known issue in OSX Docker versions after 17.09.1, whereby /etc/localtime cannot be shared causing Docker to not start. A work-around for this is to start with the following cmd.
|
||||
|
||||
```bash
|
||||
docker run --rm -e TZ=`ls -la /etc/localtime | cut -d/ -f8-9` -v `pwd`/config.json:/freqtrade/config.json -it freqtrade
|
||||
```
|
||||
|
||||
More information on this docker issue and work-around can be read [here](https://github.com/docker/for-mac/issues/2396).
|
||||
|
||||
In this example, the database will be created inside the docker instance and will be lost when you will refresh your image.
|
||||
|
||||
### 5. Run a restartable docker image
|
||||
|
||||
To run a restartable instance in the background (feel free to place your configuration and database files wherever it feels comfortable on your filesystem).
|
||||
|
||||
**5.1. Move your config file and database**
|
||||
|
||||
```bash
|
||||
mkdir ~/.freqtrade
|
||||
mv config.json ~/.freqtrade
|
||||
mv tradesv3.sqlite ~/.freqtrade
|
||||
```
|
||||
|
||||
**5.2. Run the docker image**
|
||||
|
||||
```bash
|
||||
docker run -d \
|
||||
--name freqtrade \
|
||||
-v /etc/localtime:/etc/localtime:ro \
|
||||
-v ~/.freqtrade/config.json:/freqtrade/config.json \
|
||||
-v ~/.freqtrade/tradesv3.sqlite:/freqtrade/tradesv3.sqlite \
|
||||
freqtrade --db-url sqlite:///tradesv3.sqlite
|
||||
```
|
||||
|
||||
!!! Note
|
||||
db-url defaults to `sqlite:///tradesv3.sqlite` but it defaults to `sqlite://` if `dry_run=True` is being used.
|
||||
To override this behaviour use a custom db-url value: i.e.: `--db-url sqlite:///tradesv3.dryrun.sqlite`
|
||||
|
||||
### 6. Monitor your Docker instance
|
||||
|
||||
You can then use the following commands to monitor and manage your container:
|
||||
|
||||
```bash
|
||||
docker logs freqtrade
|
||||
docker logs -f freqtrade
|
||||
docker restart freqtrade
|
||||
docker stop freqtrade
|
||||
docker start freqtrade
|
||||
```
|
||||
|
||||
For more information on how to operate Docker, please refer to the [official Docker documentation](https://docs.docker.com/).
|
||||
|
||||
!!! Note
|
||||
You do not need to rebuild the image for configuration changes, it will suffice to edit `config.json` and restart the container.
|
||||
|
||||
### 7. Backtest with docker
|
||||
|
||||
The following assumes that the above steps (1-4) have been completed successfully.
|
||||
Also, backtest-data should be available at `~/.freqtrade/user_data/`.
|
||||
|
||||
```bash
|
||||
docker run -d \
|
||||
--name freqtrade \
|
||||
-v /etc/localtime:/etc/localtime:ro \
|
||||
-v ~/.freqtrade/config.json:/freqtrade/config.json \
|
||||
-v ~/.freqtrade/tradesv3.sqlite:/freqtrade/tradesv3.sqlite \
|
||||
-v ~/.freqtrade/user_data/:/freqtrade/user_data/ \
|
||||
freqtrade --strategy AwsomelyProfitableStrategy backtesting
|
||||
```
|
||||
|
||||
Head over to the [Backtesting Documentation](backtesting.md) for more details.
|
||||
|
||||
!!! Note
|
||||
Additional parameters can be appended after the image name (`freqtrade` in the above example).
|
||||
Use this option to configure the `config.json` configuration file. The script will interactively ask you questions to setup your bot and create your `config.json`.
|
||||
|
||||
------
|
||||
|
||||
@@ -289,55 +91,39 @@ Head over to the [Backtesting Documentation](backtesting.md) for more details.
|
||||
We've included/collected install instructions for Ubuntu 16.04, MacOS, and Windows. These are guidelines and your success may vary with other distros.
|
||||
OS Specific steps are listed first, the [Common](#common) section below is necessary for all systems.
|
||||
|
||||
### Requirements
|
||||
|
||||
Click each one for install guide:
|
||||
|
||||
* [Python >= 3.6.x](http://docs.python-guide.org/en/latest/starting/installation/)
|
||||
* [pip](https://pip.pypa.io/en/stable/installing/)
|
||||
* [git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)
|
||||
* [virtualenv](https://virtualenv.pypa.io/en/stable/installation/) (Recommended)
|
||||
* [TA-Lib](https://mrjbq7.github.io/ta-lib/install.html)
|
||||
!!! Note
|
||||
Python3.6 or higher and the corresponding pip are assumed to be available.
|
||||
|
||||
### Linux - Ubuntu 16.04
|
||||
|
||||
#### Install Python 3.6, Git, and wget
|
||||
#### Install necessary dependencies
|
||||
|
||||
```bash
|
||||
sudo add-apt-repository ppa:jonathonf/python-3.6
|
||||
sudo apt-get update
|
||||
sudo apt-get install python3.6 python3.6-venv python3.6-dev build-essential autoconf libtool pkg-config make wget git
|
||||
sudo apt-get install build-essential git
|
||||
```
|
||||
|
||||
#### Raspberry Pi / Raspbian
|
||||
### Raspberry Pi / Raspbian
|
||||
|
||||
Before installing FreqTrade on a Raspberry Pi running the official Raspbian Image, make sure you have at least Python 3.6 installed. The default image only provides Python 3.5. Probably the easiest way to get a recent version of python is [miniconda](https://repo.continuum.io/miniconda/).
|
||||
The following assumes the latest [Raspbian Buster lite image](https://www.raspberrypi.org/downloads/raspbian/) from at least September 2019.
|
||||
This image comes with python3.7 preinstalled, making it easy to get freqtrade up and running.
|
||||
|
||||
The following assumes that miniconda3 is installed and available in your environment. Last miniconda3 installation file use python 3.4, we will update to python 3.6 on this installation.
|
||||
It's recommended to use (mini)conda for this as installation/compilation of `numpy`, `scipy` and `pandas` takes a long time.
|
||||
If you have installed it from (mini)conda, you can remove `numpy`, `scipy`, and `pandas` from `requirements.txt` before you install it with `pip`.
|
||||
|
||||
Additional package to install on your Raspbian, `libffi-dev` required by cryptography (from python-telegram-bot).
|
||||
Tested using a Raspberry Pi 3 with the Raspbian Buster lite image, all updates applied.
|
||||
|
||||
``` bash
|
||||
conda config --add channels rpi
|
||||
conda install python=3.6
|
||||
conda create -n freqtrade python=3.6
|
||||
conda activate freqtrade
|
||||
conda install scipy pandas numpy
|
||||
sudo apt-get install python3-venv libatlas-base-dev
|
||||
git clone https://github.com/freqtrade/freqtrade.git
|
||||
cd freqtrade
|
||||
|
||||
sudo apt install libffi-dev
|
||||
python3 -m pip install -r requirements.txt
|
||||
python3 -m pip install -e .
|
||||
bash setup.sh -i
|
||||
```
|
||||
|
||||
### MacOS
|
||||
!!! Note "Installation duration"
|
||||
Depending on your internet speed and the Raspberry Pi version, installation can take multiple hours to complete.
|
||||
|
||||
#### Install Python 3.6, git and wget
|
||||
|
||||
```bash
|
||||
brew install python3 git wget
|
||||
```
|
||||
!!! Note
|
||||
The above does not install hyperopt dependencies. To install these, please use `python3 -m pip install -e .[hyperopt]`.
|
||||
We do not advise to run hyperopt on a Raspberry Pi, since this is a very resource-heavy operation, which should be done on powerful machine.
|
||||
|
||||
### Common
|
||||
|
||||
@@ -370,83 +156,87 @@ python3 -m venv .env
|
||||
source .env/bin/activate
|
||||
```
|
||||
|
||||
#### 3. Install FreqTrade
|
||||
#### 3. Install Freqtrade
|
||||
|
||||
Clone the git repository:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/freqtrade/freqtrade.git
|
||||
|
||||
cd freqtrade
|
||||
```
|
||||
|
||||
Optionally checkout the stable/master branch:
|
||||
Optionally checkout the master branch to get the latest stable release:
|
||||
|
||||
```bash
|
||||
git checkout master
|
||||
```
|
||||
|
||||
#### 4. Initialize the configuration
|
||||
#### 4. Install python dependencies
|
||||
|
||||
``` bash
|
||||
cd freqtrade
|
||||
python3 -m pip install --upgrade pip
|
||||
python3 -m pip install -e .
|
||||
```
|
||||
|
||||
#### 5. Initialize the configuration
|
||||
|
||||
```bash
|
||||
# Initialize the user_directory
|
||||
freqtrade create-userdir --userdir user_data/
|
||||
|
||||
cp config.json.example config.json
|
||||
```
|
||||
|
||||
> *To edit the config please refer to [Bot Configuration](configuration.md).*
|
||||
|
||||
#### 5. Install python dependencies
|
||||
|
||||
``` bash
|
||||
pip3 install --upgrade pip
|
||||
pip3 install -r requirements.txt
|
||||
pip3 install -e .
|
||||
```
|
||||
|
||||
#### 6. Run the Bot
|
||||
|
||||
If this is the first time you run the bot, ensure you are running it in Dry-run `"dry_run": true,` otherwise it will start to buy and sell coins.
|
||||
|
||||
```bash
|
||||
python3.6 ./freqtrade/main.py -c config.json
|
||||
freqtrade trade -c config.json
|
||||
```
|
||||
|
||||
*Note*: If you run the bot on a server, you should consider using [Docker](#automatic-installation---docker) a terminal multiplexer like `screen` or [`tmux`](https://en.wikipedia.org/wiki/Tmux) to avoid that the bot is stopped on logout.
|
||||
*Note*: If you run the bot on a server, you should consider using [Docker](docker.md) or a terminal multiplexer like `screen` or [`tmux`](https://en.wikipedia.org/wiki/Tmux) to avoid that the bot is stopped on logout.
|
||||
|
||||
#### 7. [Optional] Configure `freqtrade` as a `systemd` service
|
||||
#### 7. (Optional) Post-installation Tasks
|
||||
|
||||
From the freqtrade repo... copy `freqtrade.service` to your systemd user directory (usually `~/.config/systemd/user`) and update `WorkingDirectory` and `ExecStart` to match your setup.
|
||||
|
||||
After that you can start the daemon with:
|
||||
|
||||
```bash
|
||||
systemctl --user start freqtrade
|
||||
```
|
||||
|
||||
For this to be persistent (run when user is logged out) you'll need to enable `linger` for your freqtrade user.
|
||||
|
||||
```bash
|
||||
sudo loginctl enable-linger "$USER"
|
||||
```
|
||||
On Linux, as an optional post-installation task, you may wish to setup the bot to run as a `systemd` service or configure it to send the log messages to the `syslog`/`rsyslog` or `journald` daemons. See [Advanced Logging](advanced-setup.md#advanced-logging) for details.
|
||||
|
||||
------
|
||||
|
||||
## Using Conda
|
||||
|
||||
Freqtrade can also be installed using Anaconda (or Miniconda).
|
||||
|
||||
``` bash
|
||||
conda env create -f environment.yml
|
||||
```
|
||||
|
||||
!!! Note
|
||||
This requires the [ta-lib](#1-install-ta-lib) C-library to be installed first.
|
||||
|
||||
## Windows
|
||||
|
||||
We recommend that Windows users use [Docker](#docker) as this will work much easier and smoother (also more secure).
|
||||
We recommend that Windows users use [Docker](docker.md) as this will work much easier and smoother (also more secure).
|
||||
|
||||
If that is not possible, try using the Windows Linux subsystem (WSL) - for which the Ubuntu instructions should work.
|
||||
If that is not available on your system, feel free to try the instructions below, which led to success for some.
|
||||
|
||||
### Install freqtrade manually
|
||||
|
||||
!!! Note
|
||||
Make sure to use 64bit Windows and 64bit Python to avoid problems with backtesting or hyperopt due to the memory constraints 32bit applications have under Windows.
|
||||
|
||||
!!! Hint
|
||||
Using the [Anaconda Distribution](https://www.anaconda.com/distribution/) under Windows can greatly help with installation problems. Check out the [Conda section](#using-conda) in this document for more information.
|
||||
|
||||
#### Clone the git repository
|
||||
|
||||
```bash
|
||||
git clone https://github.com/freqtrade/freqtrade.git
|
||||
```
|
||||
|
||||
copy paste `config.json` to ``\path\freqtrade-develop\freqtrade`
|
||||
|
||||
#### Install ta-lib
|
||||
|
||||
Install ta-lib according to the [ta-lib documentation](https://github.com/mrjbq7/ta-lib#windows).
|
||||
@@ -456,14 +246,12 @@ As compiling from source on windows has heavy dependencies (requires a partial v
|
||||
```cmd
|
||||
>cd \path\freqtrade-develop
|
||||
>python -m venv .env
|
||||
>cd .env\Scripts
|
||||
>activate.bat
|
||||
>cd \path\freqtrade-develop
|
||||
>.env\Scripts\activate.bat
|
||||
REM optionally install ta-lib from wheel
|
||||
REM >pip install TA_Lib‑0.4.17‑cp36‑cp36m‑win32.whl
|
||||
>pip install -r requirements.txt
|
||||
>pip install -e .
|
||||
>python freqtrade\main.py
|
||||
>freqtrade
|
||||
```
|
||||
|
||||
> Thanks [Owdr](https://github.com/Owdr) for the commands. Source: [Issue #222](https://github.com/freqtrade/freqtrade/issues/222)
|
||||
@@ -476,9 +264,24 @@ error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++
|
||||
|
||||
Unfortunately, many packages requiring compilation don't provide a pre-build wheel. It is therefore mandatory to have a C/C++ compiler installed and available for your python environment to use.
|
||||
|
||||
The easiest way is to download install Microsoft Visual Studio Community [here](https://visualstudio.microsoft.com/downloads/) and make sure to install "Common Tools for Visual C++" to enable building c code on Windows. Unfortunately, this is a heavy download / dependency (~4Gb) so you might want to consider WSL or docker first.
|
||||
The easiest way is to download install Microsoft Visual Studio Community [here](https://visualstudio.microsoft.com/downloads/) and make sure to install "Common Tools for Visual C++" to enable building c code on Windows. Unfortunately, this is a heavy download / dependency (~4Gb) so you might want to consider WSL or [docker](docker.md) first.
|
||||
|
||||
---
|
||||
|
||||
Now you have an environment ready, the next step is
|
||||
[Bot Configuration](configuration.md).
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### MacOS installation error
|
||||
|
||||
Newer versions of MacOS may have installation failed with errors like `error: command 'g++' failed with exit status 1`.
|
||||
|
||||
This error will require explicit installation of the SDK Headers, which are not installed by default in this version of MacOS.
|
||||
For MacOS 10.14, this can be accomplished with the below command.
|
||||
|
||||
``` bash
|
||||
open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
|
||||
```
|
||||
|
||||
If this file is inexistant, then you're probably on a different version of MacOS, so you may need to consult the internet for specific resolution details.
|
||||
|
||||
@@ -49,4 +49,6 @@
|
||||
</nav>
|
||||
<!-- Place this tag in your head or just before your close body tag. -->
|
||||
<script async defer src="https://buttons.github.io/buttons.js"></script>
|
||||
<script src="https://code.jquery.com/jquery-3.4.1.min.js"
|
||||
integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
|
||||
</header>
|
||||
283
docs/plotting.md
283
docs/plotting.md
@@ -1,88 +1,271 @@
|
||||
# Plotting
|
||||
This page explains how to plot prices, indicator, profits.
|
||||
|
||||
## Installation
|
||||
This page explains how to plot prices, indicators and profits.
|
||||
|
||||
Plotting scripts use Plotly library. Install/upgrade it with:
|
||||
## Installation / Setup
|
||||
|
||||
Plotting modules use the Plotly library. You can install / upgrade this by running the following command:
|
||||
|
||||
``` bash
|
||||
pip install -U -r requirements-plot.txt
|
||||
```
|
||||
pip install --upgrade plotly
|
||||
```
|
||||
|
||||
At least version 2.3.0 is required.
|
||||
|
||||
## Plot price and indicators
|
||||
Usage for the price plotter:
|
||||
|
||||
The `freqtrade plot-dataframe` subcommand shows an interactive graph with three subplots:
|
||||
|
||||
* Main plot with candlestics and indicators following price (sma/ema)
|
||||
* Volume bars
|
||||
* Additional indicators as specified by `--indicators2`
|
||||
|
||||

|
||||
|
||||
Possible arguments:
|
||||
|
||||
```
|
||||
script/plot_dataframe.py [-h] [-p pairs] [--live]
|
||||
usage: freqtrade plot-dataframe [-h] [-v] [--logfile FILE] [-V] [-c PATH] [-d PATH] [--userdir PATH] [-s NAME]
|
||||
[--strategy-path PATH] [-p PAIRS [PAIRS ...]] [--indicators1 INDICATORS1 [INDICATORS1 ...]]
|
||||
[--indicators2 INDICATORS2 [INDICATORS2 ...]] [--plot-limit INT] [--db-url PATH]
|
||||
[--trade-source {DB,file}] [--export EXPORT] [--export-filename PATH] [--timerange TIMERANGE]
|
||||
[-i TICKER_INTERVAL]
|
||||
|
||||
optional arguments:
|
||||
-h, --help show this help message and exit
|
||||
-p PAIRS [PAIRS ...], --pairs PAIRS [PAIRS ...]
|
||||
Show profits for only these pairs. Pairs are space-separated.
|
||||
--indicators1 INDICATORS1 [INDICATORS1 ...]
|
||||
Set indicators from your strategy you want in the first row of the graph. Space-separated list. Example:
|
||||
`ema3 ema5`. Default: `['sma', 'ema3', 'ema5']`.
|
||||
--indicators2 INDICATORS2 [INDICATORS2 ...]
|
||||
Set indicators from your strategy you want in the third row of the graph. Space-separated list. Example:
|
||||
`fastd fastk`. Default: `['macd', 'macdsignal']`.
|
||||
--plot-limit INT Specify tick limit for plotting. Notice: too high values cause huge files. Default: 750.
|
||||
--db-url PATH Override trades database URL, this is useful in custom deployments (default: `sqlite:///tradesv3.sqlite`
|
||||
for Live Run mode, `sqlite:///tradesv3.dryrun.sqlite` for Dry Run).
|
||||
--trade-source {DB,file}
|
||||
Specify the source for trades (Can be DB or file (backtest file)) Default: file
|
||||
--export EXPORT Export backtest results, argument are: trades. Example: `--export=trades`
|
||||
--export-filename PATH
|
||||
Save backtest results to the file with this filename. Requires `--export` to be set as well. Example:
|
||||
`--export-filename=user_data/backtest_results/backtest_today.json`
|
||||
--timerange TIMERANGE
|
||||
Specify what timerange of data to use.
|
||||
-i TICKER_INTERVAL, --ticker-interval TICKER_INTERVAL
|
||||
Specify ticker interval (`1m`, `5m`, `30m`, `1h`, `1d`).
|
||||
|
||||
Common arguments:
|
||||
-v, --verbose Verbose mode (-vv for more, -vvv to get all messages).
|
||||
--logfile FILE Log to the file specified. Special values are: 'syslog', 'journald'. See the documentation for more
|
||||
details.
|
||||
-V, --version show program's version number and exit
|
||||
-c PATH, --config PATH
|
||||
Specify configuration file (default: `config.json`). Multiple --config options may be used. Can be set to
|
||||
`-` to read config from stdin.
|
||||
-d PATH, --datadir PATH
|
||||
Path to directory with historical backtesting data.
|
||||
--userdir PATH, --user-data-dir PATH
|
||||
Path to userdata directory.
|
||||
|
||||
Strategy arguments:
|
||||
-s NAME, --strategy NAME
|
||||
Specify strategy class name which will be used by the bot.
|
||||
--strategy-path PATH Specify additional strategy lookup path.
|
||||
|
||||
```
|
||||
|
||||
Example
|
||||
```
|
||||
python scripts/plot_dataframe.py -p BTC/ETH
|
||||
Example:
|
||||
|
||||
``` bash
|
||||
freqtrade plot-dataframe -p BTC/ETH
|
||||
```
|
||||
|
||||
The `-p` pairs argument, can be used to specify
|
||||
pairs you would like to plot.
|
||||
The `-p/--pairs` argument can be used to specify pairs you would like to plot.
|
||||
|
||||
**Advanced use**
|
||||
!!! Note
|
||||
The `freqtrade plot-dataframe` subcommand generates one plot-file per pair.
|
||||
|
||||
To plot multiple pairs, separate them with a comma:
|
||||
```
|
||||
python scripts/plot_dataframe.py -p BTC/ETH,XRP/ETH
|
||||
Specify custom indicators.
|
||||
Use `--indicators1` for the main plot and `--indicators2` for the subplot below (if values are in a different range than prices).
|
||||
|
||||
!!! Tip
|
||||
You will almost certainly want to specify a custom strategy! This can be done by adding `-s Classname` / `--strategy ClassName` to the command.
|
||||
|
||||
``` bash
|
||||
freqtrade plot-dataframe --strategy AwesomeStrategy -p BTC/ETH --indicators1 sma ema --indicators2 macd
|
||||
```
|
||||
|
||||
To plot the current live price use the `--live` flag:
|
||||
```
|
||||
python scripts/plot_dataframe.py -p BTC/ETH --live
|
||||
### Further usage examples
|
||||
|
||||
To plot multiple pairs, separate them with a space:
|
||||
|
||||
``` bash
|
||||
freqtrade plot-dataframe --strategy AwesomeStrategy -p BTC/ETH XRP/ETH
|
||||
```
|
||||
|
||||
To plot a timerange (to zoom in):
|
||||
```
|
||||
python scripts/plot_dataframe.py -p BTC/ETH --timerange=100-200
|
||||
```
|
||||
Timerange doesn't work with live data.
|
||||
To plot a timerange (to zoom in)
|
||||
|
||||
To plot trades stored in a database use `--db-url` argument:
|
||||
```
|
||||
python scripts/plot_dataframe.py --db-url sqlite:///tradesv3.dry_run.sqlite -p BTC/ETH
|
||||
``` bash
|
||||
freqtrade plot-dataframe --strategy AwesomeStrategy -p BTC/ETH --timerange=20180801-20180805
|
||||
```
|
||||
|
||||
To plot a test strategy the strategy should have first be backtested.
|
||||
The results may then be plotted with the -s argument:
|
||||
To plot trades stored in a database use `--db-url` in combination with `--trade-source DB`:
|
||||
|
||||
``` bash
|
||||
freqtrade plot-dataframe --strategy AwesomeStrategy --db-url sqlite:///tradesv3.dry_run.sqlite -p BTC/ETH --trade-source DB
|
||||
```
|
||||
python scripts/plot_dataframe.py -s Strategy_Name -p BTC/ETH --datadir user_data/data/<exchange_name>/
|
||||
|
||||
To plot trades from a backtesting result, use `--export-filename <filename>`
|
||||
|
||||
``` bash
|
||||
freqtrade plot-dataframe --strategy AwesomeStrategy --export-filename user_data/backtest_results/backtest-result.json -p BTC/ETH
|
||||
```
|
||||
|
||||
### Plot dataframe basics
|
||||
|
||||

|
||||
|
||||
The `plot-dataframe` subcommand requires backtesting data, a strategy and either a backtesting-results file or a database, containing trades corresponding to the strategy.
|
||||
|
||||
The resulting plot will have the following elements:
|
||||
|
||||
* Green triangles: Buy signals from the strategy. (Note: not every buy signal generates a trade, compare to cyan circles.)
|
||||
* Red triangles: Sell signals from the strategy. (Also, not every sell signal terminates a trade, compare to red and green squares.)
|
||||
* Cyan circles: Trade entry points.
|
||||
* Red squares: Trade exit points for trades with loss or 0% profit.
|
||||
* Green squares: Trade exit points for profitable trades.
|
||||
* Indicators with values corresponding to the candle scale (e.g. SMA/EMA), as specified with `--indicators1`.
|
||||
* Volume (bar chart at the bottom of the main chart).
|
||||
* Indicators with values in different scales (e.g. MACD, RSI) below the volume bars, as specified with `--indicators2`.
|
||||
|
||||
!!! Note "Bollinger Bands"
|
||||
Bollinger bands are automatically added to the plot if the columns `bb_lowerband` and `bb_upperband` exist, and are painted as a light blue area spanning from the lower band to the upper band.
|
||||
|
||||
#### Advanced plot configuration
|
||||
|
||||
An advanced plot configuration can be specified in the strategy in the `plot_config` parameter.
|
||||
|
||||
Additional features when using plot_config include:
|
||||
|
||||
* Specify colors per indicator
|
||||
* Specify additional subplots
|
||||
|
||||
The sample plot configuration below specifies fixed colors for the indicators. Otherwise consecutive plots may produce different colorschemes each time, making comparisons difficult.
|
||||
It also allows multiple subplots to display both MACD and RSI at the same time.
|
||||
|
||||
Sample configuration with inline comments explaining the process:
|
||||
|
||||
``` python
|
||||
plot_config = {
|
||||
'main_plot': {
|
||||
# Configuration for main plot indicators.
|
||||
# Specifies `ema10` to be red, and `ema50` to be a shade of gray
|
||||
'ema10': {'color': 'red'},
|
||||
'ema50': {'color': '#CCCCCC'},
|
||||
# By omitting color, a random color is selected.
|
||||
'sar': {},
|
||||
},
|
||||
'subplots': {
|
||||
# Create subplot MACD
|
||||
"MACD": {
|
||||
'macd': {'color': 'blue'},
|
||||
'macdsignal': {'color': 'orange'},
|
||||
},
|
||||
# Additional subplot RSI
|
||||
"RSI": {
|
||||
'rsi': {'color': 'red'},
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
!!! Note
|
||||
The above configuration assumes that `ema10`, `ema50`, `macd`, `macdsignal` and `rsi` are columns in the DataFrame created by the strategy.
|
||||
|
||||
## Plot profit
|
||||
|
||||
The profit plotter show a picture with three plots:
|
||||
1) Average closing price for all pairs
|
||||
2) The summarized profit made by backtesting.
|
||||
Note that this is not the real-world profit, but
|
||||
more of an estimate.
|
||||
3) Each pair individually profit
|
||||

|
||||
|
||||
The first graph is good to get a grip of how the overall market
|
||||
progresses.
|
||||
The `plot-profit` subcommand shows an interactive graph with three plots:
|
||||
|
||||
The second graph will show how you algorithm works or doesnt.
|
||||
Perhaps you want an algorithm that steadily makes small profits,
|
||||
or one that acts less seldom, but makes big swings.
|
||||
* Average closing price for all pairs.
|
||||
* The summarized profit made by backtesting.
|
||||
Note that this is not the real-world profit, but more of an estimate.
|
||||
* Profit for each individual pair.
|
||||
|
||||
The third graph can be useful to spot outliers, events in pairs
|
||||
that makes profit spikes.
|
||||
The first graph is good to get a grip of how the overall market progresses.
|
||||
|
||||
Usage for the profit plotter:
|
||||
The second graph will show if your algorithm works or doesn't.
|
||||
Perhaps you want an algorithm that steadily makes small profits, or one that acts less often, but makes big swings.
|
||||
|
||||
The third graph can be useful to spot outliers, events in pairs that cause profit spikes.
|
||||
|
||||
Possible options for the `freqtrade plot-profit` subcommand:
|
||||
|
||||
```
|
||||
script/plot_profit.py [-h] [-p pair] [--datadir directory] [--ticker_interval num]
|
||||
usage: freqtrade plot-profit [-h] [-v] [--logfile FILE] [-V] [-c PATH]
|
||||
[-d PATH] [--userdir PATH] [-p PAIRS [PAIRS ...]]
|
||||
[--timerange TIMERANGE] [--export EXPORT]
|
||||
[--export-filename PATH] [--db-url PATH]
|
||||
[--trade-source {DB,file}] [-i TICKER_INTERVAL]
|
||||
|
||||
optional arguments:
|
||||
-h, --help show this help message and exit
|
||||
-p PAIRS [PAIRS ...], --pairs PAIRS [PAIRS ...]
|
||||
Show profits for only these pairs. Pairs are space-
|
||||
separated.
|
||||
--timerange TIMERANGE
|
||||
Specify what timerange of data to use.
|
||||
--export EXPORT Export backtest results, argument are: trades.
|
||||
Example: `--export=trades`
|
||||
--export-filename PATH
|
||||
Save backtest results to the file with this filename.
|
||||
Requires `--export` to be set as well. Example:
|
||||
`--export-filename=user_data/backtest_results/backtest
|
||||
_today.json`
|
||||
--db-url PATH Override trades database URL, this is useful in custom
|
||||
deployments (default: `sqlite:///tradesv3.sqlite` for
|
||||
Live Run mode, `sqlite:///tradesv3.dryrun.sqlite` for
|
||||
Dry Run).
|
||||
--trade-source {DB,file}
|
||||
Specify the source for trades (Can be DB or file
|
||||
(backtest file)) Default: file
|
||||
-i TICKER_INTERVAL, --ticker-interval TICKER_INTERVAL
|
||||
Specify ticker interval (`1m`, `5m`, `30m`, `1h`,
|
||||
`1d`).
|
||||
|
||||
Common arguments:
|
||||
-v, --verbose Verbose mode (-vv for more, -vvv to get all messages).
|
||||
--logfile FILE Log to the file specified. Special values are:
|
||||
'syslog', 'journald'. See the documentation for more
|
||||
details.
|
||||
-V, --version show program's version number and exit
|
||||
-c PATH, --config PATH
|
||||
Specify configuration file (default: `config.json`).
|
||||
Multiple --config options may be used. Can be set to
|
||||
`-` to read config from stdin.
|
||||
-d PATH, --datadir PATH
|
||||
Path to directory with historical backtesting data.
|
||||
--userdir PATH, --user-data-dir PATH
|
||||
Path to userdata directory.
|
||||
|
||||
```
|
||||
|
||||
The `-p` pair argument, can be used to plot a single pair
|
||||
The `-p/--pairs` argument, can be used to limit the pairs that are considered for this calculation.
|
||||
|
||||
Example
|
||||
Examples:
|
||||
|
||||
Use custom backtest-export file
|
||||
|
||||
``` bash
|
||||
freqtrade plot-profit -p LTC/BTC --export-filename user_data/backtest_results/backtest-result-Strategy005.json
|
||||
```
|
||||
python3 scripts/plot_profit.py --datadir ../freqtrade/freqtrade/tests/testdata-20171221/ -p BTC_LTC
|
||||
|
||||
Use custom database
|
||||
|
||||
``` bash
|
||||
freqtrade plot-profit -p LTC/BTC --db-url sqlite:///tradesv3.sqlite --trade-source DB
|
||||
```
|
||||
|
||||
``` bash
|
||||
freqtrade --datadir user_data/data/binance_save/ plot-profit -p LTC/BTC
|
||||
```
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
mkdocs-material==3.1.0
|
||||
mkdocs-material==4.6.0
|
||||
mdx_truly_sane_lists==1.2
|
||||
|
||||
204
docs/rest-api.md
Normal file
204
docs/rest-api.md
Normal file
@@ -0,0 +1,204 @@
|
||||
# REST API Usage
|
||||
|
||||
## Configuration
|
||||
|
||||
Enable the rest API by adding the api_server section to your configuration and setting `api_server.enabled` to `true`.
|
||||
|
||||
Sample configuration:
|
||||
|
||||
``` json
|
||||
"api_server": {
|
||||
"enabled": true,
|
||||
"listen_ip_address": "127.0.0.1",
|
||||
"listen_port": 8080,
|
||||
"username": "Freqtrader",
|
||||
"password": "SuperSecret1!"
|
||||
},
|
||||
```
|
||||
|
||||
!!! Danger "Security warning"
|
||||
By default, the configuration listens on localhost only (so it's not reachable from other systems). We strongly recommend to not expose this API to the internet and choose a strong, unique password, since others will potentially be able to control your bot.
|
||||
|
||||
!!! Danger "Password selection"
|
||||
Please make sure to select a very strong, unique password to protect your bot from unauthorized access.
|
||||
|
||||
You can then access the API by going to `http://127.0.0.1:8080/api/v1/ping` in a browser to check if the API is running correctly.
|
||||
This should return the response:
|
||||
|
||||
``` output
|
||||
{"status":"pong"}
|
||||
```
|
||||
|
||||
All other endpoints return sensitive info and require authentication, so are not available through a web browser.
|
||||
|
||||
To generate a secure password, either use a password manager, or use the below code snipped.
|
||||
|
||||
``` python
|
||||
import secrets
|
||||
secrets.token_hex()
|
||||
```
|
||||
|
||||
### Configuration with docker
|
||||
|
||||
If you run your bot using docker, you'll need to have the bot listen to incomming connections. The security is then handled by docker.
|
||||
|
||||
``` json
|
||||
"api_server": {
|
||||
"enabled": true,
|
||||
"listen_ip_address": "0.0.0.0",
|
||||
"listen_port": 8080
|
||||
},
|
||||
```
|
||||
|
||||
Add the following to your docker command:
|
||||
|
||||
``` bash
|
||||
-p 127.0.0.1:8080:8080
|
||||
```
|
||||
|
||||
A complete sample-command may then look as follows:
|
||||
|
||||
```bash
|
||||
docker run -d \
|
||||
--name freqtrade \
|
||||
-v ~/.freqtrade/config.json:/freqtrade/config.json \
|
||||
-v ~/.freqtrade/user_data/:/freqtrade/user_data \
|
||||
-v ~/.freqtrade/tradesv3.sqlite:/freqtrade/tradesv3.sqlite \
|
||||
-p 127.0.0.1:8080:8080 \
|
||||
freqtrade trade --db-url sqlite:///tradesv3.sqlite --strategy MyAwesomeStrategy
|
||||
```
|
||||
|
||||
!!! Danger "Security warning"
|
||||
By using `-p 8080:8080` the API is available to everyone connecting to the server under the correct port, so others may be able to control your bot.
|
||||
|
||||
## Consuming the API
|
||||
|
||||
You can consume the API by using the script `scripts/rest_client.py`.
|
||||
The client script only requires the `requests` module, so FreqTrade does not need to be installed on the system.
|
||||
|
||||
``` bash
|
||||
python3 scripts/rest_client.py <command> [optional parameters]
|
||||
```
|
||||
|
||||
By default, the script assumes `127.0.0.1` (localhost) and port `8080` to be used, however you can specify a configuration file to override this behaviour.
|
||||
|
||||
### Minimalistic client config
|
||||
|
||||
``` json
|
||||
{
|
||||
"api_server": {
|
||||
"enabled": true,
|
||||
"listen_ip_address": "0.0.0.0",
|
||||
"listen_port": 8080
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
``` bash
|
||||
python3 scripts/rest_client.py --config rest_config.json <command> [optional parameters]
|
||||
```
|
||||
|
||||
## Available commands
|
||||
|
||||
| Command | Default | Description |
|
||||
|----------|---------|-------------|
|
||||
| `start` | | Starts the trader
|
||||
| `stop` | | Stops the trader
|
||||
| `stopbuy` | | Stops the trader from opening new trades. Gracefully closes open trades according to their rules.
|
||||
| `reload_conf` | | Reloads the configuration file
|
||||
| `show_config` | | Shows part of the current configuration with relevant settings to operation
|
||||
| `status` | | Lists all open trades
|
||||
| `count` | | Displays number of trades used and available
|
||||
| `profit` | | Display a summary of your profit/loss from close trades and some stats about your performance
|
||||
| `forcesell <trade_id>` | | Instantly sells the given trade (Ignoring `minimum_roi`).
|
||||
| `forcesell all` | | Instantly sells all open trades (Ignoring `minimum_roi`).
|
||||
| `forcebuy <pair> [rate]` | | Instantly buys the given pair. Rate is optional. (`forcebuy_enable` must be set to True)
|
||||
| `performance` | | Show performance of each finished trade grouped by pair
|
||||
| `balance` | | Show account balance per currency
|
||||
| `daily <n>` | 7 | Shows profit or loss per day, over the last n days
|
||||
| `whitelist` | | Show the current whitelist
|
||||
| `blacklist [pair]` | | Show the current blacklist, or adds a pair to the blacklist.
|
||||
| `edge` | | Show validated pairs by Edge if it is enabled.
|
||||
| `version` | | Show version
|
||||
|
||||
Possible commands can be listed from the rest-client script using the `help` command.
|
||||
|
||||
``` bash
|
||||
python3 scripts/rest_client.py help
|
||||
```
|
||||
|
||||
``` output
|
||||
Possible commands:
|
||||
balance
|
||||
Get the account balance
|
||||
:returns: json object
|
||||
|
||||
blacklist
|
||||
Show the current blacklist
|
||||
:param add: List of coins to add (example: "BNB/BTC")
|
||||
:returns: json object
|
||||
|
||||
count
|
||||
Returns the amount of open trades
|
||||
:returns: json object
|
||||
|
||||
daily
|
||||
Returns the amount of open trades
|
||||
:returns: json object
|
||||
|
||||
edge
|
||||
Returns information about edge
|
||||
:returns: json object
|
||||
|
||||
forcebuy
|
||||
Buy an asset
|
||||
:param pair: Pair to buy (ETH/BTC)
|
||||
:param price: Optional - price to buy
|
||||
:returns: json object of the trade
|
||||
|
||||
forcesell
|
||||
Force-sell a trade
|
||||
:param tradeid: Id of the trade (can be received via status command)
|
||||
:returns: json object
|
||||
|
||||
performance
|
||||
Returns the performance of the different coins
|
||||
:returns: json object
|
||||
|
||||
profit
|
||||
Returns the profit summary
|
||||
:returns: json object
|
||||
|
||||
reload_conf
|
||||
Reload configuration
|
||||
:returns: json object
|
||||
|
||||
show_config
|
||||
Returns part of the configuration, relevant for trading operations.
|
||||
:return: json object containing the version
|
||||
|
||||
start
|
||||
Start the bot if it's in stopped state.
|
||||
:returns: json object
|
||||
|
||||
status
|
||||
Get the status of open trades
|
||||
:returns: json object
|
||||
|
||||
stop
|
||||
Stop the bot. Use start to restart
|
||||
:returns: json object
|
||||
|
||||
stopbuy
|
||||
Stop buying (but handle sells gracefully).
|
||||
use reload_conf to reset
|
||||
:returns: json object
|
||||
|
||||
version
|
||||
Returns the version of the bot
|
||||
:returns: json object containing the version
|
||||
|
||||
whitelist
|
||||
Show the current whitelist
|
||||
:returns: json object
|
||||
```
|
||||
@@ -1,5 +1,5 @@
|
||||
# SQL Helper
|
||||
This page constains some help if you want to edit your sqlite db.
|
||||
This page contains some help if you want to edit your sqlite db.
|
||||
|
||||
## Install sqlite3
|
||||
**Ubuntu/Debian installation**
|
||||
@@ -44,6 +44,14 @@ CREATE TABLE trades (
|
||||
open_date DATETIME NOT NULL,
|
||||
close_date DATETIME,
|
||||
open_order_id VARCHAR,
|
||||
stop_loss FLOAT,
|
||||
initial_stop_loss FLOAT,
|
||||
stoploss_order_id VARCHAR,
|
||||
stoploss_last_update DATETIME,
|
||||
max_rate FLOAT,
|
||||
sell_reason VARCHAR,
|
||||
strategy VARCHAR,
|
||||
ticker_interval INTEGER,
|
||||
PRIMARY KEY (id),
|
||||
CHECK (is_open IN (0, 1))
|
||||
);
|
||||
@@ -55,38 +63,45 @@ CREATE TABLE trades (
|
||||
SELECT * FROM trades;
|
||||
```
|
||||
|
||||
## Fix trade still open after a /forcesell
|
||||
## Fix trade still open after a manual sell on the exchange
|
||||
|
||||
!!! Warning
|
||||
Manually selling a pair on the exchange will not be detected by the bot and it will try to sell anyway. Whenever possible, forcesell <tradeid> should be used to accomplish the same thing.
|
||||
It is strongly advised to backup your database file before making any manual changes.
|
||||
|
||||
!!! Note
|
||||
This should not be necessary after /forcesell, as forcesell orders are closed automatically by the bot on the next iteration.
|
||||
|
||||
```sql
|
||||
UPDATE trades
|
||||
SET is_open=0, close_date=<close_date>, close_rate=<close_rate>, close_profit=close_rate/open_rate-1
|
||||
SET is_open=0, close_date=<close_date>, close_rate=<close_rate>, close_profit=close_rate/open_rate-1, sell_reason=<sell_reason>
|
||||
WHERE id=<trade_ID_to_update>;
|
||||
```
|
||||
|
||||
**Example:**
|
||||
##### Example
|
||||
|
||||
```sql
|
||||
UPDATE trades
|
||||
SET is_open=0, close_date='2017-12-20 03:08:45.103418', close_rate=0.19638016, close_profit=0.0496
|
||||
SET is_open=0, close_date='2017-12-20 03:08:45.103418', close_rate=0.19638016, close_profit=0.0496, sell_reason='force_sell'
|
||||
WHERE id=31;
|
||||
```
|
||||
|
||||
## Insert manually a new trade
|
||||
|
||||
```sql
|
||||
INSERT
|
||||
INTO trades (exchange, pair, is_open, fee_open, fee_close, open_rate, stake_amount, amount, open_date)
|
||||
VALUES ('BITTREX', 'BTC_<COIN>', 1, 0.0025, 0.0025, <open_rate>, <stake_amount>, <amount>, '<datetime>')
|
||||
INSERT INTO trades (exchange, pair, is_open, fee_open, fee_close, open_rate, stake_amount, amount, open_date)
|
||||
VALUES ('bittrex', 'ETH/BTC', 1, 0.0025, 0.0025, <open_rate>, <stake_amount>, <amount>, '<datetime>')
|
||||
```
|
||||
|
||||
**Example:**
|
||||
##### Example:
|
||||
|
||||
```sql
|
||||
INSERT INTO trades (exchange, pair, is_open, fee_open, fee_close, open_rate, stake_amount, amount, open_date) VALUES ('BITTREX', 'BTC_ETC', 1, 0.0025, 0.0025, 0.00258580, 0.002, 0.7715262081, '2017-11-28 12:44:24.000000')
|
||||
INSERT INTO trades (exchange, pair, is_open, fee_open, fee_close, open_rate, stake_amount, amount, open_date)
|
||||
VALUES ('bittrex', 'ETH/BTC', 1, 0.0025, 0.0025, 0.00258580, 0.002, 0.7715262081, '2017-11-28 12:44:24.000000')
|
||||
```
|
||||
|
||||
## Fix wrong fees in the table
|
||||
If your DB was created before
|
||||
[PR#200](https://github.com/freqtrade/freqtrade/pull/200) was merged
|
||||
(before 12/23/17).
|
||||
If your DB was created before [PR#200](https://github.com/freqtrade/freqtrade/pull/200) was merged (before 12/23/17).
|
||||
|
||||
```sql
|
||||
UPDATE trades SET fee=0.0025 WHERE fee=0.005;
|
||||
|
||||
116
docs/stoploss.md
116
docs/stoploss.md
@@ -1,62 +1,110 @@
|
||||
# Stop Loss support
|
||||
# Stop Loss
|
||||
|
||||
The `stoploss` configuration parameter is loss in percentage that should trigger a sale.
|
||||
For example, value `-0.10` will cause immediate sell if the profit dips below -10% for a given trade. This parameter is optional.
|
||||
|
||||
Most of the strategy files already include the optimal `stoploss` value.
|
||||
|
||||
!!! Info
|
||||
All stoploss properties mentioned in this file can be set in the Strategy, or in the configuration. Configuration values will override the strategy values.
|
||||
|
||||
## Stop Loss Types
|
||||
|
||||
At this stage the bot contains the following stoploss support modes:
|
||||
|
||||
1. static stop loss, defined in either the strategy or configuration.
|
||||
2. trailing stop loss, defined in the configuration.
|
||||
3. trailing stop loss, custom positive loss, defined in configuration.
|
||||
1. Static stop loss.
|
||||
2. Trailing stop loss.
|
||||
3. Trailing stop loss, custom positive loss.
|
||||
4. Trailing stop loss only once the trade has reached a certain offset.
|
||||
|
||||
!!! Note
|
||||
All stoploss properties can be configured in either Strategy or configuration. Configuration values override strategy values.
|
||||
Those stoploss modes can be *on exchange* or *off exchange*. If the stoploss is *on exchange* it means a stoploss limit order is placed on the exchange immediately after buy order happens successfully. This will protect you against sudden crashes in market as the order will be in the queue immediately and if market goes down then the order has more chance of being fulfilled.
|
||||
|
||||
Those stoploss modes can be *on exchange* or *off exchange*. If the stoploss is *on exchange* it means a stoploss limit order is placed on the exchange immediately after buy order happens successfuly. This will protect you against sudden crashes in market as the order will be in the queue immediately and if market goes down then the order has more chance of being fulfilled.
|
||||
In case of stoploss on exchange there is another parameter called `stoploss_on_exchange_interval`. This configures the interval in seconds at which the bot will check the stoploss and update it if necessary.
|
||||
|
||||
In case of stoploss on exchange there is another parameter called `stoploss_on_exchange_interval`. This configures the interval in seconds at which the bot will check the stoploss and update it if necessary. As an example in case of trailing stoploss if the order is on the exchange and the market is going up then the bot automatically cancels the previous stoploss order and put a new one with a stop value higher than previous one. It is clear that the bot cannot do it every 5 seconds otherwise it gets banned. So this parameter will tell the bot how often it should update the stoploss order. The default value is 60 (1 minute).
|
||||
For example, assuming the stoploss is on exchange, and trailing stoploss is enabled, and the market is going up, then the bot automatically cancels the previous stoploss order and puts a new one with a stop value higher than the previous stoploss order.
|
||||
The bot cannot do this every 5 seconds (at each iteration), otherwise it would get banned by the exchange.
|
||||
So this parameter will tell the bot how often it should update the stoploss order. The default value is 60 (1 minute).
|
||||
This same logic will reapply a stoploss order on the exchange should you cancel it accidentally.
|
||||
|
||||
!!! Note
|
||||
Stoploss on exchange is only supported for Binance as of now.
|
||||
|
||||
|
||||
## Static Stop Loss
|
||||
|
||||
This is very simple, basically you define a stop loss of x in your strategy file or alternative in the configuration, which
|
||||
will overwrite the strategy definition. This will basically try to sell your asset, the second the loss exceeds the defined loss.
|
||||
This is very simple, you define a stop loss of x (as a ratio of price, i.e. x * 100% of price). This will try to sell the asset once the loss exceeds the defined loss.
|
||||
|
||||
## Trail Stop Loss
|
||||
## Trailing Stop Loss
|
||||
|
||||
The initial value for this stop loss, is defined in your strategy or configuration. Just as you would define your Stop Loss normally.
|
||||
To enable this Feauture all you have to do is to define the configuration element:
|
||||
The initial value for this is `stoploss`, just as you would define your static Stop loss.
|
||||
To enable trailing stoploss:
|
||||
|
||||
``` json
|
||||
"trailing_stop" : True
|
||||
``` python
|
||||
trailing_stop = True
|
||||
```
|
||||
|
||||
This will now activate an algorithm, which automatically moves your stop loss up every time the price of your asset increases.
|
||||
This will now activate an algorithm, which automatically moves the stop loss up every time the price of your asset increases.
|
||||
|
||||
For example, simplified math,
|
||||
For example, simplified math:
|
||||
|
||||
* you buy an asset at a price of 100$
|
||||
* your stop loss is defined at 2%
|
||||
* which means your stop loss, gets triggered once your asset dropped below 98$
|
||||
* assuming your asset now increases to 102$
|
||||
* your stop loss, will now be 2% of 102$ or 99.96$
|
||||
* now your asset drops in value to 101$, your stop loss, will still be 99.96$
|
||||
* the bot buys an asset at a price of 100$
|
||||
* the stop loss is defined at 2%
|
||||
* the stop loss would get triggered once the asset dropps below 98$
|
||||
* assuming the asset now increases to 102$
|
||||
* the stop loss will now be 2% of 102$ or 99.96$
|
||||
* now the asset drops in value to 101$, the stop loss will still be 99.96$ and would trigger at 99.96$.
|
||||
|
||||
basically what this means is that your stop loss will be adjusted to be always be 2% of the highest observed price
|
||||
In summary: The stoploss will be adjusted to be always be 2% of the highest observed price.
|
||||
|
||||
### Custom positive loss
|
||||
### Custom positive stoploss
|
||||
|
||||
Due to demand, it is possible to have a default stop loss, when you are in the red with your buy, but once your profit surpasses a certain percentage,
|
||||
the system will utilize a new stop loss, which can be a different value. For example your default stop loss is 5%, but once you have 1.1% profit,
|
||||
it will be changed to be only a 1% stop loss, which trails the green candles until it goes below them.
|
||||
It is also possible to have a default stop loss, when you are in the red with your buy, but once your profit surpasses a certain percentage, the system will utilize a new stop loss, which can have a different value.
|
||||
For example your default stop loss is 5%, but once you have 1.1% profit, it will be changed to be only a 1% stop loss, which trails the green candles until it goes below them.
|
||||
|
||||
Both values can be configured in the main configuration file and requires `"trailing_stop": true` to be set to true.
|
||||
Both values require `trailing_stop` to be set to true.
|
||||
|
||||
``` json
|
||||
"trailing_stop_positive": 0.01,
|
||||
"trailing_stop_positive_offset": 0.011,
|
||||
``` python
|
||||
trailing_stop_positive = 0.01
|
||||
trailing_stop_positive_offset = 0.011
|
||||
```
|
||||
|
||||
The 0.01 would translate to a 1% stop loss, once you hit 1.1% profit.
|
||||
Before this, `stoploss` is used for the trailing stoploss.
|
||||
|
||||
You should also make sure to have this value (`trailing_stop_positive_offset`) lower than your minimal ROI, otherwise minimal ROI will apply first and sell your trade.
|
||||
Read the [next section](#trailing-only-once-offset-is-reached) to keep stoploss at 5% of the entry point.
|
||||
|
||||
!!! Tip
|
||||
Make sure to have this value (`trailing_stop_positive_offset`) lower than minimal ROI, otherwise minimal ROI will apply first and sell the trade.
|
||||
|
||||
### Trailing only once offset is reached
|
||||
|
||||
It is also possible to use a static stoploss until the offset is reached, and then trail the trade to take profits once the market turns.
|
||||
|
||||
If `"trailing_only_offset_is_reached": true` then the trailing stoploss is only activated once the offset is reached. Until then, the stoploss remains at the configured `stoploss`.
|
||||
This option can be used with or without `trailing_stop_positive`, but uses `trailing_stop_positive_offset` as offset.
|
||||
|
||||
``` python
|
||||
trailing_stop_positive_offset = 0.011
|
||||
trailing_only_offset_is_reached = true
|
||||
```
|
||||
|
||||
Simplified example:
|
||||
|
||||
``` python
|
||||
stoploss = 0.05
|
||||
trailing_stop_positive_offset = 0.03
|
||||
trailing_only_offset_is_reached = True
|
||||
```
|
||||
|
||||
* the bot buys an asset at a price of 100$
|
||||
* the stop loss is defined at 5%
|
||||
* the stop loss will remain at 95% until profit reaches +3%
|
||||
|
||||
## Changing stoploss on open trades
|
||||
|
||||
A stoploss on an open trade can be changed by changing the value in the configuration or strategy and use the `/reload_conf` command (alternatively, completely stopping and restarting the bot also works).
|
||||
|
||||
The new stoploss value will be applied to open trades (and corresponding log-messages will be generated).
|
||||
|
||||
### Limitations
|
||||
|
||||
Stoploss values cannot be changed if `trailing_stop` is enabled and the stoploss has already been adjusted, or if [Edge](edge.md) is enabled (since Edge would recalculate stoploss based on the current market situation).
|
||||
|
||||
558
docs/strategy-customization.md
Normal file
558
docs/strategy-customization.md
Normal file
@@ -0,0 +1,558 @@
|
||||
# Strategy Customization
|
||||
|
||||
This page explains where to customize your strategies, and add new
|
||||
indicators.
|
||||
|
||||
## Install a custom strategy file
|
||||
|
||||
This is very simple. Copy paste your strategy file into the directory `user_data/strategies`.
|
||||
|
||||
Let assume you have a class called `AwesomeStrategy` in the file `AwesomeStrategy.py`:
|
||||
|
||||
1. Move your file into `user_data/strategies` (you should have `user_data/strategies/AwesomeStrategy.py`
|
||||
2. Start the bot with the param `--strategy AwesomeStrategy` (the parameter is the class name)
|
||||
|
||||
```bash
|
||||
freqtrade trade --strategy AwesomeStrategy
|
||||
```
|
||||
|
||||
## Develop your own strategy
|
||||
|
||||
The bot includes a default strategy file.
|
||||
Also, several other strategies are available in the [strategy repository](https://github.com/freqtrade/freqtrade-strategies).
|
||||
|
||||
You will however most likely have your own idea for a strategy.
|
||||
This document intends to help you develop one for yourself.
|
||||
|
||||
To get started, use `freqtrade new-strategy --strategy AwesomeStrategy`.
|
||||
This will create a new strategy file from a template, which will be located under `user_data/strategies/AwesomeStrategy.py`.
|
||||
|
||||
!!! Note
|
||||
This is just a template file, which will most likely not be profitable out of the box.
|
||||
|
||||
### Anatomy of a strategy
|
||||
|
||||
A strategy file contains all the information needed to build a good strategy:
|
||||
|
||||
- Indicators
|
||||
- Buy strategy rules
|
||||
- Sell strategy rules
|
||||
- Minimal ROI recommended
|
||||
- Stoploss strongly recommended
|
||||
|
||||
The bot also include a sample strategy called `SampleStrategy` you can update: `user_data/strategies/sample_strategy.py`.
|
||||
You can test it with the parameter: `--strategy SampleStrategy`
|
||||
|
||||
Additionally, there is an attribute called `INTERFACE_VERSION`, which defines the version of the strategy interface the bot should use.
|
||||
The current version is 2 - which is also the default when it's not set explicitly in the strategy.
|
||||
|
||||
Future versions will require this to be set.
|
||||
|
||||
```bash
|
||||
freqtrade trade --strategy AwesomeStrategy
|
||||
```
|
||||
|
||||
**For the following section we will use the [user_data/strategies/sample_strategy.py](https://github.com/freqtrade/freqtrade/blob/develop/freqtrade/templates/sample_strategy.py)
|
||||
file as reference.**
|
||||
|
||||
!!! Note "Strategies and Backtesting"
|
||||
To avoid problems and unexpected differences between Backtesting and dry/live modes, please be aware
|
||||
that during backtesting the full time-interval is passed to the `populate_*()` methods at once.
|
||||
It is therefore best to use vectorized operations (across the whole dataframe, not loops) and
|
||||
avoid index referencing (`df.iloc[-1]`), but instead use `df.shift()` to get to the previous candle.
|
||||
|
||||
!!! Warning "Warning: Using future data"
|
||||
Since backtesting passes the full time interval to the `populate_*()` methods, the strategy author
|
||||
needs to take care to avoid having the strategy utilize data from the future.
|
||||
Some common patterns for this are listed in the [Common Mistakes](#common-mistakes-when-developing-strategies) section of this document.
|
||||
|
||||
### Customize Indicators
|
||||
|
||||
Buy and sell strategies need indicators. You can add more indicators by extending the list contained in the method `populate_indicators()` from your strategy file.
|
||||
|
||||
You should only add the indicators used in either `populate_buy_trend()`, `populate_sell_trend()`, or to populate another indicator, otherwise performance may suffer.
|
||||
|
||||
It's important to always return the dataframe without removing/modifying the columns `"open", "high", "low", "close", "volume"`, otherwise these fields would contain something unexpected.
|
||||
|
||||
Sample:
|
||||
|
||||
```python
|
||||
def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Adds several different TA indicators to the given DataFrame
|
||||
|
||||
Performance Note: For the best performance be frugal on the number of indicators
|
||||
you are using. Let uncomment only the indicator you are using in your strategies
|
||||
or your hyperopt configuration, otherwise you will waste your memory and CPU usage.
|
||||
:param dataframe: Raw data from the exchange and parsed by parse_ticker_dataframe()
|
||||
:param metadata: Additional information, like the currently traded pair
|
||||
:return: a Dataframe with all mandatory indicators for the strategies
|
||||
"""
|
||||
dataframe['sar'] = ta.SAR(dataframe)
|
||||
dataframe['adx'] = ta.ADX(dataframe)
|
||||
stoch = ta.STOCHF(dataframe)
|
||||
dataframe['fastd'] = stoch['fastd']
|
||||
dataframe['fastk'] = stoch['fastk']
|
||||
dataframe['blower'] = ta.BBANDS(dataframe, nbdevup=2, nbdevdn=2)['lowerband']
|
||||
dataframe['sma'] = ta.SMA(dataframe, timeperiod=40)
|
||||
dataframe['tema'] = ta.TEMA(dataframe, timeperiod=9)
|
||||
dataframe['mfi'] = ta.MFI(dataframe)
|
||||
dataframe['rsi'] = ta.RSI(dataframe)
|
||||
dataframe['ema5'] = ta.EMA(dataframe, timeperiod=5)
|
||||
dataframe['ema10'] = ta.EMA(dataframe, timeperiod=10)
|
||||
dataframe['ema50'] = ta.EMA(dataframe, timeperiod=50)
|
||||
dataframe['ema100'] = ta.EMA(dataframe, timeperiod=100)
|
||||
dataframe['ao'] = awesome_oscillator(dataframe)
|
||||
macd = ta.MACD(dataframe)
|
||||
dataframe['macd'] = macd['macd']
|
||||
dataframe['macdsignal'] = macd['macdsignal']
|
||||
dataframe['macdhist'] = macd['macdhist']
|
||||
hilbert = ta.HT_SINE(dataframe)
|
||||
dataframe['htsine'] = hilbert['sine']
|
||||
dataframe['htleadsine'] = hilbert['leadsine']
|
||||
dataframe['plus_dm'] = ta.PLUS_DM(dataframe)
|
||||
dataframe['plus_di'] = ta.PLUS_DI(dataframe)
|
||||
dataframe['minus_dm'] = ta.MINUS_DM(dataframe)
|
||||
dataframe['minus_di'] = ta.MINUS_DI(dataframe)
|
||||
return dataframe
|
||||
```
|
||||
|
||||
!!! Note "Want more indicator examples?"
|
||||
Look into the [user_data/strategies/sample_strategy.py](https://github.com/freqtrade/freqtrade/blob/develop/freqtrade/templates/sample_strategy.py).
|
||||
Then uncomment indicators you need.
|
||||
|
||||
### Strategy startup period
|
||||
|
||||
Most indicators have an instable startup period, in which they are either not available, or the calculation is incorrect. This can lead to inconsistencies, since Freqtrade does not know how long this instable period should be.
|
||||
To account for this, the strategy can be assigned the `startup_candle_count` attribute.
|
||||
This should be set to the maximum number of candles that the strategy requires to calculate stable indicators.
|
||||
|
||||
In this example strategy, this should be set to 100 (`startup_candle_count = 100`), since the longest needed history is 100 candles.
|
||||
|
||||
``` python
|
||||
dataframe['ema100'] = ta.EMA(dataframe, timeperiod=100)
|
||||
```
|
||||
|
||||
By letting the bot know how much history is needed, backtest trades can start at the specified timerange during backtesting and hyperopt.
|
||||
|
||||
!!! Warning
|
||||
`startup_candle_count` should be below `ohlcv_candle_limit` (which is 500 for most exchanges) - since only this amount of candles will be available during Dry-Run/Live Trade operations.
|
||||
|
||||
#### Example
|
||||
|
||||
Let's try to backtest 1 month (January 2019) of 5m candles using the an example strategy with EMA100, as above.
|
||||
|
||||
``` bash
|
||||
freqtrade backtesting --timerange 20190101-20190201 --ticker-interval 5m
|
||||
```
|
||||
|
||||
Assuming `startup_candle_count` is set to 100, backtesting knows it needs 100 candles to generate valid buy signals. It will load data from `20190101 - (100 * 5m)` - which is ~2019-12-31 15:30:00.
|
||||
If this data is available, indicators will be calculated with this extended timerange. The instable startup period (up to 2019-01-01 00:00:00) will then be removed before starting backtesting.
|
||||
|
||||
!!! Note
|
||||
If data for the startup period is not available, then the timerange will be adjusted to account for this startup period - so Backtesting would start at 2019-01-01 08:30:00.
|
||||
|
||||
### Buy signal rules
|
||||
|
||||
Edit the method `populate_buy_trend()` in your strategy file to update your buy strategy.
|
||||
|
||||
It's important to always return the dataframe without removing/modifying the columns `"open", "high", "low", "close", "volume"`, otherwise these fields would contain something unexpected.
|
||||
|
||||
This will method will also define a new column, `"buy"`, which needs to contain 1 for buys, and 0 for "no action".
|
||||
|
||||
Sample from `user_data/strategies/sample_strategy.py`:
|
||||
|
||||
```python
|
||||
def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Based on TA indicators, populates the buy signal for the given dataframe
|
||||
:param dataframe: DataFrame populated with indicators
|
||||
:param metadata: Additional information, like the currently traded pair
|
||||
:return: DataFrame with buy column
|
||||
"""
|
||||
dataframe.loc[
|
||||
(
|
||||
(qtpylib.crossed_above(dataframe['rsi'], 30)) & # Signal: RSI crosses above 30
|
||||
(dataframe['tema'] <= dataframe['bb_middleband']) & # Guard
|
||||
(dataframe['tema'] > dataframe['tema'].shift(1)) & # Guard
|
||||
(dataframe['volume'] > 0) # Make sure Volume is not 0
|
||||
),
|
||||
'buy'] = 1
|
||||
|
||||
return dataframe
|
||||
```
|
||||
|
||||
!!! Note
|
||||
Buying requires sellers to buy from - therefore volume needs to be > 0 (`dataframe['volume'] > 0`) to make sure that the bot does not buy/sell in no-activity periods.
|
||||
|
||||
### Sell signal rules
|
||||
|
||||
Edit the method `populate_sell_trend()` into your strategy file to update your sell strategy.
|
||||
Please note that the sell-signal is only used if `use_sell_signal` is set to true in the configuration.
|
||||
|
||||
It's important to always return the dataframe without removing/modifying the columns `"open", "high", "low", "close", "volume"`, otherwise these fields would contain something unexpected.
|
||||
|
||||
This will method will also define a new column, `"sell"`, which needs to contain 1 for sells, and 0 for "no action".
|
||||
|
||||
Sample from `user_data/strategies/sample_strategy.py`:
|
||||
|
||||
```python
|
||||
def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Based on TA indicators, populates the sell signal for the given dataframe
|
||||
:param dataframe: DataFrame populated with indicators
|
||||
:param metadata: Additional information, like the currently traded pair
|
||||
:return: DataFrame with buy column
|
||||
"""
|
||||
dataframe.loc[
|
||||
(
|
||||
(qtpylib.crossed_above(dataframe['rsi'], 70)) & # Signal: RSI crosses above 70
|
||||
(dataframe['tema'] > dataframe['bb_middleband']) & # Guard
|
||||
(dataframe['tema'] < dataframe['tema'].shift(1)) & # Guard
|
||||
(dataframe['volume'] > 0) # Make sure Volume is not 0
|
||||
),
|
||||
'sell'] = 1
|
||||
return dataframe
|
||||
```
|
||||
|
||||
### Minimal ROI
|
||||
|
||||
This dict defines the minimal Return On Investment (ROI) a trade should reach before selling, independent from the sell signal.
|
||||
|
||||
It is of the following format, with the dict key (left side of the colon) being the minutes passed since the trade opened, and the value (right side of the colon) being the percentage.
|
||||
|
||||
```python
|
||||
minimal_roi = {
|
||||
"40": 0.0,
|
||||
"30": 0.01,
|
||||
"20": 0.02,
|
||||
"0": 0.04
|
||||
}
|
||||
```
|
||||
|
||||
The above configuration would therefore mean:
|
||||
|
||||
- Sell whenever 4% profit was reached
|
||||
- Sell when 2% profit was reached (in effect after 20 minutes)
|
||||
- Sell when 1% profit was reached (in effect after 30 minutes)
|
||||
- Sell when trade is non-loosing (in effect after 40 minutes)
|
||||
|
||||
The calculation does include fees.
|
||||
|
||||
To disable ROI completely, set it to an insanely high number:
|
||||
|
||||
```python
|
||||
minimal_roi = {
|
||||
"0": 100
|
||||
}
|
||||
```
|
||||
|
||||
While technically not completely disabled, this would sell once the trade reaches 10000% Profit.
|
||||
|
||||
### Stoploss
|
||||
|
||||
Setting a stoploss is highly recommended to protect your capital from strong moves against you.
|
||||
|
||||
Sample:
|
||||
|
||||
``` python
|
||||
stoploss = -0.10
|
||||
```
|
||||
|
||||
This would signify a stoploss of -10%.
|
||||
|
||||
For the full documentation on stoploss features, look at the dedicated [stoploss page](stoploss.md).
|
||||
|
||||
If your exchange supports it, it's recommended to also set `"stoploss_on_exchange"` in the order_types dictionary, so your stoploss is on the exchange and cannot be missed due to network problems, high load or other reasons.
|
||||
|
||||
For more information on order_types please look [here](configuration.md#understand-order_types).
|
||||
|
||||
### Ticker interval
|
||||
|
||||
This is the set of candles the bot should download and use for the analysis.
|
||||
Common values are `"1m"`, `"5m"`, `"15m"`, `"1h"`, however all values supported by your exchange should work.
|
||||
|
||||
Please note that the same buy/sell signals may work with one interval, but not the other.
|
||||
This setting is accessible within the strategy by using `self.ticker_interval`.
|
||||
|
||||
### Metadata dict
|
||||
|
||||
The metadata-dict (available for `populate_buy_trend`, `populate_sell_trend`, `populate_indicators`) contains additional information.
|
||||
Currently this is `pair`, which can be accessed using `metadata['pair']` - and will return a pair in the format `XRP/BTC`.
|
||||
|
||||
The Metadata-dict should not be modified and does not persist information across multiple calls.
|
||||
Instead, have a look at the section [Storing information](#Storing-information)
|
||||
|
||||
### Storing information
|
||||
|
||||
Storing information can be accomplished by creating a new dictionary within the strategy class.
|
||||
|
||||
The name of the variable can be chosen at will, but should be prefixed with `cust_` to avoid naming collisions with predefined strategy variables.
|
||||
|
||||
```python
|
||||
class Awesomestrategy(IStrategy):
|
||||
# Create custom dictionary
|
||||
cust_info = {}
|
||||
def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
# Check if the entry already exists
|
||||
if "crosstime" in self.cust_info[metadata["pair"]:
|
||||
self.cust_info[metadata["pair"]["crosstime"] += 1
|
||||
else:
|
||||
self.cust_info[metadata["pair"]["crosstime"] = 1
|
||||
```
|
||||
|
||||
!!! Warning
|
||||
The data is not persisted after a bot-restart (or config-reload). Also, the amount of data should be kept smallish (no DataFrames and such), otherwise the bot will start to consume a lot of memory and eventually run out of memory and crash.
|
||||
|
||||
!!! Note
|
||||
If the data is pair-specific, make sure to use pair as one of the keys in the dictionary.
|
||||
|
||||
### Additional data (DataProvider)
|
||||
|
||||
The strategy provides access to the `DataProvider`. This allows you to get additional data to use in your strategy.
|
||||
|
||||
All methods return `None` in case of failure (do not raise an exception).
|
||||
|
||||
Please always check the mode of operation to select the correct method to get data (samples see below).
|
||||
|
||||
#### Possible options for DataProvider
|
||||
|
||||
- `available_pairs` - Property with tuples listing cached pairs with their intervals (pair, interval).
|
||||
- `ohlcv(pair, timeframe)` - Currently cached ticker data for the pair, returns DataFrame or empty DataFrame.
|
||||
- `historic_ohlcv(pair, timeframe)` - Returns historical data stored on disk.
|
||||
- `get_pair_dataframe(pair, timeframe)` - This is a universal method, which returns either historical data (for backtesting) or cached live data (for the Dry-Run and Live-Run modes).
|
||||
- `orderbook(pair, maximum)` - Returns latest orderbook data for the pair, a dict with bids/asks with a total of `maximum` entries.
|
||||
- `market(pair)` - Returns market data for the pair: fees, limits, precisions, activity flag, etc. See [ccxt documentation](https://github.com/ccxt/ccxt/wiki/Manual#markets) for more details on Market data structure.
|
||||
- `runmode` - Property containing the current runmode.
|
||||
|
||||
#### Example: fetch live ohlcv / historic data for the first informative pair
|
||||
|
||||
``` python
|
||||
if self.dp:
|
||||
inf_pair, inf_timeframe = self.informative_pairs()[0]
|
||||
informative = self.dp.get_pair_dataframe(pair=inf_pair,
|
||||
timeframe=inf_timeframe)
|
||||
```
|
||||
|
||||
!!! Warning "Warning about backtesting"
|
||||
Be carefull when using dataprovider in backtesting. `historic_ohlcv()` (and `get_pair_dataframe()`
|
||||
for the backtesting runmode) provides the full time-range in one go,
|
||||
so please be aware of it and make sure to not "look into the future" to avoid surprises when running in dry/live mode).
|
||||
|
||||
!!! Warning "Warning in hyperopt"
|
||||
This option cannot currently be used during hyperopt.
|
||||
|
||||
#### Orderbook
|
||||
|
||||
``` python
|
||||
if self.dp:
|
||||
if self.dp.runmode in ('live', 'dry_run'):
|
||||
ob = self.dp.orderbook(metadata['pair'], 1)
|
||||
dataframe['best_bid'] = ob['bids'][0][0]
|
||||
dataframe['best_ask'] = ob['asks'][0][0]
|
||||
```
|
||||
|
||||
!!! Warning
|
||||
The order book is not part of the historic data which means backtesting and hyperopt will not work if this
|
||||
method is used.
|
||||
|
||||
#### Available Pairs
|
||||
|
||||
``` python
|
||||
if self.dp:
|
||||
for pair, ticker in self.dp.available_pairs:
|
||||
print(f"available {pair}, {ticker}")
|
||||
```
|
||||
|
||||
#### Get data for non-tradeable pairs
|
||||
|
||||
Data for additional, informative pairs (reference pairs) can be beneficial for some strategies.
|
||||
Ohlcv data for these pairs will be downloaded as part of the regular whitelist refresh process and is available via `DataProvider` just as other pairs (see above).
|
||||
These parts will **not** be traded unless they are also specified in the pair whitelist, or have been selected by Dynamic Whitelisting.
|
||||
|
||||
The pairs need to be specified as tuples in the format `("pair", "interval")`, with pair as the first and time interval as the second argument.
|
||||
|
||||
Sample:
|
||||
|
||||
``` python
|
||||
def informative_pairs(self):
|
||||
return [("ETH/USDT", "5m"),
|
||||
("BTC/TUSD", "15m"),
|
||||
]
|
||||
```
|
||||
|
||||
!!! Warning
|
||||
As these pairs will be refreshed as part of the regular whitelist refresh, it's best to keep this list short.
|
||||
All intervals and all pairs can be specified as long as they are available (and active) on the used exchange.
|
||||
It is however better to use resampling to longer time-intervals when possible
|
||||
to avoid hammering the exchange with too many requests and risk being blocked.
|
||||
|
||||
### Additional data (Wallets)
|
||||
|
||||
The strategy provides access to the `Wallets` object. This contains the current balances on the exchange.
|
||||
|
||||
!!! Note
|
||||
Wallets is not available during backtesting / hyperopt.
|
||||
|
||||
Please always check if `Wallets` is available to avoid failures during backtesting.
|
||||
|
||||
``` python
|
||||
if self.wallets:
|
||||
free_eth = self.wallets.get_free('ETH')
|
||||
used_eth = self.wallets.get_used('ETH')
|
||||
total_eth = self.wallets.get_total('ETH')
|
||||
```
|
||||
|
||||
#### Possible options for Wallets
|
||||
|
||||
- `get_free(asset)` - currently available balance to trade
|
||||
- `get_used(asset)` - currently tied up balance (open orders)
|
||||
- `get_total(asset)` - total available balance - sum of the 2 above
|
||||
|
||||
### Additional data (Trades)
|
||||
|
||||
A history of Trades can be retrieved in the strategy by querying the database.
|
||||
|
||||
At the top of the file, import Trade.
|
||||
|
||||
```python
|
||||
from freqtrade.persistence import Trade
|
||||
```
|
||||
|
||||
The following example queries for the current pair and trades from today, however other filters can easily be added.
|
||||
|
||||
``` python
|
||||
if self.config['runmode'] in ('live', 'dry_run'):
|
||||
trades = Trade.get_trades([Trade.pair == metadata['pair'],
|
||||
Trade.open_date > datetime.utcnow() - timedelta(days=1),
|
||||
Trade.is_open == False,
|
||||
]).order_by(Trade.close_date).all()
|
||||
# Summarize profit for this pair.
|
||||
curdayprofit = sum(trade.close_profit for trade in trades)
|
||||
```
|
||||
|
||||
Get amount of stake_currency currently invested in Trades:
|
||||
|
||||
``` python
|
||||
if self.config['runmode'] in ('live', 'dry_run'):
|
||||
total_stakes = Trade.total_open_trades_stakes()
|
||||
```
|
||||
|
||||
Retrieve performance per pair.
|
||||
Returns a List of dicts per pair.
|
||||
|
||||
``` python
|
||||
if self.config['runmode'] in ('live', 'dry_run'):
|
||||
performance = Trade.get_overall_performance()
|
||||
```
|
||||
|
||||
Sample return value: ETH/BTC had 5 trades, with a total profit of 1.5% (ratio of 0.015).
|
||||
|
||||
``` json
|
||||
{'pair': "ETH/BTC", 'profit': 0.015, 'count': 5}
|
||||
```
|
||||
|
||||
!!! Warning
|
||||
Trade history is not available during backtesting or hyperopt.
|
||||
|
||||
### Prevent trades from happening for a specific pair
|
||||
|
||||
Freqtrade locks pairs automatically for the current candle (until that candle is over) when a pair is sold, preventing an immediate re-buy of that pair.
|
||||
|
||||
Locked pairs will show the message `Pair <pair> is currently locked.`.
|
||||
|
||||
#### Locking pairs from within the strategy
|
||||
|
||||
Sometimes it may be desired to lock a pair after certain events happen (e.g. multiple losing trades in a row).
|
||||
|
||||
Freqtrade has an easy method to do this from within the strategy, by calling `self.lock_pair(pair, until)`.
|
||||
`until` must be a datetime object in the future, after which trading will be reenabled for that pair.
|
||||
|
||||
Locks can also be lifted manually, by calling `self.unlock_pair(pair)`.
|
||||
|
||||
To verify if a pair is currently locked, use `self.is_pair_locked(pair)`.
|
||||
|
||||
!!! Note
|
||||
Locked pairs are not persisted, so a restart of the bot, or calling `/reload_conf` will reset locked pairs.
|
||||
|
||||
!!! Warning
|
||||
Locking pairs is not functioning during backtesting.
|
||||
|
||||
##### Pair locking example
|
||||
|
||||
``` python
|
||||
from freqtrade.persistence import Trade
|
||||
from datetime import timedelta, datetime, timezone
|
||||
# Put the above lines a the top of the strategy file, next to all the other imports
|
||||
# --------
|
||||
|
||||
# Within populate indicators (or populate_buy):
|
||||
if self.config['runmode'] in ('live', 'dry_run'):
|
||||
# fetch closed trades for the last 2 days
|
||||
trades = Trade.get_trades([Trade.pair == metadata['pair'],
|
||||
Trade.open_date > datetime.utcnow() - timedelta(days=2),
|
||||
Trade.is_open == False,
|
||||
]).all()
|
||||
# Analyze the conditions you'd like to lock the pair .... will probably be different for every strategy
|
||||
sumprofit = sum(trade.close_profit for trade in trades)
|
||||
if sumprofit < 0:
|
||||
# Lock pair for 12 hours
|
||||
self.lock_pair(metadata['pair'], until=datetime.now(timezone.utc) + timedelta(hours=12))
|
||||
```
|
||||
|
||||
### Print created dataframe
|
||||
|
||||
To inspect the created dataframe, you can issue a print-statement in either `populate_buy_trend()` or `populate_sell_trend()`.
|
||||
You may also want to print the pair so it's clear what data is currently shown.
|
||||
|
||||
``` python
|
||||
def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
dataframe.loc[
|
||||
(
|
||||
#>> whatever condition<<<
|
||||
),
|
||||
'buy'] = 1
|
||||
|
||||
# Print the Analyzed pair
|
||||
print(f"result for {metadata['pair']}")
|
||||
|
||||
# Inspect the last 5 rows
|
||||
print(dataframe.tail())
|
||||
|
||||
return dataframe
|
||||
```
|
||||
|
||||
Printing more than a few rows is also possible (simply use `print(dataframe)` instead of `print(dataframe.tail())`), however not recommended, as that will be very verbose (~500 lines per pair every 5 seconds).
|
||||
|
||||
### Specify custom strategy location
|
||||
|
||||
If you want to use a strategy from a different directory you can pass `--strategy-path`
|
||||
|
||||
```bash
|
||||
freqtrade trade --strategy AwesomeStrategy --strategy-path /some/directory
|
||||
```
|
||||
|
||||
### Common mistakes when developing strategies
|
||||
|
||||
Backtesting analyzes the whole time-range at once for performance reasons. Because of this, strategy authors need to make sure that strategies do not look-ahead into the future.
|
||||
This is a common pain-point, which can cause huge differences between backtesting and dry/live run methods, since they all use data which is not available during dry/live runs, so these strategies will perform well during backtesting, but will fail / perform badly in real conditions.
|
||||
|
||||
The following lists some common patterns which should be avoided to prevent frustration:
|
||||
|
||||
- don't use `shift(-1)`. This uses data from the future, which is not available.
|
||||
- don't use `.iloc[-1]` or any other absolute position in the dataframe, this will be different between dry-run and backtesting.
|
||||
- don't use `dataframe['volume'].mean()`. This uses the full DataFrame for backtesting, including data from the future. Use `dataframe['volume'].rolling(<window>).mean()` instead
|
||||
- don't use `.resample('1h')`. This uses the left border of the interval, so moves data from an hour to the start of the hour. Use `.resample('1h', label='right')` instead.
|
||||
|
||||
### Further strategy ideas
|
||||
|
||||
To get additional Ideas for strategies, head over to our [strategy repository](https://github.com/freqtrade/freqtrade-strategies). Feel free to use them as they are - but results will depend on the current market situation, pairs used etc. - therefore please backtest the strategy for your exchange/desired pairs first, evaluate carefully, use at your own risk.
|
||||
Feel free to use any of them as inspiration for your own strategies.
|
||||
We're happy to accept Pull Requests containing new Strategies to that repo.
|
||||
|
||||
We also got a *strategy-sharing* channel in our [Slack community](https://join.slack.com/t/highfrequencybot/shared_invite/enQtNjU5ODcwNjI1MDU3LTU1MTgxMjkzNmYxNWE1MDEzYzQ3YmU4N2MwZjUyNjJjODRkMDVkNjg4YTAyZGYzYzlhOTZiMTE4ZjQ4YzM0OGE) which is a great place to get and/or share ideas.
|
||||
|
||||
## Next step
|
||||
|
||||
Now you have a perfect strategy you probably want to backtest it.
|
||||
Your next step is to learn [How to use the Backtesting](backtesting.md).
|
||||
158
docs/strategy_analysis_example.md
Normal file
158
docs/strategy_analysis_example.md
Normal file
@@ -0,0 +1,158 @@
|
||||
# Strategy analysis example
|
||||
|
||||
Debugging a strategy can be time-consuming. FreqTrade offers helper functions to visualize raw data.
|
||||
|
||||
## Setup
|
||||
|
||||
|
||||
```python
|
||||
from pathlib import Path
|
||||
# Customize these according to your needs.
|
||||
|
||||
# Define some constants
|
||||
timeframe = "5m"
|
||||
# Name of the strategy class
|
||||
strategy_name = 'SampleStrategy'
|
||||
# Path to user data
|
||||
user_data_dir = Path('user_data')
|
||||
# Location of the strategy
|
||||
strategy_location = user_data_dir / 'strategies'
|
||||
# Location of the data
|
||||
data_location = Path(user_data_dir, 'data', 'binance')
|
||||
# Pair to analyze - Only use one pair here
|
||||
pair = "BTC_USDT"
|
||||
```
|
||||
|
||||
|
||||
```python
|
||||
# Load data using values set above
|
||||
from freqtrade.data.history import load_pair_history
|
||||
|
||||
candles = load_pair_history(datadir=data_location,
|
||||
timeframe=timeframe,
|
||||
pair=pair)
|
||||
|
||||
# Confirm success
|
||||
print("Loaded " + str(len(candles)) + f" rows of data for {pair} from {data_location}")
|
||||
candles.head()
|
||||
```
|
||||
|
||||
## Load and run strategy
|
||||
* Rerun each time the strategy file is changed
|
||||
|
||||
|
||||
```python
|
||||
# Load strategy using values set above
|
||||
from freqtrade.resolvers import StrategyResolver
|
||||
strategy = StrategyResolver.load_strategy({'strategy': strategy_name,
|
||||
'user_data_dir': user_data_dir,
|
||||
'strategy_path': strategy_location})
|
||||
|
||||
# Generate buy/sell signals using strategy
|
||||
df = strategy.analyze_ticker(candles, {'pair': pair})
|
||||
df.tail()
|
||||
```
|
||||
|
||||
### Display the trade details
|
||||
|
||||
* Note that using `data.head()` would also work, however most indicators have some "startup" data at the top of the dataframe.
|
||||
* Some possible problems
|
||||
* Columns with NaN values at the end of the dataframe
|
||||
* Columns used in `crossed*()` functions with completely different units
|
||||
* Comparison with full backtest
|
||||
* having 200 buy signals as output for one pair from `analyze_ticker()` does not necessarily mean that 200 trades will be made during backtesting.
|
||||
* Assuming you use only one condition such as, `df['rsi'] < 30` as buy condition, this will generate multiple "buy" signals for each pair in sequence (until rsi returns > 29). The bot will only buy on the first of these signals (and also only if a trade-slot ("max_open_trades") is still available), or on one of the middle signals, as soon as a "slot" becomes available.
|
||||
|
||||
|
||||
|
||||
```python
|
||||
# Report results
|
||||
print(f"Generated {df['buy'].sum()} buy signals")
|
||||
data = df.set_index('date', drop=False)
|
||||
data.tail()
|
||||
```
|
||||
|
||||
## Load existing objects into a Jupyter notebook
|
||||
|
||||
The following cells assume that you have already generated data using the cli.
|
||||
They will allow you to drill deeper into your results, and perform analysis which otherwise would make the output very difficult to digest due to information overload.
|
||||
|
||||
### Load backtest results to pandas dataframe
|
||||
|
||||
Analyze a trades dataframe (also used below for plotting)
|
||||
|
||||
|
||||
```python
|
||||
from freqtrade.data.btanalysis import load_backtest_data
|
||||
|
||||
# Load backtest results
|
||||
trades = load_backtest_data(user_data_dir / "backtest_results/backtest-result.json")
|
||||
|
||||
# Show value-counts per pair
|
||||
trades.groupby("pair")["sell_reason"].value_counts()
|
||||
```
|
||||
|
||||
### Load live trading results into a pandas dataframe
|
||||
|
||||
In case you did already some trading and want to analyze your performance
|
||||
|
||||
|
||||
```python
|
||||
from freqtrade.data.btanalysis import load_trades_from_db
|
||||
|
||||
# Fetch trades from database
|
||||
trades = load_trades_from_db("sqlite:///tradesv3.sqlite")
|
||||
|
||||
# Display results
|
||||
trades.groupby("pair")["sell_reason"].value_counts()
|
||||
```
|
||||
|
||||
## Analyze the loaded trades for trade parallelism
|
||||
This can be useful to find the best `max_open_trades` parameter, when used with backtesting in conjunction with `--disable-max-market-positions`.
|
||||
|
||||
`analyze_trade_parallelism()` returns a timeseries dataframe with an "open_trades" column, specifying the number of open trades for each candle.
|
||||
|
||||
|
||||
```python
|
||||
from freqtrade.data.btanalysis import analyze_trade_parallelism
|
||||
|
||||
# Analyze the above
|
||||
parallel_trades = analyze_trade_parallelism(trades, '5m')
|
||||
|
||||
|
||||
parallel_trades.plot()
|
||||
```
|
||||
|
||||
## Plot results
|
||||
|
||||
Freqtrade offers interactive plotting capabilities based on plotly.
|
||||
|
||||
|
||||
```python
|
||||
from freqtrade.plot.plotting import generate_candlestick_graph
|
||||
# Limit graph period to keep plotly quick and reactive
|
||||
|
||||
data_red = data['2019-06-01':'2019-06-10']
|
||||
# Generate candlestick graph
|
||||
graph = generate_candlestick_graph(pair=pair,
|
||||
data=data_red,
|
||||
trades=trades,
|
||||
indicators1=['sma20', 'ema50', 'ema55'],
|
||||
indicators2=['rsi', 'macd', 'macdsignal', 'macdhist']
|
||||
)
|
||||
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
```python
|
||||
# Show graph inline
|
||||
# graph.show()
|
||||
|
||||
# Render graph in a seperate window
|
||||
graph.show(renderer="browser")
|
||||
|
||||
```
|
||||
|
||||
Feel free to submit an issue or Pull Request enhancing this document if you would like to share ideas on how to best analyze the data.
|
||||
13
docs/stylesheets/ft.extra.css
Normal file
13
docs/stylesheets/ft.extra.css
Normal file
@@ -0,0 +1,13 @@
|
||||
.rst-versions {
|
||||
font-size: .7rem;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.rst-versions.rst-badge .rst-current-version {
|
||||
font-size: .7rem;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.rst-versions .rst-other-versions {
|
||||
color: white;
|
||||
}
|
||||
@@ -1,13 +1,48 @@
|
||||
# Telegram usage
|
||||
|
||||
This page explains how to command your bot with Telegram.
|
||||
## Setup your Telegram bot
|
||||
|
||||
## Prerequisite
|
||||
To control your bot with Telegram, you need first to
|
||||
[set up a Telegram bot](installation.md)
|
||||
and add your Telegram API keys into your config file.
|
||||
Below we explain how to create your Telegram Bot, and how to get your
|
||||
Telegram user id.
|
||||
|
||||
### 1. Create your Telegram bot
|
||||
|
||||
Start a chat with the [Telegram BotFather](https://telegram.me/BotFather)
|
||||
|
||||
Send the message `/newbot`.
|
||||
|
||||
*BotFather response:*
|
||||
|
||||
> Alright, a new bot. How are we going to call it? Please choose a name for your bot.
|
||||
|
||||
Choose the public name of your bot (e.x. `Freqtrade bot`)
|
||||
|
||||
*BotFather response:*
|
||||
|
||||
> Good. Now let's choose a username for your bot. It must end in `bot`. Like this, for example: TetrisBot or tetris_bot.
|
||||
|
||||
Choose the name id of your bot and send it to the BotFather (e.g. "`My_own_freqtrade_bot`")
|
||||
|
||||
*BotFather response:*
|
||||
|
||||
> Done! Congratulations on your new bot. You will find it at `t.me/yourbots_name_bot`. You can now add a description, about section and profile picture for your bot, see /help for a list of commands. By the way, when you've finished creating your cool bot, ping our Bot Support if you want a better username for it. Just make sure the bot is fully operational before you do this.
|
||||
|
||||
> Use this token to access the HTTP API: `22222222:APITOKEN`
|
||||
|
||||
> For a description of the Bot API, see this page: https://core.telegram.org/bots/api Father bot will return you the token (API key)
|
||||
|
||||
Copy the API Token (`22222222:APITOKEN` in the above example) and keep use it for the config parameter `token`.
|
||||
|
||||
Don't forget to start the conversation with your bot, by clicking `/START` button
|
||||
|
||||
### 2. Get your user id
|
||||
|
||||
Talk to the [userinfobot](https://telegram.me/userinfobot)
|
||||
|
||||
Get your "Id", you will use it for the config parameter `chat_id`.
|
||||
|
||||
## Telegram commands
|
||||
|
||||
Per default, the Telegram bot shows predefined commands. Some commands
|
||||
are only available by sending them to the bot. The table below list the
|
||||
official commands. You can ask at any moment for help with `/help`.
|
||||
@@ -16,7 +51,9 @@ official commands. You can ask at any moment for help with `/help`.
|
||||
|----------|---------|-------------|
|
||||
| `/start` | | Starts the trader
|
||||
| `/stop` | | Stops the trader
|
||||
| `/stopbuy` | | Stops the trader from opening new trades. Gracefully closes open trades according to their rules.
|
||||
| `/reload_conf` | | Reloads the configuration file
|
||||
| `/show_config` | | Shows part of the current configuration with relevant settings to operation
|
||||
| `/status` | | Lists all open trades
|
||||
| `/status table` | | List all open trades in a table format
|
||||
| `/count` | | Displays number of trades used and available
|
||||
@@ -27,6 +64,9 @@ official commands. You can ask at any moment for help with `/help`.
|
||||
| `/performance` | | Show performance of each finished trade grouped by pair
|
||||
| `/balance` | | Show account balance per currency
|
||||
| `/daily <n>` | 7 | Shows profit or loss per day, over the last n days
|
||||
| `/whitelist` | | Show the current whitelist
|
||||
| `/blacklist [pair]` | | Show the current blacklist, or adds a pair to the blacklist.
|
||||
| `/edge` | | Show validated pairs by Edge if it is enabled.
|
||||
| `/help` | | Show help message
|
||||
| `/version` | | Show version
|
||||
|
||||
@@ -43,22 +83,34 @@ Below, example of Telegram message you will receive for each command.
|
||||
> `Stopping trader ...`
|
||||
> **Status:** `stopped`
|
||||
|
||||
## /status
|
||||
### /stopbuy
|
||||
|
||||
> **status:** `Setting max_open_trades to 0. Run /reload_conf to reset.`
|
||||
|
||||
Prevents the bot from opening new trades by temporarily setting "max_open_trades" to 0. Open trades will be handled via their regular rules (ROI / Sell-signal, stoploss, ...).
|
||||
|
||||
After this, give the bot time to close off open trades (can be checked via `/status table`).
|
||||
Once all positions are sold, run `/stop` to completely stop the bot.
|
||||
|
||||
`/reload_conf` resets "max_open_trades" to the value set in the configuration and resets this command.
|
||||
|
||||
!!! Warning
|
||||
The stop-buy signal is ONLY active while the bot is running, and is not persisted anyway, so restarting the bot will cause this to reset.
|
||||
|
||||
### /status
|
||||
|
||||
For each open trade, the bot will send you the following message.
|
||||
|
||||
> **Trade ID:** `123`
|
||||
> **Trade ID:** `123` `(since 1 days ago)`
|
||||
> **Current Pair:** CVC/BTC
|
||||
> **Open Since:** `1 days ago`
|
||||
> **Amount:** `26.64180098`
|
||||
> **Open Rate:** `0.00007489`
|
||||
> **Close Rate:** `None`
|
||||
> **Current Rate:** `0.00007489`
|
||||
> **Close Profit:** `None`
|
||||
> **Current Profit:** `12.95%`
|
||||
> **Open Order:** `None`
|
||||
> **Stoploss:** `0.00007389 (-0.02%)`
|
||||
|
||||
## /status table
|
||||
### /status table
|
||||
|
||||
Return the status of all open trades in a table format.
|
||||
```
|
||||
@@ -68,7 +120,7 @@ Return the status of all open trades in a table format.
|
||||
123 CVC/BTC 1 h 12.95%
|
||||
```
|
||||
|
||||
## /count
|
||||
### /count
|
||||
|
||||
Return the number of trades used and available.
|
||||
```
|
||||
@@ -77,7 +129,7 @@ current max
|
||||
2 10
|
||||
```
|
||||
|
||||
## /profit
|
||||
### /profit
|
||||
|
||||
Return a summary of your profit/loss and performance.
|
||||
|
||||
@@ -94,17 +146,19 @@ Return a summary of your profit/loss and performance.
|
||||
> **Avg. Duration:** `2:33:45`
|
||||
> **Best Performing:** `PAY/BTC: 50.23%`
|
||||
|
||||
## /forcesell <trade_id>
|
||||
### /forcesell <trade_id>
|
||||
|
||||
> **BITTREX:** Selling BTC/LTC with limit `0.01650000 (profit: ~-4.07%, -0.00008168)`
|
||||
|
||||
## /forcebuy <pair>
|
||||
### /forcebuy <pair>
|
||||
|
||||
> **BITTREX**: Buying ETH/BTC with limit `0.03400000` (`1.000000 ETH`, `225.290 USD`)
|
||||
> **BITTREX:** Buying ETH/BTC with limit `0.03400000` (`1.000000 ETH`, `225.290 USD`)
|
||||
|
||||
Note that for this to work, `forcebuy_enable` needs to be set to true.
|
||||
|
||||
## /performance
|
||||
[More details](configuration.md/#understand-forcebuy_enable)
|
||||
|
||||
### /performance
|
||||
|
||||
Return the performance of each crypto-currency the bot has sold.
|
||||
> Performance:
|
||||
@@ -115,7 +169,7 @@ Return the performance of each crypto-currency the bot has sold.
|
||||
> 5. `STORJ/BTC 27.24%`
|
||||
> ...
|
||||
|
||||
## /balance
|
||||
### /balance
|
||||
|
||||
Return the balance of all crypto-currency your have on the exchange.
|
||||
|
||||
@@ -129,7 +183,7 @@ Return the balance of all crypto-currency your have on the exchange.
|
||||
> **Balance:** 86.64180098
|
||||
> **Pending:** 0.0
|
||||
|
||||
## /daily <n>
|
||||
### /daily <n>
|
||||
|
||||
Per default `/daily` will return the 7 last days.
|
||||
The example below if for `/daily 3`:
|
||||
@@ -143,6 +197,38 @@ Day Profit BTC Profit USD
|
||||
2018-01-01 0.00269130 BTC 34.986 USD
|
||||
```
|
||||
|
||||
## /version
|
||||
### /whitelist
|
||||
|
||||
Shows the current whitelist
|
||||
|
||||
> Using whitelist `StaticPairList` with 22 pairs
|
||||
> `IOTA/BTC, NEO/BTC, TRX/BTC, VET/BTC, ADA/BTC, ETC/BTC, NCASH/BTC, DASH/BTC, XRP/BTC, XVG/BTC, EOS/BTC, LTC/BTC, OMG/BTC, BTG/BTC, LSK/BTC, ZEC/BTC, HOT/BTC, IOTX/BTC, XMR/BTC, AST/BTC, XLM/BTC, NANO/BTC`
|
||||
|
||||
### /blacklist [pair]
|
||||
|
||||
Shows the current blacklist.
|
||||
If Pair is set, then this pair will be added to the pairlist.
|
||||
Also supports multiple pairs, seperated by a space.
|
||||
Use `/reload_conf` to reset the blacklist.
|
||||
|
||||
> Using blacklist `StaticPairList` with 2 pairs
|
||||
>`DODGE/BTC`, `HOT/BTC`.
|
||||
|
||||
### /edge
|
||||
|
||||
Shows pairs validated by Edge along with their corresponding winrate, expectancy and stoploss values.
|
||||
|
||||
> **Edge only validated following pairs:**
|
||||
```
|
||||
Pair Winrate Expectancy Stoploss
|
||||
-------- --------- ------------ ----------
|
||||
DOCK/ETH 0.522727 0.881821 -0.03
|
||||
PHX/ETH 0.677419 0.560488 -0.03
|
||||
HOT/ETH 0.733333 0.490492 -0.03
|
||||
HC/ETH 0.588235 0.280988 -0.02
|
||||
ARDR/ETH 0.366667 0.143059 -0.01
|
||||
```
|
||||
|
||||
### /version
|
||||
|
||||
> **Version:** `0.14.3`
|
||||
|
||||
370
docs/utils.md
Normal file
370
docs/utils.md
Normal file
@@ -0,0 +1,370 @@
|
||||
# Utility Subcommands
|
||||
|
||||
Besides the Live-Trade and Dry-Run run modes, the `backtesting`, `edge` and `hyperopt` optimization subcommands, and the `download-data` subcommand which prepares historical data, the bot contains a number of utility subcommands. They are described in this section.
|
||||
|
||||
## Create userdir
|
||||
|
||||
Creates the directory structure to hold your files for freqtrade.
|
||||
Will also create strategy and hyperopt examples for you to get started.
|
||||
Can be used multiple times - using `--reset` will reset the sample strategy and hyperopt files to their default state.
|
||||
|
||||
```
|
||||
usage: freqtrade create-userdir [-h] [--userdir PATH] [--reset]
|
||||
|
||||
optional arguments:
|
||||
-h, --help show this help message and exit
|
||||
--userdir PATH, --user-data-dir PATH
|
||||
Path to userdata directory.
|
||||
--reset Reset sample files to their original state.
|
||||
```
|
||||
|
||||
!!! Warning
|
||||
Using `--reset` may result in loss of data, since this will overwrite all sample files without asking again.
|
||||
|
||||
```
|
||||
├── backtest_results
|
||||
├── data
|
||||
├── hyperopt_results
|
||||
├── hyperopts
|
||||
│ ├── sample_hyperopt_advanced.py
|
||||
│ ├── sample_hyperopt_loss.py
|
||||
│ └── sample_hyperopt.py
|
||||
├── notebooks
|
||||
│ └── strategy_analysis_example.ipynb
|
||||
├── plot
|
||||
└── strategies
|
||||
└── sample_strategy.py
|
||||
```
|
||||
|
||||
## Create new strategy
|
||||
|
||||
Creates a new strategy from a template similar to SampleStrategy.
|
||||
The file will be named inline with your class name, and will not overwrite existing files.
|
||||
|
||||
Results will be located in `user_data/strategies/<strategyclassname>.py`.
|
||||
|
||||
``` output
|
||||
usage: freqtrade new-strategy [-h] [--userdir PATH] [-s NAME]
|
||||
[--template {full,minimal}]
|
||||
|
||||
optional arguments:
|
||||
-h, --help show this help message and exit
|
||||
--userdir PATH, --user-data-dir PATH
|
||||
Path to userdata directory.
|
||||
-s NAME, --strategy NAME
|
||||
Specify strategy class name which will be used by the
|
||||
bot.
|
||||
--template {full,minimal}
|
||||
Use a template which is either `minimal` or `full`
|
||||
(containing multiple sample indicators). Default:
|
||||
`full`.
|
||||
|
||||
```
|
||||
|
||||
### Sample usage of new-strategy
|
||||
|
||||
```bash
|
||||
freqtrade new-strategy --strategy AwesomeStrategy
|
||||
```
|
||||
|
||||
With custom user directory
|
||||
|
||||
```bash
|
||||
freqtrade new-strategy --userdir ~/.freqtrade/ --strategy AwesomeStrategy
|
||||
```
|
||||
|
||||
## Create new hyperopt
|
||||
|
||||
Creates a new hyperopt from a template similar to SampleHyperopt.
|
||||
The file will be named inline with your class name, and will not overwrite existing files.
|
||||
|
||||
Results will be located in `user_data/hyperopts/<classname>.py`.
|
||||
|
||||
``` output
|
||||
usage: freqtrade new-hyperopt [-h] [--userdir PATH] [--hyperopt NAME]
|
||||
[--template {full,minimal}]
|
||||
|
||||
optional arguments:
|
||||
-h, --help show this help message and exit
|
||||
--userdir PATH, --user-data-dir PATH
|
||||
Path to userdata directory.
|
||||
--hyperopt NAME Specify hyperopt class name which will be used by the
|
||||
bot.
|
||||
--template {full,minimal}
|
||||
Use a template which is either `minimal` or `full`
|
||||
(containing multiple sample indicators). Default:
|
||||
`full`.
|
||||
```
|
||||
|
||||
### Sample usage of new-hyperopt
|
||||
|
||||
```bash
|
||||
freqtrade new-hyperopt --hyperopt AwesomeHyperopt
|
||||
```
|
||||
|
||||
With custom user directory
|
||||
|
||||
```bash
|
||||
freqtrade new-hyperopt --userdir ~/.freqtrade/ --hyperopt AwesomeHyperopt
|
||||
```
|
||||
|
||||
## List Strategies
|
||||
|
||||
Use the `list-strategies` subcommand to see all strategies in one particular directory.
|
||||
|
||||
```
|
||||
freqtrade list-strategies --help
|
||||
usage: freqtrade list-strategies [-h] [-v] [--logfile FILE] [-V] [-c PATH] [-d PATH] [--userdir PATH] [--strategy-path PATH] [-1]
|
||||
|
||||
optional arguments:
|
||||
-h, --help show this help message and exit
|
||||
--strategy-path PATH Specify additional strategy lookup path.
|
||||
-1, --one-column Print output in one column.
|
||||
|
||||
Common arguments:
|
||||
-v, --verbose Verbose mode (-vv for more, -vvv to get all messages).
|
||||
--logfile FILE Log to the file specified. Special values are: 'syslog', 'journald'. See the documentation for more details.
|
||||
-V, --version show program's version number and exit
|
||||
-c PATH, --config PATH
|
||||
Specify configuration file (default: `config.json`). Multiple --config options may be used. Can be set to `-`
|
||||
to read config from stdin.
|
||||
-d PATH, --datadir PATH
|
||||
Path to directory with historical backtesting data.
|
||||
--userdir PATH, --user-data-dir PATH
|
||||
Path to userdata directory.
|
||||
```
|
||||
|
||||
!!! Warning
|
||||
Using this command will try to load all python files from a directory. This can be a security risk if untrusted files reside in this directory, since all module-level code is executed.
|
||||
|
||||
Example: search default strategy directory within userdir
|
||||
|
||||
``` bash
|
||||
freqtrade list-strategies --userdir ~/.freqtrade/
|
||||
```
|
||||
|
||||
Example: search dedicated strategy path
|
||||
|
||||
``` bash
|
||||
freqtrade list-strategies --strategy-path ~/.freqtrade/strategies/
|
||||
```
|
||||
|
||||
## List Exchanges
|
||||
|
||||
Use the `list-exchanges` subcommand to see the exchanges available for the bot.
|
||||
|
||||
```
|
||||
usage: freqtrade list-exchanges [-h] [-1] [-a]
|
||||
|
||||
optional arguments:
|
||||
-h, --help show this help message and exit
|
||||
-1, --one-column Print output in one column.
|
||||
-a, --all Print all exchanges known to the ccxt library.
|
||||
```
|
||||
|
||||
* Example: see exchanges available for the bot:
|
||||
```
|
||||
$ freqtrade list-exchanges
|
||||
Exchanges available for Freqtrade: _1btcxe, acx, allcoin, bequant, bibox, binance, binanceje, binanceus, bitbank, bitfinex, bitfinex2, bitkk, bitlish, bitmart, bittrex, bitz, bleutrade, btcalpha, btcmarkets, btcturk, buda, cex, cobinhood, coinbaseprime, coinbasepro, coinex, cointiger, coss, crex24, digifinex, dsx, dx, ethfinex, fcoin, fcoinjp, gateio, gdax, gemini, hitbtc2, huobipro, huobiru, idex, kkex, kraken, kucoin, kucoin2, kuna, lbank, mandala, mercado, oceanex, okcoincny, okcoinusd, okex, okex3, poloniex, rightbtc, theocean, tidebit, upbit, zb
|
||||
```
|
||||
|
||||
* Example: see all exchanges supported by the ccxt library (including 'bad' ones, i.e. those that are known to not work with Freqtrade):
|
||||
```
|
||||
$ freqtrade list-exchanges -a
|
||||
All exchanges supported by the ccxt library: _1btcxe, acx, adara, allcoin, anxpro, bcex, bequant, bibox, bigone, binance, binanceje, binanceus, bit2c, bitbank, bitbay, bitfinex, bitfinex2, bitflyer, bitforex, bithumb, bitkk, bitlish, bitmart, bitmex, bitso, bitstamp, bitstamp1, bittrex, bitz, bl3p, bleutrade, braziliex, btcalpha, btcbox, btcchina, btcmarkets, btctradeim, btctradeua, btcturk, buda, bxinth, cex, chilebit, cobinhood, coinbase, coinbaseprime, coinbasepro, coincheck, coinegg, coinex, coinexchange, coinfalcon, coinfloor, coingi, coinmarketcap, coinmate, coinone, coinspot, cointiger, coolcoin, coss, crex24, crypton, deribit, digifinex, dsx, dx, ethfinex, exmo, exx, fcoin, fcoinjp, flowbtc, foxbit, fybse, gateio, gdax, gemini, hitbtc, hitbtc2, huobipro, huobiru, ice3x, idex, independentreserve, indodax, itbit, kkex, kraken, kucoin, kucoin2, kuna, lakebtc, latoken, lbank, liquid, livecoin, luno, lykke, mandala, mercado, mixcoins, negociecoins, nova, oceanex, okcoincny, okcoinusd, okex, okex3, paymium, poloniex, rightbtc, southxchange, stronghold, surbitcoin, theocean, therock, tidebit, tidex, upbit, vaultoro, vbtc, virwox, xbtce, yobit, zaif, zb
|
||||
```
|
||||
|
||||
## List Timeframes
|
||||
|
||||
Use the `list-timeframes` subcommand to see the list of ticker intervals (timeframes) available for the exchange.
|
||||
|
||||
```
|
||||
usage: freqtrade list-timeframes [-h] [--exchange EXCHANGE] [-1]
|
||||
|
||||
optional arguments:
|
||||
-h, --help show this help message and exit
|
||||
--exchange EXCHANGE Exchange name (default: `bittrex`). Only valid if no
|
||||
config is provided.
|
||||
-1, --one-column Print output in one column.
|
||||
|
||||
```
|
||||
|
||||
* Example: see the timeframes for the 'binance' exchange, set in the configuration file:
|
||||
|
||||
```
|
||||
$ freqtrade -c config_binance.json list-timeframes
|
||||
...
|
||||
Timeframes available for the exchange `binance`: 1m, 3m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 8h, 12h, 1d, 3d, 1w, 1M
|
||||
```
|
||||
|
||||
* Example: enumerate exchanges available for Freqtrade and print timeframes supported by each of them:
|
||||
```
|
||||
$ for i in `freqtrade list-exchanges -1`; do freqtrade list-timeframes --exchange $i; done
|
||||
```
|
||||
|
||||
## List pairs/list markets
|
||||
|
||||
The `list-pairs` and `list-markets` subcommands allow to see the pairs/markets available on exchange.
|
||||
|
||||
Pairs are markets with the '/' character between the base currency part and the quote currency part in the market symbol.
|
||||
For example, in the 'ETH/BTC' pair 'ETH' is the base currency, while 'BTC' is the quote currency.
|
||||
|
||||
For pairs traded by Freqtrade the pair quote currency is defined by the value of the `stake_currency` configuration setting.
|
||||
|
||||
You can print info about any pair/market with these subcommands - and you can filter output by quote-currency using `--quote BTC`, or by base-currency using `--base ETH` options correspondingly.
|
||||
|
||||
These subcommands have same usage and same set of available options:
|
||||
|
||||
```
|
||||
usage: freqtrade list-markets [-h] [--exchange EXCHANGE] [--print-list]
|
||||
[--print-json] [-1] [--print-csv]
|
||||
[--base BASE_CURRENCY [BASE_CURRENCY ...]]
|
||||
[--quote QUOTE_CURRENCY [QUOTE_CURRENCY ...]]
|
||||
[-a]
|
||||
|
||||
usage: freqtrade list-pairs [-h] [--exchange EXCHANGE] [--print-list]
|
||||
[--print-json] [-1] [--print-csv]
|
||||
[--base BASE_CURRENCY [BASE_CURRENCY ...]]
|
||||
[--quote QUOTE_CURRENCY [QUOTE_CURRENCY ...]] [-a]
|
||||
|
||||
optional arguments:
|
||||
-h, --help show this help message and exit
|
||||
--exchange EXCHANGE Exchange name (default: `bittrex`). Only valid if no
|
||||
config is provided.
|
||||
--print-list Print list of pairs or market symbols. By default data
|
||||
is printed in the tabular format.
|
||||
--print-json Print list of pairs or market symbols in JSON format.
|
||||
-1, --one-column Print output in one column.
|
||||
--print-csv Print exchange pair or market data in the csv format.
|
||||
--base BASE_CURRENCY [BASE_CURRENCY ...]
|
||||
Specify base currency(-ies). Space-separated list.
|
||||
--quote QUOTE_CURRENCY [QUOTE_CURRENCY ...]
|
||||
Specify quote currency(-ies). Space-separated list.
|
||||
-a, --all Print all pairs or market symbols. By default only
|
||||
active ones are shown.
|
||||
```
|
||||
|
||||
By default, only active pairs/markets are shown. Active pairs/markets are those that can currently be traded
|
||||
on the exchange. The see the list of all pairs/markets (not only the active ones), use the `-a`/`-all` option.
|
||||
|
||||
Pairs/markets are sorted by its symbol string in the printed output.
|
||||
|
||||
### Examples
|
||||
|
||||
* Print the list of active pairs with quote currency USD on exchange, specified in the default
|
||||
configuration file (i.e. pairs on the "Bittrex" exchange) in JSON format:
|
||||
|
||||
```
|
||||
$ freqtrade list-pairs --quote USD --print-json
|
||||
```
|
||||
|
||||
* Print the list of all pairs on the exchange, specified in the `config_binance.json` configuration file
|
||||
(i.e. on the "Binance" exchange) with base currencies BTC or ETH and quote currencies USDT or USD, as the
|
||||
human-readable list with summary:
|
||||
|
||||
```
|
||||
$ freqtrade -c config_binance.json list-pairs --all --base BTC ETH --quote USDT USD --print-list
|
||||
```
|
||||
|
||||
* Print all markets on exchange "Kraken", in the tabular format:
|
||||
|
||||
```
|
||||
$ freqtrade list-markets --exchange kraken --all
|
||||
```
|
||||
|
||||
## Test pairlist
|
||||
|
||||
Use the `test-pairlist` subcommand to test the configuration of [dynamic pairlists](configuration.md#pairlists).
|
||||
|
||||
Requires a configuration with specified `pairlists` attribute.
|
||||
Can be used to generate static pairlists to be used during backtesting / hyperopt.
|
||||
|
||||
```
|
||||
usage: freqtrade test-pairlist [-h] [-c PATH]
|
||||
[--quote QUOTE_CURRENCY [QUOTE_CURRENCY ...]]
|
||||
[-1] [--print-json]
|
||||
|
||||
optional arguments:
|
||||
-h, --help show this help message and exit
|
||||
-c PATH, --config PATH
|
||||
Specify configuration file (default: `config.json`).
|
||||
Multiple --config options may be used. Can be set to
|
||||
`-` to read config from stdin.
|
||||
--quote QUOTE_CURRENCY [QUOTE_CURRENCY ...]
|
||||
Specify quote currency(-ies). Space-separated list.
|
||||
-1, --one-column Print output in one column.
|
||||
--print-json Print list of pairs or market symbols in JSON format.
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
Show whitelist when using a [dynamic pairlist](configuration.md#pairlists).
|
||||
|
||||
```
|
||||
freqtrade test-pairlist --config config.json --quote USDT BTC
|
||||
```
|
||||
|
||||
## List Hyperopt results
|
||||
|
||||
You can list the hyperoptimization epochs the Hyperopt module evaluated previously with the `hyperopt-list` subcommand.
|
||||
|
||||
```
|
||||
usage: freqtrade hyperopt-list [-h] [-v] [--logfile FILE] [-V] [-c PATH]
|
||||
[-d PATH] [--userdir PATH] [--best]
|
||||
[--profitable] [--no-color] [--print-json]
|
||||
[--no-details]
|
||||
|
||||
optional arguments:
|
||||
-h, --help show this help message and exit
|
||||
--best Select only best epochs.
|
||||
--profitable Select only profitable epochs.
|
||||
--no-color Disable colorization of hyperopt results. May be
|
||||
useful if you are redirecting output to a file.
|
||||
--print-json Print best result detailization in JSON format.
|
||||
--no-details Do not print best epoch details.
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
List all results, print details of the best result at the end:
|
||||
```
|
||||
freqtrade hyperopt-list
|
||||
```
|
||||
|
||||
List only epochs with positive profit. Do not print the details of the best epoch, so that the list can be iterated in a script:
|
||||
```
|
||||
freqtrade hyperopt-list --profitable --no-details
|
||||
```
|
||||
|
||||
## Show details of Hyperopt results
|
||||
|
||||
You can show the details of any hyperoptimization epoch previously evaluated by the Hyperopt module with the `hyperopt-show` subcommand.
|
||||
|
||||
```
|
||||
usage: freqtrade hyperopt-show [-h] [-v] [--logfile FILE] [-V] [-c PATH]
|
||||
[-d PATH] [--userdir PATH] [--best]
|
||||
[--profitable] [-n INT] [--print-json]
|
||||
[--no-header]
|
||||
|
||||
optional arguments:
|
||||
-h, --help show this help message and exit
|
||||
--best Select only best epochs.
|
||||
--profitable Select only profitable epochs.
|
||||
-n INT, --index INT Specify the index of the epoch to print details for.
|
||||
--print-json Print best result detailization in JSON format.
|
||||
--no-header Do not print epoch details header.
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
Print details for the epoch 168 (the number of the epoch is shown by the `hyperopt-list` subcommand or by Hyperopt itself during hyperoptimization run):
|
||||
|
||||
```
|
||||
freqtrade hyperopt-show -n 168
|
||||
```
|
||||
|
||||
Prints JSON data with details for the last best epoch (i.e., the best of all epochs):
|
||||
|
||||
```
|
||||
freqtrade hyperopt-show --best -n -1 --print-json --no-header
|
||||
```
|
||||
@@ -1,7 +1,5 @@
|
||||
# Webhook usage
|
||||
|
||||
This page explains how to configure your bot to talk to webhooks.
|
||||
|
||||
## Configuration
|
||||
|
||||
Enable webhooks by adding a webhook-section to your configuration file, and setting `webhook.enabled` to `true`.
|
||||
@@ -39,34 +37,34 @@ Different payloads can be configured for different events. Not all fields are ne
|
||||
The fields in `webhook.webhookbuy` are filled when the bot executes a buy. Parameters are filled using string.format.
|
||||
Possible parameters are:
|
||||
|
||||
* exchange
|
||||
* pair
|
||||
* market_url
|
||||
* limit
|
||||
* stake_amount
|
||||
* stake_amount_fiat
|
||||
* stake_currency
|
||||
* fiat_currency
|
||||
* `exchange`
|
||||
* `pair`
|
||||
* `limit`
|
||||
* `stake_amount`
|
||||
* `stake_currency`
|
||||
* `fiat_currency`
|
||||
* `order_type`
|
||||
|
||||
### Webhooksell
|
||||
|
||||
The fields in `webhook.webhooksell` are filled when the bot sells a trade. Parameters are filled using string.format.
|
||||
Possible parameters are:
|
||||
|
||||
* exchange
|
||||
* pair
|
||||
* gain
|
||||
* market_url
|
||||
* limit
|
||||
* amount
|
||||
* open_rate
|
||||
* current_rate
|
||||
* profit_amount
|
||||
* profit_percent
|
||||
* profit_fiat
|
||||
* stake_currency
|
||||
* fiat_currency
|
||||
* sell_reason
|
||||
* `exchange`
|
||||
* `pair`
|
||||
* `gain`
|
||||
* `limit`
|
||||
* `amount`
|
||||
* `open_rate`
|
||||
* `current_rate`
|
||||
* `profit_amount`
|
||||
* `profit_percent`
|
||||
* `stake_currency`
|
||||
* `fiat_currency`
|
||||
* `sell_reason`
|
||||
* `order_type`
|
||||
* `open_date`
|
||||
* `close_date`
|
||||
|
||||
### Webhookstatus
|
||||
|
||||
|
||||
60
environment.yml
Normal file
60
environment.yml
Normal file
@@ -0,0 +1,60 @@
|
||||
name: freqtrade
|
||||
channels:
|
||||
- defaults
|
||||
- conda-forge
|
||||
dependencies:
|
||||
# Required for app
|
||||
- python>=3.6
|
||||
- pip
|
||||
- wheel
|
||||
- numpy
|
||||
- pandas
|
||||
- SQLAlchemy
|
||||
- arrow
|
||||
- requests
|
||||
- urllib3
|
||||
- wrapt
|
||||
- jsonschema
|
||||
- tabulate
|
||||
- python-rapidjson
|
||||
- flask
|
||||
- python-dotenv
|
||||
- cachetools
|
||||
- python-telegram-bot
|
||||
# Optional for plotting
|
||||
- plotly
|
||||
# Optional for hyperopt
|
||||
- scipy
|
||||
- scikit-optimize
|
||||
- scikit-learn
|
||||
- filelock
|
||||
- joblib
|
||||
# Optional for development
|
||||
- flake8
|
||||
- pytest
|
||||
- pytest-mock
|
||||
- pytest-asyncio
|
||||
- pytest-cov
|
||||
- coveralls
|
||||
- mypy
|
||||
# Useful for jupyter
|
||||
- jupyter
|
||||
- ipykernel
|
||||
- isort
|
||||
- yapf
|
||||
- pip:
|
||||
# Required for app
|
||||
- cython
|
||||
- coinmarketcap
|
||||
- ccxt
|
||||
- TA-Lib
|
||||
- py_find_1st
|
||||
- sdnotify
|
||||
# Optional for develpment
|
||||
- flake8-tidy-imports
|
||||
- flake8-type-annotations
|
||||
- pytest-random-order
|
||||
- -e .
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ After=network.target
|
||||
# Set WorkingDirectory and ExecStart to your file paths accordingly
|
||||
# NOTE: %h will be resolved to /home/<username>
|
||||
WorkingDirectory=%h/freqtrade
|
||||
ExecStart=/usr/bin/freqtrade --dynamic-whitelist 40
|
||||
ExecStart=/usr/bin/freqtrade trade
|
||||
Restart=on-failure
|
||||
|
||||
[Install]
|
||||
|
||||
30
freqtrade.service.watchdog
Normal file
30
freqtrade.service.watchdog
Normal file
@@ -0,0 +1,30 @@
|
||||
[Unit]
|
||||
Description=Freqtrade Daemon
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
# Set WorkingDirectory and ExecStart to your file paths accordingly
|
||||
# NOTE: %h will be resolved to /home/<username>
|
||||
WorkingDirectory=%h/freqtrade
|
||||
ExecStart=/usr/bin/freqtrade trade --sd-notify
|
||||
|
||||
Restart=always
|
||||
#Restart=on-failure
|
||||
|
||||
# Note that we use Type=notify here
|
||||
Type=notify
|
||||
|
||||
# Currently required if Type=notify
|
||||
NotifyAccess=all
|
||||
|
||||
StartLimitInterval=1min
|
||||
StartLimitBurst=5
|
||||
|
||||
TimeoutStartSec=1min
|
||||
|
||||
# Use here (process_throttle_secs * 2) or longer time interval
|
||||
WatchdogSec=20
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
|
||||
@@ -1,25 +1,13 @@
|
||||
""" FreqTrade bot """
|
||||
__version__ = '0.18.1'
|
||||
__version__ = '2020.01'
|
||||
|
||||
if __version__ == 'develop':
|
||||
|
||||
class DependencyException(BaseException):
|
||||
"""
|
||||
Indicates that a assumed dependency is not met.
|
||||
This could happen when there is currently not enough money on the account.
|
||||
"""
|
||||
|
||||
|
||||
class OperationalException(BaseException):
|
||||
"""
|
||||
Requires manual intervention.
|
||||
This happens when an exchange returns an unexpected error during runtime
|
||||
or given configuration is invalid.
|
||||
"""
|
||||
|
||||
|
||||
class TemporaryError(BaseException):
|
||||
"""
|
||||
Temporary network or exchange related error.
|
||||
This could happen when an exchange is congested, unavailable, or the user
|
||||
has networking problems. Usually resolves itself after a time.
|
||||
"""
|
||||
try:
|
||||
import subprocess
|
||||
__version__ = 'develop-' + subprocess.check_output(
|
||||
['git', 'log', '--format="%h"', '-n 1'],
|
||||
stderr=subprocess.DEVNULL).decode("utf-8").rstrip().strip('"')
|
||||
except Exception:
|
||||
# git not available, ignore
|
||||
pass
|
||||
|
||||
@@ -6,10 +6,7 @@ To launch Freqtrade as a module
|
||||
> python -m freqtrade (with Python >= 3.6)
|
||||
"""
|
||||
|
||||
import sys
|
||||
|
||||
from freqtrade import main
|
||||
|
||||
if __name__ == '__main__':
|
||||
main.set_loggers()
|
||||
main.main(sys.argv[1:])
|
||||
main.main()
|
||||
|
||||
@@ -1,423 +0,0 @@
|
||||
"""
|
||||
This module contains the argument manager class
|
||||
"""
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import re
|
||||
from typing import List, NamedTuple, Optional
|
||||
|
||||
import arrow
|
||||
|
||||
from freqtrade import __version__, constants
|
||||
|
||||
|
||||
class TimeRange(NamedTuple):
|
||||
"""
|
||||
NamedTuple Defining timerange inputs.
|
||||
[start/stop]type defines if [start/stop]ts shall be used.
|
||||
if *type is none, don't use corresponding startvalue.
|
||||
"""
|
||||
starttype: Optional[str] = None
|
||||
stoptype: Optional[str] = None
|
||||
startts: int = 0
|
||||
stopts: int = 0
|
||||
|
||||
|
||||
class Arguments(object):
|
||||
"""
|
||||
Arguments Class. Manage the arguments received by the cli
|
||||
"""
|
||||
|
||||
def __init__(self, args: List[str], description: str) -> None:
|
||||
self.args = args
|
||||
self.parsed_arg: Optional[argparse.Namespace] = None
|
||||
self.parser = argparse.ArgumentParser(description=description)
|
||||
|
||||
def _load_args(self) -> None:
|
||||
self.common_args_parser()
|
||||
self._build_subcommands()
|
||||
|
||||
def get_parsed_arg(self) -> argparse.Namespace:
|
||||
"""
|
||||
Return the list of arguments
|
||||
:return: List[str] List of arguments
|
||||
"""
|
||||
if self.parsed_arg is None:
|
||||
self._load_args()
|
||||
self.parsed_arg = self.parse_args()
|
||||
|
||||
return self.parsed_arg
|
||||
|
||||
def parse_args(self) -> argparse.Namespace:
|
||||
"""
|
||||
Parses given arguments and returns an argparse Namespace instance.
|
||||
"""
|
||||
parsed_arg = self.parser.parse_args(self.args)
|
||||
|
||||
return parsed_arg
|
||||
|
||||
def common_args_parser(self) -> None:
|
||||
"""
|
||||
Parses given common arguments and returns them as a parsed object.
|
||||
"""
|
||||
self.parser.add_argument(
|
||||
'-v', '--verbose',
|
||||
help='verbose mode (-vv for more, -vvv to get all messages)',
|
||||
action='count',
|
||||
dest='loglevel',
|
||||
default=0,
|
||||
)
|
||||
self.parser.add_argument(
|
||||
'--version',
|
||||
action='version',
|
||||
version=f'%(prog)s {__version__}'
|
||||
)
|
||||
self.parser.add_argument(
|
||||
'-c', '--config',
|
||||
help='specify configuration file (default: %(default)s)',
|
||||
dest='config',
|
||||
default='config.json',
|
||||
type=str,
|
||||
metavar='PATH',
|
||||
)
|
||||
self.parser.add_argument(
|
||||
'-d', '--datadir',
|
||||
help='path to backtest data',
|
||||
dest='datadir',
|
||||
default=None,
|
||||
type=str,
|
||||
metavar='PATH',
|
||||
)
|
||||
self.parser.add_argument(
|
||||
'-s', '--strategy',
|
||||
help='specify strategy class name (default: %(default)s)',
|
||||
dest='strategy',
|
||||
default='DefaultStrategy',
|
||||
type=str,
|
||||
metavar='NAME',
|
||||
)
|
||||
self.parser.add_argument(
|
||||
'--strategy-path',
|
||||
help='specify additional strategy lookup path',
|
||||
dest='strategy_path',
|
||||
type=str,
|
||||
metavar='PATH',
|
||||
)
|
||||
self.parser.add_argument(
|
||||
'--customhyperopt',
|
||||
help='specify hyperopt class name (default: %(default)s)',
|
||||
dest='hyperopt',
|
||||
default=constants.DEFAULT_HYPEROPT,
|
||||
type=str,
|
||||
metavar='NAME',
|
||||
)
|
||||
self.parser.add_argument(
|
||||
'--dynamic-whitelist',
|
||||
help='dynamically generate and update whitelist'
|
||||
' based on 24h BaseVolume (default: %(const)s)'
|
||||
' DEPRECATED.',
|
||||
dest='dynamic_whitelist',
|
||||
const=constants.DYNAMIC_WHITELIST,
|
||||
type=int,
|
||||
metavar='INT',
|
||||
nargs='?',
|
||||
)
|
||||
self.parser.add_argument(
|
||||
'--db-url',
|
||||
help='Override trades database URL, this is useful if dry_run is enabled'
|
||||
' or in custom deployments (default: %(default)s)',
|
||||
dest='db_url',
|
||||
type=str,
|
||||
metavar='PATH',
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def backtesting_options(parser: argparse.ArgumentParser) -> None:
|
||||
"""
|
||||
Parses given arguments for Backtesting scripts.
|
||||
"""
|
||||
parser.add_argument(
|
||||
'--eps', '--enable-position-stacking',
|
||||
help='Allow buying the same pair multiple times (position stacking)',
|
||||
action='store_true',
|
||||
dest='position_stacking',
|
||||
default=False
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
'--dmmp', '--disable-max-market-positions',
|
||||
help='Disable applying `max_open_trades` during backtest '
|
||||
'(same as setting `max_open_trades` to a very high number)',
|
||||
action='store_false',
|
||||
dest='use_max_market_positions',
|
||||
default=True
|
||||
)
|
||||
parser.add_argument(
|
||||
'-l', '--live',
|
||||
help='using live data',
|
||||
action='store_true',
|
||||
dest='live',
|
||||
)
|
||||
parser.add_argument(
|
||||
'-r', '--refresh-pairs-cached',
|
||||
help='refresh the pairs files in tests/testdata with the latest data from the '
|
||||
'exchange. Use it if you want to run your backtesting with up-to-date data.',
|
||||
action='store_true',
|
||||
dest='refresh_pairs',
|
||||
)
|
||||
parser.add_argument(
|
||||
'--strategy-list',
|
||||
help='Provide a commaseparated list of strategies to backtest '
|
||||
'Please note that ticker-interval needs to be set either in config '
|
||||
'or via command line. When using this together with --export trades, '
|
||||
'the strategy-name is injected into the filename '
|
||||
'(so backtest-data.json becomes backtest-data-DefaultStrategy.json',
|
||||
nargs='+',
|
||||
dest='strategy_list',
|
||||
)
|
||||
parser.add_argument(
|
||||
'--export',
|
||||
help='export backtest results, argument are: trades\
|
||||
Example --export=trades',
|
||||
type=str,
|
||||
default=None,
|
||||
dest='export',
|
||||
)
|
||||
parser.add_argument(
|
||||
'--export-filename',
|
||||
help='Save backtest results to this filename \
|
||||
requires --export to be set as well\
|
||||
Example --export-filename=user_data/backtest_data/backtest_today.json\
|
||||
(default: %(default)s)',
|
||||
type=str,
|
||||
default=os.path.join('user_data', 'backtest_data', 'backtest-result.json'),
|
||||
dest='exportfilename',
|
||||
metavar='PATH',
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def edge_options(parser: argparse.ArgumentParser) -> None:
|
||||
"""
|
||||
Parses given arguments for Backtesting scripts.
|
||||
"""
|
||||
parser.add_argument(
|
||||
'-r', '--refresh-pairs-cached',
|
||||
help='refresh the pairs files in tests/testdata with the latest data from the '
|
||||
'exchange. Use it if you want to run your edge with up-to-date data.',
|
||||
action='store_true',
|
||||
dest='refresh_pairs',
|
||||
)
|
||||
parser.add_argument(
|
||||
'--stoplosses',
|
||||
help='defines a range of stoploss against which edge will assess the strategy '
|
||||
'the format is "min,max,step" (without any space).'
|
||||
'example: --stoplosses=-0.01,-0.1,-0.001',
|
||||
type=str,
|
||||
dest='stoploss_range',
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def optimizer_shared_options(parser: argparse.ArgumentParser) -> None:
|
||||
"""
|
||||
Parses given common arguments for Backtesting and Hyperopt scripts.
|
||||
:param parser:
|
||||
:return:
|
||||
"""
|
||||
parser.add_argument(
|
||||
'-i', '--ticker-interval',
|
||||
help='specify ticker interval (1m, 5m, 30m, 1h, 1d)',
|
||||
dest='ticker_interval',
|
||||
type=str,
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
'--timerange',
|
||||
help='specify what timerange of data to use.',
|
||||
default=None,
|
||||
type=str,
|
||||
dest='timerange',
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def hyperopt_options(parser: argparse.ArgumentParser) -> None:
|
||||
"""
|
||||
Parses given arguments for Hyperopt scripts.
|
||||
"""
|
||||
parser.add_argument(
|
||||
'--eps', '--enable-position-stacking',
|
||||
help='Allow buying the same pair multiple times (position stacking)',
|
||||
action='store_true',
|
||||
dest='position_stacking',
|
||||
default=False
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
'--dmmp', '--disable-max-market-positions',
|
||||
help='Disable applying `max_open_trades` during backtest '
|
||||
'(same as setting `max_open_trades` to a very high number)',
|
||||
action='store_false',
|
||||
dest='use_max_market_positions',
|
||||
default=True
|
||||
)
|
||||
parser.add_argument(
|
||||
'-e', '--epochs',
|
||||
help='specify number of epochs (default: %(default)d)',
|
||||
dest='epochs',
|
||||
default=constants.HYPEROPT_EPOCH,
|
||||
type=int,
|
||||
metavar='INT',
|
||||
)
|
||||
parser.add_argument(
|
||||
'-s', '--spaces',
|
||||
help='Specify which parameters to hyperopt. Space separate list. \
|
||||
Default: %(default)s',
|
||||
choices=['all', 'buy', 'sell', 'roi', 'stoploss'],
|
||||
default='all',
|
||||
nargs='+',
|
||||
dest='spaces',
|
||||
)
|
||||
|
||||
def _build_subcommands(self) -> None:
|
||||
"""
|
||||
Builds and attaches all subcommands
|
||||
:return: None
|
||||
"""
|
||||
from freqtrade.optimize import backtesting, hyperopt, edge_cli
|
||||
|
||||
subparsers = self.parser.add_subparsers(dest='subparser')
|
||||
|
||||
# Add backtesting subcommand
|
||||
backtesting_cmd = subparsers.add_parser('backtesting', help='backtesting module')
|
||||
backtesting_cmd.set_defaults(func=backtesting.start)
|
||||
self.optimizer_shared_options(backtesting_cmd)
|
||||
self.backtesting_options(backtesting_cmd)
|
||||
|
||||
# Add edge subcommand
|
||||
edge_cmd = subparsers.add_parser('edge', help='edge module')
|
||||
edge_cmd.set_defaults(func=edge_cli.start)
|
||||
self.optimizer_shared_options(edge_cmd)
|
||||
self.edge_options(edge_cmd)
|
||||
|
||||
# Add hyperopt subcommand
|
||||
hyperopt_cmd = subparsers.add_parser('hyperopt', help='hyperopt module')
|
||||
hyperopt_cmd.set_defaults(func=hyperopt.start)
|
||||
self.optimizer_shared_options(hyperopt_cmd)
|
||||
self.hyperopt_options(hyperopt_cmd)
|
||||
|
||||
@staticmethod
|
||||
def parse_timerange(text: Optional[str]) -> TimeRange:
|
||||
"""
|
||||
Parse the value of the argument --timerange to determine what is the range desired
|
||||
:param text: value from --timerange
|
||||
:return: Start and End range period
|
||||
"""
|
||||
if text is None:
|
||||
return TimeRange(None, None, 0, 0)
|
||||
syntax = [(r'^-(\d{8})$', (None, 'date')),
|
||||
(r'^(\d{8})-$', ('date', None)),
|
||||
(r'^(\d{8})-(\d{8})$', ('date', 'date')),
|
||||
(r'^-(\d{10})$', (None, 'date')),
|
||||
(r'^(\d{10})-$', ('date', None)),
|
||||
(r'^(\d{10})-(\d{10})$', ('date', 'date')),
|
||||
(r'^(-\d+)$', (None, 'line')),
|
||||
(r'^(\d+)-$', ('line', None)),
|
||||
(r'^(\d+)-(\d+)$', ('index', 'index'))]
|
||||
for rex, stype in syntax:
|
||||
# Apply the regular expression to text
|
||||
match = re.match(rex, text)
|
||||
if match: # Regex has matched
|
||||
rvals = match.groups()
|
||||
index = 0
|
||||
start: int = 0
|
||||
stop: int = 0
|
||||
if stype[0]:
|
||||
starts = rvals[index]
|
||||
if stype[0] == 'date' and len(starts) == 8:
|
||||
start = arrow.get(starts, 'YYYYMMDD').timestamp
|
||||
else:
|
||||
start = int(starts)
|
||||
index += 1
|
||||
if stype[1]:
|
||||
stops = rvals[index]
|
||||
if stype[1] == 'date' and len(stops) == 8:
|
||||
stop = arrow.get(stops, 'YYYYMMDD').timestamp
|
||||
else:
|
||||
stop = int(stops)
|
||||
return TimeRange(stype[0], stype[1], start, stop)
|
||||
raise Exception('Incorrect syntax for timerange "%s"' % text)
|
||||
|
||||
def scripts_options(self) -> None:
|
||||
"""
|
||||
Parses given arguments for scripts.
|
||||
"""
|
||||
self.parser.add_argument(
|
||||
'-p', '--pairs',
|
||||
help='Show profits for only this pairs. Pairs are comma-separated.',
|
||||
dest='pairs',
|
||||
default=None
|
||||
)
|
||||
|
||||
def testdata_dl_options(self) -> None:
|
||||
"""
|
||||
Parses given arguments for testdata download
|
||||
"""
|
||||
self.parser.add_argument(
|
||||
'--pairs-file',
|
||||
help='File containing a list of pairs to download',
|
||||
dest='pairs_file',
|
||||
default=None,
|
||||
metavar='PATH',
|
||||
)
|
||||
|
||||
self.parser.add_argument(
|
||||
'--export',
|
||||
help='Export files to given dir',
|
||||
dest='export',
|
||||
default=None,
|
||||
metavar='PATH',
|
||||
)
|
||||
|
||||
self.parser.add_argument(
|
||||
'-c', '--config',
|
||||
help='specify configuration file, used for additional exchange parameters',
|
||||
dest='config',
|
||||
default=None,
|
||||
type=str,
|
||||
metavar='PATH',
|
||||
)
|
||||
|
||||
self.parser.add_argument(
|
||||
'--days',
|
||||
help='Download data for number of days',
|
||||
dest='days',
|
||||
type=int,
|
||||
metavar='INT',
|
||||
default=None
|
||||
)
|
||||
|
||||
self.parser.add_argument(
|
||||
'--exchange',
|
||||
help='Exchange name (default: %(default)s). Only valid if no config is provided',
|
||||
dest='exchange',
|
||||
type=str,
|
||||
default='bittrex'
|
||||
)
|
||||
|
||||
self.parser.add_argument(
|
||||
'-t', '--timeframes',
|
||||
help='Specify which tickers to download. Space separated list. \
|
||||
Default: %(default)s',
|
||||
choices=['1m', '3m', '5m', '15m', '30m', '1h', '2h', '4h',
|
||||
'6h', '8h', '12h', '1d', '3d', '1w'],
|
||||
default=['1m', '5m'],
|
||||
nargs='+',
|
||||
dest='timeframes',
|
||||
)
|
||||
|
||||
self.parser.add_argument(
|
||||
'--erase',
|
||||
help='Clean all existing data for the selected exchange/pairs/timeframes',
|
||||
dest='erase',
|
||||
action='store_true'
|
||||
)
|
||||
25
freqtrade/commands/__init__.py
Normal file
25
freqtrade/commands/__init__.py
Normal file
@@ -0,0 +1,25 @@
|
||||
# flake8: noqa: F401
|
||||
"""
|
||||
Commands module.
|
||||
Contains all start-commands, subcommands and CLI Interface creation.
|
||||
|
||||
Note: Be careful with file-scoped imports in these subfiles.
|
||||
as they are parsed on startup, nothing containing optional modules should be loaded.
|
||||
"""
|
||||
from freqtrade.commands.arguments import Arguments
|
||||
from freqtrade.commands.data_commands import start_download_data
|
||||
from freqtrade.commands.deploy_commands import (start_create_userdir,
|
||||
start_new_hyperopt,
|
||||
start_new_strategy)
|
||||
from freqtrade.commands.hyperopt_commands import (start_hyperopt_list,
|
||||
start_hyperopt_show)
|
||||
from freqtrade.commands.list_commands import (start_list_exchanges,
|
||||
start_list_markets,
|
||||
start_list_strategies,
|
||||
start_list_timeframes)
|
||||
from freqtrade.commands.optimize_commands import (start_backtesting,
|
||||
start_edge, start_hyperopt)
|
||||
from freqtrade.commands.pairlist_commands import start_test_pairlist
|
||||
from freqtrade.commands.plot_commands import (start_plot_dataframe,
|
||||
start_plot_profit)
|
||||
from freqtrade.commands.trade_commands import start_trading
|
||||
288
freqtrade/commands/arguments.py
Normal file
288
freqtrade/commands/arguments.py
Normal file
@@ -0,0 +1,288 @@
|
||||
"""
|
||||
This module contains the argument manager class
|
||||
"""
|
||||
import argparse
|
||||
from functools import partial
|
||||
from pathlib import Path
|
||||
from typing import Any, Dict, List, Optional
|
||||
|
||||
from freqtrade import constants
|
||||
from freqtrade.commands.cli_options import AVAILABLE_CLI_OPTIONS
|
||||
|
||||
ARGS_COMMON = ["verbosity", "logfile", "version", "config", "datadir", "user_data_dir"]
|
||||
|
||||
ARGS_STRATEGY = ["strategy", "strategy_path"]
|
||||
|
||||
ARGS_TRADE = ["db_url", "sd_notify", "dry_run"]
|
||||
|
||||
ARGS_COMMON_OPTIMIZE = ["ticker_interval", "timerange",
|
||||
"max_open_trades", "stake_amount", "fee"]
|
||||
|
||||
ARGS_BACKTEST = ARGS_COMMON_OPTIMIZE + ["position_stacking", "use_max_market_positions",
|
||||
"strategy_list", "export", "exportfilename"]
|
||||
|
||||
ARGS_HYPEROPT = ARGS_COMMON_OPTIMIZE + ["hyperopt", "hyperopt_path",
|
||||
"position_stacking", "epochs", "spaces",
|
||||
"use_max_market_positions", "print_all",
|
||||
"print_colorized", "print_json", "hyperopt_jobs",
|
||||
"hyperopt_random_state", "hyperopt_min_trades",
|
||||
"hyperopt_continue", "hyperopt_loss"]
|
||||
|
||||
ARGS_EDGE = ARGS_COMMON_OPTIMIZE + ["stoploss_range"]
|
||||
|
||||
ARGS_LIST_STRATEGIES = ["strategy_path", "print_one_column"]
|
||||
|
||||
ARGS_LIST_EXCHANGES = ["print_one_column", "list_exchanges_all"]
|
||||
|
||||
ARGS_LIST_TIMEFRAMES = ["exchange", "print_one_column"]
|
||||
|
||||
ARGS_LIST_PAIRS = ["exchange", "print_list", "list_pairs_print_json", "print_one_column",
|
||||
"print_csv", "base_currencies", "quote_currencies", "list_pairs_all"]
|
||||
|
||||
ARGS_TEST_PAIRLIST = ["config", "quote_currencies", "print_one_column", "list_pairs_print_json"]
|
||||
|
||||
ARGS_CREATE_USERDIR = ["user_data_dir", "reset"]
|
||||
|
||||
ARGS_BUILD_STRATEGY = ["user_data_dir", "strategy", "template"]
|
||||
|
||||
ARGS_BUILD_HYPEROPT = ["user_data_dir", "hyperopt", "template"]
|
||||
|
||||
ARGS_DOWNLOAD_DATA = ["pairs", "pairs_file", "days", "download_trades", "exchange",
|
||||
"timeframes", "erase"]
|
||||
|
||||
ARGS_PLOT_DATAFRAME = ["pairs", "indicators1", "indicators2", "plot_limit",
|
||||
"db_url", "trade_source", "export", "exportfilename",
|
||||
"timerange", "ticker_interval"]
|
||||
|
||||
ARGS_PLOT_PROFIT = ["pairs", "timerange", "export", "exportfilename", "db_url",
|
||||
"trade_source", "ticker_interval"]
|
||||
|
||||
ARGS_HYPEROPT_LIST = ["hyperopt_list_best", "hyperopt_list_profitable", "print_colorized",
|
||||
"print_json", "hyperopt_list_no_details"]
|
||||
|
||||
ARGS_HYPEROPT_SHOW = ["hyperopt_list_best", "hyperopt_list_profitable", "hyperopt_show_index",
|
||||
"print_json", "hyperopt_show_no_header"]
|
||||
|
||||
NO_CONF_REQURIED = ["download-data", "list-timeframes", "list-markets", "list-pairs",
|
||||
"list-strategies", "hyperopt-list", "hyperopt-show", "plot-dataframe",
|
||||
"plot-profit"]
|
||||
|
||||
NO_CONF_ALLOWED = ["create-userdir", "list-exchanges", "new-hyperopt", "new-strategy"]
|
||||
|
||||
|
||||
class Arguments:
|
||||
"""
|
||||
Arguments Class. Manage the arguments received by the cli
|
||||
"""
|
||||
|
||||
def __init__(self, args: Optional[List[str]]) -> None:
|
||||
self.args = args
|
||||
self._parsed_arg: Optional[argparse.Namespace] = None
|
||||
|
||||
def get_parsed_arg(self) -> Dict[str, Any]:
|
||||
"""
|
||||
Return the list of arguments
|
||||
:return: List[str] List of arguments
|
||||
"""
|
||||
if self._parsed_arg is None:
|
||||
self._build_subcommands()
|
||||
self._parsed_arg = self._parse_args()
|
||||
|
||||
return vars(self._parsed_arg)
|
||||
|
||||
def _parse_args(self) -> argparse.Namespace:
|
||||
"""
|
||||
Parses given arguments and returns an argparse Namespace instance.
|
||||
"""
|
||||
parsed_arg = self.parser.parse_args(self.args)
|
||||
|
||||
# Workaround issue in argparse with action='append' and default value
|
||||
# (see https://bugs.python.org/issue16399)
|
||||
# Allow no-config for certain commands (like downloading / plotting)
|
||||
if ('config' in parsed_arg and parsed_arg.config is None and
|
||||
((Path.cwd() / constants.DEFAULT_CONFIG).is_file() or
|
||||
not ('command' in parsed_arg and parsed_arg.command in NO_CONF_REQURIED))):
|
||||
parsed_arg.config = [constants.DEFAULT_CONFIG]
|
||||
|
||||
return parsed_arg
|
||||
|
||||
def _build_args(self, optionlist, parser):
|
||||
|
||||
for val in optionlist:
|
||||
opt = AVAILABLE_CLI_OPTIONS[val]
|
||||
parser.add_argument(*opt.cli, dest=val, **opt.kwargs)
|
||||
|
||||
def _build_subcommands(self) -> None:
|
||||
"""
|
||||
Builds and attaches all subcommands.
|
||||
:return: None
|
||||
"""
|
||||
# Build shared arguments (as group Common Options)
|
||||
_common_parser = argparse.ArgumentParser(add_help=False)
|
||||
group = _common_parser.add_argument_group("Common arguments")
|
||||
self._build_args(optionlist=ARGS_COMMON, parser=group)
|
||||
|
||||
_strategy_parser = argparse.ArgumentParser(add_help=False)
|
||||
strategy_group = _strategy_parser.add_argument_group("Strategy arguments")
|
||||
self._build_args(optionlist=ARGS_STRATEGY, parser=strategy_group)
|
||||
|
||||
# Build main command
|
||||
self.parser = argparse.ArgumentParser(description='Free, open source crypto trading bot')
|
||||
self._build_args(optionlist=['version'], parser=self.parser)
|
||||
|
||||
from freqtrade.commands import (start_create_userdir, start_download_data,
|
||||
start_hyperopt_list, start_hyperopt_show,
|
||||
start_list_exchanges, start_list_markets,
|
||||
start_list_strategies, start_new_hyperopt,
|
||||
start_new_strategy, start_list_timeframes,
|
||||
start_plot_dataframe, start_plot_profit,
|
||||
start_backtesting, start_hyperopt, start_edge,
|
||||
start_test_pairlist, start_trading)
|
||||
|
||||
subparsers = self.parser.add_subparsers(dest='command',
|
||||
# Use custom message when no subhandler is added
|
||||
# shown from `main.py`
|
||||
# required=True
|
||||
)
|
||||
|
||||
# Add trade subcommand
|
||||
trade_cmd = subparsers.add_parser('trade', help='Trade module.',
|
||||
parents=[_common_parser, _strategy_parser])
|
||||
trade_cmd.set_defaults(func=start_trading)
|
||||
self._build_args(optionlist=ARGS_TRADE, parser=trade_cmd)
|
||||
|
||||
# Add backtesting subcommand
|
||||
backtesting_cmd = subparsers.add_parser('backtesting', help='Backtesting module.',
|
||||
parents=[_common_parser, _strategy_parser])
|
||||
backtesting_cmd.set_defaults(func=start_backtesting)
|
||||
self._build_args(optionlist=ARGS_BACKTEST, parser=backtesting_cmd)
|
||||
|
||||
# Add edge subcommand
|
||||
edge_cmd = subparsers.add_parser('edge', help='Edge module.',
|
||||
parents=[_common_parser, _strategy_parser])
|
||||
edge_cmd.set_defaults(func=start_edge)
|
||||
self._build_args(optionlist=ARGS_EDGE, parser=edge_cmd)
|
||||
|
||||
# Add hyperopt subcommand
|
||||
hyperopt_cmd = subparsers.add_parser('hyperopt', help='Hyperopt module.',
|
||||
parents=[_common_parser, _strategy_parser],
|
||||
)
|
||||
hyperopt_cmd.set_defaults(func=start_hyperopt)
|
||||
self._build_args(optionlist=ARGS_HYPEROPT, parser=hyperopt_cmd)
|
||||
|
||||
# add create-userdir subcommand
|
||||
create_userdir_cmd = subparsers.add_parser('create-userdir',
|
||||
help="Create user-data directory.",
|
||||
)
|
||||
create_userdir_cmd.set_defaults(func=start_create_userdir)
|
||||
self._build_args(optionlist=ARGS_CREATE_USERDIR, parser=create_userdir_cmd)
|
||||
|
||||
# add new-strategy subcommand
|
||||
build_strategy_cmd = subparsers.add_parser('new-strategy',
|
||||
help="Create new strategy")
|
||||
build_strategy_cmd.set_defaults(func=start_new_strategy)
|
||||
self._build_args(optionlist=ARGS_BUILD_STRATEGY, parser=build_strategy_cmd)
|
||||
|
||||
# add new-hyperopt subcommand
|
||||
build_hyperopt_cmd = subparsers.add_parser('new-hyperopt',
|
||||
help="Create new hyperopt")
|
||||
build_hyperopt_cmd.set_defaults(func=start_new_hyperopt)
|
||||
self._build_args(optionlist=ARGS_BUILD_HYPEROPT, parser=build_hyperopt_cmd)
|
||||
|
||||
# Add list-strategies subcommand
|
||||
list_strategies_cmd = subparsers.add_parser(
|
||||
'list-strategies',
|
||||
help='Print available strategies.',
|
||||
parents=[_common_parser],
|
||||
)
|
||||
list_strategies_cmd.set_defaults(func=start_list_strategies)
|
||||
self._build_args(optionlist=ARGS_LIST_STRATEGIES, parser=list_strategies_cmd)
|
||||
|
||||
# Add list-exchanges subcommand
|
||||
list_exchanges_cmd = subparsers.add_parser(
|
||||
'list-exchanges',
|
||||
help='Print available exchanges.',
|
||||
parents=[_common_parser],
|
||||
)
|
||||
list_exchanges_cmd.set_defaults(func=start_list_exchanges)
|
||||
self._build_args(optionlist=ARGS_LIST_EXCHANGES, parser=list_exchanges_cmd)
|
||||
|
||||
# Add list-timeframes subcommand
|
||||
list_timeframes_cmd = subparsers.add_parser(
|
||||
'list-timeframes',
|
||||
help='Print available ticker intervals (timeframes) for the exchange.',
|
||||
parents=[_common_parser],
|
||||
)
|
||||
list_timeframes_cmd.set_defaults(func=start_list_timeframes)
|
||||
self._build_args(optionlist=ARGS_LIST_TIMEFRAMES, parser=list_timeframes_cmd)
|
||||
|
||||
# Add list-markets subcommand
|
||||
list_markets_cmd = subparsers.add_parser(
|
||||
'list-markets',
|
||||
help='Print markets on exchange.',
|
||||
parents=[_common_parser],
|
||||
)
|
||||
list_markets_cmd.set_defaults(func=partial(start_list_markets, pairs_only=False))
|
||||
self._build_args(optionlist=ARGS_LIST_PAIRS, parser=list_markets_cmd)
|
||||
|
||||
# Add list-pairs subcommand
|
||||
list_pairs_cmd = subparsers.add_parser(
|
||||
'list-pairs',
|
||||
help='Print pairs on exchange.',
|
||||
parents=[_common_parser],
|
||||
)
|
||||
list_pairs_cmd.set_defaults(func=partial(start_list_markets, pairs_only=True))
|
||||
self._build_args(optionlist=ARGS_LIST_PAIRS, parser=list_pairs_cmd)
|
||||
|
||||
# Add test-pairlist subcommand
|
||||
test_pairlist_cmd = subparsers.add_parser(
|
||||
'test-pairlist',
|
||||
help='Test your pairlist configuration.',
|
||||
)
|
||||
test_pairlist_cmd.set_defaults(func=start_test_pairlist)
|
||||
self._build_args(optionlist=ARGS_TEST_PAIRLIST, parser=test_pairlist_cmd)
|
||||
|
||||
# Add download-data subcommand
|
||||
download_data_cmd = subparsers.add_parser(
|
||||
'download-data',
|
||||
help='Download backtesting data.',
|
||||
parents=[_common_parser],
|
||||
)
|
||||
download_data_cmd.set_defaults(func=start_download_data)
|
||||
self._build_args(optionlist=ARGS_DOWNLOAD_DATA, parser=download_data_cmd)
|
||||
|
||||
# Add Plotting subcommand
|
||||
plot_dataframe_cmd = subparsers.add_parser(
|
||||
'plot-dataframe',
|
||||
help='Plot candles with indicators.',
|
||||
parents=[_common_parser, _strategy_parser],
|
||||
)
|
||||
plot_dataframe_cmd.set_defaults(func=start_plot_dataframe)
|
||||
self._build_args(optionlist=ARGS_PLOT_DATAFRAME, parser=plot_dataframe_cmd)
|
||||
|
||||
# Plot profit
|
||||
plot_profit_cmd = subparsers.add_parser(
|
||||
'plot-profit',
|
||||
help='Generate plot showing profits.',
|
||||
parents=[_common_parser],
|
||||
)
|
||||
plot_profit_cmd.set_defaults(func=start_plot_profit)
|
||||
self._build_args(optionlist=ARGS_PLOT_PROFIT, parser=plot_profit_cmd)
|
||||
|
||||
# Add hyperopt-list subcommand
|
||||
hyperopt_list_cmd = subparsers.add_parser(
|
||||
'hyperopt-list',
|
||||
help='List Hyperopt results',
|
||||
parents=[_common_parser],
|
||||
)
|
||||
hyperopt_list_cmd.set_defaults(func=start_hyperopt_list)
|
||||
self._build_args(optionlist=ARGS_HYPEROPT_LIST, parser=hyperopt_list_cmd)
|
||||
|
||||
# Add hyperopt-show subcommand
|
||||
hyperopt_show_cmd = subparsers.add_parser(
|
||||
'hyperopt-show',
|
||||
help='Show details of Hyperopt results',
|
||||
parents=[_common_parser],
|
||||
)
|
||||
hyperopt_show_cmd.set_defaults(func=start_hyperopt_show)
|
||||
self._build_args(optionlist=ARGS_HYPEROPT_SHOW, parser=hyperopt_show_cmd)
|
||||
417
freqtrade/commands/cli_options.py
Normal file
417
freqtrade/commands/cli_options.py
Normal file
@@ -0,0 +1,417 @@
|
||||
"""
|
||||
Definition of cli arguments used in arguments.py
|
||||
"""
|
||||
from argparse import ArgumentTypeError
|
||||
|
||||
from freqtrade import __version__, constants
|
||||
|
||||
|
||||
def check_int_positive(value: str) -> int:
|
||||
try:
|
||||
uint = int(value)
|
||||
if uint <= 0:
|
||||
raise ValueError
|
||||
except ValueError:
|
||||
raise ArgumentTypeError(
|
||||
f"{value} is invalid for this parameter, should be a positive integer value"
|
||||
)
|
||||
return uint
|
||||
|
||||
|
||||
def check_int_nonzero(value: str) -> int:
|
||||
try:
|
||||
uint = int(value)
|
||||
if uint == 0:
|
||||
raise ValueError
|
||||
except ValueError:
|
||||
raise ArgumentTypeError(
|
||||
f"{value} is invalid for this parameter, should be a non-zero integer value"
|
||||
)
|
||||
return uint
|
||||
|
||||
|
||||
class Arg:
|
||||
# Optional CLI arguments
|
||||
def __init__(self, *args, **kwargs):
|
||||
self.cli = args
|
||||
self.kwargs = kwargs
|
||||
|
||||
|
||||
# List of available command line options
|
||||
AVAILABLE_CLI_OPTIONS = {
|
||||
# Common options
|
||||
"verbosity": Arg(
|
||||
'-v', '--verbose',
|
||||
help='Verbose mode (-vv for more, -vvv to get all messages).',
|
||||
action='count',
|
||||
default=0,
|
||||
),
|
||||
"logfile": Arg(
|
||||
'--logfile',
|
||||
help="Log to the file specified. Special values are: 'syslog', 'journald'. "
|
||||
"See the documentation for more details.",
|
||||
metavar='FILE',
|
||||
),
|
||||
"version": Arg(
|
||||
'-V', '--version',
|
||||
action='version',
|
||||
version=f'%(prog)s {__version__}',
|
||||
),
|
||||
"config": Arg(
|
||||
'-c', '--config',
|
||||
help=f'Specify configuration file (default: `{constants.DEFAULT_CONFIG}`). '
|
||||
f'Multiple --config options may be used. '
|
||||
f'Can be set to `-` to read config from stdin.',
|
||||
action='append',
|
||||
metavar='PATH',
|
||||
),
|
||||
"datadir": Arg(
|
||||
'-d', '--datadir',
|
||||
help='Path to directory with historical backtesting data.',
|
||||
metavar='PATH',
|
||||
),
|
||||
"user_data_dir": Arg(
|
||||
'--userdir', '--user-data-dir',
|
||||
help='Path to userdata directory.',
|
||||
metavar='PATH',
|
||||
),
|
||||
"reset": Arg(
|
||||
'--reset',
|
||||
help='Reset sample files to their original state.',
|
||||
action='store_true',
|
||||
),
|
||||
# Main options
|
||||
"strategy": Arg(
|
||||
'-s', '--strategy',
|
||||
help='Specify strategy class name which will be used by the bot.',
|
||||
metavar='NAME',
|
||||
),
|
||||
"strategy_path": Arg(
|
||||
'--strategy-path',
|
||||
help='Specify additional strategy lookup path.',
|
||||
metavar='PATH',
|
||||
),
|
||||
"db_url": Arg(
|
||||
'--db-url',
|
||||
help=f'Override trades database URL, this is useful in custom deployments '
|
||||
f'(default: `{constants.DEFAULT_DB_PROD_URL}` for Live Run mode, '
|
||||
f'`{constants.DEFAULT_DB_DRYRUN_URL}` for Dry Run).',
|
||||
metavar='PATH',
|
||||
),
|
||||
"sd_notify": Arg(
|
||||
'--sd-notify',
|
||||
help='Notify systemd service manager.',
|
||||
action='store_true',
|
||||
),
|
||||
"dry_run": Arg(
|
||||
'--dry-run',
|
||||
help='Enforce dry-run for trading (removes Exchange secrets and simulates trades).',
|
||||
action='store_true',
|
||||
),
|
||||
# Optimize common
|
||||
"ticker_interval": Arg(
|
||||
'-i', '--ticker-interval',
|
||||
help='Specify ticker interval (`1m`, `5m`, `30m`, `1h`, `1d`).',
|
||||
),
|
||||
"timerange": Arg(
|
||||
'--timerange',
|
||||
help='Specify what timerange of data to use.',
|
||||
),
|
||||
"max_open_trades": Arg(
|
||||
'--max-open-trades',
|
||||
help='Override the value of the `max_open_trades` configuration setting.',
|
||||
type=int,
|
||||
metavar='INT',
|
||||
),
|
||||
"stake_amount": Arg(
|
||||
'--stake-amount',
|
||||
help='Override the value of the `stake_amount` configuration setting.',
|
||||
type=float,
|
||||
),
|
||||
# Backtesting
|
||||
"position_stacking": Arg(
|
||||
'--eps', '--enable-position-stacking',
|
||||
help='Allow buying the same pair multiple times (position stacking).',
|
||||
action='store_true',
|
||||
default=False,
|
||||
),
|
||||
"use_max_market_positions": Arg(
|
||||
'--dmmp', '--disable-max-market-positions',
|
||||
help='Disable applying `max_open_trades` during backtest '
|
||||
'(same as setting `max_open_trades` to a very high number).',
|
||||
action='store_false',
|
||||
default=True,
|
||||
),
|
||||
"strategy_list": Arg(
|
||||
'--strategy-list',
|
||||
help='Provide a space-separated list of strategies to backtest. '
|
||||
'Please note that ticker-interval needs to be set either in config '
|
||||
'or via command line. When using this together with `--export trades`, '
|
||||
'the strategy-name is injected into the filename '
|
||||
'(so `backtest-data.json` becomes `backtest-data-DefaultStrategy.json`',
|
||||
nargs='+',
|
||||
),
|
||||
"export": Arg(
|
||||
'--export',
|
||||
help='Export backtest results, argument are: trades. '
|
||||
'Example: `--export=trades`',
|
||||
),
|
||||
"exportfilename": Arg(
|
||||
'--export-filename',
|
||||
help='Save backtest results to the file with this filename. '
|
||||
'Requires `--export` to be set as well. '
|
||||
'Example: `--export-filename=user_data/backtest_results/backtest_today.json`',
|
||||
metavar='PATH',
|
||||
),
|
||||
"fee": Arg(
|
||||
'--fee',
|
||||
help='Specify fee ratio. Will be applied twice (on trade entry and exit).',
|
||||
type=float,
|
||||
metavar='FLOAT',
|
||||
),
|
||||
# Edge
|
||||
"stoploss_range": Arg(
|
||||
'--stoplosses',
|
||||
help='Defines a range of stoploss values against which edge will assess the strategy. '
|
||||
'The format is "min,max,step" (without any space). '
|
||||
'Example: `--stoplosses=-0.01,-0.1,-0.001`',
|
||||
),
|
||||
# Hyperopt
|
||||
"hyperopt": Arg(
|
||||
'--hyperopt',
|
||||
help='Specify hyperopt class name which will be used by the bot.',
|
||||
metavar='NAME',
|
||||
),
|
||||
"hyperopt_path": Arg(
|
||||
'--hyperopt-path',
|
||||
help='Specify additional lookup path for Hyperopt and Hyperopt Loss functions.',
|
||||
metavar='PATH',
|
||||
),
|
||||
"epochs": Arg(
|
||||
'-e', '--epochs',
|
||||
help='Specify number of epochs (default: %(default)d).',
|
||||
type=check_int_positive,
|
||||
metavar='INT',
|
||||
default=constants.HYPEROPT_EPOCH,
|
||||
),
|
||||
"spaces": Arg(
|
||||
'--spaces',
|
||||
help='Specify which parameters to hyperopt. Space-separated list.',
|
||||
choices=['all', 'buy', 'sell', 'roi', 'stoploss', 'trailing', 'default'],
|
||||
nargs='+',
|
||||
default='default',
|
||||
),
|
||||
"print_all": Arg(
|
||||
'--print-all',
|
||||
help='Print all results, not only the best ones.',
|
||||
action='store_true',
|
||||
default=False,
|
||||
),
|
||||
"print_colorized": Arg(
|
||||
'--no-color',
|
||||
help='Disable colorization of hyperopt results. May be useful if you are '
|
||||
'redirecting output to a file.',
|
||||
action='store_false',
|
||||
default=True,
|
||||
),
|
||||
"print_json": Arg(
|
||||
'--print-json',
|
||||
help='Print best result detailization in JSON format.',
|
||||
action='store_true',
|
||||
default=False,
|
||||
),
|
||||
"hyperopt_jobs": Arg(
|
||||
'-j', '--job-workers',
|
||||
help='The number of concurrently running jobs for hyperoptimization '
|
||||
'(hyperopt worker processes). '
|
||||
'If -1 (default), all CPUs are used, for -2, all CPUs but one are used, etc. '
|
||||
'If 1 is given, no parallel computing code is used at all.',
|
||||
type=int,
|
||||
metavar='JOBS',
|
||||
default=-1,
|
||||
),
|
||||
"hyperopt_random_state": Arg(
|
||||
'--random-state',
|
||||
help='Set random state to some positive integer for reproducible hyperopt results.',
|
||||
type=check_int_positive,
|
||||
metavar='INT',
|
||||
),
|
||||
"hyperopt_min_trades": Arg(
|
||||
'--min-trades',
|
||||
help="Set minimal desired number of trades for evaluations in the hyperopt "
|
||||
"optimization path (default: 1).",
|
||||
type=check_int_positive,
|
||||
metavar='INT',
|
||||
default=1,
|
||||
),
|
||||
"hyperopt_continue": Arg(
|
||||
"--continue",
|
||||
help="Continue hyperopt from previous runs. "
|
||||
"By default, temporary files will be removed and hyperopt will start from scratch.",
|
||||
default=False,
|
||||
action='store_true',
|
||||
),
|
||||
"hyperopt_loss": Arg(
|
||||
'--hyperopt-loss',
|
||||
help='Specify the class name of the hyperopt loss function class (IHyperOptLoss). '
|
||||
'Different functions can generate completely different results, '
|
||||
'since the target for optimization is different. Built-in Hyperopt-loss-functions are: '
|
||||
'DefaultHyperOptLoss, OnlyProfitHyperOptLoss, SharpeHyperOptLoss.'
|
||||
'(default: `%(default)s`).',
|
||||
metavar='NAME',
|
||||
default=constants.DEFAULT_HYPEROPT_LOSS,
|
||||
),
|
||||
# List exchanges
|
||||
"print_one_column": Arg(
|
||||
'-1', '--one-column',
|
||||
help='Print output in one column.',
|
||||
action='store_true',
|
||||
),
|
||||
"list_exchanges_all": Arg(
|
||||
'-a', '--all',
|
||||
help='Print all exchanges known to the ccxt library.',
|
||||
action='store_true',
|
||||
),
|
||||
# List pairs / markets
|
||||
"list_pairs_all": Arg(
|
||||
'-a', '--all',
|
||||
help='Print all pairs or market symbols. By default only active '
|
||||
'ones are shown.',
|
||||
action='store_true',
|
||||
),
|
||||
"print_list": Arg(
|
||||
'--print-list',
|
||||
help='Print list of pairs or market symbols. By default data is '
|
||||
'printed in the tabular format.',
|
||||
action='store_true',
|
||||
),
|
||||
"list_pairs_print_json": Arg(
|
||||
'--print-json',
|
||||
help='Print list of pairs or market symbols in JSON format.',
|
||||
action='store_true',
|
||||
default=False,
|
||||
),
|
||||
"print_csv": Arg(
|
||||
'--print-csv',
|
||||
help='Print exchange pair or market data in the csv format.',
|
||||
action='store_true',
|
||||
),
|
||||
"quote_currencies": Arg(
|
||||
'--quote',
|
||||
help='Specify quote currency(-ies). Space-separated list.',
|
||||
nargs='+',
|
||||
metavar='QUOTE_CURRENCY',
|
||||
),
|
||||
"base_currencies": Arg(
|
||||
'--base',
|
||||
help='Specify base currency(-ies). Space-separated list.',
|
||||
nargs='+',
|
||||
metavar='BASE_CURRENCY',
|
||||
),
|
||||
# Script options
|
||||
"pairs": Arg(
|
||||
'-p', '--pairs',
|
||||
help='Show profits for only these pairs. Pairs are space-separated.',
|
||||
nargs='+',
|
||||
),
|
||||
# Download data
|
||||
"pairs_file": Arg(
|
||||
'--pairs-file',
|
||||
help='File containing a list of pairs to download.',
|
||||
metavar='FILE',
|
||||
),
|
||||
"days": Arg(
|
||||
'--days',
|
||||
help='Download data for given number of days.',
|
||||
type=check_int_positive,
|
||||
metavar='INT',
|
||||
),
|
||||
"download_trades": Arg(
|
||||
'--dl-trades',
|
||||
help='Download trades instead of OHLCV data. The bot will resample trades to the '
|
||||
'desired timeframe as specified as --timeframes/-t.',
|
||||
action='store_true',
|
||||
),
|
||||
"exchange": Arg(
|
||||
'--exchange',
|
||||
help=f'Exchange name (default: `{constants.DEFAULT_EXCHANGE}`). '
|
||||
f'Only valid if no config is provided.',
|
||||
),
|
||||
"timeframes": Arg(
|
||||
'-t', '--timeframes',
|
||||
help=f'Specify which tickers to download. Space-separated list. '
|
||||
f'Default: `1m 5m`.',
|
||||
choices=['1m', '3m', '5m', '15m', '30m', '1h', '2h', '4h',
|
||||
'6h', '8h', '12h', '1d', '3d', '1w'],
|
||||
default=['1m', '5m'],
|
||||
nargs='+',
|
||||
),
|
||||
"erase": Arg(
|
||||
'--erase',
|
||||
help='Clean all existing data for the selected exchange/pairs/timeframes.',
|
||||
action='store_true',
|
||||
),
|
||||
# Templating options
|
||||
"template": Arg(
|
||||
'--template',
|
||||
help='Use a template which is either `minimal` or '
|
||||
'`full` (containing multiple sample indicators). Default: `%(default)s`.',
|
||||
choices=['full', 'minimal'],
|
||||
default='full',
|
||||
),
|
||||
# Plot dataframe
|
||||
"indicators1": Arg(
|
||||
'--indicators1',
|
||||
help='Set indicators from your strategy you want in the first row of the graph. '
|
||||
"Space-separated list. Example: `ema3 ema5`. Default: `['sma', 'ema3', 'ema5']`.",
|
||||
nargs='+',
|
||||
),
|
||||
"indicators2": Arg(
|
||||
'--indicators2',
|
||||
help='Set indicators from your strategy you want in the third row of the graph. '
|
||||
"Space-separated list. Example: `fastd fastk`. Default: `['macd', 'macdsignal']`.",
|
||||
nargs='+',
|
||||
),
|
||||
"plot_limit": Arg(
|
||||
'--plot-limit',
|
||||
help='Specify tick limit for plotting. Notice: too high values cause huge files. '
|
||||
'Default: %(default)s.',
|
||||
type=check_int_positive,
|
||||
metavar='INT',
|
||||
default=750,
|
||||
),
|
||||
"trade_source": Arg(
|
||||
'--trade-source',
|
||||
help='Specify the source for trades (Can be DB or file (backtest file)) '
|
||||
'Default: %(default)s',
|
||||
choices=["DB", "file"],
|
||||
default="file",
|
||||
),
|
||||
# hyperopt-list, hyperopt-show
|
||||
"hyperopt_list_profitable": Arg(
|
||||
'--profitable',
|
||||
help='Select only profitable epochs.',
|
||||
action='store_true',
|
||||
),
|
||||
"hyperopt_list_best": Arg(
|
||||
'--best',
|
||||
help='Select only best epochs.',
|
||||
action='store_true',
|
||||
),
|
||||
"hyperopt_list_no_details": Arg(
|
||||
'--no-details',
|
||||
help='Do not print best epoch details.',
|
||||
action='store_true',
|
||||
),
|
||||
"hyperopt_show_index": Arg(
|
||||
'-n', '--index',
|
||||
help='Specify the index of the epoch to print details for.',
|
||||
type=check_int_nonzero,
|
||||
metavar='INT',
|
||||
),
|
||||
"hyperopt_show_no_header": Arg(
|
||||
'--no-header',
|
||||
help='Do not print epoch details header.',
|
||||
action='store_true',
|
||||
),
|
||||
}
|
||||
63
freqtrade/commands/data_commands.py
Normal file
63
freqtrade/commands/data_commands.py
Normal file
@@ -0,0 +1,63 @@
|
||||
import logging
|
||||
import sys
|
||||
from typing import Any, Dict, List
|
||||
|
||||
import arrow
|
||||
|
||||
from freqtrade.configuration import TimeRange, setup_utils_configuration
|
||||
from freqtrade.data.history import (convert_trades_to_ohlcv,
|
||||
refresh_backtest_ohlcv_data,
|
||||
refresh_backtest_trades_data)
|
||||
from freqtrade.exceptions import OperationalException
|
||||
from freqtrade.resolvers import ExchangeResolver
|
||||
from freqtrade.state import RunMode
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def start_download_data(args: Dict[str, Any]) -> None:
|
||||
"""
|
||||
Download data (former download_backtest_data.py script)
|
||||
"""
|
||||
config = setup_utils_configuration(args, RunMode.UTIL_EXCHANGE)
|
||||
|
||||
timerange = TimeRange()
|
||||
if 'days' in config:
|
||||
time_since = arrow.utcnow().shift(days=-config['days']).strftime("%Y%m%d")
|
||||
timerange = TimeRange.parse_timerange(f'{time_since}-')
|
||||
|
||||
if 'pairs' not in config:
|
||||
raise OperationalException(
|
||||
"Downloading data requires a list of pairs. "
|
||||
"Please check the documentation on how to configure this.")
|
||||
|
||||
logger.info(f'About to download pairs: {config["pairs"]}, '
|
||||
f'intervals: {config["timeframes"]} to {config["datadir"]}')
|
||||
|
||||
pairs_not_available: List[str] = []
|
||||
|
||||
# Init exchange
|
||||
exchange = ExchangeResolver.load_exchange(config['exchange']['name'], config)
|
||||
try:
|
||||
|
||||
if config.get('download_trades'):
|
||||
pairs_not_available = refresh_backtest_trades_data(
|
||||
exchange, pairs=config["pairs"], datadir=config['datadir'],
|
||||
timerange=timerange, erase=config.get("erase"))
|
||||
|
||||
# Convert downloaded trade data to different timeframes
|
||||
convert_trades_to_ohlcv(
|
||||
pairs=config["pairs"], timeframes=config["timeframes"],
|
||||
datadir=config['datadir'], timerange=timerange, erase=config.get("erase"))
|
||||
else:
|
||||
pairs_not_available = refresh_backtest_ohlcv_data(
|
||||
exchange, pairs=config["pairs"], timeframes=config["timeframes"],
|
||||
datadir=config['datadir'], timerange=timerange, erase=config.get("erase"))
|
||||
|
||||
except KeyboardInterrupt:
|
||||
sys.exit("SIGINT received, aborting ...")
|
||||
|
||||
finally:
|
||||
if pairs_not_available:
|
||||
logger.info(f"Pairs [{','.join(pairs_not_available)}] not available "
|
||||
f"on exchange {exchange.name}.")
|
||||
112
freqtrade/commands/deploy_commands.py
Normal file
112
freqtrade/commands/deploy_commands.py
Normal file
@@ -0,0 +1,112 @@
|
||||
import logging
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from typing import Any, Dict
|
||||
|
||||
from freqtrade.configuration import setup_utils_configuration
|
||||
from freqtrade.configuration.directory_operations import (copy_sample_files,
|
||||
create_userdata_dir)
|
||||
from freqtrade.constants import USERPATH_HYPEROPTS, USERPATH_STRATEGY
|
||||
from freqtrade.exceptions import OperationalException
|
||||
from freqtrade.misc import render_template
|
||||
from freqtrade.state import RunMode
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def start_create_userdir(args: Dict[str, Any]) -> None:
|
||||
"""
|
||||
Create "user_data" directory to contain user data strategies, hyperopt, ...)
|
||||
:param args: Cli args from Arguments()
|
||||
:return: None
|
||||
"""
|
||||
if "user_data_dir" in args and args["user_data_dir"]:
|
||||
userdir = create_userdata_dir(args["user_data_dir"], create_dir=True)
|
||||
copy_sample_files(userdir, overwrite=args["reset"])
|
||||
else:
|
||||
logger.warning("`create-userdir` requires --userdir to be set.")
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
def deploy_new_strategy(strategy_name, strategy_path: Path, subtemplate: str):
|
||||
"""
|
||||
Deploy new strategy from template to strategy_path
|
||||
"""
|
||||
indicators = render_template(templatefile=f"subtemplates/indicators_{subtemplate}.j2",)
|
||||
buy_trend = render_template(templatefile=f"subtemplates/buy_trend_{subtemplate}.j2",)
|
||||
sell_trend = render_template(templatefile=f"subtemplates/sell_trend_{subtemplate}.j2",)
|
||||
plot_config = render_template(templatefile=f"subtemplates/plot_config_{subtemplate}.j2",)
|
||||
|
||||
strategy_text = render_template(templatefile='base_strategy.py.j2',
|
||||
arguments={"strategy": strategy_name,
|
||||
"indicators": indicators,
|
||||
"buy_trend": buy_trend,
|
||||
"sell_trend": sell_trend,
|
||||
"plot_config": plot_config,
|
||||
})
|
||||
|
||||
logger.info(f"Writing strategy to `{strategy_path}`.")
|
||||
strategy_path.write_text(strategy_text)
|
||||
|
||||
|
||||
def start_new_strategy(args: Dict[str, Any]) -> None:
|
||||
|
||||
config = setup_utils_configuration(args, RunMode.UTIL_NO_EXCHANGE)
|
||||
|
||||
if "strategy" in args and args["strategy"]:
|
||||
if args["strategy"] == "DefaultStrategy":
|
||||
raise OperationalException("DefaultStrategy is not allowed as name.")
|
||||
|
||||
new_path = config['user_data_dir'] / USERPATH_STRATEGY / (args["strategy"] + ".py")
|
||||
|
||||
if new_path.exists():
|
||||
raise OperationalException(f"`{new_path}` already exists. "
|
||||
"Please choose another Strategy Name.")
|
||||
|
||||
deploy_new_strategy(args['strategy'], new_path, args['template'])
|
||||
|
||||
else:
|
||||
raise OperationalException("`new-strategy` requires --strategy to be set.")
|
||||
|
||||
|
||||
def deploy_new_hyperopt(hyperopt_name, hyperopt_path: Path, subtemplate: str):
|
||||
"""
|
||||
Deploys a new hyperopt template to hyperopt_path
|
||||
"""
|
||||
buy_guards = render_template(
|
||||
templatefile=f"subtemplates/hyperopt_buy_guards_{subtemplate}.j2",)
|
||||
sell_guards = render_template(
|
||||
templatefile=f"subtemplates/hyperopt_sell_guards_{subtemplate}.j2",)
|
||||
buy_space = render_template(
|
||||
templatefile=f"subtemplates/hyperopt_buy_space_{subtemplate}.j2",)
|
||||
sell_space = render_template(
|
||||
templatefile=f"subtemplates/hyperopt_sell_space_{subtemplate}.j2",)
|
||||
|
||||
strategy_text = render_template(templatefile='base_hyperopt.py.j2',
|
||||
arguments={"hyperopt": hyperopt_name,
|
||||
"buy_guards": buy_guards,
|
||||
"sell_guards": sell_guards,
|
||||
"buy_space": buy_space,
|
||||
"sell_space": sell_space,
|
||||
})
|
||||
|
||||
logger.info(f"Writing hyperopt to `{hyperopt_path}`.")
|
||||
hyperopt_path.write_text(strategy_text)
|
||||
|
||||
|
||||
def start_new_hyperopt(args: Dict[str, Any]) -> None:
|
||||
|
||||
config = setup_utils_configuration(args, RunMode.UTIL_NO_EXCHANGE)
|
||||
|
||||
if "hyperopt" in args and args["hyperopt"]:
|
||||
if args["hyperopt"] == "DefaultHyperopt":
|
||||
raise OperationalException("DefaultHyperopt is not allowed as name.")
|
||||
|
||||
new_path = config['user_data_dir'] / USERPATH_HYPEROPTS / (args["hyperopt"] + ".py")
|
||||
|
||||
if new_path.exists():
|
||||
raise OperationalException(f"`{new_path}` already exists. "
|
||||
"Please choose another Strategy Name.")
|
||||
deploy_new_hyperopt(args['hyperopt'], new_path, args['template'])
|
||||
else:
|
||||
raise OperationalException("`new-hyperopt` requires --hyperopt to be set.")
|
||||
114
freqtrade/commands/hyperopt_commands.py
Normal file
114
freqtrade/commands/hyperopt_commands.py
Normal file
@@ -0,0 +1,114 @@
|
||||
import logging
|
||||
from operator import itemgetter
|
||||
from typing import Any, Dict, List
|
||||
|
||||
from colorama import init as colorama_init
|
||||
|
||||
from freqtrade.configuration import setup_utils_configuration
|
||||
from freqtrade.exceptions import OperationalException
|
||||
from freqtrade.state import RunMode
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def start_hyperopt_list(args: Dict[str, Any]) -> None:
|
||||
"""
|
||||
List hyperopt epochs previously evaluated
|
||||
"""
|
||||
from freqtrade.optimize.hyperopt import Hyperopt
|
||||
|
||||
config = setup_utils_configuration(args, RunMode.UTIL_NO_EXCHANGE)
|
||||
|
||||
only_best = config.get('hyperopt_list_best', False)
|
||||
only_profitable = config.get('hyperopt_list_profitable', False)
|
||||
print_colorized = config.get('print_colorized', False)
|
||||
print_json = config.get('print_json', False)
|
||||
no_details = config.get('hyperopt_list_no_details', False)
|
||||
no_header = False
|
||||
|
||||
trials_file = (config['user_data_dir'] /
|
||||
'hyperopt_results' / 'hyperopt_results.pickle')
|
||||
|
||||
# Previous evaluations
|
||||
trials = Hyperopt.load_previous_results(trials_file)
|
||||
total_epochs = len(trials)
|
||||
|
||||
trials = _hyperopt_filter_trials(trials, only_best, only_profitable)
|
||||
|
||||
# TODO: fetch the interval for epochs to print from the cli option
|
||||
epoch_start, epoch_stop = 0, None
|
||||
|
||||
if print_colorized:
|
||||
colorama_init(autoreset=True)
|
||||
|
||||
try:
|
||||
# Human-friendly indexes used here (starting from 1)
|
||||
for val in trials[epoch_start:epoch_stop]:
|
||||
Hyperopt.print_results_explanation(val, total_epochs, not only_best, print_colorized)
|
||||
|
||||
except KeyboardInterrupt:
|
||||
print('User interrupted..')
|
||||
|
||||
if trials and not no_details:
|
||||
sorted_trials = sorted(trials, key=itemgetter('loss'))
|
||||
results = sorted_trials[0]
|
||||
Hyperopt.print_epoch_details(results, total_epochs, print_json, no_header)
|
||||
|
||||
|
||||
def start_hyperopt_show(args: Dict[str, Any]) -> None:
|
||||
"""
|
||||
Show details of a hyperopt epoch previously evaluated
|
||||
"""
|
||||
from freqtrade.optimize.hyperopt import Hyperopt
|
||||
|
||||
config = setup_utils_configuration(args, RunMode.UTIL_NO_EXCHANGE)
|
||||
|
||||
only_best = config.get('hyperopt_list_best', False)
|
||||
only_profitable = config.get('hyperopt_list_profitable', False)
|
||||
no_header = config.get('hyperopt_show_no_header', False)
|
||||
|
||||
trials_file = (config['user_data_dir'] /
|
||||
'hyperopt_results' / 'hyperopt_results.pickle')
|
||||
|
||||
# Previous evaluations
|
||||
trials = Hyperopt.load_previous_results(trials_file)
|
||||
total_epochs = len(trials)
|
||||
|
||||
trials = _hyperopt_filter_trials(trials, only_best, only_profitable)
|
||||
trials_epochs = len(trials)
|
||||
|
||||
n = config.get('hyperopt_show_index', -1)
|
||||
if n > trials_epochs:
|
||||
raise OperationalException(
|
||||
f"The index of the epoch to show should be less than {trials_epochs + 1}.")
|
||||
if n < -trials_epochs:
|
||||
raise OperationalException(
|
||||
f"The index of the epoch to show should be greater than {-trials_epochs - 1}.")
|
||||
|
||||
# Translate epoch index from human-readable format to pythonic
|
||||
if n > 0:
|
||||
n -= 1
|
||||
|
||||
print_json = config.get('print_json', False)
|
||||
|
||||
if trials:
|
||||
val = trials[n]
|
||||
Hyperopt.print_epoch_details(val, total_epochs, print_json, no_header,
|
||||
header_str="Epoch details")
|
||||
|
||||
|
||||
def _hyperopt_filter_trials(trials: List, only_best: bool, only_profitable: bool) -> List:
|
||||
"""
|
||||
Filter our items from the list of hyperopt results
|
||||
"""
|
||||
if only_best:
|
||||
trials = [x for x in trials if x['is_best']]
|
||||
if only_profitable:
|
||||
trials = [x for x in trials if x['results_metrics']['profit'] > 0]
|
||||
|
||||
logger.info(f"{len(trials)} " +
|
||||
("best " if only_best else "") +
|
||||
("profitable " if only_profitable else "") +
|
||||
"epochs found.")
|
||||
|
||||
return trials
|
||||
156
freqtrade/commands/list_commands.py
Normal file
156
freqtrade/commands/list_commands.py
Normal file
@@ -0,0 +1,156 @@
|
||||
import csv
|
||||
import logging
|
||||
import sys
|
||||
from collections import OrderedDict
|
||||
from pathlib import Path
|
||||
from typing import Any, Dict
|
||||
|
||||
import rapidjson
|
||||
from tabulate import tabulate
|
||||
|
||||
from freqtrade.configuration import setup_utils_configuration
|
||||
from freqtrade.constants import USERPATH_STRATEGY
|
||||
from freqtrade.exceptions import OperationalException
|
||||
from freqtrade.exchange import (available_exchanges, ccxt_exchanges,
|
||||
market_is_active, symbol_is_pair)
|
||||
from freqtrade.misc import plural
|
||||
from freqtrade.resolvers import ExchangeResolver, StrategyResolver
|
||||
from freqtrade.state import RunMode
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def start_list_exchanges(args: Dict[str, Any]) -> None:
|
||||
"""
|
||||
Print available exchanges
|
||||
:param args: Cli args from Arguments()
|
||||
:return: None
|
||||
"""
|
||||
exchanges = ccxt_exchanges() if args['list_exchanges_all'] else available_exchanges()
|
||||
if args['print_one_column']:
|
||||
print('\n'.join(exchanges))
|
||||
else:
|
||||
if args['list_exchanges_all']:
|
||||
print(f"All exchanges supported by the ccxt library: {', '.join(exchanges)}")
|
||||
else:
|
||||
print(f"Exchanges available for Freqtrade: {', '.join(exchanges)}")
|
||||
|
||||
|
||||
def start_list_strategies(args: Dict[str, Any]) -> None:
|
||||
"""
|
||||
Print Strategies available in a directory
|
||||
"""
|
||||
config = setup_utils_configuration(args, RunMode.UTIL_NO_EXCHANGE)
|
||||
|
||||
directory = Path(config.get('strategy_path', config['user_data_dir'] / USERPATH_STRATEGY))
|
||||
strategies = StrategyResolver.search_all_objects(directory)
|
||||
# Sort alphabetically
|
||||
strategies = sorted(strategies, key=lambda x: x['name'])
|
||||
strats_to_print = [{'name': s['name'], 'location': s['location'].name} for s in strategies]
|
||||
|
||||
if args['print_one_column']:
|
||||
print('\n'.join([s['name'] for s in strategies]))
|
||||
else:
|
||||
print(tabulate(strats_to_print, headers='keys', tablefmt='pipe'))
|
||||
|
||||
|
||||
def start_list_timeframes(args: Dict[str, Any]) -> None:
|
||||
"""
|
||||
Print ticker intervals (timeframes) available on Exchange
|
||||
"""
|
||||
config = setup_utils_configuration(args, RunMode.UTIL_EXCHANGE)
|
||||
# Do not use ticker_interval set in the config
|
||||
config['ticker_interval'] = None
|
||||
|
||||
# Init exchange
|
||||
exchange = ExchangeResolver.load_exchange(config['exchange']['name'], config, validate=False)
|
||||
|
||||
if args['print_one_column']:
|
||||
print('\n'.join(exchange.timeframes))
|
||||
else:
|
||||
print(f"Timeframes available for the exchange `{exchange.name}`: "
|
||||
f"{', '.join(exchange.timeframes)}")
|
||||
|
||||
|
||||
def start_list_markets(args: Dict[str, Any], pairs_only: bool = False) -> None:
|
||||
"""
|
||||
Print pairs/markets on the exchange
|
||||
:param args: Cli args from Arguments()
|
||||
:param pairs_only: if True print only pairs, otherwise print all instruments (markets)
|
||||
:return: None
|
||||
"""
|
||||
config = setup_utils_configuration(args, RunMode.UTIL_EXCHANGE)
|
||||
|
||||
# Init exchange
|
||||
exchange = ExchangeResolver.load_exchange(config['exchange']['name'], config, validate=False)
|
||||
|
||||
# By default only active pairs/markets are to be shown
|
||||
active_only = not args.get('list_pairs_all', False)
|
||||
|
||||
base_currencies = args.get('base_currencies', [])
|
||||
quote_currencies = args.get('quote_currencies', [])
|
||||
|
||||
try:
|
||||
pairs = exchange.get_markets(base_currencies=base_currencies,
|
||||
quote_currencies=quote_currencies,
|
||||
pairs_only=pairs_only,
|
||||
active_only=active_only)
|
||||
# Sort the pairs/markets by symbol
|
||||
pairs = OrderedDict(sorted(pairs.items()))
|
||||
except Exception as e:
|
||||
raise OperationalException(f"Cannot get markets. Reason: {e}") from e
|
||||
|
||||
else:
|
||||
summary_str = ((f"Exchange {exchange.name} has {len(pairs)} ") +
|
||||
("active " if active_only else "") +
|
||||
(plural(len(pairs), "pair" if pairs_only else "market")) +
|
||||
(f" with {', '.join(base_currencies)} as base "
|
||||
f"{plural(len(base_currencies), 'currency', 'currencies')}"
|
||||
if base_currencies else "") +
|
||||
(" and" if base_currencies and quote_currencies else "") +
|
||||
(f" with {', '.join(quote_currencies)} as quote "
|
||||
f"{plural(len(quote_currencies), 'currency', 'currencies')}"
|
||||
if quote_currencies else ""))
|
||||
|
||||
headers = ["Id", "Symbol", "Base", "Quote", "Active",
|
||||
*(['Is pair'] if not pairs_only else [])]
|
||||
|
||||
tabular_data = []
|
||||
for _, v in pairs.items():
|
||||
tabular_data.append({'Id': v['id'], 'Symbol': v['symbol'],
|
||||
'Base': v['base'], 'Quote': v['quote'],
|
||||
'Active': market_is_active(v),
|
||||
**({'Is pair': symbol_is_pair(v['symbol'])}
|
||||
if not pairs_only else {})})
|
||||
|
||||
if (args.get('print_one_column', False) or
|
||||
args.get('list_pairs_print_json', False) or
|
||||
args.get('print_csv', False)):
|
||||
# Print summary string in the log in case of machine-readable
|
||||
# regular formats.
|
||||
logger.info(f"{summary_str}.")
|
||||
else:
|
||||
# Print empty string separating leading logs and output in case of
|
||||
# human-readable formats.
|
||||
print()
|
||||
|
||||
if len(pairs):
|
||||
if args.get('print_list', False):
|
||||
# print data as a list, with human-readable summary
|
||||
print(f"{summary_str}: {', '.join(pairs.keys())}.")
|
||||
elif args.get('print_one_column', False):
|
||||
print('\n'.join(pairs.keys()))
|
||||
elif args.get('list_pairs_print_json', False):
|
||||
print(rapidjson.dumps(list(pairs.keys()), default=str))
|
||||
elif args.get('print_csv', False):
|
||||
writer = csv.DictWriter(sys.stdout, fieldnames=headers)
|
||||
writer.writeheader()
|
||||
writer.writerows(tabular_data)
|
||||
else:
|
||||
# print data as a table, with the human-readable summary
|
||||
print(f"{summary_str}:")
|
||||
print(tabulate(tabular_data, headers='keys', tablefmt='pipe'))
|
||||
elif not (args.get('print_one_column', False) or
|
||||
args.get('list_pairs_print_json', False) or
|
||||
args.get('print_csv', False)):
|
||||
print(f"{summary_str}.")
|
||||
102
freqtrade/commands/optimize_commands.py
Normal file
102
freqtrade/commands/optimize_commands.py
Normal file
@@ -0,0 +1,102 @@
|
||||
import logging
|
||||
from typing import Any, Dict
|
||||
|
||||
from freqtrade import constants
|
||||
from freqtrade.configuration import setup_utils_configuration
|
||||
from freqtrade.exceptions import DependencyException, OperationalException
|
||||
from freqtrade.state import RunMode
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def setup_optimize_configuration(args: Dict[str, Any], method: RunMode) -> Dict[str, Any]:
|
||||
"""
|
||||
Prepare the configuration for the Hyperopt module
|
||||
:param args: Cli args from Arguments()
|
||||
:return: Configuration
|
||||
"""
|
||||
config = setup_utils_configuration(args, method)
|
||||
|
||||
if method == RunMode.BACKTEST:
|
||||
if config['stake_amount'] == constants.UNLIMITED_STAKE_AMOUNT:
|
||||
raise DependencyException('stake amount could not be "%s" for backtesting' %
|
||||
constants.UNLIMITED_STAKE_AMOUNT)
|
||||
|
||||
return config
|
||||
|
||||
|
||||
def start_backtesting(args: Dict[str, Any]) -> None:
|
||||
"""
|
||||
Start Backtesting script
|
||||
:param args: Cli args from Arguments()
|
||||
:return: None
|
||||
"""
|
||||
# Import here to avoid loading backtesting module when it's not used
|
||||
from freqtrade.optimize.backtesting import Backtesting
|
||||
|
||||
# Initialize configuration
|
||||
config = setup_optimize_configuration(args, RunMode.BACKTEST)
|
||||
|
||||
logger.info('Starting freqtrade in Backtesting mode')
|
||||
|
||||
# Initialize backtesting object
|
||||
backtesting = Backtesting(config)
|
||||
backtesting.start()
|
||||
|
||||
|
||||
def start_hyperopt(args: Dict[str, Any]) -> None:
|
||||
"""
|
||||
Start hyperopt script
|
||||
:param args: Cli args from Arguments()
|
||||
:return: None
|
||||
"""
|
||||
# Import here to avoid loading hyperopt module when it's not used
|
||||
try:
|
||||
from filelock import FileLock, Timeout
|
||||
from freqtrade.optimize.hyperopt import Hyperopt
|
||||
except ImportError as e:
|
||||
raise OperationalException(
|
||||
f"{e}. Please ensure that the hyperopt dependencies are installed.") from e
|
||||
# Initialize configuration
|
||||
config = setup_optimize_configuration(args, RunMode.HYPEROPT)
|
||||
|
||||
logger.info('Starting freqtrade in Hyperopt mode')
|
||||
|
||||
lock = FileLock(Hyperopt.get_lock_filename(config))
|
||||
|
||||
try:
|
||||
with lock.acquire(timeout=1):
|
||||
|
||||
# Remove noisy log messages
|
||||
logging.getLogger('hyperopt.tpe').setLevel(logging.WARNING)
|
||||
logging.getLogger('filelock').setLevel(logging.WARNING)
|
||||
|
||||
# Initialize backtesting object
|
||||
hyperopt = Hyperopt(config)
|
||||
hyperopt.start()
|
||||
|
||||
except Timeout:
|
||||
logger.info("Another running instance of freqtrade Hyperopt detected.")
|
||||
logger.info("Simultaneous execution of multiple Hyperopt commands is not supported. "
|
||||
"Hyperopt module is resource hungry. Please run your Hyperopt sequentially "
|
||||
"or on separate machines.")
|
||||
logger.info("Quitting now.")
|
||||
# TODO: return False here in order to help freqtrade to exit
|
||||
# with non-zero exit code...
|
||||
# Same in Edge and Backtesting start() functions.
|
||||
|
||||
|
||||
def start_edge(args: Dict[str, Any]) -> None:
|
||||
"""
|
||||
Start Edge script
|
||||
:param args: Cli args from Arguments()
|
||||
:return: None
|
||||
"""
|
||||
from freqtrade.optimize.edge_cli import EdgeCli
|
||||
# Initialize configuration
|
||||
config = setup_optimize_configuration(args, RunMode.EDGE)
|
||||
logger.info('Starting freqtrade in Edge mode')
|
||||
|
||||
# Initialize Edge object
|
||||
edge_cli = EdgeCli(config)
|
||||
edge_cli.start()
|
||||
42
freqtrade/commands/pairlist_commands.py
Normal file
42
freqtrade/commands/pairlist_commands.py
Normal file
@@ -0,0 +1,42 @@
|
||||
import logging
|
||||
from typing import Any, Dict
|
||||
|
||||
import rapidjson
|
||||
|
||||
from freqtrade.configuration import setup_utils_configuration
|
||||
from freqtrade.resolvers import ExchangeResolver
|
||||
from freqtrade.state import RunMode
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def start_test_pairlist(args: Dict[str, Any]) -> None:
|
||||
"""
|
||||
Test Pairlist configuration
|
||||
"""
|
||||
from freqtrade.pairlist.pairlistmanager import PairListManager
|
||||
config = setup_utils_configuration(args, RunMode.UTIL_EXCHANGE)
|
||||
|
||||
exchange = ExchangeResolver.load_exchange(config['exchange']['name'], config, validate=False)
|
||||
|
||||
quote_currencies = args.get('quote_currencies')
|
||||
if not quote_currencies:
|
||||
quote_currencies = [config.get('stake_currency')]
|
||||
results = {}
|
||||
for curr in quote_currencies:
|
||||
config['stake_currency'] = curr
|
||||
# Do not use ticker_interval set in the config
|
||||
pairlists = PairListManager(exchange, config)
|
||||
pairlists.refresh_pairlist()
|
||||
results[curr] = pairlists.whitelist
|
||||
|
||||
for curr, pairlist in results.items():
|
||||
if not args.get('print_one_column', False):
|
||||
print(f"Pairs for {curr}: ")
|
||||
|
||||
if args.get('print_one_column', False):
|
||||
print('\n'.join(pairlist))
|
||||
elif args.get('list_pairs_print_json', False):
|
||||
print(rapidjson.dumps(list(pairlist), default=str))
|
||||
else:
|
||||
print(pairlist)
|
||||
36
freqtrade/commands/plot_commands.py
Normal file
36
freqtrade/commands/plot_commands.py
Normal file
@@ -0,0 +1,36 @@
|
||||
from typing import Any, Dict
|
||||
|
||||
from freqtrade.configuration import setup_utils_configuration
|
||||
from freqtrade.exceptions import OperationalException
|
||||
from freqtrade.state import RunMode
|
||||
|
||||
|
||||
def validate_plot_args(args: Dict[str, Any]):
|
||||
if not args.get('datadir') and not args.get('config'):
|
||||
raise OperationalException(
|
||||
"You need to specify either `--datadir` or `--config` "
|
||||
"for plot-profit and plot-dataframe.")
|
||||
|
||||
|
||||
def start_plot_dataframe(args: Dict[str, Any]) -> None:
|
||||
"""
|
||||
Entrypoint for dataframe plotting
|
||||
"""
|
||||
# Import here to avoid errors if plot-dependencies are not installed.
|
||||
from freqtrade.plot.plotting import load_and_plot_trades
|
||||
validate_plot_args(args)
|
||||
config = setup_utils_configuration(args, RunMode.PLOT)
|
||||
|
||||
load_and_plot_trades(config)
|
||||
|
||||
|
||||
def start_plot_profit(args: Dict[str, Any]) -> None:
|
||||
"""
|
||||
Entrypoint for plot_profit
|
||||
"""
|
||||
# Import here to avoid errors if plot-dependencies are not installed.
|
||||
from freqtrade.plot.plotting import plot_profit
|
||||
validate_plot_args(args)
|
||||
config = setup_utils_configuration(args, RunMode.PLOT)
|
||||
|
||||
plot_profit(config)
|
||||
27
freqtrade/commands/trade_commands.py
Normal file
27
freqtrade/commands/trade_commands.py
Normal file
@@ -0,0 +1,27 @@
|
||||
import logging
|
||||
|
||||
from typing import Any, Dict
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def start_trading(args: Dict[str, Any]) -> int:
|
||||
"""
|
||||
Main entry point for trading mode
|
||||
"""
|
||||
# Import here to avoid loading worker module when it's not used
|
||||
from freqtrade.worker import Worker
|
||||
|
||||
# Create and run worker
|
||||
worker = None
|
||||
try:
|
||||
worker = Worker(args)
|
||||
worker.run()
|
||||
except KeyboardInterrupt:
|
||||
logger.info('SIGINT received, aborting ...')
|
||||
finally:
|
||||
if worker:
|
||||
logger.info("worker found ... calling exit")
|
||||
worker.exit()
|
||||
return 0
|
||||
@@ -1,334 +0,0 @@
|
||||
"""
|
||||
This module contains the configuration class
|
||||
"""
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
from argparse import Namespace
|
||||
from typing import Any, Dict, Optional
|
||||
|
||||
import ccxt
|
||||
from jsonschema import Draft4Validator, validate
|
||||
from jsonschema.exceptions import ValidationError, best_match
|
||||
|
||||
from freqtrade import OperationalException, constants
|
||||
from freqtrade.state import RunMode
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def set_loggers(log_level: int = 0) -> None:
|
||||
"""
|
||||
Set the logger level for Third party libs
|
||||
:return: None
|
||||
"""
|
||||
|
||||
logging.getLogger('requests').setLevel(logging.INFO if log_level <= 1 else logging.DEBUG)
|
||||
logging.getLogger("urllib3").setLevel(logging.INFO if log_level <= 1 else logging.DEBUG)
|
||||
logging.getLogger('ccxt.base.exchange').setLevel(
|
||||
logging.INFO if log_level <= 2 else logging.DEBUG)
|
||||
logging.getLogger('telegram').setLevel(logging.INFO)
|
||||
|
||||
|
||||
class Configuration(object):
|
||||
"""
|
||||
Class to read and init the bot configuration
|
||||
Reuse this class for the bot, backtesting, hyperopt and every script that required configuration
|
||||
"""
|
||||
|
||||
def __init__(self, args: Namespace, runmode: RunMode = None) -> None:
|
||||
self.args = args
|
||||
self.config: Optional[Dict[str, Any]] = None
|
||||
self.runmode = runmode
|
||||
|
||||
def load_config(self) -> Dict[str, Any]:
|
||||
"""
|
||||
Extract information for sys.argv and load the bot configuration
|
||||
:return: Configuration dictionary
|
||||
"""
|
||||
logger.info('Using config: %s ...', self.args.config)
|
||||
config = self._load_config_file(self.args.config)
|
||||
|
||||
# Set strategy if not specified in config and or if it's non default
|
||||
if self.args.strategy != constants.DEFAULT_STRATEGY or not config.get('strategy'):
|
||||
config.update({'strategy': self.args.strategy})
|
||||
|
||||
if self.args.strategy_path:
|
||||
config.update({'strategy_path': self.args.strategy_path})
|
||||
|
||||
# Add the hyperopt file to use
|
||||
config.update({'hyperopt': self.args.hyperopt})
|
||||
|
||||
# Load Common configuration
|
||||
config = self._load_common_config(config)
|
||||
|
||||
# Load Backtesting
|
||||
config = self._load_backtesting_config(config)
|
||||
|
||||
# Load Edge
|
||||
config = self._load_edge_config(config)
|
||||
|
||||
# Load Hyperopt
|
||||
config = self._load_hyperopt_config(config)
|
||||
|
||||
# Set runmode
|
||||
if not self.runmode:
|
||||
# Handle real mode, infer dry/live from config
|
||||
self.runmode = RunMode.DRY_RUN if config.get('dry_run', True) else RunMode.LIVE
|
||||
|
||||
config.update({'runmode': self.runmode})
|
||||
|
||||
return config
|
||||
|
||||
def _load_config_file(self, path: str) -> Dict[str, Any]:
|
||||
"""
|
||||
Loads a config file from the given path
|
||||
:param path: path as str
|
||||
:return: configuration as dictionary
|
||||
"""
|
||||
try:
|
||||
with open(path) as file:
|
||||
conf = json.load(file)
|
||||
except FileNotFoundError:
|
||||
raise OperationalException(
|
||||
f'Config file "{path}" not found!'
|
||||
' Please create a config file or check whether it exists.')
|
||||
|
||||
if 'internals' not in conf:
|
||||
conf['internals'] = {}
|
||||
logger.info('Validating configuration ...')
|
||||
|
||||
return self._validate_config(conf)
|
||||
|
||||
def _load_common_config(self, config: Dict[str, Any]) -> Dict[str, Any]:
|
||||
"""
|
||||
Extract information for sys.argv and load common configuration
|
||||
:return: configuration as dictionary
|
||||
"""
|
||||
|
||||
# Log level
|
||||
if 'loglevel' in self.args and self.args.loglevel:
|
||||
config.update({'verbosity': self.args.loglevel})
|
||||
else:
|
||||
config.update({'verbosity': 0})
|
||||
logging.basicConfig(
|
||||
level=logging.INFO if config['verbosity'] < 1 else logging.DEBUG,
|
||||
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
|
||||
)
|
||||
set_loggers(config['verbosity'])
|
||||
logger.info('Verbosity set to %s', config['verbosity'])
|
||||
|
||||
# Add dynamic_whitelist if found
|
||||
if 'dynamic_whitelist' in self.args and self.args.dynamic_whitelist:
|
||||
# Update to volumePairList (the previous default)
|
||||
config['pairlist'] = {'method': 'VolumePairList',
|
||||
'config': {'number_assets': self.args.dynamic_whitelist}
|
||||
}
|
||||
logger.warning(
|
||||
'Parameter --dynamic-whitelist has been deprecated, '
|
||||
'and will be completely replaced by the whitelist dict in the future. '
|
||||
'For now: using dynamically generated whitelist based on VolumePairList. '
|
||||
'(not applicable with Backtesting and Hyperopt)'
|
||||
)
|
||||
|
||||
if self.args.db_url and self.args.db_url != constants.DEFAULT_DB_PROD_URL:
|
||||
config.update({'db_url': self.args.db_url})
|
||||
logger.info('Parameter --db-url detected ...')
|
||||
|
||||
if config.get('dry_run', False):
|
||||
logger.info('Dry run is enabled')
|
||||
if config.get('db_url') in [None, constants.DEFAULT_DB_PROD_URL]:
|
||||
# Default to in-memory db for dry_run if not specified
|
||||
config['db_url'] = constants.DEFAULT_DB_DRYRUN_URL
|
||||
else:
|
||||
if not config.get('db_url', None):
|
||||
config['db_url'] = constants.DEFAULT_DB_PROD_URL
|
||||
logger.info('Dry run is disabled')
|
||||
|
||||
if config.get('forcebuy_enable', False):
|
||||
logger.warning('`forcebuy` RPC message enabled.')
|
||||
|
||||
# Setting max_open_trades to infinite if -1
|
||||
if config.get('max_open_trades') == -1:
|
||||
config['max_open_trades'] = float('inf')
|
||||
|
||||
logger.info(f'Using DB: "{config["db_url"]}"')
|
||||
|
||||
# Check if the exchange set by the user is supported
|
||||
self.check_exchange(config)
|
||||
|
||||
return config
|
||||
|
||||
def _create_datadir(self, config: Dict[str, Any], datadir: Optional[str] = None) -> str:
|
||||
if not datadir:
|
||||
# set datadir
|
||||
exchange_name = config.get('exchange', {}).get('name').lower()
|
||||
datadir = os.path.join('user_data', 'data', exchange_name)
|
||||
|
||||
if not os.path.isdir(datadir):
|
||||
os.makedirs(datadir)
|
||||
logger.info(f'Created data directory: {datadir}')
|
||||
return datadir
|
||||
|
||||
def _load_backtesting_config(self, config: Dict[str, Any]) -> Dict[str, Any]:
|
||||
"""
|
||||
Extract information for sys.argv and load Backtesting configuration
|
||||
:return: configuration as dictionary
|
||||
"""
|
||||
|
||||
# If -i/--ticker-interval is used we override the configuration parameter
|
||||
# (that will override the strategy configuration)
|
||||
if 'ticker_interval' in self.args and self.args.ticker_interval:
|
||||
config.update({'ticker_interval': self.args.ticker_interval})
|
||||
logger.info('Parameter -i/--ticker-interval detected ...')
|
||||
logger.info('Using ticker_interval: %s ...', config.get('ticker_interval'))
|
||||
|
||||
# If -l/--live is used we add it to the configuration
|
||||
if 'live' in self.args and self.args.live:
|
||||
config.update({'live': True})
|
||||
logger.info('Parameter -l/--live detected ...')
|
||||
|
||||
# If --enable-position-stacking is used we add it to the configuration
|
||||
if 'position_stacking' in self.args and self.args.position_stacking:
|
||||
config.update({'position_stacking': True})
|
||||
logger.info('Parameter --enable-position-stacking detected ...')
|
||||
|
||||
# If --disable-max-market-positions is used we add it to the configuration
|
||||
if 'use_max_market_positions' in self.args and not self.args.use_max_market_positions:
|
||||
config.update({'use_max_market_positions': False})
|
||||
logger.info('Parameter --disable-max-market-positions detected ...')
|
||||
logger.info('max_open_trades set to unlimited ...')
|
||||
else:
|
||||
logger.info('Using max_open_trades: %s ...', config.get('max_open_trades'))
|
||||
|
||||
# If --timerange is used we add it to the configuration
|
||||
if 'timerange' in self.args and self.args.timerange:
|
||||
config.update({'timerange': self.args.timerange})
|
||||
logger.info('Parameter --timerange detected: %s ...', self.args.timerange)
|
||||
|
||||
# If --datadir is used we add it to the configuration
|
||||
if 'datadir' in self.args and self.args.datadir:
|
||||
config.update({'datadir': self._create_datadir(config, self.args.datadir)})
|
||||
else:
|
||||
config.update({'datadir': self._create_datadir(config, None)})
|
||||
logger.info('Using data folder: %s ...', config.get('datadir'))
|
||||
|
||||
# If -r/--refresh-pairs-cached is used we add it to the configuration
|
||||
if 'refresh_pairs' in self.args and self.args.refresh_pairs:
|
||||
config.update({'refresh_pairs': True})
|
||||
logger.info('Parameter -r/--refresh-pairs-cached detected ...')
|
||||
|
||||
if 'strategy_list' in self.args and self.args.strategy_list:
|
||||
config.update({'strategy_list': self.args.strategy_list})
|
||||
logger.info('Using strategy list of %s Strategies', len(self.args.strategy_list))
|
||||
|
||||
if 'ticker_interval' in self.args and self.args.ticker_interval:
|
||||
config.update({'ticker_interval': self.args.ticker_interval})
|
||||
logger.info('Overriding ticker interval with Command line argument')
|
||||
|
||||
# If --export is used we add it to the configuration
|
||||
if 'export' in self.args and self.args.export:
|
||||
config.update({'export': self.args.export})
|
||||
logger.info('Parameter --export detected: %s ...', self.args.export)
|
||||
|
||||
# If --export-filename is used we add it to the configuration
|
||||
if 'export' in config and 'exportfilename' in self.args and self.args.exportfilename:
|
||||
config.update({'exportfilename': self.args.exportfilename})
|
||||
logger.info('Storing backtest results to %s ...', self.args.exportfilename)
|
||||
|
||||
return config
|
||||
|
||||
def _load_edge_config(self, config: Dict[str, Any]) -> Dict[str, Any]:
|
||||
"""
|
||||
Extract information for sys.argv and load Edge configuration
|
||||
:return: configuration as dictionary
|
||||
"""
|
||||
|
||||
# If --timerange is used we add it to the configuration
|
||||
if 'timerange' in self.args and self.args.timerange:
|
||||
config.update({'timerange': self.args.timerange})
|
||||
logger.info('Parameter --timerange detected: %s ...', self.args.timerange)
|
||||
|
||||
# If --timerange is used we add it to the configuration
|
||||
if 'stoploss_range' in self.args and self.args.stoploss_range:
|
||||
txt_range = eval(self.args.stoploss_range)
|
||||
config['edge'].update({'stoploss_range_min': txt_range[0]})
|
||||
config['edge'].update({'stoploss_range_max': txt_range[1]})
|
||||
config['edge'].update({'stoploss_range_step': txt_range[2]})
|
||||
logger.info('Parameter --stoplosses detected: %s ...', self.args.stoploss_range)
|
||||
|
||||
# If -r/--refresh-pairs-cached is used we add it to the configuration
|
||||
if 'refresh_pairs' in self.args and self.args.refresh_pairs:
|
||||
config.update({'refresh_pairs': True})
|
||||
logger.info('Parameter -r/--refresh-pairs-cached detected ...')
|
||||
|
||||
return config
|
||||
|
||||
def _load_hyperopt_config(self, config: Dict[str, Any]) -> Dict[str, Any]:
|
||||
"""
|
||||
Extract information for sys.argv and load Hyperopt configuration
|
||||
:return: configuration as dictionary
|
||||
"""
|
||||
# If --epochs is used we add it to the configuration
|
||||
if 'epochs' in self.args and self.args.epochs:
|
||||
config.update({'epochs': self.args.epochs})
|
||||
logger.info('Parameter --epochs detected ...')
|
||||
logger.info('Will run Hyperopt with for %s epochs ...', config.get('epochs'))
|
||||
|
||||
# If --spaces is used we add it to the configuration
|
||||
if 'spaces' in self.args and self.args.spaces:
|
||||
config.update({'spaces': self.args.spaces})
|
||||
logger.info('Parameter -s/--spaces detected: %s', config.get('spaces'))
|
||||
|
||||
return config
|
||||
|
||||
def _validate_config(self, conf: Dict[str, Any]) -> Dict[str, Any]:
|
||||
"""
|
||||
Validate the configuration follow the Config Schema
|
||||
:param conf: Config in JSON format
|
||||
:return: Returns the config if valid, otherwise throw an exception
|
||||
"""
|
||||
try:
|
||||
validate(conf, constants.CONF_SCHEMA, Draft4Validator)
|
||||
return conf
|
||||
except ValidationError as exception:
|
||||
logger.critical(
|
||||
'Invalid configuration. See config.json.example. Reason: %s',
|
||||
exception
|
||||
)
|
||||
raise ValidationError(
|
||||
best_match(Draft4Validator(constants.CONF_SCHEMA).iter_errors(conf)).message
|
||||
)
|
||||
|
||||
def get_config(self) -> Dict[str, Any]:
|
||||
"""
|
||||
Return the config. Use this method to get the bot config
|
||||
:return: Dict: Bot config
|
||||
"""
|
||||
if self.config is None:
|
||||
self.config = self.load_config()
|
||||
|
||||
return self.config
|
||||
|
||||
def check_exchange(self, config: Dict[str, Any]) -> bool:
|
||||
"""
|
||||
Check if the exchange name in the config file is supported by Freqtrade
|
||||
:return: True or raised an exception if the exchange if not supported
|
||||
"""
|
||||
exchange = config.get('exchange', {}).get('name').lower()
|
||||
if exchange not in ccxt.exchanges:
|
||||
|
||||
exception_msg = f'Exchange "{exchange}" not supported.\n' \
|
||||
f'The following exchanges are supported: {", ".join(ccxt.exchanges)}'
|
||||
|
||||
logger.critical(exception_msg)
|
||||
raise OperationalException(
|
||||
exception_msg
|
||||
)
|
||||
# Depreciation warning
|
||||
if 'ccxt_rate_limit' in config.get('exchange', {}):
|
||||
logger.warning("`ccxt_rate_limit` has been deprecated in favor of "
|
||||
"`ccxt_config` and `ccxt_async_config` and will be removed "
|
||||
"in a future version.")
|
||||
|
||||
logger.debug('Exchange "%s" supported', exchange)
|
||||
return True
|
||||
7
freqtrade/configuration/__init__.py
Normal file
7
freqtrade/configuration/__init__.py
Normal file
@@ -0,0 +1,7 @@
|
||||
# flake8: noqa: F401
|
||||
|
||||
from freqtrade.configuration.config_setup import setup_utils_configuration
|
||||
from freqtrade.configuration.check_exchange import check_exchange, remove_credentials
|
||||
from freqtrade.configuration.timerange import TimeRange
|
||||
from freqtrade.configuration.configuration import Configuration
|
||||
from freqtrade.configuration.config_validation import validate_config_consistency
|
||||
74
freqtrade/configuration/check_exchange.py
Normal file
74
freqtrade/configuration/check_exchange.py
Normal file
@@ -0,0 +1,74 @@
|
||||
import logging
|
||||
from typing import Any, Dict
|
||||
|
||||
from freqtrade.exceptions import OperationalException
|
||||
from freqtrade.exchange import (available_exchanges, get_exchange_bad_reason,
|
||||
is_exchange_bad, is_exchange_known_ccxt,
|
||||
is_exchange_officially_supported)
|
||||
from freqtrade.state import RunMode
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def remove_credentials(config: Dict[str, Any]):
|
||||
"""
|
||||
Removes exchange keys from the configuration and specifies dry-run
|
||||
Used for backtesting / hyperopt / edge and utils.
|
||||
Modifies the input dict!
|
||||
"""
|
||||
config['exchange']['key'] = ''
|
||||
config['exchange']['secret'] = ''
|
||||
config['exchange']['password'] = ''
|
||||
config['exchange']['uid'] = ''
|
||||
config['dry_run'] = True
|
||||
|
||||
|
||||
def check_exchange(config: Dict[str, Any], check_for_bad: bool = True) -> bool:
|
||||
"""
|
||||
Check if the exchange name in the config file is supported by Freqtrade
|
||||
:param check_for_bad: if True, check the exchange against the list of known 'bad'
|
||||
exchanges
|
||||
:return: False if exchange is 'bad', i.e. is known to work with the bot with
|
||||
critical issues or does not work at all, crashes, etc. True otherwise.
|
||||
raises an exception if the exchange if not supported by ccxt
|
||||
and thus is not known for the Freqtrade at all.
|
||||
"""
|
||||
|
||||
if (config['runmode'] in [RunMode.PLOT, RunMode.UTIL_NO_EXCHANGE, RunMode.OTHER]
|
||||
and not config.get('exchange', {}).get('name')):
|
||||
# Skip checking exchange in plot mode, since it requires no exchange
|
||||
return True
|
||||
logger.info("Checking exchange...")
|
||||
|
||||
exchange = config.get('exchange', {}).get('name').lower()
|
||||
if not exchange:
|
||||
raise OperationalException(
|
||||
f'This command requires a configured exchange. You should either use '
|
||||
f'`--exchange <exchange_name>` or specify a configuration file via `--config`.\n'
|
||||
f'The following exchanges are available for Freqtrade: '
|
||||
f'{", ".join(available_exchanges())}'
|
||||
)
|
||||
|
||||
if not is_exchange_known_ccxt(exchange):
|
||||
raise OperationalException(
|
||||
f'Exchange "{exchange}" is not known to the ccxt library '
|
||||
f'and therefore not available for the bot.\n'
|
||||
f'The following exchanges are available for Freqtrade: '
|
||||
f'{", ".join(available_exchanges())}'
|
||||
)
|
||||
|
||||
if check_for_bad and is_exchange_bad(exchange):
|
||||
raise OperationalException(f'Exchange "{exchange}" is known to not work with the bot yet. '
|
||||
f'Reason: {get_exchange_bad_reason(exchange)}')
|
||||
|
||||
if is_exchange_officially_supported(exchange):
|
||||
logger.info(f'Exchange "{exchange}" is officially supported '
|
||||
f'by the Freqtrade development team.')
|
||||
else:
|
||||
logger.warning(f'Exchange "{exchange}" is known to the the ccxt library, '
|
||||
f'available for the bot, but not officially supported '
|
||||
f'by the Freqtrade development team. '
|
||||
f'It may work flawlessly (please report back) or have serious issues. '
|
||||
f'Use it at your own discretion.')
|
||||
|
||||
return True
|
||||
25
freqtrade/configuration/config_setup.py
Normal file
25
freqtrade/configuration/config_setup.py
Normal file
@@ -0,0 +1,25 @@
|
||||
import logging
|
||||
from typing import Any, Dict
|
||||
|
||||
from .config_validation import validate_config_consistency
|
||||
from .configuration import Configuration
|
||||
from .check_exchange import remove_credentials
|
||||
from freqtrade.state import RunMode
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def setup_utils_configuration(args: Dict[str, Any], method: RunMode) -> Dict[str, Any]:
|
||||
"""
|
||||
Prepare the configuration for utils subcommands
|
||||
:param args: Cli args from Arguments()
|
||||
:return: Configuration
|
||||
"""
|
||||
configuration = Configuration(args, method)
|
||||
config = configuration.get_config()
|
||||
|
||||
# Ensure we do not use Exchange credentials
|
||||
remove_credentials(config)
|
||||
validate_config_consistency(config)
|
||||
|
||||
return config
|
||||
164
freqtrade/configuration/config_validation.py
Normal file
164
freqtrade/configuration/config_validation.py
Normal file
@@ -0,0 +1,164 @@
|
||||
import logging
|
||||
from copy import deepcopy
|
||||
from typing import Any, Dict
|
||||
|
||||
from jsonschema import Draft4Validator, validators
|
||||
from jsonschema.exceptions import ValidationError, best_match
|
||||
|
||||
from freqtrade import constants
|
||||
from freqtrade.exceptions import OperationalException
|
||||
from freqtrade.state import RunMode
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def _extend_validator(validator_class):
|
||||
"""
|
||||
Extended validator for the Freqtrade configuration JSON Schema.
|
||||
Currently it only handles defaults for subschemas.
|
||||
"""
|
||||
validate_properties = validator_class.VALIDATORS['properties']
|
||||
|
||||
def set_defaults(validator, properties, instance, schema):
|
||||
for prop, subschema in properties.items():
|
||||
if 'default' in subschema:
|
||||
instance.setdefault(prop, subschema['default'])
|
||||
|
||||
for error in validate_properties(
|
||||
validator, properties, instance, schema,
|
||||
):
|
||||
yield error
|
||||
|
||||
return validators.extend(
|
||||
validator_class, {'properties': set_defaults}
|
||||
)
|
||||
|
||||
|
||||
FreqtradeValidator = _extend_validator(Draft4Validator)
|
||||
|
||||
|
||||
def validate_config_schema(conf: Dict[str, Any]) -> Dict[str, Any]:
|
||||
"""
|
||||
Validate the configuration follow the Config Schema
|
||||
:param conf: Config in JSON format
|
||||
:return: Returns the config if valid, otherwise throw an exception
|
||||
"""
|
||||
conf_schema = deepcopy(constants.CONF_SCHEMA)
|
||||
if conf.get('runmode', RunMode.OTHER) in (RunMode.DRY_RUN, RunMode.LIVE):
|
||||
conf_schema['required'] = constants.SCHEMA_TRADE_REQUIRED
|
||||
else:
|
||||
conf_schema['required'] = constants.SCHEMA_MINIMAL_REQUIRED
|
||||
try:
|
||||
FreqtradeValidator(conf_schema).validate(conf)
|
||||
return conf
|
||||
except ValidationError as e:
|
||||
logger.critical(
|
||||
f"Invalid configuration. See config.json.example. Reason: {e}"
|
||||
)
|
||||
raise ValidationError(
|
||||
best_match(Draft4Validator(conf_schema).iter_errors(conf)).message
|
||||
)
|
||||
|
||||
|
||||
def validate_config_consistency(conf: Dict[str, Any]) -> None:
|
||||
"""
|
||||
Validate the configuration consistency.
|
||||
Should be ran after loading both configuration and strategy,
|
||||
since strategies can set certain configuration settings too.
|
||||
:param conf: Config in JSON format
|
||||
:return: Returns None if everything is ok, otherwise throw an OperationalException
|
||||
"""
|
||||
|
||||
# validating trailing stoploss
|
||||
_validate_trailing_stoploss(conf)
|
||||
_validate_edge(conf)
|
||||
_validate_whitelist(conf)
|
||||
_validate_unlimited_amount(conf)
|
||||
|
||||
# validate configuration before returning
|
||||
logger.info('Validating configuration ...')
|
||||
validate_config_schema(conf)
|
||||
|
||||
|
||||
def _validate_unlimited_amount(conf: Dict[str, Any]) -> None:
|
||||
"""
|
||||
If edge is disabled, either max_open_trades or stake_amount need to be set.
|
||||
:raise: OperationalException if config validation failed
|
||||
"""
|
||||
if (not conf.get('edge', {}).get('enabled')
|
||||
and conf.get('max_open_trades') == float('inf')
|
||||
and conf.get('stake_amount') == constants.UNLIMITED_STAKE_AMOUNT):
|
||||
raise OperationalException("`max_open_trades` and `stake_amount` cannot both be unlimited.")
|
||||
|
||||
|
||||
def _validate_trailing_stoploss(conf: Dict[str, Any]) -> None:
|
||||
|
||||
if conf.get('stoploss') == 0.0:
|
||||
raise OperationalException(
|
||||
'The config stoploss needs to be different from 0 to avoid problems with sell orders.'
|
||||
)
|
||||
# Skip if trailing stoploss is not activated
|
||||
if not conf.get('trailing_stop', False):
|
||||
return
|
||||
|
||||
tsl_positive = float(conf.get('trailing_stop_positive', 0))
|
||||
tsl_offset = float(conf.get('trailing_stop_positive_offset', 0))
|
||||
tsl_only_offset = conf.get('trailing_only_offset_is_reached', False)
|
||||
|
||||
if tsl_only_offset:
|
||||
if tsl_positive == 0.0:
|
||||
raise OperationalException(
|
||||
'The config trailing_only_offset_is_reached needs '
|
||||
'trailing_stop_positive_offset to be more than 0 in your config.')
|
||||
if tsl_positive > 0 and 0 < tsl_offset <= tsl_positive:
|
||||
raise OperationalException(
|
||||
'The config trailing_stop_positive_offset needs '
|
||||
'to be greater than trailing_stop_positive in your config.')
|
||||
|
||||
# Fetch again without default
|
||||
if 'trailing_stop_positive' in conf and float(conf['trailing_stop_positive']) == 0.0:
|
||||
raise OperationalException(
|
||||
'The config trailing_stop_positive needs to be different from 0 '
|
||||
'to avoid problems with sell orders.'
|
||||
)
|
||||
|
||||
|
||||
def _validate_edge(conf: Dict[str, Any]) -> None:
|
||||
"""
|
||||
Edge and Dynamic whitelist should not both be enabled, since edge overrides dynamic whitelists.
|
||||
"""
|
||||
|
||||
if not conf.get('edge', {}).get('enabled'):
|
||||
return
|
||||
|
||||
if conf.get('pairlist', {}).get('method') == 'VolumePairList':
|
||||
raise OperationalException(
|
||||
"Edge and VolumePairList are incompatible, "
|
||||
"Edge will override whatever pairs VolumePairlist selects."
|
||||
)
|
||||
|
||||
|
||||
def _validate_whitelist(conf: Dict[str, Any]) -> None:
|
||||
"""
|
||||
Dynamic whitelist does not require pair_whitelist to be set - however StaticWhitelist does.
|
||||
"""
|
||||
if conf.get('runmode', RunMode.OTHER) in [RunMode.OTHER, RunMode.PLOT,
|
||||
RunMode.UTIL_NO_EXCHANGE, RunMode.UTIL_EXCHANGE]:
|
||||
return
|
||||
|
||||
for pl in conf.get('pairlists', [{'method': 'StaticPairList'}]):
|
||||
if (pl.get('method') == 'StaticPairList'
|
||||
and not conf.get('exchange', {}).get('pair_whitelist')):
|
||||
raise OperationalException("StaticPairList requires pair_whitelist to be set.")
|
||||
|
||||
if pl.get('method') == 'StaticPairList':
|
||||
stake = conf['stake_currency']
|
||||
invalid_pairs = []
|
||||
for pair in conf['exchange'].get('pair_whitelist'):
|
||||
if not pair.endswith(f'/{stake}'):
|
||||
invalid_pairs.append(pair)
|
||||
|
||||
if invalid_pairs:
|
||||
raise OperationalException(
|
||||
f"Stake-currency '{stake}' not compatible with pair-whitelist. "
|
||||
f"Please remove the following pairs: {invalid_pairs}")
|
||||
412
freqtrade/configuration/configuration.py
Normal file
412
freqtrade/configuration/configuration.py
Normal file
@@ -0,0 +1,412 @@
|
||||
"""
|
||||
This module contains the configuration class
|
||||
"""
|
||||
import logging
|
||||
import warnings
|
||||
from copy import deepcopy
|
||||
from pathlib import Path
|
||||
from typing import Any, Callable, Dict, List, Optional
|
||||
|
||||
from freqtrade import constants
|
||||
from freqtrade.configuration.check_exchange import check_exchange
|
||||
from freqtrade.configuration.deprecated_settings import process_temporary_deprecated_settings
|
||||
from freqtrade.configuration.directory_operations import (create_datadir,
|
||||
create_userdata_dir)
|
||||
from freqtrade.configuration.load_config import load_config_file
|
||||
from freqtrade.exceptions import OperationalException
|
||||
from freqtrade.loggers import setup_logging
|
||||
from freqtrade.misc import deep_merge_dicts, json_load
|
||||
from freqtrade.state import NON_UTIL_MODES, TRADING_MODES, RunMode
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Configuration:
|
||||
"""
|
||||
Class to read and init the bot configuration
|
||||
Reuse this class for the bot, backtesting, hyperopt and every script that required configuration
|
||||
"""
|
||||
|
||||
def __init__(self, args: Dict[str, Any], runmode: RunMode = None) -> None:
|
||||
self.args = args
|
||||
self.config: Optional[Dict[str, Any]] = None
|
||||
self.runmode = runmode
|
||||
|
||||
def get_config(self) -> Dict[str, Any]:
|
||||
"""
|
||||
Return the config. Use this method to get the bot config
|
||||
:return: Dict: Bot config
|
||||
"""
|
||||
if self.config is None:
|
||||
self.config = self.load_config()
|
||||
|
||||
return self.config
|
||||
|
||||
@staticmethod
|
||||
def from_files(files: List[str]) -> Dict[str, Any]:
|
||||
"""
|
||||
Iterate through the config files passed in, loading all of them
|
||||
and merging their contents.
|
||||
Files are loaded in sequence, parameters in later configuration files
|
||||
override the same parameter from an earlier file (last definition wins).
|
||||
Runs through the whole Configuration initialization, so all expected config entries
|
||||
are available to interactive environments.
|
||||
:param files: List of file paths
|
||||
:return: configuration dictionary
|
||||
"""
|
||||
c = Configuration({"config": files}, RunMode.OTHER)
|
||||
return c.get_config()
|
||||
|
||||
def load_from_files(self, files: List[str]) -> Dict[str, Any]:
|
||||
|
||||
# Keep this method as staticmethod, so it can be used from interactive environments
|
||||
config: Dict[str, Any] = {}
|
||||
|
||||
if not files:
|
||||
return deepcopy(constants.MINIMAL_CONFIG)
|
||||
|
||||
# We expect here a list of config filenames
|
||||
for path in files:
|
||||
logger.info(f'Using config: {path} ...')
|
||||
|
||||
# Merge config options, overwriting old values
|
||||
config = deep_merge_dicts(load_config_file(path), config)
|
||||
|
||||
# Normalize config
|
||||
if 'internals' not in config:
|
||||
config['internals'] = {}
|
||||
# TODO: This can be deleted along with removal of deprecated
|
||||
# experimental settings
|
||||
if 'ask_strategy' not in config:
|
||||
config['ask_strategy'] = {}
|
||||
|
||||
if 'pairlists' not in config:
|
||||
config['pairlists'] = []
|
||||
|
||||
return config
|
||||
|
||||
def load_config(self) -> Dict[str, Any]:
|
||||
"""
|
||||
Extract information for sys.argv and load the bot configuration
|
||||
:return: Configuration dictionary
|
||||
"""
|
||||
# Load all configs
|
||||
config: Dict[str, Any] = self.load_from_files(self.args.get("config", []))
|
||||
|
||||
# Keep a copy of the original configuration file
|
||||
config['original_config'] = deepcopy(config)
|
||||
|
||||
self._process_runmode(config)
|
||||
|
||||
self._process_common_options(config)
|
||||
|
||||
self._process_trading_options(config)
|
||||
|
||||
self._process_optimize_options(config)
|
||||
|
||||
self._process_plot_options(config)
|
||||
|
||||
# Check if the exchange set by the user is supported
|
||||
check_exchange(config, config.get('experimental', {}).get('block_bad_exchanges', True))
|
||||
|
||||
self._resolve_pairs_list(config)
|
||||
|
||||
process_temporary_deprecated_settings(config)
|
||||
|
||||
return config
|
||||
|
||||
def _process_logging_options(self, config: Dict[str, Any]) -> None:
|
||||
"""
|
||||
Extract information for sys.argv and load logging configuration:
|
||||
the -v/--verbose, --logfile options
|
||||
"""
|
||||
# Log level
|
||||
config.update({'verbosity': self.args.get("verbosity", 0)})
|
||||
|
||||
if 'logfile' in self.args and self.args["logfile"]:
|
||||
config.update({'logfile': self.args["logfile"]})
|
||||
|
||||
setup_logging(config)
|
||||
|
||||
def _process_trading_options(self, config: Dict[str, Any]) -> None:
|
||||
if config['runmode'] not in TRADING_MODES:
|
||||
return
|
||||
|
||||
if config.get('dry_run', False):
|
||||
logger.info('Dry run is enabled')
|
||||
if config.get('db_url') in [None, constants.DEFAULT_DB_PROD_URL]:
|
||||
# Default to in-memory db for dry_run if not specified
|
||||
config['db_url'] = constants.DEFAULT_DB_DRYRUN_URL
|
||||
else:
|
||||
if not config.get('db_url', None):
|
||||
config['db_url'] = constants.DEFAULT_DB_PROD_URL
|
||||
logger.info('Dry run is disabled')
|
||||
|
||||
logger.info(f'Using DB: "{config["db_url"]}"')
|
||||
|
||||
def _process_common_options(self, config: Dict[str, Any]) -> None:
|
||||
|
||||
self._process_logging_options(config)
|
||||
|
||||
# Set strategy if not specified in config and or if it's non default
|
||||
if self.args.get("strategy") or not config.get('strategy'):
|
||||
config.update({'strategy': self.args.get("strategy")})
|
||||
|
||||
self._args_to_config(config, argname='strategy_path',
|
||||
logstring='Using additional Strategy lookup path: {}')
|
||||
|
||||
if ('db_url' in self.args and self.args["db_url"] and
|
||||
self.args["db_url"] != constants.DEFAULT_DB_PROD_URL):
|
||||
config.update({'db_url': self.args["db_url"]})
|
||||
logger.info('Parameter --db-url detected ...')
|
||||
|
||||
if config.get('forcebuy_enable', False):
|
||||
logger.warning('`forcebuy` RPC message enabled.')
|
||||
|
||||
# Support for sd_notify
|
||||
if 'sd_notify' in self.args and self.args["sd_notify"]:
|
||||
config['internals'].update({'sd_notify': True})
|
||||
|
||||
self._args_to_config(config, argname='dry_run',
|
||||
logstring='Parameter --dry-run detected, '
|
||||
'overriding dry_run to: {} ...')
|
||||
|
||||
def _process_datadir_options(self, config: Dict[str, Any]) -> None:
|
||||
"""
|
||||
Extract information for sys.argv and load directory configurations
|
||||
--user-data, --datadir
|
||||
"""
|
||||
# Check exchange parameter here - otherwise `datadir` might be wrong.
|
||||
if "exchange" in self.args and self.args["exchange"]:
|
||||
config['exchange']['name'] = self.args["exchange"]
|
||||
logger.info(f"Using exchange {config['exchange']['name']}")
|
||||
|
||||
if 'pair_whitelist' not in config['exchange']:
|
||||
config['exchange']['pair_whitelist'] = []
|
||||
|
||||
if 'user_data_dir' in self.args and self.args["user_data_dir"]:
|
||||
config.update({'user_data_dir': self.args["user_data_dir"]})
|
||||
elif 'user_data_dir' not in config:
|
||||
# Default to cwd/user_data (legacy option ...)
|
||||
config.update({'user_data_dir': str(Path.cwd() / "user_data")})
|
||||
|
||||
# reset to user_data_dir so this contains the absolute path.
|
||||
config['user_data_dir'] = create_userdata_dir(config['user_data_dir'], create_dir=False)
|
||||
logger.info('Using user-data directory: %s ...', config['user_data_dir'])
|
||||
|
||||
config.update({'datadir': create_datadir(config, self.args.get("datadir", None))})
|
||||
logger.info('Using data directory: %s ...', config.get('datadir'))
|
||||
|
||||
if self.args.get('exportfilename'):
|
||||
self._args_to_config(config, argname='exportfilename',
|
||||
logstring='Storing backtest results to {} ...')
|
||||
else:
|
||||
config['exportfilename'] = (config['user_data_dir']
|
||||
/ 'backtest_results/backtest-result.json')
|
||||
|
||||
def _process_optimize_options(self, config: Dict[str, Any]) -> None:
|
||||
|
||||
# This will override the strategy configuration
|
||||
self._args_to_config(config, argname='ticker_interval',
|
||||
logstring='Parameter -i/--ticker-interval detected ... '
|
||||
'Using ticker_interval: {} ...')
|
||||
|
||||
self._args_to_config(config, argname='position_stacking',
|
||||
logstring='Parameter --enable-position-stacking detected ...')
|
||||
|
||||
# Setting max_open_trades to infinite if -1
|
||||
if config.get('max_open_trades') == -1:
|
||||
config['max_open_trades'] = float('inf')
|
||||
|
||||
if 'use_max_market_positions' in self.args and not self.args["use_max_market_positions"]:
|
||||
config.update({'use_max_market_positions': False})
|
||||
logger.info('Parameter --disable-max-market-positions detected ...')
|
||||
logger.info('max_open_trades set to unlimited ...')
|
||||
elif 'max_open_trades' in self.args and self.args["max_open_trades"]:
|
||||
config.update({'max_open_trades': self.args["max_open_trades"]})
|
||||
logger.info('Parameter --max-open-trades detected, '
|
||||
'overriding max_open_trades to: %s ...', config.get('max_open_trades'))
|
||||
elif config['runmode'] in NON_UTIL_MODES:
|
||||
logger.info('Using max_open_trades: %s ...', config.get('max_open_trades'))
|
||||
|
||||
self._args_to_config(config, argname='stake_amount',
|
||||
logstring='Parameter --stake-amount detected, '
|
||||
'overriding stake_amount to: {} ...')
|
||||
|
||||
self._args_to_config(config, argname='fee',
|
||||
logstring='Parameter --fee detected, '
|
||||
'setting fee to: {} ...')
|
||||
|
||||
self._args_to_config(config, argname='timerange',
|
||||
logstring='Parameter --timerange detected: {} ...')
|
||||
|
||||
self._process_datadir_options(config)
|
||||
|
||||
self._args_to_config(config, argname='strategy_list',
|
||||
logstring='Using strategy list of {} strategies', logfun=len)
|
||||
|
||||
self._args_to_config(config, argname='ticker_interval',
|
||||
logstring='Overriding ticker interval with Command line argument')
|
||||
|
||||
self._args_to_config(config, argname='export',
|
||||
logstring='Parameter --export detected: {} ...')
|
||||
|
||||
# Edge section:
|
||||
if 'stoploss_range' in self.args and self.args["stoploss_range"]:
|
||||
txt_range = eval(self.args["stoploss_range"])
|
||||
config['edge'].update({'stoploss_range_min': txt_range[0]})
|
||||
config['edge'].update({'stoploss_range_max': txt_range[1]})
|
||||
config['edge'].update({'stoploss_range_step': txt_range[2]})
|
||||
logger.info('Parameter --stoplosses detected: %s ...', self.args["stoploss_range"])
|
||||
|
||||
# Hyperopt section
|
||||
self._args_to_config(config, argname='hyperopt',
|
||||
logstring='Using Hyperopt class name: {}')
|
||||
|
||||
self._args_to_config(config, argname='hyperopt_path',
|
||||
logstring='Using additional Hyperopt lookup path: {}')
|
||||
|
||||
self._args_to_config(config, argname='epochs',
|
||||
logstring='Parameter --epochs detected ... '
|
||||
'Will run Hyperopt with for {} epochs ...'
|
||||
)
|
||||
|
||||
self._args_to_config(config, argname='spaces',
|
||||
logstring='Parameter -s/--spaces detected: {}')
|
||||
|
||||
self._args_to_config(config, argname='print_all',
|
||||
logstring='Parameter --print-all detected ...')
|
||||
|
||||
if 'print_colorized' in self.args and not self.args["print_colorized"]:
|
||||
logger.info('Parameter --no-color detected ...')
|
||||
config.update({'print_colorized': False})
|
||||
else:
|
||||
config.update({'print_colorized': True})
|
||||
|
||||
self._args_to_config(config, argname='print_json',
|
||||
logstring='Parameter --print-json detected ...')
|
||||
|
||||
self._args_to_config(config, argname='hyperopt_jobs',
|
||||
logstring='Parameter -j/--job-workers detected: {}')
|
||||
|
||||
self._args_to_config(config, argname='hyperopt_random_state',
|
||||
logstring='Parameter --random-state detected: {}')
|
||||
|
||||
self._args_to_config(config, argname='hyperopt_min_trades',
|
||||
logstring='Parameter --min-trades detected: {}')
|
||||
|
||||
self._args_to_config(config, argname='hyperopt_continue',
|
||||
logstring='Hyperopt continue: {}')
|
||||
|
||||
self._args_to_config(config, argname='hyperopt_loss',
|
||||
logstring='Using Hyperopt loss class name: {}')
|
||||
|
||||
self._args_to_config(config, argname='hyperopt_show_index',
|
||||
logstring='Parameter -n/--index detected: {}')
|
||||
|
||||
self._args_to_config(config, argname='hyperopt_list_best',
|
||||
logstring='Parameter --best detected: {}')
|
||||
|
||||
self._args_to_config(config, argname='hyperopt_list_profitable',
|
||||
logstring='Parameter --profitable detected: {}')
|
||||
|
||||
self._args_to_config(config, argname='hyperopt_list_no_details',
|
||||
logstring='Parameter --no-details detected: {}')
|
||||
|
||||
self._args_to_config(config, argname='hyperopt_show_no_header',
|
||||
logstring='Parameter --no-header detected: {}')
|
||||
|
||||
def _process_plot_options(self, config: Dict[str, Any]) -> None:
|
||||
|
||||
self._args_to_config(config, argname='pairs',
|
||||
logstring='Using pairs {}')
|
||||
|
||||
self._args_to_config(config, argname='indicators1',
|
||||
logstring='Using indicators1: {}')
|
||||
|
||||
self._args_to_config(config, argname='indicators2',
|
||||
logstring='Using indicators2: {}')
|
||||
|
||||
self._args_to_config(config, argname='plot_limit',
|
||||
logstring='Limiting plot to: {}')
|
||||
self._args_to_config(config, argname='trade_source',
|
||||
logstring='Using trades from: {}')
|
||||
|
||||
self._args_to_config(config, argname='erase',
|
||||
logstring='Erase detected. Deleting existing data.')
|
||||
|
||||
self._args_to_config(config, argname='timeframes',
|
||||
logstring='timeframes --timeframes: {}')
|
||||
|
||||
self._args_to_config(config, argname='days',
|
||||
logstring='Detected --days: {}')
|
||||
self._args_to_config(config, argname='download_trades',
|
||||
logstring='Detected --dl-trades: {}')
|
||||
|
||||
def _process_runmode(self, config: Dict[str, Any]) -> None:
|
||||
|
||||
if not self.runmode:
|
||||
# Handle real mode, infer dry/live from config
|
||||
self.runmode = RunMode.DRY_RUN if config.get('dry_run', True) else RunMode.LIVE
|
||||
logger.info(f"Runmode set to {self.runmode}.")
|
||||
|
||||
config.update({'runmode': self.runmode})
|
||||
|
||||
def _args_to_config(self, config: Dict[str, Any], argname: str,
|
||||
logstring: str, logfun: Optional[Callable] = None,
|
||||
deprecated_msg: Optional[str] = None) -> None:
|
||||
"""
|
||||
:param config: Configuration dictionary
|
||||
:param argname: Argumentname in self.args - will be copied to config dict.
|
||||
:param logstring: Logging String
|
||||
:param logfun: logfun is applied to the configuration entry before passing
|
||||
that entry to the log string using .format().
|
||||
sample: logfun=len (prints the length of the found
|
||||
configuration instead of the content)
|
||||
"""
|
||||
if (argname in self.args and self.args[argname] is not None
|
||||
and self.args[argname] is not False):
|
||||
|
||||
config.update({argname: self.args[argname]})
|
||||
if logfun:
|
||||
logger.info(logstring.format(logfun(config[argname])))
|
||||
else:
|
||||
logger.info(logstring.format(config[argname]))
|
||||
if deprecated_msg:
|
||||
warnings.warn(f"DEPRECATED: {deprecated_msg}", DeprecationWarning)
|
||||
|
||||
def _resolve_pairs_list(self, config: Dict[str, Any]) -> None:
|
||||
"""
|
||||
Helper for download script.
|
||||
Takes first found:
|
||||
* -p (pairs argument)
|
||||
* --pairs-file
|
||||
* whitelist from config
|
||||
"""
|
||||
|
||||
if "pairs" in config:
|
||||
return
|
||||
|
||||
if "pairs_file" in self.args and self.args["pairs_file"]:
|
||||
pairs_file = Path(self.args["pairs_file"])
|
||||
logger.info(f'Reading pairs file "{pairs_file}".')
|
||||
# Download pairs from the pairs file if no config is specified
|
||||
# or if pairs file is specified explicitely
|
||||
if not pairs_file.exists():
|
||||
raise OperationalException(f'No pairs file found with path "{pairs_file}".')
|
||||
with pairs_file.open('r') as f:
|
||||
config['pairs'] = json_load(f)
|
||||
config['pairs'].sort()
|
||||
return
|
||||
|
||||
if "config" in self.args and self.args["config"]:
|
||||
logger.info("Using pairlist from configuration.")
|
||||
config['pairs'] = config.get('exchange', {}).get('pair_whitelist')
|
||||
else:
|
||||
# Fall back to /dl_path/pairs.json
|
||||
pairs_file = config['datadir'] / "pairs.json"
|
||||
if pairs_file.exists():
|
||||
with pairs_file.open('r') as f:
|
||||
config['pairs'] = json_load(f)
|
||||
if 'pairs' in config:
|
||||
config['pairs'].sort()
|
||||
92
freqtrade/configuration/deprecated_settings.py
Normal file
92
freqtrade/configuration/deprecated_settings.py
Normal file
@@ -0,0 +1,92 @@
|
||||
"""
|
||||
Functions to handle deprecated settings
|
||||
"""
|
||||
|
||||
import logging
|
||||
from typing import Any, Dict
|
||||
|
||||
from freqtrade.exceptions import OperationalException
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def check_conflicting_settings(config: Dict[str, Any],
|
||||
section1: str, name1: str,
|
||||
section2: str, name2: str):
|
||||
section1_config = config.get(section1, {})
|
||||
section2_config = config.get(section2, {})
|
||||
if name1 in section1_config and name2 in section2_config:
|
||||
raise OperationalException(
|
||||
f"Conflicting settings `{section1}.{name1}` and `{section2}.{name2}` "
|
||||
"(DEPRECATED) detected in the configuration file. "
|
||||
"This deprecated setting will be removed in the next versions of Freqtrade. "
|
||||
f"Please delete it from your configuration and use the `{section1}.{name1}` "
|
||||
"setting instead."
|
||||
)
|
||||
|
||||
|
||||
def process_deprecated_setting(config: Dict[str, Any],
|
||||
section1: str, name1: str,
|
||||
section2: str, name2: str):
|
||||
section2_config = config.get(section2, {})
|
||||
|
||||
if name2 in section2_config:
|
||||
logger.warning(
|
||||
"DEPRECATED: "
|
||||
f"The `{section2}.{name2}` setting is deprecated and "
|
||||
"will be removed in the next versions of Freqtrade. "
|
||||
f"Please use the `{section1}.{name1}` setting in your configuration instead."
|
||||
)
|
||||
section1_config = config.get(section1, {})
|
||||
section1_config[name1] = section2_config[name2]
|
||||
|
||||
|
||||
def process_temporary_deprecated_settings(config: Dict[str, Any]) -> None:
|
||||
|
||||
check_conflicting_settings(config, 'ask_strategy', 'use_sell_signal',
|
||||
'experimental', 'use_sell_signal')
|
||||
check_conflicting_settings(config, 'ask_strategy', 'sell_profit_only',
|
||||
'experimental', 'sell_profit_only')
|
||||
check_conflicting_settings(config, 'ask_strategy', 'ignore_roi_if_buy_signal',
|
||||
'experimental', 'ignore_roi_if_buy_signal')
|
||||
|
||||
process_deprecated_setting(config, 'ask_strategy', 'use_sell_signal',
|
||||
'experimental', 'use_sell_signal')
|
||||
process_deprecated_setting(config, 'ask_strategy', 'sell_profit_only',
|
||||
'experimental', 'sell_profit_only')
|
||||
process_deprecated_setting(config, 'ask_strategy', 'ignore_roi_if_buy_signal',
|
||||
'experimental', 'ignore_roi_if_buy_signal')
|
||||
|
||||
if not config.get('pairlists') and not config.get('pairlists'):
|
||||
config['pairlists'] = [{'method': 'StaticPairList'}]
|
||||
logger.warning(
|
||||
"DEPRECATED: "
|
||||
"Pairlists must be defined explicitly in the future."
|
||||
"Defaulting to StaticPairList for now.")
|
||||
|
||||
if config.get('pairlist', {}).get("method") == 'VolumePairList':
|
||||
logger.warning(
|
||||
"DEPRECATED: "
|
||||
f"Using VolumePairList in pairlist is deprecated and must be moved to pairlists. "
|
||||
"Please refer to the docs on configuration details")
|
||||
pl = {'method': 'VolumePairList'}
|
||||
pl.update(config.get('pairlist', {}).get('config'))
|
||||
config['pairlists'].append(pl)
|
||||
|
||||
if config.get('pairlist', {}).get('config', {}).get('precision_filter'):
|
||||
logger.warning(
|
||||
"DEPRECATED: "
|
||||
f"Using precision_filter setting is deprecated and has been replaced by"
|
||||
"PrecisionFilter. Please refer to the docs on configuration details")
|
||||
config['pairlists'].append({'method': 'PrecisionFilter'})
|
||||
|
||||
if (config.get('edge', {}).get('enabled', False)
|
||||
and 'capital_available_percentage' in config.get('edge', {})):
|
||||
logger.warning(
|
||||
"DEPRECATED: "
|
||||
"Using 'edge.capital_available_percentage' has been deprecated in favor of "
|
||||
"'tradable_balance_ratio'. Please migrate your configuration to "
|
||||
"'tradable_balance_ratio' and remove 'capital_available_percentage' "
|
||||
"from the edge configuration."
|
||||
)
|
||||
76
freqtrade/configuration/directory_operations.py
Normal file
76
freqtrade/configuration/directory_operations.py
Normal file
@@ -0,0 +1,76 @@
|
||||
import logging
|
||||
import shutil
|
||||
from pathlib import Path
|
||||
from typing import Any, Dict, Optional
|
||||
|
||||
from freqtrade.exceptions import OperationalException
|
||||
from freqtrade.constants import USER_DATA_FILES
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def create_datadir(config: Dict[str, Any], datadir: Optional[str] = None) -> Path:
|
||||
|
||||
folder = Path(datadir) if datadir else Path(f"{config['user_data_dir']}/data")
|
||||
if not datadir:
|
||||
# set datadir
|
||||
exchange_name = config.get('exchange', {}).get('name').lower()
|
||||
folder = folder.joinpath(exchange_name)
|
||||
|
||||
if not folder.is_dir():
|
||||
folder.mkdir(parents=True)
|
||||
logger.info(f'Created data directory: {datadir}')
|
||||
return folder
|
||||
|
||||
|
||||
def create_userdata_dir(directory: str, create_dir=False) -> Path:
|
||||
"""
|
||||
Create userdata directory structure.
|
||||
if create_dir is True, then the parent-directory will be created if it does not exist.
|
||||
Sub-directories will always be created if the parent directory exists.
|
||||
Raises OperationalException if given a non-existing directory.
|
||||
:param directory: Directory to check
|
||||
:param create_dir: Create directory if it does not exist.
|
||||
:return: Path object containing the directory
|
||||
"""
|
||||
sub_dirs = ["backtest_results", "data", "hyperopts", "hyperopt_results", "notebooks",
|
||||
"plot", "strategies", ]
|
||||
folder = Path(directory)
|
||||
if not folder.is_dir():
|
||||
if create_dir:
|
||||
folder.mkdir(parents=True)
|
||||
logger.info(f'Created user-data directory: {folder}')
|
||||
else:
|
||||
raise OperationalException(
|
||||
f"Directory `{folder}` does not exist. "
|
||||
"Please use `freqtrade create-userdir` to create a user directory")
|
||||
|
||||
# Create required subdirectories
|
||||
for f in sub_dirs:
|
||||
subfolder = folder / f
|
||||
if not subfolder.is_dir():
|
||||
subfolder.mkdir(parents=False)
|
||||
return folder
|
||||
|
||||
|
||||
def copy_sample_files(directory: Path, overwrite: bool = False) -> None:
|
||||
"""
|
||||
Copy files from templates to User data directory.
|
||||
:param directory: Directory to copy data to
|
||||
:param overwrite: Overwrite existing sample files
|
||||
"""
|
||||
if not directory.is_dir():
|
||||
raise OperationalException(f"Directory `{directory}` does not exist.")
|
||||
sourcedir = Path(__file__).parents[1] / "templates"
|
||||
for source, target in USER_DATA_FILES.items():
|
||||
targetdir = directory / target
|
||||
if not targetdir.is_dir():
|
||||
raise OperationalException(f"Directory `{targetdir}` does not exist.")
|
||||
targetfile = targetdir / source
|
||||
if targetfile.exists():
|
||||
if not overwrite:
|
||||
logger.warning(f"File `{targetfile}` exists already, not deploying sample file.")
|
||||
continue
|
||||
else:
|
||||
logger.warning(f"File `{targetfile}` exists already, overwriting.")
|
||||
shutil.copy(str(sourcedir / source), str(targetfile))
|
||||
33
freqtrade/configuration/load_config.py
Normal file
33
freqtrade/configuration/load_config.py
Normal file
@@ -0,0 +1,33 @@
|
||||
"""
|
||||
This module contain functions to load the configuration file
|
||||
"""
|
||||
import rapidjson
|
||||
import logging
|
||||
import sys
|
||||
from typing import Any, Dict
|
||||
|
||||
from freqtrade.exceptions import OperationalException
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
CONFIG_PARSE_MODE = rapidjson.PM_COMMENTS | rapidjson.PM_TRAILING_COMMAS
|
||||
|
||||
|
||||
def load_config_file(path: str) -> Dict[str, Any]:
|
||||
"""
|
||||
Loads a config file from the given path
|
||||
:param path: path as str
|
||||
:return: configuration as dictionary
|
||||
"""
|
||||
try:
|
||||
# Read config from stdin if requested in the options
|
||||
with open(path) if path != '-' else sys.stdin as file:
|
||||
config = rapidjson.load(file, parse_mode=CONFIG_PARSE_MODE)
|
||||
except FileNotFoundError:
|
||||
raise OperationalException(
|
||||
f'Config file "{path}" not found!'
|
||||
' Please create a config file or check whether it exists.')
|
||||
|
||||
return config
|
||||
106
freqtrade/configuration/timerange.py
Normal file
106
freqtrade/configuration/timerange.py
Normal file
@@ -0,0 +1,106 @@
|
||||
"""
|
||||
This module contains the argument manager class
|
||||
"""
|
||||
import logging
|
||||
import re
|
||||
from typing import Optional
|
||||
|
||||
import arrow
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class TimeRange:
|
||||
"""
|
||||
object defining timerange inputs.
|
||||
[start/stop]type defines if [start/stop]ts shall be used.
|
||||
if *type is None, don't use corresponding startvalue.
|
||||
"""
|
||||
|
||||
def __init__(self, starttype: Optional[str] = None, stoptype: Optional[str] = None,
|
||||
startts: int = 0, stopts: int = 0):
|
||||
|
||||
self.starttype: Optional[str] = starttype
|
||||
self.stoptype: Optional[str] = stoptype
|
||||
self.startts: int = startts
|
||||
self.stopts: int = stopts
|
||||
|
||||
def __eq__(self, other):
|
||||
"""Override the default Equals behavior"""
|
||||
return (self.starttype == other.starttype and self.stoptype == other.stoptype
|
||||
and self.startts == other.startts and self.stopts == other.stopts)
|
||||
|
||||
def subtract_start(self, seconds) -> None:
|
||||
"""
|
||||
Subtracts <seconds> from startts if startts is set.
|
||||
:param seconds: Seconds to subtract from starttime
|
||||
:return: None (Modifies the object in place)
|
||||
"""
|
||||
if self.startts:
|
||||
self.startts = self.startts - seconds
|
||||
|
||||
def adjust_start_if_necessary(self, timeframe_secs: int, startup_candles: int,
|
||||
min_date: arrow.Arrow) -> None:
|
||||
"""
|
||||
Adjust startts by <startup_candles> candles.
|
||||
Applies only if no startup-candles have been available.
|
||||
:param timeframe_secs: Ticker timeframe in seconds e.g. `timeframe_to_seconds('5m')`
|
||||
:param startup_candles: Number of candles to move start-date forward
|
||||
:param min_date: Minimum data date loaded. Key kriterium to decide if start-time
|
||||
has to be moved
|
||||
:return: None (Modifies the object in place)
|
||||
"""
|
||||
if (not self.starttype or (startup_candles
|
||||
and min_date.timestamp >= self.startts)):
|
||||
# If no startts was defined, or backtest-data starts at the defined backtest-date
|
||||
logger.warning("Moving start-date by %s candles to account for startup time.",
|
||||
startup_candles)
|
||||
self.startts = (min_date.timestamp + timeframe_secs * startup_candles)
|
||||
self.starttype = 'date'
|
||||
|
||||
@staticmethod
|
||||
def parse_timerange(text: Optional[str]):
|
||||
"""
|
||||
Parse the value of the argument --timerange to determine what is the range desired
|
||||
:param text: value from --timerange
|
||||
:return: Start and End range period
|
||||
"""
|
||||
if text is None:
|
||||
return TimeRange(None, None, 0, 0)
|
||||
syntax = [(r'^-(\d{8})$', (None, 'date')),
|
||||
(r'^(\d{8})-$', ('date', None)),
|
||||
(r'^(\d{8})-(\d{8})$', ('date', 'date')),
|
||||
(r'^-(\d{10})$', (None, 'date')),
|
||||
(r'^(\d{10})-$', ('date', None)),
|
||||
(r'^(\d{10})-(\d{10})$', ('date', 'date')),
|
||||
(r'^-(\d{13})$', (None, 'date')),
|
||||
(r'^(\d{13})-$', ('date', None)),
|
||||
(r'^(\d{13})-(\d{13})$', ('date', 'date')),
|
||||
]
|
||||
for rex, stype in syntax:
|
||||
# Apply the regular expression to text
|
||||
match = re.match(rex, text)
|
||||
if match: # Regex has matched
|
||||
rvals = match.groups()
|
||||
index = 0
|
||||
start: int = 0
|
||||
stop: int = 0
|
||||
if stype[0]:
|
||||
starts = rvals[index]
|
||||
if stype[0] == 'date' and len(starts) == 8:
|
||||
start = arrow.get(starts, 'YYYYMMDD').timestamp
|
||||
elif len(starts) == 13:
|
||||
start = int(starts) // 1000
|
||||
else:
|
||||
start = int(starts)
|
||||
index += 1
|
||||
if stype[1]:
|
||||
stops = rvals[index]
|
||||
if stype[1] == 'date' and len(stops) == 8:
|
||||
stop = arrow.get(stops, 'YYYYMMDD').timestamp
|
||||
elif len(stops) == 13:
|
||||
stop = int(stops) // 1000
|
||||
else:
|
||||
stop = int(stops)
|
||||
return TimeRange(stype[0], stype[1], start, stop)
|
||||
raise Exception('Incorrect syntax for timerange "%s"' % text)
|
||||
@@ -3,38 +3,34 @@
|
||||
"""
|
||||
bot constants
|
||||
"""
|
||||
DYNAMIC_WHITELIST = 20 # pairs
|
||||
DEFAULT_CONFIG = 'config.json'
|
||||
DEFAULT_EXCHANGE = 'bittrex'
|
||||
PROCESS_THROTTLE_SECS = 5 # sec
|
||||
TICKER_INTERVAL = 5 # min
|
||||
HYPEROPT_EPOCH = 100 # epochs
|
||||
RETRY_TIMEOUT = 30 # sec
|
||||
DEFAULT_STRATEGY = 'DefaultStrategy'
|
||||
DEFAULT_HYPEROPT = 'DefaultHyperOpts'
|
||||
DEFAULT_HYPEROPT_LOSS = 'DefaultHyperOptLoss'
|
||||
DEFAULT_DB_PROD_URL = 'sqlite:///tradesv3.sqlite'
|
||||
DEFAULT_DB_DRYRUN_URL = 'sqlite://'
|
||||
DEFAULT_DB_DRYRUN_URL = 'sqlite:///tradesv3.dryrun.sqlite'
|
||||
UNLIMITED_STAKE_AMOUNT = 'unlimited'
|
||||
DEFAULT_AMOUNT_RESERVE_PERCENT = 0.05
|
||||
REQUIRED_ORDERTIF = ['buy', 'sell']
|
||||
REQUIRED_ORDERTYPES = ['buy', 'sell', 'stoploss', 'stoploss_on_exchange']
|
||||
ORDERTYPE_POSSIBILITIES = ['limit', 'market']
|
||||
ORDERTIF_POSSIBILITIES = ['gtc', 'fok', 'ioc']
|
||||
AVAILABLE_PAIRLISTS = ['StaticPairList', 'VolumePairList']
|
||||
AVAILABLE_PAIRLISTS = ['StaticPairList', 'VolumePairList', 'PrecisionFilter', 'PriceFilter']
|
||||
DRY_RUN_WALLET = 1000
|
||||
MATH_CLOSE_PREC = 1e-14 # Precision used for float comparisons
|
||||
|
||||
TICKER_INTERVAL_MINUTES = {
|
||||
'1m': 1,
|
||||
'3m': 3,
|
||||
'5m': 5,
|
||||
'15m': 15,
|
||||
'30m': 30,
|
||||
'1h': 60,
|
||||
'2h': 120,
|
||||
'4h': 240,
|
||||
'6h': 360,
|
||||
'8h': 480,
|
||||
'12h': 720,
|
||||
'1d': 1440,
|
||||
'3d': 4320,
|
||||
'1w': 10080,
|
||||
USERPATH_HYPEROPTS = 'hyperopts'
|
||||
USERPATH_STRATEGY = 'strategies'
|
||||
|
||||
# Soure files with destination directories within user-directory
|
||||
USER_DATA_FILES = {
|
||||
'sample_strategy.py': USERPATH_STRATEGY,
|
||||
'sample_hyperopt_advanced.py': USERPATH_HYPEROPTS,
|
||||
'sample_hyperopt_loss.py': USERPATH_HYPEROPTS,
|
||||
'sample_hyperopt.py': USERPATH_HYPEROPTS,
|
||||
'strategy_analysis_example.ipynb': 'notebooks',
|
||||
}
|
||||
|
||||
SUPPORTED_FIAT = [
|
||||
@@ -45,20 +41,45 @@ SUPPORTED_FIAT = [
|
||||
"BTC", "XBT", "ETH", "XRP", "LTC", "BCH", "USDT"
|
||||
]
|
||||
|
||||
MINIMAL_CONFIG = {
|
||||
'stake_currency': '',
|
||||
'dry_run': True,
|
||||
'exchange': {
|
||||
'name': '',
|
||||
'key': '',
|
||||
'secret': '',
|
||||
'pair_whitelist': [],
|
||||
'ccxt_async_config': {
|
||||
'enableRateLimit': True,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Required json-schema for user specified config
|
||||
CONF_SCHEMA = {
|
||||
'type': 'object',
|
||||
'properties': {
|
||||
'max_open_trades': {'type': 'integer', 'minimum': -1},
|
||||
'ticker_interval': {'type': 'string', 'enum': list(TICKER_INTERVAL_MINUTES.keys())},
|
||||
'stake_currency': {'type': 'string', 'enum': ['BTC', 'XBT', 'ETH', 'USDT', 'EUR', 'USD']},
|
||||
'max_open_trades': {'type': ['integer', 'number'], 'minimum': -1},
|
||||
'ticker_interval': {'type': 'string'},
|
||||
'stake_currency': {'type': 'string'},
|
||||
'stake_amount': {
|
||||
"type": ["number", "string"],
|
||||
"minimum": 0.0005,
|
||||
"pattern": UNLIMITED_STAKE_AMOUNT
|
||||
'type': ['number', 'string'],
|
||||
'minimum': 0.0001,
|
||||
'pattern': UNLIMITED_STAKE_AMOUNT
|
||||
},
|
||||
'tradable_balance_ratio': {
|
||||
'type': 'number',
|
||||
'minimum': 0.1,
|
||||
'maximum': 1,
|
||||
'default': 0.99
|
||||
},
|
||||
'amend_last_stake_amount': {'type': 'boolean', 'default': False},
|
||||
'last_stake_amount_min_ratio': {
|
||||
'type': 'number', 'minimum': 0.0, 'maximum': 1.0, 'default': 0.5
|
||||
},
|
||||
'fiat_display_currency': {'type': 'string', 'enum': SUPPORTED_FIAT},
|
||||
'dry_run': {'type': 'boolean'},
|
||||
'dry_run_wallet': {'type': 'number', 'default': DRY_RUN_WALLET},
|
||||
'process_only_new_candles': {'type': 'boolean'},
|
||||
'minimal_roi': {
|
||||
'type': 'object',
|
||||
@@ -67,15 +88,17 @@ CONF_SCHEMA = {
|
||||
},
|
||||
'minProperties': 1
|
||||
},
|
||||
'amount_reserve_percent': {'type': 'number', 'minimum': 0.0, 'maximum': 0.5},
|
||||
'stoploss': {'type': 'number', 'maximum': 0, 'exclusiveMaximum': True},
|
||||
'trailing_stop': {'type': 'boolean'},
|
||||
'trailing_stop_positive': {'type': 'number', 'minimum': 0, 'maximum': 1},
|
||||
'trailing_stop_positive_offset': {'type': 'number', 'minimum': 0, 'maximum': 1},
|
||||
'trailing_only_offset_is_reached': {'type': 'boolean'},
|
||||
'unfilledtimeout': {
|
||||
'type': 'object',
|
||||
'properties': {
|
||||
'buy': {'type': 'number', 'minimum': 3},
|
||||
'sell': {'type': 'number', 'minimum': 10}
|
||||
'buy': {'type': 'number', 'minimum': 1},
|
||||
'sell': {'type': 'number', 'minimum': 1}
|
||||
}
|
||||
},
|
||||
'bid_strategy': {
|
||||
@@ -87,7 +110,7 @@ CONF_SCHEMA = {
|
||||
'maximum': 1,
|
||||
'exclusiveMaximum': False,
|
||||
'use_order_book': {'type': 'boolean'},
|
||||
'order_book_top': {'type': 'number', 'maximum': 20, 'minimum': 1},
|
||||
'order_book_top': {'type': 'integer', 'maximum': 20, 'minimum': 1},
|
||||
'check_depth_of_market': {
|
||||
'type': 'object',
|
||||
'properties': {
|
||||
@@ -103,8 +126,11 @@ CONF_SCHEMA = {
|
||||
'type': 'object',
|
||||
'properties': {
|
||||
'use_order_book': {'type': 'boolean'},
|
||||
'order_book_min': {'type': 'number', 'minimum': 1},
|
||||
'order_book_max': {'type': 'number', 'minimum': 1, 'maximum': 50}
|
||||
'order_book_min': {'type': 'integer', 'minimum': 1},
|
||||
'order_book_max': {'type': 'integer', 'minimum': 1, 'maximum': 50},
|
||||
'use_sell_signal': {'type': 'boolean'},
|
||||
'sell_profit_only': {'type': 'boolean'},
|
||||
'ignore_roi_if_buy_signal': {'type': 'boolean'}
|
||||
}
|
||||
},
|
||||
'order_types': {
|
||||
@@ -112,6 +138,7 @@ CONF_SCHEMA = {
|
||||
'properties': {
|
||||
'buy': {'type': 'string', 'enum': ORDERTYPE_POSSIBILITIES},
|
||||
'sell': {'type': 'string', 'enum': ORDERTYPE_POSSIBILITIES},
|
||||
'emergencysell': {'type': 'string', 'enum': ORDERTYPE_POSSIBILITIES},
|
||||
'stoploss': {'type': 'string', 'enum': ORDERTYPE_POSSIBILITIES},
|
||||
'stoploss_on_exchange': {'type': 'boolean'},
|
||||
'stoploss_on_exchange_interval': {'type': 'number'}
|
||||
@@ -133,16 +160,20 @@ CONF_SCHEMA = {
|
||||
'properties': {
|
||||
'use_sell_signal': {'type': 'boolean'},
|
||||
'sell_profit_only': {'type': 'boolean'},
|
||||
'ignore_roi_if_buy_signal_true': {'type': 'boolean'}
|
||||
'ignore_roi_if_buy_signal': {'type': 'boolean'},
|
||||
'block_bad_exchanges': {'type': 'boolean'}
|
||||
}
|
||||
},
|
||||
'pairlist': {
|
||||
'pairlists': {
|
||||
'type': 'array',
|
||||
'items': {
|
||||
'type': 'object',
|
||||
'properties': {
|
||||
'method': {'type': 'string', 'enum': AVAILABLE_PAIRLISTS},
|
||||
'config': {'type': 'object'}
|
||||
},
|
||||
'required': ['method']
|
||||
'required': ['method'],
|
||||
}
|
||||
},
|
||||
'telegram': {
|
||||
'type': 'object',
|
||||
@@ -162,14 +193,30 @@ CONF_SCHEMA = {
|
||||
'webhookstatus': {'type': 'object'},
|
||||
},
|
||||
},
|
||||
'api_server': {
|
||||
'type': 'object',
|
||||
'properties': {
|
||||
'enabled': {'type': 'boolean'},
|
||||
'listen_ip_address': {'format': 'ipv4'},
|
||||
'listen_port': {
|
||||
'type': 'integer',
|
||||
'minimum': 1024,
|
||||
'maximum': 65535
|
||||
},
|
||||
'username': {'type': 'string'},
|
||||
'password': {'type': 'string'},
|
||||
},
|
||||
'required': ['enabled', 'listen_ip_address', 'listen_port', 'username', 'password']
|
||||
},
|
||||
'db_url': {'type': 'string'},
|
||||
'initial_state': {'type': 'string', 'enum': ['running', 'stopped']},
|
||||
'forcebuy_enable': {'type': 'boolean'},
|
||||
'internals': {
|
||||
'type': 'object',
|
||||
'properties': {
|
||||
'process_throttle_secs': {'type': 'number'},
|
||||
'interval': {'type': 'integer'}
|
||||
'process_throttle_secs': {'type': 'integer'},
|
||||
'interval': {'type': 'integer'},
|
||||
'sd_notify': {'type': 'boolean'},
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -178,10 +225,10 @@ CONF_SCHEMA = {
|
||||
'type': 'object',
|
||||
'properties': {
|
||||
'name': {'type': 'string'},
|
||||
'sandbox': {'type': 'boolean'},
|
||||
'key': {'type': 'string'},
|
||||
'secret': {'type': 'string'},
|
||||
'password': {'type': 'string'},
|
||||
'sandbox': {'type': 'boolean', 'default': False},
|
||||
'key': {'type': 'string', 'default': ''},
|
||||
'secret': {'type': 'string', 'default': ''},
|
||||
'password': {'type': 'string', 'default': ''},
|
||||
'uid': {'type': 'string'},
|
||||
'pair_whitelist': {
|
||||
'type': 'array',
|
||||
@@ -200,40 +247,50 @@ CONF_SCHEMA = {
|
||||
'uniqueItems': True
|
||||
},
|
||||
'outdated_offset': {'type': 'integer', 'minimum': 1},
|
||||
'markets_refresh_interval': {'type': 'integer'},
|
||||
'ccxt_config': {'type': 'object'},
|
||||
'ccxt_async_config': {'type': 'object'}
|
||||
},
|
||||
'required': ['name', 'key', 'secret', 'pair_whitelist']
|
||||
'required': ['name']
|
||||
},
|
||||
'edge': {
|
||||
'type': 'object',
|
||||
'properties': {
|
||||
"enabled": {'type': 'boolean'},
|
||||
"process_throttle_secs": {'type': 'integer', 'minimum': 600},
|
||||
"calculate_since_number_of_days": {'type': 'integer'},
|
||||
"allowed_risk": {'type': 'number'},
|
||||
"capital_available_percentage": {'type': 'number'},
|
||||
"stoploss_range_min": {'type': 'number'},
|
||||
"stoploss_range_max": {'type': 'number'},
|
||||
"stoploss_range_step": {'type': 'number'},
|
||||
"minimum_winrate": {'type': 'number'},
|
||||
"minimum_expectancy": {'type': 'number'},
|
||||
"min_trade_number": {'type': 'number'},
|
||||
"max_trade_duration_minute": {'type': 'integer'},
|
||||
"remove_pumps": {'type': 'boolean'}
|
||||
'enabled': {'type': 'boolean'},
|
||||
'process_throttle_secs': {'type': 'integer', 'minimum': 600},
|
||||
'calculate_since_number_of_days': {'type': 'integer'},
|
||||
'allowed_risk': {'type': 'number'},
|
||||
'capital_available_percentage': {'type': 'number'},
|
||||
'stoploss_range_min': {'type': 'number'},
|
||||
'stoploss_range_max': {'type': 'number'},
|
||||
'stoploss_range_step': {'type': 'number'},
|
||||
'minimum_winrate': {'type': 'number'},
|
||||
'minimum_expectancy': {'type': 'number'},
|
||||
'min_trade_number': {'type': 'number'},
|
||||
'max_trade_duration_minute': {'type': 'integer'},
|
||||
'remove_pumps': {'type': 'boolean'}
|
||||
},
|
||||
'required': ['process_throttle_secs', 'allowed_risk', 'capital_available_percentage']
|
||||
'required': ['process_throttle_secs', 'allowed_risk']
|
||||
}
|
||||
},
|
||||
'anyOf': [
|
||||
{'required': ['exchange']}
|
||||
],
|
||||
'required': [
|
||||
}
|
||||
|
||||
SCHEMA_TRADE_REQUIRED = [
|
||||
'exchange',
|
||||
'max_open_trades',
|
||||
'stake_currency',
|
||||
'stake_amount',
|
||||
'tradable_balance_ratio',
|
||||
'last_stake_amount_min_ratio',
|
||||
'dry_run',
|
||||
'dry_run_wallet',
|
||||
'bid_strategy',
|
||||
'telegram'
|
||||
'unfilledtimeout',
|
||||
'stoploss',
|
||||
'minimal_roi',
|
||||
]
|
||||
|
||||
SCHEMA_MINIMAL_REQUIRED = [
|
||||
'exchange',
|
||||
'dry_run',
|
||||
]
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Module to handle data operations for freqtrade
|
||||
"""
|
||||
|
||||
# limit what's imported when using `from freqtrad.data import *``
|
||||
# limit what's imported when using `from freqtrade.data import *`
|
||||
__all__ = [
|
||||
'converter'
|
||||
]
|
||||
|
||||
189
freqtrade/data/btanalysis.py
Normal file
189
freqtrade/data/btanalysis.py
Normal file
@@ -0,0 +1,189 @@
|
||||
"""
|
||||
Helpers when analyzing backtest data
|
||||
"""
|
||||
import logging
|
||||
from pathlib import Path
|
||||
from typing import Dict
|
||||
|
||||
import numpy as np
|
||||
import pandas as pd
|
||||
from datetime import timezone
|
||||
|
||||
from freqtrade import persistence
|
||||
from freqtrade.misc import json_load
|
||||
from freqtrade.persistence import Trade
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
# must align with columns in backtest.py
|
||||
BT_DATA_COLUMNS = ["pair", "profitperc", "open_time", "close_time", "index", "duration",
|
||||
"open_rate", "close_rate", "open_at_end", "sell_reason"]
|
||||
|
||||
|
||||
def load_backtest_data(filename) -> pd.DataFrame:
|
||||
"""
|
||||
Load backtest data file.
|
||||
:param filename: pathlib.Path object, or string pointing to the file.
|
||||
:return: a dataframe with the analysis results
|
||||
"""
|
||||
if isinstance(filename, str):
|
||||
filename = Path(filename)
|
||||
|
||||
if not filename.is_file():
|
||||
raise ValueError(f"File {filename} does not exist.")
|
||||
|
||||
with filename.open() as file:
|
||||
data = json_load(file)
|
||||
|
||||
df = pd.DataFrame(data, columns=BT_DATA_COLUMNS)
|
||||
|
||||
df['open_time'] = pd.to_datetime(df['open_time'],
|
||||
unit='s',
|
||||
utc=True,
|
||||
infer_datetime_format=True
|
||||
)
|
||||
df['close_time'] = pd.to_datetime(df['close_time'],
|
||||
unit='s',
|
||||
utc=True,
|
||||
infer_datetime_format=True
|
||||
)
|
||||
df['profit'] = df['close_rate'] - df['open_rate']
|
||||
df = df.sort_values("open_time").reset_index(drop=True)
|
||||
return df
|
||||
|
||||
|
||||
def analyze_trade_parallelism(results: pd.DataFrame, timeframe: str) -> pd.DataFrame:
|
||||
"""
|
||||
Find overlapping trades by expanding each trade once per period it was open
|
||||
and then counting overlaps.
|
||||
:param results: Results Dataframe - can be loaded
|
||||
:param timeframe: Timeframe used for backtest
|
||||
:return: dataframe with open-counts per time-period in timeframe
|
||||
"""
|
||||
from freqtrade.exchange import timeframe_to_minutes
|
||||
timeframe_min = timeframe_to_minutes(timeframe)
|
||||
dates = [pd.Series(pd.date_range(row[1].open_time, row[1].close_time,
|
||||
freq=f"{timeframe_min}min"))
|
||||
for row in results[['open_time', 'close_time']].iterrows()]
|
||||
deltas = [len(x) for x in dates]
|
||||
dates = pd.Series(pd.concat(dates).values, name='date')
|
||||
df2 = pd.DataFrame(np.repeat(results.values, deltas, axis=0), columns=results.columns)
|
||||
|
||||
df2 = pd.concat([dates, df2], axis=1)
|
||||
df2 = df2.set_index('date')
|
||||
df_final = df2.resample(f"{timeframe_min}min")[['pair']].count()
|
||||
df_final = df_final.rename({'pair': 'open_trades'}, axis=1)
|
||||
return df_final
|
||||
|
||||
|
||||
def evaluate_result_multi(results: pd.DataFrame, timeframe: str,
|
||||
max_open_trades: int) -> pd.DataFrame:
|
||||
"""
|
||||
Find overlapping trades by expanding each trade once per period it was open
|
||||
and then counting overlaps
|
||||
:param results: Results Dataframe - can be loaded
|
||||
:param timeframe: Frequency used for the backtest
|
||||
:param max_open_trades: parameter max_open_trades used during backtest run
|
||||
:return: dataframe with open-counts per time-period in freq
|
||||
"""
|
||||
df_final = analyze_trade_parallelism(results, timeframe)
|
||||
return df_final[df_final['open_trades'] > max_open_trades]
|
||||
|
||||
|
||||
def load_trades_from_db(db_url: str) -> pd.DataFrame:
|
||||
"""
|
||||
Load trades from a DB (using dburl)
|
||||
:param db_url: Sqlite url (default format sqlite:///tradesv3.dry-run.sqlite)
|
||||
:return: Dataframe containing Trades
|
||||
"""
|
||||
trades: pd.DataFrame = pd.DataFrame([], columns=BT_DATA_COLUMNS)
|
||||
persistence.init(db_url, clean_open_orders=False)
|
||||
|
||||
columns = ["pair", "open_time", "close_time", "profit", "profitperc",
|
||||
"open_rate", "close_rate", "amount", "duration", "sell_reason",
|
||||
"fee_open", "fee_close", "open_rate_requested", "close_rate_requested",
|
||||
"stake_amount", "max_rate", "min_rate", "id", "exchange",
|
||||
"stop_loss", "initial_stop_loss", "strategy", "ticker_interval"]
|
||||
|
||||
trades = pd.DataFrame([(t.pair,
|
||||
t.open_date.replace(tzinfo=timezone.utc),
|
||||
t.close_date.replace(tzinfo=timezone.utc) if t.close_date else None,
|
||||
t.calc_profit(), t.calc_profit_ratio(),
|
||||
t.open_rate, t.close_rate, t.amount,
|
||||
(round((t.close_date.timestamp() - t.open_date.timestamp()) / 60, 2)
|
||||
if t.close_date else None),
|
||||
t.sell_reason,
|
||||
t.fee_open, t.fee_close,
|
||||
t.open_rate_requested,
|
||||
t.close_rate_requested,
|
||||
t.stake_amount,
|
||||
t.max_rate,
|
||||
t.min_rate,
|
||||
t.id, t.exchange,
|
||||
t.stop_loss, t.initial_stop_loss,
|
||||
t.strategy, t.ticker_interval
|
||||
)
|
||||
for t in Trade.get_trades().all()],
|
||||
columns=columns)
|
||||
|
||||
return trades
|
||||
|
||||
|
||||
def load_trades(source: str, db_url: str, exportfilename: str) -> pd.DataFrame:
|
||||
"""
|
||||
Based on configuration option "trade_source":
|
||||
* loads data from DB (using `db_url`)
|
||||
* loads data from backtestfile (using `exportfilename`)
|
||||
"""
|
||||
if source == "DB":
|
||||
return load_trades_from_db(db_url)
|
||||
elif source == "file":
|
||||
return load_backtest_data(Path(exportfilename))
|
||||
|
||||
|
||||
def extract_trades_of_period(dataframe: pd.DataFrame, trades: pd.DataFrame) -> pd.DataFrame:
|
||||
"""
|
||||
Compare trades and backtested pair DataFrames to get trades performed on backtested period
|
||||
:return: the DataFrame of a trades of period
|
||||
"""
|
||||
trades = trades.loc[(trades['open_time'] >= dataframe.iloc[0]['date']) &
|
||||
(trades['close_time'] <= dataframe.iloc[-1]['date'])]
|
||||
return trades
|
||||
|
||||
|
||||
def combine_tickers_with_mean(tickers: Dict[str, pd.DataFrame], column: str = "close"):
|
||||
"""
|
||||
Combine multiple dataframes "column"
|
||||
:param tickers: Dict of Dataframes, dict key should be pair.
|
||||
:param column: Column in the original dataframes to use
|
||||
:return: DataFrame with the column renamed to the dict key, and a column
|
||||
named mean, containing the mean of all pairs.
|
||||
"""
|
||||
df_comb = pd.concat([tickers[pair].set_index('date').rename(
|
||||
{column: pair}, axis=1)[pair] for pair in tickers], axis=1)
|
||||
|
||||
df_comb['mean'] = df_comb.mean(axis=1)
|
||||
|
||||
return df_comb
|
||||
|
||||
|
||||
def create_cum_profit(df: pd.DataFrame, trades: pd.DataFrame, col_name: str,
|
||||
timeframe: str) -> pd.DataFrame:
|
||||
"""
|
||||
Adds a column `col_name` with the cumulative profit for the given trades array.
|
||||
:param df: DataFrame with date index
|
||||
:param trades: DataFrame containing trades (requires columns close_time and profitperc)
|
||||
:param col_name: Column name that will be assigned the results
|
||||
:param timeframe: Timeframe used during the operations
|
||||
:return: Returns df with one additional column, col_name, containing the cumulative profit.
|
||||
"""
|
||||
from freqtrade.exchange import timeframe_to_minutes
|
||||
timeframe_minutes = timeframe_to_minutes(timeframe)
|
||||
# Resample to timeframe to make sure trades match candles
|
||||
_trades_sum = trades.resample(f'{timeframe_minutes}min', on='close_time')[['profitperc']].sum()
|
||||
df.loc[:, col_name] = _trades_sum.cumsum()
|
||||
# Set first value to 0
|
||||
df.loc[df.iloc[0].name, col_name] = 0
|
||||
# FFill to get continuous
|
||||
df[col_name] = df[col_name].ffill()
|
||||
return df
|
||||
@@ -2,22 +2,25 @@
|
||||
Functions to convert data from one format to another
|
||||
"""
|
||||
import logging
|
||||
|
||||
import pandas as pd
|
||||
from pandas import DataFrame, to_datetime
|
||||
|
||||
from freqtrade.constants import TICKER_INTERVAL_MINUTES
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def parse_ticker_dataframe(ticker: list, ticker_interval: str,
|
||||
fill_missing: bool = True) -> DataFrame:
|
||||
def parse_ticker_dataframe(ticker: list, timeframe: str, pair: str, *,
|
||||
fill_missing: bool = True,
|
||||
drop_incomplete: bool = True) -> DataFrame:
|
||||
"""
|
||||
Converts a ticker-list (format ccxt.fetch_ohlcv) to a Dataframe
|
||||
:param ticker: ticker list, as returned by exchange.async_get_candle_history
|
||||
:param ticker_interval: ticker_interval (e.g. 5m). Used to fill up eventual missing data
|
||||
:param timeframe: timeframe (e.g. 5m). Used to fill up eventual missing data
|
||||
:param pair: Pair this data is for (used to warn if fillup was necessary)
|
||||
:param fill_missing: fill up missing candles with 0 candles
|
||||
(see ohlcv_fill_up_missing_data for details)
|
||||
:param drop_incomplete: Drop the last candle of the dataframe, assuming it's incomplete
|
||||
:return: DataFrame
|
||||
"""
|
||||
logger.debug("Parsing tickerlist to dataframe")
|
||||
@@ -43,21 +46,25 @@ def parse_ticker_dataframe(ticker: list, ticker_interval: str,
|
||||
'close': 'last',
|
||||
'volume': 'max',
|
||||
})
|
||||
frame.drop(frame.tail(1).index, inplace=True) # eliminate partial candle
|
||||
# eliminate partial candle
|
||||
if drop_incomplete:
|
||||
frame.drop(frame.tail(1).index, inplace=True)
|
||||
logger.debug('Dropping last candle')
|
||||
|
||||
if fill_missing:
|
||||
return ohlcv_fill_up_missing_data(frame, ticker_interval)
|
||||
return ohlcv_fill_up_missing_data(frame, timeframe, pair)
|
||||
else:
|
||||
return frame
|
||||
|
||||
|
||||
def ohlcv_fill_up_missing_data(dataframe: DataFrame, ticker_interval: str) -> DataFrame:
|
||||
def ohlcv_fill_up_missing_data(dataframe: DataFrame, timeframe: str, pair: str) -> DataFrame:
|
||||
"""
|
||||
Fills up missing data with 0 volume rows,
|
||||
using the previous close as price for "open", "high" "low" and "close", volume is set to 0
|
||||
|
||||
"""
|
||||
from freqtrade.exchange import timeframe_to_minutes
|
||||
|
||||
ohlc_dict = {
|
||||
'open': 'first',
|
||||
'high': 'max',
|
||||
@@ -65,9 +72,9 @@ def ohlcv_fill_up_missing_data(dataframe: DataFrame, ticker_interval: str) -> Da
|
||||
'close': 'last',
|
||||
'volume': 'sum'
|
||||
}
|
||||
tick_mins = TICKER_INTERVAL_MINUTES[ticker_interval]
|
||||
ticker_minutes = timeframe_to_minutes(timeframe)
|
||||
# Resample to create "NAN" values
|
||||
df = dataframe.resample(f'{tick_mins}min', on='date').agg(ohlc_dict)
|
||||
df = dataframe.resample(f'{ticker_minutes}min', on='date').agg(ohlc_dict)
|
||||
|
||||
# Forwardfill close for missing columns
|
||||
df['close'] = df['close'].fillna(method='ffill')
|
||||
@@ -78,7 +85,10 @@ def ohlcv_fill_up_missing_data(dataframe: DataFrame, ticker_interval: str) -> Da
|
||||
'low': df['close'],
|
||||
})
|
||||
df.reset_index(inplace=True)
|
||||
logger.debug(f"Missing data fillup: before: {len(dataframe)} - after: {len(df)}")
|
||||
len_before = len(dataframe)
|
||||
len_after = len(df)
|
||||
if len_before != len_after:
|
||||
logger.info(f"Missing data fillup for {pair}: before: {len_before} - after: {len_after}")
|
||||
return df
|
||||
|
||||
|
||||
@@ -104,3 +114,25 @@ def order_book_to_dataframe(bids: list, asks: list) -> DataFrame:
|
||||
keys=['b_sum', 'b_size', 'bids', 'asks', 'a_size', 'a_sum'])
|
||||
# logger.info('order book %s', frame )
|
||||
return frame
|
||||
|
||||
|
||||
def trades_to_ohlcv(trades: list, timeframe: str) -> list:
|
||||
"""
|
||||
Converts trades list to ohlcv list
|
||||
:param trades: List of trades, as returned by ccxt.fetch_trades.
|
||||
:param timeframe: Ticker timeframe to resample data to
|
||||
:return: ohlcv timeframe as list (as returned by ccxt.fetch_ohlcv)
|
||||
"""
|
||||
from freqtrade.exchange import timeframe_to_minutes
|
||||
ticker_minutes = timeframe_to_minutes(timeframe)
|
||||
df = pd.DataFrame(trades)
|
||||
df['datetime'] = pd.to_datetime(df['datetime'])
|
||||
df = df.set_index('datetime')
|
||||
|
||||
df_new = df['price'].resample(f'{ticker_minutes}min').ohlc()
|
||||
df_new['volume'] = df['amount'].resample(f'{ticker_minutes}min').sum()
|
||||
df_new['date'] = df_new.index.astype("int64") // 10 ** 6
|
||||
# Drop 0 volume rows
|
||||
df_new = df_new.dropna()
|
||||
columns = ["date", "open", "high", "low", "close", "volume"]
|
||||
return list(zip(*[df_new[x].values.tolist() for x in columns]))
|
||||
|
||||
@@ -5,8 +5,7 @@ including Klines, tickers, historic data
|
||||
Common Interface for bot and strategy to access data.
|
||||
"""
|
||||
import logging
|
||||
from pathlib import Path
|
||||
from typing import List, Tuple
|
||||
from typing import Any, Dict, List, Optional, Tuple
|
||||
|
||||
from pandas import DataFrame
|
||||
|
||||
@@ -17,7 +16,7 @@ from freqtrade.state import RunMode
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class DataProvider(object):
|
||||
class DataProvider:
|
||||
|
||||
def __init__(self, config: dict, exchange: Exchange) -> None:
|
||||
self._config = config
|
||||
@@ -37,43 +36,63 @@ class DataProvider(object):
|
||||
@property
|
||||
def available_pairs(self) -> List[Tuple[str, str]]:
|
||||
"""
|
||||
Return a list of tuples containing pair, tick_interval for which data is currently cached.
|
||||
Return a list of tuples containing (pair, timeframe) for which data is currently cached.
|
||||
Should be whitelist + open trades.
|
||||
"""
|
||||
return list(self._exchange._klines.keys())
|
||||
|
||||
def ohlcv(self, pair: str, tick_interval: str = None, copy: bool = True) -> DataFrame:
|
||||
def ohlcv(self, pair: str, timeframe: str = None, copy: bool = True) -> DataFrame:
|
||||
"""
|
||||
get ohlcv data for the given pair as DataFrame
|
||||
Please check `available_pairs` to verify which pairs are currently cached.
|
||||
Get ohlcv data for the given pair as DataFrame
|
||||
Please use the `available_pairs` method to verify which pairs are currently cached.
|
||||
:param pair: pair to get the data for
|
||||
:param tick_interval: ticker_interval to get pair for
|
||||
:param copy: copy dataframe before returning.
|
||||
Use false only for RO operations (where the dataframe is not modified)
|
||||
:param timeframe: Ticker timeframe to get data for
|
||||
:param copy: copy dataframe before returning if True.
|
||||
Use False only for read-only operations (where the dataframe is not modified)
|
||||
"""
|
||||
if self.runmode in (RunMode.DRY_RUN, RunMode.LIVE):
|
||||
if tick_interval:
|
||||
pairtick = (pair, tick_interval)
|
||||
else:
|
||||
pairtick = (pair, self._config['ticker_interval'])
|
||||
|
||||
return self._exchange.klines(pairtick, copy=copy)
|
||||
return self._exchange.klines((pair, timeframe or self._config['ticker_interval']),
|
||||
copy=copy)
|
||||
else:
|
||||
return DataFrame()
|
||||
|
||||
def historic_ohlcv(self, pair: str, ticker_interval: str) -> DataFrame:
|
||||
def historic_ohlcv(self, pair: str, timeframe: str = None) -> DataFrame:
|
||||
"""
|
||||
get stored historic ohlcv data
|
||||
Get stored historic ohlcv data
|
||||
:param pair: pair to get the data for
|
||||
:param tick_interval: ticker_interval to get pair for
|
||||
:param timeframe: timeframe to get data for
|
||||
"""
|
||||
return load_pair_history(pair=pair,
|
||||
ticker_interval=ticker_interval,
|
||||
refresh_pairs=False,
|
||||
datadir=Path(self._config['datadir']) if self._config.get(
|
||||
'datadir') else None
|
||||
timeframe=timeframe or self._config['ticker_interval'],
|
||||
datadir=self._config['datadir']
|
||||
)
|
||||
|
||||
def get_pair_dataframe(self, pair: str, timeframe: str = None) -> DataFrame:
|
||||
"""
|
||||
Return pair ohlcv data, either live or cached historical -- depending
|
||||
on the runmode.
|
||||
:param pair: pair to get the data for
|
||||
:param timeframe: timeframe to get data for
|
||||
:return: Dataframe for this pair
|
||||
"""
|
||||
if self.runmode in (RunMode.DRY_RUN, RunMode.LIVE):
|
||||
# Get live ohlcv data.
|
||||
data = self.ohlcv(pair=pair, timeframe=timeframe)
|
||||
else:
|
||||
# Get historic ohlcv data (cached on disk).
|
||||
data = self.historic_ohlcv(pair=pair, timeframe=timeframe)
|
||||
if len(data) == 0:
|
||||
logger.warning(f"No data found for ({pair}, {timeframe}).")
|
||||
return data
|
||||
|
||||
def market(self, pair: str) -> Optional[Dict[str, Any]]:
|
||||
"""
|
||||
Return market data for the pair
|
||||
:param pair: Pair to get the data for
|
||||
:return: Market data dict from ccxt or None if market info is not available for the pair
|
||||
"""
|
||||
return self._exchange.markets.get(pair)
|
||||
|
||||
def ticker(self, pair: str):
|
||||
"""
|
||||
Return last ticker data
|
||||
@@ -81,12 +100,14 @@ class DataProvider(object):
|
||||
# TODO: Implement me
|
||||
pass
|
||||
|
||||
def orderbook(self, pair: str, max: int):
|
||||
def orderbook(self, pair: str, maximum: int) -> Dict[str, List]:
|
||||
"""
|
||||
return latest orderbook data
|
||||
fetch latest orderbook data
|
||||
:param pair: pair to get the data for
|
||||
:param maximum: Maximum number of orderbook entries to query
|
||||
:return: dict including bids/asks with a total of `maximum` entries.
|
||||
"""
|
||||
# TODO: Implement me
|
||||
pass
|
||||
return self._exchange.get_order_book(pair, maximum)
|
||||
|
||||
@property
|
||||
def runmode(self) -> RunMode:
|
||||
|
||||
@@ -1,21 +1,27 @@
|
||||
"""
|
||||
Handle historic data (ohlcv).
|
||||
includes:
|
||||
|
||||
Includes:
|
||||
* load data for a pair (or a list of pairs) from disk
|
||||
* download data from exchange and store to disk
|
||||
"""
|
||||
|
||||
import logging
|
||||
import operator
|
||||
from copy import deepcopy
|
||||
from datetime import datetime, timezone
|
||||
from pathlib import Path
|
||||
from typing import Optional, List, Dict, Tuple, Any
|
||||
from typing import Any, Dict, List, Optional, Tuple
|
||||
|
||||
import arrow
|
||||
from pandas import DataFrame
|
||||
|
||||
from freqtrade import misc, constants, OperationalException
|
||||
from freqtrade.data.converter import parse_ticker_dataframe
|
||||
from freqtrade.exchange import Exchange
|
||||
from freqtrade.arguments import TimeRange
|
||||
from freqtrade import misc
|
||||
from freqtrade.configuration import TimeRange
|
||||
from freqtrade.data.converter import parse_ticker_dataframe, trades_to_ohlcv
|
||||
from freqtrade.exceptions import OperationalException
|
||||
from freqtrade.exchange import (Exchange, timeframe_to_minutes,
|
||||
timeframe_to_seconds)
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -30,20 +36,12 @@ def trim_tickerlist(tickerlist: List[Dict], timerange: TimeRange) -> List[Dict]:
|
||||
start_index = 0
|
||||
stop_index = len(tickerlist)
|
||||
|
||||
if timerange.starttype == 'line':
|
||||
stop_index = timerange.startts
|
||||
if timerange.starttype == 'index':
|
||||
start_index = timerange.startts
|
||||
elif timerange.starttype == 'date':
|
||||
if timerange.starttype == 'date':
|
||||
while (start_index < len(tickerlist) and
|
||||
tickerlist[start_index][0] < timerange.startts * 1000):
|
||||
start_index += 1
|
||||
|
||||
if timerange.stoptype == 'line':
|
||||
start_index = len(tickerlist) + timerange.stopts
|
||||
if timerange.stoptype == 'index':
|
||||
stop_index = timerange.stopts
|
||||
elif timerange.stoptype == 'date':
|
||||
if timerange.stoptype == 'date':
|
||||
while (stop_index > 0 and
|
||||
tickerlist[stop_index-1][0] > timerange.stopts * 1000):
|
||||
stop_index -= 1
|
||||
@@ -54,106 +52,199 @@ def trim_tickerlist(tickerlist: List[Dict], timerange: TimeRange) -> List[Dict]:
|
||||
return tickerlist[start_index:stop_index]
|
||||
|
||||
|
||||
def load_tickerdata_file(
|
||||
datadir: Optional[Path], pair: str,
|
||||
ticker_interval: str,
|
||||
timerange: Optional[TimeRange] = None) -> Optional[list]:
|
||||
def trim_dataframe(df: DataFrame, timerange: TimeRange, df_date_col: str = 'date') -> DataFrame:
|
||||
"""
|
||||
Trim dataframe based on given timerange
|
||||
:param df: Dataframe to trim
|
||||
:param timerange: timerange (use start and end date if available)
|
||||
:param: df_date_col: Column in the dataframe to use as Date column
|
||||
:return: trimmed dataframe
|
||||
"""
|
||||
if timerange.starttype == 'date':
|
||||
start = datetime.fromtimestamp(timerange.startts, tz=timezone.utc)
|
||||
df = df.loc[df[df_date_col] >= start, :]
|
||||
if timerange.stoptype == 'date':
|
||||
stop = datetime.fromtimestamp(timerange.stopts, tz=timezone.utc)
|
||||
df = df.loc[df[df_date_col] <= stop, :]
|
||||
return df
|
||||
|
||||
|
||||
def load_tickerdata_file(datadir: Path, pair: str, timeframe: str,
|
||||
timerange: Optional[TimeRange] = None) -> List[Dict]:
|
||||
"""
|
||||
Load a pair from file, either .json.gz or .json
|
||||
:return tickerlist or None if unsuccesful
|
||||
:return: tickerlist or None if unsuccessful
|
||||
"""
|
||||
path = make_testdata_path(datadir)
|
||||
pair_s = pair.replace('/', '_')
|
||||
file = path.joinpath(f'{pair_s}-{ticker_interval}.json')
|
||||
|
||||
pairdata = misc.file_load_json(file)
|
||||
|
||||
filename = pair_data_filename(datadir, pair, timeframe)
|
||||
pairdata = misc.file_load_json(filename)
|
||||
if not pairdata:
|
||||
return None
|
||||
return []
|
||||
|
||||
if timerange:
|
||||
pairdata = trim_tickerlist(pairdata, timerange)
|
||||
return pairdata
|
||||
|
||||
|
||||
def load_pair_history(pair: str,
|
||||
ticker_interval: str,
|
||||
datadir: Optional[Path],
|
||||
timerange: TimeRange = TimeRange(None, None, 0, 0),
|
||||
refresh_pairs: bool = False,
|
||||
exchange: Optional[Exchange] = None,
|
||||
fill_up_missing: bool = True
|
||||
) -> DataFrame:
|
||||
def store_tickerdata_file(datadir: Path, pair: str,
|
||||
timeframe: str, data: list, is_zip: bool = False):
|
||||
"""
|
||||
Loads cached ticker history for the given pair.
|
||||
:return: DataFrame with ohlcv data
|
||||
Stores tickerdata to file
|
||||
"""
|
||||
filename = pair_data_filename(datadir, pair, timeframe)
|
||||
misc.file_dump_json(filename, data, is_zip=is_zip)
|
||||
|
||||
# If the user force the refresh of pairs
|
||||
if refresh_pairs:
|
||||
if not exchange:
|
||||
raise OperationalException("Exchange needs to be initialized when "
|
||||
"calling load_data with refresh_pairs=True")
|
||||
|
||||
logger.info('Download data for pair and store them in %s', datadir)
|
||||
download_pair_history(datadir=datadir,
|
||||
exchange=exchange,
|
||||
pair=pair,
|
||||
tick_interval=ticker_interval,
|
||||
timerange=timerange)
|
||||
def load_trades_file(datadir: Path, pair: str,
|
||||
timerange: Optional[TimeRange] = None) -> List[Dict]:
|
||||
"""
|
||||
Load a pair from file, either .json.gz or .json
|
||||
:return: tradelist or empty list if unsuccesful
|
||||
"""
|
||||
filename = pair_trades_filename(datadir, pair)
|
||||
tradesdata = misc.file_load_json(filename)
|
||||
if not tradesdata:
|
||||
return []
|
||||
|
||||
pairdata = load_tickerdata_file(datadir, pair, ticker_interval, timerange=timerange)
|
||||
return tradesdata
|
||||
|
||||
if pairdata:
|
||||
|
||||
def store_trades_file(datadir: Path, pair: str,
|
||||
data: list, is_zip: bool = True):
|
||||
"""
|
||||
Stores tickerdata to file
|
||||
"""
|
||||
filename = pair_trades_filename(datadir, pair)
|
||||
misc.file_dump_json(filename, data, is_zip=is_zip)
|
||||
|
||||
|
||||
def _validate_pairdata(pair, pairdata, timerange: TimeRange):
|
||||
if timerange.starttype == 'date' and pairdata[0][0] > timerange.startts * 1000:
|
||||
logger.warning('Missing data at start for pair %s, data starts at %s',
|
||||
pair, arrow.get(pairdata[0][0] // 1000).strftime('%Y-%m-%d %H:%M:%S'))
|
||||
if timerange.stoptype == 'date' and pairdata[-1][0] < timerange.stopts * 1000:
|
||||
logger.warning('Missing data at end for pair %s, data ends at %s',
|
||||
pair,
|
||||
arrow.get(pairdata[-1][0] // 1000).strftime('%Y-%m-%d %H:%M:%S'))
|
||||
return parse_ticker_dataframe(pairdata, ticker_interval, fill_up_missing)
|
||||
pair, arrow.get(pairdata[-1][0] // 1000).strftime('%Y-%m-%d %H:%M:%S'))
|
||||
|
||||
|
||||
def load_pair_history(pair: str,
|
||||
timeframe: str,
|
||||
datadir: Path,
|
||||
timerange: Optional[TimeRange] = None,
|
||||
fill_up_missing: bool = True,
|
||||
drop_incomplete: bool = True,
|
||||
startup_candles: int = 0,
|
||||
) -> DataFrame:
|
||||
"""
|
||||
Load cached ticker history for the given pair.
|
||||
|
||||
:param pair: Pair to load data for
|
||||
:param timeframe: Ticker timeframe (e.g. "5m")
|
||||
:param datadir: Path to the data storage location.
|
||||
:param timerange: Limit data to be loaded to this timerange
|
||||
:param fill_up_missing: Fill missing values with "No action"-candles
|
||||
:param drop_incomplete: Drop last candle assuming it may be incomplete.
|
||||
:param startup_candles: Additional candles to load at the start of the period
|
||||
:return: DataFrame with ohlcv data, or empty DataFrame
|
||||
"""
|
||||
timerange_startup = deepcopy(timerange)
|
||||
if startup_candles > 0 and timerange_startup:
|
||||
timerange_startup.subtract_start(timeframe_to_seconds(timeframe) * startup_candles)
|
||||
|
||||
pairdata = load_tickerdata_file(datadir, pair, timeframe, timerange=timerange_startup)
|
||||
|
||||
if pairdata:
|
||||
if timerange_startup:
|
||||
_validate_pairdata(pair, pairdata, timerange_startup)
|
||||
return parse_ticker_dataframe(pairdata, timeframe, pair=pair,
|
||||
fill_missing=fill_up_missing,
|
||||
drop_incomplete=drop_incomplete)
|
||||
else:
|
||||
logger.warning('No data for pair: "%s", Interval: %s. '
|
||||
'Use --refresh-pairs-cached to download the data',
|
||||
pair, ticker_interval)
|
||||
return None
|
||||
logger.warning(
|
||||
f'No history data for pair: "{pair}", timeframe: {timeframe}. '
|
||||
'Use `freqtrade download-data` to download the data'
|
||||
)
|
||||
return DataFrame()
|
||||
|
||||
|
||||
def load_data(datadir: Optional[Path],
|
||||
ticker_interval: str,
|
||||
def load_data(datadir: Path,
|
||||
timeframe: str,
|
||||
pairs: List[str],
|
||||
refresh_pairs: bool = False,
|
||||
exchange: Optional[Exchange] = None,
|
||||
timerange: TimeRange = TimeRange(None, None, 0, 0),
|
||||
fill_up_missing: bool = True) -> Dict[str, DataFrame]:
|
||||
timerange: Optional[TimeRange] = None,
|
||||
fill_up_missing: bool = True,
|
||||
startup_candles: int = 0,
|
||||
fail_without_data: bool = False
|
||||
) -> Dict[str, DataFrame]:
|
||||
"""
|
||||
Loads ticker history data for a list of pairs the given parameters
|
||||
:return: dict(<pair>:<tickerlist>)
|
||||
Load ticker history data for a list of pairs.
|
||||
|
||||
:param datadir: Path to the data storage location.
|
||||
:param timeframe: Ticker Timeframe (e.g. "5m")
|
||||
:param pairs: List of pairs to load
|
||||
:param timerange: Limit data to be loaded to this timerange
|
||||
:param fill_up_missing: Fill missing values with "No action"-candles
|
||||
:param startup_candles: Additional candles to load at the start of the period
|
||||
:param fail_without_data: Raise OperationalException if no data is found.
|
||||
:return: dict(<pair>:<Dataframe>)
|
||||
"""
|
||||
result = {}
|
||||
result: Dict[str, DataFrame] = {}
|
||||
if startup_candles > 0 and timerange:
|
||||
logger.info(f'Using indicator startup period: {startup_candles} ...')
|
||||
|
||||
for pair in pairs:
|
||||
hist = load_pair_history(pair=pair, ticker_interval=ticker_interval,
|
||||
hist = load_pair_history(pair=pair, timeframe=timeframe,
|
||||
datadir=datadir, timerange=timerange,
|
||||
refresh_pairs=refresh_pairs,
|
||||
exchange=exchange,
|
||||
fill_up_missing=fill_up_missing)
|
||||
if hist is not None:
|
||||
fill_up_missing=fill_up_missing,
|
||||
startup_candles=startup_candles)
|
||||
if not hist.empty:
|
||||
result[pair] = hist
|
||||
|
||||
if fail_without_data and not result:
|
||||
raise OperationalException("No data found. Terminating.")
|
||||
return result
|
||||
|
||||
|
||||
def make_testdata_path(datadir: Optional[Path]) -> Path:
|
||||
"""Return the path where testdata files are stored"""
|
||||
return datadir or (Path(__file__).parent.parent / "tests" / "testdata").resolve()
|
||||
def refresh_data(datadir: Path,
|
||||
timeframe: str,
|
||||
pairs: List[str],
|
||||
exchange: Exchange,
|
||||
timerange: Optional[TimeRange] = None,
|
||||
) -> None:
|
||||
"""
|
||||
Refresh ticker history data for a list of pairs.
|
||||
|
||||
:param datadir: Path to the data storage location.
|
||||
:param timeframe: Ticker Timeframe (e.g. "5m")
|
||||
:param pairs: List of pairs to load
|
||||
:param exchange: Exchange object
|
||||
:param timerange: Limit data to be loaded to this timerange
|
||||
"""
|
||||
for pair in pairs:
|
||||
_download_pair_history(pair=pair, timeframe=timeframe,
|
||||
datadir=datadir, timerange=timerange,
|
||||
exchange=exchange)
|
||||
|
||||
|
||||
def load_cached_data_for_updating(filename: Path, tick_interval: str,
|
||||
def pair_data_filename(datadir: Path, pair: str, timeframe: str) -> Path:
|
||||
pair_s = pair.replace("/", "_")
|
||||
filename = datadir.joinpath(f'{pair_s}-{timeframe}.json')
|
||||
return filename
|
||||
|
||||
|
||||
def pair_trades_filename(datadir: Path, pair: str) -> Path:
|
||||
pair_s = pair.replace("/", "_")
|
||||
filename = datadir.joinpath(f'{pair_s}-trades.json.gz')
|
||||
return filename
|
||||
|
||||
|
||||
def _load_cached_data_for_updating(datadir: Path, pair: str, timeframe: str,
|
||||
timerange: Optional[TimeRange]) -> Tuple[List[Any],
|
||||
Optional[int]]:
|
||||
"""
|
||||
Load cached data and choose what part of the data should be updated
|
||||
Load cached data to download more data.
|
||||
If timerange is passed in, checks whether data from an before the stored data will be
|
||||
downloaded.
|
||||
If that's the case then what's available should be completely overwritten.
|
||||
Only used by download_pair_history().
|
||||
"""
|
||||
|
||||
since_ms = None
|
||||
@@ -163,13 +254,12 @@ def load_cached_data_for_updating(filename: Path, tick_interval: str,
|
||||
if timerange.starttype == 'date':
|
||||
since_ms = timerange.startts * 1000
|
||||
elif timerange.stoptype == 'line':
|
||||
num_minutes = timerange.stopts * constants.TICKER_INTERVAL_MINUTES[tick_interval]
|
||||
num_minutes = timerange.stopts * timeframe_to_minutes(timeframe)
|
||||
since_ms = arrow.utcnow().shift(minutes=num_minutes).timestamp * 1000
|
||||
|
||||
# read the cached file
|
||||
if filename.is_file():
|
||||
with open(filename, "rt") as file:
|
||||
data = misc.json_load(file)
|
||||
# Intentionally don't pass timerange in - since we need to load the full dataset.
|
||||
data = load_tickerdata_file(datadir, pair, timeframe)
|
||||
# remove the last item, could be incomplete candle
|
||||
if data:
|
||||
data.pop()
|
||||
@@ -187,49 +277,205 @@ def load_cached_data_for_updating(filename: Path, tick_interval: str,
|
||||
return (data, since_ms)
|
||||
|
||||
|
||||
def download_pair_history(datadir: Optional[Path],
|
||||
def _download_pair_history(datadir: Path,
|
||||
exchange: Exchange,
|
||||
pair: str,
|
||||
tick_interval: str = '5m',
|
||||
timeframe: str = '5m',
|
||||
timerange: Optional[TimeRange] = None) -> bool:
|
||||
"""
|
||||
Download the latest ticker intervals from the exchange for the pair passed in parameters
|
||||
The data is downloaded starting from the last correct ticker interval data that
|
||||
Download latest candles from the exchange for the pair and timeframe passed in parameters
|
||||
The data is downloaded starting from the last correct data that
|
||||
exists in a cache. If timerange starts earlier than the data in the cache,
|
||||
the full data will be redownloaded
|
||||
|
||||
Based on @Rybolov work: https://github.com/rybolov/freqtrade-data
|
||||
|
||||
:param pair: pair to download
|
||||
:param tick_interval: ticker interval
|
||||
:param timeframe: Ticker Timeframe (e.g 5m)
|
||||
:param timerange: range of time to download
|
||||
:return: bool with success state
|
||||
|
||||
"""
|
||||
try:
|
||||
path = make_testdata_path(datadir)
|
||||
filepair = pair.replace("/", "_")
|
||||
filename = path.joinpath(f'{filepair}-{tick_interval}.json')
|
||||
logger.info(
|
||||
f'Download history data for pair: "{pair}", timeframe: {timeframe} '
|
||||
f'and store in {datadir}.'
|
||||
)
|
||||
|
||||
logger.info('Download the pair: "%s", Interval: %s', pair, tick_interval)
|
||||
|
||||
data, since_ms = load_cached_data_for_updating(filename, tick_interval, timerange)
|
||||
data, since_ms = _load_cached_data_for_updating(datadir, pair, timeframe, timerange)
|
||||
|
||||
logger.debug("Current Start: %s", misc.format_ms_time(data[1][0]) if data else 'None')
|
||||
logger.debug("Current End: %s", misc.format_ms_time(data[-1][0]) if data else 'None')
|
||||
|
||||
# Default since_ms to 30 days if nothing is given
|
||||
new_data = exchange.get_history(pair=pair, tick_interval=tick_interval,
|
||||
since_ms=since_ms if since_ms
|
||||
else
|
||||
int(arrow.utcnow().shift(days=-30).float_timestamp) * 1000)
|
||||
new_data = exchange.get_historic_ohlcv(pair=pair,
|
||||
timeframe=timeframe,
|
||||
since_ms=since_ms if since_ms else
|
||||
int(arrow.utcnow().shift(
|
||||
days=-30).float_timestamp) * 1000
|
||||
)
|
||||
data.extend(new_data)
|
||||
|
||||
logger.debug("New Start: %s", misc.format_ms_time(data[0][0]))
|
||||
logger.debug("New End: %s", misc.format_ms_time(data[-1][0]))
|
||||
|
||||
misc.file_dump_json(filename, data)
|
||||
store_tickerdata_file(datadir, pair, timeframe, data=data)
|
||||
return True
|
||||
except BaseException:
|
||||
logger.info('Failed to download the pair: "%s", Interval: %s',
|
||||
pair, tick_interval)
|
||||
|
||||
except Exception as e:
|
||||
logger.error(
|
||||
f'Failed to download history data for pair: "{pair}", timeframe: {timeframe}. '
|
||||
f'Error: {e}'
|
||||
)
|
||||
return False
|
||||
|
||||
|
||||
def refresh_backtest_ohlcv_data(exchange: Exchange, pairs: List[str], timeframes: List[str],
|
||||
datadir: Path, timerange: Optional[TimeRange] = None,
|
||||
erase=False) -> List[str]:
|
||||
"""
|
||||
Refresh stored ohlcv data for backtesting and hyperopt operations.
|
||||
Used by freqtrade download-data subcommand.
|
||||
:return: List of pairs that are not available.
|
||||
"""
|
||||
pairs_not_available = []
|
||||
for pair in pairs:
|
||||
if pair not in exchange.markets:
|
||||
pairs_not_available.append(pair)
|
||||
logger.info(f"Skipping pair {pair}...")
|
||||
continue
|
||||
for timeframe in timeframes:
|
||||
|
||||
dl_file = pair_data_filename(datadir, pair, timeframe)
|
||||
if erase and dl_file.exists():
|
||||
logger.info(
|
||||
f'Deleting existing data for pair {pair}, interval {timeframe}.')
|
||||
dl_file.unlink()
|
||||
|
||||
logger.info(f'Downloading pair {pair}, interval {timeframe}.')
|
||||
_download_pair_history(datadir=datadir, exchange=exchange,
|
||||
pair=pair, timeframe=str(timeframe),
|
||||
timerange=timerange)
|
||||
return pairs_not_available
|
||||
|
||||
|
||||
def _download_trades_history(datadir: Path,
|
||||
exchange: Exchange,
|
||||
pair: str,
|
||||
timerange: Optional[TimeRange] = None) -> bool:
|
||||
"""
|
||||
Download trade history from the exchange.
|
||||
Appends to previously downloaded trades data.
|
||||
"""
|
||||
try:
|
||||
|
||||
since = timerange.startts * 1000 if timerange and timerange.starttype == 'date' else None
|
||||
|
||||
trades = load_trades_file(datadir, pair)
|
||||
|
||||
from_id = trades[-1]['id'] if trades else None
|
||||
|
||||
logger.debug("Current Start: %s", trades[0]['datetime'] if trades else 'None')
|
||||
logger.debug("Current End: %s", trades[-1]['datetime'] if trades else 'None')
|
||||
|
||||
# Default since_ms to 30 days if nothing is given
|
||||
new_trades = exchange.get_historic_trades(pair=pair,
|
||||
since=since if since else
|
||||
int(arrow.utcnow().shift(
|
||||
days=-30).float_timestamp) * 1000,
|
||||
from_id=from_id,
|
||||
)
|
||||
trades.extend(new_trades[1])
|
||||
store_trades_file(datadir, pair, trades)
|
||||
|
||||
logger.debug("New Start: %s", trades[0]['datetime'])
|
||||
logger.debug("New End: %s", trades[-1]['datetime'])
|
||||
logger.info(f"New Amount of trades: {len(trades)}")
|
||||
return True
|
||||
|
||||
except Exception as e:
|
||||
logger.error(
|
||||
f'Failed to download historic trades for pair: "{pair}". '
|
||||
f'Error: {e}'
|
||||
)
|
||||
return False
|
||||
|
||||
|
||||
def refresh_backtest_trades_data(exchange: Exchange, pairs: List[str], datadir: Path,
|
||||
timerange: TimeRange, erase=False) -> List[str]:
|
||||
"""
|
||||
Refresh stored trades data for backtesting and hyperopt operations.
|
||||
Used by freqtrade download-data subcommand.
|
||||
:return: List of pairs that are not available.
|
||||
"""
|
||||
pairs_not_available = []
|
||||
for pair in pairs:
|
||||
if pair not in exchange.markets:
|
||||
pairs_not_available.append(pair)
|
||||
logger.info(f"Skipping pair {pair}...")
|
||||
continue
|
||||
|
||||
dl_file = pair_trades_filename(datadir, pair)
|
||||
if erase and dl_file.exists():
|
||||
logger.info(
|
||||
f'Deleting existing data for pair {pair}.')
|
||||
dl_file.unlink()
|
||||
|
||||
logger.info(f'Downloading trades for pair {pair}.')
|
||||
_download_trades_history(datadir=datadir, exchange=exchange,
|
||||
pair=pair,
|
||||
timerange=timerange)
|
||||
return pairs_not_available
|
||||
|
||||
|
||||
def convert_trades_to_ohlcv(pairs: List[str], timeframes: List[str],
|
||||
datadir: Path, timerange: TimeRange, erase=False) -> None:
|
||||
"""
|
||||
Convert stored trades data to ohlcv data
|
||||
"""
|
||||
for pair in pairs:
|
||||
trades = load_trades_file(datadir, pair)
|
||||
for timeframe in timeframes:
|
||||
ohlcv_file = pair_data_filename(datadir, pair, timeframe)
|
||||
if erase and ohlcv_file.exists():
|
||||
logger.info(f'Deleting existing data for pair {pair}, interval {timeframe}.')
|
||||
ohlcv_file.unlink()
|
||||
ohlcv = trades_to_ohlcv(trades, timeframe)
|
||||
# Store ohlcv
|
||||
store_tickerdata_file(datadir, pair, timeframe, data=ohlcv)
|
||||
|
||||
|
||||
def get_timerange(data: Dict[str, DataFrame]) -> Tuple[arrow.Arrow, arrow.Arrow]:
|
||||
"""
|
||||
Get the maximum common timerange for the given backtest data.
|
||||
|
||||
:param data: dictionary with preprocessed backtesting data
|
||||
:return: tuple containing min_date, max_date
|
||||
"""
|
||||
timeranges = [
|
||||
(arrow.get(frame['date'].min()), arrow.get(frame['date'].max()))
|
||||
for frame in data.values()
|
||||
]
|
||||
return (min(timeranges, key=operator.itemgetter(0))[0],
|
||||
max(timeranges, key=operator.itemgetter(1))[1])
|
||||
|
||||
|
||||
def validate_backtest_data(data: DataFrame, pair: str, min_date: datetime,
|
||||
max_date: datetime, timeframe_min: int) -> bool:
|
||||
"""
|
||||
Validates preprocessed backtesting data for missing values and shows warnings about it that.
|
||||
|
||||
:param data: preprocessed backtesting data (as DataFrame)
|
||||
:param pair: pair used for log output.
|
||||
:param min_date: start-date of the data
|
||||
:param max_date: end-date of the data
|
||||
:param timeframe_min: ticker Timeframe in minutes
|
||||
"""
|
||||
# total difference in minutes / timeframe-minutes
|
||||
expected_frames = int((max_date - min_date).total_seconds() // 60 // timeframe_min)
|
||||
found_missing = False
|
||||
dflen = len(data)
|
||||
if dflen < expected_frames:
|
||||
found_missing = True
|
||||
logger.warning("%s has missing frames: expected %s, got %s, that's %s missing values",
|
||||
pair, expected_frames, dflen, expected_frames - dflen)
|
||||
return found_missing
|
||||
|
||||
@@ -1,441 +1 @@
|
||||
# pragma pylint: disable=W0603
|
||||
""" Edge positioning package """
|
||||
import logging
|
||||
from pathlib import Path
|
||||
from typing import Any, Dict, NamedTuple
|
||||
|
||||
import arrow
|
||||
import numpy as np
|
||||
import utils_find_1st as utf1st
|
||||
from pandas import DataFrame
|
||||
|
||||
from freqtrade import constants, OperationalException
|
||||
from freqtrade.arguments import Arguments
|
||||
from freqtrade.arguments import TimeRange
|
||||
from freqtrade.data import history
|
||||
from freqtrade.optimize import get_timeframe
|
||||
from freqtrade.strategy.interface import SellType
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class PairInfo(NamedTuple):
|
||||
stoploss: float
|
||||
winrate: float
|
||||
risk_reward_ratio: float
|
||||
required_risk_reward: float
|
||||
expectancy: float
|
||||
nb_trades: int
|
||||
avg_trade_duration: float
|
||||
|
||||
|
||||
class Edge():
|
||||
"""
|
||||
Calculates Win Rate, Risk Reward Ratio, Expectancy
|
||||
against historical data for a give set of markets and a strategy
|
||||
it then adjusts stoploss and position size accordingly
|
||||
and force it into the strategy
|
||||
Author: https://github.com/mishaker
|
||||
"""
|
||||
|
||||
config: Dict = {}
|
||||
_cached_pairs: Dict[str, Any] = {} # Keeps a list of pairs
|
||||
|
||||
def __init__(self, config: Dict[str, Any], exchange, strategy) -> None:
|
||||
|
||||
self.config = config
|
||||
self.exchange = exchange
|
||||
self.strategy = strategy
|
||||
self.ticker_interval = self.strategy.ticker_interval
|
||||
self.tickerdata_to_dataframe = self.strategy.tickerdata_to_dataframe
|
||||
self.get_timeframe = get_timeframe
|
||||
self.advise_sell = self.strategy.advise_sell
|
||||
self.advise_buy = self.strategy.advise_buy
|
||||
|
||||
self.edge_config = self.config.get('edge', {})
|
||||
self._cached_pairs: Dict[str, Any] = {} # Keeps a list of pairs
|
||||
self._final_pairs: list = []
|
||||
|
||||
# checking max_open_trades. it should be -1 as with Edge
|
||||
# the number of trades is determined by position size
|
||||
if self.config['max_open_trades'] != float('inf'):
|
||||
logger.critical('max_open_trades should be -1 in config !')
|
||||
|
||||
if self.config['stake_amount'] != constants.UNLIMITED_STAKE_AMOUNT:
|
||||
raise OperationalException('Edge works only with unlimited stake amount')
|
||||
|
||||
self._capital_percentage: float = self.edge_config.get('capital_available_percentage')
|
||||
self._allowed_risk: float = self.edge_config.get('allowed_risk')
|
||||
self._since_number_of_days: int = self.edge_config.get('calculate_since_number_of_days', 14)
|
||||
self._last_updated: int = 0 # Timestamp of pairs last updated time
|
||||
self._refresh_pairs = True
|
||||
|
||||
self._stoploss_range_min = float(self.edge_config.get('stoploss_range_min', -0.01))
|
||||
self._stoploss_range_max = float(self.edge_config.get('stoploss_range_max', -0.05))
|
||||
self._stoploss_range_step = float(self.edge_config.get('stoploss_range_step', -0.001))
|
||||
|
||||
# calculating stoploss range
|
||||
self._stoploss_range = np.arange(
|
||||
self._stoploss_range_min,
|
||||
self._stoploss_range_max,
|
||||
self._stoploss_range_step
|
||||
)
|
||||
|
||||
self._timerange: TimeRange = Arguments.parse_timerange("%s-" % arrow.now().shift(
|
||||
days=-1 * self._since_number_of_days).format('YYYYMMDD'))
|
||||
|
||||
self.fee = self.exchange.get_fee()
|
||||
|
||||
def calculate(self) -> bool:
|
||||
pairs = self.config['exchange']['pair_whitelist']
|
||||
heartbeat = self.edge_config.get('process_throttle_secs')
|
||||
|
||||
if (self._last_updated > 0) and (
|
||||
self._last_updated + heartbeat > arrow.utcnow().timestamp):
|
||||
return False
|
||||
|
||||
data: Dict[str, Any] = {}
|
||||
logger.info('Using stake_currency: %s ...', self.config['stake_currency'])
|
||||
logger.info('Using local backtesting data (using whitelist in given config) ...')
|
||||
|
||||
data = history.load_data(
|
||||
datadir=Path(self.config['datadir']) if self.config.get('datadir') else None,
|
||||
pairs=pairs,
|
||||
ticker_interval=self.ticker_interval,
|
||||
refresh_pairs=self._refresh_pairs,
|
||||
exchange=self.exchange,
|
||||
timerange=self._timerange
|
||||
)
|
||||
|
||||
if not data:
|
||||
# Reinitializing cached pairs
|
||||
self._cached_pairs = {}
|
||||
logger.critical("No data found. Edge is stopped ...")
|
||||
return False
|
||||
|
||||
preprocessed = self.tickerdata_to_dataframe(data)
|
||||
|
||||
# Print timeframe
|
||||
min_date, max_date = self.get_timeframe(preprocessed)
|
||||
logger.info(
|
||||
'Measuring data from %s up to %s (%s days) ...',
|
||||
min_date.isoformat(),
|
||||
max_date.isoformat(),
|
||||
(max_date - min_date).days
|
||||
)
|
||||
headers = ['date', 'buy', 'open', 'close', 'sell', 'high', 'low']
|
||||
|
||||
trades: list = []
|
||||
for pair, pair_data in preprocessed.items():
|
||||
# Sorting dataframe by date and reset index
|
||||
pair_data = pair_data.sort_values(by=['date'])
|
||||
pair_data = pair_data.reset_index(drop=True)
|
||||
|
||||
ticker_data = self.advise_sell(
|
||||
self.advise_buy(pair_data, {'pair': pair}), {'pair': pair})[headers].copy()
|
||||
|
||||
trades += self._find_trades_for_stoploss_range(ticker_data, pair, self._stoploss_range)
|
||||
|
||||
# If no trade found then exit
|
||||
if len(trades) == 0:
|
||||
return False
|
||||
|
||||
# Fill missing, calculable columns, profit, duration , abs etc.
|
||||
trades_df = self._fill_calculable_fields(DataFrame(trades))
|
||||
self._cached_pairs = self._process_expectancy(trades_df)
|
||||
self._last_updated = arrow.utcnow().timestamp
|
||||
|
||||
return True
|
||||
|
||||
def stake_amount(self, pair: str, free_capital: float,
|
||||
total_capital: float, capital_in_trade: float) -> float:
|
||||
stoploss = self.stoploss(pair)
|
||||
available_capital = (total_capital + capital_in_trade) * self._capital_percentage
|
||||
allowed_capital_at_risk = available_capital * self._allowed_risk
|
||||
max_position_size = abs(allowed_capital_at_risk / stoploss)
|
||||
position_size = min(max_position_size, free_capital)
|
||||
if pair in self._cached_pairs:
|
||||
logger.info(
|
||||
'winrate: %s, expectancy: %s, position size: %s, pair: %s,'
|
||||
' capital in trade: %s, free capital: %s, total capital: %s,'
|
||||
' stoploss: %s, available capital: %s.',
|
||||
self._cached_pairs[pair].winrate,
|
||||
self._cached_pairs[pair].expectancy,
|
||||
position_size, pair,
|
||||
capital_in_trade, free_capital, total_capital,
|
||||
stoploss, available_capital
|
||||
)
|
||||
return round(position_size, 15)
|
||||
|
||||
def stoploss(self, pair: str) -> float:
|
||||
if pair in self._cached_pairs:
|
||||
return self._cached_pairs[pair].stoploss
|
||||
else:
|
||||
logger.warning('tried to access stoploss of a non-existing pair, '
|
||||
'strategy stoploss is returned instead.')
|
||||
return self.strategy.stoploss
|
||||
|
||||
def adjust(self, pairs) -> list:
|
||||
"""
|
||||
Filters out and sorts "pairs" according to Edge calculated pairs
|
||||
"""
|
||||
final = []
|
||||
for pair, info in self._cached_pairs.items():
|
||||
if info.expectancy > float(self.edge_config.get('minimum_expectancy', 0.2)) and \
|
||||
info.winrate > float(self.edge_config.get('minimum_winrate', 0.60)) and \
|
||||
pair in pairs:
|
||||
final.append(pair)
|
||||
|
||||
if self._final_pairs != final:
|
||||
self._final_pairs = final
|
||||
if self._final_pairs:
|
||||
logger.info(
|
||||
'Minimum expectancy and minimum winrate are met only for %s,'
|
||||
' so other pairs are filtered out.',
|
||||
self._final_pairs
|
||||
)
|
||||
else:
|
||||
logger.info(
|
||||
'Edge removed all pairs as no pair with minimum expectancy '
|
||||
'and minimum winrate was found !'
|
||||
)
|
||||
|
||||
return self._final_pairs
|
||||
|
||||
def _fill_calculable_fields(self, result: DataFrame) -> DataFrame:
|
||||
"""
|
||||
The result frame contains a number of columns that are calculable
|
||||
from other columns. These are left blank till all rows are added,
|
||||
to be populated in single vector calls.
|
||||
|
||||
Columns to be populated are:
|
||||
- Profit
|
||||
- trade duration
|
||||
- profit abs
|
||||
:param result Dataframe
|
||||
:return: result Dataframe
|
||||
"""
|
||||
|
||||
# stake and fees
|
||||
# stake = 0.015
|
||||
# 0.05% is 0.0005
|
||||
# fee = 0.001
|
||||
|
||||
# we set stake amount to an arbitrary amount.
|
||||
# as it doesn't change the calculation.
|
||||
# all returned values are relative. they are percentages.
|
||||
stake = 0.015
|
||||
fee = self.fee
|
||||
open_fee = fee / 2
|
||||
close_fee = fee / 2
|
||||
|
||||
result['trade_duration'] = result['close_time'] - result['open_time']
|
||||
|
||||
result['trade_duration'] = result['trade_duration'].map(
|
||||
lambda x: int(x.total_seconds() / 60))
|
||||
|
||||
# Spends, Takes, Profit, Absolute Profit
|
||||
|
||||
# Buy Price
|
||||
result['buy_vol'] = stake / result['open_rate'] # How many target are we buying
|
||||
result['buy_fee'] = stake * open_fee
|
||||
result['buy_spend'] = stake + result['buy_fee'] # How much we're spending
|
||||
|
||||
# Sell price
|
||||
result['sell_sum'] = result['buy_vol'] * result['close_rate']
|
||||
result['sell_fee'] = result['sell_sum'] * close_fee
|
||||
result['sell_take'] = result['sell_sum'] - result['sell_fee']
|
||||
|
||||
# profit_percent
|
||||
result['profit_percent'] = (result['sell_take'] - result['buy_spend']) / result['buy_spend']
|
||||
|
||||
# Absolute profit
|
||||
result['profit_abs'] = result['sell_take'] - result['buy_spend']
|
||||
|
||||
return result
|
||||
|
||||
def _process_expectancy(self, results: DataFrame) -> Dict[str, Any]:
|
||||
"""
|
||||
This calculates WinRate, Required Risk Reward, Risk Reward and Expectancy of all pairs
|
||||
The calulation will be done per pair and per strategy.
|
||||
"""
|
||||
# Removing pairs having less than min_trades_number
|
||||
min_trades_number = self.edge_config.get('min_trade_number', 10)
|
||||
results = results.groupby(['pair', 'stoploss']).filter(lambda x: len(x) > min_trades_number)
|
||||
###################################
|
||||
|
||||
# Removing outliers (Only Pumps) from the dataset
|
||||
# The method to detect outliers is to calculate standard deviation
|
||||
# Then every value more than (standard deviation + 2*average) is out (pump)
|
||||
#
|
||||
# Removing Pumps
|
||||
if self.edge_config.get('remove_pumps', False):
|
||||
results = results.groupby(['pair', 'stoploss']).apply(
|
||||
lambda x: x[x['profit_abs'] < 2 * x['profit_abs'].std() + x['profit_abs'].mean()])
|
||||
##########################################################################
|
||||
|
||||
# Removing trades having a duration more than X minutes (set in config)
|
||||
max_trade_duration = self.edge_config.get('max_trade_duration_minute', 1440)
|
||||
results = results[results.trade_duration < max_trade_duration]
|
||||
#######################################################################
|
||||
|
||||
if results.empty:
|
||||
return {}
|
||||
|
||||
groupby_aggregator = {
|
||||
'profit_abs': [
|
||||
('nb_trades', 'count'), # number of all trades
|
||||
('profit_sum', lambda x: x[x > 0].sum()), # cumulative profit of all winning trades
|
||||
('loss_sum', lambda x: abs(x[x < 0].sum())), # cumulative loss of all losing trades
|
||||
('nb_win_trades', lambda x: x[x > 0].count()) # number of winning trades
|
||||
],
|
||||
'trade_duration': [('avg_trade_duration', 'mean')]
|
||||
}
|
||||
|
||||
# Group by (pair and stoploss) by applying above aggregator
|
||||
df = results.groupby(['pair', 'stoploss'])['profit_abs', 'trade_duration'].agg(
|
||||
groupby_aggregator).reset_index(col_level=1)
|
||||
|
||||
# Dropping level 0 as we don't need it
|
||||
df.columns = df.columns.droplevel(0)
|
||||
|
||||
# Calculating number of losing trades, average win and average loss
|
||||
df['nb_loss_trades'] = df['nb_trades'] - df['nb_win_trades']
|
||||
df['average_win'] = df['profit_sum'] / df['nb_win_trades']
|
||||
df['average_loss'] = df['loss_sum'] / df['nb_loss_trades']
|
||||
|
||||
# Win rate = number of profitable trades / number of trades
|
||||
df['winrate'] = df['nb_win_trades'] / df['nb_trades']
|
||||
|
||||
# risk_reward_ratio = average win / average loss
|
||||
df['risk_reward_ratio'] = df['average_win'] / df['average_loss']
|
||||
|
||||
# required_risk_reward = (1 / winrate) - 1
|
||||
df['required_risk_reward'] = (1 / df['winrate']) - 1
|
||||
|
||||
# expectancy = (risk_reward_ratio * winrate) - (lossrate)
|
||||
df['expectancy'] = (df['risk_reward_ratio'] * df['winrate']) - (1 - df['winrate'])
|
||||
|
||||
# sort by expectancy and stoploss
|
||||
df = df.sort_values(by=['expectancy', 'stoploss'], ascending=False).groupby(
|
||||
'pair').first().sort_values(by=['expectancy'], ascending=False).reset_index()
|
||||
|
||||
final = {}
|
||||
for x in df.itertuples():
|
||||
final[x.pair] = PairInfo(
|
||||
x.stoploss,
|
||||
x.winrate,
|
||||
x.risk_reward_ratio,
|
||||
x.required_risk_reward,
|
||||
x.expectancy,
|
||||
x.nb_trades,
|
||||
x.avg_trade_duration
|
||||
)
|
||||
|
||||
# Returning a list of pairs in order of "expectancy"
|
||||
return final
|
||||
|
||||
def _find_trades_for_stoploss_range(self, ticker_data, pair, stoploss_range):
|
||||
buy_column = ticker_data['buy'].values
|
||||
sell_column = ticker_data['sell'].values
|
||||
date_column = ticker_data['date'].values
|
||||
ohlc_columns = ticker_data[['open', 'high', 'low', 'close']].values
|
||||
|
||||
result: list = []
|
||||
for stoploss in stoploss_range:
|
||||
result += self._detect_next_stop_or_sell_point(
|
||||
buy_column, sell_column, date_column, ohlc_columns, round(stoploss, 6), pair
|
||||
)
|
||||
|
||||
return result
|
||||
|
||||
def _detect_next_stop_or_sell_point(self, buy_column, sell_column, date_column,
|
||||
ohlc_columns, stoploss, pair, start_point=0):
|
||||
"""
|
||||
Iterate through ohlc_columns recursively in order to find the next trade
|
||||
Next trade opens from the first buy signal noticed to
|
||||
The sell or stoploss signal after it.
|
||||
It then calls itself cutting OHLC, buy_column, sell_colum and date_column
|
||||
Cut from (the exit trade index) + 1
|
||||
Author: https://github.com/mishaker
|
||||
"""
|
||||
|
||||
result: list = []
|
||||
open_trade_index = utf1st.find_1st(buy_column, 1, utf1st.cmp_equal)
|
||||
|
||||
# return empty if we don't find trade entry (i.e. buy==1) or
|
||||
# we find a buy but at the of array
|
||||
if open_trade_index == -1 or open_trade_index == len(buy_column) - 1:
|
||||
return []
|
||||
else:
|
||||
open_trade_index += 1 # when a buy signal is seen,
|
||||
# trade opens in reality on the next candle
|
||||
|
||||
stop_price_percentage = stoploss + 1
|
||||
open_price = ohlc_columns[open_trade_index, 0]
|
||||
stop_price = (open_price * stop_price_percentage)
|
||||
|
||||
# Searching for the index where stoploss is hit
|
||||
stop_index = utf1st.find_1st(
|
||||
ohlc_columns[open_trade_index:, 2], stop_price, utf1st.cmp_smaller)
|
||||
|
||||
# If we don't find it then we assume stop_index will be far in future (infinite number)
|
||||
if stop_index == -1:
|
||||
stop_index = float('inf')
|
||||
|
||||
# Searching for the index where sell is hit
|
||||
sell_index = utf1st.find_1st(sell_column[open_trade_index:], 1, utf1st.cmp_equal)
|
||||
|
||||
# If we don't find it then we assume sell_index will be far in future (infinite number)
|
||||
if sell_index == -1:
|
||||
sell_index = float('inf')
|
||||
|
||||
# Check if we don't find any stop or sell point (in that case trade remains open)
|
||||
# It is not interesting for Edge to consider it so we simply ignore the trade
|
||||
# And stop iterating there is no more entry
|
||||
if stop_index == sell_index == float('inf'):
|
||||
return []
|
||||
|
||||
if stop_index <= sell_index:
|
||||
exit_index = open_trade_index + stop_index
|
||||
exit_type = SellType.STOP_LOSS
|
||||
exit_price = stop_price
|
||||
elif stop_index > sell_index:
|
||||
# if exit is SELL then we exit at the next candle
|
||||
exit_index = open_trade_index + sell_index + 1
|
||||
|
||||
# check if we have the next candle
|
||||
if len(ohlc_columns) - 1 < exit_index:
|
||||
return []
|
||||
|
||||
exit_type = SellType.SELL_SIGNAL
|
||||
exit_price = ohlc_columns[exit_index, 0]
|
||||
|
||||
trade = {'pair': pair,
|
||||
'stoploss': stoploss,
|
||||
'profit_percent': '',
|
||||
'profit_abs': '',
|
||||
'open_time': date_column[open_trade_index],
|
||||
'close_time': date_column[exit_index],
|
||||
'open_index': start_point + open_trade_index,
|
||||
'close_index': start_point + exit_index,
|
||||
'trade_duration': '',
|
||||
'open_rate': round(open_price, 15),
|
||||
'close_rate': round(exit_price, 15),
|
||||
'exit_type': exit_type
|
||||
}
|
||||
|
||||
result.append(trade)
|
||||
|
||||
# Calling again the same function recursively but giving
|
||||
# it a view of exit_index till the end of array
|
||||
return result + self._detect_next_stop_or_sell_point(
|
||||
buy_column[exit_index:],
|
||||
sell_column[exit_index:],
|
||||
date_column[exit_index:],
|
||||
ohlc_columns[exit_index:],
|
||||
stoploss,
|
||||
pair,
|
||||
(start_point + exit_index)
|
||||
)
|
||||
from .edge_positioning import Edge, PairInfo # noqa: F401
|
||||
|
||||
464
freqtrade/edge/edge_positioning.py
Normal file
464
freqtrade/edge/edge_positioning.py
Normal file
@@ -0,0 +1,464 @@
|
||||
# pragma pylint: disable=W0603
|
||||
""" Edge positioning package """
|
||||
import logging
|
||||
from typing import Any, Dict, NamedTuple
|
||||
|
||||
import arrow
|
||||
import numpy as np
|
||||
import utils_find_1st as utf1st
|
||||
from pandas import DataFrame
|
||||
|
||||
from freqtrade import constants
|
||||
from freqtrade.configuration import TimeRange
|
||||
from freqtrade.data import history
|
||||
from freqtrade.exceptions import OperationalException
|
||||
from freqtrade.strategy.interface import SellType
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class PairInfo(NamedTuple):
|
||||
stoploss: float
|
||||
winrate: float
|
||||
risk_reward_ratio: float
|
||||
required_risk_reward: float
|
||||
expectancy: float
|
||||
nb_trades: int
|
||||
avg_trade_duration: float
|
||||
|
||||
|
||||
class Edge:
|
||||
"""
|
||||
Calculates Win Rate, Risk Reward Ratio, Expectancy
|
||||
against historical data for a give set of markets and a strategy
|
||||
it then adjusts stoploss and position size accordingly
|
||||
and force it into the strategy
|
||||
Author: https://github.com/mishaker
|
||||
"""
|
||||
|
||||
config: Dict = {}
|
||||
_cached_pairs: Dict[str, Any] = {} # Keeps a list of pairs
|
||||
|
||||
def __init__(self, config: Dict[str, Any], exchange, strategy) -> None:
|
||||
|
||||
self.config = config
|
||||
self.exchange = exchange
|
||||
self.strategy = strategy
|
||||
|
||||
self.edge_config = self.config.get('edge', {})
|
||||
self._cached_pairs: Dict[str, Any] = {} # Keeps a list of pairs
|
||||
self._final_pairs: list = []
|
||||
|
||||
# checking max_open_trades. it should be -1 as with Edge
|
||||
# the number of trades is determined by position size
|
||||
if self.config['max_open_trades'] != float('inf'):
|
||||
logger.critical('max_open_trades should be -1 in config !')
|
||||
|
||||
if self.config['stake_amount'] != constants.UNLIMITED_STAKE_AMOUNT:
|
||||
raise OperationalException('Edge works only with unlimited stake amount')
|
||||
|
||||
# Deprecated capital_available_percentage. Will use tradable_balance_ratio in the future.
|
||||
self._capital_percentage: float = self.edge_config.get(
|
||||
'capital_available_percentage', self.config['tradable_balance_ratio'])
|
||||
self._allowed_risk: float = self.edge_config.get('allowed_risk')
|
||||
self._since_number_of_days: int = self.edge_config.get('calculate_since_number_of_days', 14)
|
||||
self._last_updated: int = 0 # Timestamp of pairs last updated time
|
||||
self._refresh_pairs = True
|
||||
|
||||
self._stoploss_range_min = float(self.edge_config.get('stoploss_range_min', -0.01))
|
||||
self._stoploss_range_max = float(self.edge_config.get('stoploss_range_max', -0.05))
|
||||
self._stoploss_range_step = float(self.edge_config.get('stoploss_range_step', -0.001))
|
||||
|
||||
# calculating stoploss range
|
||||
self._stoploss_range = np.arange(
|
||||
self._stoploss_range_min,
|
||||
self._stoploss_range_max,
|
||||
self._stoploss_range_step
|
||||
)
|
||||
|
||||
self._timerange: TimeRange = TimeRange.parse_timerange("%s-" % arrow.now().shift(
|
||||
days=-1 * self._since_number_of_days).format('YYYYMMDD'))
|
||||
if config.get('fee'):
|
||||
self.fee = config['fee']
|
||||
else:
|
||||
self.fee = self.exchange.get_fee(symbol=self.config['exchange']['pair_whitelist'][0])
|
||||
|
||||
def calculate(self) -> bool:
|
||||
pairs = self.config['exchange']['pair_whitelist']
|
||||
heartbeat = self.edge_config.get('process_throttle_secs')
|
||||
|
||||
if (self._last_updated > 0) and (
|
||||
self._last_updated + heartbeat > arrow.utcnow().timestamp):
|
||||
return False
|
||||
|
||||
data: Dict[str, Any] = {}
|
||||
logger.info('Using stake_currency: %s ...', self.config['stake_currency'])
|
||||
logger.info('Using local backtesting data (using whitelist in given config) ...')
|
||||
|
||||
if self._refresh_pairs:
|
||||
history.refresh_data(
|
||||
datadir=self.config['datadir'],
|
||||
pairs=pairs,
|
||||
exchange=self.exchange,
|
||||
timeframe=self.strategy.ticker_interval,
|
||||
timerange=self._timerange,
|
||||
)
|
||||
|
||||
data = history.load_data(
|
||||
datadir=self.config['datadir'],
|
||||
pairs=pairs,
|
||||
timeframe=self.strategy.ticker_interval,
|
||||
timerange=self._timerange,
|
||||
startup_candles=self.strategy.startup_candle_count,
|
||||
)
|
||||
|
||||
if not data:
|
||||
# Reinitializing cached pairs
|
||||
self._cached_pairs = {}
|
||||
logger.critical("No data found. Edge is stopped ...")
|
||||
return False
|
||||
|
||||
preprocessed = self.strategy.tickerdata_to_dataframe(data)
|
||||
|
||||
# Print timeframe
|
||||
min_date, max_date = history.get_timerange(preprocessed)
|
||||
logger.info(
|
||||
'Measuring data from %s up to %s (%s days) ...',
|
||||
min_date.isoformat(),
|
||||
max_date.isoformat(),
|
||||
(max_date - min_date).days
|
||||
)
|
||||
headers = ['date', 'buy', 'open', 'close', 'sell', 'high', 'low']
|
||||
|
||||
trades: list = []
|
||||
for pair, pair_data in preprocessed.items():
|
||||
# Sorting dataframe by date and reset index
|
||||
pair_data = pair_data.sort_values(by=['date'])
|
||||
pair_data = pair_data.reset_index(drop=True)
|
||||
|
||||
ticker_data = self.strategy.advise_sell(
|
||||
self.strategy.advise_buy(pair_data, {'pair': pair}), {'pair': pair})[headers].copy()
|
||||
|
||||
trades += self._find_trades_for_stoploss_range(ticker_data, pair, self._stoploss_range)
|
||||
|
||||
# If no trade found then exit
|
||||
if len(trades) == 0:
|
||||
logger.info("No trades found.")
|
||||
return False
|
||||
|
||||
# Fill missing, calculable columns, profit, duration , abs etc.
|
||||
trades_df = self._fill_calculable_fields(DataFrame(trades))
|
||||
self._cached_pairs = self._process_expectancy(trades_df)
|
||||
self._last_updated = arrow.utcnow().timestamp
|
||||
|
||||
return True
|
||||
|
||||
def stake_amount(self, pair: str, free_capital: float,
|
||||
total_capital: float, capital_in_trade: float) -> float:
|
||||
stoploss = self.stoploss(pair)
|
||||
available_capital = (total_capital + capital_in_trade) * self._capital_percentage
|
||||
allowed_capital_at_risk = available_capital * self._allowed_risk
|
||||
max_position_size = abs(allowed_capital_at_risk / stoploss)
|
||||
position_size = min(max_position_size, free_capital)
|
||||
if pair in self._cached_pairs:
|
||||
logger.info(
|
||||
'winrate: %s, expectancy: %s, position size: %s, pair: %s,'
|
||||
' capital in trade: %s, free capital: %s, total capital: %s,'
|
||||
' stoploss: %s, available capital: %s.',
|
||||
self._cached_pairs[pair].winrate,
|
||||
self._cached_pairs[pair].expectancy,
|
||||
position_size, pair,
|
||||
capital_in_trade, free_capital, total_capital,
|
||||
stoploss, available_capital
|
||||
)
|
||||
return round(position_size, 15)
|
||||
|
||||
def stoploss(self, pair: str) -> float:
|
||||
if pair in self._cached_pairs:
|
||||
return self._cached_pairs[pair].stoploss
|
||||
else:
|
||||
logger.warning('tried to access stoploss of a non-existing pair, '
|
||||
'strategy stoploss is returned instead.')
|
||||
return self.strategy.stoploss
|
||||
|
||||
def adjust(self, pairs) -> list:
|
||||
"""
|
||||
Filters out and sorts "pairs" according to Edge calculated pairs
|
||||
"""
|
||||
final = []
|
||||
for pair, info in self._cached_pairs.items():
|
||||
if info.expectancy > float(self.edge_config.get('minimum_expectancy', 0.2)) and \
|
||||
info.winrate > float(self.edge_config.get('minimum_winrate', 0.60)) and \
|
||||
pair in pairs:
|
||||
final.append(pair)
|
||||
|
||||
if self._final_pairs != final:
|
||||
self._final_pairs = final
|
||||
if self._final_pairs:
|
||||
logger.info(
|
||||
'Minimum expectancy and minimum winrate are met only for %s,'
|
||||
' so other pairs are filtered out.',
|
||||
self._final_pairs
|
||||
)
|
||||
else:
|
||||
logger.info(
|
||||
'Edge removed all pairs as no pair with minimum expectancy '
|
||||
'and minimum winrate was found !'
|
||||
)
|
||||
|
||||
return self._final_pairs
|
||||
|
||||
def accepted_pairs(self) -> list:
|
||||
"""
|
||||
return a list of accepted pairs along with their winrate, expectancy and stoploss
|
||||
"""
|
||||
final = []
|
||||
for pair, info in self._cached_pairs.items():
|
||||
if info.expectancy > float(self.edge_config.get('minimum_expectancy', 0.2)) and \
|
||||
info.winrate > float(self.edge_config.get('minimum_winrate', 0.60)):
|
||||
final.append({
|
||||
'Pair': pair,
|
||||
'Winrate': info.winrate,
|
||||
'Expectancy': info.expectancy,
|
||||
'Stoploss': info.stoploss,
|
||||
})
|
||||
return final
|
||||
|
||||
def _fill_calculable_fields(self, result: DataFrame) -> DataFrame:
|
||||
"""
|
||||
The result frame contains a number of columns that are calculable
|
||||
from other columns. These are left blank till all rows are added,
|
||||
to be populated in single vector calls.
|
||||
|
||||
Columns to be populated are:
|
||||
- Profit
|
||||
- trade duration
|
||||
- profit abs
|
||||
:param result Dataframe
|
||||
:return: result Dataframe
|
||||
"""
|
||||
|
||||
# stake and fees
|
||||
# stake = 0.015
|
||||
# 0.05% is 0.0005
|
||||
# fee = 0.001
|
||||
|
||||
# we set stake amount to an arbitrary amount.
|
||||
# as it doesn't change the calculation.
|
||||
# all returned values are relative. they are percentages.
|
||||
stake = 0.015
|
||||
fee = self.fee
|
||||
open_fee = fee / 2
|
||||
close_fee = fee / 2
|
||||
|
||||
result['trade_duration'] = result['close_time'] - result['open_time']
|
||||
|
||||
result['trade_duration'] = result['trade_duration'].map(
|
||||
lambda x: int(x.total_seconds() / 60))
|
||||
|
||||
# Spends, Takes, Profit, Absolute Profit
|
||||
|
||||
# Buy Price
|
||||
result['buy_vol'] = stake / result['open_rate'] # How many target are we buying
|
||||
result['buy_fee'] = stake * open_fee
|
||||
result['buy_spend'] = stake + result['buy_fee'] # How much we're spending
|
||||
|
||||
# Sell price
|
||||
result['sell_sum'] = result['buy_vol'] * result['close_rate']
|
||||
result['sell_fee'] = result['sell_sum'] * close_fee
|
||||
result['sell_take'] = result['sell_sum'] - result['sell_fee']
|
||||
|
||||
# profit_percent
|
||||
result['profit_percent'] = (result['sell_take'] - result['buy_spend']) / result['buy_spend']
|
||||
|
||||
# Absolute profit
|
||||
result['profit_abs'] = result['sell_take'] - result['buy_spend']
|
||||
|
||||
return result
|
||||
|
||||
def _process_expectancy(self, results: DataFrame) -> Dict[str, Any]:
|
||||
"""
|
||||
This calculates WinRate, Required Risk Reward, Risk Reward and Expectancy of all pairs
|
||||
The calulation will be done per pair and per strategy.
|
||||
"""
|
||||
# Removing pairs having less than min_trades_number
|
||||
min_trades_number = self.edge_config.get('min_trade_number', 10)
|
||||
results = results.groupby(['pair', 'stoploss']).filter(lambda x: len(x) > min_trades_number)
|
||||
###################################
|
||||
|
||||
# Removing outliers (Only Pumps) from the dataset
|
||||
# The method to detect outliers is to calculate standard deviation
|
||||
# Then every value more than (standard deviation + 2*average) is out (pump)
|
||||
#
|
||||
# Removing Pumps
|
||||
if self.edge_config.get('remove_pumps', False):
|
||||
results = results.groupby(['pair', 'stoploss']).apply(
|
||||
lambda x: x[x['profit_abs'] < 2 * x['profit_abs'].std() + x['profit_abs'].mean()])
|
||||
##########################################################################
|
||||
|
||||
# Removing trades having a duration more than X minutes (set in config)
|
||||
max_trade_duration = self.edge_config.get('max_trade_duration_minute', 1440)
|
||||
results = results[results.trade_duration < max_trade_duration]
|
||||
#######################################################################
|
||||
|
||||
if results.empty:
|
||||
return {}
|
||||
|
||||
groupby_aggregator = {
|
||||
'profit_abs': [
|
||||
('nb_trades', 'count'), # number of all trades
|
||||
('profit_sum', lambda x: x[x > 0].sum()), # cumulative profit of all winning trades
|
||||
('loss_sum', lambda x: abs(x[x < 0].sum())), # cumulative loss of all losing trades
|
||||
('nb_win_trades', lambda x: x[x > 0].count()) # number of winning trades
|
||||
],
|
||||
'trade_duration': [('avg_trade_duration', 'mean')]
|
||||
}
|
||||
|
||||
# Group by (pair and stoploss) by applying above aggregator
|
||||
df = results.groupby(['pair', 'stoploss'])['profit_abs', 'trade_duration'].agg(
|
||||
groupby_aggregator).reset_index(col_level=1)
|
||||
|
||||
# Dropping level 0 as we don't need it
|
||||
df.columns = df.columns.droplevel(0)
|
||||
|
||||
# Calculating number of losing trades, average win and average loss
|
||||
df['nb_loss_trades'] = df['nb_trades'] - df['nb_win_trades']
|
||||
df['average_win'] = df['profit_sum'] / df['nb_win_trades']
|
||||
df['average_loss'] = df['loss_sum'] / df['nb_loss_trades']
|
||||
|
||||
# Win rate = number of profitable trades / number of trades
|
||||
df['winrate'] = df['nb_win_trades'] / df['nb_trades']
|
||||
|
||||
# risk_reward_ratio = average win / average loss
|
||||
df['risk_reward_ratio'] = df['average_win'] / df['average_loss']
|
||||
|
||||
# required_risk_reward = (1 / winrate) - 1
|
||||
df['required_risk_reward'] = (1 / df['winrate']) - 1
|
||||
|
||||
# expectancy = (risk_reward_ratio * winrate) - (lossrate)
|
||||
df['expectancy'] = (df['risk_reward_ratio'] * df['winrate']) - (1 - df['winrate'])
|
||||
|
||||
# sort by expectancy and stoploss
|
||||
df = df.sort_values(by=['expectancy', 'stoploss'], ascending=False).groupby(
|
||||
'pair').first().sort_values(by=['expectancy'], ascending=False).reset_index()
|
||||
|
||||
final = {}
|
||||
for x in df.itertuples():
|
||||
final[x.pair] = PairInfo(
|
||||
x.stoploss,
|
||||
x.winrate,
|
||||
x.risk_reward_ratio,
|
||||
x.required_risk_reward,
|
||||
x.expectancy,
|
||||
x.nb_trades,
|
||||
x.avg_trade_duration
|
||||
)
|
||||
|
||||
# Returning a list of pairs in order of "expectancy"
|
||||
return final
|
||||
|
||||
def _find_trades_for_stoploss_range(self, ticker_data, pair, stoploss_range):
|
||||
buy_column = ticker_data['buy'].values
|
||||
sell_column = ticker_data['sell'].values
|
||||
date_column = ticker_data['date'].values
|
||||
ohlc_columns = ticker_data[['open', 'high', 'low', 'close']].values
|
||||
|
||||
result: list = []
|
||||
for stoploss in stoploss_range:
|
||||
result += self._detect_next_stop_or_sell_point(
|
||||
buy_column, sell_column, date_column, ohlc_columns, round(stoploss, 6), pair
|
||||
)
|
||||
|
||||
return result
|
||||
|
||||
def _detect_next_stop_or_sell_point(self, buy_column, sell_column, date_column,
|
||||
ohlc_columns, stoploss, pair):
|
||||
"""
|
||||
Iterate through ohlc_columns in order to find the next trade
|
||||
Next trade opens from the first buy signal noticed to
|
||||
The sell or stoploss signal after it.
|
||||
It then cuts OHLC, buy_column, sell_column and date_column.
|
||||
Cut from (the exit trade index) + 1.
|
||||
|
||||
Author: https://github.com/mishaker
|
||||
"""
|
||||
|
||||
result: list = []
|
||||
start_point = 0
|
||||
|
||||
while True:
|
||||
open_trade_index = utf1st.find_1st(buy_column, 1, utf1st.cmp_equal)
|
||||
|
||||
# Return empty if we don't find trade entry (i.e. buy==1) or
|
||||
# we find a buy but at the end of array
|
||||
if open_trade_index == -1 or open_trade_index == len(buy_column) - 1:
|
||||
break
|
||||
else:
|
||||
# When a buy signal is seen,
|
||||
# trade opens in reality on the next candle
|
||||
open_trade_index += 1
|
||||
|
||||
stop_price_percentage = stoploss + 1
|
||||
open_price = ohlc_columns[open_trade_index, 0]
|
||||
stop_price = (open_price * stop_price_percentage)
|
||||
|
||||
# Searching for the index where stoploss is hit
|
||||
stop_index = utf1st.find_1st(
|
||||
ohlc_columns[open_trade_index:, 2], stop_price, utf1st.cmp_smaller)
|
||||
|
||||
# If we don't find it then we assume stop_index will be far in future (infinite number)
|
||||
if stop_index == -1:
|
||||
stop_index = float('inf')
|
||||
|
||||
# Searching for the index where sell is hit
|
||||
sell_index = utf1st.find_1st(sell_column[open_trade_index:], 1, utf1st.cmp_equal)
|
||||
|
||||
# If we don't find it then we assume sell_index will be far in future (infinite number)
|
||||
if sell_index == -1:
|
||||
sell_index = float('inf')
|
||||
|
||||
# Check if we don't find any stop or sell point (in that case trade remains open)
|
||||
# It is not interesting for Edge to consider it so we simply ignore the trade
|
||||
# And stop iterating there is no more entry
|
||||
if stop_index == sell_index == float('inf'):
|
||||
break
|
||||
|
||||
if stop_index <= sell_index:
|
||||
exit_index = open_trade_index + stop_index
|
||||
exit_type = SellType.STOP_LOSS
|
||||
exit_price = stop_price
|
||||
elif stop_index > sell_index:
|
||||
# If exit is SELL then we exit at the next candle
|
||||
exit_index = open_trade_index + sell_index + 1
|
||||
|
||||
# Check if we have the next candle
|
||||
if len(ohlc_columns) - 1 < exit_index:
|
||||
break
|
||||
|
||||
exit_type = SellType.SELL_SIGNAL
|
||||
exit_price = ohlc_columns[exit_index, 0]
|
||||
|
||||
trade = {'pair': pair,
|
||||
'stoploss': stoploss,
|
||||
'profit_percent': '',
|
||||
'profit_abs': '',
|
||||
'open_time': date_column[open_trade_index],
|
||||
'close_time': date_column[exit_index],
|
||||
'open_index': start_point + open_trade_index,
|
||||
'close_index': start_point + exit_index,
|
||||
'trade_duration': '',
|
||||
'open_rate': round(open_price, 15),
|
||||
'close_rate': round(exit_price, 15),
|
||||
'exit_type': exit_type
|
||||
}
|
||||
|
||||
result.append(trade)
|
||||
|
||||
# Giving a view of exit_index till the end of array
|
||||
buy_column = buy_column[exit_index:]
|
||||
sell_column = sell_column[exit_index:]
|
||||
date_column = date_column[exit_index:]
|
||||
ohlc_columns = ohlc_columns[exit_index:]
|
||||
start_point += exit_index
|
||||
|
||||
return result
|
||||
37
freqtrade/exceptions.py
Normal file
37
freqtrade/exceptions.py
Normal file
@@ -0,0 +1,37 @@
|
||||
|
||||
|
||||
class FreqtradeException(Exception):
|
||||
"""
|
||||
Freqtrade base exception. Handled at the outermost level.
|
||||
All other exception types are subclasses of this exception type.
|
||||
"""
|
||||
|
||||
|
||||
class OperationalException(FreqtradeException):
|
||||
"""
|
||||
Requires manual intervention and will stop the bot.
|
||||
Most of the time, this is caused by an invalid Configuration.
|
||||
"""
|
||||
|
||||
|
||||
class DependencyException(FreqtradeException):
|
||||
"""
|
||||
Indicates that an assumed dependency is not met.
|
||||
This could happen when there is currently not enough money on the account.
|
||||
"""
|
||||
|
||||
|
||||
class InvalidOrderException(FreqtradeException):
|
||||
"""
|
||||
This is returned when the order is not valid. Example:
|
||||
If stoploss on exchange order is hit, then trying to cancel the order
|
||||
should return this exception.
|
||||
"""
|
||||
|
||||
|
||||
class TemporaryError(FreqtradeException):
|
||||
"""
|
||||
Temporary network or exchange related error.
|
||||
This could happen when an exchange is congested, unavailable, or the user
|
||||
has networking problems. Usually resolves itself after a time.
|
||||
"""
|
||||
@@ -1,730 +1,18 @@
|
||||
# pragma pylint: disable=W0603
|
||||
""" Cryptocurrency Exchanges support """
|
||||
import logging
|
||||
import inspect
|
||||
from random import randint
|
||||
from typing import List, Dict, Tuple, Any, Optional
|
||||
from datetime import datetime
|
||||
from math import floor, ceil
|
||||
|
||||
import arrow
|
||||
import asyncio
|
||||
import ccxt
|
||||
import ccxt.async_support as ccxt_async
|
||||
from pandas import DataFrame
|
||||
|
||||
from freqtrade import constants, OperationalException, DependencyException, TemporaryError
|
||||
from freqtrade.data.converter import parse_ticker_dataframe
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
API_RETRY_COUNT = 4
|
||||
|
||||
|
||||
# Urls to exchange markets, insert quote and base with .format()
|
||||
_EXCHANGE_URLS = {
|
||||
ccxt.bittrex.__name__: '/Market/Index?MarketName={quote}-{base}',
|
||||
ccxt.binance.__name__: '/tradeDetail.html?symbol={base}_{quote}'
|
||||
}
|
||||
|
||||
|
||||
def retrier_async(f):
|
||||
async def wrapper(*args, **kwargs):
|
||||
count = kwargs.pop('count', API_RETRY_COUNT)
|
||||
try:
|
||||
return await f(*args, **kwargs)
|
||||
except (TemporaryError, DependencyException) as ex:
|
||||
logger.warning('%s() returned exception: "%s"', f.__name__, ex)
|
||||
if count > 0:
|
||||
count -= 1
|
||||
kwargs.update({'count': count})
|
||||
logger.warning('retrying %s() still for %s times', f.__name__, count)
|
||||
return await wrapper(*args, **kwargs)
|
||||
else:
|
||||
logger.warning('Giving up retrying: %s()', f.__name__)
|
||||
raise ex
|
||||
return wrapper
|
||||
|
||||
|
||||
def retrier(f):
|
||||
def wrapper(*args, **kwargs):
|
||||
count = kwargs.pop('count', API_RETRY_COUNT)
|
||||
try:
|
||||
return f(*args, **kwargs)
|
||||
except (TemporaryError, DependencyException) as ex:
|
||||
logger.warning('%s() returned exception: "%s"', f.__name__, ex)
|
||||
if count > 0:
|
||||
count -= 1
|
||||
kwargs.update({'count': count})
|
||||
logger.warning('retrying %s() still for %s times', f.__name__, count)
|
||||
return wrapper(*args, **kwargs)
|
||||
else:
|
||||
logger.warning('Giving up retrying: %s()', f.__name__)
|
||||
raise ex
|
||||
return wrapper
|
||||
|
||||
|
||||
class Exchange(object):
|
||||
|
||||
_conf: Dict = {}
|
||||
|
||||
def __init__(self, config: dict) -> None:
|
||||
"""
|
||||
Initializes this module with the given config,
|
||||
it does basic validation whether the specified
|
||||
exchange and pairs are valid.
|
||||
:return: None
|
||||
"""
|
||||
self._conf.update(config)
|
||||
|
||||
self._cached_ticker: Dict[str, Any] = {}
|
||||
|
||||
# Holds last candle refreshed time of each pair
|
||||
self._pairs_last_refresh_time: Dict[Tuple[str, str], int] = {}
|
||||
|
||||
# Holds candles
|
||||
self._klines: Dict[Tuple[str, str], DataFrame] = {}
|
||||
|
||||
# Holds all open sell orders for dry_run
|
||||
self._dry_run_open_orders: Dict[str, Any] = {}
|
||||
|
||||
if config['dry_run']:
|
||||
logger.info('Instance is running with dry_run enabled')
|
||||
|
||||
exchange_config = config['exchange']
|
||||
self._api: ccxt.Exchange = self._init_ccxt(
|
||||
exchange_config, ccxt_kwargs=exchange_config.get('ccxt_config'))
|
||||
self._api_async: ccxt_async.Exchange = self._init_ccxt(
|
||||
exchange_config, ccxt_async, ccxt_kwargs=exchange_config.get('ccxt_async_config'))
|
||||
|
||||
logger.info('Using Exchange "%s"', self.name)
|
||||
|
||||
self.markets = self._load_markets()
|
||||
# Check if all pairs are available
|
||||
self.validate_pairs(config['exchange']['pair_whitelist'])
|
||||
self.validate_ordertypes(config.get('order_types', {}))
|
||||
self.validate_order_time_in_force(config.get('order_time_in_force', {}))
|
||||
if config.get('ticker_interval'):
|
||||
# Check if timeframe is available
|
||||
self.validate_timeframes(config['ticker_interval'])
|
||||
|
||||
def __del__(self):
|
||||
"""
|
||||
Destructor - clean up async stuff
|
||||
"""
|
||||
logger.debug("Exchange object destroyed, closing async loop")
|
||||
if self._api_async and inspect.iscoroutinefunction(self._api_async.close):
|
||||
asyncio.get_event_loop().run_until_complete(self._api_async.close())
|
||||
|
||||
def _init_ccxt(self, exchange_config: dict, ccxt_module=ccxt,
|
||||
ccxt_kwargs: dict = None) -> ccxt.Exchange:
|
||||
"""
|
||||
Initialize ccxt with given config and return valid
|
||||
ccxt instance.
|
||||
"""
|
||||
# Find matching class for the given exchange name
|
||||
name = exchange_config['name']
|
||||
|
||||
if name not in ccxt_module.exchanges:
|
||||
raise OperationalException(f'Exchange {name} is not supported')
|
||||
|
||||
ex_config = {
|
||||
'apiKey': exchange_config.get('key'),
|
||||
'secret': exchange_config.get('secret'),
|
||||
'password': exchange_config.get('password'),
|
||||
'uid': exchange_config.get('uid', ''),
|
||||
'enableRateLimit': exchange_config.get('ccxt_rate_limit', True)
|
||||
}
|
||||
if ccxt_kwargs:
|
||||
logger.info('Applying additional ccxt config: %s', ccxt_kwargs)
|
||||
ex_config.update(ccxt_kwargs)
|
||||
try:
|
||||
|
||||
api = getattr(ccxt_module, name.lower())(ex_config)
|
||||
except (KeyError, AttributeError):
|
||||
raise OperationalException(f'Exchange {name} is not supported')
|
||||
|
||||
self.set_sandbox(api, exchange_config, name)
|
||||
|
||||
return api
|
||||
|
||||
@property
|
||||
def name(self) -> str:
|
||||
"""exchange Name (from ccxt)"""
|
||||
return self._api.name
|
||||
|
||||
@property
|
||||
def id(self) -> str:
|
||||
"""exchange ccxt id"""
|
||||
return self._api.id
|
||||
|
||||
def klines(self, pair_interval: Tuple[str, str], copy=True) -> DataFrame:
|
||||
# create key tuple
|
||||
if pair_interval in self._klines:
|
||||
return self._klines[pair_interval].copy() if copy else self._klines[pair_interval]
|
||||
else:
|
||||
return DataFrame()
|
||||
|
||||
def set_sandbox(self, api, exchange_config: dict, name: str):
|
||||
if exchange_config.get('sandbox'):
|
||||
if api.urls.get('test'):
|
||||
api.urls['api'] = api.urls['test']
|
||||
logger.info("Enabled Sandbox API on %s", name)
|
||||
else:
|
||||
logger.warning(name, "No Sandbox URL in CCXT, exiting. "
|
||||
"Please check your config.json")
|
||||
raise OperationalException(f'Exchange {name} does not provide a sandbox api')
|
||||
|
||||
def _load_async_markets(self) -> None:
|
||||
try:
|
||||
if self._api_async:
|
||||
asyncio.get_event_loop().run_until_complete(self._api_async.load_markets())
|
||||
|
||||
except ccxt.BaseError as e:
|
||||
logger.warning('Could not load async markets. Reason: %s', e)
|
||||
return
|
||||
|
||||
def _load_markets(self) -> Dict[str, Any]:
|
||||
""" Initialize markets both sync and async """
|
||||
try:
|
||||
markets = self._api.load_markets()
|
||||
self._load_async_markets()
|
||||
return markets
|
||||
except ccxt.BaseError as e:
|
||||
logger.warning('Unable to initialize markets. Reason: %s', e)
|
||||
return {}
|
||||
|
||||
def validate_pairs(self, pairs: List[str]) -> None:
|
||||
"""
|
||||
Checks if all given pairs are tradable on the current exchange.
|
||||
Raises OperationalException if one pair is not available.
|
||||
:param pairs: list of pairs
|
||||
:return: None
|
||||
"""
|
||||
|
||||
if not self.markets:
|
||||
logger.warning('Unable to validate pairs (assuming they are correct).')
|
||||
# return
|
||||
|
||||
stake_cur = self._conf['stake_currency']
|
||||
for pair in pairs:
|
||||
# Note: ccxt has BaseCurrency/QuoteCurrency format for pairs
|
||||
# TODO: add a support for having coins in BTC/USDT format
|
||||
if not pair.endswith(stake_cur):
|
||||
raise OperationalException(
|
||||
f'Pair {pair} not compatible with stake_currency: {stake_cur}')
|
||||
if self.markets and pair not in self.markets:
|
||||
raise OperationalException(
|
||||
f'Pair {pair} is not available at {self.name}'
|
||||
f'Please remove {pair} from your whitelist.')
|
||||
|
||||
def validate_timeframes(self, timeframe: List[str]) -> None:
|
||||
"""
|
||||
Checks if ticker interval from config is a supported timeframe on the exchange
|
||||
"""
|
||||
timeframes = self._api.timeframes
|
||||
if timeframe not in timeframes:
|
||||
raise OperationalException(
|
||||
f'Invalid ticker {timeframe}, this Exchange supports {timeframes}')
|
||||
|
||||
def validate_ordertypes(self, order_types: Dict) -> None:
|
||||
"""
|
||||
Checks if order-types configured in strategy/config are supported
|
||||
"""
|
||||
if any(v == 'market' for k, v in order_types.items()):
|
||||
if not self.exchange_has('createMarketOrder'):
|
||||
raise OperationalException(
|
||||
f'Exchange {self.name} does not support market orders.')
|
||||
|
||||
if order_types.get('stoploss_on_exchange'):
|
||||
if self.name != 'Binance':
|
||||
raise OperationalException(
|
||||
'On exchange stoploss is not supported for %s.' % self.name
|
||||
)
|
||||
|
||||
def validate_order_time_in_force(self, order_time_in_force: Dict) -> None:
|
||||
"""
|
||||
Checks if order time in force configured in strategy/config are supported
|
||||
"""
|
||||
if any(v != 'gtc' for k, v in order_time_in_force.items()):
|
||||
if self.name != 'Binance':
|
||||
raise OperationalException(
|
||||
f'Time in force policies are not supporetd for {self.name} yet.')
|
||||
|
||||
def exchange_has(self, endpoint: str) -> bool:
|
||||
"""
|
||||
Checks if exchange implements a specific API endpoint.
|
||||
Wrapper around ccxt 'has' attribute
|
||||
:param endpoint: Name of endpoint (e.g. 'fetchOHLCV', 'fetchTickers')
|
||||
:return: bool
|
||||
"""
|
||||
return endpoint in self._api.has and self._api.has[endpoint]
|
||||
|
||||
def symbol_amount_prec(self, pair, amount: float):
|
||||
'''
|
||||
Returns the amount to buy or sell to a precision the Exchange accepts
|
||||
Rounded down
|
||||
'''
|
||||
if self._api.markets[pair]['precision']['amount']:
|
||||
symbol_prec = self._api.markets[pair]['precision']['amount']
|
||||
big_amount = amount * pow(10, symbol_prec)
|
||||
amount = floor(big_amount) / pow(10, symbol_prec)
|
||||
return amount
|
||||
|
||||
def symbol_price_prec(self, pair, price: float):
|
||||
'''
|
||||
Returns the price buying or selling with to the precision the Exchange accepts
|
||||
Rounds up
|
||||
'''
|
||||
if self._api.markets[pair]['precision']['price']:
|
||||
symbol_prec = self._api.markets[pair]['precision']['price']
|
||||
big_price = price * pow(10, symbol_prec)
|
||||
price = ceil(big_price) / pow(10, symbol_prec)
|
||||
return price
|
||||
|
||||
def buy(self, pair: str, ordertype: str, amount: float,
|
||||
rate: float, time_in_force) -> Dict:
|
||||
if self._conf['dry_run']:
|
||||
order_id = f'dry_run_buy_{randint(0, 10**6)}'
|
||||
self._dry_run_open_orders[order_id] = {
|
||||
'pair': pair,
|
||||
'price': rate,
|
||||
'amount': amount,
|
||||
'type': ordertype,
|
||||
'side': 'buy',
|
||||
'remaining': 0.0,
|
||||
'datetime': arrow.utcnow().isoformat(),
|
||||
'status': 'closed',
|
||||
'fee': None
|
||||
}
|
||||
return {'id': order_id}
|
||||
|
||||
try:
|
||||
# Set the precision for amount and price(rate) as accepted by the exchange
|
||||
amount = self.symbol_amount_prec(pair, amount)
|
||||
rate = self.symbol_price_prec(pair, rate) if ordertype != 'market' else None
|
||||
|
||||
if time_in_force == 'gtc':
|
||||
return self._api.create_order(pair, ordertype, 'buy', amount, rate)
|
||||
else:
|
||||
return self._api.create_order(pair, ordertype, 'buy',
|
||||
amount, rate, {'timeInForce': time_in_force})
|
||||
|
||||
except ccxt.InsufficientFunds as e:
|
||||
raise DependencyException(
|
||||
f'Insufficient funds to create limit buy order on market {pair}.'
|
||||
f'Tried to buy amount {amount} at rate {rate} (total {rate*amount}).'
|
||||
f'Message: {e}')
|
||||
except ccxt.InvalidOrder as e:
|
||||
raise DependencyException(
|
||||
f'Could not create limit buy order on market {pair}.'
|
||||
f'Tried to buy amount {amount} at rate {rate} (total {rate*amount}).'
|
||||
f'Message: {e}')
|
||||
except (ccxt.NetworkError, ccxt.ExchangeError) as e:
|
||||
raise TemporaryError(
|
||||
f'Could not place buy order due to {e.__class__.__name__}. Message: {e}')
|
||||
except ccxt.BaseError as e:
|
||||
raise OperationalException(e)
|
||||
|
||||
def sell(self, pair: str, ordertype: str, amount: float,
|
||||
rate: float, time_in_force='gtc') -> Dict:
|
||||
if self._conf['dry_run']:
|
||||
order_id = f'dry_run_sell_{randint(0, 10**6)}'
|
||||
self._dry_run_open_orders[order_id] = {
|
||||
'pair': pair,
|
||||
'price': rate,
|
||||
'amount': amount,
|
||||
'type': ordertype,
|
||||
'side': 'sell',
|
||||
'remaining': 0.0,
|
||||
'datetime': arrow.utcnow().isoformat(),
|
||||
'status': 'closed'
|
||||
}
|
||||
return {'id': order_id}
|
||||
|
||||
try:
|
||||
# Set the precision for amount and price(rate) as accepted by the exchange
|
||||
amount = self.symbol_amount_prec(pair, amount)
|
||||
rate = self.symbol_price_prec(pair, rate) if ordertype != 'market' else None
|
||||
|
||||
if time_in_force == 'gtc':
|
||||
return self._api.create_order(pair, ordertype, 'sell', amount, rate)
|
||||
else:
|
||||
return self._api.create_order(pair, ordertype, 'sell',
|
||||
amount, rate, {'timeInForce': time_in_force})
|
||||
|
||||
except ccxt.InsufficientFunds as e:
|
||||
raise DependencyException(
|
||||
f'Insufficient funds to create limit sell order on market {pair}.'
|
||||
f'Tried to sell amount {amount} at rate {rate} (total {rate*amount}).'
|
||||
f'Message: {e}')
|
||||
except ccxt.InvalidOrder as e:
|
||||
raise DependencyException(
|
||||
f'Could not create limit sell order on market {pair}.'
|
||||
f'Tried to sell amount {amount} at rate {rate} (total {rate*amount}).'
|
||||
f'Message: {e}')
|
||||
except (ccxt.NetworkError, ccxt.ExchangeError) as e:
|
||||
raise TemporaryError(
|
||||
f'Could not place sell order due to {e.__class__.__name__}. Message: {e}')
|
||||
except ccxt.BaseError as e:
|
||||
raise OperationalException(e)
|
||||
|
||||
def stoploss_limit(self, pair: str, amount: float, stop_price: float, rate: float) -> Dict:
|
||||
"""
|
||||
creates a stoploss limit order.
|
||||
NOTICE: it is not supported by all exchanges. only binance is tested for now.
|
||||
"""
|
||||
|
||||
# Set the precision for amount and price(rate) as accepted by the exchange
|
||||
amount = self.symbol_amount_prec(pair, amount)
|
||||
rate = self.symbol_price_prec(pair, rate)
|
||||
stop_price = self.symbol_price_prec(pair, stop_price)
|
||||
|
||||
# Ensure rate is less than stop price
|
||||
if stop_price <= rate:
|
||||
raise OperationalException(
|
||||
'In stoploss limit order, stop price should be more than limit price')
|
||||
|
||||
if self._conf['dry_run']:
|
||||
order_id = f'dry_run_buy_{randint(0, 10**6)}'
|
||||
self._dry_run_open_orders[order_id] = {
|
||||
'info': {},
|
||||
'id': order_id,
|
||||
'pair': pair,
|
||||
'price': stop_price,
|
||||
'amount': amount,
|
||||
'type': 'stop_loss_limit',
|
||||
'side': 'sell',
|
||||
'remaining': amount,
|
||||
'datetime': arrow.utcnow().isoformat(),
|
||||
'status': 'open',
|
||||
'fee': None
|
||||
}
|
||||
return self._dry_run_open_orders[order_id]
|
||||
|
||||
try:
|
||||
order = self._api.create_order(pair, 'stop_loss_limit', 'sell',
|
||||
amount, rate, {'stopPrice': stop_price})
|
||||
logger.info('stoploss limit order added for %s. '
|
||||
'stop price: %s. limit: %s' % (pair, stop_price, rate))
|
||||
return order
|
||||
|
||||
except ccxt.InsufficientFunds as e:
|
||||
raise DependencyException(
|
||||
f'Insufficient funds to place stoploss limit order on market {pair}. '
|
||||
f'Tried to put a stoploss amount {amount} with '
|
||||
f'stop {stop_price} and limit {rate} (total {rate*amount}).'
|
||||
f'Message: {e}')
|
||||
except ccxt.InvalidOrder as e:
|
||||
raise DependencyException(
|
||||
f'Could not place stoploss limit order on market {pair}.'
|
||||
f'Tried to place stoploss amount {amount} with '
|
||||
f'stop {stop_price} and limit {rate} (total {rate*amount}).'
|
||||
f'Message: {e}')
|
||||
except (ccxt.NetworkError, ccxt.ExchangeError) as e:
|
||||
raise TemporaryError(
|
||||
f'Could not place stoploss limit order due to {e.__class__.__name__}. Message: {e}')
|
||||
except ccxt.BaseError as e:
|
||||
raise OperationalException(e)
|
||||
|
||||
@retrier
|
||||
def get_balance(self, currency: str) -> float:
|
||||
if self._conf['dry_run']:
|
||||
return 999.9
|
||||
|
||||
# ccxt exception is already handled by get_balances
|
||||
balances = self.get_balances()
|
||||
balance = balances.get(currency)
|
||||
if balance is None:
|
||||
raise TemporaryError(
|
||||
f'Could not get {currency} balance due to malformed exchange response: {balances}')
|
||||
return balance['free']
|
||||
|
||||
@retrier
|
||||
def get_balances(self) -> dict:
|
||||
if self._conf['dry_run']:
|
||||
return {}
|
||||
|
||||
try:
|
||||
balances = self._api.fetch_balance()
|
||||
# Remove additional info from ccxt results
|
||||
balances.pop("info", None)
|
||||
balances.pop("free", None)
|
||||
balances.pop("total", None)
|
||||
balances.pop("used", None)
|
||||
|
||||
return balances
|
||||
except (ccxt.NetworkError, ccxt.ExchangeError) as e:
|
||||
raise TemporaryError(
|
||||
f'Could not get balance due to {e.__class__.__name__}. Message: {e}')
|
||||
except ccxt.BaseError as e:
|
||||
raise OperationalException(e)
|
||||
|
||||
@retrier
|
||||
def get_tickers(self) -> Dict:
|
||||
try:
|
||||
return self._api.fetch_tickers()
|
||||
except ccxt.NotSupported as e:
|
||||
raise OperationalException(
|
||||
f'Exchange {self._api.name} does not support fetching tickers in batch.'
|
||||
f'Message: {e}')
|
||||
except (ccxt.NetworkError, ccxt.ExchangeError) as e:
|
||||
raise TemporaryError(
|
||||
f'Could not load tickers due to {e.__class__.__name__}. Message: {e}')
|
||||
except ccxt.BaseError as e:
|
||||
raise OperationalException(e)
|
||||
|
||||
@retrier
|
||||
def get_ticker(self, pair: str, refresh: Optional[bool] = True) -> dict:
|
||||
if refresh or pair not in self._cached_ticker.keys():
|
||||
try:
|
||||
if pair not in self._api.markets:
|
||||
raise DependencyException(f"Pair {pair} not available")
|
||||
data = self._api.fetch_ticker(pair)
|
||||
try:
|
||||
self._cached_ticker[pair] = {
|
||||
'bid': float(data['bid']),
|
||||
'ask': float(data['ask']),
|
||||
}
|
||||
except KeyError:
|
||||
logger.debug("Could not cache ticker data for %s", pair)
|
||||
return data
|
||||
except (ccxt.NetworkError, ccxt.ExchangeError) as e:
|
||||
raise TemporaryError(
|
||||
f'Could not load ticker due to {e.__class__.__name__}. Message: {e}')
|
||||
except ccxt.BaseError as e:
|
||||
raise OperationalException(e)
|
||||
else:
|
||||
logger.info("returning cached ticker-data for %s", pair)
|
||||
return self._cached_ticker[pair]
|
||||
|
||||
def get_history(self, pair: str, tick_interval: str,
|
||||
since_ms: int) -> List:
|
||||
"""
|
||||
Gets candle history using asyncio and returns the list of candles.
|
||||
Handles all async doing.
|
||||
"""
|
||||
return asyncio.get_event_loop().run_until_complete(
|
||||
self._async_get_history(pair=pair, tick_interval=tick_interval,
|
||||
since_ms=since_ms))
|
||||
|
||||
async def _async_get_history(self, pair: str,
|
||||
tick_interval: str,
|
||||
since_ms: int) -> List:
|
||||
# Assume exchange returns 500 candles
|
||||
_LIMIT = 500
|
||||
|
||||
one_call = constants.TICKER_INTERVAL_MINUTES[tick_interval] * 60 * _LIMIT * 1000
|
||||
logger.debug("one_call: %s", one_call)
|
||||
input_coroutines = [self._async_get_candle_history(
|
||||
pair, tick_interval, since) for since in
|
||||
range(since_ms, arrow.utcnow().timestamp * 1000, one_call)]
|
||||
|
||||
tickers = await asyncio.gather(*input_coroutines, return_exceptions=True)
|
||||
|
||||
# Combine tickers
|
||||
data: List = []
|
||||
for p, ticker_interval, ticker in tickers:
|
||||
if p == pair:
|
||||
data.extend(ticker)
|
||||
# Sort data again after extending the result - above calls return in "async order"
|
||||
data = sorted(data, key=lambda x: x[0])
|
||||
logger.info("downloaded %s with length %s.", pair, len(data))
|
||||
return data
|
||||
|
||||
def refresh_latest_ohlcv(self, pair_list: List[Tuple[str, str]]) -> List[Tuple[str, List]]:
|
||||
"""
|
||||
Refresh in-memory ohlcv asyncronously and set `_klines` with the result
|
||||
"""
|
||||
logger.debug("Refreshing ohlcv data for %d pairs", len(pair_list))
|
||||
|
||||
input_coroutines = []
|
||||
|
||||
# Gather corotines to run
|
||||
for pair, ticker_interval in set(pair_list):
|
||||
# Calculating ticker interval in second
|
||||
interval_in_sec = constants.TICKER_INTERVAL_MINUTES[ticker_interval] * 60
|
||||
|
||||
if not ((self._pairs_last_refresh_time.get((pair, ticker_interval), 0)
|
||||
+ interval_in_sec) >= arrow.utcnow().timestamp
|
||||
and (pair, ticker_interval) in self._klines):
|
||||
input_coroutines.append(self._async_get_candle_history(pair, ticker_interval))
|
||||
else:
|
||||
logger.debug("Using cached ohlcv data for %s, %s ...", pair, ticker_interval)
|
||||
|
||||
tickers = asyncio.get_event_loop().run_until_complete(
|
||||
asyncio.gather(*input_coroutines, return_exceptions=True))
|
||||
|
||||
# handle caching
|
||||
for res in tickers:
|
||||
if isinstance(res, Exception):
|
||||
logger.warning("Async code raised an exception: %s", res.__class__.__name__)
|
||||
continue
|
||||
pair = res[0]
|
||||
tick_interval = res[1]
|
||||
ticks = res[2]
|
||||
# keeping last candle time as last refreshed time of the pair
|
||||
if ticks:
|
||||
self._pairs_last_refresh_time[(pair, tick_interval)] = ticks[-1][0] // 1000
|
||||
# keeping parsed dataframe in cache
|
||||
self._klines[(pair, tick_interval)] = parse_ticker_dataframe(
|
||||
ticks, tick_interval, fill_missing=True)
|
||||
return tickers
|
||||
|
||||
@retrier_async
|
||||
async def _async_get_candle_history(self, pair: str, tick_interval: str,
|
||||
since_ms: Optional[int] = None) -> Tuple[str, str, List]:
|
||||
"""
|
||||
Asyncronously gets candle histories using fetch_ohlcv
|
||||
returns tuple: (pair, tick_interval, ohlcv_list)
|
||||
"""
|
||||
try:
|
||||
# fetch ohlcv asynchronously
|
||||
logger.debug("fetching %s, %s since %s ...", pair, tick_interval, since_ms)
|
||||
|
||||
data = await self._api_async.fetch_ohlcv(pair, timeframe=tick_interval,
|
||||
since=since_ms)
|
||||
|
||||
# Because some exchange sort Tickers ASC and other DESC.
|
||||
# Ex: Bittrex returns a list of tickers ASC (oldest first, newest last)
|
||||
# when GDAX returns a list of tickers DESC (newest first, oldest last)
|
||||
# Only sort if necessary to save computing time
|
||||
try:
|
||||
if data and data[0][0] > data[-1][0]:
|
||||
data = sorted(data, key=lambda x: x[0])
|
||||
except IndexError:
|
||||
logger.exception("Error loading %s. Result was %s.", pair, data)
|
||||
return pair, tick_interval, []
|
||||
logger.debug("done fetching %s, %s ...", pair, tick_interval)
|
||||
return pair, tick_interval, data
|
||||
|
||||
except ccxt.NotSupported as e:
|
||||
raise OperationalException(
|
||||
f'Exchange {self._api.name} does not support fetching historical candlestick data.'
|
||||
f'Message: {e}')
|
||||
except (ccxt.NetworkError, ccxt.ExchangeError) as e:
|
||||
raise TemporaryError(
|
||||
f'Could not load ticker history due to {e.__class__.__name__}. Message: {e}')
|
||||
except ccxt.BaseError as e:
|
||||
raise OperationalException(f'Could not fetch ticker data. Msg: {e}')
|
||||
|
||||
@retrier
|
||||
def cancel_order(self, order_id: str, pair: str) -> None:
|
||||
if self._conf['dry_run']:
|
||||
return
|
||||
|
||||
try:
|
||||
return self._api.cancel_order(order_id, pair)
|
||||
except ccxt.InvalidOrder as e:
|
||||
raise DependencyException(
|
||||
f'Could not cancel order. Message: {e}')
|
||||
except (ccxt.NetworkError, ccxt.ExchangeError) as e:
|
||||
raise TemporaryError(
|
||||
f'Could not cancel order due to {e.__class__.__name__}. Message: {e}')
|
||||
except ccxt.BaseError as e:
|
||||
raise OperationalException(e)
|
||||
|
||||
@retrier
|
||||
def get_order(self, order_id: str, pair: str) -> Dict:
|
||||
if self._conf['dry_run']:
|
||||
order = self._dry_run_open_orders[order_id]
|
||||
order.update({
|
||||
'id': order_id
|
||||
})
|
||||
return order
|
||||
try:
|
||||
return self._api.fetch_order(order_id, pair)
|
||||
except ccxt.InvalidOrder as e:
|
||||
raise DependencyException(
|
||||
f'Could not get order. Message: {e}')
|
||||
except (ccxt.NetworkError, ccxt.ExchangeError) as e:
|
||||
raise TemporaryError(
|
||||
f'Could not get order due to {e.__class__.__name__}. Message: {e}')
|
||||
except ccxt.BaseError as e:
|
||||
raise OperationalException(e)
|
||||
|
||||
@retrier
|
||||
def get_order_book(self, pair: str, limit: int = 100) -> dict:
|
||||
"""
|
||||
get order book level 2 from exchange
|
||||
|
||||
Notes:
|
||||
20180619: bittrex doesnt support limits -.-
|
||||
20180619: binance support limits but only on specific range
|
||||
"""
|
||||
try:
|
||||
if self._api.name == 'Binance':
|
||||
limit_range = [5, 10, 20, 50, 100, 500, 1000]
|
||||
# get next-higher step in the limit_range list
|
||||
limit = min(list(filter(lambda x: limit <= x, limit_range)))
|
||||
# above script works like loop below (but with slightly better performance):
|
||||
# for limitx in limit_range:
|
||||
# if limit <= limitx:
|
||||
# limit = limitx
|
||||
# break
|
||||
|
||||
return self._api.fetch_l2_order_book(pair, limit)
|
||||
except ccxt.NotSupported as e:
|
||||
raise OperationalException(
|
||||
f'Exchange {self._api.name} does not support fetching order book.'
|
||||
f'Message: {e}')
|
||||
except (ccxt.NetworkError, ccxt.ExchangeError) as e:
|
||||
raise TemporaryError(
|
||||
f'Could not get order book due to {e.__class__.__name__}. Message: {e}')
|
||||
except ccxt.BaseError as e:
|
||||
raise OperationalException(e)
|
||||
|
||||
@retrier
|
||||
def get_trades_for_order(self, order_id: str, pair: str, since: datetime) -> List:
|
||||
if self._conf['dry_run']:
|
||||
return []
|
||||
if not self.exchange_has('fetchMyTrades'):
|
||||
return []
|
||||
try:
|
||||
# Allow 5s offset to catch slight time offsets (discovered in #1185)
|
||||
my_trades = self._api.fetch_my_trades(pair, since.timestamp() - 5)
|
||||
matched_trades = [trade for trade in my_trades if trade['order'] == order_id]
|
||||
|
||||
return matched_trades
|
||||
|
||||
except ccxt.NetworkError as e:
|
||||
raise TemporaryError(
|
||||
f'Could not get trades due to networking error. Message: {e}')
|
||||
except ccxt.BaseError as e:
|
||||
raise OperationalException(e)
|
||||
|
||||
def get_pair_detail_url(self, pair: str) -> str:
|
||||
try:
|
||||
url_base = self._api.urls.get('www')
|
||||
base, quote = pair.split('/')
|
||||
|
||||
return url_base + _EXCHANGE_URLS[self._api.id].format(base=base, quote=quote)
|
||||
except KeyError:
|
||||
logger.warning('Could not get exchange url for %s', self.name)
|
||||
return ""
|
||||
|
||||
@retrier
|
||||
def get_markets(self) -> List[dict]:
|
||||
try:
|
||||
return self._api.fetch_markets()
|
||||
except (ccxt.NetworkError, ccxt.ExchangeError) as e:
|
||||
raise TemporaryError(
|
||||
f'Could not load markets due to {e.__class__.__name__}. Message: {e}')
|
||||
except ccxt.BaseError as e:
|
||||
raise OperationalException(e)
|
||||
|
||||
@retrier
|
||||
def get_fee(self, symbol='ETH/BTC', type='', side='', amount=1,
|
||||
price=1, taker_or_maker='maker') -> float:
|
||||
try:
|
||||
# validate that markets are loaded before trying to get fee
|
||||
if self._api.markets is None or len(self._api.markets) == 0:
|
||||
self._api.load_markets()
|
||||
|
||||
return self._api.calculate_fee(symbol=symbol, type=type, side=side, amount=amount,
|
||||
price=price, takerOrMaker=taker_or_maker)['rate']
|
||||
except (ccxt.NetworkError, ccxt.ExchangeError) as e:
|
||||
raise TemporaryError(
|
||||
f'Could not get fee info due to {e.__class__.__name__}. Message: {e}')
|
||||
except ccxt.BaseError as e:
|
||||
raise OperationalException(e)
|
||||
from freqtrade.exchange.common import MAP_EXCHANGE_CHILDCLASS # noqa: F401
|
||||
from freqtrade.exchange.exchange import Exchange # noqa: F401
|
||||
from freqtrade.exchange.exchange import (get_exchange_bad_reason, # noqa: F401
|
||||
is_exchange_bad,
|
||||
is_exchange_known_ccxt,
|
||||
is_exchange_officially_supported,
|
||||
ccxt_exchanges,
|
||||
available_exchanges)
|
||||
from freqtrade.exchange.exchange import (timeframe_to_seconds, # noqa: F401
|
||||
timeframe_to_minutes,
|
||||
timeframe_to_msecs,
|
||||
timeframe_to_next_date,
|
||||
timeframe_to_prev_date)
|
||||
from freqtrade.exchange.exchange import (market_is_active, # noqa: F401
|
||||
symbol_is_pair)
|
||||
from freqtrade.exchange.kraken import Kraken # noqa: F401
|
||||
from freqtrade.exchange.binance import Binance # noqa: F401
|
||||
from freqtrade.exchange.bibox import Bibox # noqa: F401
|
||||
|
||||
22
freqtrade/exchange/bibox.py
Normal file
22
freqtrade/exchange/bibox.py
Normal file
@@ -0,0 +1,22 @@
|
||||
""" Bibox exchange subclass """
|
||||
import logging
|
||||
from typing import Dict
|
||||
|
||||
from freqtrade.exchange import Exchange
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Bibox(Exchange):
|
||||
"""
|
||||
Bibox exchange class. Contains adjustments needed for Freqtrade to work
|
||||
with this exchange.
|
||||
|
||||
Please note that this exchange is not included in the list of exchanges
|
||||
officially supported by the Freqtrade development team. So some features
|
||||
may still not work as expected.
|
||||
"""
|
||||
|
||||
# fetchCurrencies API point requires authentication for Bibox,
|
||||
# so switch it off for Freqtrade load_markets()
|
||||
_ccxt_config: Dict = {"has": {"fetchCurrencies": False}}
|
||||
85
freqtrade/exchange/binance.py
Normal file
85
freqtrade/exchange/binance.py
Normal file
@@ -0,0 +1,85 @@
|
||||
""" Binance exchange subclass """
|
||||
import logging
|
||||
from typing import Dict
|
||||
|
||||
import ccxt
|
||||
|
||||
from freqtrade.exceptions import (DependencyException, InvalidOrderException,
|
||||
OperationalException, TemporaryError)
|
||||
from freqtrade.exchange import Exchange
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Binance(Exchange):
|
||||
|
||||
_ft_has: Dict = {
|
||||
"stoploss_on_exchange": True,
|
||||
"order_time_in_force": ['gtc', 'fok', 'ioc'],
|
||||
"trades_pagination": "id",
|
||||
"trades_pagination_arg": "fromId",
|
||||
}
|
||||
|
||||
def get_order_book(self, pair: str, limit: int = 100) -> dict:
|
||||
"""
|
||||
get order book level 2 from exchange
|
||||
|
||||
20180619: binance support limits but only on specific range
|
||||
"""
|
||||
limit_range = [5, 10, 20, 50, 100, 500, 1000]
|
||||
# get next-higher step in the limit_range list
|
||||
limit = min(list(filter(lambda x: limit <= x, limit_range)))
|
||||
|
||||
return super().get_order_book(pair, limit)
|
||||
|
||||
def stoploss_limit(self, pair: str, amount: float, stop_price: float, rate: float) -> Dict:
|
||||
"""
|
||||
creates a stoploss limit order.
|
||||
this stoploss-limit is binance-specific.
|
||||
It may work with a limited number of other exchanges, but this has not been tested yet.
|
||||
|
||||
"""
|
||||
ordertype = "stop_loss_limit"
|
||||
|
||||
stop_price = self.price_to_precision(pair, stop_price)
|
||||
|
||||
# Ensure rate is less than stop price
|
||||
if stop_price <= rate:
|
||||
raise OperationalException(
|
||||
'In stoploss limit order, stop price should be more than limit price')
|
||||
|
||||
if self._config['dry_run']:
|
||||
dry_order = self.dry_run_order(
|
||||
pair, ordertype, "sell", amount, stop_price)
|
||||
return dry_order
|
||||
|
||||
try:
|
||||
params = self._params.copy()
|
||||
params.update({'stopPrice': stop_price})
|
||||
|
||||
amount = self.amount_to_precision(pair, amount)
|
||||
|
||||
rate = self.price_to_precision(pair, rate)
|
||||
|
||||
order = self._api.create_order(pair, ordertype, 'sell',
|
||||
amount, rate, params)
|
||||
logger.info('stoploss limit order added for %s. '
|
||||
'stop price: %s. limit: %s', pair, stop_price, rate)
|
||||
return order
|
||||
except ccxt.InsufficientFunds as e:
|
||||
raise DependencyException(
|
||||
f'Insufficient funds to create {ordertype} sell order on market {pair}.'
|
||||
f'Tried to sell amount {amount} at rate {rate}. '
|
||||
f'Message: {e}') from e
|
||||
except ccxt.InvalidOrder as e:
|
||||
# Errors:
|
||||
# `binance Order would trigger immediately.`
|
||||
raise InvalidOrderException(
|
||||
f'Could not create {ordertype} sell order on market {pair}. '
|
||||
f'Tried to sell amount {amount} at rate {rate}. '
|
||||
f'Message: {e}') from e
|
||||
except (ccxt.NetworkError, ccxt.ExchangeError) as e:
|
||||
raise TemporaryError(
|
||||
f'Could not place sell order due to {e.__class__.__name__}. Message: {e}') from e
|
||||
except ccxt.BaseError as e:
|
||||
raise OperationalException(e) from e
|
||||
124
freqtrade/exchange/common.py
Normal file
124
freqtrade/exchange/common.py
Normal file
@@ -0,0 +1,124 @@
|
||||
import logging
|
||||
|
||||
from freqtrade.exceptions import DependencyException, TemporaryError
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
API_RETRY_COUNT = 4
|
||||
BAD_EXCHANGES = {
|
||||
"bitmex": "Various reasons.",
|
||||
"bitstamp": "Does not provide history. "
|
||||
"Details in https://github.com/freqtrade/freqtrade/issues/1983",
|
||||
"hitbtc": "This API cannot be used with Freqtrade. "
|
||||
"Use `hitbtc2` exchange id to access this exchange.",
|
||||
**dict.fromkeys([
|
||||
'adara',
|
||||
'anxpro',
|
||||
'bigone',
|
||||
'coinbase',
|
||||
'coinexchange',
|
||||
'coinmarketcap',
|
||||
'lykke',
|
||||
'xbtce',
|
||||
], "Does not provide timeframes. ccxt fetchOHLCV: False"),
|
||||
**dict.fromkeys([
|
||||
'bcex',
|
||||
'bit2c',
|
||||
'bitbay',
|
||||
'bitflyer',
|
||||
'bitforex',
|
||||
'bithumb',
|
||||
'bitso',
|
||||
'bitstamp1',
|
||||
'bl3p',
|
||||
'braziliex',
|
||||
'btcbox',
|
||||
'btcchina',
|
||||
'btctradeim',
|
||||
'btctradeua',
|
||||
'bxinth',
|
||||
'chilebit',
|
||||
'coincheck',
|
||||
'coinegg',
|
||||
'coinfalcon',
|
||||
'coinfloor',
|
||||
'coingi',
|
||||
'coinmate',
|
||||
'coinone',
|
||||
'coinspot',
|
||||
'coolcoin',
|
||||
'crypton',
|
||||
'deribit',
|
||||
'exmo',
|
||||
'exx',
|
||||
'flowbtc',
|
||||
'foxbit',
|
||||
'fybse',
|
||||
# 'hitbtc',
|
||||
'ice3x',
|
||||
'independentreserve',
|
||||
'indodax',
|
||||
'itbit',
|
||||
'lakebtc',
|
||||
'latoken',
|
||||
'liquid',
|
||||
'livecoin',
|
||||
'luno',
|
||||
'mixcoins',
|
||||
'negociecoins',
|
||||
'nova',
|
||||
'paymium',
|
||||
'southxchange',
|
||||
'stronghold',
|
||||
'surbitcoin',
|
||||
'therock',
|
||||
'tidex',
|
||||
'vaultoro',
|
||||
'vbtc',
|
||||
'virwox',
|
||||
'yobit',
|
||||
'zaif',
|
||||
], "Does not provide timeframes. ccxt fetchOHLCV: emulated"),
|
||||
}
|
||||
|
||||
MAP_EXCHANGE_CHILDCLASS = {
|
||||
'binanceus': 'binance',
|
||||
'binanceje': 'binance',
|
||||
}
|
||||
|
||||
|
||||
def retrier_async(f):
|
||||
async def wrapper(*args, **kwargs):
|
||||
count = kwargs.pop('count', API_RETRY_COUNT)
|
||||
try:
|
||||
return await f(*args, **kwargs)
|
||||
except (TemporaryError, DependencyException) as ex:
|
||||
logger.warning('%s() returned exception: "%s"', f.__name__, ex)
|
||||
if count > 0:
|
||||
count -= 1
|
||||
kwargs.update({'count': count})
|
||||
logger.warning('retrying %s() still for %s times', f.__name__, count)
|
||||
return await wrapper(*args, **kwargs)
|
||||
else:
|
||||
logger.warning('Giving up retrying: %s()', f.__name__)
|
||||
raise ex
|
||||
return wrapper
|
||||
|
||||
|
||||
def retrier(f):
|
||||
def wrapper(*args, **kwargs):
|
||||
count = kwargs.pop('count', API_RETRY_COUNT)
|
||||
try:
|
||||
return f(*args, **kwargs)
|
||||
except (TemporaryError, DependencyException) as ex:
|
||||
logger.warning('%s() returned exception: "%s"', f.__name__, ex)
|
||||
if count > 0:
|
||||
count -= 1
|
||||
kwargs.update({'count': count})
|
||||
logger.warning('retrying %s() still for %s times', f.__name__, count)
|
||||
return wrapper(*args, **kwargs)
|
||||
else:
|
||||
logger.warning('Giving up retrying: %s()', f.__name__)
|
||||
raise ex
|
||||
return wrapper
|
||||
1099
freqtrade/exchange/exchange.py
Normal file
1099
freqtrade/exchange/exchange.py
Normal file
File diff suppressed because it is too large
Load Diff
50
freqtrade/exchange/kraken.py
Normal file
50
freqtrade/exchange/kraken.py
Normal file
@@ -0,0 +1,50 @@
|
||||
""" Kraken exchange subclass """
|
||||
import logging
|
||||
from typing import Dict
|
||||
|
||||
import ccxt
|
||||
|
||||
from freqtrade.exceptions import OperationalException, TemporaryError
|
||||
from freqtrade.exchange import Exchange
|
||||
from freqtrade.exchange.exchange import retrier
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Kraken(Exchange):
|
||||
|
||||
_params: Dict = {"trading_agreement": "agree"}
|
||||
_ft_has: Dict = {
|
||||
"trades_pagination": "id",
|
||||
"trades_pagination_arg": "since",
|
||||
}
|
||||
|
||||
@retrier
|
||||
def get_balances(self) -> dict:
|
||||
if self._config['dry_run']:
|
||||
return {}
|
||||
|
||||
try:
|
||||
balances = self._api.fetch_balance()
|
||||
# Remove additional info from ccxt results
|
||||
balances.pop("info", None)
|
||||
balances.pop("free", None)
|
||||
balances.pop("total", None)
|
||||
balances.pop("used", None)
|
||||
|
||||
orders = self._api.fetch_open_orders()
|
||||
order_list = [(x["symbol"].split("/")[0 if x["side"] == "sell" else 1],
|
||||
x["remaining"],
|
||||
# Don't remove the below comment, this can be important for debuggung
|
||||
# x["side"], x["amount"],
|
||||
) for x in orders]
|
||||
for bal in balances:
|
||||
balances[bal]['used'] = sum(order[1] for order in order_list if order[0] == bal)
|
||||
balances[bal]['free'] = balances[bal]['total'] - balances[bal]['used']
|
||||
|
||||
return balances
|
||||
except (ccxt.NetworkError, ccxt.ExchangeError) as e:
|
||||
raise TemporaryError(
|
||||
f'Could not get balance due to {e.__class__.__name__}. Message: {e}') from e
|
||||
except ccxt.BaseError as e:
|
||||
raise OperationalException(e) from e
|
||||
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user