Compare commits
597 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4c9e608a1a | |||
| 90665731c1 | |||
| 7a9ea40d72 | |||
| c66e221012 | |||
| f38d2466df | |||
| 1cc92c645a | |||
| ab764df411 | |||
| 87c5f89b6c | |||
| 780c794ef0 | |||
| 8b4070dbcf | |||
| 4e089fd17e | |||
| f454006ec3 | |||
| f5002929ee | |||
| 4e1d75a3e1 | |||
| d4462ba5d8 | |||
| 6dc71269a2 | |||
| 730ccba535 | |||
| 1175721579 | |||
| e5157d5471 | |||
| 7fcb23e0c7 | |||
| f075d90d99 | |||
| bf94748058 | |||
| 2890d13d92 | |||
| 9232778732 | |||
| 70a25f9837 | |||
| 4434df1999 | |||
| b9e9f6f040 | |||
| f92caf0f1f | |||
| 55b90917e4 | |||
| d0546e998a | |||
| e9f414b29c | |||
| 7638261e8f | |||
| a049d6eab1 | |||
| 61f46b959e | |||
| ccb1e4af02 | |||
| 06424cae28 | |||
| 9aeb2eaabd | |||
| c6061daec4 | |||
| 5be0352705 | |||
| 06995f26fd | |||
| 7b45844670 | |||
| 0a0c2adf7d | |||
| 7aab3b34d6 | |||
| c4aa221c9b | |||
| da12071d8f | |||
| 581a9bb1c9 | |||
| f5258510cc | |||
| 99401f9d69 | |||
| 729bea2d8e | |||
| 8b72e4f23e | |||
| 17202c6d29 | |||
| 567d4331fd | |||
| 92c9f443e8 | |||
| dd2d7bb863 | |||
| 9c0d612729 | |||
| 07d5636d1e | |||
| 977cabb580 | |||
| 15a7e1d9d1 | |||
| 953ffcf204 | |||
| b24e6e72c7 | |||
| 82b05f6b5a | |||
| a662802011 | |||
| 5483ade786 | |||
| ae02a7007b | |||
| 3c6e058b00 | |||
| ad3ddcaadb | |||
| be56052417 | |||
| 9a888d9896 | |||
| 24a7e585e4 | |||
| 2120f1ed5b | |||
| 3a2bb22cb3 | |||
| a7c4ec6eaf | |||
| f7b934b306 | |||
| d34e7a1e8e | |||
| 4804ec986a | |||
| 16117e5b6c | |||
| 985805e0d5 | |||
| 78acaf8f4c | |||
| a1dad065b2 | |||
| 3b03d4346c | |||
| c6551819cd | |||
| e58635a881 | |||
| 8e3331d0db | |||
| 8391a0612d | |||
| 68c00d1c4d | |||
| f48f24ce2e | |||
| 9d5a88416a | |||
| a314786056 | |||
| aee9b2c749 | |||
| 3fffee3b05 | |||
| 72abae7b94 | |||
| a300df7ff3 | |||
| 8e500d4601 | |||
| f6e1442fdf | |||
| d8d8260d76 | |||
| 72dd0d062b | |||
| 03c67d6a3b | |||
| 314cd10e27 | |||
| 6e6a929fac | |||
| d069f5477e | |||
| a4a5fbe4a8 | |||
| 01e288297a | |||
| 7564b1e6df | |||
| cf010c3f17 | |||
| 5ff95db9e1 | |||
| ada72d2264 | |||
| 9f436dcd1e | |||
| 95a710d4a8 | |||
| bf5d300a54 | |||
| f7a1325339 | |||
| e13152715c | |||
| 19a35ed111 | |||
| e62ba8ed1e | |||
| f62ded94bb | |||
| 74f459d7ed | |||
| 815a351435 | |||
| 9857f30703 | |||
| a7de2cf682 | |||
| 5e2f4924d6 | |||
| b74a334f25 | |||
| 58c9a61cf0 | |||
| d5620cf8b5 | |||
| 2e50c100f9 | |||
| 776d9ac5e0 | |||
| 301e348789 | |||
| 6467d85059 | |||
| 4b4d090d39 | |||
| 2ddafa28f2 | |||
| d6bb47816c | |||
| f40d90cf08 | |||
| ab7c1ec24f | |||
| be5969a1e1 | |||
| 992d173adc | |||
| 5396519b20 | |||
| d8122f5d33 | |||
| 92f8b2dd02 | |||
| 29e35cf824 | |||
| 26ff88c71a | |||
| 7b3951f1e5 | |||
| 5dbfc92c5a | |||
| a14281722a | |||
| a80f3ae919 | |||
| 5f558137d3 | |||
| ecd66f8a64 | |||
| 8d965d4833 | |||
| 25a3de653c | |||
| ac519a273b | |||
| 68429f9c37 | |||
| 5cb41badc1 | |||
| 54bebeabb7 | |||
| 3a17c2b55c | |||
| 7b7b8b8f8b | |||
| 55201b6224 | |||
| 49b9296cd9 | |||
| 09fabd911e | |||
| 43be752847 | |||
| 6cfd31c705 | |||
| 3bce9278bd | |||
| 068caf159d | |||
| eb8875b64b | |||
| 97578c0831 | |||
| 7219f71bc1 | |||
| eea9133b3f | |||
| a8f543ce62 | |||
| b35172a3b8 | |||
| 7b8f0583a4 | |||
| 7ae89711dd | |||
| a2c3729254 | |||
| 14c9f783d5 | |||
| 6c9c709c65 | |||
| 1c2ffc6aaa | |||
| a6d2bc5238 | |||
| 737d2804d2 | |||
| 3e14c2664e | |||
| 78bd8554aa | |||
| f1d5679fba | |||
| a9e82b7fc2 | |||
| 21f77f9c5d | |||
| c4c0198d20 | |||
| d72d13ed58 | |||
| 5ea0705547 | |||
| 575b50deda | |||
| a0d1a04605 | |||
| aa4704e37d | |||
| 4143a2559a | |||
| 693a8fa979 | |||
| 6ec639d347 | |||
| 52d5d35afb | |||
| 8a21cc6d18 | |||
| b6bedf20ce | |||
| 9f02279d5a | |||
| 6f9906e935 | |||
| e934c3934d | |||
| d6f78e4cc8 | |||
| f9cc05b202 | |||
| 76eb92b821 | |||
| e749051dbc | |||
| 6de7c70e7e | |||
| 74f52b14cd | |||
| e33363bf6c | |||
| 7d77e63b81 | |||
| cfa855dec8 | |||
| 34a72a0555 | |||
| a9db7d0286 | |||
| 19140e9cfa | |||
| b0c3f2ff7f | |||
| 8686b56b9e | |||
| 6ab731acdb | |||
| 8ca63cf0ee | |||
| 5774c08b4a | |||
| b731cdef56 | |||
| b51c93fbc1 | |||
| e948839fb5 | |||
| 587ec513db | |||
| efed5700be | |||
| 5ddaea7efc | |||
| 66577b741f | |||
| 09017980b6 | |||
| 3a7721ebe8 | |||
| 35cc3efd5a | |||
| 95ad756909 | |||
| 816ca2ea15 | |||
| 246891a8f6 | |||
| 25fd63c6d0 | |||
| cadbbd0e2e | |||
| 65b83c46fb | |||
| 31204a37a5 | |||
| 67774c71e5 | |||
| 44b65daf1c | |||
| 48ff0c5744 | |||
| 3934aa118f | |||
| d40efb883c | |||
| 84ec09565a | |||
| 387431e4df | |||
| 662747c06c | |||
| 89272e9ddb | |||
| 23d4d25e39 | |||
| 488a608c90 | |||
| a94d18a10b | |||
| 94aba0f9ac | |||
| 35c3ca91eb | |||
| 53328bc595 | |||
| bb7a4c4739 | |||
| 7d38963c61 | |||
| a7e7c17134 | |||
| 0544af1f68 | |||
| ba87f3e7d7 | |||
| b60a3802e7 | |||
| 4beb6a8049 | |||
| bd10afc796 | |||
| 2868efa779 | |||
| fe466e2e86 | |||
| 6c5771b40c | |||
| 5c81d31bd1 | |||
| b1b3b42489 | |||
| 5b03fc1a89 | |||
| dd73c724c4 | |||
| 5cbcd68446 | |||
| 3bc1afd149 | |||
| 877761ecd3 | |||
| 9ef464e002 | |||
| 3deb089d64 | |||
| f4f2249447 | |||
| 1c5a4f4f39 | |||
| 1909fc3139 | |||
| 2de831f1b2 | |||
| 1739200ee4 | |||
| 31a44178a4 | |||
| eb9f233a78 | |||
| 3986dc2617 | |||
| 1f7f2ee3dd | |||
| 6e0da1aa3a | |||
| af3b0ed39f | |||
| 1302b67772 | |||
| 6d44248607 | |||
| 5f1d9cbab1 | |||
| aad21195df | |||
| 739a67fdcb | |||
| 48bd5cb2c0 | |||
| 9c079ccdfd | |||
| 2542102280 | |||
| 5407c2efec | |||
| 81a5d49687 | |||
| 321b44b779 | |||
| 61a1ed897f | |||
| 5bb4cffa21 | |||
| 5c314b6f1c | |||
| cee8855dca | |||
| 1196237f82 | |||
| 9d5295fdb4 | |||
| 71e1c91148 | |||
| e9718e064f | |||
| 3e8bb29c9f | |||
| 2fd703fcc5 | |||
| 2a84b00dad | |||
| 711ebfea28 | |||
| 8cd2ee95f9 | |||
| 539937c0eb | |||
| fefd698e96 | |||
| 3512d788dc | |||
| 54c4dd1ce6 | |||
| daaff66ff0 | |||
| 8610f9883d | |||
| e503d4a9c0 | |||
| eaf3fc8833 | |||
| 94c5ddc13d | |||
| a3fedbaba7 | |||
| 1cf1d9e3d7 | |||
| 6b250f9dfe | |||
| 3d24ef66d8 | |||
| ef0fc13235 | |||
| 394ff1bbf6 | |||
| 5cdd087465 | |||
| 93051f4f97 | |||
| 1c2eed1421 | |||
| 532f5ab080 | |||
| e3ffe56549 | |||
| 564634be45 | |||
| ab3ae3dc62 | |||
| d037f67f74 | |||
| b1b6341a6e | |||
| 8c92f9407d | |||
| e0aa660b56 | |||
| 25d4cabe3b | |||
| 7539b6ffda | |||
| 8e623ee64c | |||
| 59ab51c06c | |||
| 2eb2617b6f | |||
| b284572ea7 | |||
| 1e5d9ecfa3 | |||
| e8bda298e3 | |||
| 489cd008d6 | |||
| 22ddd9a7d4 | |||
| 128ea45fee | |||
| 3ff1e31a81 | |||
| 2495f68751 | |||
| 70ee652be5 | |||
| bb1d34c33d | |||
| 8f6d64f5e1 | |||
| b40848373d | |||
| 2824bcff41 | |||
| e8b967d634 | |||
| 12d617cf8d | |||
| 48ab5ed990 | |||
| 3363b1062e | |||
| d35dde6757 | |||
| 6016d4886e | |||
| f77eaa4083 | |||
| 460d88ced7 | |||
| 6bb559f1b0 | |||
| 7c91eb0091 | |||
| ae672e1110 | |||
| 1c4bf67e29 | |||
| c4e671fdc3 | |||
| c5c5198fb3 | |||
| 634ec3c85f | |||
| d15aa4b337 | |||
| e160739a28 | |||
| 030e07030c | |||
| a50a15ebc6 | |||
| 514452c4ec | |||
| f091db3b0e | |||
| caf1d6e7f2 | |||
| 81f6637803 | |||
| f764f1fc10 | |||
| 9a8ef17c73 | |||
| 8fe582a7a7 | |||
| 5cf3a2256a | |||
| caf4ffbc0b | |||
| d156f36f99 | |||
| 4390324d22 | |||
| 8d7ef1929e | |||
| 08fb8e42f7 | |||
| eaf6abecc8 | |||
| b4796cbf73 | |||
| e042b2e07b | |||
| 9f021cbee6 | |||
| bf615e415b | |||
| c72f5b79fe | |||
| 51c1674663 | |||
| e445452d35 | |||
| 9fff38d0a3 | |||
| bdd69dbfbc | |||
| ec4767acd5 | |||
| 78c8054954 | |||
| f21c5ea88a | |||
| 82903cc567 | |||
| 0233c38711 | |||
| 24f5096ec6 | |||
| 030bc8641b | |||
| c9403eb946 | |||
| 87b0a6d3f3 | |||
| c0d404edb5 | |||
| a7a16d1e1e | |||
| 1f21d5e2c2 | |||
| a531f8644d | |||
| 765a0b52cb | |||
| 4919d6944e | |||
| ac20596f10 | |||
| 5e79a93235 | |||
| 2e8decbb6d | |||
| 196e599dc8 | |||
| 485cad2dc6 | |||
| 61cbe0c4b1 | |||
| 5510e138db | |||
| c9e9f9bd82 | |||
| 768ba1baaf | |||
| ad25a60149 | |||
| 3fdcd6e8f1 | |||
| be0c0761e3 | |||
| 00dd3f05ac | |||
| c6f30989c9 | |||
| 4ab6fba9e7 | |||
| 3ef082e2d9 | |||
| cccf44cd68 | |||
| 506d665a43 | |||
| 8514e35ad0 | |||
| af0a3f9a8d | |||
| 2df1a93dfc | |||
| 75e39d3154 | |||
| 5d755e3ca0 | |||
| fbeb2e4789 | |||
| 6b288d46af | |||
| 394cdfcc15 | |||
| 28df02da82 | |||
| d4ee725747 | |||
| 6617d3bb46 | |||
| 2453e344f4 | |||
| 7f0e886cfd | |||
| e34ea393d9 | |||
| a00a5e52c4 | |||
| 6abc0a3fb9 | |||
| 7e4b9d7481 | |||
| e3f241acb7 | |||
| eee233f894 | |||
| 615095c780 | |||
| b22bce3dd8 | |||
| 9f1d9add18 | |||
| 36f2bef6b8 | |||
| 07906d2576 | |||
| 5c977c212b | |||
| 09b084e85a | |||
| aefc72554a | |||
| 33c2cc806a | |||
| 74aa17d534 | |||
| 4de1501c68 | |||
| dc12b3e750 | |||
| dacd09db8b | |||
| c63d0e167c | |||
| 6ccd98d795 | |||
| 52b0e64950 | |||
| 5e5137edc1 | |||
| 5d4edb5ec0 | |||
| 6dccab9bfe | |||
| 653c160d76 | |||
| 3f65ed452e | |||
| 09cdc7ceca | |||
| e98e6d8aee | |||
| f10223bf13 | |||
| 38b3062653 | |||
| 6063e4accb | |||
| 06e249f569 | |||
| d064bd4f34 | |||
| 765d2c332c | |||
| 8857c77645 | |||
| 1ff4e40824 | |||
| 09d59c79a7 | |||
| dd6ac4b196 | |||
| 67fe3682b5 | |||
| a07e6183bb | |||
| ac99537c25 | |||
| 734a6f0442 | |||
| c934535dc8 | |||
| 3e3f092f0c | |||
| 834aafb8f2 | |||
| df19c77bcf | |||
| 6edcda1e42 | |||
| fe8c367bce | |||
| a37edf8c62 | |||
| 09ef2c9dea | |||
| 42b1d8ecf8 | |||
| 32437a95f3 | |||
| 2e29d3523b | |||
| 530300a951 | |||
| 612a09634c | |||
| fd6a2456d0 | |||
| 1ad0e7e365 | |||
| 055ee5c88f | |||
| ae676d8e03 | |||
| 0dc665e45b | |||
| bc6ea16db8 | |||
| a1d0528adb | |||
| ecfa1fd5b5 | |||
| eaf76047e3 | |||
| 761d3f216e | |||
| e7d9ac2247 | |||
| 842e651928 | |||
| 091d1c2d55 | |||
| 47bf2d1f26 | |||
| 758392c206 | |||
| 647011bf0c | |||
| 580413b5f8 | |||
| c8c9e5167e | |||
| 2e8707059d | |||
| e0d9d01493 | |||
| 45bf1ace7d | |||
| 39a5328f5a | |||
| 9f82738c96 | |||
| f69f6ec8be | |||
| 8b3fb11f14 | |||
| b0f4c57fa8 | |||
| d759deae8f | |||
| b695b5a83c | |||
| b8883b790e | |||
| 423197cb23 | |||
| 38107664b5 | |||
| 42d3f557bc | |||
| 1a3c913176 | |||
| 83de41ad0e | |||
| 8cc4664823 | |||
| aaecbc2206 | |||
| e36df7eff5 | |||
| 95f58b2b8c | |||
| 8df0ce3fb5 | |||
| 4177809f71 | |||
| 96aa214fc5 | |||
| a3c1c8c1b4 | |||
| 2bf3494cbc | |||
| e3dd3478bb | |||
| 457af15b35 | |||
| 1eef1675cc | |||
| 89ef31b381 | |||
| c00472c42d | |||
| c0143b04c8 | |||
| d1c901ae94 | |||
| dd0aeaf380 | |||
| 3e8e250a65 | |||
| a34b580444 | |||
| e7ea9d09c9 | |||
| e4e11be331 | |||
| 9774c51a97 | |||
| 87ff8dc7bc | |||
| 2434ae5476 | |||
| e474294d55 | |||
| b081716df7 | |||
| e1af43b133 | |||
| 1ea6a99c48 | |||
| 79fc80957f | |||
| 937eedd8ca | |||
| 93ae45dcbb | |||
| 1adbd525bc | |||
| ced7465c1f | |||
| d635cb8516 | |||
| 2b578633ab | |||
| 824f555d48 | |||
| 999fd15bee | |||
| be07879a1e | |||
| ab543c2680 | |||
| 79aa0bce5a | |||
| 05a76c0297 | |||
| 15eeac3c48 | |||
| d8a84a7d6b | |||
| 863a5b7b81 | |||
| 4ad049aec3 | |||
| 03c16d034d | |||
| c1f8dce109 | |||
| 887f513438 | |||
| 12fbae7204 | |||
| a05cb8f1c5 | |||
| cffee80b0e | |||
| 0c0f2e43e8 | |||
| 35456a1f32 | |||
| b6a6bca41b | |||
| 102cc87618 | |||
| 1ec45dcf19 | |||
| f2fb1b7919 | |||
| 78c5b18937 | |||
| 86de1dee29 | |||
| 7afd3cb730 | |||
| b887e2ad21 | |||
| ea2350f1ed | |||
| 786c858452 | |||
| a6b643a33f | |||
| 0e5235e6dc | |||
| c93c97c2de | |||
| 271ba462b1 | |||
| 690918f8d3 | |||
| de5dd66512 | |||
| c8593b2307 | |||
| fc21757e40 | |||
| b6d0cde29f | |||
| f0dfc23a5f | |||
| 4e2ccfc091 | |||
| e4b1e1118b | |||
| ba2e798f7d | |||
| 85edef8394 | |||
| 559f6e2791 |
+2
-1
@@ -14,10 +14,11 @@ MANIFEST.in
|
||||
README.md
|
||||
freqtrade.service
|
||||
freqtrade.egg-info
|
||||
.venv/
|
||||
|
||||
config.json*
|
||||
*.sqlite
|
||||
user_data
|
||||
user_data/
|
||||
*.log
|
||||
|
||||
.vscode
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
name: 'docker-tags'
|
||||
description: 'Set Docker default Tag environment variables'
|
||||
# inputs:
|
||||
outputs:
|
||||
BRANCH_NAME:
|
||||
description: 'The branch name'
|
||||
value: ${{ steps.tags.outputs.BRANCH_NAME }}
|
||||
TAG:
|
||||
description: 'The Docker tag'
|
||||
value: ${{ steps.tags.outputs.TAG }}
|
||||
TAG_PLOT:
|
||||
description: 'The Docker tag for the plot'
|
||||
value: ${{ steps.tags.outputs.TAG_PLOT }}
|
||||
TAG_FREQAI:
|
||||
description: 'The Docker tag for the freqai'
|
||||
value: ${{ steps.tags.outputs.TAG_FREQAI }}
|
||||
TAG_FREQAI_RL:
|
||||
description: 'The Docker tag for the freqai_rl'
|
||||
value: ${{ steps.tags.outputs.TAG_FREQAI_RL }}
|
||||
TAG_FREQAI_TORCH:
|
||||
description: 'The Docker tag for the freqai_torch'
|
||||
value: ${{ steps.tags.outputs.TAG_FREQAI_TORCH }}
|
||||
TAG_ARM:
|
||||
description: 'The Docker tag for the arm'
|
||||
value: ${{ steps.tags.outputs.TAG_ARM }}
|
||||
TAG_PLOT_ARM:
|
||||
description: 'The Docker tag for the plot arm'
|
||||
value: ${{ steps.tags.outputs.TAG_PLOT_ARM }}
|
||||
TAG_FREQAI_ARM:
|
||||
description: 'The Docker tag for the freqai arm'
|
||||
value: ${{ steps.tags.outputs.TAG_FREQAI_ARM }}
|
||||
TAG_FREQAI_RL_ARM:
|
||||
description: 'The Docker tag for the freqai_rl arm'
|
||||
value: ${{ steps.tags.outputs.TAG_FREQAI_RL_ARM }}
|
||||
TAG_PI:
|
||||
description: 'The Docker tag for the pi'
|
||||
value: ${{ steps.tags.outputs.TAG_PI }}
|
||||
CACHE_TAG_PI:
|
||||
description: 'The Docker cache tag for the pi'
|
||||
value: ${{ steps.tags.outputs.CACHE_TAG_PI }}
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Extract branch name
|
||||
shell: bash
|
||||
id: tags
|
||||
env:
|
||||
BRANCH_NAME_INPUT: ${{ github.event.inputs.branch_name }}
|
||||
run: |
|
||||
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
|
||||
BRANCH_NAME="${BRANCH_NAME_INPUT}"
|
||||
else
|
||||
BRANCH_NAME="${GITHUB_REF##*/}"
|
||||
fi
|
||||
|
||||
# Replace / with _ to create a valid tag
|
||||
TAG=$(echo "${BRANCH_NAME}" | sed -e "s/\//_/g")
|
||||
TAG_PLOT=${TAG}_plot
|
||||
TAG_FREQAI=${TAG}_freqai
|
||||
TAG_FREQAI_RL=${TAG_FREQAI}rl
|
||||
TAG_FREQAI_TORCH=${TAG_FREQAI}torch
|
||||
|
||||
TAG_ARM=${TAG}_arm
|
||||
TAG_PLOT_ARM=${TAG_PLOT}_arm
|
||||
TAG_FREQAI_ARM=${TAG_FREQAI}_arm
|
||||
TAG_FREQAI_RL_ARM=${TAG_FREQAI_RL}_arm
|
||||
|
||||
TAG_PI="${TAG}_pi"
|
||||
|
||||
CACHE_TAG_PI=${CACHE_IMAGE}:${TAG_PI}_cache
|
||||
|
||||
echo "BRANCH_NAME=${BRANCH_NAME}" >> "$GITHUB_OUTPUT"
|
||||
echo "TAG=${TAG}" >> "$GITHUB_OUTPUT"
|
||||
echo "TAG_PLOT=${TAG_PLOT}" >> "$GITHUB_OUTPUT"
|
||||
echo "TAG_FREQAI=${TAG_FREQAI}" >> "$GITHUB_OUTPUT"
|
||||
echo "TAG_FREQAI_RL=${TAG_FREQAI_RL}" >> "$GITHUB_OUTPUT"
|
||||
echo "TAG_FREQAI_TORCH=${TAG_FREQAI_TORCH}" >> "$GITHUB_OUTPUT"
|
||||
echo "TAG_ARM=${TAG_ARM}" >> "$GITHUB_OUTPUT"
|
||||
echo "TAG_PLOT_ARM=${TAG_PLOT_ARM}" >> "$GITHUB_OUTPUT"
|
||||
echo "TAG_FREQAI_ARM=${TAG_FREQAI_ARM}" >> "$GITHUB_OUTPUT"
|
||||
echo "TAG_FREQAI_RL_ARM=${TAG_FREQAI_RL_ARM}" >> "$GITHUB_OUTPUT"
|
||||
echo "TAG_PI=${TAG_PI}" >> "$GITHUB_OUTPUT"
|
||||
|
||||
echo "CACHE_TAG_PI=${CACHE_TAG_PI}" >> "$GITHUB_OUTPUT"
|
||||
|
||||
cat "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Save commit SHA to file
|
||||
shell: bash
|
||||
# Add commit to docker container
|
||||
run: |
|
||||
echo "${GITHUB_SHA}" > freqtrade_commit
|
||||
@@ -29,6 +29,10 @@ updates:
|
||||
mkdocs:
|
||||
patterns:
|
||||
- "mkdocs*"
|
||||
scipy:
|
||||
patterns:
|
||||
- "scipy"
|
||||
- "scipy-stubs"
|
||||
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/"
|
||||
|
||||
@@ -15,11 +15,11 @@ jobs:
|
||||
environment:
|
||||
name: develop
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v5
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- uses: actions/setup-python@v5
|
||||
- uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version: "3.12"
|
||||
|
||||
|
||||
+81
-284
@@ -19,52 +19,43 @@ concurrency:
|
||||
permissions:
|
||||
repository-projects: read
|
||||
jobs:
|
||||
build-linux:
|
||||
|
||||
tests:
|
||||
name: "Tests and Linting"
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ "ubuntu-22.04", "ubuntu-24.04" ]
|
||||
os: [ "ubuntu-22.04", "ubuntu-24.04", "macos-14", "macos-15" , "windows-2022", "windows-2025" ]
|
||||
python-version: ["3.11", "3.12", "3.13"]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v5
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@e92bafb6253dcd438e0484186d7669ea7a8ca1cc # v6.4.3
|
||||
uses: astral-sh/setup-uv@b75a909f75acd358c2196fb9a5f1299a9a8868a4 # v6.7.0
|
||||
with:
|
||||
activate-environment: true
|
||||
enable-cache: true
|
||||
python-version: ${{ matrix.python-version }}
|
||||
cache-dependency-glob: "requirements**.txt"
|
||||
cache-suffix: "${{ matrix.python-version }}"
|
||||
prune-cache: false
|
||||
|
||||
- name: Cache_dependencies
|
||||
uses: actions/cache@v4
|
||||
id: cache
|
||||
with:
|
||||
path: ~/dependencies/
|
||||
key: ${{ runner.os }}-dependencies
|
||||
|
||||
- name: TA binary *nix
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
- name: Installation - macOS (Brew)
|
||||
if: ${{ runner.os == 'macOS' }}
|
||||
run: |
|
||||
cd build_helpers && ./install_ta-lib.sh ${HOME}/dependencies/; cd ..
|
||||
# brew update
|
||||
# TODO: Should be the brew upgrade
|
||||
brew install libomp
|
||||
|
||||
- name: Installation - *nix
|
||||
- name: Installation (python)
|
||||
run: |
|
||||
uv pip install --upgrade wheel
|
||||
export LD_LIBRARY_PATH=${HOME}/dependencies/lib:$LD_LIBRARY_PATH
|
||||
export TA_LIBRARY_PATH=${HOME}/dependencies/lib
|
||||
export TA_INCLUDE_PATH=${HOME}/dependencies/include
|
||||
uv pip install -r requirements-dev.txt
|
||||
uv pip install -e ft_client/
|
||||
uv pip install -e .
|
||||
@@ -76,7 +67,7 @@ jobs:
|
||||
- name: Tests
|
||||
if: (!(runner.os == 'Linux' && matrix.python-version == '3.12' && matrix.os == 'ubuntu-24.04'))
|
||||
run: |
|
||||
pytest --random-order
|
||||
pytest --random-order --durations 20 -n auto
|
||||
|
||||
- name: Tests with Coveralls
|
||||
if: (runner.os == 'Linux' && matrix.python-version == '3.12' && matrix.os == 'ubuntu-24.04')
|
||||
@@ -103,9 +94,9 @@ jobs:
|
||||
run: |
|
||||
python build_helpers/create_command_partials.py
|
||||
|
||||
- name: Check for repository changes
|
||||
- name: Check for repository changes - *nix
|
||||
# TODO: python 3.13 slightly changed the output of argparse.
|
||||
if: (matrix.python-version != '3.13')
|
||||
if: ${{ (matrix.python-version != '3.13') && (runner.os != 'Windows') }}
|
||||
run: |
|
||||
if [ -n "$(git status --porcelain)" ]; then
|
||||
echo "Repository is dirty, changes detected:"
|
||||
@@ -116,13 +107,27 @@ jobs:
|
||||
echo "Repository is clean, no changes detected."
|
||||
fi
|
||||
|
||||
- name: Check for repository changes - Windows
|
||||
if: ${{ runner.os == 'Windows' && (matrix.python-version != '3.13') }}
|
||||
run: |
|
||||
if (git status --porcelain) {
|
||||
Write-Host "Repository is dirty, changes detected:"
|
||||
git status
|
||||
git diff
|
||||
exit 1
|
||||
}
|
||||
else {
|
||||
Write-Host "Repository is clean, no changes detected."
|
||||
}
|
||||
|
||||
- name: Backtesting (multi)
|
||||
run: |
|
||||
cp tests/testdata/config.tests.json config.json
|
||||
freqtrade create-userdir --userdir user_data
|
||||
cp tests/testdata/config.tests.json user_data/config.json
|
||||
freqtrade new-strategy -s AwesomeStrategy
|
||||
freqtrade new-strategy -s AwesomeStrategyMin --template minimal
|
||||
freqtrade backtesting --datadir tests/testdata --strategy-list AwesomeStrategy AwesomeStrategyMin -i 5m
|
||||
freqtrade new-strategy -s AwesomeStrategyAdv --template advanced
|
||||
freqtrade backtesting --datadir tests/testdata --strategy-list AwesomeStrategy AwesomeStrategyMin AwesomeStrategyAdv -i 5m
|
||||
|
||||
- name: Hyperopt
|
||||
run: |
|
||||
@@ -143,221 +148,13 @@ jobs:
|
||||
ruff format --check
|
||||
|
||||
- name: Mypy
|
||||
if: matrix.os == 'ubuntu-24.04'
|
||||
run: |
|
||||
mypy freqtrade scripts tests
|
||||
|
||||
- name: Discord notification
|
||||
uses: rjstone/discord-webhook-notify@c2597273488aeda841dd1e891321952b51f7996f #v2.2.1
|
||||
if: failure() && ( github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false)
|
||||
with:
|
||||
severity: error
|
||||
details: Freqtrade CI failed on ${{ matrix.os }}
|
||||
webhookUrl: ${{ secrets.DISCORD_WEBHOOK }}
|
||||
|
||||
build-macos:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ "macos-14", "macos-15" ]
|
||||
python-version: ["3.11", "3.12", "3.13"]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
check-latest: true
|
||||
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@e92bafb6253dcd438e0484186d7669ea7a8ca1cc # v6.4.3
|
||||
with:
|
||||
activate-environment: true
|
||||
enable-cache: true
|
||||
python-version: ${{ matrix.python-version }}
|
||||
cache-dependency-glob: "requirements**.txt"
|
||||
cache-suffix: "${{ matrix.python-version }}"
|
||||
prune-cache: false
|
||||
|
||||
- name: Cache_dependencies
|
||||
uses: actions/cache@v4
|
||||
id: cache
|
||||
with:
|
||||
path: ~/dependencies/
|
||||
key: ${{ matrix.os }}-dependencies
|
||||
|
||||
- name: TA binary *nix
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
cd build_helpers && ./install_ta-lib.sh ${HOME}/dependencies/; cd ..
|
||||
|
||||
- name: Installation - macOS (Brew)
|
||||
run: |
|
||||
# brew update
|
||||
# TODO: Should be the brew upgrade
|
||||
# homebrew fails to update python due to unlinking failures
|
||||
# https://github.com/actions/runner-images/issues/6817
|
||||
rm /usr/local/bin/2to3 || true
|
||||
rm /usr/local/bin/2to3-3.11 || true
|
||||
rm /usr/local/bin/2to3-3.12 || true
|
||||
rm /usr/local/bin/idle3 || true
|
||||
rm /usr/local/bin/idle3.11 || true
|
||||
rm /usr/local/bin/idle3.12 || true
|
||||
rm /usr/local/bin/pydoc3 || true
|
||||
rm /usr/local/bin/pydoc3.11 || true
|
||||
rm /usr/local/bin/pydoc3.12 || true
|
||||
rm /usr/local/bin/python3 || true
|
||||
rm /usr/local/bin/python3.11 || true
|
||||
rm /usr/local/bin/python3.12 || true
|
||||
rm /usr/local/bin/python3-config || true
|
||||
rm /usr/local/bin/python3.11-config || true
|
||||
rm /usr/local/bin/python3.12-config || true
|
||||
|
||||
brew install libomp
|
||||
|
||||
- name: Installation (python)
|
||||
run: |
|
||||
uv pip install wheel
|
||||
export LD_LIBRARY_PATH=${HOME}/dependencies/lib:$LD_LIBRARY_PATH
|
||||
export TA_LIBRARY_PATH=${HOME}/dependencies/lib
|
||||
export TA_INCLUDE_PATH=${HOME}/dependencies/include
|
||||
uv pip install -r requirements-dev.txt
|
||||
uv pip install -e ft_client/
|
||||
uv pip install -e .
|
||||
|
||||
- name: Tests
|
||||
run: |
|
||||
pytest --random-order
|
||||
|
||||
- name: Check for repository changes
|
||||
run: |
|
||||
if [ -n "$(git status --porcelain)" ]; then
|
||||
echo "Repository is dirty, changes detected:"
|
||||
git status
|
||||
git diff
|
||||
exit 1
|
||||
else
|
||||
echo "Repository is clean, no changes detected."
|
||||
fi
|
||||
|
||||
- name: Backtesting
|
||||
run: |
|
||||
cp tests/testdata/config.tests.json config.json
|
||||
freqtrade create-userdir --userdir user_data
|
||||
freqtrade new-strategy -s AwesomeStrategyAdv --template advanced
|
||||
freqtrade backtesting --datadir tests/testdata --strategy AwesomeStrategyAdv
|
||||
|
||||
- name: Hyperopt
|
||||
run: |
|
||||
cp tests/testdata/config.tests.json config.json
|
||||
freqtrade create-userdir --userdir user_data
|
||||
freqtrade hyperopt --datadir tests/testdata -e 5 --strategy SampleStrategy --hyperopt-loss SharpeHyperOptLossDaily --print-all
|
||||
|
||||
- name: Sort imports (isort)
|
||||
run: |
|
||||
isort --check .
|
||||
|
||||
- name: Run Ruff
|
||||
run: |
|
||||
ruff check --output-format=github
|
||||
|
||||
- name: Run Ruff format check
|
||||
run: |
|
||||
ruff format --check
|
||||
|
||||
- name: Mypy
|
||||
if: matrix.os == 'macos-15'
|
||||
run: |
|
||||
mypy freqtrade scripts
|
||||
|
||||
- name: Discord notification
|
||||
uses: rjstone/discord-webhook-notify@c2597273488aeda841dd1e891321952b51f7996f #v2.2.1
|
||||
if: failure() && ( github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false)
|
||||
with:
|
||||
severity: info
|
||||
details: Test Succeeded!
|
||||
webhookUrl: ${{ secrets.DISCORD_WEBHOOK }}
|
||||
|
||||
build-windows:
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ windows-latest ]
|
||||
python-version: ["3.11", "3.12", "3.13"]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@e92bafb6253dcd438e0484186d7669ea7a8ca1cc # v6.4.3
|
||||
with:
|
||||
activate-environment: true
|
||||
enable-cache: true
|
||||
python-version: ${{ matrix.python-version }}
|
||||
cache-dependency-glob: "requirements**.txt"
|
||||
cache-suffix: "${{ matrix.python-version }}"
|
||||
prune-cache: false
|
||||
|
||||
- name: Installation
|
||||
run: |
|
||||
function uvpipFunction { uv pip $args }
|
||||
Set-Alias -name pip -value uvpipFunction
|
||||
|
||||
./build_helpers/install_windows.ps1
|
||||
|
||||
- name: Tests
|
||||
run: |
|
||||
pytest --random-order --durations 20 -n auto
|
||||
|
||||
- name: Check for repository changes
|
||||
run: |
|
||||
if (git status --porcelain) {
|
||||
Write-Host "Repository is dirty, changes detected:"
|
||||
git status
|
||||
git diff
|
||||
exit 1
|
||||
}
|
||||
else {
|
||||
Write-Host "Repository is clean, no changes detected."
|
||||
}
|
||||
|
||||
- name: Backtesting
|
||||
run: |
|
||||
cp tests/testdata/config.tests.json config.json
|
||||
freqtrade create-userdir --userdir user_data
|
||||
freqtrade backtesting --datadir tests/testdata --strategy SampleStrategy
|
||||
|
||||
- name: Hyperopt
|
||||
run: |
|
||||
cp tests/testdata/config.tests.json config.json
|
||||
freqtrade create-userdir --userdir user_data
|
||||
freqtrade hyperopt --datadir tests/testdata -e 5 --strategy SampleStrategy --hyperopt-loss SharpeHyperOptLossDaily --print-all
|
||||
|
||||
- name: Run Ruff
|
||||
run: |
|
||||
ruff check --output-format=github
|
||||
|
||||
- name: Run Ruff format check
|
||||
run: |
|
||||
ruff format --check
|
||||
|
||||
- name: Mypy
|
||||
if: ${{ matrix.os == 'ubuntu-24.04' || matrix.os == 'macos-15' }}
|
||||
run: |
|
||||
mypy freqtrade scripts tests
|
||||
|
||||
- name: Run Pester tests (PowerShell)
|
||||
if: ${{ runner.os == 'Windows' }}
|
||||
shell: powershell
|
||||
run: |
|
||||
$PSVersionTable
|
||||
Set-PSRepository psgallery -InstallationPolicy trusted
|
||||
@@ -366,25 +163,24 @@ jobs:
|
||||
Invoke-Pester -Path "tests" -CI
|
||||
if ($Error.Length -gt 0) {exit 1}
|
||||
|
||||
shell: powershell
|
||||
|
||||
- name: Discord notification
|
||||
uses: rjstone/discord-webhook-notify@c2597273488aeda841dd1e891321952b51f7996f #v2.2.1
|
||||
if: failure() && ( github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false)
|
||||
if: ${{ failure() && ( github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false) }}
|
||||
with:
|
||||
severity: error
|
||||
details: Test Failed
|
||||
details: Freqtrade CI failed on ${{ matrix.os }} with Python ${{ matrix.python-version }}!
|
||||
webhookUrl: ${{ secrets.DISCORD_WEBHOOK }}
|
||||
|
||||
mypy-version-check:
|
||||
runs-on: ubuntu-22.04
|
||||
name: "Mypy Version Check"
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v5
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version: "3.12"
|
||||
|
||||
@@ -394,21 +190,23 @@ jobs:
|
||||
python build_helpers/pre_commit_update.py
|
||||
|
||||
pre-commit:
|
||||
name: "Pre-commit checks"
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v5
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- uses: actions/setup-python@v5
|
||||
- uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version: "3.12"
|
||||
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
|
||||
|
||||
docs-check:
|
||||
name: "Documentation build"
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v5
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
@@ -417,7 +215,7 @@ jobs:
|
||||
./tests/test_docs.sh
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version: "3.12"
|
||||
|
||||
@@ -437,46 +235,30 @@ jobs:
|
||||
|
||||
build-linux-online:
|
||||
# Run pytest with "live" checks
|
||||
name: "Tests and Linting - Online tests"
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v5
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version: "3.12"
|
||||
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@e92bafb6253dcd438e0484186d7669ea7a8ca1cc # v6.4.3
|
||||
uses: astral-sh/setup-uv@b75a909f75acd358c2196fb9a5f1299a9a8868a4 # v6.7.0
|
||||
with:
|
||||
activate-environment: true
|
||||
enable-cache: true
|
||||
python-version: "3.12"
|
||||
cache-dependency-glob: "requirements**.txt"
|
||||
cache-suffix: "3.12"
|
||||
prune-cache: false
|
||||
|
||||
- name: Cache_dependencies
|
||||
uses: actions/cache@v4
|
||||
id: cache
|
||||
with:
|
||||
path: ~/dependencies/
|
||||
key: ${{ runner.os }}-dependencies
|
||||
|
||||
|
||||
- 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: |
|
||||
uv pip install --upgrade wheel
|
||||
export LD_LIBRARY_PATH=${HOME}/dependencies/lib:$LD_LIBRARY_PATH
|
||||
export TA_LIBRARY_PATH=${HOME}/dependencies/lib
|
||||
export TA_INCLUDE_PATH=${HOME}/dependencies/include
|
||||
uv pip install -r requirements-dev.txt
|
||||
uv pip install -e ft_client/
|
||||
uv pip install -e .
|
||||
@@ -491,9 +273,7 @@ jobs:
|
||||
# Notify only once - when CI completes (and after deploy) in case it's successful
|
||||
notify-complete:
|
||||
needs: [
|
||||
build-linux,
|
||||
build-macos,
|
||||
build-windows,
|
||||
tests,
|
||||
docs-check,
|
||||
mypy-version-check,
|
||||
pre-commit,
|
||||
@@ -508,15 +288,16 @@ jobs:
|
||||
|
||||
- name: Check user permission
|
||||
id: check
|
||||
uses: scherermichael-oss/action-has-permission@136e061bfe093832d87f090dd768e14e27a740d3 # 1.0.6
|
||||
continue-on-error: true
|
||||
uses: prince-chrismc/check-actor-permissions-action@d504e74ba31658f4cdf4fcfeb509d4c09736d88e # v3.0.2
|
||||
with:
|
||||
required-permission: write
|
||||
permission: "write"
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Discord notification
|
||||
uses: rjstone/discord-webhook-notify@c2597273488aeda841dd1e891321952b51f7996f #v2.2.1
|
||||
if: always() && steps.check.outputs.has-permission && ( github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false)
|
||||
if: steps.check.outputs.permitted == 'true' && ( github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false)
|
||||
with:
|
||||
severity: info
|
||||
details: Test Completed!
|
||||
@@ -524,16 +305,16 @@ jobs:
|
||||
|
||||
build:
|
||||
name: "Build"
|
||||
needs: [ build-linux, build-macos, build-windows, docs-check, mypy-version-check, pre-commit ]
|
||||
needs: [ tests, docs-check, mypy-version-check, pre-commit ]
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v5
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version: "3.12"
|
||||
|
||||
@@ -575,19 +356,19 @@ jobs:
|
||||
id-token: write
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v5
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Download artifact 📦
|
||||
uses: actions/download-artifact@v4
|
||||
uses: actions/download-artifact@v5
|
||||
with:
|
||||
pattern: freqtrade*-build
|
||||
path: dist
|
||||
merge-multiple: true
|
||||
|
||||
- name: Publish to PyPI (Test)
|
||||
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4
|
||||
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
|
||||
with:
|
||||
repository-url: https://test.pypi.org/legacy/
|
||||
|
||||
@@ -604,24 +385,29 @@ jobs:
|
||||
id-token: write
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v5
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Download artifact 📦
|
||||
uses: actions/download-artifact@v4
|
||||
uses: actions/download-artifact@v5
|
||||
with:
|
||||
pattern: freqtrade*-build
|
||||
path: dist
|
||||
merge-multiple: true
|
||||
|
||||
- name: Publish to PyPI
|
||||
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4
|
||||
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
|
||||
|
||||
|
||||
docker-build:
|
||||
name: "Docker Build and Deploy"
|
||||
needs: [ build-linux, build-macos, build-windows, docs-check, mypy-version-check, pre-commit ]
|
||||
needs: [
|
||||
tests,
|
||||
docs-check,
|
||||
mypy-version-check,
|
||||
pre-commit
|
||||
]
|
||||
if: (github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'release') && github.repository == 'freqtrade/freqtrade'
|
||||
uses: ./.github/workflows/docker-build.yml
|
||||
permissions:
|
||||
@@ -631,3 +417,14 @@ jobs:
|
||||
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
||||
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
||||
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
|
||||
|
||||
|
||||
packages-cleanup:
|
||||
name: "Docker Package Cleanup"
|
||||
uses: ./.github/workflows/packages-cleanup.yml
|
||||
# Only run on push, schedule, or release events
|
||||
if: (github.event_name == 'push' || github.event_name == 'schedule') && github.repository == 'freqtrade/freqtrade'
|
||||
permissions:
|
||||
packages: write
|
||||
with:
|
||||
package_name: 'freqtrade'
|
||||
|
||||
@@ -19,12 +19,12 @@ jobs:
|
||||
name: Deploy Docs through mike
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v5
|
||||
with:
|
||||
persist-credentials: true
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version: '3.12'
|
||||
|
||||
|
||||
@@ -24,11 +24,11 @@ jobs:
|
||||
packages: write
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v5
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
|
||||
uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
|
||||
@@ -20,43 +20,37 @@ on:
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
env:
|
||||
IMAGE_NAME: "freqtradeorg/freqtrade"
|
||||
CACHE_IMAGE: "freqtradeorg/freqtrade_cache"
|
||||
GHCR_IMAGE_NAME: "ghcr.io/freqtrade/freqtrade"
|
||||
PI_PLATFORM: "linux/arm/v7"
|
||||
|
||||
jobs:
|
||||
deploy-docker:
|
||||
name: "Deploy Docker x64 and armv7l"
|
||||
runs-on: ubuntu-22.04
|
||||
if: github.repository == 'freqtrade/freqtrade'
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v5
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
- name: Set docker tag names
|
||||
id: tags
|
||||
uses: ./.github/actions/docker-tags
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0
|
||||
with:
|
||||
python-version: "3.12"
|
||||
|
||||
- name: Extract branch name
|
||||
id: extract-branch
|
||||
env:
|
||||
BRANCH_NAME_INPUT: ${{ github.event.inputs.branch_name }}
|
||||
run: |
|
||||
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
|
||||
BRANCH_NAME="${BRANCH_NAME_INPUT}"
|
||||
else
|
||||
BRANCH_NAME="${GITHUB_REF##*/}"
|
||||
fi
|
||||
echo "GITHUB_REF='${GITHUB_REF}'"
|
||||
echo "branch=${BRANCH_NAME}" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Dockerhub login
|
||||
env:
|
||||
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
||||
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
||||
run: |
|
||||
echo "${DOCKER_PASSWORD}" | docker login --username ${DOCKER_USERNAME} --password-stdin
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
|
||||
with:
|
||||
cache-image: false
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
id: buildx
|
||||
@@ -67,14 +61,89 @@ jobs:
|
||||
env:
|
||||
PLATFORMS: ${{ steps.buildx.outputs.platforms }}
|
||||
|
||||
- name: Build and test and push docker images
|
||||
- name: Build image without cache
|
||||
if: github.event_name == 'schedule'
|
||||
env:
|
||||
BRANCH_NAME: ${{ steps.extract-branch.outputs.branch }}
|
||||
TAG: ${{ steps.tags.outputs.TAG }}
|
||||
run: |
|
||||
build_helpers/publish_docker_multi.sh
|
||||
docker build -t ${CACHE_IMAGE}:${TAG} .
|
||||
|
||||
- name: Build ARMHF image without cache
|
||||
if: github.event_name == 'schedule'
|
||||
env:
|
||||
TAG_PI: ${{ steps.tags.outputs.TAG_PI }}
|
||||
CACHE_TAG_PI: ${{ steps.tags.outputs.CACHE_TAG_PI }}
|
||||
run: |
|
||||
docker buildx build \
|
||||
--cache-to=type=registry,ref=${CACHE_TAG_PI} \
|
||||
-f docker/Dockerfile.armhf \
|
||||
--platform ${PI_PLATFORM} \
|
||||
-t ${IMAGE_NAME}:${TAG_PI} \
|
||||
--push \
|
||||
--provenance=false \
|
||||
.
|
||||
|
||||
- name: Build image with cache
|
||||
if: github.event_name != 'schedule'
|
||||
env:
|
||||
TAG: ${{ steps.tags.outputs.TAG }}
|
||||
run: |
|
||||
docker pull ${IMAGE_NAME}:${TAG} || true
|
||||
docker build --cache-from ${IMAGE_NAME}:${TAG} -t ${CACHE_IMAGE}:${TAG} .
|
||||
|
||||
- name: Build ARMHF image with cache
|
||||
if: github.event_name != 'schedule'
|
||||
# disable provenance due to https://github.com/docker/buildx/issues/1509
|
||||
env:
|
||||
TAG_PI: ${{ steps.tags.outputs.TAG_PI }}
|
||||
CACHE_TAG_PI: ${{ steps.tags.outputs.CACHE_TAG_PI }}
|
||||
run: |
|
||||
docker buildx build \
|
||||
--cache-from=type=registry,ref=${CACHE_TAG_PI} \
|
||||
--cache-to=type=registry,ref=${CACHE_TAG_PI} \
|
||||
-f docker/Dockerfile.armhf \
|
||||
--platform ${PI_PLATFORM} \
|
||||
-t ${IMAGE_NAME}:${TAG_PI} \
|
||||
--push \
|
||||
--provenance=false \
|
||||
.
|
||||
|
||||
- name: Run build for AI images
|
||||
env:
|
||||
TAG: ${{ steps.tags.outputs.TAG }}
|
||||
TAG_PLOT: ${{ steps.tags.outputs.TAG_PLOT }}
|
||||
TAG_FREQAI: ${{ steps.tags.outputs.TAG_FREQAI }}
|
||||
TAG_FREQAI_RL: ${{ steps.tags.outputs.TAG_FREQAI_RL }}
|
||||
run: |
|
||||
docker build --build-arg sourceimage=${CACHE_IMAGE} --build-arg sourcetag=${TAG} -t ${CACHE_IMAGE}:${TAG_PLOT} -f docker/Dockerfile.plot .
|
||||
docker build --build-arg sourceimage=${CACHE_IMAGE} --build-arg sourcetag=${TAG} -t ${CACHE_IMAGE}:${TAG_FREQAI} -f docker/Dockerfile.freqai .
|
||||
docker build --build-arg sourceimage=${CACHE_IMAGE} --build-arg sourcetag=${TAG_FREQAI} -t ${CACHE_IMAGE}:${TAG_FREQAI_RL} -f docker/Dockerfile.freqai_rl .
|
||||
|
||||
|
||||
- name: Run backtest in Docker
|
||||
env:
|
||||
TAG: ${{ steps.tags.outputs.TAG }}
|
||||
run: |
|
||||
docker run --rm -v $(pwd)/tests/testdata/config.tests.json:/freqtrade/config.json:ro -v $(pwd)/tests:/tests ${CACHE_IMAGE}:${TAG} backtesting --datadir /tests/testdata --strategy-path /tests/strategy/strats/ --strategy StrategyTestV3
|
||||
|
||||
- name: Push cache images
|
||||
env:
|
||||
TAG: ${{ steps.tags.outputs.TAG }}
|
||||
TAG_PLOT: ${{ steps.tags.outputs.TAG_PLOT }}
|
||||
TAG_FREQAI: ${{ steps.tags.outputs.TAG_FREQAI }}
|
||||
TAG_FREQAI_RL: ${{ steps.tags.outputs.TAG_FREQAI_RL }}
|
||||
run: |
|
||||
docker push ${CACHE_IMAGE}:$TAG
|
||||
docker push ${CACHE_IMAGE}:$TAG_PLOT
|
||||
docker push ${CACHE_IMAGE}:$TAG_FREQAI
|
||||
docker push ${CACHE_IMAGE}:$TAG_FREQAI_RL
|
||||
|
||||
- name: list Images
|
||||
run: |
|
||||
docker images
|
||||
|
||||
deploy-arm:
|
||||
name: "Deploy Docker"
|
||||
name: "Deploy Docker ARM64"
|
||||
permissions:
|
||||
packages: write
|
||||
needs: [ deploy-docker ]
|
||||
@@ -83,37 +152,139 @@ jobs:
|
||||
if: github.repository == 'freqtrade/freqtrade'
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v5
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Extract branch name
|
||||
id: extract-branch
|
||||
env:
|
||||
BRANCH_NAME_INPUT: ${{ github.event.inputs.branch_name }}
|
||||
run: |
|
||||
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
|
||||
BRANCH_NAME="${BRANCH_NAME_INPUT}"
|
||||
else
|
||||
BRANCH_NAME="${GITHUB_REF##*/}"
|
||||
fi
|
||||
echo "GITHUB_REF='${GITHUB_REF}'"
|
||||
echo "branch=${BRANCH_NAME}" >> "$GITHUB_OUTPUT"
|
||||
- name: Set docker tag names
|
||||
id: tags
|
||||
uses: ./.github/actions/docker-tags
|
||||
|
||||
- name: Dockerhub login
|
||||
env:
|
||||
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
||||
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
||||
run: |
|
||||
echo "${DOCKER_PASSWORD}" | docker login --username ${DOCKER_USERNAME} --password-stdin
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
- name: Build and test and push docker images
|
||||
- name: Login to github
|
||||
uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Build image without cache
|
||||
if: github.event_name == 'schedule'
|
||||
env:
|
||||
BRANCH_NAME: ${{ steps.extract-branch.outputs.branch }}
|
||||
GHCR_USERNAME: ${{ github.actor }}
|
||||
GHCR_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
TAG_ARM: ${{ steps.tags.outputs.TAG_ARM }}
|
||||
run: |
|
||||
build_helpers/publish_docker_arm64.sh
|
||||
docker build -t ${IMAGE_NAME}:${TAG_ARM} .
|
||||
|
||||
- name: Build image with cache
|
||||
if: github.event_name != 'schedule'
|
||||
env:
|
||||
TAG_ARM: ${{ steps.tags.outputs.TAG_ARM }}
|
||||
run: |
|
||||
docker pull ${IMAGE_NAME}:${TAG_ARM} || true
|
||||
docker build --cache-from ${IMAGE_NAME}:${TAG_ARM} -t ${CACHE_IMAGE}:${TAG_ARM} .
|
||||
|
||||
- name: Run build for AI images
|
||||
env:
|
||||
TAG_ARM: ${{ steps.tags.outputs.TAG_ARM }}
|
||||
TAG_PLOT_ARM: ${{ steps.tags.outputs.TAG_PLOT_ARM }}
|
||||
TAG_FREQAI_ARM: ${{ steps.tags.outputs.TAG_FREQAI_ARM }}
|
||||
TAG_FREQAI_RL_ARM: ${{ steps.tags.outputs.TAG_FREQAI_RL_ARM }}
|
||||
run: |
|
||||
docker build --build-arg sourceimage=${CACHE_IMAGE} --build-arg sourcetag=${TAG_ARM} -t ${CACHE_IMAGE}:${TAG_PLOT_ARM} -f docker/Dockerfile.plot .
|
||||
docker build --build-arg sourceimage=${CACHE_IMAGE} --build-arg sourcetag=${TAG_ARM} -t ${CACHE_IMAGE}:${TAG_FREQAI_ARM} -f docker/Dockerfile.freqai .
|
||||
docker build --build-arg sourceimage=${CACHE_IMAGE} --build-arg sourcetag=${TAG_FREQAI_ARM} -t ${CACHE_IMAGE}:${TAG_FREQAI_RL_ARM} -f docker/Dockerfile.freqai_rl .
|
||||
|
||||
|
||||
- name: Run backtest in Docker
|
||||
env:
|
||||
TAG_ARM: ${{ steps.tags.outputs.TAG_ARM }}
|
||||
run: |
|
||||
docker run --rm -v $(pwd)/tests/testdata/config.tests.json:/freqtrade/config.json:ro -v $(pwd)/tests:/tests ${CACHE_IMAGE}:${TAG_ARM} backtesting --datadir /tests/testdata --strategy-path /tests/strategy/strats/ --strategy StrategyTestV3
|
||||
|
||||
- name: Docker images
|
||||
run: |
|
||||
docker images
|
||||
|
||||
- name: Push cache images
|
||||
env:
|
||||
TAG_ARM: ${{ steps.tags.outputs.TAG_ARM }}
|
||||
TAG_PLOT_ARM: ${{ steps.tags.outputs.TAG_PLOT_ARM }}
|
||||
TAG_FREQAI_ARM: ${{ steps.tags.outputs.TAG_FREQAI_ARM }}
|
||||
TAG_FREQAI_RL_ARM: ${{ steps.tags.outputs.TAG_FREQAI_RL_ARM }}
|
||||
run: |
|
||||
docker push ${CACHE_IMAGE}:$TAG_PLOT_ARM
|
||||
docker push ${CACHE_IMAGE}:$TAG_FREQAI_ARM
|
||||
docker push ${CACHE_IMAGE}:$TAG_FREQAI_RL_ARM
|
||||
docker push ${CACHE_IMAGE}:$TAG_ARM
|
||||
|
||||
- name: Create manifests
|
||||
env:
|
||||
TAG_ARM: ${{ steps.tags.outputs.TAG_ARM }}
|
||||
TAG: ${{ steps.tags.outputs.TAG }}
|
||||
TAG_PI: ${{ steps.tags.outputs.TAG_PI }}
|
||||
run: |
|
||||
docker buildx imagetools create \
|
||||
--tag ${IMAGE_NAME}:${TAG} \
|
||||
--tag ${GHCR_IMAGE_NAME}:${TAG} \
|
||||
${CACHE_IMAGE}:${TAG} ${CACHE_IMAGE}:${TAG_ARM} ${IMAGE_NAME}:${TAG_PI}
|
||||
|
||||
- name: Create multiarch image - Plot
|
||||
env:
|
||||
TAG_PLOT: ${{ steps.tags.outputs.TAG_PLOT }}
|
||||
TAG_PLOT_ARM: ${{ steps.tags.outputs.TAG_PLOT_ARM }}
|
||||
run: |
|
||||
docker buildx imagetools create \
|
||||
--tag ${IMAGE_NAME}:${TAG_PLOT} \
|
||||
--tag ${GHCR_IMAGE_NAME}:${TAG_PLOT} \
|
||||
${CACHE_IMAGE}:${TAG_PLOT} ${CACHE_IMAGE}:${TAG_PLOT_ARM}
|
||||
|
||||
- name: Create multiarch image - FreqAI
|
||||
env:
|
||||
TAG_FREQAI: ${{ steps.tags.outputs.TAG_FREQAI }}
|
||||
TAG_FREQAI_ARM: ${{ steps.tags.outputs.TAG_FREQAI_ARM }}
|
||||
run: |
|
||||
docker buildx imagetools create \
|
||||
--tag ${IMAGE_NAME}:${TAG_FREQAI} \
|
||||
--tag ${GHCR_IMAGE_NAME}:${TAG_FREQAI} \
|
||||
${CACHE_IMAGE}:${TAG_FREQAI} ${CACHE_IMAGE}:${TAG_FREQAI_ARM}
|
||||
|
||||
- name: Create multiarch image - FreqAI RL
|
||||
env:
|
||||
TAG_FREQAI_RL: ${{ steps.tags.outputs.TAG_FREQAI_RL }}
|
||||
TAG_FREQAI_RL_ARM: ${{ steps.tags.outputs.TAG_FREQAI_RL_ARM }}
|
||||
TAG_FREQAI_TORCH: ${{ steps.tags.outputs.TAG_FREQAI_TORCH }}
|
||||
run: |
|
||||
# Create special Torch tag - which is identical to the RL tag.
|
||||
docker buildx imagetools create \
|
||||
--tag ${IMAGE_NAME}:${TAG_FREQAI_RL} \
|
||||
--tag ${GHCR_IMAGE_NAME}:${TAG_FREQAI_RL} \
|
||||
--tag ${IMAGE_NAME}:${TAG_FREQAI_TORCH} \
|
||||
--tag ${GHCR_IMAGE_NAME}:${TAG_FREQAI_TORCH} \
|
||||
${CACHE_IMAGE}:${TAG_FREQAI_RL} ${CACHE_IMAGE}:${TAG_FREQAI_RL_ARM}
|
||||
|
||||
- name: Tag latest
|
||||
if: env.TAG == 'develop'
|
||||
env:
|
||||
TAG: ${{ steps.tags.outputs.TAG }}
|
||||
run: |
|
||||
# Tag image as latest
|
||||
docker buildx imagetools create \
|
||||
--tag ${GHCR_IMAGE_NAME}:${TAG} \
|
||||
--tag ${GHCR_IMAGE_NAME}:latest \
|
||||
${IMAGE_NAME}:${TAG}
|
||||
|
||||
- name: Docker images
|
||||
run: |
|
||||
docker images
|
||||
|
||||
- name: Image cleanup
|
||||
run: |
|
||||
docker image prune -a --force --filter "until=24h"
|
||||
|
||||
- name: Discord notification
|
||||
uses: rjstone/discord-webhook-notify@c2597273488aeda841dd1e891321952b51f7996f #v2.2.1
|
||||
|
||||
@@ -11,7 +11,7 @@ jobs:
|
||||
dockerHubDescription:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v5
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
name: Cleanup Packages
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
package_name:
|
||||
description: 'Package name to clean up'
|
||||
required: false
|
||||
default: 'freqtrade'
|
||||
type: string
|
||||
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
package_name:
|
||||
description: 'Package name to clean up'
|
||||
required: false
|
||||
default: 'freqtrade'
|
||||
type: choice
|
||||
options:
|
||||
- 'freqtrade'
|
||||
- 'freqtrade-devcontainer'
|
||||
delete-untagged:
|
||||
description: 'Whether to delete only untagged images'
|
||||
required: false
|
||||
default: true
|
||||
type: boolean
|
||||
|
||||
env:
|
||||
PACKAGE_NAME: "freqtrade"
|
||||
|
||||
jobs:
|
||||
deploy-docker:
|
||||
name: "Delete Packages"
|
||||
runs-on: ubuntu-24.04
|
||||
if: github.repository == 'freqtrade/freqtrade'
|
||||
permissions:
|
||||
packages: write
|
||||
|
||||
steps:
|
||||
- name: "Delete untagged Package Versions"
|
||||
uses: actions/delete-package-versions@v5
|
||||
with:
|
||||
package-name: ${{ inputs.package_name || env.PACKAGE_NAME }}
|
||||
package-type: 'container'
|
||||
min-versions-to-keep: 10
|
||||
delete-only-untagged-versions: ${{ inputs.delete-untagged || 'true' }}
|
||||
@@ -13,11 +13,11 @@ jobs:
|
||||
auto-update:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v5
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- uses: actions/setup-python@v5
|
||||
- uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version: "3.12"
|
||||
|
||||
|
||||
@@ -21,9 +21,9 @@ jobs:
|
||||
# actions: read # only needed for private repos
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v4.2.2
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Run zizmor 🌈
|
||||
uses: zizmorcore/zizmor-action@f52a838cfabf134edcbaa7c8b3677dde20045018 # v0.1.1
|
||||
uses: zizmorcore/zizmor-action@e673c3917a1aef3c65c972347ed84ccd013ecda4 # v0.2.0
|
||||
|
||||
@@ -21,18 +21,18 @@ repos:
|
||||
# stages: [push]
|
||||
|
||||
- repo: https://github.com/pre-commit/mirrors-mypy
|
||||
rev: "v1.17.0"
|
||||
rev: "v1.18.2"
|
||||
hooks:
|
||||
- id: mypy
|
||||
exclude: build_helpers
|
||||
additional_dependencies:
|
||||
- types-cachetools==6.1.0.20250717
|
||||
- types-cachetools==6.2.0.20250827
|
||||
- types-filelock==3.2.7
|
||||
- types-requests==2.32.4.20250611
|
||||
- types-requests==2.32.4.20250913
|
||||
- types-tabulate==0.9.0.20241207
|
||||
- types-python-dateutil==2.9.0.20250708
|
||||
- scipy-stubs==1.16.0.2
|
||||
- SQLAlchemy==2.0.41
|
||||
- types-python-dateutil==2.9.0.20250822
|
||||
- scipy-stubs==1.16.2.0
|
||||
- SQLAlchemy==2.0.43
|
||||
# stages: [push]
|
||||
|
||||
- repo: https://github.com/pycqa/isort
|
||||
@@ -44,13 +44,13 @@ repos:
|
||||
|
||||
- repo: https://github.com/charliermarsh/ruff-pre-commit
|
||||
# Ruff version.
|
||||
rev: 'v0.12.5'
|
||||
rev: 'v0.13.1'
|
||||
hooks:
|
||||
- id: ruff
|
||||
- id: ruff-format
|
||||
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v5.0.0
|
||||
rev: v6.0.0
|
||||
hooks:
|
||||
- id: end-of-file-fixer
|
||||
exclude: |
|
||||
@@ -83,6 +83,6 @@ repos:
|
||||
|
||||
# Ensure github actions remain safe
|
||||
- repo: https://github.com/woodruffw/zizmor-pre-commit
|
||||
rev: v1.11.0
|
||||
rev: v1.13.0
|
||||
hooks:
|
||||
- id: zizmor
|
||||
|
||||
+31
-29
@@ -9,8 +9,10 @@ Issues labeled [good first issue](https://github.com/freqtrade/freqtrade/labels/
|
||||
Few pointers for contributions:
|
||||
|
||||
- Create your PR against the `develop` branch, not `stable`.
|
||||
- New features need to contain unit tests, must conform to PEP8 (max-line-length = 100) and should be documented with the introduction PR.
|
||||
- PR's can be declared as `[WIP]` - which signify Work in Progress Pull Requests (which are not finished).
|
||||
- Stick to english in both commit messages, PR descriptions and code comments and variable names.
|
||||
- New features need to contain unit tests, must pass CI (run pre-commit and pytest to get an early feedback) and should be documented with the introduction PR.
|
||||
- PR's can be declared as draft - signaling Work in Progress for Pull Requests (which are not finished). We'll still aim to provide feedback on draft PR's in a timely manner.
|
||||
- If you're using AI for your PR, please both mention it in the PR description and do a thorough review of the generated code. The final responsibility for the code with the PR author, not with the AI.
|
||||
|
||||
If you are unsure, discuss the feature on our [discord server](https://discord.gg/p7nuUNVfP7) or in a [issue](https://github.com/freqtrade/freqtrade/issues) before a Pull Request.
|
||||
|
||||
@@ -43,43 +45,43 @@ pytest tests/test_<file_name>.py
|
||||
pytest tests/test_<file_name>.py::test_<method_name>
|
||||
```
|
||||
|
||||
### 2. Test if your code is PEP8 compliant
|
||||
### 2. Test if your code corresponds to our style guide
|
||||
|
||||
#### Run Ruff
|
||||
We receive a lot of code that fails preliminary CI checks.
|
||||
To help with that, we encourage contributors to install the git pre-commit hook that will let you know immediately when you try to commit code that fails these checks.
|
||||
|
||||
You can manually run pre-commit with `pre-commit run -a` - or install the git hook with `pre-commit install` to have it run automatically on each commit.
|
||||
|
||||
Running `pre-commit run -a` will run all checks, including `ruff`, `mypy` and `codespell` (among others).
|
||||
|
||||
#### Additional styles applied
|
||||
|
||||
- Have docstrings on all public methods
|
||||
- Use double-quotes for docstrings
|
||||
- Multiline docstrings should be indented to the level of the first quote
|
||||
- Doc-strings should follow the reST format (`:param xxx: ...`, `:return: ...`, `:raises KeyError: ...`)
|
||||
|
||||
#### Manually run the individual checks
|
||||
|
||||
The following sections describe how to run the individual checks that are running as part of the pre-commit hook.
|
||||
|
||||
##### Run ruff
|
||||
|
||||
Check your code with ruff to ensure that it follows the style guide.
|
||||
|
||||
```bash
|
||||
ruff check .
|
||||
ruff format .
|
||||
```
|
||||
|
||||
We receive a lot of code that fails the `ruff` checks.
|
||||
To help with that, we encourage you to install the git pre-commit
|
||||
hook that will warn you when you try to commit code that fails these checks.
|
||||
##### Run mypy
|
||||
|
||||
you can manually run pre-commit with `pre-commit run -a`.
|
||||
|
||||
##### Additional styles applied
|
||||
|
||||
* Have docstrings on all public methods
|
||||
* Use double-quotes for docstrings
|
||||
* Multiline docstrings should be indented to the level of the first quote
|
||||
* Doc-strings should follow the reST format (`:param xxx: ...`, `:return: ...`, `:raises KeyError: ... `)
|
||||
|
||||
### 3. Test if all type-hints are correct
|
||||
|
||||
#### Run mypy
|
||||
Check your code with mypy to ensure that it follows the type-hinting rules.
|
||||
|
||||
``` bash
|
||||
mypy freqtrade
|
||||
```
|
||||
|
||||
### 4. Ensure formatting is correct
|
||||
|
||||
#### Run ruff
|
||||
|
||||
``` bash
|
||||
ruff format .
|
||||
```
|
||||
|
||||
## (Core)-Committer Guide
|
||||
|
||||
### Process: Pull Requests
|
||||
@@ -118,7 +120,7 @@ Exceptions:
|
||||
- Ensure cross-platform compatibility for every change that's accepted. Windows, Mac & Linux.
|
||||
- Ensure no malicious code is introduced into the core code.
|
||||
- Create issues for any major changes and enhancements that you wish to make. Discuss things transparently and get community feedback.
|
||||
- Keep feature versions as small as possible, preferably one new feature per version.
|
||||
- Keep feature PR's as small as possible, preferably one new feature per PR.
|
||||
- Be welcoming to newcomers and encourage diverse new contributors from all backgrounds. See the Python Community Code of Conduct (https://www.python.org/psf/codeofconduct/).
|
||||
|
||||
### Becoming a Committer
|
||||
@@ -130,6 +132,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.
|
||||
|
||||
Being a Committer does not grant write permission on `develop` or `stable` for security reasons (Users trust Freqtrade with their Exchange API keys).
|
||||
Being a Committer does not automatically grant write permission on `develop` or `stable` for security reasons (Users trust Freqtrade with their Exchange API keys).
|
||||
|
||||
After being Committer for some time, a Committer may be named Core Committer and given full repository access.
|
||||
|
||||
+2
-7
@@ -1,4 +1,4 @@
|
||||
FROM python:3.13.5-slim-bookworm AS base
|
||||
FROM python:3.13.7-slim-bookworm AS base
|
||||
|
||||
# Setup env
|
||||
ENV LANG=C.UTF-8
|
||||
@@ -27,11 +27,6 @@ RUN apt-get update \
|
||||
&& apt-get clean \
|
||||
&& pip install --upgrade pip wheel
|
||||
|
||||
# Install TA-lib
|
||||
COPY build_helpers/* /tmp/
|
||||
RUN cd /tmp && /tmp/install_ta-lib.sh && rm -r /tmp/*ta-lib*
|
||||
ENV LD_LIBRARY_PATH=/usr/local/lib
|
||||
|
||||
# Install dependencies
|
||||
COPY --chown=ftuser:ftuser requirements.txt requirements-hyperopt.txt /freqtrade/
|
||||
USER ftuser
|
||||
@@ -49,7 +44,7 @@ USER ftuser
|
||||
# Install and execute
|
||||
COPY --chown=ftuser:ftuser . /freqtrade/
|
||||
|
||||
RUN pip install -e . --user --no-cache-dir --no-build-isolation \
|
||||
RUN pip install -e . --user --no-cache-dir \
|
||||
&& mkdir /freqtrade/user_data/ \
|
||||
&& freqtrade install-ui
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
[](https://doi.org/10.21105/joss.04864)
|
||||
[](https://coveralls.io/github/freqtrade/freqtrade?branch=develop)
|
||||
[](https://www.freqtrade.io)
|
||||
[](https://codeclimate.com/github/freqtrade/freqtrade/maintainability)
|
||||
|
||||
Freqtrade is a free and open source crypto trading bot written in Python. It is designed to support all major exchanges and be controlled via Telegram or webUI. It contains backtesting, plotting and money management tools as well as strategy optimization by machine learning.
|
||||
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
if [ -z "$1" ]; then
|
||||
INSTALL_LOC=/usr/local
|
||||
else
|
||||
INSTALL_LOC=${1}
|
||||
fi
|
||||
echo "Installing to ${INSTALL_LOC}"
|
||||
if [ -n "$2" ] || [ ! -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 \
|
||||
&& echo "Downloading gcc config.guess and config.sub" \
|
||||
&& curl -s 'https://raw.githubusercontent.com/gcc-mirror/gcc/master/config.guess' -o config.guess \
|
||||
&& curl -s 'https://raw.githubusercontent.com/gcc-mirror/gcc/master/config.sub' -o config.sub \
|
||||
&& ./configure --prefix=${INSTALL_LOC}/ \
|
||||
&& make
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed building ta-lib."
|
||||
cd .. && rm -rf ./ta-lib/
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "$2" ]; then
|
||||
which sudo && sudo make install || make install
|
||||
if [ -x "$(command -v apt-get)" ]; then
|
||||
echo "Updating library path using ldconfig"
|
||||
sudo ldconfig
|
||||
fi
|
||||
else
|
||||
# Don't install with sudo
|
||||
make install
|
||||
fi
|
||||
|
||||
cd .. && rm -rf ./ta-lib/
|
||||
else
|
||||
echo "TA-lib already installed, skipping installation"
|
||||
fi
|
||||
@@ -1,10 +0,0 @@
|
||||
# vendored Wheels compiled via https://github.com/xmatthias/ta-lib-python/tree/ta_bundled_040
|
||||
|
||||
python -m pip install --upgrade pip
|
||||
python -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')"
|
||||
|
||||
pip install -U wheel "numpy<3.0"
|
||||
pip install --only-binary ta-lib --find-links=build_helpers\ "ta-lib<0.6.0"
|
||||
|
||||
pip install -r requirements-dev.txt
|
||||
pip install -e .
|
||||
@@ -1,119 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Use BuildKit, otherwise building on ARM fails
|
||||
export DOCKER_BUILDKIT=1
|
||||
|
||||
IMAGE_NAME=freqtradeorg/freqtrade
|
||||
CACHE_IMAGE=freqtradeorg/freqtrade_cache
|
||||
GHCR_IMAGE_NAME=ghcr.io/freqtrade/freqtrade
|
||||
|
||||
# Replace / with _ to create a valid tag
|
||||
TAG=$(echo "${BRANCH_NAME}" | sed -e "s/\//_/g")
|
||||
TAG_PLOT=${TAG}_plot
|
||||
TAG_FREQAI=${TAG}_freqai
|
||||
TAG_FREQAI_RL=${TAG_FREQAI}rl
|
||||
TAG_FREQAI_TORCH=${TAG_FREQAI}torch
|
||||
TAG_PI="${TAG}_pi"
|
||||
|
||||
TAG_ARM=${TAG}_arm
|
||||
TAG_PLOT_ARM=${TAG_PLOT}_arm
|
||||
TAG_FREQAI_ARM=${TAG_FREQAI}_arm
|
||||
TAG_FREQAI_RL_ARM=${TAG_FREQAI_RL}_arm
|
||||
|
||||
echo "Running for ${TAG}"
|
||||
|
||||
# Add commit and commit_message to docker container
|
||||
echo "${GITHUB_SHA}" > freqtrade_commit
|
||||
|
||||
if [ "${GITHUB_EVENT_NAME}" = "schedule" ]; then
|
||||
echo "event ${GITHUB_EVENT_NAME}: full rebuild - skipping cache"
|
||||
# Build regular image
|
||||
docker build -t freqtrade:${TAG_ARM} .
|
||||
|
||||
else
|
||||
echo "event ${GITHUB_EVENT_NAME}: building with cache"
|
||||
# Build regular image
|
||||
docker pull ${IMAGE_NAME}:${TAG_ARM}
|
||||
docker build --cache-from ${IMAGE_NAME}:${TAG_ARM} -t freqtrade:${TAG_ARM} .
|
||||
|
||||
fi
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "failed building multiarch images"
|
||||
return 1
|
||||
fi
|
||||
|
||||
docker build --build-arg sourceimage=freqtrade --build-arg sourcetag=${TAG_ARM} -t freqtrade:${TAG_PLOT_ARM} -f docker/Dockerfile.plot .
|
||||
docker build --build-arg sourceimage=freqtrade --build-arg sourcetag=${TAG_ARM} -t freqtrade:${TAG_FREQAI_ARM} -f docker/Dockerfile.freqai .
|
||||
docker build --build-arg sourceimage=freqtrade --build-arg sourcetag=${TAG_FREQAI_ARM} -t freqtrade:${TAG_FREQAI_RL_ARM} -f docker/Dockerfile.freqai_rl .
|
||||
|
||||
# Tag image for upload and next build step
|
||||
docker tag freqtrade:$TAG_ARM ${CACHE_IMAGE}:$TAG_ARM
|
||||
docker tag freqtrade:$TAG_PLOT_ARM ${CACHE_IMAGE}:$TAG_PLOT_ARM
|
||||
docker tag freqtrade:$TAG_FREQAI_ARM ${CACHE_IMAGE}:$TAG_FREQAI_ARM
|
||||
docker tag freqtrade:$TAG_FREQAI_RL_ARM ${CACHE_IMAGE}:$TAG_FREQAI_RL_ARM
|
||||
|
||||
# Run backtest
|
||||
docker run --rm -v $(pwd)/tests/testdata/config.tests.json:/freqtrade/config.json:ro -v $(pwd)/tests:/tests freqtrade:${TAG_ARM} backtesting --datadir /tests/testdata --strategy-path /tests/strategy/strats/ --strategy StrategyTestV3
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "failed running backtest"
|
||||
return 1
|
||||
fi
|
||||
|
||||
docker images
|
||||
|
||||
docker push ${CACHE_IMAGE}:$TAG_PLOT_ARM
|
||||
docker push ${CACHE_IMAGE}:$TAG_FREQAI_ARM
|
||||
docker push ${CACHE_IMAGE}:$TAG_FREQAI_RL_ARM
|
||||
docker push ${CACHE_IMAGE}:$TAG_ARM
|
||||
|
||||
# Create multi-arch image
|
||||
# Make sure that all images contained here are pushed to github first.
|
||||
# Otherwise installation might fail.
|
||||
echo "create manifests"
|
||||
|
||||
docker manifest create ${IMAGE_NAME}:${TAG} ${CACHE_IMAGE}:${TAG} ${CACHE_IMAGE}:${TAG_ARM} ${IMAGE_NAME}:${TAG_PI}
|
||||
docker manifest push -p ${IMAGE_NAME}:${TAG}
|
||||
|
||||
docker manifest create ${IMAGE_NAME}:${TAG_PLOT} ${CACHE_IMAGE}:${TAG_PLOT} ${CACHE_IMAGE}:${TAG_PLOT_ARM}
|
||||
docker manifest push -p ${IMAGE_NAME}:${TAG_PLOT}
|
||||
|
||||
docker manifest create ${IMAGE_NAME}:${TAG_FREQAI} ${CACHE_IMAGE}:${TAG_FREQAI} ${CACHE_IMAGE}:${TAG_FREQAI_ARM}
|
||||
docker manifest push -p ${IMAGE_NAME}:${TAG_FREQAI}
|
||||
|
||||
docker manifest create ${IMAGE_NAME}:${TAG_FREQAI_RL} ${CACHE_IMAGE}:${TAG_FREQAI_RL} ${CACHE_IMAGE}:${TAG_FREQAI_RL_ARM}
|
||||
docker manifest push -p ${IMAGE_NAME}:${TAG_FREQAI_RL}
|
||||
|
||||
# Create special Torch tag - which is identical to the RL tag.
|
||||
docker manifest create ${IMAGE_NAME}:${TAG_FREQAI_TORCH} ${CACHE_IMAGE}:${TAG_FREQAI_RL} ${CACHE_IMAGE}:${TAG_FREQAI_RL_ARM}
|
||||
docker manifest push -p ${IMAGE_NAME}:${TAG_FREQAI_TORCH}
|
||||
|
||||
# copy images to ghcr.io
|
||||
|
||||
alias crane="docker run --rm -i -v $(pwd)/.crane:/home/nonroot/.docker/ gcr.io/go-containerregistry/crane"
|
||||
mkdir .crane
|
||||
chmod a+rwx .crane
|
||||
|
||||
echo "${GHCR_TOKEN}" | crane auth login ghcr.io -u "${GHCR_USERNAME}" --password-stdin
|
||||
|
||||
crane copy ${IMAGE_NAME}:${TAG_FREQAI_RL} ${GHCR_IMAGE_NAME}:${TAG_FREQAI_RL}
|
||||
crane copy ${IMAGE_NAME}:${TAG_FREQAI_RL} ${GHCR_IMAGE_NAME}:${TAG_FREQAI_TORCH}
|
||||
crane copy ${IMAGE_NAME}:${TAG_FREQAI} ${GHCR_IMAGE_NAME}:${TAG_FREQAI}
|
||||
crane copy ${IMAGE_NAME}:${TAG_PLOT} ${GHCR_IMAGE_NAME}:${TAG_PLOT}
|
||||
crane copy ${IMAGE_NAME}:${TAG} ${GHCR_IMAGE_NAME}:${TAG}
|
||||
|
||||
# Tag as latest for develop builds
|
||||
if [ "${TAG}" = "develop" ]; then
|
||||
echo 'Tagging image as latest'
|
||||
docker manifest create ${IMAGE_NAME}:latest ${CACHE_IMAGE}:${TAG_ARM} ${IMAGE_NAME}:${TAG_PI} ${CACHE_IMAGE}:${TAG}
|
||||
docker manifest push -p ${IMAGE_NAME}:latest
|
||||
|
||||
crane copy ${IMAGE_NAME}:latest ${GHCR_IMAGE_NAME}:latest
|
||||
fi
|
||||
|
||||
docker images
|
||||
rm -rf .crane
|
||||
|
||||
# Cleanup old images from arm64 node.
|
||||
docker image prune -a --force --filter "until=24h"
|
||||
@@ -1,89 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# The below assumes a correctly setup docker buildx environment
|
||||
|
||||
IMAGE_NAME=freqtradeorg/freqtrade
|
||||
CACHE_IMAGE=freqtradeorg/freqtrade_cache
|
||||
# Replace / with _ to create a valid tag
|
||||
TAG=$(echo "${BRANCH_NAME}" | sed -e "s/\//_/g")
|
||||
TAG_PLOT=${TAG}_plot
|
||||
TAG_FREQAI=${TAG}_freqai
|
||||
TAG_FREQAI_RL=${TAG_FREQAI}rl
|
||||
TAG_PI="${TAG}_pi"
|
||||
|
||||
PI_PLATFORM="linux/arm/v7"
|
||||
echo "Running for ${TAG}"
|
||||
CACHE_TAG=${CACHE_IMAGE}:${TAG_PI}_cache
|
||||
|
||||
# Add commit and commit_message to docker container
|
||||
echo "${GITHUB_SHA}" > freqtrade_commit
|
||||
|
||||
if [ "${GITHUB_EVENT_NAME}" = "schedule" ]; then
|
||||
echo "event ${GITHUB_EVENT_NAME}: full rebuild - skipping cache"
|
||||
# Build regular image
|
||||
docker build -t freqtrade:${TAG} .
|
||||
# Build PI image
|
||||
docker buildx build \
|
||||
--cache-to=type=registry,ref=${CACHE_TAG} \
|
||||
-f docker/Dockerfile.armhf \
|
||||
--platform ${PI_PLATFORM} \
|
||||
-t ${IMAGE_NAME}:${TAG_PI} \
|
||||
--push \
|
||||
--provenance=false \
|
||||
.
|
||||
else
|
||||
echo "event ${GITHUB_EVENT_NAME}: building with cache"
|
||||
# Build regular image
|
||||
docker pull ${IMAGE_NAME}:${TAG}
|
||||
docker build --cache-from ${IMAGE_NAME}:${TAG} -t freqtrade:${TAG} .
|
||||
|
||||
# Pull last build to avoid rebuilding the whole image
|
||||
# docker pull --platform ${PI_PLATFORM} ${IMAGE_NAME}:${TAG}
|
||||
# disable provenance due to https://github.com/docker/buildx/issues/1509
|
||||
docker buildx build \
|
||||
--cache-from=type=registry,ref=${CACHE_TAG} \
|
||||
--cache-to=type=registry,ref=${CACHE_TAG} \
|
||||
-f docker/Dockerfile.armhf \
|
||||
--platform ${PI_PLATFORM} \
|
||||
-t ${IMAGE_NAME}:${TAG_PI} \
|
||||
--push \
|
||||
--provenance=false \
|
||||
.
|
||||
fi
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "failed building multiarch images"
|
||||
return 1
|
||||
fi
|
||||
# Tag image for upload and next build step
|
||||
docker tag freqtrade:$TAG ${CACHE_IMAGE}:$TAG
|
||||
|
||||
docker build --build-arg sourceimage=freqtrade --build-arg sourcetag=${TAG} -t freqtrade:${TAG_PLOT} -f docker/Dockerfile.plot .
|
||||
docker build --build-arg sourceimage=freqtrade --build-arg sourcetag=${TAG} -t freqtrade:${TAG_FREQAI} -f docker/Dockerfile.freqai .
|
||||
docker build --build-arg sourceimage=freqtrade --build-arg sourcetag=${TAG_FREQAI} -t freqtrade:${TAG_FREQAI_RL} -f docker/Dockerfile.freqai_rl .
|
||||
|
||||
docker tag freqtrade:$TAG_PLOT ${CACHE_IMAGE}:$TAG_PLOT
|
||||
docker tag freqtrade:$TAG_FREQAI ${CACHE_IMAGE}:$TAG_FREQAI
|
||||
docker tag freqtrade:$TAG_FREQAI_RL ${CACHE_IMAGE}:$TAG_FREQAI_RL
|
||||
|
||||
# Run backtest
|
||||
docker run --rm -v $(pwd)/tests/testdata/config.tests.json:/freqtrade/config.json:ro -v $(pwd)/tests:/tests freqtrade:${TAG} backtesting --datadir /tests/testdata --strategy-path /tests/strategy/strats/ --strategy StrategyTestV3
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "failed running backtest"
|
||||
return 1
|
||||
fi
|
||||
|
||||
docker images
|
||||
|
||||
docker push ${CACHE_IMAGE}:$TAG
|
||||
docker push ${CACHE_IMAGE}:$TAG_PLOT
|
||||
docker push ${CACHE_IMAGE}:$TAG_FREQAI
|
||||
docker push ${CACHE_IMAGE}:$TAG_FREQAI_RL
|
||||
|
||||
docker images
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "failed building image"
|
||||
return 1
|
||||
fi
|
||||
@@ -180,6 +180,16 @@
|
||||
"description": "Offset for profit exit. \nUsually specified in the strategy and missing in the configuration.",
|
||||
"type": "number"
|
||||
},
|
||||
"recursive_strategy_search": {
|
||||
"description": "Enable recursive strategy search.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"user_data_dir": {
|
||||
"description": "Path to the user data directory."
|
||||
},
|
||||
"datadir": {
|
||||
"description": "Path to the data directory."
|
||||
},
|
||||
"fee": {
|
||||
"description": "Trading fee percentage. Can help to simulate slippage in backtesting",
|
||||
"type": "number",
|
||||
@@ -562,6 +572,7 @@
|
||||
"pairlists": {
|
||||
"description": "Configuration for pairlists.",
|
||||
"type": "array",
|
||||
"minItems": 1,
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -576,6 +587,7 @@
|
||||
"RemotePairList",
|
||||
"MarketCapPairList",
|
||||
"AgeFilter",
|
||||
"DelistFilter",
|
||||
"FullTradesFilter",
|
||||
"OffsetFilter",
|
||||
"PerformanceFilter",
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -25,10 +25,10 @@
|
||||
"trading_mode": "spot",
|
||||
"margin_mode": "",
|
||||
"minimal_roi": {
|
||||
"40": 0.0,
|
||||
"30": 0.01,
|
||||
"20": 0.02,
|
||||
"0": 0.04
|
||||
"40": 0.0,
|
||||
"30": 0.01,
|
||||
"20": 0.02,
|
||||
"0": 0.04
|
||||
},
|
||||
"stoploss": -0.10,
|
||||
"unfilledtimeout": {
|
||||
@@ -47,7 +47,7 @@
|
||||
"bids_to_ask_delta": 1
|
||||
}
|
||||
},
|
||||
"exit_pricing":{
|
||||
"exit_pricing": {
|
||||
"price_side": "same",
|
||||
"use_order_book": true,
|
||||
"order_book_top": 1,
|
||||
@@ -70,18 +70,38 @@
|
||||
"exit": "GTC"
|
||||
},
|
||||
"pairlists": [
|
||||
{"method": "StaticPairList"},
|
||||
{"method": "FullTradesFilter"},
|
||||
{
|
||||
"method": "StaticPairList"
|
||||
},
|
||||
{
|
||||
"method": "DelistFilter",
|
||||
"max_days_from_now": 0,
|
||||
},
|
||||
{
|
||||
"method": "FullTradesFilter"
|
||||
},
|
||||
{
|
||||
"method": "VolumePairList",
|
||||
"number_assets": 20,
|
||||
"sort_key": "quoteVolume",
|
||||
"refresh_period": 1800
|
||||
},
|
||||
{"method": "AgeFilter", "min_days_listed": 10},
|
||||
{"method": "PrecisionFilter"},
|
||||
{"method": "PriceFilter", "low_price_ratio": 0.01, "min_price": 0.00000010},
|
||||
{"method": "SpreadFilter", "max_spread_ratio": 0.005},
|
||||
{
|
||||
"method": "AgeFilter",
|
||||
"min_days_listed": 10
|
||||
},
|
||||
{
|
||||
"method": "PrecisionFilter"
|
||||
},
|
||||
{
|
||||
"method": "PriceFilter",
|
||||
"low_price_ratio": 0.01,
|
||||
"min_price": 0.00000010
|
||||
},
|
||||
{
|
||||
"method": "SpreadFilter",
|
||||
"max_spread_ratio": 0.005
|
||||
},
|
||||
{
|
||||
"method": "RangeStabilityFilter",
|
||||
"lookback_days": 10,
|
||||
@@ -166,12 +186,12 @@
|
||||
"external_message_consumer": {
|
||||
"enabled": false,
|
||||
"producers": [
|
||||
{
|
||||
"name": "default",
|
||||
"host": "127.0.0.2",
|
||||
"port": 8080,
|
||||
"ws_token": "secret_ws_t0ken."
|
||||
}
|
||||
{
|
||||
"name": "default",
|
||||
"host": "127.0.0.2",
|
||||
"port": 8080,
|
||||
"ws_token": "secret_ws_t0ken."
|
||||
}
|
||||
],
|
||||
"wait_timeout": 300,
|
||||
"ping_timeout": 10,
|
||||
@@ -195,4 +215,4 @@
|
||||
"reduce_df_footprint": false,
|
||||
"dataformat_ohlcv": "feather",
|
||||
"dataformat_trades": "feather"
|
||||
}
|
||||
}
|
||||
@@ -34,8 +34,7 @@ COPY build_helpers/* /tmp/
|
||||
# Install dependencies
|
||||
COPY --chown=ftuser:ftuser requirements.txt /freqtrade/
|
||||
USER ftuser
|
||||
RUN pip install --user --no-cache-dir "numpy<3.0" \
|
||||
&& pip install --user --no-index --find-links /tmp/ pyarrow TA-Lib \
|
||||
RUN pip install --user --only-binary=:all: --find-links /tmp/ pyarrow TA-Lib \
|
||||
&& pip install --user --no-cache-dir -r requirements.txt
|
||||
|
||||
# Copy dependencies to runtime-image
|
||||
@@ -49,7 +48,7 @@ USER ftuser
|
||||
# Install and execute
|
||||
COPY --chown=ftuser:ftuser . /freqtrade/
|
||||
|
||||
RUN pip install -e . --user --no-cache-dir --no-build-isolation\
|
||||
RUN pip install -e . --user --no-cache-dir \
|
||||
&& mkdir /freqtrade/user_data/ \
|
||||
&& freqtrade install-ui
|
||||
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
FROM freqtradeorg/freqtrade:develop
|
||||
|
||||
# Install dependencies
|
||||
COPY requirements-dev.txt /freqtrade/
|
||||
|
||||
RUN pip install numpy --user --no-cache-dir \
|
||||
&& pip install -r requirements-dev.txt --user --no-cache-dir
|
||||
|
||||
# Empty the ENTRYPOINT to allow all commands
|
||||
ENTRYPOINT []
|
||||
@@ -46,29 +46,32 @@ ranging from the simplest (0) to the most detailed per pair, per buy and per sel
|
||||
|
||||
More options are available by running with the `-h` option.
|
||||
|
||||
### Using export-filename
|
||||
### Using backtest-filename
|
||||
|
||||
Normally, `backtesting-analysis` uses the latest backtest results, but if you wanted to go
|
||||
back to a previous backtest output, you need to supply the `--export-filename` option.
|
||||
You can supply the same parameter to `backtest-analysis` with the name of the final backtest
|
||||
output file. This allows you to keep historical versions of backtest results and re-analyse
|
||||
them at a later date:
|
||||
By default, `backtesting-analysis` processes the most recent backtest results in the `user_data/backtest_results` directory.
|
||||
If you want to analyze results from an earlier backtest, use the `--backtest-filename` option to specify the desired file. This lets you revisit and re-analyze historical backtest outputs at any time by providing the filename of the relevant backtest result:
|
||||
|
||||
``` bash
|
||||
freqtrade backtesting -c <config.json> --timeframe <tf> --strategy <strategy_name> --timerange=<timerange> --export=signals --export-filename=/tmp/mystrat_backtest.json
|
||||
freqtrade backtesting-analysis -c <config.json> --timeframe <tf> --strategy <strategy_name> --timerange <timerange> --export signals --backtest-filename backtest-result-2025-03-05_20-38-34.zip
|
||||
```
|
||||
|
||||
You should see some output similar to below in the logs with the name of the timestamped
|
||||
filename that was exported:
|
||||
|
||||
```
|
||||
2022-06-14 16:28:32,698 - freqtrade.misc - INFO - dumping json to "/tmp/mystrat_backtest-2022-06-14_16-28-32.json"
|
||||
2022-06-14 16:28:32,698 - freqtrade.misc - INFO - dumping json to "mystrat_backtest-2022-06-14_16-28-32.json"
|
||||
```
|
||||
|
||||
You can then use that filename in `backtesting-analysis`:
|
||||
|
||||
```
|
||||
freqtrade backtesting-analysis -c <config.json> --export-filename=/tmp/mystrat_backtest-2022-06-14_16-28-32.json
|
||||
freqtrade backtesting-analysis -c <config.json> --backtest-filename=mystrat_backtest-2022-06-14_16-28-32.json
|
||||
```
|
||||
|
||||
To use a result from a different results directory, you can use `--backtest-directory` to specify the directory
|
||||
|
||||
``` bash
|
||||
freqtrade backtesting-analysis -c <config.json> --backtest-directory custom_results/ --backtest-filename mystrat_backtest-2022-06-14_16-28-32.json
|
||||
```
|
||||
|
||||
### Tuning the buy tags and sell tags to display
|
||||
|
||||
+235
-204
@@ -105,12 +105,14 @@ Only use this if you're sure you'll not want to plot or analyze your results fur
|
||||
|
||||
---
|
||||
|
||||
Exporting trades to file specifying a custom filename
|
||||
Exporting trades to file specifying a custom directory
|
||||
|
||||
```bash
|
||||
freqtrade backtesting --strategy backtesting --export trades --export-filename=backtest_samplestrategy.json
|
||||
freqtrade backtesting --strategy backtesting --export trades --backtest-directory=user_data/custom-backtest-results
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
Please also read about the [strategy startup period](strategy-customization.md#strategy-startup-period).
|
||||
|
||||
---
|
||||
@@ -158,117 +160,136 @@ The most important in the backtesting is to understand the result.
|
||||
A backtesting result will look like that:
|
||||
|
||||
```
|
||||
================================================ BACKTESTING REPORT =================================================
|
||||
| Pair | Trades | Avg Profit % | Tot Profit BTC | Tot Profit % | Avg Duration | Wins Draws Loss Win% |
|
||||
|----------+--------+----------------+------------------+----------------+--------------+--------------------------|
|
||||
| ADA/BTC | 35 | -0.11 | -0.00019428 | -1.94 | 4:35:00 | 14 0 21 40.0 |
|
||||
| ARK/BTC | 11 | -0.41 | -0.00022647 | -2.26 | 2:03:00 | 3 0 8 27.3 |
|
||||
| BTS/BTC | 32 | 0.31 | 0.00048938 | 4.89 | 5:05:00 | 18 0 14 56.2 |
|
||||
| DASH/BTC | 13 | -0.08 | -0.00005343 | -0.53 | 4:39:00 | 6 0 7 46.2 |
|
||||
| ENG/BTC | 18 | 1.36 | 0.00122807 | 12.27 | 2:50:00 | 8 0 10 44.4 |
|
||||
| EOS/BTC | 36 | 0.08 | 0.00015304 | 1.53 | 3:34:00 | 16 0 20 44.4 |
|
||||
| ETC/BTC | 26 | 0.37 | 0.00047576 | 4.75 | 6:14:00 | 11 0 15 42.3 |
|
||||
| ETH/BTC | 33 | 0.30 | 0.00049856 | 4.98 | 7:31:00 | 16 0 17 48.5 |
|
||||
| IOTA/BTC | 32 | 0.03 | 0.00005444 | 0.54 | 3:12:00 | 14 0 18 43.8 |
|
||||
| LSK/BTC | 15 | 1.75 | 0.00131413 | 13.13 | 2:58:00 | 6 0 9 40.0 |
|
||||
| LTC/BTC | 32 | -0.04 | -0.00006886 | -0.69 | 4:49:00 | 11 0 21 34.4 |
|
||||
| NANO/BTC | 17 | 1.26 | 0.00107058 | 10.70 | 1:55:00 | 10 0 7 58.5 |
|
||||
| NEO/BTC | 23 | 0.82 | 0.00094936 | 9.48 | 2:59:00 | 10 0 13 43.5 |
|
||||
| REQ/BTC | 9 | 1.17 | 0.00052734 | 5.27 | 3:47:00 | 4 0 5 44.4 |
|
||||
| XLM/BTC | 16 | 1.22 | 0.00097800 | 9.77 | 3:15:00 | 7 0 9 43.8 |
|
||||
| XMR/BTC | 23 | -0.18 | -0.00020696 | -2.07 | 5:30:00 | 12 0 11 52.2 |
|
||||
| XRP/BTC | 35 | 0.66 | 0.00114897 | 11.48 | 3:49:00 | 12 0 23 34.3 |
|
||||
| ZEC/BTC | 22 | -0.46 | -0.00050971 | -5.09 | 2:22:00 | 7 0 15 31.8 |
|
||||
| TOTAL | 429 | 0.36 | 0.00762792 | 76.20 | 4:12:00 | 186 0 243 43.4 |
|
||||
============================================= LEFT OPEN TRADES REPORT =============================================
|
||||
| Pair | Trades | Avg Profit % | Tot Profit BTC | Tot Profit % | Avg Duration | Win Draw Loss Win% |
|
||||
|----------+---------+----------------+------------------+----------------+----------------+---------------------|
|
||||
| ADA/BTC | 1 | 0.89 | 0.00004434 | 0.44 | 6:00:00 | 1 0 0 100 |
|
||||
| LTC/BTC | 1 | 0.68 | 0.00003421 | 0.34 | 2:00:00 | 1 0 0 100 |
|
||||
| TOTAL | 2 | 0.78 | 0.00007855 | 0.78 | 4:00:00 | 2 0 0 100 |
|
||||
==================== EXIT REASON STATS ====================
|
||||
| Exit Reason | Exits | Wins | Draws | Losses |
|
||||
|--------------------+---------+-------+--------+---------|
|
||||
| trailing_stop_loss | 205 | 150 | 0 | 55 |
|
||||
| stop_loss | 166 | 0 | 0 | 166 |
|
||||
| exit_signal | 56 | 36 | 0 | 20 |
|
||||
| force_exit | 2 | 0 | 0 | 2 |
|
||||
BACKTESTING REPORT
|
||||
┏━━━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━┓
|
||||
┃ Pair ┃ Trades ┃ Avg Profit % ┃ Tot Profit USDT ┃ Tot Profit % ┃ Avg Duration ┃ Win Draw Loss Win% ┃
|
||||
┡━━━━━━━━━━━━━━━╇━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━┩
|
||||
│ LTC/USDT:USDT │ 16 │ 1.0 │ 56.176 │ 5.62 │ 16:16:00 │ 16 0 0 100 │
|
||||
│ ETC/USDT:USDT │ 12 │ 0.72 │ 30.936 │ 3.09 │ 9:55:00 │ 11 0 1 91.7 │
|
||||
│ ETH/USDT:USDT │ 8 │ 0.66 │ 17.864 │ 1.79 │ 1 day, 13:55:00 │ 7 0 1 87.5 │
|
||||
│ XLM/USDT:USDT │ 10 │ 0.31 │ 11.054 │ 1.11 │ 12:08:00 │ 9 0 1 90.0 │
|
||||
│ BTC/USDT:USDT │ 8 │ 0.21 │ 7.289 │ 0.73 │ 3 days, 1:24:00 │ 6 0 2 75.0 │
|
||||
│ XRP/USDT:USDT │ 9 │ -0.14 │ -7.261 │ -0.73 │ 21:18:00 │ 8 0 1 88.9 │
|
||||
│ DOT/USDT:USDT │ 6 │ -0.4 │ -9.187 │ -0.92 │ 5:35:00 │ 4 0 2 66.7 │
|
||||
│ ADA/USDT:USDT │ 8 │ -1.76 │ -52.098 │ -5.21 │ 11:38:00 │ 6 0 2 75.0 │
|
||||
│ TOTAL │ 77 │ 0.22 │ 54.774 │ 5.48 │ 22:12:00 │ 67 0 10 87.0 │
|
||||
└───────────────┴────────┴──────────────┴─────────────────┴──────────────┴─────────────────┴────────────────────────┘
|
||||
LEFT OPEN TRADES REPORT
|
||||
┏━━━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━┓
|
||||
┃ Pair ┃ Trades ┃ Avg Profit % ┃ Tot Profit USDT ┃ Tot Profit % ┃ Avg Duration ┃ Win Draw Loss Win% ┃
|
||||
┡━━━━━━━━━━━━━━━╇━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━┩
|
||||
│ BTC/USDT:USDT │ 1 │ -4.14 │ -9.930 │ -0.99 │ 17 days, 8:00:00 │ 0 0 1 0 │
|
||||
│ ETC/USDT:USDT │ 1 │ -4.24 │ -15.365 │ -1.54 │ 10:40:00 │ 0 0 1 0 │
|
||||
│ DOT/USDT:USDT │ 1 │ -5.29 │ -19.125 │ -1.91 │ 11:30:00 │ 0 0 1 0 │
|
||||
│ TOTAL │ 3 │ -4.56 │ -44.420 │ -4.44 │ 6 days, 2:03:00 │ 0 0 3 0 │
|
||||
└───────────────┴────────┴──────────────┴─────────────────┴──────────────┴──────────────────┴────────────────────────┘
|
||||
ENTER TAG STATS
|
||||
┏━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━┓
|
||||
┃ Enter Tag ┃ Entries ┃ Avg Profit % ┃ Tot Profit USDT ┃ Tot Profit % ┃ Avg Duration ┃ Win Draw Loss Win% ┃
|
||||
┡━━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━┩
|
||||
│ OTHER │ 77 │ 0.22 │ 54.774 │ 5.48 │ 22:12:00 │ 67 0 10 87.0 │
|
||||
│ TOTAL │ 77 │ 0.22 │ 54.774 │ 5.48 │ 22:12:00 │ 67 0 10 87.0 │
|
||||
└───────────┴─────────┴──────────────┴─────────────────┴──────────────┴──────────────┴────────────────────────┘
|
||||
EXIT REASON STATS
|
||||
┏━━━━━━━━━━━━━┳━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━┓
|
||||
┃ Exit Reason ┃ Exits ┃ Avg Profit % ┃ Tot Profit USDT ┃ Tot Profit % ┃ Avg Duration ┃ Win Draw Loss Win% ┃
|
||||
┡━━━━━━━━━━━━━╇━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━┩
|
||||
│ roi │ 67 │ 1.05 │ 242.179 │ 24.22 │ 15:49:00 │ 67 0 0 100 │
|
||||
│ exit_signal │ 4 │ -2.23 │ -31.217 │ -3.12 │ 1 day, 8:38:00 │ 0 0 4 0 │
|
||||
│ force_exit │ 3 │ -4.56 │ -44.420 │ -4.44 │ 6 days, 2:03:00 │ 0 0 3 0 │
|
||||
│ stop_loss │ 3 │ -10.14 │ -111.768 │ -11.18 │ 1 day, 3:05:00 │ 0 0 3 0 │
|
||||
│ TOTAL │ 77 │ 0.22 │ 54.774 │ 5.48 │ 22:12:00 │ 67 0 10 87.0 │
|
||||
└─────────────┴───────┴──────────────┴─────────────────┴──────────────┴─────────────────┴────────────────────────┘
|
||||
MIXED TAG STATS
|
||||
┏━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━┓
|
||||
┃ Enter Tag ┃ Exit Reason ┃ Trades ┃ Avg Profit % ┃ Tot Profit USDT ┃ Tot Profit % ┃ Avg Duration ┃ Win Draw Loss Win% ┃
|
||||
┡━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━┩
|
||||
│ │ roi │ 67 │ 1.05 │ 242.179 │ 24.22 │ 15:49:00 │ 67 0 0 100 │
|
||||
│ │ exit_signal │ 4 │ -2.23 │ -31.217 │ -3.12 │ 1 day, 8:38:00 │ 0 0 4 0 │
|
||||
│ │ force_exit │ 3 │ -4.56 │ -44.420 │ -4.44 │ 6 days, 2:03:00 │ 0 0 3 0 │
|
||||
│ │ stop_loss │ 3 │ -10.14 │ -111.768 │ -11.18 │ 1 day, 3:05:00 │ 0 0 3 0 │
|
||||
│ TOTAL │ │ 77 │ 0.22 │ 54.774 │ 5.48 │ 22:12:00 │ 67 0 10 87.0 │
|
||||
└───────────┴─────────────┴────────┴──────────────┴─────────────────┴──────────────┴─────────────────┴────────────────────────┘
|
||||
SUMMARY METRICS
|
||||
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
|
||||
┃ Metric ┃ Value ┃
|
||||
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
|
||||
│ Backtesting from │ 2025-07-01 00:00:00 │
|
||||
│ Backtesting to │ 2025-08-01 00:00:00 │
|
||||
│ Trading Mode │ Isolated Futures │
|
||||
│ Max open trades │ 3 │
|
||||
│ │ │
|
||||
│ Total/Daily Avg Trades │ 77 / 2.48 │
|
||||
│ Starting balance │ 1000 USDT │
|
||||
│ Final balance │ 1054.774 USDT │
|
||||
│ Absolute profit │ 54.774 USDT │
|
||||
│ Total profit % │ 5.48% │
|
||||
│ CAGR % │ 87.36% │
|
||||
│ Sortino │ 2.48 │
|
||||
│ Sharpe │ 3.75 │
|
||||
│ Calmar │ 40.99 │
|
||||
│ SQN │ 0.69 │
|
||||
│ Profit factor │ 1.29 │
|
||||
│ Expectancy (Ratio) │ 0.71 (0.04) │
|
||||
│ Avg. daily profit │ 1.767 USDT │
|
||||
│ Avg. stake amount │ 345.016 USDT │
|
||||
│ Total trade volume │ 53316.954 USDT │
|
||||
│ │ │
|
||||
│ Long / Short trades │ 67 / 10 │
|
||||
│ Long / Short profit % │ 8.94% / -3.47% │
|
||||
│ Long / Short profit USDT │ 89.425 / -34.651 │
|
||||
│ │ │
|
||||
│ Best Pair │ LTC/USDT:USDT 5.62% │
|
||||
│ Worst Pair │ ADA/USDT:USDT -5.21% │
|
||||
│ Best trade │ ETC/USDT:USDT 2.00% │
|
||||
│ Worst trade │ ADA/USDT:USDT -10.17% │
|
||||
│ Best day │ 26.91 USDT │
|
||||
│ Worst day │ -47.741 USDT │
|
||||
│ Days win/draw/lose │ 20 / 6 / 5 │
|
||||
│ Min/Max/Avg. Duration Winners │ 0d 00:35 / 5d 18:15 / 0d 15:49 │
|
||||
│ Min/Max/Avg. Duration Losers │ 0d 10:40 / 17d 08:00 / 2d 17:00 │
|
||||
│ Max Consecutive Wins / Loss │ 36 / 3 │
|
||||
│ Rejected Entry signals │ 258 │
|
||||
│ Entry/Exit Timeouts │ 0 / 0 │
|
||||
│ │ │
|
||||
│ Min balance │ 1003.168 USDT │
|
||||
│ Max balance │ 1149.421 USDT │
|
||||
│ Max % of account underwater │ 8.23% │
|
||||
│ Absolute drawdown │ 94.647 USDT (8.23%) │
|
||||
│ Drawdown duration │ 9 days 08:50:00 │
|
||||
│ Profit at drawdown start │ 149.421 USDT │
|
||||
│ Profit at drawdown end │ 54.774 USDT │
|
||||
│ Drawdown start │ 2025-07-22 15:10:00 │
|
||||
│ Drawdown end │ 2025-08-01 00:00:00 │
|
||||
│ Market change │ 30.51% │
|
||||
└───────────────────────────────┴─────────────────────────────────┘
|
||||
|
||||
================== SUMMARY METRICS ==================
|
||||
| Metric | Value |
|
||||
|-----------------------------+---------------------|
|
||||
| Backtesting from | 2019-01-01 00:00:00 |
|
||||
| Backtesting to | 2019-05-01 00:00:00 |
|
||||
| Trading Mode | Spot |
|
||||
| Max open trades | 3 |
|
||||
| | |
|
||||
| Total/Daily Avg Trades | 429 / 3.575 |
|
||||
| Starting balance | 0.01000000 BTC |
|
||||
| Final balance | 0.01762792 BTC |
|
||||
| Absolute profit | 0.00762792 BTC |
|
||||
| Total profit % | 76.2% |
|
||||
| CAGR % | 460.87% |
|
||||
| Sortino | 1.88 |
|
||||
| Sharpe | 2.97 |
|
||||
| Calmar | 6.29 |
|
||||
| SQN | 2.45 |
|
||||
| Profit factor | 1.11 |
|
||||
| Expectancy (Ratio) | -0.15 (-0.05) |
|
||||
| Avg. stake amount | 0.001 BTC |
|
||||
| Total trade volume | 0.429 BTC |
|
||||
| | |
|
||||
| Long / Short | 352 / 77 |
|
||||
| Total profit Long % | 1250.58% |
|
||||
| Total profit Short % | -15.02% |
|
||||
| Absolute profit Long | 0.00838792 BTC |
|
||||
| Absolute profit Short | -0.00076 BTC |
|
||||
| | |
|
||||
| Best Pair | LSK/BTC 26.26% |
|
||||
| Worst Pair | ZEC/BTC -10.18% |
|
||||
| Best Trade | LSK/BTC 4.25% |
|
||||
| Worst Trade | ZEC/BTC -10.25% |
|
||||
| Best day | 0.00076 BTC |
|
||||
| Worst day | -0.00036 BTC |
|
||||
| Days win/draw/lose | 12 / 82 / 25 |
|
||||
| Avg. Duration Winners | 4:23:00 |
|
||||
| Avg. Duration Loser | 6:55:00 |
|
||||
| Max Consecutive Wins / Loss | 3 / 4 |
|
||||
| Rejected Entry signals | 3089 |
|
||||
| Entry/Exit Timeouts | 0 / 0 |
|
||||
| Canceled Trade Entries | 34 |
|
||||
| Canceled Entry Orders | 123 |
|
||||
| Replaced Entry Orders | 89 |
|
||||
| | |
|
||||
| Min balance | 0.00945123 BTC |
|
||||
| Max balance | 0.01846651 BTC |
|
||||
| Max % of account underwater | 25.19% |
|
||||
| Absolute Drawdown (Account) | 13.33% |
|
||||
| Drawdown | 0.0015 BTC |
|
||||
| Drawdown high | 0.0013 BTC |
|
||||
| Drawdown low | -0.0002 BTC |
|
||||
| Drawdown Start | 2019-02-15 14:10:00 |
|
||||
| Drawdown End | 2019-04-11 18:15:00 |
|
||||
| Market change | -5.88% |
|
||||
=====================================================
|
||||
Backtested 2025-07-01 00:00:00 -> 2025-08-01 00:00:00 | Max open trades : 3
|
||||
STRATEGY SUMMARY
|
||||
┏━━━━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━┓
|
||||
┃ Strategy ┃ Trades ┃ Avg Profit % ┃ Tot Profit USDT ┃ Tot Profit % ┃ Avg Duration ┃ Win Draw Loss Win% ┃ Drawdown ┃
|
||||
┡━━━━━━━━━━━━━━━━╇━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━┩
|
||||
│ SampleStrategy │ 77 │ 0.22 │ 54.774 │ 5.48 │ 22:12:00 │ 67 0 10 87.0 │ 94.647 USDT 8.23% │
|
||||
└────────────────┴────────┴──────────────┴─────────────────┴──────────────┴──────────────┴────────────────────────┴────────────────────┘
|
||||
```
|
||||
|
||||
### Backtesting report table
|
||||
|
||||
The 1st table contains all trades the bot made, including "left open trades".
|
||||
The first table contains all trades the bot made, including "left open trades".
|
||||
|
||||
The last line will give you the overall performance of your strategy,
|
||||
here:
|
||||
|
||||
```
|
||||
| TOTAL | 429 | 0.36 | 152.41 | 0.00762792 | 76.20 | 4:12:00 | 186 0 243 43.4 |
|
||||
│ TOTAL │ 77 │ 0.22 │ 54.774 │ 5.48 │ 22:12:00 │ 67 0 10 87.0 │
|
||||
```
|
||||
|
||||
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 bot has made `77` trades for an average duration of `22:12:00`, with a performance of `5.48%` (profit), that means it has earned a total of `54.774 USDT` starting with a capital of 1000 USDT.
|
||||
|
||||
The column `Avg Profit %` shows the average profit for all trades made.
|
||||
The column `Tot Profit %` shows instead the total profit % in relation to the starting balance.
|
||||
In the above results, we have a starting balance of 0.01 BTC and an absolute profit of 0.00762792 BTC - so the `Tot Profit %` will be `(0.00762792 / 0.01) * 100 ~= 76.2%`.
|
||||
|
||||
In the above results, we have a starting balance of 1000 USDT and an absolute profit of 54.774 USDT - so the `Tot Profit %` will be `(54.774 / 1000) * 100 ~= 5.48%`.
|
||||
|
||||
Your strategy performance is influenced by your entry strategy, your exit strategy, and also by the `minimal_roi` and `stop_loss` you have set.
|
||||
|
||||
@@ -284,86 +305,83 @@ On the other hand, if you set a too high `minimal_roi` like `"0": 0.55`
|
||||
(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.
|
||||
|
||||
### Exit reasons table
|
||||
|
||||
The 2nd table contains a recap of exit reasons.
|
||||
This table can tell you which area needs some additional work (e.g. all or many of the `exit_signal` trades are losses, so you should work on improving the exit signal, or consider disabling it).
|
||||
|
||||
### Left open trades table
|
||||
|
||||
The 3rd table contains all trades the bot had to `force_exit` at the end of the backtesting period to present you the full picture.
|
||||
The second table contains all trades the bot had to `force_exit` at the end of the backtesting period to present you the full picture.
|
||||
This is necessary to simulate realistic behavior, 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 also shown separately in this table for clarity.
|
||||
|
||||
### Enter tag stats table
|
||||
|
||||
The third table provides a breakdown of trades by their entry tags (e.g., `enter_long`, `enter_short`), showing the number of entries, average profit percentage, total profit in the stake currency, total profit percentage, average duration, and the number of wins, draws, and losses for each tag.
|
||||
|
||||
### Exit reason stats table
|
||||
|
||||
The fourth table contains a recap of exit reasons (e.g., `exit_signal`, `roi`, `stop_loss`, `force_exit`). This table can tell you which area needs additional work (e.g., if many `exit_signal` trades are losses, you should work on improving the exit signal or consider disabling it).
|
||||
|
||||
### Mixed tag stats table
|
||||
|
||||
The fifth table combines entry tags and exit reasons, providing a detailed view of how different entry tags performed with specific exit reasons. This can help identify which combinations of entry and exit strategies are most effective.
|
||||
|
||||
### Summary metrics
|
||||
|
||||
The last element of the backtest report is the summary metrics table.
|
||||
It contains some useful key metrics about performance of your strategy on backtesting data.
|
||||
It contains key metrics about the performance of your strategy on backtesting data.
|
||||
|
||||
```
|
||||
================== SUMMARY METRICS ==================
|
||||
| Metric | Value |
|
||||
|-----------------------------+---------------------|
|
||||
| Backtesting from | 2019-01-01 00:00:00 |
|
||||
| Backtesting to | 2019-05-01 00:00:00 |
|
||||
| Trading Mode | Spot |
|
||||
| Max open trades | 3 |
|
||||
| | |
|
||||
| Total/Daily Avg Trades | 429 / 3.575 |
|
||||
| Starting balance | 0.01000000 BTC |
|
||||
| Final balance | 0.01762792 BTC |
|
||||
| Absolute profit | 0.00762792 BTC |
|
||||
| Total profit % | 76.2% |
|
||||
| CAGR % | 460.87% |
|
||||
| Sortino | 1.88 |
|
||||
| Sharpe | 2.97 |
|
||||
| Calmar | 6.29 |
|
||||
| SQN | 2.45 |
|
||||
| Profit factor | 1.11 |
|
||||
| Expectancy (Ratio) | -0.15 (-0.05) |
|
||||
| Avg. daily profit | 0.0001 BTC |
|
||||
| Avg. stake amount | 0.001 BTC |
|
||||
| Total trade volume | 0.429 BTC |
|
||||
| | |
|
||||
| Long / Short | 352 / 77 |
|
||||
| Total profit Long % | 1250.58% |
|
||||
| Total profit Short % | -15.02% |
|
||||
| Absolute profit Long | 0.00838792 BTC |
|
||||
| Absolute profit Short | -0.00076 BTC |
|
||||
| | |
|
||||
| Best Pair | LSK/BTC 26.26% |
|
||||
| Worst Pair | ZEC/BTC -10.18% |
|
||||
| Best Trade | LSK/BTC 4.25% |
|
||||
| Worst Trade | ZEC/BTC -10.25% |
|
||||
| Best day | 0.00076 BTC |
|
||||
| Worst day | -0.00036 BTC |
|
||||
| Days win/draw/lose | 12 / 82 / 25 |
|
||||
| Avg. Duration Winners | 4:23:00 |
|
||||
| Avg. Duration Loser | 6:55:00 |
|
||||
| Max Consecutive Wins / Loss | 3 / 4 |
|
||||
| Rejected Entry signals | 3089 |
|
||||
| Entry/Exit Timeouts | 0 / 0 |
|
||||
| Canceled Trade Entries | 34 |
|
||||
| Canceled Entry Orders | 123 |
|
||||
| Replaced Entry Orders | 89 |
|
||||
| | |
|
||||
| Min balance | 0.00945123 BTC |
|
||||
| Max balance | 0.01846651 BTC |
|
||||
| Max % of account underwater | 25.19% |
|
||||
| Absolute Drawdown (Account) | 13.33% |
|
||||
| Drawdown | 0.0015 BTC |
|
||||
| Drawdown high | 0.0013 BTC |
|
||||
| Drawdown low | -0.0002 BTC |
|
||||
| Drawdown Start | 2019-02-15 14:10:00 |
|
||||
| Drawdown End | 2019-04-11 18:15:00 |
|
||||
| Market change | -5.88% |
|
||||
=====================================================
|
||||
|
||||
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
|
||||
┃ Metric ┃ Value ┃
|
||||
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
|
||||
│ Backtesting from │ 2025-07-01 00:00:00 │
|
||||
│ Backtesting to │ 2025-08-01 00:00:00 │
|
||||
│ Trading Mode │ Isolated Futures │
|
||||
│ Max open trades │ 3 │
|
||||
│ │ │
|
||||
│ Total/Daily Avg Trades │ 72 / 2.32 │
|
||||
│ Starting balance │ 1000 USDT │
|
||||
│ Final balance │ 1106.734 USDT │
|
||||
│ Absolute profit │ 106.734 USDT │
|
||||
│ Total profit % │ 10.67% │
|
||||
│ CAGR % │ 230.04% │
|
||||
│ Sortino │ 4.99 │
|
||||
│ Sharpe │ 8.00 │
|
||||
│ Calmar │ 77.76 │
|
||||
│ SQN │ 1.52 │
|
||||
│ Profit factor │ 1.79 │
|
||||
│ Expectancy (Ratio) │ 1.48 (0.07) │
|
||||
│ Avg. daily profit │ 3.443 USDT │
|
||||
│ Avg. stake amount │ 363.133 USDT │
|
||||
│ Total trade volume │ 52466.174 USDT │
|
||||
│ │ │
|
||||
│ Best Pair │ LTC/USDT:USDT 4.48% │
|
||||
│ Worst Pair │ ADA/USDT:USDT -1.78% │
|
||||
│ Best trade │ ETC/USDT:USDT 2.00% │
|
||||
│ Worst trade │ ADA/USDT:USDT -10.17% │
|
||||
│ Best day │ 23.535 USDT │
|
||||
│ Worst day │ -49.813 USDT │
|
||||
│ Days win/draw/lose │ 21 / 6 / 4 │
|
||||
│ Min/Max/Avg. Duration Winners │ 0d 00:35 / 5d 18:15 / 0d 15:30 │
|
||||
│ Min/Max/Avg. Duration Losers │ 0d 12:00 / 17d 08:00 / 3d 23:28 │
|
||||
│ Max Consecutive Wins / Loss │ 58 / 4 │
|
||||
│ Rejected Entry signals │ 254 │
|
||||
│ Entry/Exit Timeouts │ 0 / 0 │
|
||||
│ │ │
|
||||
│ Min balance │ 1003.168 USDT │
|
||||
│ Max balance │ 1209 USDT │
|
||||
│ Max % of account underwater │ 8.46% │
|
||||
│ Absolute drawdown │ 102.266 USDT (8.46%) │
|
||||
│ Drawdown duration │ 9 days 08:50:00 │
|
||||
│ Profit at drawdown start │ 209 USDT │
|
||||
│ Profit at drawdown end │ 106.734 USDT │
|
||||
│ Drawdown start │ 2025-07-22 15:10:00 │
|
||||
│ Drawdown end │ 2025-08-01 00:00:00 │
|
||||
│ Market change │ 30.51% │
|
||||
└───────────────────────────────┴─────────────────────────────────┘
|
||||
```
|
||||
|
||||
- `Backtesting from` / `Backtesting to`: Backtesting range (usually defined with the `--timerange` option).
|
||||
- `Max open trades`: Setting of `max_open_trades` (or `--max-open-trades`) - or number of pairs in the pairlist (whatever is lower).
|
||||
- `Trading Mode`: Spot or Futures trading.
|
||||
- `Max open trades`: Setting of `max_open_trades` (or `--max-open-trades`) - or number of pairs in the pairlist (whatever is lower).
|
||||
- `Total/Daily Avg Trades`: Identical to the total trades of the backtest output table / Total trades divided by the backtesting duration in days (this will give you information about how many trades to expect from the strategy).
|
||||
- `Starting balance`: Start balance - as given by dry-run-wallet (config or command line).
|
||||
- `Final balance`: Final balance - starting balance + absolute profit.
|
||||
@@ -374,58 +392,71 @@ It contains some useful key metrics about performance of your strategy on backte
|
||||
- `Sharpe`: Annualized Sharpe ratio.
|
||||
- `Calmar`: Annualized Calmar ratio.
|
||||
- `SQN`: System Quality Number (SQN) - by Van Tharp.
|
||||
- `Profit factor`: profit / loss.
|
||||
- `Profit factor`: Sum of the profits of all winning trades divided by the sum of the losses of all losing trades.
|
||||
- `Expectancy (Ratio)`: Expectancy ratio, which is the average profit or loss per trade. A negative expectancy ratio means that your strategy is not profitable.
|
||||
- `Avg. daily profit`: Average profit per day, calculated as `(Total Profit / Backtest Days)`.
|
||||
- `Avg. stake amount`: Average stake amount, either `stake_amount` or the average when using dynamic stake amount.
|
||||
- `Total trade volume`: Volume generated on the exchange to reach the above profit.
|
||||
- `Best Pair` / `Worst Pair`: Best and worst performing pair (based on absolute profit), and it's corresponding `Tot Profit %`.
|
||||
- `Best Trade` / `Worst Trade`: Biggest single winning trade and biggest single losing trade.
|
||||
- `Long / Short trades`: Split long/short trade counts (only shown when short trades were made).
|
||||
- `Long / Short profit %`: Profit percentage for long and short trades (only shown when short trades were made).
|
||||
- `Long / Short profit USDT`: Profit in stake currency for long and short trades (only shown when short trades were made).
|
||||
- `Best Pair` / `Worst Pair`: Best and worst performing pair (based on total profit percentage), and its corresponding `Tot Profit %`.
|
||||
- `Best trade` / `Worst trade`: Biggest single winning trade and biggest single losing trade.
|
||||
- `Best day` / `Worst day`: Best and worst day based on daily profit.
|
||||
- `Days win/draw/lose`: Winning / Losing days (draws are usually days without closed trade).
|
||||
- `Avg. Duration Winners` / `Avg. Duration Loser`: Average durations for winning and losing trades.
|
||||
- `Days win/draw/lose`: Winning / Losing days (draws are usually days without closed trades).
|
||||
- `Min/Max/Avg. Duration Winners`: Minimum, maximum, and average durations for winning trades.
|
||||
- `Min/Max/Avg. Duration Losers`: Minimum, maximum, and average durations for losing trades.
|
||||
- `Max Consecutive Wins / Loss`: Maximum consecutive wins/losses in a row.
|
||||
- `Rejected Entry signals`: Trade entry signals that could not be acted upon due to `max_open_trades` being reached.
|
||||
- `Entry/Exit Timeouts`: Entry/exit orders which did not fill (only applicable if custom pricing is used).
|
||||
- `Canceled Trade Entries`: Number of trades that have been canceled by user request via `adjust_entry_price`.
|
||||
- `Canceled Entry Orders`: Number of entry orders that have been canceled by user request via `adjust_entry_price`.
|
||||
- `Replaced Entry Orders`: Number of entry orders that have been replaced by user request via `adjust_entry_price`.
|
||||
- `Min balance` / `Max balance`: Lowest and Highest Wallet balance during the backtest period.
|
||||
- `Max % of account underwater`: Maximum percentage your account has decreased from the top since the simulation started.
|
||||
Calculated as the maximum of `(Max Balance - Current Balance) / (Max Balance)`.
|
||||
- `Absolute Drawdown (Account)`: Maximum Account Drawdown experienced. Calculated as `(Absolute Drawdown) / (DrawdownHigh + startingBalance)`.
|
||||
- `Drawdown`: Maximum, absolute drawdown experienced. Difference between Drawdown High and Subsequent Low point.
|
||||
- `Drawdown high` / `Drawdown low`: Profit at the beginning and end of the largest drawdown period. A negative low value means initial capital lost.
|
||||
- `Drawdown Start` / `Drawdown End`: Start and end datetime for this largest drawdown (can also be visualized via the `plot-dataframe` sub-command).
|
||||
- `Market change`: Change of the market during the backtest period. Calculated as average of all pairs changes from the first to the last candle using the "close" column.
|
||||
- `Long / Short`: Split long/short values (Only shown when short trades were made).
|
||||
- `Total profit Long %` / `Absolute profit Long`: Profit long trades only (Only shown when short trades were made).
|
||||
- `Total profit Short %` / `Absolute profit Short`: Profit short trades only (Only shown when short trades were made).
|
||||
- `Max % of account underwater`: Maximum percentage your account has decreased from the top since the simulation started. Calculated as the maximum of `(Max Balance - Current Balance) / (Max Balance)`.
|
||||
- `Absolute drawdown`: Maximum absolute drawdown experienced, including percentage relative to the account calculated as `(Absolute Drawdown) / (DrawdownHigh + startingBalance)`..
|
||||
- `Drawdown duration`: Duration of the largest drawdown period.
|
||||
- `Profit at drawdown start` / `Profit at drawdown end`: Profit at the beginning and end of the largest drawdown period.
|
||||
- `Drawdown start` / `Drawdown end`: Start and end datetime for the largest drawdown (can also be visualized via the `plot-dataframe` sub-command).
|
||||
- `Market change`: Change of the market during the backtest period. Calculated as the average of all pairs' changes from the first to the last candle using the "close" column.
|
||||
|
||||
### Daily / Weekly / Monthly breakdown
|
||||
### Daily / Weekly / Monthly / Yearly breakdown
|
||||
|
||||
You can get an overview over daily / weekly or monthly results by using the `--breakdown <>` switch.
|
||||
You can get an overview over daily, weekly, monthly, or yearly results by using the `--breakdown <>` switch.
|
||||
|
||||
To visualize daily and weekly breakdowns, you can use the following:
|
||||
To visualize monthly and yearly breakdowns, you can use the following:
|
||||
|
||||
``` bash
|
||||
freqtrade backtesting --strategy MyAwesomeStrategy --breakdown day week
|
||||
freqtrade backtesting --strategy MyAwesomeStrategy --breakdown month year
|
||||
```
|
||||
|
||||
``` output
|
||||
======================== DAY BREAKDOWN =========================
|
||||
| Day | Tot Profit USDT | Wins | Draws | Losses |
|
||||
|------------+-------------------+--------+---------+----------|
|
||||
| 03/07/2021 | 200.0 | 2 | 0 | 0 |
|
||||
| 04/07/2021 | -50.31 | 0 | 0 | 2 |
|
||||
| 05/07/2021 | 220.611 | 3 | 2 | 0 |
|
||||
| 06/07/2021 | 150.974 | 3 | 0 | 2 |
|
||||
| 07/07/2021 | -70.193 | 1 | 0 | 2 |
|
||||
| 08/07/2021 | 212.413 | 2 | 0 | 3 |
|
||||
|
||||
MONTH BREAKDOWN
|
||||
┏━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━┓
|
||||
┃ Month ┃ Trades ┃ Tot Profit USDT ┃ Profit Factor ┃ Win Draw Loss Win% ┃
|
||||
┡━━━━━━━━━━━━╇━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━┩
|
||||
│ 31/01/2020 │ 12 │ 44.451 │ 7.28 │ 10 0 2 83.3 │
|
||||
│ 29/02/2020 │ 30 │ 45.41 │ 2.36 │ 17 0 13 56.7 │
|
||||
│ 31/03/2020 │ 35 │ 142.024 │ 2.42 │ 14 0 21 40.0 │
|
||||
│ 30/04/2020 │ 67 │ -23.692 │ 0.81 │ 24 0 43 35.8 │
|
||||
...
|
||||
...
|
||||
│ 30/04/2025 │ 203 │ -63.43 │ 0.81 │ 73 0 130 36.0 │
|
||||
│ 31/05/2025 │ 142 │ 104.675 │ 1.28 │ 59 0 83 41.5 │
|
||||
│ 30/06/2025 │ 177 │ -1.014 │ 1.0 │ 85 0 92 48.0 │
|
||||
│ 31/07/2025 │ 155 │ 232.762 │ 1.6 │ 63 0 92 40.6 │
|
||||
└────────────┴────────┴─────────────────┴───────────────┴────────────────────────┘
|
||||
YEAR BREAKDOWN
|
||||
┏━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━┓
|
||||
┃ Year ┃ Trades ┃ Tot Profit USDT ┃ Profit Factor ┃ Win Draw Loss Win% ┃
|
||||
┡━━━━━━━━━━━━╇━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━┩
|
||||
│ 31/12/2020 │ 896 │ 868.889 │ 1.46 │ 351 0 545 39.2 │
|
||||
│ 31/12/2021 │ 1778 │ 4487.163 │ 1.93 │ 745 0 1033 41.9 │
|
||||
│ 31/12/2022 │ 1736 │ 938.27 │ 1.27 │ 698 0 1038 40.2 │
|
||||
│ 31/12/2023 │ 1712 │ 1677.126 │ 1.68 │ 670 0 1042 39.1 │
|
||||
│ 31/12/2024 │ 1609 │ 3198.424 │ 2.22 │ 773 0 836 48.0 │
|
||||
│ 31/12/2025 │ 1042 │ 716.174 │ 1.33 │ 420 0 622 40.3 │
|
||||
└────────────┴────────┴─────────────────┴───────────────┴────────────────────────┘
|
||||
```
|
||||
|
||||
The output will show a table containing the realized absolute Profit (in stake currency) for the given timeperiod, as well as wins, draws and losses that materialized (closed) on this day. Below that there will be a second table for the summarized values of weeks indicated by the date of the closing Sunday. The same would apply to a monthly breakdown indicated by the last day of the month.
|
||||
The output will display tables containing the realized absolute profit (in stake currency) for the selected period, along with additional statistics such as number of trades, profit factor, and distribution of wins, draws, and losses that materialized (closed) on this period.
|
||||
|
||||
### Backtest result caching
|
||||
|
||||
@@ -449,10 +480,10 @@ For this mode - `--notes "<notes>"` can be used to add notes to the backtest res
|
||||
The output file freqtrade produces is a zip file containing the following files:
|
||||
|
||||
- The backtest report in json format
|
||||
- the market change data in feather format
|
||||
- a copy of the strategy file
|
||||
- a copy of the strategy parameters (if a parameter file was used)
|
||||
- a sanitized copy of the config file
|
||||
- The market change data in feather format
|
||||
- A copy of the strategy file
|
||||
- A copy of the strategy parameters (if a parameter file was used)
|
||||
- A sanitized copy of the config file
|
||||
|
||||
This will ensure results are reproducible - under the assumption that the same data is available.
|
||||
|
||||
@@ -470,7 +501,7 @@ Since backtesting lacks some detailed information about what happens within a ca
|
||||
- Exit-signal is favored over Stoploss, because exit-signals are assumed to trigger on candle's open
|
||||
- ROI
|
||||
- Exits are compared to high - but the ROI value is used (e.g. ROI = 2%, high=5% - so the exit will be at 2%)
|
||||
- Exits are never "below the candle", so a ROI of 2% may result in a exit at 2.4% if low was at 2.4% profit
|
||||
- Exits are never "below the candle", so a ROI of 2% may result in an exit at 2.4% if low was at 2.4% profit
|
||||
- ROI entries which came into effect on the triggering candle (e.g. `120: 0.02` for 1h candles, from `60: 0.05`) will use the candle's open as exit rate
|
||||
- Force-exits caused by `<N>=-1` ROI entries use low as exit value, unless N falls on the candle open (e.g. `120: -1` for 1h candles)
|
||||
- Stoploss exits happen exactly at stoploss price, even if low was lower, but the loss will be `2 * fees` higher than the stoploss price
|
||||
@@ -536,7 +567,7 @@ freqtrade backtesting --strategy AwesomeStrategy --timeframe 1h --timeframe-deta
|
||||
|
||||
This will load 1h data (the main timeframe) as well as 5m data (detail timeframe) for the selected timerange.
|
||||
The strategy will be analyzed with the 1h timeframe.
|
||||
Candles where activity may take place (there's an active signal, the pair is in a trade) are evaluated at the 5m timeframe.
|
||||
Candles where activity may take place (there's an active signal, the pair is in a trade) are evaluated at the 5m timeframe.
|
||||
This will allow for a more accurate simulation of intra-candle movements - and can lead to different results, especially on higher timeframes.
|
||||
|
||||
Entries will generally still happen at the main candle's open, however freed trade slots may be freed earlier (if the exit signal is triggered on the 5m candle), which can then be used for a new trade of a different pair.
|
||||
@@ -599,5 +630,5 @@ Detailed output for all strategies one after the other will be available, so mak
|
||||
|
||||
## Next step
|
||||
|
||||
Great, your strategy is profitable. What if the bot can give your the optimal parameters to use for your strategy?
|
||||
Great, your strategy is profitable. What if the bot can give you the optimal parameters to use for your strategy?
|
||||
Your next step is to learn [how to find optimal parameters with Hyperopt](hyperopt.md)
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
usage: freqtrade backtesting-analysis [-h] [-v] [--no-color] [--logfile FILE]
|
||||
[-V] [-c PATH] [-d PATH]
|
||||
[--userdir PATH]
|
||||
[--export-filename PATH]
|
||||
[--backtest-filename PATH]
|
||||
[--backtest-directory PATH]
|
||||
[--analysis-groups {0,1,2,3,4,5} [{0,1,2,3,4,5} ...]]
|
||||
[--enter-reason-list ENTER_REASON_LIST [ENTER_REASON_LIST ...]]
|
||||
[--exit-reason-list EXIT_REASON_LIST [EXIT_REASON_LIST ...]]
|
||||
@@ -14,10 +15,15 @@ usage: freqtrade backtesting-analysis [-h] [-v] [--no-color] [--logfile FILE]
|
||||
|
||||
options:
|
||||
-h, --help show this help message and exit
|
||||
--export-filename PATH, --backtest-filename PATH
|
||||
Use this filename for backtest results.Requires
|
||||
`--export` to be set as well. Example: `--export-filen
|
||||
ame=user_data/backtest_results/backtest_today.json`
|
||||
--backtest-filename PATH, --export-filename PATH
|
||||
Use this filename for backtest results.Example:
|
||||
`--backtest-
|
||||
filename=backtest_results_2020-09-27_16-20-48.json`.
|
||||
Assumes either `user_data/backtest_results/` or
|
||||
`--export-directory` as base directory.
|
||||
--backtest-directory PATH, --export-directory PATH
|
||||
Directory to use for backtest results. Example:
|
||||
`--export-directory=user_data/backtest_results/`.
|
||||
--analysis-groups {0,1,2,3,4,5} [{0,1,2,3,4,5} ...]
|
||||
grouping output - 0: simple wins/losses by enter tag,
|
||||
1: by enter_tag, 2: by enter_tag and exit_tag, 3: by
|
||||
|
||||
@@ -1,15 +1,22 @@
|
||||
```
|
||||
usage: freqtrade backtesting-show [-h] [-v] [--no-color] [--logfile FILE] [-V]
|
||||
[-c PATH] [-d PATH] [--userdir PATH]
|
||||
[--export-filename PATH] [--show-pair-list]
|
||||
[--backtest-filename PATH]
|
||||
[--backtest-directory PATH]
|
||||
[--show-pair-list]
|
||||
[--breakdown {day,week,month,year} [{day,week,month,year} ...]]
|
||||
|
||||
options:
|
||||
-h, --help show this help message and exit
|
||||
--export-filename PATH, --backtest-filename PATH
|
||||
Use this filename for backtest results.Requires
|
||||
`--export` to be set as well. Example: `--export-filen
|
||||
ame=user_data/backtest_results/backtest_today.json`
|
||||
--backtest-filename PATH, --export-filename PATH
|
||||
Use this filename for backtest results.Example:
|
||||
`--backtest-
|
||||
filename=backtest_results_2020-09-27_16-20-48.json`.
|
||||
Assumes either `user_data/backtest_results/` or
|
||||
`--export-directory` as base directory.
|
||||
--backtest-directory PATH, --export-directory PATH
|
||||
Directory to use for backtest results. Example:
|
||||
`--export-directory=user_data/backtest_results/`.
|
||||
--show-pair-list Show backtesting pairlist sorted by profit.
|
||||
--breakdown {day,week,month,year} [{day,week,month,year} ...]
|
||||
Show backtesting breakdown per [day, week, month,
|
||||
|
||||
@@ -10,11 +10,13 @@ usage: freqtrade backtesting [-h] [-v] [--no-color] [--logfile FILE] [-V]
|
||||
[--stake-amount STAKE_AMOUNT] [--fee FLOAT]
|
||||
[-p PAIRS [PAIRS ...]] [--eps]
|
||||
[--enable-protections]
|
||||
[--enable-dynamic-pairlist]
|
||||
[--dry-run-wallet DRY_RUN_WALLET]
|
||||
[--timeframe-detail TIMEFRAME_DETAIL]
|
||||
[--strategy-list STRATEGY_LIST [STRATEGY_LIST ...]]
|
||||
[--export {none,trades,signals}]
|
||||
[--export-filename PATH]
|
||||
[--backtest-filename PATH]
|
||||
[--backtest-directory PATH]
|
||||
[--breakdown {day,week,month,year} [{day,week,month,year} ...]]
|
||||
[--cache {none,day,week,month}]
|
||||
[--freqai-backtest-live-models] [--notes TEXT]
|
||||
@@ -43,9 +45,14 @@ options:
|
||||
Allow buying the same pair multiple times (position
|
||||
stacking).
|
||||
--enable-protections, --enableprotections
|
||||
Enable protections for backtesting.Will slow
|
||||
Enable protections for backtesting. Will slow
|
||||
backtesting down by a considerable amount, but will
|
||||
include configured protections
|
||||
--enable-dynamic-pairlist
|
||||
Enables dynamic pairlist refreshes in backtesting. The
|
||||
pairlist will be generated for each new candle if
|
||||
you're using a pairlist handler that supports this
|
||||
feature, for example, ShuffleFilter.
|
||||
--dry-run-wallet DRY_RUN_WALLET, --starting-balance DRY_RUN_WALLET
|
||||
Starting balance, used for backtesting / hyperopt and
|
||||
dry-runs.
|
||||
@@ -61,10 +68,15 @@ options:
|
||||
becomes `backtest-data-SampleStrategy.json`
|
||||
--export {none,trades,signals}
|
||||
Export backtest results (default: trades).
|
||||
--export-filename PATH, --backtest-filename PATH
|
||||
Use this filename for backtest results.Requires
|
||||
`--export` to be set as well. Example: `--export-filen
|
||||
ame=user_data/backtest_results/backtest_today.json`
|
||||
--backtest-filename PATH, --export-filename PATH
|
||||
Use this filename for backtest results.Example:
|
||||
`--backtest-
|
||||
filename=backtest_results_2020-09-27_16-20-48.json`.
|
||||
Assumes either `user_data/backtest_results/` or
|
||||
`--export-directory` as base directory.
|
||||
--backtest-directory PATH, --export-directory PATH
|
||||
Directory to use for backtest results. Example:
|
||||
`--export-directory=user_data/backtest_results/`.
|
||||
--breakdown {day,week,month,year} [{day,week,month,year} ...]
|
||||
Show backtesting breakdown per [day, week, month,
|
||||
year].
|
||||
|
||||
@@ -4,6 +4,7 @@ usage: freqtrade download-data [-h] [-v] [--no-color] [--logfile FILE] [-V]
|
||||
[-p PAIRS [PAIRS ...]] [--pairs-file FILE]
|
||||
[--days INT] [--new-pairs-days INT]
|
||||
[--include-inactive-pairs]
|
||||
[--no-parallel-download]
|
||||
[--timerange TIMERANGE] [--dl-trades]
|
||||
[--convert] [--exchange EXCHANGE]
|
||||
[-t TIMEFRAMES [TIMEFRAMES ...]] [--erase]
|
||||
@@ -24,6 +25,9 @@ options:
|
||||
Default: `None`.
|
||||
--include-inactive-pairs
|
||||
Also download data from inactive pairs.
|
||||
--no-parallel-download
|
||||
Disable parallel startup download. Only use this if
|
||||
you experience issues.
|
||||
--timerange TIMERANGE
|
||||
Specify what timerange of data to use.
|
||||
--dl-trades Download trades instead of OHLCV data.
|
||||
|
||||
@@ -44,7 +44,7 @@ options:
|
||||
Allow buying the same pair multiple times (position
|
||||
stacking).
|
||||
--enable-protections, --enableprotections
|
||||
Enable protections for backtesting.Will slow
|
||||
Enable protections for backtesting. Will slow
|
||||
backtesting down by a considerable amount, but will
|
||||
include configured protections
|
||||
--dry-run-wallet DRY_RUN_WALLET, --starting-balance DRY_RUN_WALLET
|
||||
|
||||
@@ -1,11 +1,16 @@
|
||||
```
|
||||
usage: freqtrade list-exchanges [-h] [-v] [--no-color] [--logfile FILE] [-V]
|
||||
[-c PATH] [-d PATH] [--userdir PATH] [-1] [-a]
|
||||
[--trading-mode {spot,margin,futures}]
|
||||
[--dex-exchanges]
|
||||
|
||||
options:
|
||||
-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.
|
||||
--trading-mode {spot,margin,futures}, --tradingmode {spot,margin,futures}
|
||||
Select Trading mode
|
||||
--dex-exchanges Print only DEX exchanges.
|
||||
|
||||
Common arguments:
|
||||
-v, --verbose Verbose mode (-vv for more, -vvv to get all messages).
|
||||
|
||||
@@ -11,15 +11,18 @@ usage: freqtrade lookahead-analysis [-h] [-v] [--no-color] [--logfile FILE]
|
||||
[--stake-amount STAKE_AMOUNT]
|
||||
[--fee FLOAT] [-p PAIRS [PAIRS ...]]
|
||||
[--enable-protections]
|
||||
[--enable-dynamic-pairlist]
|
||||
[--dry-run-wallet DRY_RUN_WALLET]
|
||||
[--timeframe-detail TIMEFRAME_DETAIL]
|
||||
[--strategy-list STRATEGY_LIST [STRATEGY_LIST ...]]
|
||||
[--export {none,trades,signals}]
|
||||
[--export-filename PATH]
|
||||
[--backtest-filename PATH]
|
||||
[--backtest-directory PATH]
|
||||
[--freqai-backtest-live-models]
|
||||
[--minimum-trade-amount INT]
|
||||
[--targeted-trade-amount INT]
|
||||
[--lookahead-analysis-exportfilename LOOKAHEAD_ANALYSIS_EXPORTFILENAME]
|
||||
[--allow-limit-orders]
|
||||
|
||||
options:
|
||||
-h, --help show this help message and exit
|
||||
@@ -42,9 +45,14 @@ options:
|
||||
Limit command to these pairs. Pairs are space-
|
||||
separated.
|
||||
--enable-protections, --enableprotections
|
||||
Enable protections for backtesting.Will slow
|
||||
Enable protections for backtesting. Will slow
|
||||
backtesting down by a considerable amount, but will
|
||||
include configured protections
|
||||
--enable-dynamic-pairlist
|
||||
Enables dynamic pairlist refreshes in backtesting. The
|
||||
pairlist will be generated for each new candle if
|
||||
you're using a pairlist handler that supports this
|
||||
feature, for example, ShuffleFilter.
|
||||
--dry-run-wallet DRY_RUN_WALLET, --starting-balance DRY_RUN_WALLET
|
||||
Starting balance, used for backtesting / hyperopt and
|
||||
dry-runs.
|
||||
@@ -60,10 +68,15 @@ options:
|
||||
becomes `backtest-data-SampleStrategy.json`
|
||||
--export {none,trades,signals}
|
||||
Export backtest results (default: trades).
|
||||
--export-filename PATH, --backtest-filename PATH
|
||||
Use this filename for backtest results.Requires
|
||||
`--export` to be set as well. Example: `--export-filen
|
||||
ame=user_data/backtest_results/backtest_today.json`
|
||||
--backtest-filename PATH, --export-filename PATH
|
||||
Use this filename for backtest results.Example:
|
||||
`--backtest-
|
||||
filename=backtest_results_2020-09-27_16-20-48.json`.
|
||||
Assumes either `user_data/backtest_results/` or
|
||||
`--export-directory` as base directory.
|
||||
--backtest-directory PATH, --export-directory PATH
|
||||
Directory to use for backtest results. Example:
|
||||
`--export-directory=user_data/backtest_results/`.
|
||||
--freqai-backtest-live-models
|
||||
Run backtest with ready models.
|
||||
--minimum-trade-amount INT
|
||||
@@ -73,6 +86,8 @@ options:
|
||||
--lookahead-analysis-exportfilename LOOKAHEAD_ANALYSIS_EXPORTFILENAME
|
||||
Use this csv-filename to store lookahead-analysis-
|
||||
results
|
||||
--allow-limit-orders Allow limit orders in lookahead analysis (could cause
|
||||
false positives in lookahead analysis results).
|
||||
|
||||
Common arguments:
|
||||
-v, --verbose Verbose mode (-vv for more, -vvv to get all messages).
|
||||
|
||||
@@ -10,7 +10,7 @@ usage: freqtrade plot-dataframe [-h] [-v] [--no-color] [--logfile FILE] [-V]
|
||||
[--plot-limit INT] [--db-url PATH]
|
||||
[--trade-source {DB,file}]
|
||||
[--export {none,trades,signals}]
|
||||
[--export-filename PATH]
|
||||
[--backtest-filename PATH]
|
||||
[--timerange TIMERANGE] [-i TIMEFRAME]
|
||||
[--no-trades]
|
||||
|
||||
@@ -38,10 +38,12 @@ options:
|
||||
(backtest file)) Default: file
|
||||
--export {none,trades,signals}
|
||||
Export backtest results (default: trades).
|
||||
--export-filename PATH, --backtest-filename PATH
|
||||
Use this filename for backtest results.Requires
|
||||
`--export` to be set as well. Example: `--export-filen
|
||||
ame=user_data/backtest_results/backtest_today.json`
|
||||
--backtest-filename PATH, --export-filename PATH
|
||||
Use this filename for backtest results.Example:
|
||||
`--backtest-
|
||||
filename=backtest_results_2020-09-27_16-20-48.json`.
|
||||
Assumes either `user_data/backtest_results/` or
|
||||
`--export-directory` as base directory.
|
||||
--timerange TIMERANGE
|
||||
Specify what timerange of data to use.
|
||||
-i TIMEFRAME, --timeframe TIMEFRAME
|
||||
|
||||
@@ -6,7 +6,7 @@ usage: freqtrade plot-profit [-h] [-v] [--no-color] [--logfile FILE] [-V]
|
||||
[--freqaimodel NAME] [--freqaimodel-path PATH]
|
||||
[-p PAIRS [PAIRS ...]] [--timerange TIMERANGE]
|
||||
[--export {none,trades,signals}]
|
||||
[--export-filename PATH] [--db-url PATH]
|
||||
[--backtest-filename PATH] [--db-url PATH]
|
||||
[--trade-source {DB,file}] [-i TIMEFRAME]
|
||||
[--auto-open]
|
||||
|
||||
@@ -19,10 +19,12 @@ options:
|
||||
Specify what timerange of data to use.
|
||||
--export {none,trades,signals}
|
||||
Export backtest results (default: trades).
|
||||
--export-filename PATH, --backtest-filename PATH
|
||||
Use this filename for backtest results.Requires
|
||||
`--export` to be set as well. Example: `--export-filen
|
||||
ame=user_data/backtest_results/backtest_today.json`
|
||||
--backtest-filename PATH, --export-filename PATH
|
||||
Use this filename for backtest results.Example:
|
||||
`--backtest-
|
||||
filename=backtest_results_2020-09-27_16-20-48.json`.
|
||||
Assumes either `user_data/backtest_results/` or
|
||||
`--export-directory` as base directory.
|
||||
--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
|
||||
|
||||
@@ -566,8 +566,8 @@ Configuration:
|
||||
|
||||
### Understand order_time_in_force
|
||||
|
||||
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:
|
||||
The `order_time_in_force` configuration parameter defines the policy by which the order is executed on the exchange.
|
||||
Commonly used time in force are:
|
||||
|
||||
**GTC (Good Till Canceled):**
|
||||
|
||||
@@ -589,11 +589,13 @@ is automatically cancelled by the exchange.
|
||||
Post only order. The order is either placed as a maker order, or it is canceled.
|
||||
This means the order must be placed on orderbook for at least time in an unfilled state.
|
||||
|
||||
Please check the [Exchange documentation](exchanges.md) for supported time in force values for your exchange.
|
||||
|
||||
#### time_in_force config
|
||||
|
||||
The `order_time_in_force` parameter contains a dict with entry and exit 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.
|
||||
Values set in the configuration file overwrite values from in the strategy, following the regular [precedence rules](#configuration-option-prevalence).
|
||||
|
||||
The possible values are: `GTC` (default), `FOK` or `IOC`.
|
||||
|
||||
@@ -605,9 +607,9 @@ The possible values are: `GTC` (default), `FOK` or `IOC`.
|
||||
```
|
||||
|
||||
!!! Warning
|
||||
This is ongoing work. For now, it is supported only for binance, gate and kucoin.
|
||||
Please don't change the default value unless you know what you are doing and have researched the impact of using different values for your particular exchange.
|
||||
|
||||
|
||||
### Fiat conversion
|
||||
|
||||
Freqtrade uses the Coingecko API to convert the coin value to it's corresponding fiat value for the Telegram reports.
|
||||
|
||||
+16
-1
@@ -408,6 +408,22 @@ jupyter nbconvert --ClearOutputPreprocessor.enabled=True --inplace freqtrade/tem
|
||||
jupyter nbconvert --ClearOutputPreprocessor.enabled=True --to markdown freqtrade/templates/strategy_analysis_example.ipynb --stdout > docs/strategy_analysis_example.md
|
||||
```
|
||||
|
||||
## Backtest documentation results
|
||||
|
||||
To generate backtest outputs, please use the following commands:
|
||||
|
||||
``` bash
|
||||
# Assume a dedicated user directory for this output
|
||||
freqtrade create-userdir --userdir user_data_bttest/
|
||||
# set can_short = True
|
||||
sed -i "s/can_short: bool = False/can_short: bool = True/" user_data_bttest/strategies/sample_strategy.py
|
||||
|
||||
freqtrade download-data --timerange 20250625-20250801 --config tests/testdata/config.tests.usdt.json --userdir user_data_bttest/ -t 5m
|
||||
|
||||
freqtrade backtesting --config tests/testdata/config.tests.usdt.json -s SampleStrategy --userdir user_data_bttest/ --cache none --timerange 20250701-20250801
|
||||
```
|
||||
|
||||
|
||||
## Continuous integration
|
||||
|
||||
This documents some decisions taken for the CI Pipeline.
|
||||
@@ -418,7 +434,6 @@ This documents some decisions taken for the CI Pipeline.
|
||||
* 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 `stable` or `develop`.
|
||||
|
||||
## Creating a release
|
||||
|
||||
+36
-9
@@ -2,6 +2,10 @@
|
||||
|
||||
This page combines common gotchas and Information which are exchange-specific and most likely don't apply to other exchanges.
|
||||
|
||||
## Quick overview of supported exchange features
|
||||
|
||||
--8<-- "includes/exchange-features.md"
|
||||
|
||||
## Exchange configuration
|
||||
|
||||
Freqtrade is based on [CCXT library](https://github.com/ccxt/ccxt) that supports over 100 cryptocurrency
|
||||
@@ -227,7 +231,7 @@ Kucoin requires a passphrase for each api key, you will therefore need to add th
|
||||
}
|
||||
```
|
||||
|
||||
Kucoin supports [time_in_force](configuration.md#understand-order_time_in_force).
|
||||
Kucoin supports [time_in_force](configuration.md#understand-order_time_in_force) with settings "GTC" (good till cancelled), "FOK" (full-or-cancel) and "IOC" (immediate-or-cancel) settings.
|
||||
|
||||
!!! Tip "Stoploss on Exchange"
|
||||
Kucoin supports `stoploss_on_exchange` and can use both stop-loss-market and stop-loss-limit orders. It provides great advantages, so we recommend to benefit from it.
|
||||
@@ -271,7 +275,9 @@ Using the wrong exchange will result in the error "OKX Error 50119: API key does
|
||||
## Gate.io
|
||||
|
||||
!!! Tip "Stoploss on Exchange"
|
||||
Gate.io supports `stoploss_on_exchange` and uses `stop-loss-limit` orders. It provides great advantages, so we recommend to benefit from it by enabling stoploss on exchange..
|
||||
Gate.io supports `stoploss_on_exchange` and uses `stop-loss-limit` orders. It provides great advantages, so we recommend to benefit from it by enabling stoploss on exchange.
|
||||
|
||||
Gate.io supports [time_in_force](configuration.md#understand-order_time_in_force) with settings "GTC" (good till cancelled), and "IOC" (immediate-or-cancel) settings.
|
||||
|
||||
Gate.io allows the use of `POINT` to pay for fees. As this is not a tradable currency (no regular market available), automatic fee calculations will fail (and default to a fee of 0).
|
||||
The configuration parameter `exchange.unknown_fee_rate` can be used to specify the exchange rate between Point and the stake currency. Obviously, changing the stake-currency will also require changes to this value.
|
||||
@@ -286,9 +292,15 @@ Without these permissions, the bot will not start correctly and show errors like
|
||||
|
||||
## Bybit
|
||||
|
||||
Futures trading on bybit is currently supported for USDT markets, and will use isolated futures mode.
|
||||
!!! Tip "Stoploss on Exchange"
|
||||
Bybit (futures only) supports `stoploss_on_exchange` and uses `stop-loss-limit` orders. It provides great advantages, so we recommend to benefit from it by enabling stoploss on exchange.
|
||||
On futures, Bybit supports both `stop-limit` as well as `stop-market` orders. You can use either `"limit"` or `"market"` in the `order_types.stoploss` configuration setting to decide which type to use.
|
||||
|
||||
On startup, freqtrade will set the position mode to "One-way Mode" for the whole (sub)account. This avoids making this call over and over again (slowing down bot operations), but means that changes to this setting may result in exceptions and errors.
|
||||
Bybit supports [time_in_force](configuration.md#understand-order_time_in_force) with settings "GTC" (good till cancelled), "FOK" (full-or-cancel), "IOC" (immediate-or-cancel) and "PO" (Post only) settings.
|
||||
|
||||
Futures trading on bybit is currently supported for isolated futures mode.
|
||||
|
||||
On startup, freqtrade will set the position mode to "One-way Mode" for the whole (sub)account. This avoids making this call over and over again (slowing down bot operations), but means that manual changes to this setting may result in exceptions and errors.
|
||||
|
||||
As bybit doesn't provide funding rate history, the dry-run calculation is used for live trades as well.
|
||||
|
||||
@@ -305,11 +317,6 @@ We do strongly recommend to limit all API keys to the IP you're going to use it
|
||||
We therefore recommend the usage of one subaccount per bot. This is especially important when using unified accounts.
|
||||
Other configurations (multiple bots on one account, manual non-bot trades on the bot account) are not supported and may lead to unexpected behavior.
|
||||
|
||||
|
||||
!!! Tip "Stoploss on Exchange"
|
||||
Bybit (futures only) supports `stoploss_on_exchange` and uses `stop-loss-limit` orders. It provides great advantages, so we recommend to benefit from it by enabling stoploss on exchange.
|
||||
On futures, Bybit supports both `stop-limit` as well as `stop-market` orders. You can use either `"limit"` or `"market"` in the `order_types.stoploss` configuration setting to decide which type to use.
|
||||
|
||||
## Bitmart
|
||||
|
||||
Bitmart requires the API key Memo (the name you give the API key) to go along with the exchange key and secret.
|
||||
@@ -328,6 +335,26 @@ It's therefore required to pass the UID as well.
|
||||
!!! Warning "Necessary Verification"
|
||||
Bitmart requires Verification Lvl2 to successfully trade on the spot market through the API - even though trading via UI works just fine with just Lvl1 verification.
|
||||
|
||||
## Bitget
|
||||
|
||||
Bitget requires a passphrase for each api key, you will therefore need to add this key into the configuration so your exchange section looks as follows:
|
||||
|
||||
```json
|
||||
"exchange": {
|
||||
"name": "bitget",
|
||||
"key": "your_exchange_key",
|
||||
"secret": "your_exchange_secret",
|
||||
"password": "your_exchange_api_key_password",
|
||||
// ...
|
||||
}
|
||||
```
|
||||
|
||||
Bitget supports [time_in_force](configuration.md#understand-order_time_in_force) with settings "GTC" (good till cancelled), "FOK" (full-or-cancel), "IOC" (immediate-or-cancel) and "PO" (Post only) settings.
|
||||
|
||||
!!! Tip "Stoploss on Exchange"
|
||||
Bitget supports `stoploss_on_exchange` and can use both stop-loss-market and stop-loss-limit orders. It provides great advantages, so we recommend to benefit from it.
|
||||
You can use either `"limit"` or `"market"` in the `order_types.stoploss` configuration setting to decide which type of stoploss shall be used.
|
||||
|
||||
## Hyperliquid
|
||||
|
||||
!!! Tip "Stoploss on Exchange"
|
||||
|
||||
@@ -297,6 +297,13 @@ Should you be asked to expose your exchange keys or send funds to some random wa
|
||||
|
||||
Failing to follow these guidelines will not be responsibility of freqtrade.
|
||||
|
||||
## Support policy
|
||||
|
||||
We provide free support for Freqtrade on our [Discord server](https://discord.gg/p7nuUNVfP7) and via GitHub issues.
|
||||
We only support the most recent release (e.g. 2025.8) and the current development branch (e.g. 2025.9-dev).
|
||||
|
||||
If you're on an older version, please follow the [upgrade instructions](updating.md) and see if your problem has already been addressed.
|
||||
|
||||
## "Freqtrade token"
|
||||
|
||||
Freqtrade does not have a Crypto token offering.
|
||||
|
||||
+11
-2
@@ -4,7 +4,7 @@ Freqtrade provides a builtin webserver, which can serve [FreqUI](https://github.
|
||||
|
||||
By default, the UI is automatically installed as part of the installation (script, docker).
|
||||
freqUI can also be manually installed by using the `freqtrade install-ui` command.
|
||||
This same command can also be used to update freqUI to new new releases.
|
||||
This same command can also be used to update freqUI to new releases.
|
||||
|
||||
Once the bot is started in trade / dry-run mode (with `freqtrade trade`) - the UI will be available under the configured API port (by default `http://127.0.0.1:8080`).
|
||||
|
||||
@@ -70,7 +70,16 @@ Things you can change (among others):
|
||||

|
||||

|
||||
|
||||
## Backtesting
|
||||
## Webserver mode
|
||||
|
||||
when freqtrade is started in [webserver mode](utils.md#webserver-mode) (freqtrade started with `freqtrade webserver`), the webserver will start in a special mode allowing for additional features, for example:
|
||||
|
||||
* Downloading data
|
||||
* Testing pairlists
|
||||
* [Backtesting strategies](#backtesting)
|
||||
* ... to be expanded
|
||||
|
||||
### Backtesting
|
||||
|
||||
When freqtrade is started in [webserver mode](utils.md#webserver-mode) (freqtrade started with `freqtrade webserver`), the backtesting view becomes available.
|
||||
This view allows you to backtest strategies and visualize the results.
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
|
||||
| Exchange | Mode | Margin mode | Stoploss type |
|
||||
|---------|---------|------|------------------|
|
||||
| [Binance](exchanges.md#binance) | spot | | limit |
|
||||
| [Binance](exchanges.md#binance) | futures | isolated, cross | market, limit |
|
||||
| [Bingx](exchanges.md#bingx) | spot | | market, limit |
|
||||
| [Bitmart](exchanges.md#bitmart) | spot | | ❌ (not supported) |
|
||||
| [Bybit](exchanges.md#bybit) | spot | | ❌ (not supported) |
|
||||
| [Bybit](exchanges.md#bybit) | futures | isolated | market, limit |
|
||||
| [Gate.io](exchanges.md#gateio) | spot | | limit |
|
||||
| [Gate.io](exchanges.md#gateio) | futures | isolated | limit |
|
||||
| [HTX](exchanges.md#htx) | spot | | limit |
|
||||
| [Hyperliquid](exchanges.md#hyperliquid) | spot | | ❌ (not supported) |
|
||||
| [Hyperliquid](exchanges.md#hyperliquid) | futures | isolated | limit |
|
||||
| [Kraken](exchanges.md#kraken) | spot | | market, limit |
|
||||
| [OKX](exchanges.md#okx) | spot | | limit |
|
||||
| [OKX](exchanges.md#okx) | futures | isolated | limit |
|
||||
| [Bitvavo](exchanges.md#bitvavo) | spot | | ❌ (not supported) |
|
||||
| [Kucoin](exchanges.md#kucoin) | spot | | market, limit |
|
||||
@@ -4,7 +4,7 @@ Pairlist Handlers define the list of pairs (pairlist) that the bot should trade.
|
||||
|
||||
In your configuration, you can use Static Pairlist (defined by the [`StaticPairList`](#static-pair-list) Pairlist Handler) and Dynamic Pairlist (defined by the [`VolumePairList`](#volume-pair-list) and [`PercentChangePairList`](#percent-change-pair-list) Pairlist Handlers).
|
||||
|
||||
Additionally, [`AgeFilter`](#agefilter), [`PrecisionFilter`](#precisionfilter), [`PriceFilter`](#pricefilter), [`ShuffleFilter`](#shufflefilter), [`SpreadFilter`](#spreadfilter) and [`VolatilityFilter`](#volatilityfilter) act as Pairlist Filters, removing certain pairs and/or moving their positions in the pairlist.
|
||||
Additionally, [`AgeFilter`](#agefilter), [`DelistFilter`](#delistfilter), [`PrecisionFilter`](#precisionfilter), [`PriceFilter`](#pricefilter), [`ShuffleFilter`](#shufflefilter), [`SpreadFilter`](#spreadfilter) and [`VolatilityFilter`](#volatilityfilter) act as Pairlist Filters, removing certain pairs and/or moving their positions in the pairlist.
|
||||
|
||||
If multiple Pairlist Handlers are used, they are chained and a combination of all Pairlist Handlers forms the resulting pairlist the bot uses for trading and backtesting. Pairlist Handlers are executed in the sequence they are configured. You can define either `StaticPairList`, `VolumePairList`, `ProducerPairList`, `RemotePairList`, `MarketCapPairList` or `PercentChangePairList` as the starting Pairlist Handler.
|
||||
|
||||
@@ -27,6 +27,7 @@ You may also use something like `.*DOWN/BTC` or `.*UP/BTC` to exclude leveraged
|
||||
* [`RemotePairList`](#remotepairlist)
|
||||
* [`MarketCapPairList`](#marketcappairlist)
|
||||
* [`AgeFilter`](#agefilter)
|
||||
* [`DelistFilter`](#delistfilter)
|
||||
* [`FullTradesFilter`](#fulltradesfilter)
|
||||
* [`OffsetFilter`](#offsetfilter)
|
||||
* [`PerformanceFilter`](#performancefilter)
|
||||
@@ -38,7 +39,7 @@ You may also use something like `.*DOWN/BTC` or `.*UP/BTC` to exclude leveraged
|
||||
* [`VolatilityFilter`](#volatilityfilter)
|
||||
|
||||
!!! Tip "Testing pairlists"
|
||||
Pairlist configurations can be quite tricky to get right. Best use the [`test-pairlist`](utils.md#test-pairlist) utility sub-command to test your configuration quickly.
|
||||
Pairlist configurations can be quite tricky to get right. Best use freqUI in [webserver mode](freq-ui.md#webserver-mode) or the [`test-pairlist`](utils.md#test-pairlist) utility sub-command to test your Pairlist configuration quickly.
|
||||
|
||||
#### Static Pair List
|
||||
|
||||
@@ -180,7 +181,7 @@ More sophisticated approach can be used, by using `lookback_timeframe` for candl
|
||||
* `refresh_period`: Defines the interval (in seconds) at which the pairlist will be refreshed. The default is 1800 seconds (30 minutes).
|
||||
* `lookback_days`: Number of days to look back. When `lookback_days` is selected, the `lookback_timeframe` is defaulted to 1 day.
|
||||
* `lookback_timeframe`: Timeframe to use for the lookback period.
|
||||
* `lookback_period`: Number of periods to look back at.
|
||||
* `lookback_period`: Number of periods to look back at.
|
||||
|
||||
When PercentChangePairList is used after other Pairlist Handlers, it will operate on the outputs of those handlers. If it is the leading Pairlist Handler, it will select pairs from all available markets with the specified stake currency.
|
||||
|
||||
@@ -270,7 +271,6 @@ You can limit the length of the pairlist with the optional parameter `number_ass
|
||||
],
|
||||
```
|
||||
|
||||
|
||||
!!! Tip "Combining pairlists"
|
||||
This pairlist can be combined with all other pairlists and filters for further pairlist reduction, and can also act as an "additional" pairlist, on top of already defined pairs.
|
||||
`ProducerPairList` can also be used multiple times in sequence, combining the pairs from multiple producers.
|
||||
@@ -312,7 +312,7 @@ The `pairlist_url` option specifies the URL of the remote server where the pairl
|
||||
The `save_to_file` option, when provided with a valid filename, saves the processed pairlist to that file in JSON format. This option is optional, and by default, the pairlist is not saved to a file.
|
||||
|
||||
??? Example "Multi bot with shared pairlist example"
|
||||
|
||||
|
||||
`save_to_file` can be used to save the pairlist to a file with Bot1:
|
||||
|
||||
```json
|
||||
@@ -389,6 +389,8 @@ The `refresh_period` setting defines the interval (in seconds) at which the mark
|
||||
The `categories` setting specifies the [coingecko categories](https://www.coingecko.com/en/categories) from which to select coins from. The default is an empty list `[]`, meaning no category filtering is applied.
|
||||
If an incorrect category string is chosen, the plugin will print the available categories from CoinGecko and fail. The category should be the ID of the category, for example, for `https://www.coingecko.com/en/categories/layer-1`, the category ID would be `layer-1`. You can pass multiple categories such as `["layer-1", "meme-token"]` to select from several categories.
|
||||
|
||||
Coins like 1000PEPE/USDT or KPEPE/USDT:USDT are detected on a best effort basis, with the prefixes `1000` and `K` being used to identify them.
|
||||
|
||||
!!! Warning "Many categories"
|
||||
Each added category corresponds to one API call to CoinGecko. The more categories you add, the longer the pairlist generation will take, potentially causing rate limit issues.
|
||||
|
||||
@@ -405,6 +407,16 @@ be caught out buying before the pair has finished dropping in price.
|
||||
|
||||
This filter allows freqtrade to ignore pairs until they have been listed for at least `min_days_listed` days and listed before `max_days_listed`.
|
||||
|
||||
#### DelistFilter
|
||||
|
||||
Removes pairs that will be delisted on the exchange maximum `max_days_from_now` days from now (defaults to `0` which remove all future delisted pairs no matter how far from now). Currently this filter only supports following exchanges:
|
||||
|
||||
!!! Note "Available exchanges"
|
||||
Delist filter is only available on Binance, where Binance Futures will work for both dry and live modes, while Binance Spot is limited to live mode (for technical reasons).
|
||||
|
||||
!!! Warning "Backtesting"
|
||||
`DelistFilter` does not support backtesting mode.
|
||||
|
||||
#### FullTradesFilter
|
||||
|
||||
Shrink whitelist to consist only in-trade pairs when the trade slots are full (when `max_open_trades` isn't being set to `-1` in the config).
|
||||
@@ -436,7 +448,7 @@ Example to remove the first 10 pairs from the pairlist, and takes the next 20 (t
|
||||
```
|
||||
|
||||
!!! Warning
|
||||
When `OffsetFilter` is used to split a larger pairlist among multiple bots in combination with `VolumeFilter`
|
||||
When `OffsetFilter` is used to split a larger pairlist among multiple bots in combination with `VolumeFilter`
|
||||
it can not be guaranteed that pairs won't overlap due to slightly different refresh intervals for the
|
||||
`VolumeFilter`.
|
||||
|
||||
@@ -599,7 +611,7 @@ Adding `"sort_direction": "asc"` or `"sort_direction": "desc"` enables sorting m
|
||||
|
||||
### Full example of Pairlist Handlers
|
||||
|
||||
The below example blacklists `BNB/BTC`, uses `VolumePairList` with `20` assets, sorting pairs by `quoteVolume` and applies [`PrecisionFilter`](#precisionfilter) and [`PriceFilter`](#pricefilter), filtering all assets where 1 price unit is > 1%. Then the [`SpreadFilter`](#spreadfilter) and [`VolatilityFilter`](#volatilityfilter) is applied and pairs are finally shuffled with the random seed set to some predefined value.
|
||||
The below example blacklists `BNB/BTC`, uses `VolumePairList` with `20` assets, sorting pairs by `quoteVolume`, then filter future delisted pairs using [`DelistFilter`](#delistfilter) and [`AgeFilter`](#agefilter) to remove pairs that are listed less than 10 days ago. After that [`PrecisionFilter`](#precisionfilter) and [`PriceFilter`](#pricefilter) are applied, filtering all assets where 1 price unit is > 1%. Then the [`SpreadFilter`](#spreadfilter) and [`VolatilityFilter`](#volatilityfilter) are applied and pairs are finally shuffled with the random seed set to some predefined value.
|
||||
|
||||
```json
|
||||
"exchange": {
|
||||
@@ -612,6 +624,10 @@ The below example blacklists `BNB/BTC`, uses `VolumePairList` with `20` assets,
|
||||
"number_assets": 20,
|
||||
"sort_key": "quoteVolume"
|
||||
},
|
||||
{
|
||||
"method": "DelistFilter",
|
||||
"max_days_from_now": 0,
|
||||
},
|
||||
{"method": "AgeFilter", "min_days_listed": 10},
|
||||
{"method": "PrecisionFilter"},
|
||||
{"method": "PriceFilter", "low_price_ratio": 0.01},
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
This section will highlight a few projects from members of the community.
|
||||
!!! Note
|
||||
The projects below are for the most part not maintained by the freqtrade , therefore use your own caution before using them.
|
||||
The projects below are for the most part not maintained by the freqtrade team, therefore use your own caution before using them.
|
||||
|
||||
- [Example freqtrade strategies](https://github.com/freqtrade/freqtrade-strategies/)
|
||||
- [FrequentHippo - Statistics of dry/live runs and backtests](http://frequenthippo.ddns.net) (by hippocritical).
|
||||
- [Online pairlist generator](https://remotepairlist.com/) (by Blood4rc).
|
||||
- [Freqtrade Backtesting Project](https://strat.ninja/) (by Blood4rc).
|
||||
- [Freqtrade analysis notebook](https://github.com/froggleston/freqtrade_analysis_notebook) (by Froggleston).
|
||||
- [TUI for freqtrade](https://github.com/froggleston/freqtrade-frogtrade9000) (by Froggleston).
|
||||
- [FTUI - Terminal UI for freqtrade](https://github.com/freqtrade/ftui) (by Froggleston).
|
||||
- [Bot Academy](https://botacademy.ddns.net/) (by stash86) - Blog about crypto bot projects.
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
[](https://github.com/freqtrade/freqtrade/actions/)
|
||||
[](https://doi.org/10.21105/joss.04864)
|
||||
[](https://coveralls.io/github/freqtrade/freqtrade?branch=develop)
|
||||
[](https://codeclimate.com/github/freqtrade/freqtrade/maintainability)
|
||||
|
||||
<!-- GitHub action buttons -->
|
||||
[:octicons-star-16: Star](https://github.com/freqtrade/freqtrade){ .md-button .md-button--sm }
|
||||
|
||||
@@ -46,7 +46,6 @@ These requirements apply to both [Script Installation](#script-installation) and
|
||||
* [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.html) (Recommended)
|
||||
* [TA-Lib](https://ta-lib.github.io/ta-lib-python/) (install instructions [below](#install-ta-lib))
|
||||
|
||||
### Install code
|
||||
|
||||
@@ -201,35 +200,6 @@ This option will hard reset your branch (only if you are on either `stable` or `
|
||||
|
||||
Make sure you fulfill the [Requirements](#requirements) and have downloaded the [Freqtrade repository](#freqtrade-repository).
|
||||
|
||||
### Install TA-Lib
|
||||
|
||||
#### TA-Lib script installation
|
||||
|
||||
```bash
|
||||
sudo ./build_helpers/install_ta-lib.sh
|
||||
```
|
||||
|
||||
!!! Note
|
||||
This will use the ta-lib tar.gz included in this repository.
|
||||
|
||||
##### TA-Lib manual installation
|
||||
|
||||
[Official installation guide](https://ta-lib.github.io/ta-lib-python/install.html)
|
||||
|
||||
```bash
|
||||
wget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz
|
||||
tar xvzf 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 --prefix=/usr/local
|
||||
make
|
||||
sudo make install
|
||||
# On debian based systems (debian, ubuntu, ...) - updating ldconfig might be necessary.
|
||||
sudo ldconfig
|
||||
cd ..
|
||||
rm -rf ./ta-lib*
|
||||
```
|
||||
|
||||
### Setup Python virtual environment (virtualenv)
|
||||
|
||||
You will run freqtrade in separated `virtual environment`
|
||||
@@ -332,16 +302,6 @@ python3 -m pip install -r requirements.txt
|
||||
python3 -m pip install -e .
|
||||
```
|
||||
|
||||
Patch conda libta-lib (Linux only)
|
||||
|
||||
```bash
|
||||
# Ensure that the environment is active!
|
||||
conda activate freqtrade
|
||||
|
||||
cd build_helpers
|
||||
bash install_ta-lib.sh ${CONDA_PREFIX} nosudo
|
||||
```
|
||||
|
||||
[You are now ready](#you-are-ready) to run the bot.
|
||||
|
||||
### Important shortcuts
|
||||
|
||||
@@ -22,6 +22,7 @@ This is done by not looking at the strategy code itself, but at changed indicato
|
||||
- `--dry-run-wallet` is forced to be basically infinite (1 billion).
|
||||
- `--stake-amount` is forced to be a static 10000 (10k).
|
||||
- `--enable-protections` is forced to be off.
|
||||
- `order_types` are forced to be "market" (late entries) unless `--lookahead-allow-limit-orders` is set.
|
||||
|
||||
These are set to avoid users accidentally generating false positives.
|
||||
|
||||
@@ -38,7 +39,7 @@ Many strategies, without the programmer knowing, have fallen prey to lookahead b
|
||||
This typically makes the strategy backtest look profitable, sometimes to extremes, but this is not realistic as the strategy is "cheating" by looking at data it would not have in dry or live modes.
|
||||
|
||||
The reason why strategies can "cheat" is because the freqtrade backtesting process populates the full dataframe including all candle timestamps at the outset.
|
||||
If the programmer is not careful or oblivious how things work internally
|
||||
If the programmer is not careful or oblivious how things work internally
|
||||
(which sometimes can be really hard to find out) then the strategy will look into the future.
|
||||
|
||||
This command is made to try to verify the validity in the form of the aforementioned lookahead bias.
|
||||
@@ -50,8 +51,7 @@ After this initial backtest runs, it will look if the `minimum-trade-amount` is
|
||||
If this happens, use a wider timerange to get more trades for the analysis, or use a timerange where more trades occur.
|
||||
|
||||
After setting the baseline it will then do additional backtest runs for every entry and exit separately.
|
||||
When these verification backtests complete, it will compare the indicators at the signal candles (both entry or exit)
|
||||
and report the bias.
|
||||
When these verification backtests complete, it will compare both dataframes (baseline and sliced) for any difference in columns' value and report the bias.
|
||||
After all signals have been verified or falsified a result table will be generated for the user to see.
|
||||
|
||||
### How to find and remove bias? How can I salvage a biased strategy?
|
||||
@@ -98,8 +98,11 @@ If the strategy has many different signals / signal types, it's up to you to sel
|
||||
This would lead to a false-negative, i.e. the strategy will be reported as non-biased.
|
||||
- `lookahead-analysis` has access to the same backtesting options and this can introduce problems.
|
||||
Please don't use any options like enabling position stacking as this will distort the number of checked signals.
|
||||
If you decide to do so, then make doubly sure that you won't ever run out of `max_open_trades` slots,
|
||||
If you decide to do so, then make doubly sure that you won't ever run out of `max_open_trades` slots,
|
||||
and that you have enough capital in the backtest wallet configuration.
|
||||
- In the results table, the `biased_indicators` column
|
||||
- limit orders in combination with `custom_entry_price()` and `custom_exit_price()` callbacks can cause late / delayed entries and exists, causing false positives.
|
||||
To avoid this - market orders are forced for this command. This implicitly means that `custom_entry_price()` and `custom_exit_price()` callbacks are not called.
|
||||
Using `--lookahead-allow-limit-orders` will skip the override and use your configured order types - however has shown to eventually produce false positives.
|
||||
- In the results table, the `biased_indicators` column
|
||||
will falsely flag FreqAI target indicators defined in `set_freqai_targets()` as biased.
|
||||
**These are not biased and can safely be ignored.**
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
markdown==3.8.2
|
||||
markdown==3.9
|
||||
mkdocs==1.6.1
|
||||
mkdocs-material==9.6.16
|
||||
mkdocs-material==9.6.20
|
||||
mdx_truly_sane_lists==1.3
|
||||
pymdown-extensions==10.16
|
||||
pymdown-extensions==10.16.1
|
||||
jinja2==3.1.6
|
||||
mike==2.1.3
|
||||
|
||||
+54
-49
@@ -140,6 +140,11 @@ This method will work for all arguments - check the "show" command for a list of
|
||||
# Get the status of the bot
|
||||
ping = client.ping()
|
||||
print(ping)
|
||||
|
||||
# Add pairs to blacklist
|
||||
client.blacklist("BTC/USDT", "ETH/USDT")
|
||||
# Add pairs to blacklist by supplying a list
|
||||
client.blacklist(*listPairs)
|
||||
# ...
|
||||
```
|
||||
|
||||
@@ -155,63 +160,63 @@ freqtrade-client help
|
||||
Possible commands:
|
||||
|
||||
available_pairs
|
||||
Return available pair (backtest data) based on timeframe / stake_currency selection
|
||||
Return available pair (backtest data) based on timeframe / stake_currency selection
|
||||
|
||||
:param timeframe: Only pairs with this timeframe available.
|
||||
:param stake_currency: Only pairs that include this timeframe
|
||||
|
||||
balance
|
||||
Get the account balance.
|
||||
Get the account balance.
|
||||
|
||||
blacklist
|
||||
Show the current blacklist.
|
||||
Show the current blacklist.
|
||||
|
||||
:param add: List of coins to add (example: "BNB/BTC")
|
||||
|
||||
cancel_open_order
|
||||
Cancel open order for trade.
|
||||
Cancel open order for trade.
|
||||
|
||||
:param trade_id: Cancels open orders for this trade.
|
||||
|
||||
count
|
||||
Return the amount of open trades.
|
||||
Return the amount of open trades.
|
||||
|
||||
daily
|
||||
Return the profits for each day, and amount of trades.
|
||||
Return the profits for each day, and amount of trades.
|
||||
|
||||
delete_lock
|
||||
Delete (disable) lock from the database.
|
||||
Delete (disable) lock from the database.
|
||||
|
||||
:param lock_id: ID for the lock to delete
|
||||
|
||||
delete_trade
|
||||
Delete trade from the database.
|
||||
Delete trade from the database.
|
||||
Tries to close open orders. Requires manual handling of this asset on the exchange.
|
||||
|
||||
:param trade_id: Deletes the trade with this ID from the database.
|
||||
|
||||
forcebuy
|
||||
Buy an asset.
|
||||
Buy an asset.
|
||||
|
||||
:param pair: Pair to buy (ETH/BTC)
|
||||
:param price: Optional - price to buy
|
||||
|
||||
forceenter
|
||||
Force entering a trade
|
||||
Force entering a trade
|
||||
|
||||
:param pair: Pair to buy (ETH/BTC)
|
||||
:param side: 'long' or 'short'
|
||||
:param price: Optional - price to buy
|
||||
|
||||
forceexit
|
||||
Force-exit a trade.
|
||||
Force-exit a trade.
|
||||
|
||||
:param tradeid: Id of the trade (can be received via status command)
|
||||
:param ordertype: Order type to use (must be market or limit)
|
||||
:param amount: Amount to sell. Full sell if not given
|
||||
|
||||
health
|
||||
Provides a quick health check of the running bot.
|
||||
Provides a quick health check of the running bot.
|
||||
|
||||
lock_add
|
||||
Manually lock a specific pair
|
||||
@@ -222,22 +227,22 @@ lock_add
|
||||
:param reason: Reason for the lock
|
||||
|
||||
locks
|
||||
Return current locks
|
||||
Return current locks
|
||||
|
||||
logs
|
||||
Show latest logs.
|
||||
Show latest logs.
|
||||
|
||||
:param limit: Limits log messages to the last <limit> logs. No limit to get the entire log.
|
||||
|
||||
pair_candles
|
||||
Return live dataframe for <pair><timeframe>.
|
||||
Return live dataframe for <pair><timeframe>.
|
||||
|
||||
:param pair: Pair to get data for
|
||||
:param timeframe: Only pairs with this timeframe available.
|
||||
:param limit: Limit result to the last n candles.
|
||||
|
||||
pair_history
|
||||
Return historic, analyzed dataframe
|
||||
Return historic, analyzed dataframe
|
||||
|
||||
:param pair: Pair to get data for
|
||||
:param timeframe: Only pairs with this timeframe available.
|
||||
@@ -245,59 +250,59 @@ pair_history
|
||||
:param timerange: Timerange to get data for (same format than --timerange endpoints)
|
||||
|
||||
performance
|
||||
Return the performance of the different coins.
|
||||
Return the performance of the different coins.
|
||||
|
||||
ping
|
||||
simple ping
|
||||
simple ping
|
||||
|
||||
plot_config
|
||||
Return plot configuration if the strategy defines one.
|
||||
Return plot configuration if the strategy defines one.
|
||||
|
||||
profit
|
||||
Return the profit summary.
|
||||
Return the profit summary.
|
||||
|
||||
reload_config
|
||||
Reload configuration.
|
||||
Reload configuration.
|
||||
|
||||
show_config
|
||||
Returns part of the configuration, relevant for trading operations.
|
||||
Returns part of the configuration, relevant for trading operations.
|
||||
|
||||
start
|
||||
Start the bot if it's in the stopped state.
|
||||
Start the bot if it's in the stopped state.
|
||||
|
||||
pause
|
||||
Pause the bot if it's in the running state. If triggered on stopped state will handle open positions.
|
||||
Pause the bot if it's in the running state. If triggered on stopped state will handle open positions.
|
||||
|
||||
stats
|
||||
Return the stats report (durations, sell-reasons).
|
||||
Return the stats report (durations, sell-reasons).
|
||||
|
||||
status
|
||||
Get the status of open trades.
|
||||
Get the status of open trades.
|
||||
|
||||
stop
|
||||
Stop the bot. Use `start` to restart.
|
||||
Stop the bot. Use `start` to restart.
|
||||
|
||||
stopbuy
|
||||
Stop buying (but handle sells gracefully). Use `reload_config` to reset.
|
||||
Stop buying (but handle sells gracefully). Use `reload_config` to reset.
|
||||
|
||||
strategies
|
||||
Lists available strategies
|
||||
Lists available strategies
|
||||
|
||||
strategy
|
||||
Get strategy details
|
||||
Get strategy details
|
||||
|
||||
:param strategy: Strategy class name
|
||||
|
||||
sysinfo
|
||||
Provides system information (CPU, RAM usage)
|
||||
Provides system information (CPU, RAM usage)
|
||||
|
||||
trade
|
||||
Return specific trade
|
||||
Return specific trade
|
||||
|
||||
:param trade_id: Specify which trade to get.
|
||||
|
||||
trades
|
||||
Return trades history, sorted by id
|
||||
Return trades history, sorted by id
|
||||
|
||||
:param limit: Limits trades to the X last trades. Max 500 trades.
|
||||
:param offset: Offset by this amount of trades.
|
||||
@@ -316,10 +321,10 @@ list_custom_data
|
||||
:param key: str, optional - Key of the custom-data
|
||||
|
||||
version
|
||||
Return the version of the bot.
|
||||
Return the version of the bot.
|
||||
|
||||
whitelist
|
||||
Show the current whitelist.
|
||||
Show the current whitelist.
|
||||
|
||||
|
||||
```
|
||||
@@ -339,32 +344,32 @@ All endpoints in the below table need to be prefixed with the base URL of the AP
|
||||
| `/reload_config` | POST | Reloads the configuration file.
|
||||
| `/trades` | GET | List last trades. Limited to 500 trades per call.
|
||||
| `/trade/<tradeid>` | GET | Get specific trade.<br/>*Params:*<br/>- `tradeid` (`int`)
|
||||
| `/trades/<tradeid>` | DELETE | Remove trade from the database. Tries to close open orders. Requires manual handling of this trade on the exchange.<br/>*Params:*<br/>- `tradeid` (`int`)
|
||||
| `/trades/<tradeid>/open-order` | DELETE | Cancel open order for this trade.<br/>*Params:*<br/>- `tradeid` (`int`)
|
||||
| `/trades/<tradeid>/reload` | POST | Reload a trade from the Exchange. Only works in live, and can potentially help recover a trade that was manually sold on the exchange.<br/>*Params:*<br/>- `tradeid` (`int`)
|
||||
| `/trades/<tradeid>` | DELETE | Remove trade from the database. Tries to close open orders. Requires manual handling of this trade on the exchange.<br/>*Params:*<br/>- `tradeid` (`int`)
|
||||
| `/trades/<tradeid>/open-order` | DELETE | Cancel open order for this trade.<br/>*Params:*<br/>- `tradeid` (`int`)
|
||||
| `/trades/<tradeid>/reload` | POST | Reload a trade from the Exchange. Only works in live, and can potentially help recover a trade that was manually sold on the exchange.<br/>*Params:*<br/>- `tradeid` (`int`)
|
||||
| `/show_config` | GET | Shows part of the current configuration with relevant settings to operation.
|
||||
| `/logs` | GET | Shows last log messages.
|
||||
| `/status` | GET | Lists all open trades.
|
||||
| `/count` | GET | Displays number of trades used and available.
|
||||
| `/entries` | GET | Shows profit statistics for each enter tags for given pair (or all pairs if pair isn't given). Pair is optional.<br/>*Params:*<br/>- `pair` (`str`)
|
||||
| `/exits` | GET | Shows profit statistics for each exit reasons for given pair (or all pairs if pair isn't given). Pair is optional.<br/>*Params:*<br/>- `pair` (`str`)
|
||||
| `/mix_tags` | GET | Shows profit statistics for each combinations of enter tag + exit reasons for given pair (or all pairs if pair isn't given). Pair is optional.<br/>*Params:*<br/>- `pair` (`str`)
|
||||
| `/entries` | GET | Shows profit statistics for each enter tags for given pair (or all pairs if pair isn't given). Pair is optional.<br/>*Params:*<br/>- `pair` (`str`)
|
||||
| `/exits` | GET | Shows profit statistics for each exit reasons for given pair (or all pairs if pair isn't given). Pair is optional.<br/>*Params:*<br/>- `pair` (`str`)
|
||||
| `/mix_tags` | GET | Shows profit statistics for each combinations of enter tag + exit reasons for given pair (or all pairs if pair isn't given). Pair is optional.<br/>*Params:*<br/>- `pair` (`str`)
|
||||
| `/locks` | GET | Displays currently locked pairs.
|
||||
| `/locks` | POST | Locks a pair until "until". (Until will be rounded up to the nearest timeframe). Side is optional and is either `long` or `short` (default is `long`). Reason is optional.<br/>*Params:*<br/>- `<pair>` (`str`)<br/>- `<until>` (`datetime`)<br/>- `[side]` (`str`)<br/>- `[reason]` (`str`)
|
||||
| `/locks/<lockid>` | DELETE | Deletes (disables) the lock by id.<br/>*Params:*<br/>- `lockid` (`int`)
|
||||
| `/locks` | POST | Locks a pair until "until". (Until will be rounded up to the nearest timeframe). Side is optional and is either `long` or `short` (default is `long`). Reason is optional.<br/>*Params:*<br/>- `<pair>` (`str`)<br/>- `<until>` (`datetime`)<br/>- `[side]` (`str`)<br/>- `[reason]` (`str`)
|
||||
| `/locks/<lockid>` | DELETE | Deletes (disables) the lock by id.<br/>*Params:*<br/>- `lockid` (`int`)
|
||||
| `/profit` | GET | Display a summary of your profit/loss from close trades and some stats about your performance.
|
||||
| `/forceexit` | POST | Instantly exits the given trade (ignoring `minimum_roi`), using the given order type ("market" or "limit", uses your config setting if not specified), and the chosen amount (full sell if not specified). If `all` is supplied as the `tradeid`, then all currently open trades will be forced to exit.<br/>*Params:*<br/>- `<tradeid>` (`int` or `str`)<br/>- `<ordertype>` (`str`)<br/>- `[amount]` (`float`)
|
||||
| `/forceenter` | POST | Instantly enters the given pair. Side is optional and is either `long` or `short` (default is `long`). Rate is optional. (`force_entry_enable` must be set to True)<br/>*Params:*<br/>- `<pair>` (`str`)<br/>- `<side>` (`str`)<br/>- `[rate]` (`float`)
|
||||
| `/performance` | GET | Show performance of each finished trade grouped by pair.
|
||||
| `/balance` | GET | Show account balance per currency.
|
||||
| `/daily` | GET | Shows profit or loss per day, over the last n days (n defaults to 7).<br/>*Params:*<br/>- `<n>` (`int`)
|
||||
| `/weekly` | GET | Shows profit or loss per week, over the last n days (n defaults to 4).<br/>*Params:*<br/>- `<n>` (`int`)
|
||||
| `/monthly` | GET | Shows profit or loss per month, over the last n days (n defaults to 3).<br/>*Params:*<br/>- `<n>` (`int`)
|
||||
| `/daily` | GET | Shows profit or loss per day, over the last n days (n defaults to 7).<br/>*Params:*<br/>- `timescale` (`int`)
|
||||
| `/weekly` | GET | Shows profit or loss per week, over the last n days (n defaults to 4).<br/>*Params:*<br/>- `timescale` (`int`)
|
||||
| `/monthly` | GET | Shows profit or loss per month, over the last n days (n defaults to 3).<br/>*Params:*<br/>- `timescale` (`int`)
|
||||
| `/stats` | GET | Display a summary of profit / loss reasons as well as average holding times.
|
||||
| `/whitelist` | GET | Show the current whitelist.
|
||||
| `/blacklist` | GET | Show the current blacklist.
|
||||
| `/blacklist` | POST | Adds the specified pair to the blacklist.<br/>*Params:*<br/>- `pair` (`str`)
|
||||
| `/blacklist` | DELETE | Deletes the specified list of pairs from the blacklist.<br/>*Params:*<br/>- `[pair,pair]` (`list[str]`)
|
||||
| `/blacklist` | POST | Adds the specified pair to the blacklist.<br/>*Params:*<br/>- `blacklist` (`str`)
|
||||
| `/blacklist` | DELETE | Deletes the specified list of pairs from the blacklist.<br/>*Params:*<br/>- `[pair,pair]` (`list[str]`)
|
||||
| `/pair_candles` | GET | Returns dataframe for a pair / timeframe combination while the bot is running. **Alpha**
|
||||
| `/pair_candles` | POST | Returns dataframe for a pair / timeframe combination while the bot is running, filtered by a provided list of columns to return. **Alpha**<br/>*Params:*<br/>- `<column_list>` (`list[str]`)
|
||||
| `/pair_history` | GET | Returns an analyzed dataframe for a given timerange, analyzed by a given strategy. **Alpha**
|
||||
@@ -488,7 +493,7 @@ To properly configure your reverse proxy (securely), please consult it's documen
|
||||
### OpenAPI interface
|
||||
|
||||
To enable the builtin openAPI interface (Swagger UI), specify `"enable_openapi": true` in the api_server configuration.
|
||||
This will enable the Swagger UI at the `/docs` endpoint. By default, that's running at http://localhost:8080/docs - but it'll depend on your settings.
|
||||
This will enable the Swagger UI at the `/docs` endpoint. By default, that's running at <http://localhost:8080/docs> - but it'll depend on your settings.
|
||||
|
||||
### Advanced API usage using JWT tokens
|
||||
|
||||
|
||||
+3
-11
@@ -26,17 +26,9 @@ These modes can be configured with these values:
|
||||
Stoploss on exchange is only supported for the following exchanges, and not all exchanges support both stop-limit and stop-market.
|
||||
The Order-type will be ignored if only one mode is available.
|
||||
|
||||
| Exchange | stop-loss type |
|
||||
|----------|-------------|
|
||||
| Binance | limit |
|
||||
| Binance Futures | market, limit |
|
||||
| Bingx | market, limit |
|
||||
| HTX | limit |
|
||||
| kraken | market, limit |
|
||||
| Gate | limit |
|
||||
| Okx | limit |
|
||||
| Kucoin | stop-limit, stop-market|
|
||||
| Hyperliquid (futures only) | limit |
|
||||
??? info "Supported exchanges and stoploss types"
|
||||
|
||||
--8<-- "includes/exchange-features.md"
|
||||
|
||||
!!! Note "Tight stoploss"
|
||||
<ins>Do not set too low/tight stoploss value when using stop loss on exchange!</ins>
|
||||
|
||||
@@ -1243,6 +1243,10 @@ class AwesomeStrategy(IStrategy):
|
||||
|
||||
```
|
||||
|
||||
!!! Tip "Learn more about storing data"
|
||||
You can learn more about storing data on the [Storing custom trade data](strategy-advanced.md#storing-information-persistent) section.
|
||||
Please keep in mind that this is considered advanced usage, and should be used with care.
|
||||
|
||||
## Plot annotations callback
|
||||
|
||||
The plot annotations callback is called whenever freqUI requests data to display a chart.
|
||||
@@ -1261,6 +1265,7 @@ The full object looks like this:
|
||||
"y_start": 94000.2, // Price / y axis value
|
||||
"y_end": 98000, // Price / y axis value
|
||||
"color": "",
|
||||
"z_level": 5, // z-level, higher values are drawn on top of lower values. Positions relative to the Chart elements need to be set in freqUI.
|
||||
"label": "some label"
|
||||
}
|
||||
```
|
||||
@@ -1352,6 +1357,7 @@ Entries will be validated, and won't be passed to the UI if they don't correspon
|
||||
"y_end": price * 1.01,
|
||||
"y_start": price * 0.99,
|
||||
"color": "rgba(0, 255, 0, 0.4)",
|
||||
"z_level": 5,
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -84,6 +84,7 @@ Check the [configuration documentation](configuration.md) about how to set the b
|
||||
**Always use dry mode when testing as this gives you an idea of how your strategy will work in reality without risking capital.**
|
||||
|
||||
## Diving in deeper
|
||||
|
||||
**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.**
|
||||
|
||||
@@ -99,9 +100,9 @@ file as reference.**
|
||||
Some common patterns for this are listed in the [Common Mistakes](#common-mistakes-when-developing-strategies) section of this document.
|
||||
|
||||
??? Hint "Lookahead and recursive analysis"
|
||||
Freqtrade includes two helpful commands to help assess common lookahead (using future data) and
|
||||
recursive bias (variance in indicator values) issues. Before running a strategy in dry or live more,
|
||||
you should always use these commands first. Please check the relevant documentation for
|
||||
Freqtrade includes two helpful commands to help assess common lookahead (using future data) and
|
||||
recursive bias (variance in indicator values) issues. Before running a strategy in dry or live more,
|
||||
you should always use these commands first. Please check the relevant documentation for
|
||||
[lookahead](lookahead-analysis.md) and [recursive](recursive-analysis.md) analysis.
|
||||
|
||||
### Dataframe
|
||||
@@ -154,7 +155,7 @@ Vectorized operations perform calculations across the whole range of data and ar
|
||||
|
||||
!!! Warning "Trade order assumptions"
|
||||
In backtesting, signals are generated on candle close. Trades are then initiated immeditely on next candle open.
|
||||
|
||||
|
||||
In dry and live, this may be delayed due to all pair dataframes needing to be analysed first, then trade processing
|
||||
for each of those pairs happens. This means that in dry/live you need to be mindful of having as low a computation
|
||||
delay as possible, usually by running a low number of pairs and having a CPU with a good clock speed.
|
||||
@@ -284,7 +285,7 @@ It's important to always return the dataframe without removing/modifying the col
|
||||
|
||||
This method will also define a new column, `"enter_long"` (`"enter_short"` for shorts), which needs to contain `1` for entries, and `0` for "no action". `enter_long` is a mandatory column that must be set even if the strategy is shorting only.
|
||||
|
||||
You can name your entry signals by using the `"enter_tag"` column, which can help debug and assess your strategy later.
|
||||
You can name your entry signals by using the `"enter_tag"` column, which can help debug and assess your strategy later.
|
||||
|
||||
Sample from `user_data/strategies/sample_strategy.py`:
|
||||
|
||||
@@ -555,7 +556,7 @@ A full sample can be found [in the DataProvider section](#complete-dataprovider-
|
||||
|
||||
??? Note "Alternative candle types"
|
||||
Informative_pairs can also provide a 3rd tuple element defining the candle type explicitly.
|
||||
Availability of alternative candle-types will depend on the trading-mode and the exchange.
|
||||
Availability of alternative candle-types will depend on the trading-mode and the exchange.
|
||||
In general, spot pairs cannot be used in futures markets, and futures candles can't be used as informative pairs for spot bots.
|
||||
Details about this may vary, if they do, this can be found in the exchange documentation.
|
||||
|
||||
@@ -783,6 +784,8 @@ Please always check the mode of operation to select the correct method to get da
|
||||
- `ohlcv(pair, timeframe)` - Currently cached candle (OHLCV) data for the pair, returns DataFrame or empty DataFrame.
|
||||
- [`orderbook(pair, maximum)`](#orderbookpair-maximum) - Returns latest orderbook data for the pair, a dict with bids/asks with a total of `maximum` entries.
|
||||
- [`ticker(pair)`](#tickerpair) - Returns current ticker data for the pair. See [ccxt documentation](https://github.com/ccxt/ccxt/wiki/Manual#price-tickers) for more details on the Ticker data structure.
|
||||
- [`check_delisting(pair)`](#check_delistingpair) - Return Datetime of the pair delisting schedule if any, otherwise return None
|
||||
- [`funding_rate(pair)`](#funding_ratepair) - Returns current funding rate data for the pair.
|
||||
- `runmode` - Property containing the current runmode.
|
||||
|
||||
### Example Usages
|
||||
@@ -854,6 +857,8 @@ dataframe, last_updated = self.dp.get_analyzed_dataframe(pair=metadata['pair'],
|
||||
|
||||
### *orderbook(pair, maximum)*
|
||||
|
||||
Retrieve the current order book for a pair.
|
||||
|
||||
``` python
|
||||
if self.dp.runmode.value in ('live', 'dry_run'):
|
||||
ob = self.dp.orderbook(metadata['pair'], 1)
|
||||
@@ -903,6 +908,69 @@ if self.dp.runmode.value in ('live', 'dry_run'):
|
||||
!!! Warning "Warning about backtesting"
|
||||
This method will always return up-to-date / real-time values. As such, usage during backtesting / hyperopt without runmode checks will lead to wrong results, e.g. your whole dataframe will contain the same single value in all rows.
|
||||
|
||||
### *check_delisting(pair)*
|
||||
|
||||
```python
|
||||
def custom_exit(self, pair: str, trade: Trade, current_time: datetime, current_rate: float, current_profit: float, **kwargs):
|
||||
if self.dp.runmode.value in ('live', 'dry_run'):
|
||||
delisting_dt = self.dp.check_delisting(pair)
|
||||
if delisting_dt is not None:
|
||||
return "delist"
|
||||
```
|
||||
|
||||
!!! Note "Availabiity of delisting information"
|
||||
This method is only available for certain exchanges and will return `None` in cases this is not available or if the pair is not scheduled for delisting.
|
||||
|
||||
!!! Warning "Warning about backtesting"
|
||||
This method will always return up-to-date / real-time values. As such, usage during backtesting / hyperopt without runmode checks will lead to wrong results, e.g. your whole dataframe will contain the same single value in all rows.
|
||||
|
||||
### *funding_rate(pair)*
|
||||
|
||||
Retrieves the current funding rate for the pair and only works for futures pairs in the format of `base/quote:settle` (e.g. `ETH/USDT:USDT`).
|
||||
|
||||
``` python
|
||||
if self.dp.runmode.value in ('live', 'dry_run'):
|
||||
funding_rate = self.dp.funding_rate(metadata['pair'])
|
||||
dataframe['current_funding_rate'] = funding_rate['fundingRate']
|
||||
dataframe['next_funding_timestamp'] = funding_rate['fundingTimestamp']
|
||||
dataframe['next_funding_datetime'] = funding_rate['fundingDatetime']
|
||||
```
|
||||
|
||||
The funding rate structure is aligned with the funding rate structure from [ccxt](https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-structure), so the result will be formatted as follows:
|
||||
|
||||
``` python
|
||||
{
|
||||
"info": {
|
||||
# ...
|
||||
},
|
||||
"symbol": "BTC/USDT:USDT",
|
||||
"markPrice": 110730.7,
|
||||
"indexPrice": 110782.52,
|
||||
"interestRate": 0.0001,
|
||||
"estimatedSettlePrice": 110822.67200153,
|
||||
"timestamp": 1757146321001,
|
||||
"datetime": "2025-09-06T08:12:01.001Z",
|
||||
"fundingRate": 5.609e-05,
|
||||
"fundingTimestamp": 1757174400000,
|
||||
"fundingDatetime": "2025-09-06T16:00:00.000Z",
|
||||
"nextFundingRate": None,
|
||||
"nextFundingTimestamp": None,
|
||||
"nextFundingDatetime": None,
|
||||
"previousFundingRate": None,
|
||||
"previousFundingTimestamp": None,
|
||||
"previousFundingDatetime": None,
|
||||
"interval": None,
|
||||
}
|
||||
```
|
||||
|
||||
Therefore, using `funding_rate['fundingRate']` as demonstrated above will use the current funding rate.
|
||||
Actually available data will vary between exchanges, so this code may not work as expected across exchanges.
|
||||
|
||||
!!! Warning "Warning about backtesting"
|
||||
Current funding-rate is not part of the historic data which means backtesting and hyperopt will not work correctly if this method is used, as the method will return up-to-date values.
|
||||
We recommend to use the historically available funding rate for backtesting (which is automatically downloaded, and is at the frequency of what the exchange provides, usually 4h or 8h).
|
||||
`self.dp.get_pair_dataframe(pair=metadata['pair'], timeframe='8h', candle_type="funding_rate")`
|
||||
|
||||
### Send Notification
|
||||
|
||||
The dataprovider `.send_msg()` function allows you to send custom notifications from your strategy.
|
||||
|
||||
@@ -47,3 +47,8 @@
|
||||
border-color: #afb8c1;
|
||||
box-shadow: inset 0 1px 0 rgba(175, 184, 193, 0.2);
|
||||
}
|
||||
|
||||
.md-grid {
|
||||
/* default is max-width: 61rem; */
|
||||
max-width: 75rem;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,3 @@ freqtrade install-ui
|
||||
|
||||
Update-problems usually come missing dependencies (you didn't follow the above instructions) - or from updated dependencies, which fail to install (for example TA-lib).
|
||||
Please refer to the corresponding installation sections (common problems linked below)
|
||||
|
||||
Common problems and their solutions:
|
||||
|
||||
* [ta-lib update on windows](windows_installation.md#install-ta-lib)
|
||||
|
||||
@@ -80,6 +80,29 @@ When using the Form-Encoded or JSON-Encoded configuration you can configure any
|
||||
|
||||
The result would be a POST request with e.g. `Status: running` body and `Content-Type: text/plain` header.
|
||||
|
||||
### Nested Webhook Configuration
|
||||
|
||||
Some webhook targets require a nested structure.
|
||||
This can be accomplished by setting the content as dictionary or list instead of as text directly.
|
||||
|
||||
This is only supported for the JSON format.
|
||||
|
||||
```json
|
||||
"webhook": {
|
||||
"enabled": true,
|
||||
"url": "https://<yourhookurl>",
|
||||
"format": "json",
|
||||
"status": {
|
||||
"msgtype": "text",
|
||||
"text": {
|
||||
"content": "Status update: {status}"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
The result would be a POST request with e.g. `{"msgtype":"text","text":{"content":"Status update: running"}}` body and `Content-Type: application/json` header.
|
||||
|
||||
## Additional configurations
|
||||
|
||||
The `webhook.retries` parameter can be set for the maximum number of retries the webhook request should attempt if it is unsuccessful (i.e. HTTP response status is not 200). By default this is set to `0` which is disabled. An additional `webhook.retry_delay` parameter can be set to specify the time in seconds between retry attempts. By default this is set to `0.1` (i.e. 100ms). Note that increasing the number of retries or retry delay may slow down the trader if there are connectivity issues with the webhook.
|
||||
|
||||
@@ -38,30 +38,6 @@ cd freqtrade
|
||||
!!! Hint
|
||||
Using the [Anaconda Distribution](https://www.anaconda.com/distribution/) under Windows can greatly help with installation problems. Check out the [Anaconda installation section](installation.md#installation-with-conda) in the documentation for more information.
|
||||
|
||||
### Install ta-lib
|
||||
|
||||
Install ta-lib according to the [ta-lib documentation](https://github.com/TA-Lib/ta-lib-python#windows).
|
||||
|
||||
As compiling from source on windows has heavy dependencies (requires a partial visual studio installation), Freqtrade provides these dependencies (in the binary wheel format) for the latest 3 Python versions (3.11, 3.12 and 3.13) and for 64bit Windows.
|
||||
These Wheels are also used by CI running on windows, and are therefore tested together with freqtrade.
|
||||
|
||||
Other versions must be downloaded from the above link.
|
||||
|
||||
``` powershell
|
||||
cd \path\freqtrade
|
||||
python -m venv .venv
|
||||
.venv\Scripts\activate.ps1
|
||||
# optionally install ta-lib from wheel
|
||||
# Eventually adjust the below filename to match the downloaded wheel
|
||||
pip install --find-links build_helpers\ TA-Lib -U
|
||||
pip install -r requirements.txt
|
||||
pip install -e .
|
||||
freqtrade
|
||||
```
|
||||
|
||||
!!! Note "Use Powershell"
|
||||
The above installation script assumes you're using powershell on a 64bit windows.
|
||||
Commands for the legacy CMD windows console may differ.
|
||||
|
||||
### Error during installation on Windows
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"""Freqtrade bot"""
|
||||
|
||||
__version__ = "2025.7"
|
||||
__version__ = "2025.9.1"
|
||||
|
||||
if "dev" in __version__:
|
||||
from pathlib import Path
|
||||
|
||||
@@ -17,7 +17,7 @@ def start_analysis_entries_exits(args: dict[str, Any]) -> None:
|
||||
from freqtrade.data.entryexitanalysis import process_entry_exit_reasons
|
||||
|
||||
# Initialize configuration
|
||||
config = setup_utils_configuration(args, RunMode.BACKTEST)
|
||||
config = setup_utils_configuration(args, RunMode.UTIL_NO_EXCHANGE)
|
||||
|
||||
logger.info("Starting freqtrade in analysis mode")
|
||||
|
||||
|
||||
@@ -49,11 +49,13 @@ ARGS_BACKTEST = [
|
||||
*ARGS_COMMON_OPTIMIZE,
|
||||
"position_stacking",
|
||||
"enable_protections",
|
||||
"enable_dynamic_pairlist",
|
||||
"dry_run_wallet",
|
||||
"timeframe_detail",
|
||||
"strategy_list",
|
||||
"export",
|
||||
"exportfilename",
|
||||
"exportdirectory",
|
||||
"backtest_breakdown",
|
||||
"backtest_cache",
|
||||
"freqai_backtest_live_models",
|
||||
@@ -94,9 +96,14 @@ ARGS_LIST_FREQAIMODELS = ["freqaimodel_path", "print_one_column"]
|
||||
|
||||
ARGS_LIST_HYPEROPTS = ["hyperopt_path", "print_one_column"]
|
||||
|
||||
ARGS_BACKTEST_SHOW = ["exportfilename", "backtest_show_pair_list", "backtest_breakdown"]
|
||||
ARGS_BACKTEST_SHOW = [
|
||||
"exportfilename",
|
||||
"exportdirectory",
|
||||
"backtest_show_pair_list",
|
||||
"backtest_breakdown",
|
||||
]
|
||||
|
||||
ARGS_LIST_EXCHANGES = ["print_one_column", "list_exchanges_all"]
|
||||
ARGS_LIST_EXCHANGES = ["print_one_column", "list_exchanges_all", "trading_mode", "dex_exchanges"]
|
||||
|
||||
ARGS_LIST_TIMEFRAMES = ["exchange", "print_one_column"]
|
||||
|
||||
@@ -158,6 +165,7 @@ ARGS_DOWNLOAD_DATA = [
|
||||
"days",
|
||||
"new_pairs_days",
|
||||
"include_inactive",
|
||||
"no_parallel_download",
|
||||
"timerange",
|
||||
"download_trades",
|
||||
"convert_trades",
|
||||
@@ -233,6 +241,7 @@ ARGS_HYPEROPT_SHOW = [
|
||||
|
||||
ARGS_ANALYZE_ENTRIES_EXITS = [
|
||||
"exportfilename",
|
||||
"exportdirectory",
|
||||
"analysis_groups",
|
||||
"enter_reason_list",
|
||||
"exit_reason_list",
|
||||
@@ -252,7 +261,12 @@ ARGS_LOOKAHEAD_ANALYSIS = [
|
||||
a
|
||||
for a in ARGS_BACKTEST
|
||||
if a not in ("position_stacking", "backtest_cache", "backtest_breakdown", "backtest_notes")
|
||||
] + ["minimum_trade_amount", "targeted_trade_amount", "lookahead_analysis_exportfilename"]
|
||||
] + [
|
||||
"minimum_trade_amount",
|
||||
"targeted_trade_amount",
|
||||
"lookahead_analysis_exportfilename",
|
||||
"lookahead_allow_limit_orders",
|
||||
]
|
||||
|
||||
ARGS_RECURSIVE_ANALYSIS = ["timeframe", "timerange", "dataformat_ohlcv", "pairs", "startup_candle"]
|
||||
|
||||
|
||||
@@ -184,12 +184,20 @@ AVAILABLE_CLI_OPTIONS = {
|
||||
"enable_protections": Arg(
|
||||
"--enable-protections",
|
||||
"--enableprotections",
|
||||
help="Enable protections for backtesting."
|
||||
help="Enable protections for backtesting. "
|
||||
"Will slow backtesting down by a considerable amount, but will include "
|
||||
"configured protections",
|
||||
action="store_true",
|
||||
default=False,
|
||||
),
|
||||
"enable_dynamic_pairlist": Arg(
|
||||
"--enable-dynamic-pairlist",
|
||||
help="Enables dynamic pairlist refreshes in backtesting. "
|
||||
"The pairlist will be generated for each new candle if you're using a "
|
||||
"pairlist handler that supports this feature, for example, ShuffleFilter.",
|
||||
action="store_true",
|
||||
default=False,
|
||||
),
|
||||
"strategy_list": Arg(
|
||||
"--strategy-list",
|
||||
help="Provide a space-separated list of strategies to backtest. "
|
||||
@@ -199,22 +207,29 @@ AVAILABLE_CLI_OPTIONS = {
|
||||
"(so `backtest-data.json` becomes `backtest-data-SampleStrategy.json`",
|
||||
nargs="+",
|
||||
),
|
||||
"export": Arg(
|
||||
"--export",
|
||||
help="Export backtest results (default: trades).",
|
||||
choices=constants.EXPORT_OPTIONS,
|
||||
),
|
||||
"backtest_notes": Arg(
|
||||
"--notes",
|
||||
help="Add notes to the backtest results.",
|
||||
metavar="TEXT",
|
||||
),
|
||||
"export": Arg(
|
||||
"--export",
|
||||
help="Export backtest results (default: trades).",
|
||||
choices=constants.EXPORT_OPTIONS,
|
||||
),
|
||||
"exportdirectory": Arg(
|
||||
"--backtest-directory",
|
||||
"--export-directory",
|
||||
help="Directory to use for backtest results. "
|
||||
"Example: `--export-directory=user_data/backtest_results/`. ",
|
||||
metavar="PATH",
|
||||
),
|
||||
"exportfilename": Arg(
|
||||
"--export-filename",
|
||||
"--backtest-filename",
|
||||
"--export-filename",
|
||||
help="Use this filename for backtest results."
|
||||
"Requires `--export` to be set as well. "
|
||||
"Example: `--export-filename=user_data/backtest_results/backtest_today.json`",
|
||||
"Example: `--backtest-filename=backtest_results_2020-09-27_16-20-48.json`. "
|
||||
"Assumes either `user_data/backtest_results/` or `--export-directory` as base directory.",
|
||||
metavar="PATH",
|
||||
),
|
||||
"disableparamexport": Arg(
|
||||
@@ -369,6 +384,11 @@ AVAILABLE_CLI_OPTIONS = {
|
||||
help="Print all exchanges known to the ccxt library.",
|
||||
action="store_true",
|
||||
),
|
||||
"dex_exchanges": Arg(
|
||||
"--dex-exchanges",
|
||||
help="Print only DEX exchanges.",
|
||||
action="store_true",
|
||||
),
|
||||
# List pairs / markets
|
||||
"list_pairs_all": Arg(
|
||||
"-a",
|
||||
@@ -442,6 +462,11 @@ AVAILABLE_CLI_OPTIONS = {
|
||||
help="Also download data from inactive pairs.",
|
||||
action="store_true",
|
||||
),
|
||||
"no_parallel_download": Arg(
|
||||
"--no-parallel-download",
|
||||
help="Disable parallel startup download. Only use this if you experience issues.",
|
||||
action="store_true",
|
||||
),
|
||||
"new_pairs_days": Arg(
|
||||
"--new-pairs-days",
|
||||
help="Download data of new pairs for given number of days. Default: `%(default)s`.",
|
||||
@@ -789,6 +814,14 @@ AVAILABLE_CLI_OPTIONS = {
|
||||
help="Specify startup candles to be checked (`199`, `499`, `999`, `1999`).",
|
||||
nargs="+",
|
||||
),
|
||||
"lookahead_allow_limit_orders": Arg(
|
||||
"--allow-limit-orders",
|
||||
help=(
|
||||
"Allow limit orders in lookahead analysis (could cause false positives "
|
||||
"in lookahead analysis results)."
|
||||
),
|
||||
action="store_true",
|
||||
),
|
||||
"show_sensitive": Arg(
|
||||
"--show-sensitive",
|
||||
help="Show secrets in the output.",
|
||||
|
||||
@@ -6,7 +6,7 @@ from typing import Any
|
||||
from freqtrade.constants import DATETIME_PRINT_FORMAT, DL_DATA_TIMEFRAMES, Config
|
||||
from freqtrade.enums import CandleType, RunMode, TradingMode
|
||||
from freqtrade.exceptions import ConfigurationError
|
||||
from freqtrade.plugins.pairlist.pairlist_helpers import dynamic_expand_pairlist
|
||||
from freqtrade.plugins.pairlist.pairlist_helpers import dynamic_expand_pairlist, expand_pairlist
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -134,7 +134,8 @@ def start_list_data(args: dict[str, Any]) -> None:
|
||||
config["datadir"], config.get("trading_mode", TradingMode.SPOT)
|
||||
)
|
||||
if args["pairs"]:
|
||||
paircombs = [comb for comb in paircombs if comb[0] in args["pairs"]]
|
||||
pl = expand_pairlist(args["pairs"], [p[0] for p in paircombs], keep_invalid=True)
|
||||
paircombs = [comb for comb in paircombs if comb[0] in pl]
|
||||
title = f"Found {len(paircombs)} pair / timeframe combinations."
|
||||
if not config.get("show_timerange"):
|
||||
groupedpair = defaultdict(list)
|
||||
@@ -197,7 +198,8 @@ def start_list_trades_data(args: dict[str, Any]) -> None:
|
||||
)
|
||||
|
||||
if args["pairs"]:
|
||||
paircombs = [comb for comb in paircombs if comb in args["pairs"]]
|
||||
pl = expand_pairlist(args["pairs"], [p for p in paircombs], keep_invalid=True)
|
||||
paircombs = [comb for comb in paircombs if comb in pl]
|
||||
|
||||
title = f"Found trades data for {len(paircombs)} {plural(len(paircombs), 'pair')}."
|
||||
if not config.get("show_timerange"):
|
||||
|
||||
@@ -46,7 +46,18 @@ def start_list_exchanges(args: dict[str, Any]) -> None:
|
||||
table.add_column("Markets")
|
||||
table.add_column("Reason")
|
||||
|
||||
trading_mode = args.get("trading_mode", None)
|
||||
dex_only = args.get("dex_exchanges", False)
|
||||
|
||||
for exchange in available_exchanges:
|
||||
if trading_mode and not any(
|
||||
a["trading_mode"] == trading_mode for a in exchange["trade_modes"]
|
||||
):
|
||||
# If trading_mode is specified, only show exchanges that support it
|
||||
continue
|
||||
if dex_only and not exchange.get("dex", False):
|
||||
# If dex_only is specified, only show DEX exchanges
|
||||
continue
|
||||
name = Text(exchange["name"])
|
||||
if exchange["supported"]:
|
||||
name.append(" (Supported)", style="italic")
|
||||
@@ -55,7 +66,7 @@ def start_list_exchanges(args: dict[str, Any]) -> None:
|
||||
if exchange["is_alias"]:
|
||||
name.stylize("strike")
|
||||
classname.stylize("strike")
|
||||
classname.append(f" (use {exchange['alias_for']})", style="italic")
|
||||
classname.append(f"\n -> use {exchange['alias_for']}", style="italic")
|
||||
|
||||
trade_modes = Text(
|
||||
", ".join(
|
||||
@@ -135,6 +146,9 @@ def start_list_strategies(args: dict[str, Any]) -> None:
|
||||
strategy_objs = StrategyResolver.search_all_objects(
|
||||
config, not args["print_one_column"], config.get("recursive_strategy_search", False)
|
||||
)
|
||||
if not strategy_objs:
|
||||
logger.warning("No strategies found.")
|
||||
return
|
||||
# Sort alphabetically
|
||||
strategy_objs = sorted(strategy_objs, key=lambda x: x["name"])
|
||||
for obj in strategy_objs:
|
||||
|
||||
@@ -72,7 +72,7 @@ def start_backtesting_show(args: dict[str, Any]) -> None:
|
||||
from freqtrade.data.btanalysis import load_backtest_stats
|
||||
from freqtrade.optimize.optimize_reports import show_backtest_results, show_sorted_pairlist
|
||||
|
||||
results = load_backtest_stats(config["exportfilename"])
|
||||
results = load_backtest_stats(config["exportdirectory"], config["exportfilename"])
|
||||
|
||||
show_backtest_results(config, results)
|
||||
show_sorted_pairlist(config, results)
|
||||
|
||||
@@ -157,6 +157,16 @@ CONF_SCHEMA = {
|
||||
"description": f"Offset for profit exit. {__IN_STRATEGY}",
|
||||
"type": "number",
|
||||
},
|
||||
"recursive_strategy_search": {
|
||||
"description": "Enable recursive strategy search.",
|
||||
"type": "boolean",
|
||||
},
|
||||
"user_data_dir": {
|
||||
"description": "Path to the user data directory.",
|
||||
},
|
||||
"datadir": {
|
||||
"description": "Path to the data directory.",
|
||||
},
|
||||
"fee": {
|
||||
"description": "Trading fee percentage. Can help to simulate slippage in backtesting",
|
||||
"type": "number",
|
||||
@@ -443,6 +453,7 @@ CONF_SCHEMA = {
|
||||
"pairlists": {
|
||||
"description": "Configuration for pairlists.",
|
||||
"type": "array",
|
||||
"minItems": 1,
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -1371,6 +1382,7 @@ SCHEMA_TRADE_REQUIRED = [
|
||||
"entry_pricing",
|
||||
"stoploss",
|
||||
"minimal_roi",
|
||||
"pairlists",
|
||||
"internals",
|
||||
"dataformat_ohlcv",
|
||||
"dataformat_trades",
|
||||
@@ -1380,6 +1392,7 @@ SCHEMA_BACKTEST_REQUIRED = [
|
||||
"exchange",
|
||||
"stake_currency",
|
||||
"stake_amount",
|
||||
"pairlists",
|
||||
"dry_run_wallet",
|
||||
"dataformat_ohlcv",
|
||||
"dataformat_trades",
|
||||
|
||||
@@ -66,7 +66,8 @@ def validate_config_schema(conf: dict[str, Any], preliminary: bool = False) -> d
|
||||
return conf
|
||||
except ValidationError as e:
|
||||
logger.critical(f"Invalid configuration. Reason: {e}")
|
||||
raise ValidationError(best_match(Draft4Validator(conf_schema).iter_errors(conf)).message)
|
||||
result = best_match(FreqtradeValidator(conf_schema).iter_errors(conf))
|
||||
raise ConfigurationError(result.message)
|
||||
|
||||
|
||||
def validate_config_consistency(conf: dict[str, Any], *, preliminary: bool = False) -> None:
|
||||
@@ -112,7 +113,6 @@ def _validate_price_config(conf: dict[str, Any]) -> None:
|
||||
"""
|
||||
When using market orders, price sides must be using the "other" side of the price
|
||||
"""
|
||||
# TODO: The below could be an enforced setting when using market orders
|
||||
if conf.get("order_types", {}).get("entry") == "market" and conf.get("entry_pricing", {}).get(
|
||||
"price_side"
|
||||
) not in ("ask", "other"):
|
||||
|
||||
@@ -18,7 +18,10 @@ from freqtrade.constants import Config
|
||||
from freqtrade.enums import (
|
||||
NON_UTIL_MODES,
|
||||
TRADE_MODES,
|
||||
CandleType,
|
||||
MarginMode,
|
||||
RunMode,
|
||||
TradingMode,
|
||||
)
|
||||
from freqtrade.exceptions import OperationalException
|
||||
from freqtrade.loggers import setup_logging
|
||||
@@ -84,9 +87,6 @@ class Configuration:
|
||||
if "internals" not in config:
|
||||
config["internals"] = {}
|
||||
|
||||
if "pairlists" not in config:
|
||||
config["pairlists"] = []
|
||||
|
||||
# Keep a copy of the original configuration file
|
||||
config["original_config"] = deepcopy(config)
|
||||
|
||||
@@ -212,13 +212,31 @@ class Configuration:
|
||||
config.update({"datadir": create_datadir(config, self.args.get("datadir"))})
|
||||
logger.info("Using data directory: %s ...", config.get("datadir"))
|
||||
|
||||
self._args_to_config(
|
||||
config, argname="exportdirectory", logstring="Using {} as backtest directory ..."
|
||||
)
|
||||
|
||||
if self.args.get("exportfilename"):
|
||||
self._args_to_config(
|
||||
config, argname="exportfilename", logstring="Storing backtest results to {} ..."
|
||||
)
|
||||
config["exportfilename"] = Path(config["exportfilename"])
|
||||
else:
|
||||
config["exportfilename"] = config["user_data_dir"] / "backtest_results"
|
||||
if config.get("exportdirectory") and Path(config["exportdirectory"]).is_dir():
|
||||
logger.warning(
|
||||
"DEPRECATED: Using `--export-filename` with directories is deprecated, "
|
||||
"use `--backtest-directory` instead."
|
||||
)
|
||||
if config.get("exportdirectory") is None:
|
||||
# Fallback - assign export-directory directly.
|
||||
config["exportdirectory"] = config["exportfilename"]
|
||||
if not config.get("exportdirectory"):
|
||||
config["exportdirectory"] = config["user_data_dir"] / "backtest_results"
|
||||
if not config.get("exportfilename"):
|
||||
config["exportfilename"] = None
|
||||
if config.get("exportfilename"):
|
||||
# ensure exportfilename is a Path object
|
||||
config["exportfilename"] = Path(config["exportfilename"])
|
||||
config["exportdirectory"] = Path(config["exportdirectory"])
|
||||
|
||||
if self.args.get("show_sensitive"):
|
||||
logger.warning(
|
||||
@@ -244,7 +262,13 @@ class Configuration:
|
||||
self._args_to_config(
|
||||
config,
|
||||
argname="enable_protections",
|
||||
logstring="Parameter --enable-protections detected, enabling Protections. ...",
|
||||
logstring="Parameter --enable-protections detected, enabling Protections ...",
|
||||
)
|
||||
|
||||
self._args_to_config(
|
||||
config,
|
||||
argname="enable_dynamic_pairlist",
|
||||
logstring="Parameter --enable-dynamic-pairlist detected, enabling dynamic pairlist ...",
|
||||
)
|
||||
|
||||
if self.args.get("max_open_trades"):
|
||||
@@ -300,7 +324,6 @@ class Configuration:
|
||||
"recursive_strategy_search",
|
||||
"Recursively searching for a strategy in the strategies folder.",
|
||||
),
|
||||
("timeframe", "Overriding timeframe with Command line argument"),
|
||||
("export", "Parameter --export detected: {} ..."),
|
||||
("backtest_breakdown", "Parameter --breakdown detected ..."),
|
||||
("backtest_cache", "Parameter --cache={} detected ..."),
|
||||
@@ -379,6 +402,7 @@ class Configuration:
|
||||
("timeframes", "timeframes --timeframes: {}"),
|
||||
("days", "Detected --days: {}"),
|
||||
("include_inactive", "Detected --include-inactive-pairs: {}"),
|
||||
("no_parallel_download", "Detected --no-parallel-download: {}"),
|
||||
("download_trades", "Detected --dl-trades: {}"),
|
||||
("convert_trades", "Detected --convert: {} - Converting Trade data to OHCV {}"),
|
||||
("dataformat_ohlcv", 'Using "{}" to store OHLCV data.'),
|
||||
@@ -394,6 +418,14 @@ class Configuration:
|
||||
self._args_to_config(
|
||||
config, argname="trading_mode", logstring="Detected --trading-mode: {}"
|
||||
)
|
||||
# TODO: The following 3 lines (candle_type_def, trading_mode, margin_mode) are actually
|
||||
# set in the exchange class. They're however necessary as fallback to avoid
|
||||
# random errors in commands that don't initialize an exchange.
|
||||
config["candle_type_def"] = CandleType.get_default(
|
||||
config.get("trading_mode", "spot") or "spot"
|
||||
)
|
||||
config["trading_mode"] = TradingMode(config.get("trading_mode", "spot") or "spot")
|
||||
config["margin_mode"] = MarginMode(config.get("margin_mode", "") or "")
|
||||
self._args_to_config(
|
||||
config, argname="candle_types", logstring="Detected --candle-types: {}"
|
||||
)
|
||||
|
||||
@@ -80,6 +80,9 @@ class TimeRange:
|
||||
val = stopdt.strftime(DATETIME_PRINT_FORMAT)
|
||||
return val
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return f"TimeRange({self.timerange_str})"
|
||||
|
||||
def __eq__(self, other):
|
||||
"""Override the default Equals behavior"""
|
||||
return (
|
||||
|
||||
@@ -49,6 +49,7 @@ AVAILABLE_PAIRLISTS = [
|
||||
"RemotePairList",
|
||||
"MarketCapPairList",
|
||||
"AgeFilter",
|
||||
"DelistFilter",
|
||||
"FullTradesFilter",
|
||||
"OffsetFilter",
|
||||
"PerformanceFilter",
|
||||
|
||||
@@ -16,10 +16,7 @@ from .bt_fileutils import (
|
||||
load_backtest_data,
|
||||
load_backtest_metadata,
|
||||
load_backtest_stats,
|
||||
load_exit_signal_candles,
|
||||
load_file_from_zip,
|
||||
load_rejected_signals,
|
||||
load_signal_candles,
|
||||
load_trades,
|
||||
load_trades_from_db,
|
||||
trade_list_to_dataframe,
|
||||
|
||||
@@ -155,33 +155,55 @@ def load_backtest_metadata(filename: Path | str) -> dict[str, Any]:
|
||||
raise OperationalException("Unexpected error while loading backtest metadata.") from e
|
||||
|
||||
|
||||
def load_backtest_stats(filename: Path | str) -> BacktestResultType:
|
||||
def _normalize_filename(file_or_directory: Path | str, filename: Path | str | None) -> Path:
|
||||
"""
|
||||
Normalize the filename by ensuring it is a Path object.
|
||||
:param file_or_directory: The directory or file to normalize.
|
||||
:param filename: The filename to normalize.
|
||||
:return: A Path object representing the normalized filename.
|
||||
"""
|
||||
if isinstance(file_or_directory, str):
|
||||
file_or_directory = Path(file_or_directory)
|
||||
if file_or_directory.is_dir():
|
||||
if not filename:
|
||||
filename = get_latest_backtest_filename(file_or_directory)
|
||||
if Path(filename).is_file():
|
||||
fn = Path(filename)
|
||||
else:
|
||||
fn = file_or_directory / filename
|
||||
else:
|
||||
fn = file_or_directory
|
||||
return fn
|
||||
|
||||
|
||||
def load_backtest_stats(
|
||||
file_or_directory: Path | str, filename: Path | str | None = None
|
||||
) -> BacktestResultType:
|
||||
"""
|
||||
Load backtest statistics file.
|
||||
:param filename: pathlib.Path object, or string pointing to the file.
|
||||
:param file_or_directory: pathlib.Path object, or string pointing to the directory,
|
||||
or absolute/relative path to the backtest results file.
|
||||
:param filename: Optional filename to load from (if different from the main filename).
|
||||
Only valid when loading from a directory.
|
||||
:return: a dictionary containing the resulting file.
|
||||
"""
|
||||
if isinstance(filename, str):
|
||||
filename = Path(filename)
|
||||
if filename.is_dir():
|
||||
filename = filename / get_latest_backtest_filename(filename)
|
||||
if not filename.is_file():
|
||||
raise ValueError(f"File {filename} does not exist.")
|
||||
logger.info(f"Loading backtest result from {filename}")
|
||||
fn = _normalize_filename(file_or_directory, filename)
|
||||
|
||||
if filename.suffix == ".zip":
|
||||
if not fn.is_file():
|
||||
raise ValueError(f"File or directory {fn} does not exist.")
|
||||
logger.info(f"Loading backtest result from {fn}")
|
||||
|
||||
if fn.suffix == ".zip":
|
||||
data = json_load(
|
||||
StringIO(
|
||||
load_file_from_zip(filename, filename.with_suffix(".json").name).decode("utf-8")
|
||||
)
|
||||
StringIO(load_file_from_zip(fn, fn.with_suffix(".json").name).decode("utf-8"))
|
||||
)
|
||||
else:
|
||||
with filename.open() as file:
|
||||
with fn.open() as file:
|
||||
data = json_load(file)
|
||||
|
||||
# Legacy list format does not contain metadata.
|
||||
if isinstance(data, dict):
|
||||
data["metadata"] = load_backtest_metadata(filename)
|
||||
data["metadata"] = load_backtest_metadata(fn)
|
||||
return data
|
||||
|
||||
|
||||
@@ -362,16 +384,21 @@ def _load_backtest_data_df_compatibility(df: pd.DataFrame) -> pd.DataFrame:
|
||||
return df
|
||||
|
||||
|
||||
def load_backtest_data(filename: Path | str, strategy: str | None = None) -> pd.DataFrame:
|
||||
def load_backtest_data(
|
||||
file_or_directory: Path | str, strategy: str | None = None, filename: Path | str | None = None
|
||||
) -> pd.DataFrame:
|
||||
"""
|
||||
Load backtest data file.
|
||||
:param filename: pathlib.Path object, or string pointing to a file or directory
|
||||
Load backtest data file, returns a dataframe with the individual trades.
|
||||
:param file_or_directory: pathlib.Path object, or string pointing to the directory,
|
||||
or absolute/relative path to the backtest results file.
|
||||
:param strategy: Strategy to load - mainly relevant for multi-strategy backtests
|
||||
Can also serve as protection to load the correct result.
|
||||
:param filename: Optional filename to load from (if different from the main filename).
|
||||
Only valid when loading from a directory.
|
||||
:return: a dataframe with the analysis results
|
||||
:raise: ValueError if loading goes wrong.
|
||||
"""
|
||||
data = load_backtest_stats(filename)
|
||||
data = load_backtest_stats(file_or_directory, filename)
|
||||
if not isinstance(data, list):
|
||||
# new, nested format
|
||||
if "strategy" not in data:
|
||||
@@ -430,20 +457,23 @@ def load_file_from_zip(zip_path: Path, filename: str) -> bytes:
|
||||
raise ValueError(f"Bad zip file: {zip_path}.") from None
|
||||
|
||||
|
||||
def load_backtest_analysis_data(backtest_dir: Path, name: str):
|
||||
def load_backtest_analysis_data(
|
||||
file_or_directory: Path,
|
||||
name: Literal["signals", "rejected", "exited"],
|
||||
filename: Path | str | None = None,
|
||||
):
|
||||
"""
|
||||
Load backtest analysis data either from a pickle file or from within a zip file
|
||||
:param backtest_dir: Directory containing backtest results
|
||||
:param file_or_directory: pathlib.Path object, or string pointing to the directory,
|
||||
or absolute/relative path to the backtest results file.
|
||||
:param name: Name of the analysis data to load (signals, rejected, exited)
|
||||
:param filename: Optional filename to load from (if different from the main filename).
|
||||
Only valid when loading from a directory.
|
||||
:return: Analysis data
|
||||
"""
|
||||
import joblib
|
||||
|
||||
if backtest_dir.is_dir():
|
||||
lbf = Path(get_latest_backtest_filename(backtest_dir))
|
||||
zip_path = backtest_dir / lbf
|
||||
else:
|
||||
zip_path = backtest_dir
|
||||
zip_path = _normalize_filename(file_or_directory, filename)
|
||||
|
||||
if zip_path.suffix == ".zip":
|
||||
# Load from zip file
|
||||
@@ -458,10 +488,10 @@ def load_backtest_analysis_data(backtest_dir: Path, name: str):
|
||||
|
||||
else:
|
||||
# Load from separate pickle file
|
||||
if backtest_dir.is_dir():
|
||||
scpf = Path(backtest_dir, f"{zip_path.stem}_{name}.pkl")
|
||||
if file_or_directory.is_dir():
|
||||
scpf = Path(file_or_directory, f"{zip_path.stem}_{name}.pkl")
|
||||
else:
|
||||
scpf = Path(backtest_dir.parent / f"{backtest_dir.stem}_{name}.pkl")
|
||||
scpf = Path(file_or_directory.parent / f"{file_or_directory.stem}_{name}.pkl")
|
||||
|
||||
try:
|
||||
with scpf.open("rb") as scp:
|
||||
@@ -473,27 +503,6 @@ def load_backtest_analysis_data(backtest_dir: Path, name: str):
|
||||
return None
|
||||
|
||||
|
||||
def load_rejected_signals(backtest_dir: Path):
|
||||
"""
|
||||
Load rejected signals from backtest directory
|
||||
"""
|
||||
return load_backtest_analysis_data(backtest_dir, "rejected")
|
||||
|
||||
|
||||
def load_signal_candles(backtest_dir: Path):
|
||||
"""
|
||||
Load signal candles from backtest directory
|
||||
"""
|
||||
return load_backtest_analysis_data(backtest_dir, "signals")
|
||||
|
||||
|
||||
def load_exit_signal_candles(backtest_dir: Path) -> dict[str, dict[str, pd.DataFrame]]:
|
||||
"""
|
||||
Load exit signal candles from backtest directory
|
||||
"""
|
||||
return load_backtest_analysis_data(backtest_dir, "exited")
|
||||
|
||||
|
||||
def trade_list_to_dataframe(trades: list[Trade] | list[LocalTrade]) -> pd.DataFrame:
|
||||
"""
|
||||
Convert list of Trade objects to pandas Dataframe
|
||||
|
||||
@@ -11,7 +11,7 @@ def get_tick_size_over_time(candles: DataFrame) -> Series:
|
||||
# count the number of significant digits for the open and close prices
|
||||
for col in ["open", "high", "low", "close"]:
|
||||
candles[f"{col}_count"] = (
|
||||
candles[col].round(14).astype(str).str.extract(r"\.(\d*[1-9])")[0].str.len()
|
||||
candles[col].round(14).apply("{:.15f}".format).str.extract(r"\.(\d*[1-9])")[0].str.len()
|
||||
)
|
||||
candles["max_count"] = candles[["open_count", "close_count", "high_count", "low_count"]].max(
|
||||
axis=1
|
||||
|
||||
@@ -181,7 +181,6 @@ def trim_dataframes(
|
||||
|
||||
def order_book_to_dataframe(bids: list, asks: list) -> DataFrame:
|
||||
"""
|
||||
TODO: This should get a dedicated test
|
||||
Gets order book list, returns dataframe with below format per suggested by creslin
|
||||
-------------------------------------------------------------------
|
||||
b_sum b_size bids asks a_size a_sum
|
||||
|
||||
@@ -23,7 +23,7 @@ from freqtrade.data.history import get_datahandler, load_pair_history
|
||||
from freqtrade.enums import CandleType, RPCMessageType, RunMode, TradingMode
|
||||
from freqtrade.exceptions import ExchangeError, OperationalException
|
||||
from freqtrade.exchange import Exchange, timeframe_to_prev_date, timeframe_to_seconds
|
||||
from freqtrade.exchange.exchange_types import OrderBook
|
||||
from freqtrade.exchange.exchange_types import FundingRate, OrderBook
|
||||
from freqtrade.misc import append_candles_to_dataframe
|
||||
from freqtrade.rpc import RPCManager
|
||||
from freqtrade.rpc.rpc_types import RPCAnalyzedDFMsg
|
||||
@@ -498,7 +498,12 @@ class DataProvider:
|
||||
return DataFrame()
|
||||
|
||||
def trades(
|
||||
self, pair: str, timeframe: str | None = None, copy: bool = True, candle_type: str = ""
|
||||
self,
|
||||
pair: str,
|
||||
timeframe: str | None = None,
|
||||
copy: bool = True,
|
||||
candle_type: str = "",
|
||||
timerange: TimeRange | None = None,
|
||||
) -> DataFrame:
|
||||
"""
|
||||
Get candle (TRADES) data for the given pair as DataFrame
|
||||
@@ -526,7 +531,7 @@ class DataProvider:
|
||||
self._config["datadir"], data_format=self._config["dataformat_trades"]
|
||||
)
|
||||
trades_df = data_handler.trades_load(
|
||||
pair, self._config.get("trading_mode", TradingMode.SPOT)
|
||||
pair, self._config.get("trading_mode", TradingMode.SPOT), timerange=timerange
|
||||
)
|
||||
return trades_df
|
||||
|
||||
@@ -543,6 +548,7 @@ class DataProvider:
|
||||
def ticker(self, pair: str):
|
||||
"""
|
||||
Return last ticker data from exchange
|
||||
Warning: Performs a network request - so use with common sense.
|
||||
:param pair: Pair to get the data for
|
||||
:return: Ticker dict from exchange or empty dict if ticker is not available for the pair
|
||||
"""
|
||||
@@ -556,7 +562,7 @@ class DataProvider:
|
||||
def orderbook(self, pair: str, maximum: int) -> OrderBook:
|
||||
"""
|
||||
Fetch latest l2 orderbook data
|
||||
Warning: Does a network request - so use with common sense.
|
||||
Warning: Performs a network request - so use with common sense.
|
||||
: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.
|
||||
@@ -565,6 +571,23 @@ class DataProvider:
|
||||
raise OperationalException(NO_EXCHANGE_EXCEPTION)
|
||||
return self._exchange.fetch_l2_order_book(pair, maximum)
|
||||
|
||||
def funding_rate(self, pair: str) -> FundingRate:
|
||||
"""
|
||||
Return Funding rate from the exchange
|
||||
Warning: Performs a network request - so use with common sense.
|
||||
:param pair: Pair to get the data for
|
||||
:return: Funding rate dict from exchange or empty dict if funding rate is not available
|
||||
If available, the "fundingRate" field will contain the funding rate.
|
||||
"fundingTimestamp" and "fundingDatetime" will contain the next funding times.
|
||||
Actually filled fields may vary between exchanges.
|
||||
"""
|
||||
if self._exchange is None:
|
||||
raise OperationalException(NO_EXCHANGE_EXCEPTION)
|
||||
try:
|
||||
return self._exchange.fetch_funding_rate(pair)
|
||||
except ExchangeError:
|
||||
return {}
|
||||
|
||||
def send_msg(self, message: str, *, always_send: bool = False) -> None:
|
||||
"""
|
||||
Send custom RPC Notifications from your bot.
|
||||
@@ -581,3 +604,19 @@ class DataProvider:
|
||||
if always_send or message not in self.__msg_cache:
|
||||
self._msg_queue.append(message)
|
||||
self.__msg_cache[message] = True
|
||||
|
||||
def check_delisting(self, pair: str) -> datetime | None:
|
||||
"""
|
||||
Check if a pair gonna be delisted on the exchange.
|
||||
Will only return datetime if the pair is gonna be delisted.
|
||||
:param pair: Pair to check
|
||||
:return: Datetime of the pair's delisting, None otherwise
|
||||
"""
|
||||
if self._exchange is None:
|
||||
raise OperationalException(NO_EXCHANGE_EXCEPTION)
|
||||
|
||||
try:
|
||||
return self._exchange.check_delisting_time(pair)
|
||||
except ExchangeError:
|
||||
logger.warning(f"Could not fetch market data for {pair}. Assuming no delisting.")
|
||||
return None
|
||||
|
||||
@@ -7,11 +7,9 @@ from freqtrade.configuration import TimeRange
|
||||
from freqtrade.constants import Config
|
||||
from freqtrade.data.btanalysis import (
|
||||
BT_DATA_COLUMNS,
|
||||
load_backtest_analysis_data,
|
||||
load_backtest_data,
|
||||
load_backtest_stats,
|
||||
load_exit_signal_candles,
|
||||
load_rejected_signals,
|
||||
load_signal_candles,
|
||||
)
|
||||
from freqtrade.exceptions import ConfigurationError, OperationalException
|
||||
from freqtrade.util import print_df_rich_table
|
||||
@@ -332,7 +330,7 @@ def process_entry_exit_reasons(config: Config):
|
||||
do_rejected = config.get("analysis_rejected", False)
|
||||
to_csv = config.get("analysis_to_csv", False)
|
||||
csv_path = Path(
|
||||
config.get("analysis_csv_path", config["exportfilename"]), # type: ignore[arg-type]
|
||||
config.get("analysis_csv_path", config["exportdirectory"]), # type: ignore[arg-type]
|
||||
)
|
||||
|
||||
if entry_only is True and exit_only is True:
|
||||
@@ -346,20 +344,30 @@ def process_entry_exit_reasons(config: Config):
|
||||
None if config.get("timerange") is None else str(config.get("timerange"))
|
||||
)
|
||||
try:
|
||||
backtest_stats = load_backtest_stats(config["exportfilename"])
|
||||
backtest_stats = load_backtest_stats(
|
||||
config["exportdirectory"], config["exportfilename"]
|
||||
)
|
||||
except ValueError as e:
|
||||
raise ConfigurationError(e) from e
|
||||
|
||||
for strategy_name, results in backtest_stats["strategy"].items():
|
||||
trades = load_backtest_data(config["exportfilename"], strategy_name)
|
||||
trades = load_backtest_data(
|
||||
config["exportdirectory"], strategy_name, config["exportfilename"]
|
||||
)
|
||||
|
||||
if trades is not None and not trades.empty:
|
||||
signal_candles = load_signal_candles(config["exportfilename"])
|
||||
exit_signals = load_exit_signal_candles(config["exportfilename"])
|
||||
signal_candles = load_backtest_analysis_data(
|
||||
config["exportdirectory"], "signals", config["exportfilename"]
|
||||
)
|
||||
exit_signals = load_backtest_analysis_data(
|
||||
config["exportdirectory"], "exited", config["exportfilename"]
|
||||
)
|
||||
|
||||
rej_df = None
|
||||
if do_rejected:
|
||||
rejected_signals_dict = load_rejected_signals(config["exportfilename"])
|
||||
rejected_signals_dict = load_backtest_analysis_data(
|
||||
config["exportdirectory"], "rejected", config["exportfilename"]
|
||||
)
|
||||
rej_df = prepare_results(
|
||||
rejected_signals_dict,
|
||||
strategy_name,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import logging
|
||||
|
||||
from pandas import DataFrame, read_feather, to_datetime
|
||||
from pyarrow import dataset
|
||||
|
||||
from freqtrade.configuration import TimeRange
|
||||
from freqtrade.constants import DEFAULT_DATAFRAME_COLUMNS, DEFAULT_TRADES_COLUMNS
|
||||
@@ -111,22 +112,71 @@ class FeatherDataHandler(IDataHandler):
|
||||
"""
|
||||
raise NotImplementedError()
|
||||
|
||||
def _build_arrow_time_filter(self, timerange: TimeRange | None):
|
||||
"""
|
||||
Build Arrow predicate filter for timerange filtering.
|
||||
Treats 0 as unbounded (no filter on that side).
|
||||
:param timerange: TimeRange object with start/stop timestamps
|
||||
:return: Arrow filter expression or None if fully unbounded
|
||||
"""
|
||||
if not timerange:
|
||||
return None
|
||||
|
||||
# Treat 0 as unbounded
|
||||
start_set = bool(timerange.startts and timerange.startts > 0)
|
||||
stop_set = bool(timerange.stopts and timerange.stopts > 0)
|
||||
|
||||
if not (start_set or stop_set):
|
||||
return None
|
||||
|
||||
ts_field = dataset.field("timestamp")
|
||||
exprs = []
|
||||
|
||||
if start_set:
|
||||
exprs.append(ts_field >= timerange.startts)
|
||||
if stop_set:
|
||||
exprs.append(ts_field <= timerange.stopts)
|
||||
|
||||
if len(exprs) == 1:
|
||||
return exprs[0]
|
||||
else:
|
||||
return exprs[0] & exprs[1]
|
||||
|
||||
def _trades_load(
|
||||
self, pair: str, trading_mode: TradingMode, timerange: TimeRange | None = None
|
||||
) -> DataFrame:
|
||||
"""
|
||||
Load a pair from file, either .json.gz or .json
|
||||
# TODO: respect timerange ...
|
||||
:param pair: Load trades for this pair
|
||||
:param trading_mode: Trading mode to use (used to determine the filename)
|
||||
:param timerange: Timerange to load trades for - currently not implemented
|
||||
:param timerange: Timerange to load trades for - filters data to this range if provided
|
||||
:return: Dataframe containing trades
|
||||
"""
|
||||
filename = self._pair_trades_filename(self._datadir, pair, trading_mode)
|
||||
if not filename.exists():
|
||||
return DataFrame(columns=DEFAULT_TRADES_COLUMNS)
|
||||
|
||||
tradesdata = read_feather(filename)
|
||||
# Use Arrow dataset with optional timerange filtering, fallback to read_feather
|
||||
try:
|
||||
dataset_reader = dataset.dataset(filename, format="feather")
|
||||
time_filter = self._build_arrow_time_filter(timerange)
|
||||
|
||||
if time_filter is not None and timerange is not None:
|
||||
tradesdata = dataset_reader.to_table(filter=time_filter).to_pandas()
|
||||
start_desc = timerange.startts if timerange.startts > 0 else "unbounded"
|
||||
stop_desc = timerange.stopts if timerange.stopts > 0 else "unbounded"
|
||||
logger.debug(
|
||||
f"Loaded {len(tradesdata)} trades for {pair} "
|
||||
f"(filtered start={start_desc}, stop={stop_desc})"
|
||||
)
|
||||
else:
|
||||
tradesdata = dataset_reader.to_table().to_pandas()
|
||||
logger.debug(f"Loaded {len(tradesdata)} trades for {pair} (unfiltered)")
|
||||
|
||||
except (ImportError, AttributeError, ValueError) as e:
|
||||
# Fallback: load entire file
|
||||
logger.warning(f"Unable to use Arrow filtering, loading entire trades file: {e}")
|
||||
tradesdata = read_feather(filename)
|
||||
|
||||
return tradesdata
|
||||
|
||||
|
||||
@@ -6,7 +6,14 @@ from pathlib import Path
|
||||
from pandas import DataFrame, concat
|
||||
|
||||
from freqtrade.configuration import TimeRange
|
||||
from freqtrade.constants import DATETIME_PRINT_FORMAT, DL_DATA_TIMEFRAMES, DOCS_LINK, Config
|
||||
from freqtrade.constants import (
|
||||
DATETIME_PRINT_FORMAT,
|
||||
DL_DATA_TIMEFRAMES,
|
||||
DOCS_LINK,
|
||||
Config,
|
||||
ListPairsWithTimeframes,
|
||||
PairWithTimeframe,
|
||||
)
|
||||
from freqtrade.data.converter import (
|
||||
clean_ohlcv_dataframe,
|
||||
convert_trades_to_ohlcv,
|
||||
@@ -17,6 +24,7 @@ from freqtrade.data.history.datahandlers import IDataHandler, get_datahandler
|
||||
from freqtrade.enums import CandleType, TradingMode
|
||||
from freqtrade.exceptions import OperationalException
|
||||
from freqtrade.exchange import Exchange
|
||||
from freqtrade.exchange.exchange_utils import date_minus_candles
|
||||
from freqtrade.plugins.pairlist.pairlist_helpers import dynamic_expand_pairlist
|
||||
from freqtrade.util import dt_now, dt_ts, format_ms_time, format_ms_time_det
|
||||
from freqtrade.util.migrations import migrate_data
|
||||
@@ -97,7 +105,7 @@ def load_data(
|
||||
"""
|
||||
result: dict[str, DataFrame] = {}
|
||||
if startup_candles > 0 and timerange:
|
||||
logger.info(f"Using indicator startup period: {startup_candles} ...")
|
||||
logger.debug(f"Using indicator startup period: {startup_candles} ...")
|
||||
|
||||
data_handler = get_datahandler(datadir, data_format)
|
||||
|
||||
@@ -226,6 +234,7 @@ def _download_pair_history(
|
||||
candle_type: CandleType,
|
||||
erase: bool = False,
|
||||
prepend: bool = False,
|
||||
pair_candles: DataFrame | None = None,
|
||||
) -> bool:
|
||||
"""
|
||||
Download latest candles from the exchange for the pair and timeframe passed in parameters
|
||||
@@ -238,6 +247,7 @@ def _download_pair_history(
|
||||
:param timerange: range of time to download
|
||||
:param candle_type: Any of the enum CandleType (must match trading mode!)
|
||||
:param erase: Erase existing data
|
||||
:param pair_candles: Optional with "1 call" pair candles.
|
||||
:return: bool with success state
|
||||
"""
|
||||
data_handler = get_datahandler(datadir, data_handler=data_handler)
|
||||
@@ -271,21 +281,40 @@ def _download_pair_history(
|
||||
"Current End: %s",
|
||||
f"{data.iloc[-1]['date']:{DATETIME_PRINT_FORMAT}}" if not data.empty else "None",
|
||||
)
|
||||
|
||||
# Default since_ms to 30 days if nothing is given
|
||||
new_dataframe = exchange.get_historic_ohlcv(
|
||||
pair=pair,
|
||||
timeframe=timeframe,
|
||||
since_ms=(
|
||||
since_ms
|
||||
if since_ms
|
||||
else int((datetime.now() - timedelta(days=new_pairs_days)).timestamp()) * 1000
|
||||
),
|
||||
is_new_pair=data.empty,
|
||||
candle_type=candle_type,
|
||||
until_ms=until_ms if until_ms else None,
|
||||
# used to check if the passed in pair_candles (parallel downloaded) covers since_ms.
|
||||
# If we need more data, we have to fall back to the standard method.
|
||||
pair_candles_since_ms = (
|
||||
dt_ts(pair_candles.iloc[0]["date"])
|
||||
if pair_candles is not None and len(pair_candles.index) > 0
|
||||
else 0
|
||||
)
|
||||
logger.info(f"Downloaded data for {pair} with length {len(new_dataframe)}.")
|
||||
if (
|
||||
pair_candles is None
|
||||
or len(pair_candles.index) == 0
|
||||
or data.empty
|
||||
or prepend is True
|
||||
or erase is True
|
||||
or pair_candles_since_ms > (since_ms if since_ms else 0)
|
||||
):
|
||||
new_dataframe = exchange.get_historic_ohlcv(
|
||||
pair=pair,
|
||||
timeframe=timeframe,
|
||||
since_ms=(
|
||||
since_ms
|
||||
if since_ms
|
||||
else int((datetime.now() - timedelta(days=new_pairs_days)).timestamp()) * 1000
|
||||
),
|
||||
is_new_pair=data.empty,
|
||||
candle_type=candle_type,
|
||||
until_ms=until_ms if until_ms else None,
|
||||
)
|
||||
logger.info(f"Downloaded data for {pair} with length {len(new_dataframe)}.")
|
||||
else:
|
||||
new_dataframe = pair_candles
|
||||
logger.info(
|
||||
f"Downloaded data for {pair} with length {len(new_dataframe)}. Parallel Method."
|
||||
)
|
||||
|
||||
if data.empty:
|
||||
data = new_dataframe
|
||||
else:
|
||||
@@ -330,6 +359,7 @@ def refresh_backtest_ohlcv_data(
|
||||
data_format: str | None = None,
|
||||
prepend: bool = False,
|
||||
progress_tracker: CustomProgress | None = None,
|
||||
no_parallel_download: bool = False,
|
||||
) -> list[str]:
|
||||
"""
|
||||
Refresh stored ohlcv data for backtesting and hyperopt operations.
|
||||
@@ -339,6 +369,7 @@ def refresh_backtest_ohlcv_data(
|
||||
progress_tracker = retrieve_progress_tracker(progress_tracker)
|
||||
|
||||
pairs_not_available = []
|
||||
fast_candles: dict[PairWithTimeframe, DataFrame] = {}
|
||||
data_handler = get_datahandler(datadir, data_format)
|
||||
candle_type = CandleType.get_default(trading_mode)
|
||||
with progress_tracker as progress:
|
||||
@@ -355,6 +386,30 @@ def refresh_backtest_ohlcv_data(
|
||||
logger.info(f"Skipping pair {pair}...")
|
||||
continue
|
||||
for timeframe in timeframes:
|
||||
# Get fast candles via parallel method on first loop through per timeframe
|
||||
# and candle type. Downloads all the pairs in the list and stores them.
|
||||
if (
|
||||
not no_parallel_download
|
||||
and exchange.get_option("download_data_parallel_quick", True)
|
||||
and (
|
||||
((pair, timeframe, candle_type) not in fast_candles)
|
||||
and (erase is False)
|
||||
and (prepend is False)
|
||||
)
|
||||
):
|
||||
fast_candles.update(
|
||||
_download_all_pairs_history_parallel(
|
||||
exchange=exchange,
|
||||
pairs=pairs,
|
||||
timeframe=timeframe,
|
||||
candle_type=candle_type,
|
||||
timerange=timerange,
|
||||
)
|
||||
)
|
||||
|
||||
# get the already downloaded pair candles if they exist
|
||||
pair_candles = fast_candles.pop((pair, timeframe, candle_type), None)
|
||||
|
||||
progress.update(timeframe_task, description=f"Timeframe {timeframe}")
|
||||
logger.debug(f"Downloading pair {pair}, {candle_type}, interval {timeframe}.")
|
||||
_download_pair_history(
|
||||
@@ -368,6 +423,7 @@ def refresh_backtest_ohlcv_data(
|
||||
candle_type=candle_type,
|
||||
erase=erase,
|
||||
prepend=prepend,
|
||||
pair_candles=pair_candles, # optional pass of dataframe of parallel candles
|
||||
)
|
||||
progress.update(timeframe_task, advance=1)
|
||||
if trading_mode == "futures":
|
||||
@@ -404,6 +460,41 @@ def refresh_backtest_ohlcv_data(
|
||||
return pairs_not_available
|
||||
|
||||
|
||||
def _download_all_pairs_history_parallel(
|
||||
exchange: Exchange,
|
||||
pairs: list[str],
|
||||
timeframe: str,
|
||||
candle_type: CandleType,
|
||||
timerange: TimeRange | None = None,
|
||||
) -> dict[PairWithTimeframe, DataFrame]:
|
||||
"""
|
||||
Allows to use the faster parallel async download method for many coins
|
||||
but only if the data is short enough to be retrieved in one call.
|
||||
Used by freqtrade download-data subcommand.
|
||||
:return: Candle pairs with timeframes
|
||||
"""
|
||||
candles: dict[PairWithTimeframe, DataFrame] = {}
|
||||
since = 0
|
||||
if timerange:
|
||||
if timerange.starttype == "date":
|
||||
since = timerange.startts * 1000
|
||||
|
||||
candle_limit = exchange.ohlcv_candle_limit(timeframe, candle_type)
|
||||
one_call_min_time_dt = dt_ts(date_minus_candles(timeframe, candle_limit))
|
||||
# check if we can get all candles in one go, if so then we can download them in parallel
|
||||
if since > one_call_min_time_dt:
|
||||
logger.info(
|
||||
f"Downloading parallel candles for {timeframe} for all pairs "
|
||||
f"since {format_ms_time(since)}"
|
||||
)
|
||||
needed_pairs: ListPairsWithTimeframes = [
|
||||
(p, timeframe, candle_type) for p in [p for p in pairs]
|
||||
]
|
||||
candles = exchange.refresh_latest_ohlcv(needed_pairs, since_ms=since, cache=False)
|
||||
|
||||
return candles
|
||||
|
||||
|
||||
def _download_trades_history(
|
||||
exchange: Exchange,
|
||||
pair: str,
|
||||
@@ -702,6 +793,7 @@ def download_data(
|
||||
trading_mode=config.get("trading_mode", "spot"),
|
||||
prepend=config.get("prepend_data", False),
|
||||
progress_tracker=progress_tracker,
|
||||
no_parallel_download=config.get("no_parallel_download", False),
|
||||
)
|
||||
finally:
|
||||
if pairs_not_available:
|
||||
|
||||
@@ -6,6 +6,7 @@ from freqtrade.exchange.exchange import Exchange
|
||||
# isort: on
|
||||
from freqtrade.exchange.binance import Binance
|
||||
from freqtrade.exchange.bingx import Bingx
|
||||
from freqtrade.exchange.bitget import Bitget
|
||||
from freqtrade.exchange.bitmart import Bitmart
|
||||
from freqtrade.exchange.bitpanda import Bitpanda
|
||||
from freqtrade.exchange.bitvavo import Bitvavo
|
||||
@@ -45,4 +46,4 @@ from freqtrade.exchange.kucoin import Kucoin
|
||||
from freqtrade.exchange.lbank import Lbank
|
||||
from freqtrade.exchange.luno import Luno
|
||||
from freqtrade.exchange.modetrade import Modetrade
|
||||
from freqtrade.exchange.okx import Okx
|
||||
from freqtrade.exchange.okx import MyOkx, Okx
|
||||
|
||||
@@ -5,10 +5,11 @@ from datetime import UTC, datetime
|
||||
from pathlib import Path
|
||||
|
||||
import ccxt
|
||||
from cachetools import TTLCache
|
||||
from pandas import DataFrame
|
||||
|
||||
from freqtrade.constants import DEFAULT_DATAFRAME_COLUMNS
|
||||
from freqtrade.enums import CandleType, MarginMode, PriceType, TradingMode
|
||||
from freqtrade.enums import TRADE_MODES, CandleType, MarginMode, PriceType, RunMode, TradingMode
|
||||
from freqtrade.exceptions import DDosProtection, OperationalException, TemporaryError
|
||||
from freqtrade.exchange import Exchange
|
||||
from freqtrade.exchange.binance_public_data import (
|
||||
@@ -40,12 +41,12 @@ class Binance(Exchange):
|
||||
"fetch_orders_limit_minutes": None,
|
||||
"l2_limit_range": [5, 10, 20, 50, 100, 500, 1000],
|
||||
"ws_enabled": True,
|
||||
"has_delisting": True,
|
||||
}
|
||||
_ft_has_futures: FtHas = {
|
||||
"funding_fee_candle_limit": 1000,
|
||||
"stoploss_order_types": {"limit": "stop", "market": "stop_market"},
|
||||
"stoploss_blocks_assets": False, # Stoploss orders do not block assets
|
||||
"order_time_in_force": ["GTC", "FOK", "IOC"],
|
||||
"tickers_have_price": False,
|
||||
"floor_leverage": True,
|
||||
"fetch_orders_limit_minutes": 7 * 1440, # "fetch_orders" is limited to 7 days
|
||||
@@ -69,6 +70,10 @@ class Binance(Exchange):
|
||||
(TradingMode.FUTURES, MarginMode.ISOLATED),
|
||||
]
|
||||
|
||||
def __init__(self, *args, **kwargs) -> None:
|
||||
super().__init__(*args, **kwargs)
|
||||
self._spot_delist_schedule_cache: TTLCache = TTLCache(maxsize=100, ttl=300)
|
||||
|
||||
def get_proxy_coin(self) -> str:
|
||||
"""
|
||||
Get the proxy coin for the given coin
|
||||
@@ -392,7 +397,7 @@ class Binance(Exchange):
|
||||
async def _async_get_trade_history_id(
|
||||
self, pair: str, until: int, since: int, from_id: str | None = None
|
||||
) -> tuple[str, list[list]]:
|
||||
logger.info(f"Fetching trades from Binance, {from_id=}, {since=}, {until=}")
|
||||
logger.info(f"Fetching trades for {pair} from Binance, {from_id=}, {since=}, {until=}")
|
||||
|
||||
if not self._config["exchange"].get("only_from_ccxt", False):
|
||||
if from_id is None or not since:
|
||||
@@ -433,3 +438,105 @@ class Binance(Exchange):
|
||||
return await super()._async_get_trade_history_id(
|
||||
pair, until=until, since=since, from_id=from_id
|
||||
)
|
||||
|
||||
def _check_delisting_futures(self, pair: str) -> datetime | None:
|
||||
delivery_time = self.markets.get(pair, {}).get("info", {}).get("deliveryDate", None)
|
||||
if delivery_time:
|
||||
if isinstance(delivery_time, str) and (delivery_time != ""):
|
||||
delivery_time = int(delivery_time)
|
||||
|
||||
# Binance set a very high delivery time for all perpetuals.
|
||||
# We compare with delivery time of BTC/USDT:USDT which assumed to never be delisted
|
||||
btc_delivery_time = (
|
||||
self.markets.get("BTC/USDT:USDT", {}).get("info", {}).get("deliveryDate", None)
|
||||
)
|
||||
|
||||
if delivery_time == btc_delivery_time:
|
||||
return None
|
||||
|
||||
delivery_time = dt_from_ts(delivery_time)
|
||||
|
||||
return delivery_time
|
||||
|
||||
def check_delisting_time(self, pair: str) -> datetime | None:
|
||||
"""
|
||||
Check if the pair gonna be delisted.
|
||||
By default, it returns None.
|
||||
:param pair: Market symbol
|
||||
:return: Datetime if the pair gonna be delisted, None otherwise
|
||||
"""
|
||||
if self._config["runmode"] not in TRADE_MODES:
|
||||
return None
|
||||
|
||||
if self.trading_mode == TradingMode.FUTURES:
|
||||
return self._check_delisting_futures(pair)
|
||||
return self._get_spot_pair_delist_time(pair, refresh=False)
|
||||
|
||||
def _get_spot_delist_schedule(self):
|
||||
"""
|
||||
Get the delisting schedule for spot pairs
|
||||
Only works in live mode as it requires API keys,
|
||||
Return sample:
|
||||
[{
|
||||
"delistTime": "1759114800000",
|
||||
"symbols": [
|
||||
"OMNIBTC",
|
||||
"OMNIFDUSD",
|
||||
"OMNITRY",
|
||||
"OMNIUSDC",
|
||||
"OMNIUSDT"
|
||||
]
|
||||
}]
|
||||
"""
|
||||
try:
|
||||
delist_schedule = self._api.sapi_get_spot_delist_schedule()
|
||||
return delist_schedule
|
||||
except ccxt.DDoSProtection as e:
|
||||
raise DDosProtection(e) from e
|
||||
except (ccxt.NetworkError, ccxt.OperationFailed, ccxt.ExchangeError) as e:
|
||||
raise TemporaryError(
|
||||
f"Could not get delist schedule {e.__class__.__name__}. Message: {e}"
|
||||
) from e
|
||||
except ccxt.BaseError as e:
|
||||
raise OperationalException(e) from e
|
||||
|
||||
def _get_spot_pair_delist_time(self, pair: str, refresh: bool = False) -> datetime | None:
|
||||
"""
|
||||
Get the delisting time for a pair if it will be delisted
|
||||
:param pair: Pair to get the delisting time for
|
||||
:param refresh: true if you need fresh data
|
||||
:return: int: delisting time None if not delisting
|
||||
"""
|
||||
|
||||
if not pair or not self._config["runmode"] == RunMode.LIVE:
|
||||
# Endpoint only works in live mode as it requires API keys
|
||||
return None
|
||||
|
||||
cache = self._spot_delist_schedule_cache
|
||||
|
||||
if not refresh:
|
||||
if delist_time := cache.get(pair, None):
|
||||
return delist_time
|
||||
|
||||
delist_schedule = self._get_spot_delist_schedule()
|
||||
|
||||
if delist_schedule is None:
|
||||
return None
|
||||
|
||||
for schedule in delist_schedule:
|
||||
delist_dt = dt_from_ts(int(schedule["delistTime"]))
|
||||
for symbol in schedule["symbols"]:
|
||||
ft_symbol = next(
|
||||
(
|
||||
pair
|
||||
for pair, market in self.markets.items()
|
||||
if market.get("id", None) == symbol
|
||||
),
|
||||
None,
|
||||
)
|
||||
if ft_symbol is None:
|
||||
continue
|
||||
|
||||
cache[ft_symbol] = delist_dt
|
||||
|
||||
return cache.get(pair, None)
|
||||
|
||||
+13654
-8088
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,128 @@
|
||||
import logging
|
||||
from datetime import timedelta
|
||||
|
||||
import ccxt
|
||||
|
||||
from freqtrade.enums import CandleType
|
||||
from freqtrade.exceptions import (
|
||||
DDosProtection,
|
||||
OperationalException,
|
||||
RetryableOrderError,
|
||||
TemporaryError,
|
||||
)
|
||||
from freqtrade.exchange import Exchange
|
||||
from freqtrade.exchange.common import API_RETRY_COUNT, retrier
|
||||
from freqtrade.exchange.exchange_types import CcxtOrder, FtHas
|
||||
from freqtrade.util.datetime_helpers import dt_now, dt_ts
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Bitget(Exchange):
|
||||
"""
|
||||
Bitget 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.
|
||||
"""
|
||||
|
||||
_ft_has: FtHas = {
|
||||
"stoploss_on_exchange": True,
|
||||
"stop_price_param": "stopPrice",
|
||||
"stop_price_prop": "stopPrice",
|
||||
"stoploss_order_types": {"limit": "limit", "market": "market"},
|
||||
"ohlcv_candle_limit": 200, # 200 for historical candles, 1000 for recent ones.
|
||||
"order_time_in_force": ["GTC", "FOK", "IOC", "PO"],
|
||||
}
|
||||
_ft_has_futures: FtHas = {
|
||||
"mark_ohlcv_timeframe": "4h",
|
||||
}
|
||||
|
||||
def ohlcv_candle_limit(
|
||||
self, timeframe: str, candle_type: CandleType, since_ms: int | None = None
|
||||
) -> int:
|
||||
"""
|
||||
Exchange ohlcv candle limit
|
||||
bitget has the following behaviour:
|
||||
* 1000 candles for up-to-date data
|
||||
* 200 candles for historic data (prior to a certain date)
|
||||
:param timeframe: Timeframe to check
|
||||
:param candle_type: Candle-type
|
||||
:param since_ms: Starting timestamp
|
||||
:return: Candle limit as integer
|
||||
"""
|
||||
timeframe_map = self._api.options["fetchOHLCV"]["maxRecentDaysPerTimeframe"]
|
||||
days = timeframe_map.get(timeframe, 30)
|
||||
|
||||
if candle_type in (CandleType.FUTURES, CandleType.SPOT, CandleType.MARK) and (
|
||||
not since_ms or dt_ts(dt_now() - timedelta(days=days)) < since_ms
|
||||
):
|
||||
return 1000
|
||||
|
||||
return super().ohlcv_candle_limit(timeframe, candle_type, since_ms)
|
||||
|
||||
def _convert_stop_order(self, pair: str, order_id: str, order: CcxtOrder) -> CcxtOrder:
|
||||
if order.get("status", "open") == "closed":
|
||||
# Use orderID as cliendOrderId filter to fetch the regular followup order.
|
||||
# Could be done with "fetch_order" - but clientOid as filter doesn't seem to work
|
||||
# https://www.bitget.com/api-doc/spot/trade/Get-Order-Info
|
||||
|
||||
for method in (
|
||||
self._api.fetch_canceled_and_closed_orders,
|
||||
self._api.fetch_open_orders,
|
||||
):
|
||||
orders = method(pair)
|
||||
orders_f = [order for order in orders if order["clientOrderId"] == order_id]
|
||||
if orders_f:
|
||||
order_reg = orders_f[0]
|
||||
self._log_exchange_response("fetch_stoploss_order1", order_reg)
|
||||
order_reg["id_stop"] = order_reg["id"]
|
||||
order_reg["id"] = order_id
|
||||
order_reg["type"] = "stoploss"
|
||||
order_reg["status_stop"] = "triggered"
|
||||
return order_reg
|
||||
order = self._order_contracts_to_amount(order)
|
||||
order["type"] = "stoploss"
|
||||
return order
|
||||
|
||||
def _fetch_stop_order_fallback(self, order_id: str, pair: str) -> CcxtOrder:
|
||||
params2 = {
|
||||
"stop": True,
|
||||
}
|
||||
for method in (
|
||||
self._api.fetch_open_orders,
|
||||
self._api.fetch_canceled_and_closed_orders,
|
||||
):
|
||||
try:
|
||||
orders = method(pair, params=params2)
|
||||
orders_f = [order for order in orders if order["id"] == order_id]
|
||||
if orders_f:
|
||||
order = orders_f[0]
|
||||
self._log_exchange_response("get_stop_order_fallback", order)
|
||||
return self._convert_stop_order(pair, order_id, order)
|
||||
except (ccxt.OrderNotFound, ccxt.InvalidOrder):
|
||||
pass
|
||||
except ccxt.DDoSProtection as e:
|
||||
raise DDosProtection(e) from e
|
||||
except (ccxt.OperationFailed, ccxt.ExchangeError) as e:
|
||||
raise TemporaryError(
|
||||
f"Could not get order due to {e.__class__.__name__}. Message: {e}"
|
||||
) from e
|
||||
except ccxt.BaseError as e:
|
||||
raise OperationalException(e) from e
|
||||
raise RetryableOrderError(f"StoplossOrder not found (pair: {pair} id: {order_id}).")
|
||||
|
||||
@retrier(retries=API_RETRY_COUNT)
|
||||
def fetch_stoploss_order(
|
||||
self, order_id: str, pair: str, params: dict | None = None
|
||||
) -> CcxtOrder:
|
||||
if self._config["dry_run"]:
|
||||
return self.fetch_dry_run_order(order_id)
|
||||
|
||||
return self._fetch_stop_order_fallback(order_id, pair)
|
||||
|
||||
def cancel_stoploss_order(self, order_id: str, pair: str, params: dict | None = None) -> dict:
|
||||
return self.cancel_order(order_id=order_id, pair=pair, params={"stop": True})
|
||||
@@ -2,8 +2,6 @@
|
||||
|
||||
import logging
|
||||
|
||||
from ccxt import DECIMAL_PLACES
|
||||
|
||||
from freqtrade.exchange import Exchange
|
||||
from freqtrade.exchange.exchange_types import FtHas
|
||||
|
||||
@@ -24,11 +22,3 @@ class Bitvavo(Exchange):
|
||||
_ft_has: FtHas = {
|
||||
"ohlcv_candle_limit": 1440,
|
||||
}
|
||||
|
||||
@property
|
||||
def precisionMode(self) -> int:
|
||||
"""
|
||||
Exchange ccxt precisionMode
|
||||
Override due to https://github.com/ccxt/ccxt/issues/20408
|
||||
"""
|
||||
return DECIMAL_PLACES
|
||||
|
||||
@@ -46,10 +46,9 @@ BAD_EXCHANGES = {
|
||||
|
||||
MAP_EXCHANGE_CHILDCLASS = {
|
||||
"binanceus": "binance",
|
||||
"binanceje": "binance",
|
||||
"binanceusdm": "binance",
|
||||
"okex": "okx",
|
||||
"myokx": "okx",
|
||||
"okxus": "okx",
|
||||
"gateio": "gate",
|
||||
"huboi": "htx",
|
||||
}
|
||||
@@ -64,6 +63,7 @@ SUPPORTED_EXCHANGES = [
|
||||
"hyperliquid",
|
||||
"kraken",
|
||||
"okx",
|
||||
"myokx",
|
||||
]
|
||||
|
||||
# either the main, or replacement methods (array) is required
|
||||
|
||||
@@ -73,6 +73,7 @@ from freqtrade.exchange.exchange_types import (
|
||||
CcxtOrder,
|
||||
CcxtPosition,
|
||||
FtHas,
|
||||
FundingRate,
|
||||
OHLCVResponse,
|
||||
OrderBook,
|
||||
Ticker,
|
||||
@@ -137,6 +138,7 @@ class Exchange:
|
||||
"ohlcv_has_history": True, # Some exchanges (Kraken) don't provide history via ohlcv
|
||||
"ohlcv_partial_candle": True,
|
||||
"ohlcv_require_since": False,
|
||||
"download_data_parallel_quick": True,
|
||||
"always_require_api_keys": False, # purge API keys for Dry-run. Must default to false.
|
||||
# Check https://github.com/ccxt/ccxt/issues/10767 for removal of ohlcv_volume_currency
|
||||
"ohlcv_volume_currency": "base", # "base" or "quote"
|
||||
@@ -164,6 +166,7 @@ class Exchange:
|
||||
"proxy_coin_mapping": {}, # Mapping for proxy coins
|
||||
# Expected to be in the format {"fetchOHLCV": True} or {"fetchOHLCV": False}
|
||||
"ws_enabled": False, # Set to true for exchanges with tested websocket support
|
||||
"has_delisting": False, # Set to true for exchanges that have delisting pair checks
|
||||
}
|
||||
_ft_has: FtHas = {}
|
||||
_ft_has_futures: FtHas = {}
|
||||
@@ -690,12 +693,13 @@ class Exchange:
|
||||
# Reload async markets, then assign them to sync api
|
||||
retrier(self._load_async_markets, retries=retries)(reload=True)
|
||||
self._markets = self._api_async.markets
|
||||
self._api.set_markets(self._api_async.markets, self._api_async.currencies)
|
||||
self._api.set_markets_from_exchange(self._api_async)
|
||||
# Assign options array, as it contains some temporary information from the exchange.
|
||||
# TODO: investigate with ccxt if it's safe to remove `.options`
|
||||
self._api.options = self._api_async.options
|
||||
if self._exchange_ws:
|
||||
# Set markets to avoid reloading on websocket api
|
||||
self._ws_async.set_markets(self._api.markets, self._api.currencies)
|
||||
self._ws_async.set_markets_from_exchange(self._api_async)
|
||||
self._ws_async.options = self._api.options
|
||||
self._last_markets_refresh = dt_ts()
|
||||
|
||||
@@ -890,6 +894,19 @@ class Exchange:
|
||||
f"Freqtrade does not support '{mm_value}' '{trading_mode}' on {self.name}."
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def combine_ft_has(cls, include_futures: bool) -> FtHas:
|
||||
"""
|
||||
Combine all ft_has options from the class hierarchy.
|
||||
Child classes override parent classes.
|
||||
Doesn't apply overrides from the configuration.
|
||||
"""
|
||||
_ft_has = deep_merge_dicts(cls._ft_has, deepcopy(cls._ft_has_default))
|
||||
|
||||
if include_futures:
|
||||
_ft_has = deep_merge_dicts(cls._ft_has_futures, _ft_has)
|
||||
return _ft_has
|
||||
|
||||
def build_ft_has(self, exchange_conf: ExchangeConfig) -> None:
|
||||
"""
|
||||
Deep merge ft_has with default ft_has options
|
||||
@@ -897,9 +914,8 @@ class Exchange:
|
||||
This is called on initialization of the exchange object.
|
||||
It must be called before ft_has is used.
|
||||
"""
|
||||
self._ft_has = deep_merge_dicts(self._ft_has, deepcopy(self._ft_has_default))
|
||||
if self.trading_mode == TradingMode.FUTURES:
|
||||
self._ft_has = deep_merge_dicts(self._ft_has_futures, self._ft_has)
|
||||
self._ft_has = self.combine_ft_has(include_futures=self.trading_mode == TradingMode.FUTURES)
|
||||
|
||||
if exchange_conf.get("_ft_has_params"):
|
||||
self._ft_has = deep_merge_dicts(exchange_conf.get("_ft_has_params"), self._ft_has)
|
||||
logger.info("Overriding exchange._ft_has with config params, result: %s", self._ft_has)
|
||||
@@ -2001,6 +2017,30 @@ class Exchange:
|
||||
except ccxt.BaseError as e:
|
||||
raise OperationalException(e) from e
|
||||
|
||||
@retrier
|
||||
def fetch_funding_rate(self, pair: str) -> FundingRate:
|
||||
"""
|
||||
Get current Funding rate from exchange.
|
||||
On Futures markets, this is the interest rate for holding a position.
|
||||
Won't work for non-futures markets
|
||||
"""
|
||||
try:
|
||||
if pair not in self.markets or self.markets[pair].get("active", False) is False:
|
||||
raise ExchangeError(f"Pair {pair} not available")
|
||||
return self._api.fetch_funding_rate(pair)
|
||||
except ccxt.NotSupported as e:
|
||||
raise OperationalException(
|
||||
f"Exchange {self._api.name} does not support fetching funding rate. Message: {e}"
|
||||
) from e
|
||||
except ccxt.DDoSProtection as e:
|
||||
raise DDosProtection(e) from e
|
||||
except (ccxt.OperationFailed, ccxt.ExchangeError) as e:
|
||||
raise TemporaryError(
|
||||
f"Could not get funding rate due to {e.__class__.__name__}. Message: {e}"
|
||||
) from e
|
||||
except ccxt.BaseError as e:
|
||||
raise OperationalException(e) from e
|
||||
|
||||
@staticmethod
|
||||
def get_next_limit_in_list(
|
||||
limit: int,
|
||||
@@ -2456,7 +2496,14 @@ class Exchange:
|
||||
data.extend(new_data)
|
||||
# Sort data again after extending the result - above calls return in "async order"
|
||||
data = sorted(data, key=lambda x: x[0])
|
||||
return pair, timeframe, candle_type, data, self._ohlcv_partial_candle
|
||||
return (
|
||||
pair,
|
||||
timeframe,
|
||||
candle_type,
|
||||
data,
|
||||
# funding_rates are always complete, so never need to be dropped.
|
||||
self._ohlcv_partial_candle if candle_type != CandleType.FUNDING_RATE else False,
|
||||
)
|
||||
|
||||
def _try_build_from_websocket(
|
||||
self, pair: str, timeframe: str, candle_type: CandleType
|
||||
@@ -2566,14 +2613,24 @@ class Exchange:
|
||||
input_coroutines: list[Coroutine[Any, Any, OHLCVResponse]] = []
|
||||
cached_pairs = []
|
||||
for pair, timeframe, candle_type in set(pair_list):
|
||||
if timeframe not in self.timeframes and candle_type in (
|
||||
invalid_funding = (
|
||||
candle_type == CandleType.FUNDING_RATE
|
||||
and timeframe != self.get_option("funding_fee_timeframe")
|
||||
)
|
||||
invalid_timeframe = timeframe not in self.timeframes and candle_type in (
|
||||
CandleType.SPOT,
|
||||
CandleType.FUTURES,
|
||||
):
|
||||
)
|
||||
if invalid_timeframe or invalid_funding:
|
||||
timeframes_ = (
|
||||
", ".join(self.timeframes)
|
||||
if candle_type != CandleType.FUNDING_RATE
|
||||
else self.get_option("funding_fee_timeframe")
|
||||
)
|
||||
logger.warning(
|
||||
f"Cannot download ({pair}, {timeframe}) combination as this timeframe is "
|
||||
f"not available on {self.name}. Available timeframes are "
|
||||
f"{', '.join(self.timeframes)}."
|
||||
f"Cannot download ({pair}, {timeframe}, {candle_type}) combination as this "
|
||||
f"timeframe is not available on {self.name}. Available timeframes are "
|
||||
f"{timeframes_}."
|
||||
)
|
||||
continue
|
||||
|
||||
@@ -2756,7 +2813,7 @@ class Exchange:
|
||||
timeframe, candle_type=candle_type, since_ms=since_ms
|
||||
)
|
||||
|
||||
if candle_type and candle_type != CandleType.SPOT:
|
||||
if candle_type and candle_type not in (CandleType.SPOT, CandleType.FUTURES):
|
||||
params.update({"price": candle_type.value})
|
||||
if candle_type != CandleType.FUNDING_RATE:
|
||||
data = await self._api_async.fetch_ohlcv(
|
||||
@@ -2771,8 +2828,6 @@ class Exchange:
|
||||
since_ms=since_ms,
|
||||
)
|
||||
# Some exchanges sort OHLCV in ASC order and others in DESC.
|
||||
# Ex: Bittrex returns the list of OHLCV in ASC order (oldest first, newest last)
|
||||
# while GDAX returns the list of OHLCV in DESC order (newest first, oldest last)
|
||||
# Only sort if necessary to save computing time
|
||||
try:
|
||||
if data and data[0][0] > data[-1][0]:
|
||||
@@ -2781,7 +2836,14 @@ class Exchange:
|
||||
logger.exception("Error loading %s. Result was %s.", pair, data)
|
||||
return pair, timeframe, candle_type, [], self._ohlcv_partial_candle
|
||||
logger.debug("Done fetching pair %s, %s interval %s...", pair, candle_type, timeframe)
|
||||
return pair, timeframe, candle_type, data, self._ohlcv_partial_candle
|
||||
return (
|
||||
pair,
|
||||
timeframe,
|
||||
candle_type,
|
||||
data,
|
||||
# funding_rates are always complete, so never need to be dropped.
|
||||
self._ohlcv_partial_candle if candle_type != CandleType.FUNDING_RATE else False,
|
||||
)
|
||||
|
||||
except ccxt.NotSupported as e:
|
||||
raise OperationalException(
|
||||
@@ -3229,7 +3291,7 @@ class Exchange:
|
||||
for sig in [signal.SIGINT, signal.SIGTERM]:
|
||||
try:
|
||||
self.loop.add_signal_handler(sig, task.cancel)
|
||||
except NotImplementedError:
|
||||
except (NotImplementedError, RuntimeError):
|
||||
# Not all platforms implement signals (e.g. windows)
|
||||
pass
|
||||
return self.loop.run_until_complete(task)
|
||||
@@ -3863,3 +3925,14 @@ class Exchange:
|
||||
# describes the min amt for a tier, and the lowest tier will always go down to 0
|
||||
else:
|
||||
raise ExchangeError(f"Cannot get maintenance ratio using {self.name}")
|
||||
|
||||
def check_delisting_time(self, pair: str) -> datetime | None:
|
||||
"""
|
||||
Check if the pair gonna be delisted.
|
||||
This function should be overridden by the exchange class if the exchange
|
||||
provides such information.
|
||||
By default, it returns None.
|
||||
:param pair: Market symbol
|
||||
:return: Datetime if the pair gonna be delisted, None otherwise
|
||||
"""
|
||||
return None
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
from typing import Any, Literal, TypedDict
|
||||
|
||||
# Re-export for easier use
|
||||
from ccxt.base.types import FundingRate # noqa: F401
|
||||
|
||||
from freqtrade.enums import CandleType
|
||||
|
||||
|
||||
@@ -25,6 +28,8 @@ class FtHas(TypedDict, total=False):
|
||||
ohlcv_volume_currency: str
|
||||
ohlcv_candle_limit_per_timeframe: dict[str, int]
|
||||
always_require_api_keys: bool
|
||||
# allow disabling of parallel download-data for specific exchanges
|
||||
download_data_parallel_quick: bool
|
||||
# Tickers
|
||||
tickers_have_quoteVolume: bool
|
||||
tickers_have_percentage: bool
|
||||
@@ -58,6 +63,9 @@ class FtHas(TypedDict, total=False):
|
||||
# Websocket control
|
||||
ws_enabled: bool
|
||||
|
||||
# Delisting check
|
||||
has_delisting: bool
|
||||
|
||||
|
||||
class Ticker(TypedDict):
|
||||
symbol: str
|
||||
|
||||
@@ -213,9 +213,9 @@ def amount_to_precision(
|
||||
amount = float(
|
||||
decimal_to_precision(
|
||||
amount,
|
||||
rounding_mode=TRUNCATE,
|
||||
precision=precision,
|
||||
counting_mode=precisionMode,
|
||||
TRUNCATE, # rounding_mode
|
||||
precision, # numPrecisionDigits
|
||||
precisionMode, # counting_mode
|
||||
)
|
||||
)
|
||||
|
||||
@@ -311,11 +311,11 @@ def price_to_precision(
|
||||
return float(
|
||||
decimal_to_precision(
|
||||
price,
|
||||
rounding_mode=rounding_mode,
|
||||
precision=int(price_precision)
|
||||
rounding_mode, # rounding mode
|
||||
int(price_precision)
|
||||
if precisionMode != TICK_SIZE
|
||||
else price_precision,
|
||||
counting_mode=precisionMode,
|
||||
else price_precision, # numPrecisionDigits
|
||||
precisionMode, # counting_mode
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ class Hyperliquid(Exchange):
|
||||
"stoploss_on_exchange": False,
|
||||
"exchange_has_overrides": {"fetchTrades": False},
|
||||
"marketOrderRequiresPrice": True,
|
||||
"download_data_parallel_quick": False,
|
||||
"ws_enabled": True,
|
||||
}
|
||||
_ft_has_futures: FtHas = {
|
||||
|
||||
@@ -65,15 +65,22 @@ class Okx(Exchange):
|
||||
"""
|
||||
Exchange ohlcv candle limit
|
||||
OKX has the following behaviour:
|
||||
* 300 candles for up-to-date data
|
||||
* 100 candles for historic data
|
||||
* 100 candles for additional candles (not futures or spot).
|
||||
* spot and futures:
|
||||
* 300 candles for regular candles
|
||||
* mark and premium-index:
|
||||
* 300 candles for up-to-date data
|
||||
* 100 candles for historic data
|
||||
* additional data:
|
||||
* 100 candles for additional candles
|
||||
:param timeframe: Timeframe to check
|
||||
:param candle_type: Candle-type
|
||||
:param since_ms: Starting timestamp
|
||||
:return: Candle limit as integer
|
||||
"""
|
||||
if candle_type in (CandleType.FUTURES, CandleType.SPOT) and (
|
||||
if candle_type in (CandleType.FUTURES, CandleType.SPOT):
|
||||
return 300
|
||||
|
||||
if candle_type in (CandleType.MARK, CandleType.PREMIUMINDEX) and (
|
||||
not since_ms or since_ms > (date_minus_candles(timeframe, 300).timestamp() * 1000)
|
||||
):
|
||||
return 300
|
||||
@@ -287,3 +294,14 @@ class Okx(Exchange):
|
||||
orders_open = self._api.fetch_open_orders(pair, since=since_ms)
|
||||
orders.extend(orders_open)
|
||||
return orders
|
||||
|
||||
|
||||
class MyOkx(Okx):
|
||||
"""
|
||||
MyOkx exchange class.
|
||||
Minimal adjustment to disable futures trading for the EU subsidiary of Okx
|
||||
"""
|
||||
|
||||
_supported_trading_mode_margin_pairs: list[tuple[TradingMode, MarginMode]] = [
|
||||
(TradingMode.SPOT, MarginMode.NONE),
|
||||
]
|
||||
|
||||
@@ -6,6 +6,7 @@ import numpy as np
|
||||
import numpy.typing as npt
|
||||
from pandas import DataFrame
|
||||
|
||||
from freqtrade.exceptions import DependencyException
|
||||
from freqtrade.freqai.data_kitchen import FreqaiDataKitchen
|
||||
from freqtrade.freqai.freqai_interface import IFreqaiModel
|
||||
|
||||
@@ -63,12 +64,19 @@ class BaseRegressionModel(IFreqaiModel):
|
||||
dd["train_labels"], _, _ = dk.label_pipeline.fit_transform(dd["train_labels"])
|
||||
|
||||
if self.freqai_info.get("data_split_parameters", {}).get("test_size", 0.1) != 0:
|
||||
(dd["test_features"], dd["test_labels"], dd["test_weights"]) = (
|
||||
dk.feature_pipeline.transform(
|
||||
dd["test_features"], dd["test_labels"], dd["test_weights"]
|
||||
if dd["test_labels"].shape[0] == 0:
|
||||
raise DependencyException(
|
||||
f"{pair}: test set is empty after filtering. "
|
||||
f"This is usually caused by overly strict SVM thresholds or insufficient data. "
|
||||
f"Try reducing 'test_size' or relaxing your SVM conditions."
|
||||
)
|
||||
)
|
||||
dd["test_labels"], _, _ = dk.label_pipeline.transform(dd["test_labels"])
|
||||
else:
|
||||
(dd["test_features"], dd["test_labels"], dd["test_weights"]) = (
|
||||
dk.feature_pipeline.transform(
|
||||
dd["test_features"], dd["test_labels"], dd["test_weights"]
|
||||
)
|
||||
)
|
||||
dd["test_labels"], _, _ = dk.label_pipeline.transform(dd["test_labels"])
|
||||
|
||||
logger.info(
|
||||
f"Training model on {len(dk.data_dictionary['train_features'].columns)} features"
|
||||
|
||||
@@ -493,7 +493,7 @@ class FreqaiDataDrawer:
|
||||
|
||||
dk.data["data_path"] = str(dk.data_path)
|
||||
dk.data["model_filename"] = str(dk.model_filename)
|
||||
dk.data["training_features_list"] = list(dk.data_dictionary["train_features"].columns)
|
||||
dk.data["training_features_list"] = dk.training_features_list
|
||||
dk.data["label_list"] = dk.label_list
|
||||
|
||||
with (save_path / f"{dk.model_filename}_{METADATA}.json").open("w") as fp:
|
||||
|
||||
@@ -514,12 +514,7 @@ class IFreqaiModel(ABC):
|
||||
current coin/bot loop
|
||||
"""
|
||||
|
||||
if "training_features_list_raw" in dk.data:
|
||||
feature_list = dk.data["training_features_list_raw"]
|
||||
else:
|
||||
feature_list = dk.data["training_features_list"]
|
||||
|
||||
if dk.training_features_list != feature_list:
|
||||
if dk.training_features_list != dk.data["training_features_list"]:
|
||||
raise OperationalException(
|
||||
"Trying to access pretrained model with `identifier` "
|
||||
"but found different features furnished by current strategy. "
|
||||
|
||||
@@ -13,6 +13,7 @@ class AnnotationType(TypedDict, total=False):
|
||||
y_end: float
|
||||
color: str
|
||||
label: str
|
||||
z_level: int
|
||||
|
||||
|
||||
AnnotationTypeTA = TypeAdapter(AnnotationType)
|
||||
|
||||
@@ -13,8 +13,8 @@ from freqtrade.loggers.set_log_levels import (
|
||||
reduce_verbosity_for_bias_tester,
|
||||
restore_verbosity_for_bias_tester,
|
||||
)
|
||||
from freqtrade.optimize.analysis.base_analysis import BaseAnalysis, VarHolder
|
||||
from freqtrade.optimize.backtesting import Backtesting
|
||||
from freqtrade.optimize.base_analysis import BaseAnalysis, VarHolder
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -70,34 +70,29 @@ class LookaheadAnalysis(BaseAnalysis):
|
||||
cut_df: DataFrame = cut_vars.indicators[current_pair]
|
||||
full_df: DataFrame = full_vars.indicators[current_pair]
|
||||
|
||||
# cut longer dataframe to length of the shorter
|
||||
full_df_cut = full_df[(full_df.date == cut_vars.compared_dt)].reset_index(drop=True)
|
||||
cut_df_cut = cut_df[(cut_df.date == cut_vars.compared_dt)].reset_index(drop=True)
|
||||
# trim full_df to the same index and length as cut_df
|
||||
cut_full_df = full_df.loc[cut_df.index]
|
||||
compare_df = cut_full_df.compare(cut_df)
|
||||
|
||||
# check if dataframes are not empty
|
||||
if full_df_cut.shape[0] != 0 and cut_df_cut.shape[0] != 0:
|
||||
# compare dataframes
|
||||
compare_df = full_df_cut.compare(cut_df_cut)
|
||||
if compare_df.shape[0] > 0:
|
||||
for col_name in compare_df:
|
||||
col_idx = compare_df.columns.get_loc(col_name)
|
||||
compare_df_row = compare_df.iloc[0]
|
||||
# compare_df now comprises tuples with [1] having either 'self' or 'other'
|
||||
if "other" in col_name[1]:
|
||||
continue
|
||||
self_value = compare_df_row.iloc[col_idx]
|
||||
other_value = compare_df_row.iloc[col_idx + 1]
|
||||
|
||||
if compare_df.shape[0] > 0:
|
||||
for col_name, values in compare_df.items():
|
||||
col_idx = compare_df.columns.get_loc(col_name)
|
||||
compare_df_row = compare_df.iloc[0]
|
||||
# compare_df now comprises tuples with [1] having either 'self' or 'other'
|
||||
if "other" in col_name[1]:
|
||||
continue
|
||||
self_value = compare_df_row.iloc[col_idx]
|
||||
other_value = compare_df_row.iloc[col_idx + 1]
|
||||
|
||||
# output differences
|
||||
if self_value != other_value:
|
||||
if not self.current_analysis.false_indicators.__contains__(col_name[0]):
|
||||
self.current_analysis.false_indicators.append(col_name[0])
|
||||
logger.info(
|
||||
f"=> found look ahead bias in indicator "
|
||||
f"{col_name[0]}. "
|
||||
f"{str(self_value)} != {str(other_value)}"
|
||||
)
|
||||
# output differences
|
||||
if self_value != other_value:
|
||||
if not self.current_analysis.false_indicators.__contains__(col_name[0]):
|
||||
self.current_analysis.false_indicators.append(col_name[0])
|
||||
logger.info(
|
||||
f"=> found look ahead bias in column "
|
||||
f"{col_name[0]}. "
|
||||
f"{str(self_value)} != {str(other_value)}"
|
||||
)
|
||||
|
||||
def prepare_data(self, varholder: VarHolder, pairs_to_load: list[DataFrame]):
|
||||
if "freqai" in self.local_config and "identifier" in self.local_config["freqai"]:
|
||||
@@ -132,7 +127,13 @@ class LookaheadAnalysis(BaseAnalysis):
|
||||
varholder.data, varholder.timerange = backtesting.load_bt_data()
|
||||
varholder.timeframe = backtesting.timeframe
|
||||
|
||||
varholder.indicators = backtesting.strategy.advise_all_indicators(varholder.data)
|
||||
temp_indicators = backtesting.strategy.advise_all_indicators(varholder.data)
|
||||
filled_indicators = dict()
|
||||
for pair, dataframe in temp_indicators.items():
|
||||
filled_indicators[pair] = backtesting.strategy.ft_advise_signals(
|
||||
dataframe, {"pair": pair}
|
||||
)
|
||||
varholder.indicators = filled_indicators
|
||||
varholder.result = self.get_result(backtesting, varholder.indicators)
|
||||
|
||||
def fill_entry_and_exit_varHolders(self, result_row):
|
||||
@@ -171,23 +172,23 @@ class LookaheadAnalysis(BaseAnalysis):
|
||||
self.fill_entry_and_exit_varHolders(result_row)
|
||||
|
||||
# this will trigger a logger-message
|
||||
buy_or_sell_biased: bool = False
|
||||
entry_or_exit_biased: bool = False
|
||||
|
||||
# register if buy signal is broken
|
||||
if not self.report_signal(
|
||||
self.entry_varHolders[idx].result, "open_date", self.entry_varHolders[idx].compared_dt
|
||||
):
|
||||
self.current_analysis.false_entry_signals += 1
|
||||
buy_or_sell_biased = True
|
||||
entry_or_exit_biased = True
|
||||
|
||||
# register if buy or sell signal is broken
|
||||
if not self.report_signal(
|
||||
self.exit_varHolders[idx].result, "close_date", self.exit_varHolders[idx].compared_dt
|
||||
):
|
||||
self.current_analysis.false_exit_signals += 1
|
||||
buy_or_sell_biased = True
|
||||
entry_or_exit_biased = True
|
||||
|
||||
if buy_or_sell_biased:
|
||||
if entry_or_exit_biased:
|
||||
logger.info(
|
||||
f"found lookahead-bias in trade "
|
||||
f"pair: {result_row['pair']}, "
|
||||
|
||||
@@ -145,9 +145,19 @@ class LookaheadAnalysisSubFunctions:
|
||||
config["enable_protections"] = False
|
||||
logger.info(
|
||||
"Protections were enabled. "
|
||||
"Disabling protections now "
|
||||
"since they could otherwise produce false positives."
|
||||
"Disabling protections now since they can produce false positives."
|
||||
)
|
||||
if not config.get("lookahead_allow_limit_orders", False):
|
||||
logger.info("Forced order_types to market orders.")
|
||||
config["order_types"] = {
|
||||
"entry": "market",
|
||||
"exit": "market",
|
||||
"stoploss": "market",
|
||||
"stoploss_on_exchange": False,
|
||||
}
|
||||
else:
|
||||
logger.info("Using configured order_types, skipping order_types override.")
|
||||
|
||||
if config["targeted_trade_amount"] < config["minimum_trade_amount"]:
|
||||
# this combo doesn't make any sense.
|
||||
raise OperationalException(
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user