Compare commits

...

510 Commits

Author SHA1 Message Date
dependabot[bot] 51f35cbfee chore(deps-dev): bump ruff from 0.15.12 to 0.15.13
Bumps [ruff](https://github.com/astral-sh/ruff) from 0.15.12 to 0.15.13.
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](https://github.com/astral-sh/ruff/compare/0.15.12...0.15.13)

---
updated-dependencies:
- dependency-name: ruff
  dependency-version: 0.15.13
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-25 07:46:19 +00:00
Matthias 2d9b13e65a Merge pull request #13180 from freqtrade/dependabot/pip/develop/mypy-2.1.0
chore(deps-dev): bump mypy from 2.0.0 to 2.1.0
2026-05-25 09:40:04 +02:00
Matthias 7c8aeed806 Merge pull request #13183 from freqtrade/dependabot/pip/develop/numpy-2.4.5
chore(deps): bump numpy from 2.4.4 to 2.4.5
2026-05-25 08:42:59 +02:00
dependabot[bot] bd706557bd chore(deps-dev): bump mypy from 2.0.0 to 2.1.0
Bumps [mypy](https://github.com/python/mypy) from 2.0.0 to 2.1.0.
- [Changelog](https://github.com/python/mypy/blob/master/CHANGELOG.md)
- [Commits](https://github.com/python/mypy/compare/v2.0.0...v2.1.0)

---
updated-dependencies:
- dependency-name: mypy
  dependency-version: 2.1.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-25 06:38:34 +00:00
Matthias d657a9760a Merge pull request #13178 from freqtrade/dependabot/pip/develop/cachetools-7.1.2
chore(deps): bump cachetools from 7.1.1 to 7.1.2
2026-05-25 08:38:06 +02:00
Matthias 0333e7e227 Merge pull request #13184 from freqtrade/dependabot/github_actions/develop/codecov/codecov-action-6.0.1
chore(deps): bump codecov/codecov-action from 6.0.0 to 6.0.1
2026-05-25 08:24:23 +02:00
dependabot[bot] 90945675bc chore(deps): bump numpy from 2.4.4 to 2.4.5
Bumps [numpy](https://github.com/numpy/numpy) from 2.4.4 to 2.4.5.
- [Release notes](https://github.com/numpy/numpy/releases)
- [Changelog](https://github.com/numpy/numpy/blob/main/doc/RELEASE_WALKTHROUGH.rst)
- [Commits](https://github.com/numpy/numpy/compare/v2.4.4...v2.4.5)

---
updated-dependencies:
- dependency-name: numpy
  dependency-version: 2.4.5
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-25 06:22:25 +00:00
Matthias d3713cbf09 fix: typo 2026-05-25 08:21:21 +02:00
Matthias 9003d5e9e0 fix: disable failing okx live test 2026-05-25 08:19:34 +02:00
dependabot[bot] 7b197aa974 chore(deps): bump codecov/codecov-action from 6.0.0 to 6.0.1
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 6.0.0 to 6.0.1.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/57e3a136b779b570ffcdbf80b3bdc90e7fab3de2...e79a6962e0d4c0c17b229090214935d2e33f8354)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-version: 6.0.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-25 03:25:14 +00:00
dependabot[bot] ec65c88797 chore(deps): bump cachetools from 7.1.1 to 7.1.2
Bumps [cachetools](https://github.com/tkem/cachetools) from 7.1.1 to 7.1.2.
- [Changelog](https://github.com/tkem/cachetools/blob/master/CHANGELOG.rst)
- [Commits](https://github.com/tkem/cachetools/compare/v7.1.1...v7.1.2)

---
updated-dependencies:
- dependency-name: cachetools
  dependency-version: 7.1.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-25 03:24:40 +00:00
Matthias ba6627cd13 chore: update schedule for pre-commit update 2026-05-24 08:59:54 +02:00
Matthias 22a6fdab13 Merge pull request #13161 from ducky-duke/fix/historic-balance-bot-managed-bool
fix: /api/v1/historic_balance returns 500 on MySQL/MariaDB backends
2026-05-23 20:58:58 +02:00
Matthias 580e5b945f test: improve test for bot_balance from mariadb 2026-05-23 20:43:13 +02:00
Matthias 83649ab787 chore: revert unnecessary comment 2026-05-23 20:39:57 +02:00
Matthias 8165fd6310 Merge pull request #13166 from stash86/main-stash
add return type of check_delisting docs section
2026-05-22 17:07:52 +02:00
Stefano 6cf46338ef add return type of check_delisting docs section 2026-05-22 16:53:27 +09:00
Matthias 0d84e80eb7 Merge pull request #13163 from freqtrade/update/binance-leverage-tiers
Update Binance Leverage Tiers
2026-05-21 06:30:27 +02:00
Freqtrade Bot 476abf80cc chore: update binance leverage tiers 2026-05-21 03:38:09 +00:00
ducky-duke a03ebc8472 fix: coerce bot_managed to bool in _rpc_get_historic_balance
read_sql may return the wallet_history `bot_managed` Boolean column as an
integer dtype (e.g. MySQL/MariaDB TINYINT). results.loc[results["bot_managed"]]
then does label-based indexing instead of boolean masking, raising a KeyError
on GET /api/v1/historic_balance (HTTP 500). Coerce with .astype(bool).
2026-05-20 17:57:59 +07:00
Matthias 1182c03b73 Merge pull request #13160 from freqtrade/dependabot/pip/pymdown-extensions-10.21.3
chore(deps): bump pymdown-extensions from 10.21.2 to 10.21.3
2026-05-20 06:31:34 +02:00
Matthias 2152fd7325 chore: temporarily decrase cooldown for pymdown 2026-05-20 06:16:15 +02:00
dependabot[bot] c7f84403d8 chore(deps): bump pymdown-extensions from 10.21.2 to 10.21.3
Bumps [pymdown-extensions](https://github.com/facelessuser/pymdown-extensions) from 10.21.2 to 10.21.3.
- [Release notes](https://github.com/facelessuser/pymdown-extensions/releases)
- [Commits](https://github.com/facelessuser/pymdown-extensions/compare/10.21.2...10.21.3)

---
updated-dependencies:
- dependency-name: pymdown-extensions
  dependency-version: 10.21.3
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-19 21:43:30 +00:00
Matthias 6dcea8bac1 Merge pull request #13158 from freqtrade/update/pre-commit-hooks
Update pre-commit hooks
2026-05-19 06:44:17 +02:00
Matthias 217a71b834 chore: temporarily revert the zizmor pre-commit update 2026-05-19 06:31:07 +02:00
Freqtrade Bot cf578a4b76 chore: update pre-commit hooks 2026-05-19 04:17:16 +00:00
Matthias f645d3e21a fix: live pair data must respect end-date 2026-05-18 18:25:14 +02:00
Matthias 9c480b4f4d chore: remove urlilb3 newer exclusion 2026-05-18 18:00:52 +02:00
Matthias 3a714cef14 Merge pull request #13154 from freqtrade/dependabot/pip/develop/ccxt-4.5.54
chore(deps): bump ccxt from 4.5.52 to 4.5.54
2026-05-18 06:57:08 +02:00
Matthias d67b54bcb5 chore(ci): work around powershell install failure
happens on northcentralus region (sometimes) ...
2026-05-18 06:34:13 +02:00
Matthias 9aebce306d Merge pull request #13151 from freqtrade/dependabot/pip/develop/types-83c091f25c
chore(deps-dev): bump the types group with 3 updates
2026-05-18 06:26:57 +02:00
Matthias 8e7aed5013 Merge pull request #13157 from freqtrade/dependabot/pip/develop/pydantic-2.13.4
chore(deps): bump pydantic from 2.13.3 to 2.13.4
2026-05-18 06:21:45 +02:00
dependabot[bot] 4cee997d11 chore(deps): bump ccxt from 4.5.52 to 4.5.54
Bumps [ccxt](https://github.com/ccxt/ccxt) from 4.5.52 to 4.5.54.
- [Release notes](https://github.com/ccxt/ccxt/releases)
- [Commits](https://github.com/ccxt/ccxt/compare/v4.5.52...v4.5.54)

---
updated-dependencies:
- dependency-name: ccxt
  dependency-version: 4.5.54
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-18 04:21:17 +00:00
Matthias 806a11c63a Merge pull request #13156 from freqtrade/dependabot/pip/develop/orjson-3.11.9
chore(deps): bump orjson from 3.11.8 to 3.11.9
2026-05-18 06:19:39 +02:00
Matthias 2e760ae1c5 Merge pull request #13155 from freqtrade/dependabot/pip/develop/mypy-2.0.0
chore(deps-dev): bump mypy from 1.20.2 to 2.0.0
2026-05-18 06:19:20 +02:00
Matthias 674b2c11bd Merge pull request #13153 from freqtrade/dependabot/pip/develop/cryptography-48.0.0
chore(deps): bump cryptography from 47.0.0 to 48.0.0
2026-05-18 06:19:00 +02:00
Freqtrade Bot 5a5dae22d3 chore(deps): Apply pre-commit types update 2026-05-18 03:33:22 +00:00
dependabot[bot] 0a1498af2d chore(deps): bump pydantic from 2.13.3 to 2.13.4
Bumps [pydantic](https://github.com/pydantic/pydantic) from 2.13.3 to 2.13.4.
- [Release notes](https://github.com/pydantic/pydantic/releases)
- [Changelog](https://github.com/pydantic/pydantic/blob/v2.13.4/HISTORY.md)
- [Commits](https://github.com/pydantic/pydantic/compare/v2.13.3...v2.13.4)

---
updated-dependencies:
- dependency-name: pydantic
  dependency-version: 2.13.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-18 03:29:40 +00:00
dependabot[bot] e8cdbf0a8e chore(deps): bump orjson from 3.11.8 to 3.11.9
Bumps [orjson](https://github.com/ijl/orjson) from 3.11.8 to 3.11.9.
- [Release notes](https://github.com/ijl/orjson/releases)
- [Changelog](https://github.com/ijl/orjson/blob/master/CHANGELOG.md)
- [Commits](https://github.com/ijl/orjson/compare/3.11.8...3.11.9)

---
updated-dependencies:
- dependency-name: orjson
  dependency-version: 3.11.9
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-18 03:29:32 +00:00
dependabot[bot] c0ee618bd0 chore(deps-dev): bump mypy from 1.20.2 to 2.0.0
Bumps [mypy](https://github.com/python/mypy) from 1.20.2 to 2.0.0.
- [Changelog](https://github.com/python/mypy/blob/master/CHANGELOG.md)
- [Commits](https://github.com/python/mypy/compare/v1.20.2...v2.0.0)

---
updated-dependencies:
- dependency-name: mypy
  dependency-version: 2.0.0
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-18 03:29:14 +00:00
dependabot[bot] a4ed0a03f1 chore(deps): bump cryptography from 47.0.0 to 48.0.0
Bumps [cryptography](https://github.com/pyca/cryptography) from 47.0.0 to 48.0.0.
- [Changelog](https://github.com/pyca/cryptography/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pyca/cryptography/compare/47.0.0...48.0.0)

---
updated-dependencies:
- dependency-name: cryptography
  dependency-version: 48.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-18 03:28:58 +00:00
dependabot[bot] 25d8d831ec chore(deps-dev): bump the types group with 3 updates
Bumps the types group with 3 updates: [types-requests](https://github.com/python/typeshed), [types-tabulate](https://github.com/python/typeshed) and [types-python-dateutil](https://github.com/python/typeshed).


Updates `types-requests` from 2.33.0.20260503 to 2.33.0.20260508
- [Commits](https://github.com/python/typeshed/commits)

Updates `types-tabulate` from 0.10.0.20260408 to 0.10.0.20260508
- [Commits](https://github.com/python/typeshed/commits)

Updates `types-python-dateutil` from 2.9.0.20260408 to 2.9.0.20260508
- [Commits](https://github.com/python/typeshed/commits)

---
updated-dependencies:
- dependency-name: types-requests
  dependency-version: 2.33.0.20260508
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: types
- dependency-name: types-tabulate
  dependency-version: 0.10.0.20260508
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: types
- dependency-name: types-python-dateutil
  dependency-version: 2.9.0.20260508
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: types
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-18 03:28:08 +00:00
Matthias 3d91223c2b refactor: further improve hyper function wording 2026-05-17 20:17:43 +02:00
Matthias 875daac375 refactor: improve naming to reflect method functionality 2026-05-17 20:13:42 +02:00
Matthias 03fac42047 chore: fix docstring typo 2026-05-17 17:20:38 +02:00
Matthias 5bcc4fbf03 Merge pull request #13147 from freqtrade/dependabot/docker/python-3.14.5-slim-trixie
chore(deps): bump python from 3.14.3-slim-trixie to 3.14.5-slim-trixie
2026-05-15 06:31:31 +02:00
dependabot[bot] 0ea2258fa8 chore(deps): bump python from 3.14.3-slim-trixie to 3.14.5-slim-trixie
Bumps python from 3.14.3-slim-trixie to 3.14.5-slim-trixie.

---
updated-dependencies:
- dependency-name: python
  dependency-version: 3.14.5-slim-trixie
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-15 03:15:25 +00:00
Matthias a0627aa2fc docs: improve freqai docs formatting 2026-05-14 19:14:05 +02:00
Matthias 764b32a0cf Merge pull request #13145 from freqtrade/update/binance-leverage-tiers
Update Binance Leverage Tiers
2026-05-14 06:21:48 +02:00
Freqtrade Bot fc634f42f6 chore: update binance leverage tiers 2026-05-14 03:37:42 +00:00
Matthias 8cce4be23c Merge pull request #13141 from freqtrade/update/pre-commit-hooks
Update pre-commit hooks
2026-05-12 06:29:32 +02:00
Freqtrade Bot 11ab80bfc4 chore: update pre-commit hooks 2026-05-12 04:15:44 +00:00
Matthias e00a1fd28c Merge pull request #13140 from freqtrade/dependabot/pip/urllib3-2.7.0
chore(deps): bump urllib3 from 2.6.3 to 2.7.0
2026-05-11 19:36:08 +02:00
Matthias b132a49f40 chore(ci): use better name for mypy-version-update 2026-05-11 19:23:17 +02:00
Matthias f82e4ce9ec chore: urllib exclude for security fix 2026-05-11 19:17:13 +02:00
Matthias fac00475a1 Merge pull request #13132 from freqtrade/dependabot/pip/develop/types-67d33dbf9b
chore(deps-dev): bump the types group across 1 directory with 2 updates
2026-05-11 19:16:02 +02:00
Matthias 2ac99fc2bf chore: switch environment for security 2026-05-11 19:15:20 +02:00
Freqtrade Bot d935de08fe Apply pre-commit types update 2026-05-11 16:36:09 +00:00
Matthias a92e0b2545 chore(ci): improved condition syntax 2026-05-11 18:34:32 +02:00
Matthias 8abdd496f6 chore: fix pre-commit updates misconception 2026-05-11 18:32:11 +02:00
dependabot[bot] 443a245d82 chore(deps-dev): bump the types group across 1 directory with 2 updates
Bumps the types group with 2 updates in the / directory: [types-cachetools](https://github.com/python/typeshed) and [types-requests](https://github.com/python/typeshed).


Updates `types-cachetools` from 6.2.0.20260408 to 7.0.0.20260503
- [Commits](https://github.com/python/typeshed/commits)

Updates `types-requests` from 2.33.0.20260408 to 2.33.0.20260503
- [Commits](https://github.com/python/typeshed/commits)

---
updated-dependencies:
- dependency-name: types-cachetools
  dependency-version: 7.0.0.20260503
  dependency-type: direct:development
  update-type: version-update:semver-major
  dependency-group: types
- dependency-name: types-requests
  dependency-version: 2.33.0.20260503
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: types
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-11 16:18:16 +00:00
Matthias d95789a2e0 feat(ci): add pre-commit types update workflow 2026-05-11 18:13:06 +02:00
Matthias 3a4adfac52 feat: auto-update pre-commit config 2026-05-11 18:05:52 +02:00
Matthias 523216a39c fix: work around to_json pandas deprecation 2026-05-11 18:05:35 +02:00
Matthias e5d4fd6b62 chore: simplify rpc code 2026-05-11 18:05:21 +02:00
dependabot[bot] 939ea01d12 chore(deps): bump urllib3 from 2.6.3 to 2.7.0
Bumps [urllib3](https://github.com/urllib3/urllib3) from 2.6.3 to 2.7.0.
- [Release notes](https://github.com/urllib3/urllib3/releases)
- [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst)
- [Commits](https://github.com/urllib3/urllib3/compare/2.6.3...2.7.0)

---
updated-dependencies:
- dependency-name: urllib3
  dependency-version: 2.7.0
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-11 16:04:30 +00:00
Matthias c587a1ccda Merge pull request #13136 from freqtrade/dependabot/pip/develop/ccxt-4.5.52
chore(deps): bump ccxt from 4.5.51 to 4.5.52
2026-05-11 06:38:12 +02:00
Matthias 6751b8e468 Merge pull request #13134 from freqtrade/dependabot/pip/develop/cachetools-7.1.1
chore(deps): bump cachetools from 7.0.6 to 7.1.1
2026-05-11 06:34:59 +02:00
Matthias ef1dca92eb Merge pull request #13137 from freqtrade/dependabot/pip/develop/pytz-2026.2
chore(deps): bump pytz from 2026.1.post1 to 2026.2
2026-05-11 06:34:49 +02:00
Matthias 0e33e69d8e Merge pull request #13135 from freqtrade/dependabot/pip/develop/build-1.5.0
chore(deps-dev): bump build from 1.4.4 to 1.5.0
2026-05-11 06:34:31 +02:00
dependabot[bot] 021011df31 chore(deps): bump pytz from 2026.1.post1 to 2026.2
Bumps [pytz](https://github.com/stub42/pytz) from 2026.1.post1 to 2026.2.
- [Release notes](https://github.com/stub42/pytz/releases)
- [Commits](https://github.com/stub42/pytz/compare/release_2026.1.post1...release_2026.2)

---
updated-dependencies:
- dependency-name: pytz
  dependency-version: '2026.2'
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-11 03:04:36 +00:00
dependabot[bot] c2e89e5f11 chore(deps): bump ccxt from 4.5.51 to 4.5.52
Bumps [ccxt](https://github.com/ccxt/ccxt) from 4.5.51 to 4.5.52.
- [Release notes](https://github.com/ccxt/ccxt/releases)
- [Commits](https://github.com/ccxt/ccxt/compare/v4.5.51...v4.5.52)

---
updated-dependencies:
- dependency-name: ccxt
  dependency-version: 4.5.52
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-11 03:04:29 +00:00
dependabot[bot] ba89faab6a chore(deps-dev): bump build from 1.4.4 to 1.5.0
Bumps [build](https://github.com/pypa/build) from 1.4.4 to 1.5.0.
- [Release notes](https://github.com/pypa/build/releases)
- [Changelog](https://github.com/pypa/build/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pypa/build/compare/1.4.4...1.5.0)

---
updated-dependencies:
- dependency-name: build
  dependency-version: 1.5.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-11 03:04:16 +00:00
dependabot[bot] ef38cb325b chore(deps): bump cachetools from 7.0.6 to 7.1.1
Bumps [cachetools](https://github.com/tkem/cachetools) from 7.0.6 to 7.1.1.
- [Changelog](https://github.com/tkem/cachetools/blob/master/CHANGELOG.rst)
- [Commits](https://github.com/tkem/cachetools/compare/v7.0.6...v7.1.1)

---
updated-dependencies:
- dependency-name: cachetools
  dependency-version: 7.1.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-11 03:03:56 +00:00
Matthias e0df17ef33 chore: take some endpoints out of alpha 2026-05-10 15:07:58 +02:00
Matthias c2578dca06 chore: update json schema 2026-05-09 09:09:32 +02:00
Matthias c8605ae8fb fix: require minimum 32 characters for JWT secrets 2026-05-09 08:55:35 +02:00
Matthias 22ef7697e8 chore: remove unused variable 2026-05-09 08:34:49 +02:00
Matthias 77cabd291f Merge pull request #13128 from freqtrade/update/binance-leverage-tiers
Update Binance Leverage Tiers
2026-05-07 07:48:26 +02:00
Freqtrade Bot 59b47a9a67 chore: update binance leverage tiers 2026-05-07 03:37:17 +00:00
Matthias e8eb5cdb4c Merge pull request #13115 from freqtrade/dependabot/pip/develop/uvicorn-0.46.0
chore(deps): bump uvicorn from 0.44.0 to 0.46.0
2026-05-04 09:31:26 +02:00
Matthias c9274a7d04 Merge pull request #13116 from freqtrade/dependabot/pip/develop/ruff-0.15.12
chore(deps-dev): bump ruff from 0.15.11 to 0.15.12
2026-05-04 07:57:25 +02:00
dependabot[bot] c6a481a2dc chore(deps): bump uvicorn from 0.44.0 to 0.46.0
Bumps [uvicorn](https://github.com/Kludex/uvicorn) from 0.44.0 to 0.46.0.
- [Release notes](https://github.com/Kludex/uvicorn/releases)
- [Changelog](https://github.com/Kludex/uvicorn/blob/main/docs/release-notes.md)
- [Commits](https://github.com/Kludex/uvicorn/compare/0.44.0...0.46.0)

---
updated-dependencies:
- dependency-name: uvicorn
  dependency-version: 0.46.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-04 05:49:07 +00:00
Matthias 0188d68a85 Merge pull request #13120 from freqtrade/dependabot/pip/develop/fastapi-0.136.1
chore(deps): bump fastapi from 0.136.0 to 0.136.1
2026-05-04 07:47:49 +02:00
Matthias 10c2ec39db Merge pull request #13122 from freqtrade/dependabot/pip/develop/cachetools-7.0.6
chore(deps): bump cachetools from 7.0.5 to 7.0.6
2026-05-04 07:43:53 +02:00
Matthias d0bf09b7e1 Merge pull request #13121 from freqtrade/dependabot/pip/develop/ccxt-4.5.51
chore(deps): bump ccxt from 4.5.50 to 4.5.51
2026-05-04 07:37:35 +02:00
Matthias d2cbae6f50 Merge pull request #13117 from freqtrade/dependabot/pip/develop/pyarrow-24.0.0
chore(deps): bump pyarrow from 23.0.1 to 24.0.0
2026-05-04 07:36:39 +02:00
dependabot[bot] 7e41443db8 chore(deps-dev): bump ruff from 0.15.11 to 0.15.12
Bumps [ruff](https://github.com/astral-sh/ruff) from 0.15.11 to 0.15.12.
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](https://github.com/astral-sh/ruff/compare/0.15.11...0.15.12)

---
updated-dependencies:
- dependency-name: ruff
  dependency-version: 0.15.12
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-04 05:33:30 +00:00
Matthias 011098209a Merge pull request #13118 from freqtrade/dependabot/pip/develop/pre-commit-4.6.0
chore(deps-dev): bump pre-commit from 4.5.1 to 4.6.0
2026-05-04 07:29:31 +02:00
dependabot[bot] 885a147b48 chore(deps): bump ccxt from 4.5.50 to 4.5.51
Bumps [ccxt](https://github.com/ccxt/ccxt) from 4.5.50 to 4.5.51.
- [Release notes](https://github.com/ccxt/ccxt/releases)
- [Commits](https://github.com/ccxt/ccxt/compare/v4.5.50...v4.5.51)

---
updated-dependencies:
- dependency-name: ccxt
  dependency-version: 4.5.51
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-04 04:50:13 +00:00
Matthias 1ad03ecb13 Merge pull request #13119 from freqtrade/dependabot/pip/develop/cryptography-47.0.0
chore(deps): bump cryptography from 46.0.7 to 47.0.0
2026-05-04 06:42:38 +02:00
Matthias c46272a7fc chore(dependabot): group bymnasium/sb3 dependencies 2026-05-04 06:41:47 +02:00
Matthias 1d8034ab66 chore: package naming in freqai-rl 2026-05-04 06:41:47 +02:00
Matthias 0b12dcfec9 chore: bump pyarrow armv7 wheel 2026-05-04 06:35:55 +02:00
dependabot[bot] cf541f8e7c chore(deps): bump fastapi from 0.136.0 to 0.136.1
Bumps [fastapi](https://github.com/fastapi/fastapi) from 0.136.0 to 0.136.1.
- [Release notes](https://github.com/fastapi/fastapi/releases)
- [Commits](https://github.com/fastapi/fastapi/compare/0.136.0...0.136.1)

---
updated-dependencies:
- dependency-name: fastapi
  dependency-version: 0.136.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-04 04:35:04 +00:00
dependabot[bot] 7c46980e9d chore(deps): bump cachetools from 7.0.5 to 7.0.6
Bumps [cachetools](https://github.com/tkem/cachetools) from 7.0.5 to 7.0.6.
- [Changelog](https://github.com/tkem/cachetools/blob/master/CHANGELOG.rst)
- [Commits](https://github.com/tkem/cachetools/compare/v7.0.5...v7.0.6)

---
updated-dependencies:
- dependency-name: cachetools
  dependency-version: 7.0.6
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-04 04:34:50 +00:00
dependabot[bot] 7c9554349d chore(deps-dev): bump pre-commit from 4.5.1 to 4.6.0
Bumps [pre-commit](https://github.com/pre-commit/pre-commit) from 4.5.1 to 4.6.0.
- [Release notes](https://github.com/pre-commit/pre-commit/releases)
- [Changelog](https://github.com/pre-commit/pre-commit/blob/main/CHANGELOG.md)
- [Commits](https://github.com/pre-commit/pre-commit/compare/v4.5.1...v4.6.0)

---
updated-dependencies:
- dependency-name: pre-commit
  dependency-version: 4.6.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-04 04:33:58 +00:00
Matthias 2d3ccb841d Merge pull request #13114 from freqtrade/dependabot/pip/develop/certifi-2026.4.22
chore(deps): bump certifi from 2026.2.25 to 2026.4.22
2026-05-04 06:33:43 +02:00
Matthias 68768748dc Merge pull request #13113 from freqtrade/dependabot/pip/develop/pydantic-2.13.3
chore(deps): bump pydantic from 2.13.2 to 2.13.3
2026-05-04 06:33:17 +02:00
Matthias 0b0a4e5df1 Merge pull request #13112 from freqtrade/dependabot/pip/develop/mypy-1.20.2
chore(deps-dev): bump mypy from 1.20.1 to 1.20.2
2026-05-04 06:33:04 +02:00
Matthias 2b47d2e91d Merge pull request #13111 from freqtrade/dependabot/pip/develop/build-1.4.4
chore(deps-dev): bump build from 1.4.3 to 1.4.4
2026-05-04 06:32:27 +02:00
Matthias 60cbf93b8f Merge pull request #13110 from freqtrade/dependabot/pip/develop/packaging-26.2
chore(deps): bump packaging from 26.1 to 26.2
2026-05-04 06:32:18 +02:00
dependabot[bot] 1b67a5b533 chore(deps): bump cryptography from 46.0.7 to 47.0.0
Bumps [cryptography](https://github.com/pyca/cryptography) from 46.0.7 to 47.0.0.
- [Changelog](https://github.com/pyca/cryptography/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pyca/cryptography/compare/46.0.7...47.0.0)

---
updated-dependencies:
- dependency-name: cryptography
  dependency-version: 47.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-04 03:04:35 +00:00
dependabot[bot] 30832e702c chore(deps): bump pyarrow from 23.0.1 to 24.0.0
Bumps [pyarrow](https://github.com/apache/arrow) from 23.0.1 to 24.0.0.
- [Release notes](https://github.com/apache/arrow/releases)
- [Commits](https://github.com/apache/arrow/compare/apache-arrow-23.0.1...apache-arrow-24.0.0)

---
updated-dependencies:
- dependency-name: pyarrow
  dependency-version: 24.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-04 03:04:22 +00:00
dependabot[bot] 8c8738e5f9 chore(deps): bump certifi from 2026.2.25 to 2026.4.22
Bumps [certifi](https://github.com/certifi/python-certifi) from 2026.2.25 to 2026.4.22.
- [Commits](https://github.com/certifi/python-certifi/compare/2026.02.25...2026.04.22)

---
updated-dependencies:
- dependency-name: certifi
  dependency-version: 2026.4.22
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-04 03:03:49 +00:00
dependabot[bot] f72d734e8c chore(deps): bump pydantic from 2.13.2 to 2.13.3
Bumps [pydantic](https://github.com/pydantic/pydantic) from 2.13.2 to 2.13.3.
- [Release notes](https://github.com/pydantic/pydantic/releases)
- [Changelog](https://github.com/pydantic/pydantic/blob/main/HISTORY.md)
- [Commits](https://github.com/pydantic/pydantic/compare/v2.13.2...v2.13.3)

---
updated-dependencies:
- dependency-name: pydantic
  dependency-version: 2.13.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-04 03:03:44 +00:00
dependabot[bot] 110ffde14e chore(deps-dev): bump mypy from 1.20.1 to 1.20.2
Bumps [mypy](https://github.com/python/mypy) from 1.20.1 to 1.20.2.
- [Changelog](https://github.com/python/mypy/blob/master/CHANGELOG.md)
- [Commits](https://github.com/python/mypy/compare/v1.20.1...v1.20.2)

---
updated-dependencies:
- dependency-name: mypy
  dependency-version: 1.20.2
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-04 03:03:35 +00:00
dependabot[bot] 2d0ab2d973 chore(deps-dev): bump build from 1.4.3 to 1.4.4
Bumps [build](https://github.com/pypa/build) from 1.4.3 to 1.4.4.
- [Release notes](https://github.com/pypa/build/releases)
- [Changelog](https://github.com/pypa/build/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pypa/build/compare/1.4.3...1.4.4)

---
updated-dependencies:
- dependency-name: build
  dependency-version: 1.4.4
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-04 03:03:27 +00:00
dependabot[bot] 8e9615ba6c chore(deps): bump packaging from 26.1 to 26.2
Bumps [packaging](https://github.com/pypa/packaging) from 26.1 to 26.2.
- [Release notes](https://github.com/pypa/packaging/releases)
- [Changelog](https://github.com/pypa/packaging/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pypa/packaging/compare/26.1...26.2)

---
updated-dependencies:
- dependency-name: packaging
  dependency-version: '26.2'
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-04 03:03:19 +00:00
Matthias 55244fb098 Merge pull request #13109 from dtmkeng/improve/maxsize-marketcappairlist
fix: increase marketcap cache size to improve performance
2026-05-03 19:16:28 +02:00
dtmkeng 2087e04a62 fix: reduce marketcap cache size to optimize memory usage 2026-05-03 15:22:31 +07:00
Matthias 5ecd64d17e fix: realized_profit calculation for open trades
while the trade is open, funding fees need to be added on every exit
this keeps realized_profit in line with prior close profits.

closes #13102
2026-05-03 08:50:03 +02:00
dtmkeng 047a107ff3 fix: increase marketcap cache size to improve performance 2026-05-03 02:36:06 +07:00
Matthias 4acdb2eb0c chore: ensure __repr__ always has an order side 2026-05-02 16:25:13 +02:00
Matthias 58a18e1e9c fix: use "toint" for show-trades 2026-05-02 16:21:54 +02:00
Matthias 17b5e9bac7 chore: minor typo fix 2026-05-02 08:27:08 +02:00
Matthias 610d03570c chore: bump version to 2026.5-dev 2026-04-30 07:13:14 +02:00
Matthias 2ea4c4de2f Merge pull request #13105 from freqtrade/update/binance-leverage-tiers
Update Binance Leverage Tiers
2026-04-30 06:31:39 +02:00
Freqtrade Bot ad8dc57e9b chore: update binance leverage tiers 2026-04-30 03:37:35 +00:00
Matthias dd970f2be1 fix: rate can be None in balance migration 2026-04-29 20:01:50 +02:00
Matthias 63819fa7e0 test: update test for unwatch_ohlcv adjustment
Co-authored-by: Copilot <copilot@github.com>
2026-04-28 20:54:04 +02:00
Matthias bfe05868eb feat: implement unwatchOHLCV
closes #13082

Co-authored-by: Copilot <copilot@github.com>
2026-04-28 20:51:47 +02:00
Matthias 14d66100be Merge pull request #13104 from freqtrade/update/pre-commit-hooks
Update pre-commit hooks
2026-04-28 06:36:39 +02:00
Freqtrade Bot afc00c5a2e chore: update pre-commit hooks 2026-04-28 04:15:25 +00:00
Matthias 0b13ddfc0a Merge pull request #13096 from freqtrade/dependabot/pip/develop/pydantic-2.13.2
chore(deps): bump pydantic from 2.12.5 to 2.13.2
2026-04-27 07:30:50 +02:00
Matthias 820000fac4 chore: update dry-run order-id generation to uuid
this is supposed to avoid insert errors in windows CI
due to time imprecisions on windows ...

Co-authored-by: Copilot <copilot@github.com>
2026-04-27 07:17:01 +02:00
Matthias 5710fe4477 Merge pull request #13093 from freqtrade/dependabot/pip/develop/sb3-contrib-gte-2.8.0
chore(deps): update sb3-contrib requirement from >=2.2.1 to >=2.8.0
2026-04-27 07:12:03 +02:00
Matthias 3c84ac6d3f Merge pull request #13097 from freqtrade/dependabot/github_actions/develop/astral-sh/setup-uv-8.1.0
chore(deps): bump astral-sh/setup-uv from 8.0.0 to 8.1.0
2026-04-27 07:06:15 +02:00
Matthias 3116139336 Merge pull request #13095 from freqtrade/dependabot/pip/develop/packaging-26.1
chore(deps): bump packaging from 26.0 to 26.1
2026-04-27 07:00:26 +02:00
Matthias 24e40d3a7a Merge pull request #13092 from freqtrade/dependabot/pip/develop/scipy-e4bafee045
chore(deps-dev): bump scipy-stubs from 1.17.1.3 to 1.17.1.4 in the scipy group
2026-04-27 06:57:32 +02:00
Matthias 5b83dce052 chore: precisely pin sb3_contrib 2026-04-27 06:37:09 +02:00
dependabot[bot] bab128b359 chore(deps): bump pydantic from 2.12.5 to 2.13.2
Bumps [pydantic](https://github.com/pydantic/pydantic) from 2.12.5 to 2.13.2.
- [Release notes](https://github.com/pydantic/pydantic/releases)
- [Changelog](https://github.com/pydantic/pydantic/blob/main/HISTORY.md)
- [Commits](https://github.com/pydantic/pydantic/compare/v2.12.5...v2.13.2)

---
updated-dependencies:
- dependency-name: pydantic
  dependency-version: 2.13.2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-27 04:32:29 +00:00
Matthias 875c464a07 chore: bump scipy-stubs in pre-commit config 2026-04-27 06:32:00 +02:00
Matthias 604fddd735 Merge pull request #13094 from freqtrade/dependabot/pip/develop/fastapi-0.136.0
chore(deps): bump fastapi from 0.135.3 to 0.136.0
2026-04-27 06:31:13 +02:00
Matthias bd247f3642 Merge pull request #13098 from freqtrade/dependabot/github_actions/develop/devcontainers/ci-0.3.1900000449
chore(deps): bump devcontainers/ci from 0.3.1900000417 to 0.3.1900000449
2026-04-27 06:30:56 +02:00
Matthias ca6419228c Merge pull request #13099 from freqtrade/dependabot/pip/develop/ruff-0.15.11
chore(deps-dev): bump ruff from 0.15.10 to 0.15.11
2026-04-27 06:30:24 +02:00
Matthias 003cc4dc38 Merge pull request #13100 from freqtrade/dependabot/pip/develop/mike-2.2.0
chore(deps): bump mike from 2.1.4 to 2.2.0
2026-04-27 06:30:10 +02:00
Matthias 41deb75279 Merge pull request #13101 from freqtrade/dependabot/pip/develop/filelock-3.29.0
chore(deps): bump filelock from 3.25.2 to 3.29.0
2026-04-27 06:29:58 +02:00
dependabot[bot] 5a8131caf6 chore(deps): bump filelock from 3.25.2 to 3.29.0
Bumps [filelock](https://github.com/tox-dev/py-filelock) from 3.25.2 to 3.29.0.
- [Release notes](https://github.com/tox-dev/py-filelock/releases)
- [Changelog](https://github.com/tox-dev/filelock/blob/main/docs/changelog.rst)
- [Commits](https://github.com/tox-dev/py-filelock/compare/3.25.2...3.29.0)

---
updated-dependencies:
- dependency-name: filelock
  dependency-version: 3.29.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-27 03:04:21 +00:00
dependabot[bot] a5cb607311 chore(deps): bump mike from 2.1.4 to 2.2.0
Bumps [mike](https://github.com/jimporter/mike) from 2.1.4 to 2.2.0.
- [Release notes](https://github.com/jimporter/mike/releases)
- [Changelog](https://github.com/jimporter/mike/blob/master/CHANGES.md)
- [Commits](https://github.com/jimporter/mike/compare/v2.1.4...v2.2.0)

---
updated-dependencies:
- dependency-name: mike
  dependency-version: 2.2.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-27 03:04:14 +00:00
dependabot[bot] cf5ba35bb0 chore(deps-dev): bump ruff from 0.15.10 to 0.15.11
Bumps [ruff](https://github.com/astral-sh/ruff) from 0.15.10 to 0.15.11.
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](https://github.com/astral-sh/ruff/compare/0.15.10...0.15.11)

---
updated-dependencies:
- dependency-name: ruff
  dependency-version: 0.15.11
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-27 03:04:07 +00:00
dependabot[bot] 668f7b7e9c chore(deps): bump devcontainers/ci from 0.3.1900000417 to 0.3.1900000449
Bumps [devcontainers/ci](https://github.com/devcontainers/ci) from 0.3.1900000417 to 0.3.1900000449.
- [Release notes](https://github.com/devcontainers/ci/releases)
- [Commits](https://github.com/devcontainers/ci/compare/8bf61b26e9c3a98f69cb6ce2f88d24ff59b785c6...b63b30de439b47a52267f241112c5b453b673db5)

---
updated-dependencies:
- dependency-name: devcontainers/ci
  dependency-version: 0.3.1900000449
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-27 03:04:06 +00:00
dependabot[bot] e2879f11f5 chore(deps): bump astral-sh/setup-uv from 8.0.0 to 8.1.0
Bumps [astral-sh/setup-uv](https://github.com/astral-sh/setup-uv) from 8.0.0 to 8.1.0.
- [Release notes](https://github.com/astral-sh/setup-uv/releases)
- [Commits](https://github.com/astral-sh/setup-uv/compare/cec208311dfd045dd5311c1add060b2062131d57...08807647e7069bb48b6ef5acd8ec9567f424441b)

---
updated-dependencies:
- dependency-name: astral-sh/setup-uv
  dependency-version: 8.1.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-27 03:03:57 +00:00
dependabot[bot] 700d4ea2ff chore(deps): bump packaging from 26.0 to 26.1
Bumps [packaging](https://github.com/pypa/packaging) from 26.0 to 26.1.
- [Release notes](https://github.com/pypa/packaging/releases)
- [Changelog](https://github.com/pypa/packaging/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pypa/packaging/compare/26.0...26.1)

---
updated-dependencies:
- dependency-name: packaging
  dependency-version: '26.1'
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-27 03:03:47 +00:00
dependabot[bot] 1f94154220 chore(deps): bump fastapi from 0.135.3 to 0.136.0
Bumps [fastapi](https://github.com/fastapi/fastapi) from 0.135.3 to 0.136.0.
- [Release notes](https://github.com/fastapi/fastapi/releases)
- [Commits](https://github.com/fastapi/fastapi/compare/0.135.3...0.136.0)

---
updated-dependencies:
- dependency-name: fastapi
  dependency-version: 0.136.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-27 03:03:37 +00:00
dependabot[bot] 14ee96172a chore(deps): update sb3-contrib requirement from >=2.2.1 to >=2.8.0
Updates the requirements on [sb3-contrib](https://github.com/Stable-Baselines-Team/stable-baselines3-contrib) to permit the latest version.
- [Release notes](https://github.com/Stable-Baselines-Team/stable-baselines3-contrib/releases)
- [Commits](https://github.com/Stable-Baselines-Team/stable-baselines3-contrib/compare/v2.2.1...v2.8.0)

---
updated-dependencies:
- dependency-name: sb3-contrib
  dependency-version: 2.8.0
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-27 03:03:23 +00:00
dependabot[bot] 159bde944b chore(deps-dev): bump scipy-stubs in the scipy group
Bumps the scipy group with 1 update: [scipy-stubs](https://github.com/scipy/scipy-stubs).


Updates `scipy-stubs` from 1.17.1.3 to 1.17.1.4
- [Release notes](https://github.com/scipy/scipy-stubs/releases)
- [Commits](https://github.com/scipy/scipy-stubs/compare/v1.17.1.3...v1.17.1.4)

---
updated-dependencies:
- dependency-name: scipy-stubs
  dependency-version: 1.17.1.4
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: scipy
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-27 03:03:14 +00:00
Matthias 0a49903695 test: update bitget test for lev_prep adjustment 2026-04-26 09:07:02 +02:00
Matthias e5f7d0cbb4 fix: bitget should set margin mode explicitly
Without this, leverage may be set on the wrong margin mode.
the leverage endpoint doesn't allow setting margin mode,
so we must control this manually.
2026-04-26 09:05:58 +02:00
Matthias f17e383157 test: add tests for get_ohlcv and ohlcvs 2026-04-25 13:09:34 +02:00
Matthias 093cc74774 refactor: make klines_last_refresh private 2026-04-25 12:49:31 +02:00
Matthias c34cd6a7dd refactor: don't use exchange_ws internal variables 2026-04-25 12:48:56 +02:00
Matthias 17678f1819 refactor: make klines_last_request private 2026-04-25 08:48:46 +02:00
Matthias 057c51b0cd test: improve tests 2026-04-25 08:47:28 +02:00
Matthias 0858b82d3e chore: add locks to exchange_ws key variables 2026-04-25 08:46:49 +02:00
Matthias 5e624d658f test: add test for startup concurrency 2026-04-25 08:37:19 +02:00
Matthias 3949efadfe chore: improve exchange_ws startup safety 2026-04-25 08:37:09 +02:00
Matthias af1de46cd4 chore: fix minor typos 2026-04-24 18:24:31 +02:00
Matthias 9d0fb9b025 test: add explicit test for continuous_stopped handling 2026-04-24 07:08:48 +02:00
Matthias 6d096c20b0 test: add test for exchange_ws reset connection details 2026-04-24 07:06:07 +02:00
Matthias 05c3360892 chore: harden ws stop cleanup 2026-04-24 06:37:05 +02:00
Matthias f9be1ac82c chore: ignore ws shutdown network errors 2026-04-24 06:33:04 +02:00
Matthias 8e9d193791 chore: improved shutdown wording 2026-04-24 06:32:55 +02:00
Matthias cdc01122d5 chore: improve ws shutdown 2026-04-24 06:32:55 +02:00
Matthias a625cbecff chore: improve shutdown for exchange_ws 2026-04-24 06:32:55 +02:00
Matthias 2e4b92ea6c Merge pull request #13083 from freqtrade/update/binance-leverage-tiers
Update Binance Leverage Tiers
2026-04-23 06:33:59 +02:00
Freqtrade Bot f2f17f6d7b chore: update binance leverage tiers 2026-04-23 03:36:46 +00:00
Matthias 3e3436e432 test: add explicit test for db_migration 2026-04-21 07:17:32 +02:00
Matthias 9dfbe8cf63 refactor: move db-migration to persistence 2026-04-21 07:17:05 +02:00
Matthias 85af9dd3fc fix: migrate wallet_history table 2026-04-21 07:16:39 +02:00
Matthias 72f9e9a051 test: update test for wallet-history_id column 2026-04-21 07:15:20 +02:00
Matthias 2549808b52 fix: add wallet_history_id to set_sequence_id logic 2026-04-21 07:15:20 +02:00
Matthias ef1e81f514 Merge pull request #13081 from freqtrade/update/pre-commit-hooks
Update pre-commit hooks
2026-04-21 06:52:10 +02:00
Matthias eabaef0da2 fix(ci): align action version comment 2026-04-21 06:39:00 +02:00
Matthias f78e9c9014 chore: bump ccxt to 4.5.50 2026-04-21 06:34:28 +02:00
Freqtrade Bot ab6f3b8222 chore: update pre-commit hooks 2026-04-21 04:02:06 +00:00
Matthias 3e42dfff13 Merge pull request #13066 from ABSllk/fix-bitget-stoploss
Add pos_loss for Bitget futures stoploss cancellation
2026-04-20 20:55:31 +02:00
Matthias af2e741465 test: add test for bitget stoploss canceling 2026-04-20 20:03:58 +02:00
Matthias 0fa3459271 Merge pull request #13069 from freqtrade/dependabot/pip/develop/types-1f2dda44ba
chore(deps-dev): bump the types group across 1 directory with 4 updates
2026-04-20 07:18:36 +02:00
Matthias ba3d29b100 Merge pull request #13072 from freqtrade/dependabot/pip/develop/ruff-0.15.10
chore(deps-dev): bump ruff from 0.15.9 to 0.15.10
2026-04-20 07:08:30 +02:00
Matthias d1132d2b13 Merge pull request #13074 from freqtrade/dependabot/github_actions/develop/peter-evans/create-pull-request-8.1.1
chore(deps): bump peter-evans/create-pull-request from 8.1.0 to 8.1.1
2026-04-20 07:07:10 +02:00
Matthias 0850f048e7 chore: align pre-commit-config type versions 2026-04-20 06:38:13 +02:00
Matthias 56f6da9026 Merge pull request #13080 from freqtrade/dependabot/pip/develop/ccxt-4.5.49
chore(deps): bump ccxt from 4.5.48 to 4.5.49
2026-04-20 06:34:05 +02:00
Matthias 470a7bf285 Merge pull request #13079 from freqtrade/dependabot/pip/develop/uvicorn-0.44.0
chore(deps): bump uvicorn from 0.43.0 to 0.44.0
2026-04-20 06:32:39 +02:00
Matthias c16a951555 Merge pull request #13078 from freqtrade/dependabot/pip/develop/rich-15.0.0
chore(deps): bump rich from 14.3.3 to 15.0.0
2026-04-20 06:32:14 +02:00
dependabot[bot] 0013b3639d chore(deps-dev): bump the types group with 4 updates
Bumps the types group with 4 updates: [types-cachetools](https://github.com/python/typeshed), [types-requests](https://github.com/python/typeshed), [types-tabulate](https://github.com/python/typeshed) and [types-python-dateutil](https://github.com/python/typeshed).


Updates `types-cachetools` from 6.2.0.20260317 to 6.2.0.20260408
- [Commits](https://github.com/python/typeshed/commits)

Updates `types-requests` from 2.33.0.20260402 to 2.33.0.20260408
- [Commits](https://github.com/python/typeshed/commits)

Updates `types-tabulate` from 0.10.0.20260308 to 0.10.0.20260408
- [Commits](https://github.com/python/typeshed/commits)

Updates `types-python-dateutil` from 2.9.0.20260402 to 2.9.0.20260408
- [Commits](https://github.com/python/typeshed/commits)

---
updated-dependencies:
- dependency-name: types-cachetools
  dependency-version: 6.2.0.20260408
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: types
- dependency-name: types-requests
  dependency-version: 2.33.0.20260408
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: types
- dependency-name: types-tabulate
  dependency-version: 0.10.0.20260408
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: types
- dependency-name: types-python-dateutil
  dependency-version: 2.9.0.20260408
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: types
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-20 04:32:07 +00:00
Matthias fdf182df55 Merge pull request #13070 from freqtrade/dependabot/github_actions/develop/actions-4684ddd577
chore(deps): bump actions/upload-artifact from 7.0.0 to 7.0.1 in the actions group
2026-04-20 06:31:45 +02:00
dependabot[bot] f3d227270e chore(deps-dev): bump ruff from 0.15.9 to 0.15.10
Bumps [ruff](https://github.com/astral-sh/ruff) from 0.15.9 to 0.15.10.
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](https://github.com/astral-sh/ruff/compare/0.15.9...0.15.10)

---
updated-dependencies:
- dependency-name: ruff
  dependency-version: 0.15.10
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-20 04:31:41 +00:00
Matthias c1a8b5520a Merge pull request #13071 from freqtrade/dependabot/pip/develop/nbconvert-7.17.1
chore(deps-dev): bump nbconvert from 7.17.0 to 7.17.1
2026-04-20 06:31:18 +02:00
Matthias d4a6fbc7c0 Merge pull request #13077 from freqtrade/dependabot/pip/develop/build-1.4.3
chore(deps-dev): bump build from 1.4.2 to 1.4.3
2026-04-20 06:30:40 +02:00
Matthias 8c5f63127d Merge pull request #13073 from freqtrade/dependabot/pip/develop/mypy-1.20.1
chore(deps-dev): bump mypy from 1.20.0 to 1.20.1
2026-04-20 06:30:07 +02:00
Matthias d9e0a2837a Merge pull request #13076 from freqtrade/dependabot/pip/develop/plotly-6.7.0
chore(deps): bump plotly from 6.6.0 to 6.7.0
2026-04-20 06:29:24 +02:00
Matthias 24bb7649eb Merge pull request #13075 from freqtrade/dependabot/github_actions/develop/zizmorcore/zizmor-action-0.5.3
chore(deps): bump zizmorcore/zizmor-action from 0.5.2 to 0.5.3
2026-04-20 06:29:09 +02:00
dependabot[bot] 4ddec7463a chore(deps): bump ccxt from 4.5.48 to 4.5.49
Bumps [ccxt](https://github.com/ccxt/ccxt) from 4.5.48 to 4.5.49.
- [Release notes](https://github.com/ccxt/ccxt/releases)
- [Commits](https://github.com/ccxt/ccxt/compare/v4.5.48...v4.5.49)

---
updated-dependencies:
- dependency-name: ccxt
  dependency-version: 4.5.49
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-20 03:04:33 +00:00
dependabot[bot] 5ddd4d4583 chore(deps): bump uvicorn from 0.43.0 to 0.44.0
Bumps [uvicorn](https://github.com/Kludex/uvicorn) from 0.43.0 to 0.44.0.
- [Release notes](https://github.com/Kludex/uvicorn/releases)
- [Changelog](https://github.com/Kludex/uvicorn/blob/main/docs/release-notes.md)
- [Commits](https://github.com/Kludex/uvicorn/compare/0.43.0...0.44.0)

---
updated-dependencies:
- dependency-name: uvicorn
  dependency-version: 0.44.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-20 03:04:18 +00:00
dependabot[bot] 11e35c467f chore(deps): bump rich from 14.3.3 to 15.0.0
Bumps [rich](https://github.com/Textualize/rich) from 14.3.3 to 15.0.0.
- [Release notes](https://github.com/Textualize/rich/releases)
- [Changelog](https://github.com/Textualize/rich/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Textualize/rich/compare/v14.3.3...v15.0.0)

---
updated-dependencies:
- dependency-name: rich
  dependency-version: 15.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-20 03:04:11 +00:00
dependabot[bot] 053134297c chore(deps-dev): bump build from 1.4.2 to 1.4.3
Bumps [build](https://github.com/pypa/build) from 1.4.2 to 1.4.3.
- [Release notes](https://github.com/pypa/build/releases)
- [Changelog](https://github.com/pypa/build/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pypa/build/compare/1.4.2...1.4.3)

---
updated-dependencies:
- dependency-name: build
  dependency-version: 1.4.3
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-20 03:04:06 +00:00
dependabot[bot] b97f037472 chore(deps): bump plotly from 6.6.0 to 6.7.0
Bumps [plotly](https://github.com/plotly/plotly.py) from 6.6.0 to 6.7.0.
- [Release notes](https://github.com/plotly/plotly.py/releases)
- [Changelog](https://github.com/plotly/plotly.py/blob/main/CHANGELOG.md)
- [Commits](https://github.com/plotly/plotly.py/compare/v6.6.0...v6.7.0)

---
updated-dependencies:
- dependency-name: plotly
  dependency-version: 6.7.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-20 03:04:01 +00:00
dependabot[bot] 097ffd87b3 chore(deps): bump zizmorcore/zizmor-action from 0.5.2 to 0.5.3
Bumps [zizmorcore/zizmor-action](https://github.com/zizmorcore/zizmor-action) from 0.5.2 to 0.5.3.
- [Release notes](https://github.com/zizmorcore/zizmor-action/releases)
- [Commits](https://github.com/zizmorcore/zizmor-action/compare/71321a20a9ded102f6e9ce5718a2fcec2c4f70d8...b1d7e1fb5de872772f31590499237e7cce841e8e)

---
updated-dependencies:
- dependency-name: zizmorcore/zizmor-action
  dependency-version: 0.5.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-20 03:04:00 +00:00
dependabot[bot] cd58bba697 chore(deps): bump peter-evans/create-pull-request from 8.1.0 to 8.1.1
Bumps [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request) from 8.1.0 to 8.1.1.
- [Release notes](https://github.com/peter-evans/create-pull-request/releases)
- [Commits](https://github.com/peter-evans/create-pull-request/compare/c0f553fe549906ede9cf27b5156039d195d2ece0...5f6978faf089d4d20b00c7766989d076bb2fc7f1)

---
updated-dependencies:
- dependency-name: peter-evans/create-pull-request
  dependency-version: 8.1.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-20 03:03:56 +00:00
dependabot[bot] 7d455c7e48 chore(deps-dev): bump mypy from 1.20.0 to 1.20.1
Bumps [mypy](https://github.com/python/mypy) from 1.20.0 to 1.20.1.
- [Changelog](https://github.com/python/mypy/blob/master/CHANGELOG.md)
- [Commits](https://github.com/python/mypy/compare/v1.20.0...v1.20.1)

---
updated-dependencies:
- dependency-name: mypy
  dependency-version: 1.20.1
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-20 03:03:54 +00:00
dependabot[bot] 9d019f1018 chore(deps-dev): bump nbconvert from 7.17.0 to 7.17.1
Bumps [nbconvert](https://github.com/jupyter/nbconvert) from 7.17.0 to 7.17.1.
- [Release notes](https://github.com/jupyter/nbconvert/releases)
- [Changelog](https://github.com/jupyter/nbconvert/blob/main/CHANGELOG.md)
- [Commits](https://github.com/jupyter/nbconvert/compare/v7.17.0...v7.17.1)

---
updated-dependencies:
- dependency-name: nbconvert
  dependency-version: 7.17.1
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-20 03:03:22 +00:00
dependabot[bot] cd70e74d7b chore(deps): bump actions/upload-artifact in the actions group
Bumps the actions group with 1 update: [actions/upload-artifact](https://github.com/actions/upload-artifact).


Updates `actions/upload-artifact` from 7.0.0 to 7.0.1
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/bbbca2ddaa5d8feaa63e36b76fdaad77386f024f...043fb46d1a93c77aae656e7c1c64a875d1fc6a0a)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: 7.0.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-20 03:03:20 +00:00
ABS b467eff8be fix(bitget): add legacy fallback for futures stoploss cancel 2026-04-20 00:11:23 +08:00
ABS a02c84ecda Merge branch 'freqtrade:develop' into fix-bitget-stoploss 2026-04-19 23:15:35 +08:00
Matthias 84535a1404 chore: add migration path for kvstore 2026-04-19 13:09:40 +02:00
Matthias 832fb7044c fix: kvstore key should allow 50 characters
closes #13068
2026-04-19 13:09:10 +02:00
Matthias 55361f0a9e fix: ensure proper quoting in migrations 2026-04-19 13:04:23 +02:00
Matthias c1795c79f3 Merge pull request #13048 from freqtrade/dependabot/pip/develop/pandas-3.0.2
chore(deps): bump pandas from 2.3.3 to 3.0.2
2026-04-17 06:21:04 +02:00
Matthias ee65ffc68f fix: align telegram output better 2026-04-16 20:17:05 +02:00
ABS 284446d782 Merge branch 'fix-bitget-stoploss' of https://github.com/ABSllk/freqtrade into fix-bitget-stoploss 2026-04-17 00:18:59 +08:00
ABS 6e270c5d06 fix(bitget): Use correct planType for Bitget futures stoploss cancellation 2026-04-17 00:18:45 +08:00
Matthias 143726edc1 Merge pull request #13064 from freqtrade/maint/remove_python_action
Remove python setup action
2026-04-16 06:56:13 +02:00
Matthias d27de49266 Merge pull request #13065 from freqtrade/update/binance-leverage-tiers
Update Binance Leverage Tiers
2026-04-16 06:44:52 +02:00
Matthias 7e3e206ab3 chore(ci): move leverage tiers update by 1 hour 2026-04-16 06:35:04 +02:00
Freqtrade Bot 12ccd292b1 chore: update binance leverage tiers 2026-04-16 04:28:50 +00:00
Matthias f1828d72ac chore(ci): improved task naming 2026-04-15 19:37:02 +02:00
Matthias 0248c20999 chore(ci): remove actions/python - uv can do this on it's own 2026-04-15 19:32:33 +02:00
Matthias 63f2a8bb68 chore: remove shorter install allows 2026-04-15 06:55:21 +02:00
Matthias b1747fe9ea docs: clarify plot_config setup 2026-04-15 06:49:19 +02:00
Matthias d55c479886 Merge pull request #13053 from ABSllk/fix-bitget-stoploss
bitget - update  stopLossPrice mapping for futures
2026-04-14 21:15:05 +02:00
Matthias b71f91a156 test: attempted reduction of test flukes by resetting recwarn 2026-04-14 21:07:16 +02:00
Matthias 7105279654 fix(bitget): handle old and new stoploss order types 2026-04-14 20:41:18 +02:00
Matthias 812dc64cd7 chore: bump cryptography exclusion to 6 days 2026-04-14 07:18:09 +02:00
Matthias 019f1ab28d Merge pull request #13062 from freqtrade/dependabot/pip/pytest-9.0.3
chore(deps-dev): bump pytest from 9.0.2 to 9.0.3
2026-04-14 07:15:04 +02:00
Matthias ff7e6c3737 chore: allow pytest to be newer temporarily 2026-04-14 06:34:14 +02:00
Matthias ac3e0899a3 Merge pull request #13063 from freqtrade/update/pre-commit-hooks
Update pre-commit hooks
2026-04-14 06:32:18 +02:00
Freqtrade Bot 0568c7b945 chore: update pre-commit hooks 2026-04-14 04:01:05 +00:00
dependabot[bot] 3a31337e43 chore(deps-dev): bump pytest from 9.0.2 to 9.0.3
Bumps [pytest](https://github.com/pytest-dev/pytest) from 9.0.2 to 9.0.3.
- [Release notes](https://github.com/pytest-dev/pytest/releases)
- [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest/compare/9.0.2...9.0.3)

---
updated-dependencies:
- dependency-name: pytest
  dependency-version: 9.0.3
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-14 02:29:25 +00:00
Matthias 2c5dc72985 chore: ensure date-column is in ms range 2026-04-13 20:09:47 +02:00
Matthias 16547dbdbe fix: improve json trades storing for pandas3 2026-04-13 18:13:40 +02:00
Matthias 412e112c0f test: fix pandas3 test 2026-04-13 18:13:40 +02:00
Matthias cd5ea969c4 test: update test pandas frequency usage 2026-04-13 18:13:40 +02:00
Matthias 15bba1b0d0 chore: remove some deprecated functions from datakitchen 2026-04-13 18:13:40 +02:00
dependabot[bot] 755a426992 chore(deps): bump pandas from 2.3.3 to 3.0.2
Bumps [pandas](https://github.com/pandas-dev/pandas) from 2.3.3 to 3.0.2.
- [Release notes](https://github.com/pandas-dev/pandas/releases)
- [Commits](https://github.com/pandas-dev/pandas/compare/v2.3.3...v3.0.2)

---
updated-dependencies:
- dependency-name: pandas
  dependency-version: 3.0.2
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-13 18:13:40 +02:00
Matthias c19982dd36 chore: use string aliases for astype calls 2026-04-13 18:06:59 +02:00
Matthias 74ba9d76a2 fix: use as_unit instead of int math 2026-04-13 07:18:48 +02:00
Matthias 187d06b5ba fix: use pd.notna to check for empty strings 2026-04-13 07:10:09 +02:00
Matthias 202326875d Merge pull request #13055 from freqtrade/dependabot/pip/develop/sqlalchemy-2.0.49
chore(deps): bump sqlalchemy from 2.0.48 to 2.0.49
2026-04-13 06:54:31 +02:00
Matthias 895a9f351f chore: bump sqlalchemy in pre-commit config 2026-04-13 06:32:28 +02:00
Matthias 48b67f7bfb Merge pull request #13059 from freqtrade/dependabot/pip/develop/ccxt-4.5.48
chore(deps): bump ccxt from 4.5.47 to 4.5.48
2026-04-13 06:31:42 +02:00
Matthias fcf5785367 Merge pull request #13058 from freqtrade/dependabot/pip/develop/technical-1.6.0
chore(deps): bump technical from 1.5.4 to 1.6.0
2026-04-13 06:31:05 +02:00
Matthias 85e84d8b69 Merge pull request #13057 from freqtrade/dependabot/pip/develop/uvicorn-0.43.0
chore(deps): bump uvicorn from 0.42.0 to 0.43.0
2026-04-13 06:30:53 +02:00
Matthias b8bd4604fa Merge pull request #13056 from freqtrade/dependabot/github_actions/develop/docker-cb5fd4910d
chore(deps): bump docker/login-action from 4.0.0 to 4.1.0 in the docker group
2026-04-13 06:30:38 +02:00
Matthias f7080ac11d Merge pull request #13054 from freqtrade/dependabot/pip/develop/ruff-0.15.9
chore(deps-dev): bump ruff from 0.15.8 to 0.15.9
2026-04-13 06:30:18 +02:00
dependabot[bot] a9b1fd219b chore(deps): bump ccxt from 4.5.47 to 4.5.48
Bumps [ccxt](https://github.com/ccxt/ccxt) from 4.5.47 to 4.5.48.
- [Release notes](https://github.com/ccxt/ccxt/releases)
- [Commits](https://github.com/ccxt/ccxt/compare/v4.5.47...v4.5.48)

---
updated-dependencies:
- dependency-name: ccxt
  dependency-version: 4.5.48
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-13 03:04:23 +00:00
dependabot[bot] 3da3290224 chore(deps): bump technical from 1.5.4 to 1.6.0
Bumps [technical](https://github.com/freqtrade/technical) from 1.5.4 to 1.6.0.
- [Release notes](https://github.com/freqtrade/technical/releases)
- [Commits](https://github.com/freqtrade/technical/compare/1.5.4...1.6.0)

---
updated-dependencies:
- dependency-name: technical
  dependency-version: 1.6.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-13 03:04:11 +00:00
dependabot[bot] 2f8d82e0b0 chore(deps): bump uvicorn from 0.42.0 to 0.43.0
Bumps [uvicorn](https://github.com/Kludex/uvicorn) from 0.42.0 to 0.43.0.
- [Release notes](https://github.com/Kludex/uvicorn/releases)
- [Changelog](https://github.com/Kludex/uvicorn/blob/main/docs/release-notes.md)
- [Commits](https://github.com/Kludex/uvicorn/compare/0.42.0...0.43.0)

---
updated-dependencies:
- dependency-name: uvicorn
  dependency-version: 0.43.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-13 03:04:03 +00:00
dependabot[bot] 94e52f5241 chore(deps): bump docker/login-action in the docker group
Bumps the docker group with 1 update: [docker/login-action](https://github.com/docker/login-action).


Updates `docker/login-action` from 4.0.0 to 4.1.0
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](https://github.com/docker/login-action/compare/b45d80f862d83dbcd57f89517bcf500b2ab88fb2...4907a6ddec9925e35a0a9e82d7399ccc52663121)

---
updated-dependencies:
- dependency-name: docker/login-action
  dependency-version: 4.1.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: docker
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-13 03:04:02 +00:00
dependabot[bot] df9469d195 chore(deps): bump sqlalchemy from 2.0.48 to 2.0.49
Bumps [sqlalchemy](https://github.com/sqlalchemy/sqlalchemy) from 2.0.48 to 2.0.49.
- [Release notes](https://github.com/sqlalchemy/sqlalchemy/releases)
- [Changelog](https://github.com/sqlalchemy/sqlalchemy/blob/main/CHANGES.rst)
- [Commits](https://github.com/sqlalchemy/sqlalchemy/commits)

---
updated-dependencies:
- dependency-name: sqlalchemy
  dependency-version: 2.0.49
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-13 03:03:59 +00:00
dependabot[bot] c9d4276c66 chore(deps-dev): bump ruff from 0.15.8 to 0.15.9
Bumps [ruff](https://github.com/astral-sh/ruff) from 0.15.8 to 0.15.9.
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](https://github.com/astral-sh/ruff/compare/0.15.8...0.15.9)

---
updated-dependencies:
- dependency-name: ruff
  dependency-version: 0.15.9
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-13 03:03:36 +00:00
Matthias 12f37b7575 chore: more generic datetime selection 2026-04-12 19:54:44 +02:00
Matthias 51d61bc6a8 chore: don't use microsecond precision for 2026-04-12 19:52:18 +02:00
Matthias 79ea1ba1d5 fix: use is_string_dtype to check for object/string types 2026-04-12 19:50:27 +02:00
Matthias f6f0180fc1 fix: use more stable "date to ms" method 2026-04-12 13:35:36 +02:00
Matthias 33211c8eb1 chore: don't use deprecated resmapling frequency 2026-04-12 13:25:07 +02:00
Matthias c60d96922d chore: improve type safety 2026-04-12 10:38:44 +02:00
Matthias 45d4c5d036 docs: update backtesting docs 2026-04-12 10:07:05 +02:00
Matthias 09106ecbe0 chore: further reorder backtest output 2026-04-12 10:06:59 +02:00
Matthias da9f592d3d docs: update backtesting docs 2026-04-12 10:03:06 +02:00
Matthias 22707d6c04 test: update test with new metrics 2026-04-12 09:51:54 +02:00
Matthias 2d930f1fff chore: improved wallet stat drawdown safety 2026-04-12 09:33:39 +02:00
Matthias 44919adae4 feat: improve backtest-output 2026-04-12 09:27:47 +02:00
Matthias a28545a67a feat: improved backtst output 2026-04-12 09:18:46 +02:00
Matthias 76c09299a9 feat: calculate complete drawdown metrics from wallet (incl. underwater) 2026-04-12 09:18:37 +02:00
Matthias 173c75c08c feat: improve wording on metrics 2026-04-12 09:00:14 +02:00
Matthias dfa2db8575 docs: add new fields to the docs 2026-04-12 09:00:04 +02:00
ABS 81fcd5ea5a fix(bitget): use stopLossPrice mapping for futures stoploss handling 2026-04-12 02:42:35 +08:00
Matthias 5e0eb5da10 chore: improved backtest-output ordering 2026-04-11 18:15:36 +02:00
Matthias 64ceb028ac test: add test for wallet based output 2026-04-11 17:25:58 +02:00
Matthias bc0c8ffb71 feat: add wallet based metrics to backtest output 2026-04-11 17:25:45 +02:00
Matthias 624be0c469 feat: add calmar_from_balance 2026-04-11 17:10:05 +02:00
Matthias bcd9023a8d feat: add max-drawdown from wallet balance 2026-04-11 17:09:37 +02:00
Matthias fba843cb61 refactor: extract balance df checks for future reuse 2026-04-11 17:05:55 +02:00
Matthias 6210927bdb feat: add sortino_from_balance calculation 2026-04-11 16:59:55 +02:00
Matthias c2b95090f7 refactor: reusable "daily_returns_from_balance" method 2026-04-11 16:59:55 +02:00
Matthias 017df564ce refactor: extract annualizated ratio calculation 2026-04-11 16:43:28 +02:00
Matthias 97badd0d3b test: add tests for sharpe based on balance 2026-04-11 16:43:28 +02:00
Matthias f3c84d6a3c feat: calculate sharpe-ratio from historic balance snapshots 2026-04-11 16:42:08 +02:00
Matthias 68d514db91 test: split test_btanalysis and test_metrics 2026-04-11 16:41:07 +02:00
Matthias f838db6409 fix: show balance also for old backtests 2026-04-11 13:38:19 +02:00
Matthias e8501dfb7a chore: fix double-space typos 2026-04-11 13:09:13 +02:00
Matthias e5a8aae831 docs: Update hyperliquid vault / subaccount documentation 2026-04-11 09:05:52 +02:00
Matthias 174a857d72 Merge pull request #12763 from freqtrade/feat/tb-lightgbm
feat: Add tensorboard callback to lightgbm
2026-04-10 06:39:18 +02:00
Matthias b66b0c3c9b Merge pull request #13038 from freqtrade/dependabot/pip/cryptography-46.0.7
chore(deps): bump cryptography from 46.0.6 to 46.0.7
2026-04-09 19:43:20 +02:00
Matthias 85ce0a1840 chore: allow cryptography security upgrades 2026-04-09 19:26:48 +02:00
dependabot[bot] 5dd2ad532b chore(deps): bump cryptography from 46.0.6 to 46.0.7
Bumps [cryptography](https://github.com/pyca/cryptography) from 46.0.6 to 46.0.7.
- [Changelog](https://github.com/pyca/cryptography/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pyca/cryptography/compare/46.0.6...46.0.7)

---
updated-dependencies:
- dependency-name: cryptography
  dependency-version: 46.0.7
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-09 19:26:46 +02:00
Matthias 68ea331703 Merge pull request #13047 from freqtrade/dependabot/pip/develop/ccxt-4.5.47
chore(deps): bump ccxt from 4.5.46 to 4.5.47
2026-04-09 18:25:58 +02:00
dependabot[bot] d93ae4e92d chore(deps): bump ccxt from 4.5.46 to 4.5.47
Bumps [ccxt](https://github.com/ccxt/ccxt) from 4.5.46 to 4.5.47.
- [Release notes](https://github.com/ccxt/ccxt/releases)
- [Commits](https://github.com/ccxt/ccxt/compare/v4.5.46...v4.5.47)

---
updated-dependencies:
- dependency-name: ccxt
  dependency-version: 4.5.47
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-09 11:45:21 +00:00
Matthias 6dfc64b5b9 Merge pull request #13043 from freqtrade/dependabot/pip/develop/aiohttp-3.13.5
chore(deps): bump aiohttp from 3.13.4 to 3.13.5
2026-04-09 13:43:55 +02:00
Matthias 44880fdc0d Merge pull request #13041 from freqtrade/dependabot/pip/develop/types-2917a68c1c
chore(deps-dev): bump the types group with 2 updates
2026-04-09 13:28:17 +02:00
Matthias 0b838d2e7c Merge pull request #13044 from freqtrade/dependabot/pip/develop/mypy-1.20.0
chore(deps-dev): bump mypy from 1.19.1 to 1.20.0
2026-04-09 13:27:40 +02:00
Matthias 6c218c8647 Merge pull request #13042 from freqtrade/dependabot/github_actions/develop/pypa/gh-action-pypi-publish-1.14.0
chore(deps): bump pypa/gh-action-pypi-publish from 1.13.0 to 1.14.0
2026-04-09 09:30:56 +02:00
Matthias 1479b0becd Merge pull request #13049 from freqtrade/dependabot/pip/develop/stable-baselines3-2.8.0
chore(deps): bump stable-baselines3 from 2.7.1 to 2.8.0
2026-04-09 09:30:40 +02:00
Matthias 7792a0b86f Merge pull request #13050 from freqtrade/dependabot/pip/develop/fastapi-0.135.3
chore(deps): bump fastapi from 0.135.2 to 0.135.3
2026-04-09 09:22:41 +02:00
Matthias 7dc7511eef Merge pull request #13046 from freqtrade/dependabot/pip/develop/requests-2.33.1
chore(deps): bump requests from 2.33.0 to 2.33.1
2026-04-09 09:09:43 +02:00
Matthias c5a46dff84 Merge pull request #13045 from freqtrade/dependabot/pip/develop/orjson-3.11.8
chore(deps): bump orjson from 3.11.7 to 3.11.8
2026-04-09 08:59:19 +02:00
dependabot[bot] 48b178b353 chore(deps): bump pypa/gh-action-pypi-publish from 1.13.0 to 1.14.0
Bumps [pypa/gh-action-pypi-publish](https://github.com/pypa/gh-action-pypi-publish) from 1.13.0 to 1.14.0.
- [Release notes](https://github.com/pypa/gh-action-pypi-publish/releases)
- [Commits](https://github.com/pypa/gh-action-pypi-publish/compare/ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e...cef221092ed1bacb1cc03d23a2d87d1d172e277b)

---
updated-dependencies:
- dependency-name: pypa/gh-action-pypi-publish
  dependency-version: 1.14.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-09 06:16:11 +00:00
dependabot[bot] b5ac870eac chore(deps): bump stable-baselines3 from 2.7.1 to 2.8.0
Bumps [stable-baselines3](https://github.com/DLR-RM/stable-baselines3) from 2.7.1 to 2.8.0.
- [Release notes](https://github.com/DLR-RM/stable-baselines3/releases)
- [Commits](https://github.com/DLR-RM/stable-baselines3/compare/v2.7.1...v2.8.0)

---
updated-dependencies:
- dependency-name: stable-baselines3
  dependency-version: 2.8.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-09 06:15:15 +00:00
dependabot[bot] 968dea5b66 chore(deps): bump aiohttp from 3.13.4 to 3.13.5
---
updated-dependencies:
- dependency-name: aiohttp
  dependency-version: 3.13.5
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-09 06:15:05 +00:00
dependabot[bot] c4aca0c2b9 chore(deps-dev): bump mypy from 1.19.1 to 1.20.0
Bumps [mypy](https://github.com/python/mypy) from 1.19.1 to 1.20.0.
- [Changelog](https://github.com/python/mypy/blob/master/CHANGELOG.md)
- [Commits](https://github.com/python/mypy/compare/v1.19.1...v1.20.0)

---
updated-dependencies:
- dependency-name: mypy
  dependency-version: 1.20.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-09 06:11:44 +00:00
dependabot[bot] 3872906a57 chore(deps): bump orjson from 3.11.7 to 3.11.8
Bumps [orjson](https://github.com/ijl/orjson) from 3.11.7 to 3.11.8.
- [Release notes](https://github.com/ijl/orjson/releases)
- [Changelog](https://github.com/ijl/orjson/blob/master/CHANGELOG.md)
- [Commits](https://github.com/ijl/orjson/compare/3.11.7...3.11.8)

---
updated-dependencies:
- dependency-name: orjson
  dependency-version: 3.11.8
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-09 06:09:08 +00:00
dependabot[bot] 55e4250bcd chore(deps): bump requests from 2.33.0 to 2.33.1
Bumps [requests](https://github.com/psf/requests) from 2.33.0 to 2.33.1.
- [Release notes](https://github.com/psf/requests/releases)
- [Changelog](https://github.com/psf/requests/blob/main/HISTORY.md)
- [Commits](https://github.com/psf/requests/compare/v2.33.0...v2.33.1)

---
updated-dependencies:
- dependency-name: requests
  dependency-version: 2.33.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-09 06:08:26 +00:00
dependabot[bot] 90d538d41a chore(deps): bump fastapi from 0.135.2 to 0.135.3
Bumps [fastapi](https://github.com/fastapi/fastapi) from 0.135.2 to 0.135.3.
- [Release notes](https://github.com/fastapi/fastapi/releases)
- [Commits](https://github.com/fastapi/fastapi/compare/0.135.2...0.135.3)

---
updated-dependencies:
- dependency-name: fastapi
  dependency-version: 0.135.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-09 06:08:00 +00:00
Matthias 4762abd13f chore: zizmor exception 2026-04-09 06:54:15 +02:00
Matthias 724ed63c41 chore: bump types in pre-commit config 2026-04-09 06:47:26 +02:00
dependabot[bot] 1dbb0f0ee7 chore(deps-dev): bump the types group with 2 updates
Bumps the types group with 2 updates: [types-requests](https://github.com/python/typeshed) and [types-python-dateutil](https://github.com/python/typeshed).


Updates `types-requests` from 2.33.0.20260327 to 2.33.0.20260402
- [Commits](https://github.com/python/typeshed/commits)

Updates `types-python-dateutil` from 2.9.0.20260323 to 2.9.0.20260402
- [Commits](https://github.com/python/typeshed/commits)

---
updated-dependencies:
- dependency-name: types-requests
  dependency-version: 2.33.0.20260402
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: types
- dependency-name: types-python-dateutil
  dependency-version: 2.9.0.20260402
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: types
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-09 04:45:48 +00:00
Matthias e5baa27d51 fix: dependabot currently doesn't support cooldown for docker
ref: https://github.com/dependabot/dependabot-core/issues/14044
2026-04-09 06:44:23 +02:00
Matthias 7c43833a2d chore: explicitly disable demo mode for binance 2026-04-09 06:39:51 +02:00
Matthias ff7cddf4ca docs: add documentation for demo bybit mode 2026-04-09 06:38:24 +02:00
Matthias 36b427cd3b feat: be clear on the use of demo exchanges 2026-04-09 06:38:24 +02:00
Matthias 8b204c75cb test: test validate_demo / dry-run combo 2026-04-09 06:38:24 +02:00
Matthias f56ea7a6ca feat: validate demo-trading and dry-run incompatibility 2026-04-09 06:38:24 +02:00
Matthias 39569df42a feat: expose demo mode via show_config 2026-04-09 06:38:24 +02:00
Matthias 08f0f28e90 feat: enable demo trading mode for ccxt 2026-04-09 06:38:24 +02:00
Matthias d8e0d41001 feat: clearly highlight if bot is starting in demo mode 2026-04-09 06:38:24 +02:00
Matthias 1ac68d6161 feat: show message when enabling demo trading mode 2026-04-09 06:38:24 +02:00
Matthias e7f9059ff4 test: add test for demo trading validation 2026-04-09 06:38:24 +02:00
Matthias 98fd645df6 feat: enable config validation for demo_trading 2026-04-09 06:38:24 +02:00
Matthias 86b8eae344 feat: add supports_demo_trading ft_has key 2026-04-09 06:38:24 +02:00
Matthias 8e62158145 Merge pull request #13039 from freqtrade/update/binance-leverage-tiers
Update Binance Leverage Tiers
2026-04-09 06:32:47 +02:00
Matthias 6a5fb9af42 chore: remove aiohttp shorter exclude-newer exception 2026-04-09 06:32:09 +02:00
Freqtrade Bot 02125f1883 chore: update binance leverage tiers 2026-04-09 04:18:20 +00:00
Matthias ed6899aad6 Merge pull request #13019 from freqtrade/feat/capture_wallets
Capture wallet balance
2026-04-07 07:16:34 +02:00
Matthias 4cced59530 Merge pull request #13032 from freqtrade/update/pre-commit-hooks
Update pre-commit hooks
2026-04-07 07:01:18 +02:00
Matthias 70b24fd0c1 test: reset pairlocks pior to running test 2026-04-07 06:44:25 +02:00
Freqtrade Bot d026b67dee chore: update pre-commit hooks 2026-04-07 03:56:56 +00:00
Matthias c906e146fc test: add reset_locks to the end of the new test 2026-04-06 10:24:41 +02:00
Matthias 8890cdbcdb chore: shorter wording in docstring 2026-04-06 10:05:26 +02:00
Matthias 6712d20578 test: Add test for new pairlock deduplication 2026-04-06 09:58:58 +02:00
Matthias 9582bd3cd7 feat: don't allow re-creation of existing logs
This prevents lock spam - where 100ds of identical rows can be inserted
into the database
2026-04-06 09:58:35 +02:00
Matthias 04990a888b fix: improve bot cleanup methods for safer shutdown 2026-04-06 09:26:28 +02:00
Matthias e6aa098c4e Merge pull request #13022 from freqtrade/dependabot/pip/develop/types-5079a209b0
chore(deps-dev): bump the types group across 1 directory with 2 updates
2026-04-06 09:15:39 +02:00
Matthias c27f719fb5 Merge pull request #13021 from AchmadFathoni/develop
Enforce SKDecimal 'name' parameter as string
2026-04-06 09:06:51 +02:00
Matthias e45d781630 chore: bump types in pre-commit config 2026-04-06 08:58:56 +02:00
dependabot[bot] 63ac3bef01 chore(deps-dev): bump the types group with 2 updates
Bumps the types group with 2 updates: [types-requests](https://github.com/python/typeshed) and [types-python-dateutil](https://github.com/python/typeshed).


Updates `types-requests` from 2.32.4.20260107 to 2.33.0.20260327
- [Commits](https://github.com/python/typeshed/commits)

Updates `types-python-dateutil` from 2.9.0.20260305 to 2.9.0.20260323
- [Commits](https://github.com/python/typeshed/commits)

---
updated-dependencies:
- dependency-name: types-requests
  dependency-version: 2.33.0.20260327
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: types
- dependency-name: types-python-dateutil
  dependency-version: 2.9.0.20260323
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: types
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-06 06:38:04 +00:00
Matthias 753bf99b95 Merge pull request #13031 from freqtrade/dependabot/pip/develop/torch-2.11.0
chore(deps): bump torch from 2.10.0 to 2.11.0
2026-04-06 08:36:48 +02:00
Matthias f13a02e2ec Merge pull request #13023 from freqtrade/dependabot/pip/develop/numpy-2.4.4
chore(deps): bump numpy from 2.4.3 to 2.4.4
2026-04-06 08:35:20 +02:00
Matthias b7b1bdda27 Merge pull request #13030 from freqtrade/dependabot/pip/develop/ccxt-4.5.46
chore(deps): bump ccxt from 4.5.45 to 4.5.46
2026-04-06 08:35:01 +02:00
Matthias 262c002a74 Merge pull request #13025 from freqtrade/dependabot/pip/develop/cmaes-0.13.0
chore(deps): bump cmaes from 0.12.0 to 0.13.0
2026-04-06 08:32:51 +02:00
Matthias a68d943eeb Merge pull request #13029 from freqtrade/dependabot/github_actions/develop/codecov/codecov-action-6.0.0
chore(deps): bump codecov/codecov-action from 5.5.2 to 6.0.0
2026-04-06 08:32:30 +02:00
Matthias a4c6cbcfd4 Merge pull request #13027 from freqtrade/dependabot/github_actions/develop/astral-sh/setup-uv-8.0.0
chore(deps): bump astral-sh/setup-uv from 7.3.1 to 8.0.0
2026-04-06 08:32:05 +02:00
Matthias f151639677 Merge pull request #13026 from freqtrade/dependabot/pip/develop/ruff-0.15.8
chore(deps-dev): bump ruff from 0.15.7 to 0.15.8
2026-04-06 08:30:43 +02:00
Matthias 0f4d1df59f Merge pull request #13024 from freqtrade/dependabot/pip/develop/fastapi-0.135.2
chore(deps): bump fastapi from 0.135.1 to 0.135.2
2026-04-06 08:30:30 +02:00
Matthias 043281ba1b Merge pull request #13028 from freqtrade/dependabot/pip/develop/pymdown-extensions-10.21.2
chore(deps): bump pymdown-extensions from 10.21 to 10.21.2
2026-04-06 08:30:03 +02:00
dependabot[bot] a33def834a chore(deps): bump torch from 2.10.0 to 2.11.0
Bumps [torch](https://github.com/pytorch/pytorch) from 2.10.0 to 2.11.0.
- [Release notes](https://github.com/pytorch/pytorch/releases)
- [Changelog](https://github.com/pytorch/pytorch/blob/main/RELEASE.md)
- [Commits](https://github.com/pytorch/pytorch/compare/v2.10.0...v2.11.0)

---
updated-dependencies:
- dependency-name: torch
  dependency-version: 2.11.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-06 03:04:48 +00:00
dependabot[bot] d25124021c chore(deps): bump ccxt from 4.5.45 to 4.5.46
Bumps [ccxt](https://github.com/ccxt/ccxt) from 4.5.45 to 4.5.46.
- [Release notes](https://github.com/ccxt/ccxt/releases)
- [Commits](https://github.com/ccxt/ccxt/compare/v4.5.45...v4.5.46)

---
updated-dependencies:
- dependency-name: ccxt
  dependency-version: 4.5.46
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-06 03:04:40 +00:00
dependabot[bot] 82ab8c4674 chore(deps): bump codecov/codecov-action from 5.5.2 to 6.0.0
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 5.5.2 to 6.0.0.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/671740ac38dd9b0130fbe1cec585b89eea48d3de...57e3a136b779b570ffcdbf80b3bdc90e7fab3de2)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-version: 6.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-06 03:04:24 +00:00
dependabot[bot] 696af8ec07 chore(deps): bump pymdown-extensions from 10.21 to 10.21.2
Bumps [pymdown-extensions](https://github.com/facelessuser/pymdown-extensions) from 10.21 to 10.21.2.
- [Release notes](https://github.com/facelessuser/pymdown-extensions/releases)
- [Commits](https://github.com/facelessuser/pymdown-extensions/compare/10.21...10.21.2)

---
updated-dependencies:
- dependency-name: pymdown-extensions
  dependency-version: 10.21.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-06 03:04:15 +00:00
dependabot[bot] 7af050ecc4 chore(deps): bump astral-sh/setup-uv from 7.3.1 to 8.0.0
Bumps [astral-sh/setup-uv](https://github.com/astral-sh/setup-uv) from 7.3.1 to 8.0.0.
- [Release notes](https://github.com/astral-sh/setup-uv/releases)
- [Commits](https://github.com/astral-sh/setup-uv/compare/5a095e7a2014a4212f075830d4f7277575a9d098...cec208311dfd045dd5311c1add060b2062131d57)

---
updated-dependencies:
- dependency-name: astral-sh/setup-uv
  dependency-version: 8.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-06 03:04:08 +00:00
dependabot[bot] 13c872d079 chore(deps-dev): bump ruff from 0.15.7 to 0.15.8
Bumps [ruff](https://github.com/astral-sh/ruff) from 0.15.7 to 0.15.8.
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](https://github.com/astral-sh/ruff/compare/0.15.7...0.15.8)

---
updated-dependencies:
- dependency-name: ruff
  dependency-version: 0.15.8
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-06 03:04:08 +00:00
dependabot[bot] bc574509bf chore(deps): bump cmaes from 0.12.0 to 0.13.0
Bumps [cmaes](https://github.com/CyberAgentAILab/cmaes) from 0.12.0 to 0.13.0.
- [Release notes](https://github.com/CyberAgentAILab/cmaes/releases)
- [Commits](https://github.com/CyberAgentAILab/cmaes/compare/v0.12.0...v0.13.0)

---
updated-dependencies:
- dependency-name: cmaes
  dependency-version: 0.13.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-06 03:03:56 +00:00
dependabot[bot] 90d4447911 chore(deps): bump fastapi from 0.135.1 to 0.135.2
Bumps [fastapi](https://github.com/fastapi/fastapi) from 0.135.1 to 0.135.2.
- [Release notes](https://github.com/fastapi/fastapi/releases)
- [Commits](https://github.com/fastapi/fastapi/compare/0.135.1...0.135.2)

---
updated-dependencies:
- dependency-name: fastapi
  dependency-version: 0.135.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-06 03:03:51 +00:00
dependabot[bot] 69ffc2c7a2 chore(deps): bump numpy from 2.4.3 to 2.4.4
Bumps [numpy](https://github.com/numpy/numpy) from 2.4.3 to 2.4.4.
- [Release notes](https://github.com/numpy/numpy/releases)
- [Changelog](https://github.com/numpy/numpy/blob/main/doc/RELEASE_WALKTHROUGH.rst)
- [Commits](https://github.com/numpy/numpy/compare/v2.4.3...v2.4.4)

---
updated-dependencies:
- dependency-name: numpy
  dependency-version: 2.4.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-06 03:03:44 +00:00
Matthias 3d68d6aefc test: Add exchange mock for get_pair_base_currency 2026-04-05 17:06:53 +02:00
Achmad Fathoni de064505c5 Enforce SKDecimal 'name' parameter as string 2026-04-05 21:55:42 +07:00
Matthias 4ba01b5c12 fix: don't assume "/" for pair base currency 2026-04-05 10:10:06 +02:00
Matthias aaadb01a6a docs: improve doc wording 2026-04-05 10:08:56 +02:00
Matthias 8768fe90b3 refactor: slightly improve generate_wallet_stats 2026-04-05 10:08:50 +02:00
Matthias 51478baa47 docs: Add Dashboard section to freqUI docs 2026-04-04 19:46:46 +02:00
Matthias b6b9ae5eb0 test: assert repr for walletHistory 2026-04-04 14:09:36 +02:00
Matthias af815a3c76 chore: unify treatment of pos.leverage fallbacks 2026-04-04 13:51:13 +02:00
Matthias 754f24c8a6 feat: allow skipping of the wallet migration
fallback method in case of problems
2026-04-04 13:48:54 +02:00
Matthias b45e086b50 test: add tests for get_backtest_wallet_change (and market change) 2026-04-04 13:41:20 +02:00
Matthias 7af322a197 fix: impove behavior when loading old backtest results 2026-04-04 13:17:48 +02:00
Matthias 75bfa87f74 chore: minor code cleanup 2026-04-04 13:12:43 +02:00
Matthias a40de0a59b chore: rename variable for better debuggability 2026-04-04 13:12:43 +02:00
Matthias 66eb7f0199 test: add test for historic_balance endpoint 2026-04-04 13:12:43 +02:00
Matthias d001d91640 chore: rename temporary column for clarity 2026-04-04 12:50:10 +02:00
Matthias dec3c3e13b test: fix a couple tsts ... 2026-04-04 12:12:11 +02:00
Matthias f99ccc5e3d docs: improved backtesting doc wording 2026-04-04 11:52:46 +02:00
Matthias 78ccb68929 fix: adjust backtest-logic to new capture method 2026-04-04 11:50:47 +02:00
Matthias e28da4b087 test: Fix and improve balance distribution test 2026-04-04 09:12:44 +02:00
Matthias 425ebeeedb fix: include fees on both trade sides 2026-04-04 09:12:44 +02:00
Matthias c3b2a73eef feat: warn for pairs without history 2026-04-04 09:12:44 +02:00
Matthias 35806c26bf fix: Improved migration for short trades 2026-04-04 09:12:44 +02:00
Matthias a9bbc45ba5 fix(migration): stake should be non-leveraged. 2026-04-04 09:12:44 +02:00
Matthias 5e6d3e265b tests: rename mock helper function 2026-04-04 09:12:44 +02:00
Matthias f9db85fcaf chore: slightly reorder parallelism code 2026-04-04 09:12:44 +02:00
Matthias 138b70a2bf test: add explicit test for prepare_balance_distribution 2026-04-04 09:12:44 +02:00
Matthias 518092a0ad fix: handle error-cases gracefully 2026-04-04 09:12:44 +02:00
Matthias 5d3776309c refactor: improve migration code structure 2026-04-04 09:12:44 +02:00
Matthias ab2e0e6d6f chore: improved logging for clarity on startup wait 2026-04-04 09:12:44 +02:00
Matthias fa48910e96 feat: improved dataframe handling 2026-04-04 09:12:44 +02:00
Matthias 5d2a7d2187 feat: wallet-migration for futures trades 2026-04-04 09:12:44 +02:00
Matthias e4eee1aa1b feat: add short fields to balance_distribution 2026-04-04 09:12:44 +02:00
Matthias 803b4cae78 chore: improved docstring 2026-04-04 09:12:44 +02:00
Matthias 09ddef3716 chore: improved variable naming 2026-04-04 09:12:44 +02:00
Matthias 5a847665ff fix: add total_quote to migration 2026-04-04 09:12:44 +02:00
Matthias 50fd6d152e fix: use correct formula for shorts 2026-04-04 09:12:44 +02:00
Matthias b4961a2cb7 fix: add quote_currency to wallet migration 2026-04-04 09:12:44 +02:00
Matthias 4cac724709 test: update wallet capture test 2026-04-04 09:12:44 +02:00
Matthias 05bbc84bf2 fix: use correct formula for wallet capture 2026-04-04 09:12:44 +02:00
Matthias 21ac7d1969 refactor: use shorter variable name 2026-04-04 09:12:44 +02:00
Matthias f125349587 feat: add additional columns to better cover futures 2026-04-04 09:12:44 +02:00
Matthias f7ddf46b32 refactor: rename WalletHistory fieldname from price to rate 2026-04-04 09:12:44 +02:00
Matthias 623991c772 chore: rename variable to price 2026-04-04 09:12:44 +02:00
Matthias 1237bb798c test: fix backtest api wallets test 2026-04-04 09:12:44 +02:00
Matthias a09036cd6e chore: fix Model naming collision 2026-04-04 09:12:44 +02:00
Matthias 9891b8332b chore: set wallet_migration_date in the correct space 2026-04-04 09:12:44 +02:00
Matthias 7b223f3d38 feat: improve balance_history response 2026-04-04 09:12:44 +02:00
Matthias 61a5ab8e1c feat: add bot_managed to wallet-history migration 2026-04-04 09:12:44 +02:00
Matthias 98493dc9ed feat: add "bot_managed" to wallet_history 2026-04-04 09:12:44 +02:00
Matthias 0835318b8f fix: capture correct balance for futures 2026-04-04 09:12:44 +02:00
Matthias b69a042f5b feat: update wallet migration to keep leverage 2026-04-04 09:12:44 +02:00
Matthias 00d39bbb80 feat: add leverage column to wallet history 2026-04-04 09:12:44 +02:00
Matthias a88dc8839d chore: simplify imports 2026-04-04 09:12:44 +02:00
Matthias cb8d68f395 test: add test for record_wallet_state 2026-04-04 09:12:44 +02:00
Matthias 7dfcf846d0 test: add asserts for backtest wallet capturing 2026-04-04 09:12:44 +02:00
Matthias 3a9160aace chore: simplify date import 2026-04-04 09:12:44 +02:00
Matthias 4904c7b9fd refactor: split trade_parallelism trades into their own testfile 2026-04-04 09:12:44 +02:00
Matthias 27c7a37531 test: add test for balance_distribution_over_time 2026-04-04 09:12:44 +02:00
Matthias 9f9e13cec2 chore: add better docstring 2026-04-04 09:12:44 +02:00
Matthias 175e77794c chore: improve wallet migration code 2026-04-04 09:12:44 +02:00
Matthias 1d7b1cd4ea test: improve test to make it more realistic 2026-04-04 09:12:44 +02:00
Matthias 323f42fc53 fix: Don't round date up to next date
it'll cause a record in the future eventually.
2026-04-04 09:12:44 +02:00
Matthias 03fd0575ce test: simplify imports 2026-04-04 09:12:44 +02:00
Matthias c12c2177cd test: add tests for wallets_migration 2026-04-04 09:12:44 +02:00
Matthias c884fd20ea chore: add repr output for wallet_history 2026-04-04 09:12:44 +02:00
Matthias 0f9cab4231 chore: fix edge-case bug for empty pairlist 2026-04-04 09:12:44 +02:00
Matthias 97e7939a30 chore: improve wallet capturing performance 2026-04-04 09:12:44 +02:00
Matthias 6e3c850807 chore: minor nitpick changes 2026-04-04 09:12:44 +02:00
Matthias 7b49dc8c11 chore: improve optimize reports stability 2026-04-04 09:12:44 +02:00
Matthias cbd1a4c060 chore: minor improvements 2026-04-04 09:12:44 +02:00
Matthias 921cb4dad8 feat: Only ffill until the end of the trade 2026-04-04 09:12:44 +02:00
Matthias bf5ec98918 chore: use "filled" over amount for balance distribution 2026-04-04 09:12:44 +02:00
Matthias c877d267c7 feat: expose minfied when converting trade list to dataframe 2026-04-04 09:12:44 +02:00
Matthias c66adf2bf1 docs: update backtesting docs with new output 2026-04-04 09:12:44 +02:00
Matthias 1ede186484 feat: display min/max balance 2026-04-04 09:12:44 +02:00
Matthias 680aeb89c3 feat: store wallet stats 2026-04-04 09:12:44 +02:00
Matthias ba1092b726 chore: use builtin helpers 2026-04-04 09:12:44 +02:00
Matthias 9ddabbd849 feat: use proper starting balance 2026-04-04 09:12:44 +02:00
Matthias b5f31bf82d chore: use proper starting balance 2026-04-04 09:12:44 +02:00
Matthias db2309dfd2 fix: avoid errors for delisted pairs 2026-04-04 09:12:44 +02:00
Matthias 418acb7034 chore: exclude open orders from balance calculation 2026-04-04 09:12:44 +02:00
Matthias 8a284060d1 fix: wrong usage of getdatetimevalue 2026-04-04 09:12:44 +02:00
Matthias 235c46ae12 chore: add wallet migration timing log 2026-04-04 09:12:44 +02:00
Matthias 1f32dbef9a feat: enable wallet-capture in webserver mode 2026-04-04 09:12:44 +02:00
Matthias d105770ff6 chore: Improve response model naming 2026-04-04 09:12:44 +02:00
Matthias 15be0510fc feat: return "capture_start_ts" as part of API response 2026-04-04 09:12:44 +02:00
Matthias 6c24925522 fix: make sure wallet_summary exists 2026-04-04 09:12:44 +02:00
Matthias a8295de2b9 chore: fix endpoint naming 2026-04-04 09:12:44 +02:00
Matthias d6a0a4ec6c chore: rename WalletHistory model to better match it's intend 2026-04-04 09:12:44 +02:00
Matthias c7878130f1 feat: capture wallet_history_date 2026-04-04 09:12:44 +02:00
Matthias 51cf051fce test: add test for backtest/wallets endpoint 2026-04-04 09:12:44 +02:00
Matthias 1f15d28eeb feat: prevent duplicate wallet migrations 2026-04-04 09:12:44 +02:00
Matthias 281b627db3 feat: add historic_balance api endpoint 2026-04-04 09:12:44 +02:00
Matthias 2d2cee2c58 refactor: rename walletsSummary schema 2026-04-04 09:12:44 +02:00
Matthias 63869be376 feat: initial attempt at migrating walletHistory 2026-04-04 09:12:44 +02:00
Matthias 37fae7ea71 feat: use proper properties for record_wallet_state 2026-04-04 09:12:44 +02:00
Matthias e52276e3da chore: fix import error 2026-04-04 09:12:44 +02:00
Matthias cba49307b6 chore: improve imports 2026-04-04 09:12:44 +02:00
Matthias b614ec4ef9 chore: schedule wallet_state capturing every night. 2026-04-04 09:12:44 +02:00
Matthias ed560f995d feat: add WalletBalance model 2026-04-04 09:11:48 +02:00
Matthias 21269b8a8d feat: add backtest/.../wallets endpoint 2026-04-04 09:11:48 +02:00
Matthias ee745551a2 feat: store wallet_summary 2026-04-04 09:11:48 +02:00
Matthias 10cc857c51 feat: add wallet to dataframe conversion 2026-04-04 09:11:48 +02:00
Matthias 11cb3ef416 feat: reset wallet_captures list in Backtesting 2026-04-04 09:11:48 +02:00
Matthias a3e7ee9895 feat: capture wallet state per candle in backtesting 2026-04-04 09:11:48 +02:00
Matthias 3a76235c48 fix: improved check for emc due to type 2026-04-04 09:09:16 +02:00
Matthias 4ddb7fd43f chore: clarify delist-filter exception 2026-04-04 09:02:52 +02:00
Matthias e3c316f311 fix: Graceful shutdown in case of failed initialization 2026-04-04 08:51:04 +02:00
Matthias 1ebd75b32a fix: improve freqtradebot cleanup resilience 2026-04-04 08:47:50 +02:00
Matthias 65f494be26 fix: don't raise freqAI in pre-mature shutdown scenarios 2026-04-04 08:41:13 +02:00
Matthias 8a98b6172c refactor: use fstrings for regular log output 2026-04-04 08:40:54 +02:00
Matthias 3e4f0df957 Merge pull request #13014 from freqtrade/dependabot/pip/aiohttp-3.13.4
chore(deps): bump aiohttp from 3.13.3 to 3.13.4
2026-04-03 12:23:18 +02:00
dependabot[bot] 4f600eb078 chore(deps): bump aiohttp from 3.13.3 to 3.13.4
---
updated-dependencies:
- dependency-name: aiohttp
  dependency-version: 3.13.4
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-03 09:57:50 +00:00
Matthias b5d400c50d chore: increase aiohttp exclude to 5 days 2026-04-03 11:56:04 +02:00
Matthias f96f9b7601 chore: move futures only flags to ft_has_futures 2026-04-02 07:26:07 +02:00
Matthias f1fc3e1451 chore: remove temporary exclude-newer-package sections 2026-04-02 07:05:33 +02:00
Matthias a7c99b3ba7 Merge pull request #13015 from freqtrade/update/binance-leverage-tiers
Update Binance Leverage Tiers
2026-04-02 06:34:24 +02:00
Freqtrade Bot 57b42b8cf0 chore: update binance leverage tiers 2026-04-02 04:15:15 +00:00
Matthias cdffee23e1 docs: Add stoploss order type explainer
closes #12984
2026-04-01 22:20:34 +02:00
Matthias 384e0c5e5a feat: update dockerfile base to python 3.14.3 2026-04-01 20:44:30 +02:00
Matthias d1b378ead6 chore: bump armhf image to 3.11.15 2026-04-01 20:29:23 +02:00
Matthias 42a153953a Merge pull request #13012 from freqtrade/feat/setup_14
Add support for 3.14 in setup-scripts
2026-04-01 19:58:12 +02:00
Matthias 8eb2edc0e2 feat: support 3.14 in setup scripts 2026-04-01 07:24:33 +02:00
Matthias b0c14d1122 docs: update non-working links to supported-futures 2026-03-31 07:21:48 +02:00
Matthias 7e7e475d4a chore: update deploy-docs to use uv 2026-03-31 07:19:37 +02:00
Matthias c21b8587a6 fix: incorrect balance estimation while entry order is not filled
closes #12993
2026-03-31 06:52:52 +02:00
Matthias ea51c646cd chore: add uv exclude-newer safeguard 2026-03-31 06:40:03 +02:00
Matthias 36d2ed061f Merge pull request #13008 from freqtrade/update/pre-commit-hooks
Update pre-commit hooks
2026-03-31 06:35:03 +02:00
Freqtrade Bot 61e27462b1 chore: update pre-commit hooks 2026-03-31 03:57:08 +00:00
Matthias c47f5f9494 Merge pull request #12997 from freqtrade/dependabot/pip/develop/scipy-7ad29c80bf
chore(deps-dev): bump scipy-stubs from 1.17.1.2 to 1.17.1.3 in the scipy group across 1 directory
2026-03-30 09:20:33 +02:00
Matthias 60ede009d9 Merge pull request #13000 from freqtrade/dependabot/pip/develop/ruff-0.15.7
chore(deps-dev): bump ruff from 0.15.6 to 0.15.7
2026-03-30 09:20:05 +02:00
Matthias 89b6cabf77 Merge pull request #12998 from freqtrade/dependabot/pip/develop/ccxt-4.5.45
chore(deps): bump ccxt from 4.5.44 to 4.5.45
2026-03-30 07:29:51 +02:00
Matthias 4b9ab0a54f chore: bump scipy-stubs in pre-commit config 2026-03-30 07:18:37 +02:00
dependabot[bot] 5782e39fc5 chore(deps-dev): bump scipy-stubs in the scipy group
Bumps the scipy group with 1 update: [scipy-stubs](https://github.com/scipy/scipy-stubs).


Updates `scipy-stubs` from 1.17.1.2 to 1.17.1.3
- [Release notes](https://github.com/scipy/scipy-stubs/releases)
- [Commits](https://github.com/scipy/scipy-stubs/compare/v1.17.1.2...v1.17.1.3)

---
updated-dependencies:
- dependency-name: scipy-stubs
  dependency-version: 1.17.1.3
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: scipy
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-30 05:17:09 +00:00
Matthias f91e71e092 Merge pull request #12994 from freqtrade/dependabot/pip/develop/types-7fbf452716
chore(deps-dev): bump types-cachetools from 6.2.0.20251022 to 6.2.0.20260317 in the types group
2026-03-30 07:15:53 +02:00
dependabot[bot] 6a8d1fff8f chore(deps-dev): bump ruff from 0.15.6 to 0.15.7
Bumps [ruff](https://github.com/astral-sh/ruff) from 0.15.6 to 0.15.7.
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](https://github.com/astral-sh/ruff/compare/0.15.6...0.15.7)

---
updated-dependencies:
- dependency-name: ruff
  dependency-version: 0.15.7
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-30 05:15:20 +00:00
Matthias e703d6fea9 chore: temporarily revert exclude-newer 2026-03-30 07:13:10 +02:00
Matthias a9f6fcc7bb chore: uv.tool add exclude-newer 2026-03-30 07:06:07 +02:00
Matthias 230281f8f2 chore: bump develop version to 2026.4-dev 2026-03-30 07:02:22 +02:00
Matthias 326ef6d49b test: update krakenfutures "filled" test 2026-03-30 06:51:31 +02:00
dependabot[bot] 5c129506ae chore(deps): bump ccxt from 4.5.44 to 4.5.45
Bumps [ccxt](https://github.com/ccxt/ccxt) from 4.5.44 to 4.5.45.
- [Release notes](https://github.com/ccxt/ccxt/releases)
- [Commits](https://github.com/ccxt/ccxt/compare/v4.5.44...v4.5.45)

---
updated-dependencies:
- dependency-name: ccxt
  dependency-version: 4.5.45
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-30 04:48:19 +00:00
Matthias 9a94d97e69 chore: bump types-cachetools in pre-commit config 2026-03-30 06:47:13 +02:00
Matthias e0942e1328 Merge pull request #13001 from freqtrade/dependabot/pip/develop/uvicorn-0.42.0
chore(deps): bump uvicorn from 0.41.0 to 0.42.0
2026-03-30 06:45:58 +02:00
Matthias 88c3fd2bd5 Merge pull request #12999 from freqtrade/dependabot/pip/develop/optuna-4.8.0
chore(deps): bump optuna from 4.7.0 to 4.8.0
2026-03-30 06:45:36 +02:00
Matthias 6e11ce9bd5 Merge pull request #12995 from freqtrade/dependabot/pip/develop/pytest-8100fefb0e
chore(deps-dev): bump pytest-cov from 7.0.0 to 7.1.0 in the pytest group
2026-03-30 06:44:44 +02:00
Matthias 5dccabe2d8 Merge pull request #12996 from freqtrade/dependabot/pip/develop/mkdocs-cf6347e75e
chore(deps): bump mkdocs-material from 9.7.5 to 9.7.6 in the mkdocs group
2026-03-30 06:44:00 +02:00
Matthias b79a280e55 Merge pull request #13002 from freqtrade/dependabot/pip/develop/python-telegram-bot-22.7
chore(deps): bump python-telegram-bot from 22.6 to 22.7
2026-03-30 06:43:40 +02:00
dependabot[bot] 1615c0bd92 chore(deps): bump python-telegram-bot from 22.6 to 22.7
Bumps [python-telegram-bot](https://github.com/python-telegram-bot/python-telegram-bot) from 22.6 to 22.7.
- [Release notes](https://github.com/python-telegram-bot/python-telegram-bot/releases)
- [Commits](https://github.com/python-telegram-bot/python-telegram-bot/compare/v22.6...v22.7)

---
updated-dependencies:
- dependency-name: python-telegram-bot
  dependency-version: '22.7'
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-30 03:04:24 +00:00
dependabot[bot] 9df068c426 chore(deps): bump uvicorn from 0.41.0 to 0.42.0
Bumps [uvicorn](https://github.com/Kludex/uvicorn) from 0.41.0 to 0.42.0.
- [Release notes](https://github.com/Kludex/uvicorn/releases)
- [Changelog](https://github.com/Kludex/uvicorn/blob/main/docs/release-notes.md)
- [Commits](https://github.com/Kludex/uvicorn/compare/0.41.0...0.42.0)

---
updated-dependencies:
- dependency-name: uvicorn
  dependency-version: 0.42.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-30 03:04:11 +00:00
dependabot[bot] e8fde061b5 chore(deps): bump optuna from 4.7.0 to 4.8.0
Bumps [optuna](https://github.com/optuna/optuna) from 4.7.0 to 4.8.0.
- [Release notes](https://github.com/optuna/optuna/releases)
- [Commits](https://github.com/optuna/optuna/compare/v4.7.0...v4.8.0)

---
updated-dependencies:
- dependency-name: optuna
  dependency-version: 4.8.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-30 03:03:39 +00:00
dependabot[bot] 8d024f5e08 chore(deps): bump mkdocs-material in the mkdocs group
Bumps the mkdocs group with 1 update: [mkdocs-material](https://github.com/squidfunk/mkdocs-material).


Updates `mkdocs-material` from 9.7.5 to 9.7.6
- [Release notes](https://github.com/squidfunk/mkdocs-material/releases)
- [Changelog](https://github.com/squidfunk/mkdocs-material/blob/master/CHANGELOG)
- [Commits](https://github.com/squidfunk/mkdocs-material/compare/9.7.5...9.7.6)

---
updated-dependencies:
- dependency-name: mkdocs-material
  dependency-version: 9.7.6
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: mkdocs
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-30 03:03:15 +00:00
dependabot[bot] 6541450c7c chore(deps-dev): bump pytest-cov from 7.0.0 to 7.1.0 in the pytest group
Bumps the pytest group with 1 update: [pytest-cov](https://github.com/pytest-dev/pytest-cov).


Updates `pytest-cov` from 7.0.0 to 7.1.0
- [Changelog](https://github.com/pytest-dev/pytest-cov/blob/master/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest-cov/compare/v7.0.0...v7.1.0)

---
updated-dependencies:
- dependency-name: pytest-cov
  dependency-version: 7.1.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: pytest
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-30 03:03:04 +00:00
dependabot[bot] c29956866d chore(deps-dev): bump types-cachetools in the types group
Bumps the types group with 1 update: [types-cachetools](https://github.com/python/typeshed).


Updates `types-cachetools` from 6.2.0.20251022 to 6.2.0.20260317
- [Commits](https://github.com/python/typeshed/commits)

---
updated-dependencies:
- dependency-name: types-cachetools
  dependency-version: 6.2.0.20260317
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: types
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-30 03:02:43 +00:00
Robert Caulk 6814bc84aa fix: Try to fix linting 2026-02-05 17:24:17 +01:00
Robert Caulk 783c365c10 fix: Avoid circular import 2026-02-05 17:15:00 +01:00
Robert Caulk 455954e0e3 feat: Add tensorboard callback to lightgbm 2026-02-01 15:14:48 +01:00
133 changed files with 16539 additions and 8862 deletions
+10 -4
View File
@@ -1,8 +1,10 @@
version: 2
updates:
- package-ecosystem: docker
cooldown:
default-days: 7
- package-ecosystem: docker # zizmor: ignore[dependabot-cooldown] Docker does not support cooldowns at the moment.
# Docker does not support cooldowns at the moment.
# https://github.com/dependabot/dependabot-core/issues/14044
# cooldown:
# default-days: 7
directories:
- "/"
- "/docker"
@@ -47,7 +49,11 @@ updates:
patterns:
- "scipy"
- "scipy-stubs"
gymnasium:
patterns:
- "gymnasium"
- "stable-baselines3"
- "sb3-contrib"
- package-ecosystem: "github-actions"
directory: "/"
cooldown:
@@ -2,7 +2,7 @@ name: Binance Leverage tiers update
on:
schedule:
- cron: "25 3 * * 4"
- cron: "25 2 * * 4"
# on demand
workflow_dispatch:
@@ -24,12 +24,8 @@ jobs:
with:
persist-credentials: false
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: "3.14"
- name: Install uv
uses: astral-sh/setup-uv@5a095e7a2014a4212f075830d4f7277575a9d098 # v7.3.1
- name: Install uv and Python 🐍
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
activate-environment: true
enable-cache: false
@@ -46,7 +42,7 @@ jobs:
run: python build_helpers/binance_update_lev_tiers.py
- uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0 # v8.1.0
- uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1
with:
token: ${{ secrets.REPO_SCOPED_TOKEN }}
add-paths: freqtrade/exchange/binance_leverage_tiers.json
+21 -42
View File
@@ -32,13 +32,8 @@ jobs:
with:
persist-credentials: false
- name: Set up Python 🐍
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
uses: astral-sh/setup-uv@5a095e7a2014a4212f075830d4f7277575a9d098 # v7.3.1
- name: Install uv and Python 🐍
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
activate-environment: true
enable-cache: true
@@ -73,7 +68,7 @@ jobs:
run: |
pytest --random-order --cov=freqtrade --cov=freqtrade_client --cov-config=.coveragerc
- uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
- uses: codecov/codecov-action@e79a6962e0d4c0c17b229090214935d2e33f8354 # v6.0.1
if: (runner.os == 'Linux' && matrix.python-version == '3.12' && matrix.os == 'ubuntu-24.04')
with:
fail_ci_if_error: true
@@ -155,7 +150,10 @@ jobs:
run: |
$PSVersionTable
Get-PSRepository | Format-List *
Set-PSRepository psgallery -InstallationPolicy trusted
if (-not (Get-PSRepository -Name PSGallery -ErrorAction SilentlyContinue)) {
Register-PSRepository -Default
}
Set-PSRepository PSGallery -InstallationPolicy Trusted
Install-Module -Name Pester -RequiredVersion 5.7.1 -Confirm:$false -Force -SkipPublisherCheck
$Error.clear()
Invoke-Pester -Path "tests" -CI
@@ -177,13 +175,8 @@ jobs:
with:
persist-credentials: false
- name: Set up Python 🐍
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 #v6.2.0
with:
python-version: "3.13"
- name: Install uv
uses: astral-sh/setup-uv@5a095e7a2014a4212f075830d4f7277575a9d098 # v7.3.1
- name: Install uv and Python 🐍
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
activate-environment: true
python-version: "3.13"
@@ -201,7 +194,8 @@ jobs:
with:
persist-credentials: false
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
- name: Set up Python 🐍
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: "3.13"
@@ -219,13 +213,8 @@ jobs:
run: |
./tests/test_docs.sh
- name: Set up Python 🐍
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: "3.13"
- name: Install uv
uses: astral-sh/setup-uv@5a095e7a2014a4212f075830d4f7277575a9d098 # v7.3.1
- name: Install uv and Python 🐍
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
activate-environment: true
python-version: "3.13"
@@ -256,13 +245,8 @@ jobs:
with:
persist-credentials: false
- name: Set up Python 🐍
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: "${{ matrix.python-version }}"
- name: Install uv
uses: astral-sh/setup-uv@5a095e7a2014a4212f075830d4f7277575a9d098 # v7.3.1
- name: Install uv and Python 🐍
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
activate-environment: true
enable-cache: true
@@ -328,13 +312,8 @@ jobs:
with:
persist-credentials: false
- name: Set up Python 🐍
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: "${{ matrix.python-version }}"
- name: Install uv
uses: astral-sh/setup-uv@5a095e7a2014a4212f075830d4f7277575a9d098 # v7.3.1
- name: Install uv and Python 🐍
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
activate-environment: true
python-version: "${{ matrix.python-version }}"
@@ -345,7 +324,7 @@ jobs:
python -m build --sdist --wheel
- name: Upload artifacts 📦
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: freqtrade-build
path: |
@@ -357,7 +336,7 @@ jobs:
python -m build --sdist --wheel ft_client
- name: Upload artifacts 📦
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: freqtrade-client-build
path: |
@@ -388,7 +367,7 @@ jobs:
merge-multiple: true
- name: Publish to PyPI (Test)
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0
with:
repository-url: https://test.pypi.org/legacy/
@@ -417,7 +396,7 @@ jobs:
merge-multiple: true
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0
docker-build:
+5 -5
View File
@@ -26,15 +26,15 @@ jobs:
with:
persist-credentials: true
- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
- name: Install uv and Python 🐍
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
python-version: '3.12'
activate-environment: true
python-version: '3.13'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r docs/requirements-docs.txt
uv pip install -r docs/requirements-docs.txt
- name: Fetch gh-pages branch
run: |
+2 -2
View File
@@ -31,13 +31,13 @@ jobs:
with:
persist-credentials: false
- name: Login to GitHub Container Registry
uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4.0.0
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pre-build dev container image
uses: devcontainers/ci@8bf61b26e9c3a98f69cb6ce2f88d24ff59b785c6 # v0.3.19
uses: devcontainers/ci@b63b30de439b47a52267f241112c5b453b673db5 # v0.3.1900000449
with:
subFolder: .github
imageName: ghcr.io/${{ github.repository }}-devcontainer
+3 -3
View File
@@ -59,7 +59,7 @@ jobs:
uses: ./.github/actions/docker-tags
- name: Login to Docker Hub
uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4.0.0
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
@@ -183,13 +183,13 @@ jobs:
uses: ./.github/actions/docker-tags
- name: Login to Docker Hub
uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4.0.0
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to github
uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4.0.0
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0
with:
registry: ghcr.io
username: ${{ github.actor }}
@@ -0,0 +1,53 @@
name: Pre-commit Types update
on:
pull_request:
branches:
- "develop"
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}"
cancel-in-progress: true
permissions: {}
jobs:
mypy-version-update:
name: "Pre-commit mypy type versions update"
runs-on: ubuntu-24.04
# Only run this job for pull requests created by dependabot[bot]
if: >
github.event.pull_request.user.login == 'dependabot[bot]' &&
github.repository == github.event.pull_request.head.repo.full_name &&
github.event_name == 'pull_request' &&
startsWith(github.head_ref, 'dependabot/')
environment:
name: dependabot-pulls
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: true
token: ${{ secrets.REPO_SCOPED_TOKEN_DEP }}
ref: ${{ github.head_ref || github.ref }}
- name: Install uv and Python 🐍
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
activate-environment: true
python-version: "3.13"
- name: Install PyYAML
run: |
- name: pre-commit dependencies
run: |
uv pip install $(grep -E "^pyyaml==" requirements-dev.txt)
python build_helpers/pre_commit_update.py --update
- uses: stefanzweifel/git-auto-commit-action@04702edda442b2e678b25b537cec683a1493fcb9 # v7
with:
commit_message: "chore(deps): Apply pre-commit types update"
commit_user_name: Freqtrade Bot
commit_user_email: 154552126+freqtrade-bot@users.noreply.github.com
commit_author: Freqtrade Bot <154552126+freqtrade-bot@users.noreply.github.com>
+4 -8
View File
@@ -2,7 +2,7 @@ name: Pre-commit auto-update
on:
schedule:
- cron: "0 3 * * 2"
- cron: "13 1 * * 2"
# on demand
workflow_dispatch:
@@ -25,12 +25,8 @@ jobs:
with:
persist-credentials: false
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: "3.13"
- name: Install uv
uses: astral-sh/setup-uv@5a095e7a2014a4212f075830d4f7277575a9d098 # v7.3.1
- name: Install uv and Python 🐍
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
activate-environment: true
python-version: "3.13"
@@ -41,7 +37,7 @@ jobs:
- name: Run auto-update
run: pre-commit autoupdate
- uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0 # v8.1.0
- uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1
with:
token: ${{ secrets.REPO_SCOPED_TOKEN }}
add-paths: .pre-commit-config.yaml
+1 -1
View File
@@ -31,4 +31,4 @@ jobs:
persist-credentials: false
- name: Run zizmor 🌈
uses: zizmorcore/zizmor-action@71321a20a9ded102f6e9ce5718a2fcec2c4f70d8 # v0.5.2
uses: zizmorcore/zizmor-action@b1d7e1fb5de872772f31590499237e7cce841e8e # v0.5.3
+9 -9
View File
@@ -15,23 +15,23 @@ repos:
- repo: https://github.com/pre-commit/mirrors-mypy
rev: "v1.19.1"
rev: "v2.1.0"
hooks:
- id: mypy
exclude: build_helpers
additional_dependencies:
- types-cachetools==6.2.0.20251022
- types-cachetools==7.0.0.20260503
- types-filelock==3.2.7
- types-requests==2.32.4.20260107
- types-tabulate==0.10.0.20260308
- types-python-dateutil==2.9.0.20260305
- scipy-stubs==1.17.1.2
- SQLAlchemy==2.0.48
- types-requests==2.33.0.20260508
- types-tabulate==0.10.0.20260508
- types-python-dateutil==2.9.0.20260508
- scipy-stubs==1.17.1.4
- SQLAlchemy==2.0.49
# stages: [push]
- repo: https://github.com/charliermarsh/ruff-pre-commit
# Ruff version.
rev: 'v0.15.7'
rev: 'v0.15.13'
hooks:
- id: ruff
- id: ruff-format
@@ -70,6 +70,6 @@ repos:
# Ensure github actions remain safe
- repo: https://github.com/woodruffw/zizmor-pre-commit
rev: v1.23.1
rev: v1.24.1
hooks:
- id: zizmor
+1 -1
View File
@@ -1,4 +1,4 @@
FROM python:3.13.12-slim-trixie AS base
FROM python:3.14.5-slim-trixie AS base
# Setup env
ENV LANG=C.UTF-8
+1 -1
View File
@@ -87,7 +87,7 @@ def extract_command_partials():
help_output = _get_help_output(subparser)
_write_partial_file(f"docs/commands/{command}.md", help_output)
else:
print(f" Warning: subcommand '{command}' not found in parser")
print(f" Warning: subcommand '{command}' not found in parser")
# freqtrade-client still uses subprocess as requested
print("Running for freqtrade-client")
+42 -2
View File
@@ -1,5 +1,7 @@
# File used in CI to ensure pre-commit dependencies are kept up-to-date.
import argparse
import re
import sys
from pathlib import Path
@@ -10,6 +12,24 @@ pre_commit_file = Path(".pre-commit-config.yaml")
require_dev = Path("requirements-dev.txt")
require = Path("requirements.txt")
parser = argparse.ArgumentParser()
parser.add_argument("--update", action="store_true")
args = parser.parse_args()
def replace_dependency_version(pre_commit_text: str, dependency: str) -> tuple[str, bool]:
"""
Regex-based replacement of a dependency version in the pre-commit config file.
using regex here ensures we only replace the version of the dependency while
keeping the overall file intact.
"""
package_name = dependency.split("==", 1)[0]
pattern = re.compile(rf"^(\s*-\s+){re.escape(package_name)}==.*$", re.MULTILINE)
updated_text, replacements = pattern.subn(rf"\1{dependency}", pre_commit_text, count=1)
return updated_text, replacements > 0 and updated_text != pre_commit_text
with require_dev.open("r") as rfile:
requirements = rfile.readlines()
@@ -23,6 +43,18 @@ supported = ("types-", "SQLAlchemy", "scipy-stubs")
# Only keep the first part of the line up to the first space
type_reqs = [r.strip("\n").split()[0] for r in requirements if r.startswith(supported)]
with pre_commit_file.open("r") as file:
pre_commit_text = file.read()
updated = False
for req in type_reqs:
pre_commit_text, req_updated = replace_dependency_version(pre_commit_text, req)
updated = updated or req_updated
if args.update and updated:
with pre_commit_file.open("w") as file:
file.write(pre_commit_text)
with pre_commit_file.open("r") as file:
f = yaml.load(file, Loader=yaml.SafeLoader)
@@ -40,12 +72,20 @@ for hook in hooks:
for req in type_reqs:
if req not in hooks:
errors.append(f"{req} is missing in pre-config file.")
errors.append(f"{req} is missing in pre-commit config file.")
if updated:
if args.update:
errors.append(".pre-commit-config.yaml was updated to match the requirements files.")
else:
errors.append(
".pre-commit-config.yaml is outdated. Run build_helpers/pre_commit_update.py --update."
)
if errors:
for e in errors:
print(e)
sys.exit(1)
sys.exit(1 if not (args.update and updated) else 0)
sys.exit(0)
+6 -1
View File
@@ -283,6 +283,10 @@
"month"
]
},
"skip_wallet_history_migration": {
"description": "Disable wallet history migration.",
"type": "boolean"
},
"hyperopt_path": {
"description": "Specify additional lookup path for Hyperopt Loss functions.",
"type": "string"
@@ -1059,7 +1063,8 @@
"jwt_secret_key": {
"description": "Secret key for JWT authentication.",
"type": "string",
"default": "somethingRandomSomethingRandom123"
"default": "somethingRandomSomethingRandom123",
"minLength": 32
},
"CORS_origins": {
"description": "List of allowed CORS origins.",
+1 -1
View File
@@ -1,4 +1,4 @@
FROM python:3.11.14-slim-bookworm AS base
FROM python:3.11.15-slim-bookworm AS base
# Setup env
ENV LANG=C.UTF-8
+203 -162
View File
@@ -160,117 +160,131 @@ 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 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 USDT89.425 / -34.651
Best Pair │ LTC/USDT:USDT 5.62%
Worst Pair │ ADA/USDT:USDT -5.21%
Best tradeETC/USDT:USDT 2.00%
Worst trade │ ADA/USDT:USDT -10.17%
Best day26.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 change30.51%
└───────────────────────────────┴─────────────────────────────────┘
BACKTESTING REPORT
┏━━━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Pair ┃ Trades ┃ Avg Profit % ┃ Tot Profit ┃ Tot Profit % ┃ Avg Duration ┃ Win Draw Loss Win% ┃
┡━━━━━━━━━━━━━━━╇━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━┩
│ LTC/USDT:USDT │ 16 │ 1.01 │ 56.882 │ 5.69 │ 16:16:00 │ 16 0 0 100 │
│ ETC/USDT:USDT │ 12 │ 0.7331.513 │ 3.15 │ 9:55:00 │ 11 0 1 91.7 │
│ ETH/USDT:USDT │ 8 │ 0.6918.659 │ 1.87 │ 1 day, 13:55:00 │ 7 0 1 87.5 │
│ XLM/USDT:USDT │ 10 │ 0.3 │ 10.694 │ 1.07 │ 12:08:00 │ 9 0 1 90.0 │
│ BTC/USDT:USDT │ 8 │ 0.22 │ 7.502 │ 0.75 │ 3 days, 1:24:00 │ 6 0 2 75.0 │
│ XRP/USDT:USDT │ 9 │ -0.13-6.837 │ -0.68 │ 21:18:00 │ 8 0 1 88.9 │
│ DOT/USDT:USDT │ 6 │ -0.39 │ -9.169 │ -0.92 │ 5:35:00 │ 4 0 2 66.7 │
│ ADA/USDT:USDT │ 8 │ -1.75 │ -52.089 │ -5.21 │ 11:38:00 │ 6 0 2 75.0 │
│ TOTAL │ 77 │ 0.2357.157 │ 5.72 │ 22:12:00 │ 67 0 10 87.0 │
└───────────────┴────────┴──────────────┴─────────────┴──────────────┴─────────────────┴────────────────────────┘
LEFT OPEN TRADES REPORT
┏━━━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Pair ┃ Trades ┃ Avg Profit % ┃ Tot Profit ┃ 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.166 │ -1.92 │ 11:30:00 │ 0 0 1 0 │
│ TOTAL │ 3 │ -4.56 │ -44.461 │ -4.45 │ 6 days, 2:03:00 │ 0 0 3 0 │
└───────────────┴────────┴──────────────┴─────────────┴──────────────┴──────────────────┴────────────────────────┘
ENTER TAG STATS
┏━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Enter Tag ┃ Entries ┃ Avg Profit % ┃ Tot Profit ┃ Tot Profit % ┃ Avg Duration ┃ Win Draw Loss Win% ┃
┡━━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━┩
│ OTHER │ 77 │ 0.2357.157 │ 5.72 │ 22:12:00 │ 67 0 10 87.0 │
│ TOTAL │ 77 │ 0.2357.157 │ 5.72 │ 22:12:00 │ 67 0 10 87.0 │
└───────────┴─────────┴──────────────┴─────────────┴──────────────┴──────────────┴────────────────────────┘
EXIT REASON STATS
┏━━━━━━━━━━━━━┳━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Exit Reason ┃ Exits ┃ Avg Profit % ┃ Tot Profit ┃ Tot Profit % ┃ Avg Duration ┃ Win Draw Loss Win% ┃
┡━━━━━━━━━━━━━╇━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━┩
│ roi │ 67 │ 1.06245.117 │ 24.51 │ 15:49:00 │ 67 0 0 100 │
│ exit_signal │ 4 │ -2.23 │ -31.226 │ -3.12 │ 1 day, 8:38:00 │ 0 0 4 0 │
│ force_exit │ 3 │ -4.56 │ -44.461 │ -4.45 │ 6 days, 2:03:00 │ 0 0 3 0 │
│ stop_loss │ 3 │ -10.14 │ -112.273 │ -11.23 │ 1 day, 3:05:00 │ 0 0 3 0 │
│ TOTAL │ 77 │ 0.2357.157 │ 5.72 │ 22:12:00 │ 67 0 10 87.0 │
└─────────────┴───────┴──────────────┴─────────────┴──────────────┴─────────────────┴────────────────────────┘
MIXED TAG STATS
┏━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Enter Tag ┃ Exit Reason ┃ Trades ┃ Avg Profit % ┃ Tot Profit ┃ Tot Profit % ┃ Avg Duration ┃ Win Draw Loss Win% ┃
┡━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━┩
│ │ roi │ 67 │ 1.06245.117 │ 24.51 │ 15:49:00 │ 67 0 0 100 │
│ │ exit_signal │ 4 │ -2.23 │ -31.226 │ -3.12 │ 1 day, 8:38:00 │ 0 0 4 0 │
│ │ force_exit │ 3 │ -4.56 │ -44.461 │ -4.45 │ 6 days, 2:03:00 │ 0 0 3 0 │
│ │ stop_loss │ 3 │ -10.14 │ -112.273 │ -11.23 │ 1 day, 3:05:00 │ 0 0 3 0 │
│ TOTAL │ │ 77 │ 0.2357.157 │ 5.72 │ 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 │ 1057.157 USDT
│ Absolute profit │ 57.157 USDT
│ Total profit % │ 5.72%
│ CAGR % │ 92.41%
│ Sharpe (closed trades)3.89
│ Sortino (closed trades)2.57
│ Calmar (closed trades) │ 43.03
│ SQN │ 0.71
│ Profit factor │ 1.30
│ Expectancy (Ratio) │ 0.74 (0.04)
│ Avg. daily profit │ 1.844 USDT
│ Avg. stake amount │ 345.478 USDT
Market change │ 30.51%
Total trade volume │ 53390.788 USDT
│ Long / Short trades │ 67 / 10
│ Long / Short profit % │ 9.19% / -3.48%
Long / Short profit USDT │ 91.940 / -34.783
Best Pair │ LTC/USDT:USDT 5.69%
Worst Pair ADA/USDT:USDT -5.21%
Best trade │ XRP/USDT:USDT 2.00%
Worst trade ADA/USDT:USDT -10.17%
Best day │ 27.031 USDT
Worst day │ -47.826 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/Max balance (closed trades) │ 1003.205 USDT / 1151.425 USDT │
│ Max % of account underwater │ 8.19%
│ Absolute drawdown │ 94.268 USDT (8.19%)
│ Drawdown duration │ 9 days 08:50:00
│ Profit at drawdown start │ 151.425 USDT
│ Profit at drawdown end │ 57.157 USDT
│ Drawdown start │ 2025-07-22 15:10:00
│ Drawdown end │ 2025-08-01 00:00:00
│ Wallet based Metrics │ │
│ Min/Max balance (wallet balance) │ 1000 USDT / 1151.425 USDT │
│ Min/Max balance dates (wallet balance) │ 2025-07-01 00:05:00 / 2025-07-22 15:15:00 │
│ Max % of account underwater (balance) │ 5.01% │
│ Absolute drawdown (wallet balance) │ 54.76 USDT (4.76%) │
│ Drawdown duration │ 7 days 20:35:00 │
│ Profit at drawdown start │ 151.425 USDT │
│ Profit at drawdown end │ 96.664 USDT │
│ Drawdown start │ 2025-07-22 15:15:00 │
│ Drawdown end │ 2025-07-30 11:50:00 │
│ Sharpe (daily wallet balance) │ 4.42 │
│ Sortino (daily wallet balance) │ 4.35 │
│ Calmar (daily wallet balance) │ 136.07 │
└────────────────────────────────────────┴───────────────────────────────────────────┘
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% │
└────────────────┴────────┴──────────────┴─────────────────┴──────────────┴──────────────┴────────────────────────┴────────────────────
STRATEGY SUMMARY
┏━━━━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┓
┃ Strategy ┃ Trades ┃ Avg Profit % ┃ Tot Profit ┃ Tot Profit % ┃ Avg Duration ┃ Win Draw Loss Win% ┃ Drawdown ┃
┡━━━━━━━━━━━━━━━━╇━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━┩
│ SampleStrategy │ 77 │ 0.2357.157 │ 5.72 │ 22:12:00 │ 67 0 10 87.0 │ 94.268 8.19% │
└────────────────┴────────┴──────────────┴─────────────┴──────────────┴──────────────┴────────────────────────┴────────────────┘
```
### Backtesting report table
@@ -329,54 +343,72 @@ The last element of the backtest report is the summary metrics table.
It contains key metrics about the performance of your strategy on backtesting data.
```
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Metric ┃ Value ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ Backtesting from │ 2025-07-01 00:00:00 │
│ Backtesting to │ 2025-08-01 00:00:00 │
Trading Mode │ Isolated Futures
Max open trades3
│ │
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%
Sortino4.99
│ Sharpe │ 8.00
Calmar │ 77.76
SQN 1.52
Profit factor1.79
Expectancy (Ratio) │ 1.48 (0.07)
Avg. daily profit │ 3.443 USDT
│ Avg. stake amount363.133 USDT
Total trade volume │ 52466.174 USDT
│ │
Best PairLTC/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 end2025-08-01 00:00:00
Market change30.51%
└───────────────────────────────┴─────────────────────────────────┘
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 │ 1057.157 USDT
Absolute profit 57.157 USDT
Total profit % 5.72%
CAGR % 92.41%
│ Sharpe (closed trades) │ 3.89
Sortino (closed trades) │ 2.57
Calmar (closed trades)43.03
SQN 0.71
Profit factor │ 1.30
Expectancy (Ratio) │ 0.74 (0.04)
│ Avg. daily profit 1.844 USDT
Avg. stake amount │ 345.478 USDT
Market change 30.51%
Total trade volume53390.788 USDT
Long / Short trades67 / 10
Long / Short profit %9.19% / -3.48%
Long / Short profit USDT │ 91.940 / -34.783
Best Pair │ LTC/USDT:USDT 5.69%
Worst Pair │ ADA/USDT:USDT -5.21%
Best trade │ XRP/USDT:USDT 2.00%
Worst trade │ ADA/USDT:USDT -10.17%
Best day │ 27.031 USDT
Worst day │ -47.826 USDT
Days win/draw/lose20 / 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/Max balance (closed trades) │ 1003.205 USDT / 1151.425 USDT
Max % of account underwater │ 8.19%
Absolute drawdown 94.268 USDT (8.19%)
Drawdown duration 9 days 08:50:00
│ Profit at drawdown start │ 151.425 USDT │
│ Profit at drawdown end │ 57.157 USDT │
│ Drawdown start │ 2025-07-22 15:10:00 │
│ Drawdown end │ 2025-08-01 00:00:00 │
│ │ │
│ Wallet based Metrics │ │
│ Min/Max balance (wallet balance) │ 1000 USDT / 1151.425 USDT │
│ Min/Max balance dates (wallet balance) │ 2025-07-01 00:05:00 / 2025-07-22 15:15:00 │
│ Max % of account underwater (balance) │ 5.01% │
│ Absolute drawdown (wallet balance) │ 54.76 USDT (4.76%) │
│ Drawdown duration │ 7 days 20:35:00 │
│ Profit at drawdown start │ 151.425 USDT │
│ Profit at drawdown end │ 96.664 USDT │
│ Drawdown start │ 2025-07-22 15:15:00 │
│ Drawdown end │ 2025-07-30 11:50:00 │
│ Sharpe (daily wallet balance) │ 4.42 │
│ Sortino (daily wallet balance) │ 4.35 │
│ Calmar (daily wallet balance) │ 136.07 │
└────────────────────────────────────────┴───────────────────────────────────────────┘
```
- `Backtesting from` / `Backtesting to`: Backtesting range (usually defined with the `--timerange` option).
@@ -388,14 +420,15 @@ It contains key metrics about the performance of your strategy on backtesting da
- `Absolute profit`: Profit made in stake currency.
- `Total profit %`: Total profit. Aligned to the `TOTAL` row's `Tot Profit %` from the first table. Calculated as `(End capital Starting capital) / Starting capital`.
- `CAGR %`: Compound annual growth rate.
- `Sortino`: Annualized Sortino ratio.
- `Sharpe`: Annualized Sharpe ratio.
- `Calmar`: Annualized Calmar ratio.
- `Sharpe (closed trades)`: Annualized Sharpe ratio including only closed trades (ignoring open trades with profits or losses).
- `Sortino (closed trades)`: Annualized Sortino ratio including only closed trades (ignoring open trades with profits or losses).
- `Calmar (closed trades)`: Annualized Calmar ratio including only closed trades (ignoring open trades with profits or losses).
- `SQN`: System Quality Number (SQN) - by Van Tharp.
- `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.
- `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.
- `Total trade volume`: Volume generated on the exchange to reach the above profit.
- `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).
@@ -409,13 +442,21 @@ It contains key metrics about the performance of your strategy on backtesting da
- `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).
- `Min balance` / `Max balance`: Lowest and Highest Wallet balance during the backtest period.
- `Min/Max balance (closed trades)`: Lowest and Highest Wallet balance during the backtest period based on closed trades trades.
- `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)`..
- `Absolute drawdown (wallet balance)`: Maximum absolute drawdown experienced based on the unrealized balance, 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.
- `Min/Max balance (wallet balance)`: Lowest and Highest Wallet balance during the backtest period - including capital tied in open trades.
- `Min/Max balance dates (wallet balance)`: Dates when the minimum and maximum unrealized balance occurred.
- `Sharpe (wallet balance)` Annualized Sharpe ratio calculation including unrealized profits.
- `Sortino (wallet balance)` Annualized Sortino ratio calculation including unrealized profits.
- `Calmar (wallet balance)` Annualized Calmar ratio calculation including unrealized profits.
!!! Tip "Wallet based Metrics"
The metrics under the "Wallet based Metrics" section are calculated based on the unrealized balance, which includes the capital tied in open trades. This provides a more comprehensive view of the strategy's performance, as it accounts for both realized and unrealized profits and losses.
### Daily / Weekly / Monthly / Yearly breakdown
+37 -9
View File
@@ -345,6 +345,15 @@ API Keys for live futures trading must have the following permissions:
We do strongly recommend to limit all API keys to the IP you're going to use it from.
### Bybit Demo Mode
Bybit has a [demo mode](https://learn.bybit.com/en/bybit-guide/how-to-use-bybit-demo-trading) - which can be activated by setting `exchange.demo_trading` to `true` in the configuration.
Bybit uses live markets to simulate your trades (without market impact) - making it work very similar to freqtrade's dry-run mode.
You'll need to use separate API keys for demo trading, which you can create on bybit's demo page.
Demo mode is incompatible with dry-run.
## Bitmart
Bitmart requires the API key Memo (the name you give the API key) to go along with the exchange key and secret.
@@ -429,31 +438,50 @@ Hyperliquid handles deposits and withdrawals on the Arbitrum One chain, a Layer
* Create a different software wallet, only transfer the funds you want to trade with to that wallet, and use that wallet to trade on Hyperliquid.
* If you have funds you don't want to use for trading (after making a profit for example), transfer them back to your hardware wallet.
### Hyperliquid Vault / Subaccount
Hyperliquid allows you to create either a vault or a subaccount.
To use these with Freqtrade, you will need to use the following configuration pattern:
!!! Warning "Vaults and Subaccounts"
You can only use either a vault or a subaccount - not both at the same time.
### Hyperliquid Subaccount
Hyperliquid allows you to create subaccounts with sufficient previous trading volume.
To use subaccounts with Freqtrade, you will need to use the following configuration pattern:
``` json
"exchange": {
"name": "hyperliquid",
"walletAddress": "your_master_wallet_address", // Your master wallet address (not the API wallet address and not the vault/subaccount address).
"walletAddress": "your_master_wallet_address", // Your master wallet address (not the API wallet or vault address - but not subaccount address).
"privateKey": "your_api_private_key", // API wallet private key (see https://app.hyperliquid.xyz/API). You'll only need the private key.
"ccxt_config": {
"options": {
"vaultAddress": "your_vault_address", // Optional, only if you want to use a vault ...
"subAccountAddress": "your_subaccount_address" // OR optional, only if you want to use a subaccount
"subAccountAddress": "your_subaccount_address" // Required if you want to use a subaccount.
}
},
// ...
}
```
Your balance and trades will now be used from your vault / subaccount - and no longer from your main account.
Your balance and trades will now be used from your subaccount - and no longer from your main account.
!!! Note
You can only use either a vault or a subaccount - not both at the same time.
### Hyperliquid Vault
Hyperliquid allows you to create vaults. To use vaults with Freqtrade, you will need to use the following configuration pattern:
``` json
"exchange": {
"name": "hyperliquid",
"walletAddress": "your_vault_address", // Your vault wallet address (Must also be added below in the ccxt_config.options.vaultAddress field)
"privateKey": "your_api_private_key", // API wallet private key (see https://app.hyperliquid.xyz/API). You'll only need the private key.
"ccxt_config": {
"options": {
"vaultAddress": "your_vault_address", // Optional, only if you want to use a vault ... (vault address must also be added to walletAdress)
}
},
// ...
}
```
Your balance and trades will now be used from your vault - and no longer from your main account.
### Historic Hyperliquid data
+2 -2
View File
@@ -2,7 +2,7 @@
## Supported Markets
Freqtrade supports spot trading, as well as futures trading for some selected exchanges. Please refer to the [documentation start page](index.md#supported-futures-exchanges-experimental) for an up-to-date list of supported exchanges.
Freqtrade supports spot trading, as well as futures trading for some selected exchanges. Please refer to the [documentation start page](index.md#supported-futures-exchanges) for an up-to-date list of supported exchanges.
### Can my bot open short positions?
@@ -14,7 +14,7 @@ In spot markets, you can in some cases use leveraged spot tokens, which reflect
### Can my bot trade options or futures?
Futures trading is supported for selected exchanges. Please refer to the [documentation start page](index.md#supported-futures-exchanges-experimental) for an up-to-date list of supported exchanges.
Futures trading is supported for selected exchanges. Please refer to the [documentation start page](index.md#supported-futures-exchanges) for an up-to-date list of supported exchanges.
## Beginner Tips & Tricks
+17
View File
@@ -46,6 +46,23 @@ On this page, you can also interact with the bot by starting and stopping it and
![FreqUI - trade view](assets/freqUI-trade-pane-dark.png#only-dark)
![FreqUI - trade view](assets/freqUI-trade-pane-light.png#only-light)
### Dashboard
The dashboard view provides an overview of the bot's performance and status.
If multiple bots are connected, the dashboard will show an overview of all connected bots, allowing you to easily switch between them or show just a subset of available bots.
#### Wallet Balance
New in freqtrade 2026.4: This shows the balance of the bot over time.
Compared to the "cumulative Profit" chart, this chart will show the actual balance of the bot over time, including unrealized profit and losses, as well as deposits and withdrawals.
Historic data has re-populated based on available exchange data - however is assumed to be best-effort and may not be 100% accurate.
More specifically, it won't cover deposits and withdrawals, and will assume a starting balance of current balance - profit/losses.
For clarity - a "Capture start" marker line is shown on the chart, which indicates the point at which the migration to the new wallet balance tracking system happened.
Only beyond this point, the wallet balance is expected to be accurate.
### Plot Configurator
FreqUI Plots can be configured either via a `plot_config` configuration object in the strategy (which can be loaded via "from strategy" button) or via the UI.
+1 -1
View File
@@ -166,7 +166,7 @@ Below are the values you can expect to include/use inside a typical strategy dat
| `df['do_predict']` | Indication of an outlier data point. The return value is integer between -2 and 2, which lets you know if the prediction is trustworthy or not. `do_predict==1` means that the prediction is trustworthy. If the Dissimilarity Index (DI, see details [here](freqai-feature-engineering.md#identifying-outliers-with-the-dissimilarity-index-di)) of the input data point is above the threshold defined in the config, FreqAI will subtract 1 from `do_predict`, resulting in `do_predict==0`. If `use_SVM_to_remove_outliers` is active, the Support Vector Machine (SVM, see details [here](freqai-feature-engineering.md#identifying-outliers-using-a-support-vector-machine-svm)) may also detect outliers in training and prediction data. In this case, the SVM will also subtract 1 from `do_predict`. If the input data point was considered an outlier by the SVM but not by the DI, or vice versa, the result will be `do_predict==0`. If both the DI and the SVM considers the input data point to be an outlier, the result will be `do_predict==-1`. As with the SVM, if `use_DBSCAN_to_remove_outliers` is active, DBSCAN (see details [here](freqai-feature-engineering.md#identifying-outliers-with-dbscan)) may also detect outliers and subtract 1 from `do_predict`. Hence, if both the SVM and DBSCAN are active and identify a datapoint that was above the DI threshold as an outlier, the result will be `do_predict==-2`. A particular case is when `do_predict == 2`, which means that the model has expired due to exceeding `expired_hours`. <br> **Datatype:** Integer between -2 and 2.
| `df['DI_values']` | Dissimilarity Index (DI) values are proxies for the level of confidence FreqAI has in the prediction. A lower DI means the prediction is close to the training data, i.e., higher prediction confidence. See details about the DI [here](freqai-feature-engineering.md#identifying-outliers-with-the-dissimilarity-index-di). <br> **Datatype:** Float.
| `df['%*']` | Any dataframe column prepended with `%` in `feature_engineering_*()` is treated as a training feature. For example, you can include the RSI in the training feature set (similar to in `templates/FreqaiExampleStrategy.py`) by setting `df['%-rsi']`. See more details on how this is done [here](freqai-feature-engineering.md). <br> **Note:** Since the number of features prepended with `%` can multiply very quickly (10s of thousands of features are easily engineered using the multiplictative functionality of, e.g., `include_shifted_candles` and `include_timeframes` as described in the [parameter table](freqai-parameter-table.md)), these features are removed from the dataframe that is returned from FreqAI to the strategy. To keep a particular type of feature for plotting purposes, you would prepend it with `%%` (see details below). <br> **Datatype:** Depends on the feature created by the user.
| `df['%%*']` | Any dataframe column prepended with `%%` in `feature_engineering_*()` is treated as a training feature, just the same as the above `%` prepend. However, in this case, the features are returned back to the strategy for FreqUI/plot-dataframe plotting and monitoring in Dry/Live/Backtesting <br> **Datatype:** Depends on the feature created by the user. Please note that features created in `feature_engineering_expand()` will have automatic FreqAI naming schemas depending on the expansions that you configured (i.e. `include_timeframes`, `include_corr_pairlist`, `indicators_periods_candles`, `include_shifted_candles`). So if you want to plot `%%-rsi` from `feature_engineering_expand_all()`, the final naming scheme for your plotting config would be: `%%-rsi-period_10_ETH/USDT:USDT_1h` for the `rsi` feature with `period=10`, `timeframe=1h`, and `pair=ETH/USDT:USDT` (the `:USDT` is added if you are using futures pairs). It is useful to simply add `print(dataframe.columns)` in your `populate_indicators()` after `self.freqai.start()` to see the full list of available features that are returned to the strategy for plotting purposes.
| `df['%%*']` | Any dataframe column prepended with `%%` in `feature_engineering_*()` is treated as a training feature, just the same as the above `%` prepend. However, in this case, the features are returned back to the strategy for FreqUI/plot-dataframe plotting and monitoring in Dry/Live/Backtesting <br> **Datatype:** Depends on the feature created by the user. <br>*Please note* that features created in `feature_engineering_expand()` will have automatic FreqAI naming schemas depending on the expansions that you configured (i.e. `include_timeframes`, `include_corr_pairlist`, `indicators_periods_candles`, `include_shifted_candles`). So if you want to plot `%%-rsi` from `feature_engineering_expand_all()`, the final naming scheme for your plotting config would be: `%%-rsi-period_10_ETH/USDT:USDT_1h` for the `rsi` feature with `period=10`, `timeframe=1h`, and `pair=ETH/USDT:USDT` (the `:USDT` is added if you are using futures pairs). It is useful to simply add `print(dataframe.columns)` in your `populate_indicators()` after `self.freqai.start()` to see the full list of available features that are returned to the strategy for plotting purposes.
## Setting the `startup_candle_count`
+4 -4
View File
@@ -111,10 +111,10 @@ It also allows multiple subplots to display both MACD and RSI at the same time.
Plot type can be configured using `type` key. Possible types are:
* `scatter` corresponding to `plotly.graph_objects.Scatter` class (default).
* `bar` corresponding to `plotly.graph_objects.Bar` class.
* `scatter` corresponding a scatter plot.
* `bar` corresponding to a bar plot.
Extra parameters to `plotly.graph_objects.*` constructor can be specified in `plotly` dict.
Extra parameters to `plotly.graph_objects.*` constructor can be specified in `plotly` dict - these are only supported when using plotly as plotting library and will be ignored when using freq-ui.
Sample configuration with inline comments explaining the process:
@@ -163,7 +163,7 @@ def plot_config(self):
```
??? Note "As attribute (former method)"
Assigning plot_config is also possible as Attribute (this used to be the default way).
Assigning `plot_config` is also possible as Attribute (this used to be the default way).
This has the disadvantage that strategy parameters are not available, preventing certain configurations from working.
``` python
+3 -3
View File
@@ -1,7 +1,7 @@
markdown==3.10.2
mkdocs==1.6.1
mkdocs-material==9.7.5
mkdocs-material==9.7.6
mdx_truly_sane_lists==1.3
pymdown-extensions==10.21
pymdown-extensions==10.21.3
jinja2==3.1.6
mike==2.1.4
mike==2.2.0
+9 -9
View File
@@ -202,20 +202,20 @@ All endpoints in the below table need to be prefixed with the base URL of the AP
| `/blacklist` | GET | Show the current blacklist.
| `/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**
| `/pair_history` | POST | Returns an analyzed dataframe for a given timerange, analyzed by a given strategy, filtered by a provided list of columns to return. **Alpha**<br/>*Params:*<br/>- `<column_list>` (`list[str]`)
| `/plot_config` | GET | Get plot config from the strategy (or nothing if not configured). **Alpha**
| `/strategies` | GET | List strategies in strategy directory. **Alpha**
| `/strategy/<strategy>` | GET | Get specific Strategy content by strategy class name. **Alpha**<br/>*Params:*<br/>- `<strategy>` (`str`)
| `/available_pairs` | GET | List available backtest data. **Alpha**
| `/pair_candles` | GET | Returns dataframe for a pair / timeframe combination while the bot is running.
| `/pair_candles` | POST | Returns dataframe for a pair / timeframe combination while the bot is running, filtered by a provided list of columns to return.<br/>*Params:*<br/>- `<column_list>` (`list[str]`)
| `/pair_history` | GET | Returns an analyzed dataframe for a given timerange, analyzed by a given strategy.
| `/pair_history` | POST | Returns an analyzed dataframe for a given timerange, analyzed by a given strategy, filtered by a provided list of columns to return.<br/>*Params:*<br/>- `<column_list>` (`list[str]`)
| `/plot_config` | GET | Get plot config from the strategy (or nothing if not configured).
| `/strategies` | GET | List strategies in strategy directory.
| `/strategy/<strategy>` | GET | Get specific Strategy content by strategy class name.<br/>*Params:*<br/>- `<strategy>` (`str`)
| `/available_pairs` | GET | List available backtest data.
| `/version` | GET | Show version.
| `/sysinfo` | GET | Show information about the system load.
| `/health` | GET | Show bot health (last bot loop).
!!! Warning "Alpha status"
Endpoints labeled with *Alpha status* above may change at any time without notice.
Endpoints labeled with *Alpha status* or *Beta status* above may change at any time without notice.
### Message WebSocket
+16
View File
@@ -39,6 +39,22 @@ The Order-type will be ignored if only one mode is available.
In that case, the bot will fallback to using the `emergency_exit` order type to place a market order as placing the stoploss order failed.
Freqtrade currently does not implement a limitation to avoid this situation, so please ensure your stoploss values are within reasonable limits for your exchange or disable stoploss on exchange.
### Which order type is used for stoploss on exchange?
The order type used for stoploss on exchange is determined by the `stoploss` value and the exchange capabilities.
If your selected exchange supports both stop-limit and stop-market orders, then the `stoploss` value will determine which order type is used for stoploss on exchange.
If your exchange only supports one of the two order types, you must configure your `stoploss` value accordingly, otherwise the bot will fail to start.
### Which order type should i use for stoploss on exchange?
If we translate the two stoploss order types into human words - they would be something like this:
* **stoploss-market** -> "when stop triggers, get me the hell out of here at whatever price".
* **stoploss-limit** -> "when stop triggers, place a limit order x% below the stoploss price. I accept a loss of "stoploss + 1%" at worst - but if price jumps further - i accept to wait for price to get back down to me, potentially resulting in a much bigger loss than "stoploss + 1%".
As a consequence, we recommend using stoploss-market orders whenever possible, as the main point of a stoploss is to get you out of a position when the market is crashing, and in such situations, you'll want to exit the position immediately at the best available price, rather than risking a limit order not getting filled and potentially incurring even greater losses.
The choice is ultimately up to you, but please be aware of the risk of using stoploss-limit orders, especially in volatile markets.
### stoploss_on_exchange and stoploss_on_exchange_limit_ratio
Enable or Disable stop loss on exchange.
+2
View File
@@ -910,6 +910,8 @@ if self.dp.runmode.value in ('live', 'dry_run'):
### *check_delisting(pair)*
Return Datetime of the pair delisting schedule if any, otherwise return None
```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'):
+1 -1
View File
@@ -1,6 +1,6 @@
"""Freqtrade bot"""
__version__ = "2026.3-dev"
__version__ = "2026.5-dev"
if "dev" in __version__:
from pathlib import Path
+3 -60
View File
@@ -8,15 +8,10 @@ logger = logging.getLogger(__name__)
def start_convert_db(args: dict[str, Any]) -> None:
from sqlalchemy import func, select
from sqlalchemy.orm import make_transient
from freqtrade.configuration.config_setup import setup_utils_configuration
from freqtrade.persistence import Order, Trade, init_db
from freqtrade.persistence.custom_data import _CustomData
from freqtrade.persistence.key_value_store import _KeyValueStoreModel
from freqtrade.persistence.migrations import set_sequence_ids
from freqtrade.persistence.pairlock import PairLock
from freqtrade.persistence import Trade, init_db
from freqtrade.persistence.db_migration import migrate_db
config = setup_utils_configuration(args, RunMode.UTIL_NO_EXCHANGE)
@@ -24,56 +19,4 @@ def start_convert_db(args: dict[str, Any]) -> None:
session_target = Trade.session
init_db(config["db_url_from"])
logger.info("Starting db migration.")
trade_count = 0
pairlock_count = 0
kv_count = 0
custom_data_count = 0
for trade in Trade.get_trades():
trade_count += 1
make_transient(trade)
for o in trade.orders:
make_transient(o)
session_target.add(trade)
session_target.commit()
for pairlock in PairLock.get_all_locks():
pairlock_count += 1
make_transient(pairlock)
session_target.add(pairlock)
session_target.commit()
for kv in _KeyValueStoreModel.session.scalars(select(_KeyValueStoreModel)):
kv_count += 1
make_transient(kv)
session_target.add(kv)
session_target.commit()
for cd in _CustomData.session.scalars(select(_CustomData)):
custom_data_count += 1
make_transient(cd)
session_target.add(cd)
session_target.commit()
# Update sequences
max_trade_id = session_target.scalar(select(func.max(Trade.id)))
max_order_id = session_target.scalar(select(func.max(Order.id)))
max_pairlock_id = session_target.scalar(select(func.max(PairLock.id)))
max_kv_id = session_target.scalar(select(func.max(_KeyValueStoreModel.id)))
max_custom_data_id = session_target.scalar(select(func.max(_CustomData.id)))
set_sequence_ids(
session_target.get_bind(),
trade_id=(max_trade_id or 0) + 1,
order_id=(max_order_id or 0) + 1,
pairlock_id=(max_pairlock_id or 0) + 1,
kv_id=(max_kv_id or 0) + 1,
custom_data_id=(max_custom_data_id or 0) + 1,
)
logger.info(
f"Migrated {trade_count} Trades, {pairlock_count} Pairlocks, "
f"{kv_count} Key-Value pairs, and {custom_data_count} Custom Data entries."
)
migrate_db(session_target)
+1 -1
View File
@@ -393,7 +393,7 @@ def start_show_trades(args: dict[str, Any]) -> None:
tfilter = []
if config.get("trade_ids"):
tfilter.append(Trade.id.in_(config["trade_ids"]))
tfilter.append(Trade.id.in_(int(tid) for tid in config["trade_ids"]))
trades = Trade.get_trades(tfilter).all()
logger.info(f"Printing {len(trades)} Trades: ")
+5
View File
@@ -236,6 +236,10 @@ CONF_SCHEMA = {
"type": "string",
"enum": BACKTEST_CACHE_AGE,
},
"skip_wallet_history_migration": {
"description": "Disable wallet history migration.",
"type": "boolean",
},
# Hyperopt
"hyperopt_path": {
"description": "Specify additional lookup path for Hyperopt Loss functions.",
@@ -753,6 +757,7 @@ CONF_SCHEMA = {
"description": "Secret key for JWT authentication.",
"type": "string",
"default": "somethingRandomSomethingRandom123",
"minLength": 32,
},
"CORS_origins": {
"description": "List of allowed CORS origins.",
@@ -92,6 +92,7 @@ def validate_config_consistency(conf: dict[str, Any], *, preliminary: bool = Fal
_validate_consumers(conf)
validate_migrated_strategy_settings(conf)
_validate_orderflow(conf)
_validate_demo_trading(conf)
# validate configuration before returning
logger.info("Validating configuration ...")
@@ -413,6 +414,11 @@ def _validate_orderflow(conf: dict[str, Any]) -> None:
)
def _validate_demo_trading(conf: dict[str, Any]) -> None:
if conf.get("exchange", {}).get("demo_trading", False) and conf.get("dry_run", False):
raise ConfigurationError("Demo trading cannot be used together with dry_run.")
def _strategy_settings(conf: dict[str, Any]) -> None:
process_deprecated_setting(conf, None, "use_sell_signal", None, "use_exit_signal")
process_deprecated_setting(conf, None, "sell_profit_only", None, "exit_profit_only")
+1
View File
@@ -7,6 +7,7 @@ from .bt_fileutils import (
get_backtest_market_change,
get_backtest_result,
get_backtest_resultlist,
get_backtest_wallet_change,
get_latest_backtest_filename,
get_latest_hyperopt_file,
get_latest_hyperopt_filename,
+27 -4
View File
@@ -10,7 +10,6 @@ from io import BytesIO, StringIO
from pathlib import Path
from typing import Any, Literal
import numpy as np
import pandas as pd
from freqtrade.constants import LAST_BT_RESULT_FN
@@ -308,10 +307,31 @@ def get_backtest_market_change(filename: Path, include_ts: bool = True) -> pd.Da
else:
df = pd.read_feather(filename)
if include_ts:
df.loc[:, "__date_ts"] = df.loc[:, "date"].astype(np.int64) // 1000 // 1000
df.loc[:, "__date_ts"] = df.loc[:, "date"].dt.as_unit("ms").astype("int64")
return df
def get_backtest_wallet_change(filename: Path, strategy_name: str) -> pd.DataFrame | None:
"""
Read backtest wallet change file.
:param filename: Path to the backtest result zip file
:param strategy_name: Name of the strategy to load
:return: DataFrame with wallet change data
"""
if filename.suffix != ".zip":
return None
try:
data = load_file_from_zip(filename, f"{filename.stem}_{strategy_name}_wallet.feather")
df = pd.read_feather(BytesIO(data))
df.loc[:, "__date_ts"] = df.loc[:, "date"].dt.as_unit("ms").astype("int64")
return df
except ValueError:
pass
return None
def find_existing_backtest_stats(
dirname: Path | str, run_ids: dict[str, str], min_backtest_date: datetime | None = None
) -> dict[str, Any]:
@@ -503,13 +523,16 @@ def load_backtest_analysis_data(
return None
def trade_list_to_dataframe(trades: list[Trade] | list[LocalTrade]) -> pd.DataFrame:
def trade_list_to_dataframe(
trades: list[Trade] | list[LocalTrade], *, minified: bool = True
) -> pd.DataFrame:
"""
Convert list of Trade objects to pandas Dataframe
:param trades: List of trade objects
:param minified: Whether to use minified version of trade JSON
:return: Dataframe with BT_DATA_COLUMNS
"""
df = pd.DataFrame.from_records([t.to_json(True) for t in trades], columns=BT_DATA_COLUMNS)
df = pd.DataFrame.from_records([t.to_json(minified) for t in trades], columns=BT_DATA_COLUMNS)
if len(df) > 0:
df["close_date"] = pd.to_datetime(df["close_timestamp"], unit="ms", utc=True)
df["open_date"] = pd.to_datetime(df["open_timestamp"], unit="ms", utc=True)
@@ -1,9 +1,15 @@
import logging
from datetime import datetime
import numpy as np
import pandas as pd
from freqtrade.constants import IntOrInf
from freqtrade.exchange import (
timeframe_to_prev_date,
timeframe_to_resample_freq,
)
from freqtrade.util import dt_from_ts
logger = logging.getLogger(__name__)
@@ -58,3 +64,95 @@ def evaluate_result_multi(
"""
df_final = analyze_trade_parallelism(trades, timeframe)
return df_final[df_final["open_trades"] > max_open_trades]
def balance_distribution_over_time(
trades: pd.DataFrame,
min_date: datetime,
max_date: datetime,
timeframe: str,
stake_currency: str,
start_balance: float,
pairlist: list[str],
) -> pd.DataFrame:
"""
Return a dataframe with stake_currency and the pairlist as columns
Each column will contain the amount of the currency at the given time
Columns added are:
- stake_currency: amount of stake currency
- <pair>: amount of base currency in the pair
- <pair>_leverage: leverage used for the pair at the time (NaN if no open trade)
- <pair>_is_short: 1 if the open trade is short, 0 if long (NaN if no open trade)
- <pair>_collateral: amount of stake currency used as collateral for open trades
:param trades: Trades Dataframe - can be loaded from backtest, or created
via trade_list_to_dataframe
:param timeframe: Frequency to use for the resulting dataframe
:param min_date: start date
:param max_date: End date (will be rounded down to timeframe)
:param stake_currency: The stake currency
:param start_balance: Starting balance in stake currency
:param pairlist: List of trading pairs to include in the dataframe
Can be obtained via trade_df["pair"].unique()
For pairs without trades, the column will be all zeros
:return: Dataframe with balance distribution over time
"""
min_date_res = timeframe_to_prev_date(timeframe, min_date)
max_date_res = timeframe_to_prev_date(timeframe, max_date)
index = pd.date_range(min_date_res, max_date_res, freq=timeframe_to_resample_freq(timeframe))
pairs_lev = [f"{pair}_leverage" for pair in pairlist]
pairs_is_short = [f"{pair}_is_short" for pair in pairlist]
pairs_collateral = [f"{pair}_collateral" for pair in pairlist]
pairs_lev += pairs_is_short
df = pd.DataFrame(
index=index, columns=[stake_currency] + pairlist + pairs_lev + pairs_collateral, dtype=float
)
# Initialize variables to starting values
df[stake_currency] = float(start_balance)
df[pairlist + pairs_collateral] = 0.0
df[pairs_lev] = np.nan
for trade in trades.sort_values(by=["open_date"]).itertuples():
pair = trade.pair
end_date = trade.close_date if trade.close_date is not pd.NaT else None
# Exclude open orders - these won't have order_filled_timestamp set.
df.loc[trade.open_date : end_date, f"{pair}_leverage"] = trade.leverage
df.loc[trade.open_date : end_date, f"{pair}_is_short"] = 1 if trade.is_short else 0
orders = [o for o in trade.orders if o["order_filled_timestamp"]]
current_position = 0
current_collateral = 0
for order in sorted(orders, key=lambda x: x["order_filled_timestamp"]):
filled_at = pd.Timestamp(dt_from_ts(order["order_filled_timestamp"]))
real_amount = order.get("filled", order["amount"])
stake = order["safe_price"] * real_amount
stake_no_lev = stake / trade.leverage
if order["ft_is_entry"]:
# Entry order: lock collateral and pay fee
# For both long and short: balance decreases by collateral + fee
fee_open = stake * trade.fee_open
current_position += real_amount
current_collateral += stake_no_lev
df.loc[filled_at:end_date, pair] += real_amount
df.loc[filled_at:end_date, f"{pair}_collateral"] += stake_no_lev
df.loc[filled_at:, stake_currency] -= stake_no_lev + fee_open
else:
# Exit order: release collateral and realize profit/loss
fee_close = stake * trade.fee_close
if trade.is_short:
# For SHORT
df.loc[filled_at:, stake_currency] += (
current_collateral * (1 + trade.leverage) - stake
) - fee_close
else:
# For LONG
df.loc[filled_at:, stake_currency] += (
stake - current_collateral * (trade.leverage - 1) - fee_close
)
df.loc[filled_at:end_date, pair] -= real_amount
df.loc[filled_at:end_date, f"{pair}_collateral"] -= stake_no_lev
current_position -= real_amount
current_collateral -= stake_no_lev
# Round to avoid floating point issues
df = df.round(14)
return df
@@ -1,6 +1,6 @@
import logging
from pandas import DataFrame, read_feather, to_datetime
from pandas import DataFrame, read_feather
from pyarrow import dataset
from freqtrade.configuration import TimeRange
@@ -71,7 +71,7 @@ class FeatherDataHandler(IDataHandler):
"volume": "float",
}
)
pairdata["date"] = to_datetime(pairdata["date"], unit="ms", utc=True)
pairdata["date"] = pairdata["date"].dt.as_unit("ms")
return pairdata
except Exception as e:
logger.exception(
@@ -1,6 +1,5 @@
import logging
import numpy as np
from pandas import DataFrame, read_json, to_datetime
from freqtrade import misc
@@ -35,8 +34,8 @@ class JsonDataHandler(IDataHandler):
filename = self._pair_data_filename(self._datadir, pair, timeframe, candle_type)
self.create_dir_if_needed(filename)
_data = data.copy()
# Convert date to int
_data["date"] = _data["date"].astype(np.int64) // 1000 // 1000
# Convert date to int (milliseconds)
_data["date"] = _data["date"].dt.as_unit("ms").astype("int64")
# Reset index, select only appropriate columns and save as json
_data.reset_index(drop=True).loc[:, self._columns].to_json(
@@ -81,7 +80,7 @@ class JsonDataHandler(IDataHandler):
"volume": "float",
}
)
pairdata["date"] = to_datetime(pairdata["date"], unit="ms", utc=True)
pairdata["date"] = to_datetime(pairdata["date"], unit="ms", utc=True).dt.as_unit("ms")
return pairdata
def ohlcv_append(
@@ -105,6 +104,9 @@ class JsonDataHandler(IDataHandler):
:param trading_mode: Trading mode to use (used to determine the filename)
"""
filename = self._pair_trades_filename(self._datadir, pair, trading_mode)
# Convert StringDtype columns to object to avoid NaN serialization issues
for col in data.select_dtypes(include="string").columns:
data[col] = data[col].astype(object).where(data[col].notna(), other=None)
trades = data.values.tolist()
misc.file_dump_json(filename, trades, is_zip=self._use_zip)
@@ -1,6 +1,6 @@
import logging
from pandas import DataFrame, read_parquet, to_datetime
from pandas import DataFrame, read_parquet
from freqtrade.configuration import TimeRange
from freqtrade.constants import DEFAULT_DATAFRAME_COLUMNS, DEFAULT_TRADES_COLUMNS
@@ -68,7 +68,7 @@ class ParquetDataHandler(IDataHandler):
"volume": "float",
}
)
pairdata["date"] = to_datetime(pairdata["date"], unit="ms", utc=True)
pairdata["date"] = pairdata["date"].dt.as_unit("ms")
return pairdata
except Exception as e:
logger.exception(
+196 -25
View File
@@ -140,7 +140,7 @@ def _calc_drawdown_series(
max_drawdown_df["drawdown_relative"] = (max_balance - cumulative_balance) / max_balance
else:
# NOTE: This is not completely accurate,
# but might good enough if starting_balance is not available
# but will be good enough if starting_balance is not available
max_drawdown_df["drawdown_relative"] = (
max_drawdown_df["high_value"] - max_drawdown_df["cumulative"]
) / max_drawdown_df["high_value"]
@@ -333,6 +333,72 @@ def calculate_expectancy(trades: pd.DataFrame) -> tuple[float, float]:
return expectancy, expectancy_ratio
def _calculate_annualized_ratio(
expected_returns_mean: float,
denominator: float,
annualization_factor: int = 365,
) -> float:
"""
Helper function to calculate annualized ratios like Sharpe and Sortino.
:param expected_returns_mean: Mean of the returns (expected returns)
:param denominator: Denominator of the ratio (e.g. standard deviation for Sharpe)
:param annualization_factor: Factor to annualize the ratio (default is 365 for daily returns)
:return: Annualized ratio, or -100.0 if denominator is zero or NaN to indicate this is
not optimal.
"""
if denominator != 0 and not np.isnan(denominator):
return float(expected_returns_mean / denominator * np.sqrt(annualization_factor))
# Define high (negative) ratio to be clear that this is NOT optimal.
return -100.0
def _calculate_daily_returns_from_balance(
balance_history: pd.DataFrame,
date_col: str,
balance_col: str,
) -> pd.Series:
wallet = _prepare_balance_history(balance_history, date_col, balance_col)
if len(wallet) == 0:
return pd.DataFrame(columns=[date_col, balance_col])
# Sample balance to daily end-of-day values to normalize variable snapshot frequency.
daily_balance = (
wallet.set_index(date_col)[balance_col].resample("1D").last().dropna().rename(balance_col)
)
daily_balance = daily_balance.reset_index()
if len(daily_balance) < 2:
return pd.Series(dtype=float)
return daily_balance[balance_col].pct_change().dropna()
def _prepare_balance_history(
balance_history: pd.DataFrame,
date_col: str,
balance_col: str,
) -> pd.DataFrame:
"""
Prepare balance history for calculations by filtering out rows with
missing date or balance values.
"""
if (
len(balance_history) == 0
or date_col not in balance_history
or balance_col not in balance_history
):
return pd.DataFrame(columns=[date_col, balance_col])
wallet = balance_history.loc[:, [date_col, balance_col]].copy()
wallet = wallet.dropna(subset=[date_col, balance_col]).sort_values(date_col)
if len(wallet) == 0:
return pd.DataFrame(columns=[date_col, balance_col])
return wallet
def calculate_sortino(
trades: pd.DataFrame,
min_date: datetime | None,
@@ -354,14 +420,31 @@ def calculate_sortino(
down_stdev = np.std(trades.loc[trades["profit_abs"] < 0, "profit_abs"] / starting_balance)
if down_stdev != 0 and not np.isnan(down_stdev):
sortino_ratio = expected_returns_mean / down_stdev * np.sqrt(365)
else:
# Define high (negative) sortino ratio to be clear that this is NOT optimal.
sortino_ratio = -100
return _calculate_annualized_ratio(expected_returns_mean, down_stdev)
# print(expected_returns_mean, down_stdev, sortino_ratio)
return sortino_ratio
def calculate_sortino_from_balance(
balance_history: pd.DataFrame,
date_col: str = "date",
balance_col: str = "total_quote",
) -> float:
"""
Calculate sortino ratio from historical balance snapshots.
:param balance_history: DataFrame containing at least date and balance columns
:param date_col: Column containing timestamps
:param balance_col: Column containing historical balance values
:return: sortino
"""
daily_returns = _calculate_daily_returns_from_balance(balance_history, date_col, balance_col)
if len(daily_returns) == 0:
return 0.0
expected_returns_mean = daily_returns.mean()
downside_returns = daily_returns[daily_returns < 0]
down_stdev = downside_returns.std(ddof=0)
return _calculate_annualized_ratio(expected_returns_mean, down_stdev)
def calculate_sharpe(
@@ -384,14 +467,67 @@ def calculate_sharpe(
expected_returns_mean = total_profit.sum() / days_period
up_stdev = np.std(total_profit)
if up_stdev != 0:
sharp_ratio = expected_returns_mean / up_stdev * np.sqrt(365)
else:
# Define high (negative) sharpe ratio to be clear that this is NOT optimal.
sharp_ratio = -100
return _calculate_annualized_ratio(expected_returns_mean, up_stdev)
# print(expected_returns_mean, up_stdev, sharp_ratio)
return sharp_ratio
def calculate_sharpe_from_balance(
balance_history: pd.DataFrame,
date_col: str = "date",
balance_col: str = "total_quote",
) -> float:
"""
Calculate sharpe ratio from historical balance snapshots.
:param balance_history: DataFrame containing at least date and balance columns
:param date_col: Column containing timestamps
:param balance_col: Column containing historical balance values
:return: sharpe
"""
daily_returns = _calculate_daily_returns_from_balance(balance_history, date_col, balance_col)
if len(daily_returns) == 0:
return 0.0
expected_returns_mean = daily_returns.mean()
up_stdev = daily_returns.std(ddof=0)
return _calculate_annualized_ratio(expected_returns_mean, up_stdev)
def calculate_max_drawdown_from_balance(
balance_history: pd.DataFrame,
date_col: str = "date",
balance_col: str = "total_quote",
relative: bool = False,
) -> DrawDownResult:
"""
Calculate max drawdown from historical balance snapshots.
:param balance_history: DataFrame containing at least date and balance columns
:param date_col: Column containing timestamps
:param balance_col: Column containing historical balance values
:param relative: If True, use relative drawdown for max calculation instead of absolute
:return: DrawDownResult object
:raise: ValueError if balance-history dataframe was found empty.
"""
wallet = _prepare_balance_history(
balance_history=balance_history,
date_col=date_col,
balance_col=balance_col,
)
if len(wallet) < 2:
raise ValueError("Balance-history dataframe empty.")
starting_balance = float(wallet[balance_col].iloc[0])
wallet.loc[:, "total_balance"] = wallet[balance_col].diff().fillna(0.0)
return calculate_max_drawdown(
wallet,
date_col=date_col,
value_col="total_balance",
starting_balance=starting_balance,
relative=relative,
)
def calculate_calmar(
@@ -401,12 +537,12 @@ def calculate_calmar(
starting_balance: float,
) -> float:
"""
Calculate calmar
Calculate calmar from trades data.
:param trades: DataFrame containing trades (requires columns close_date and profit_abs)
:return: calmar
"""
if (len(trades) == 0) or (min_date is None) or (max_date is None) or (min_date == max_date):
return 0
return 0.0
total_profit = trades["profit_abs"].sum() / starting_balance
days_period = max(1, (max_date - min_date).days)
@@ -422,16 +558,51 @@ def calculate_calmar(
)
max_drawdown = drawdown.relative_account_drawdown
except ValueError:
max_drawdown = 0
return 0.0
if max_drawdown != 0:
calmar_ratio = expected_returns_mean / max_drawdown * math.sqrt(365)
else:
# Define high (negative) calmar ratio to be clear that this is NOT optimal.
calmar_ratio = -100
return _calculate_annualized_ratio(expected_returns_mean, max_drawdown)
# print(expected_returns_mean, max_drawdown, calmar_ratio)
return calmar_ratio
def calculate_calmar_from_balance(
balance_history: pd.DataFrame,
date_col: str = "date",
balance_col: str = "total_quote",
) -> float:
"""
Calculate calmar ratio from historical balance snapshots.
:param balance_history: DataFrame containing at least date and balance columns
:param date_col: Column containing timestamps
:param balance_col: Column containing historical balance values
:return: calmar
"""
wallet = _prepare_balance_history(
balance_history=balance_history,
date_col=date_col,
balance_col=balance_col,
)
if len(wallet) < 2:
return 0.0
starting_balance = float(wallet[balance_col].iloc[0])
final_balance = float(wallet[balance_col].iloc[-1])
days_period = max(1, (wallet[date_col].iloc[-1] - wallet[date_col].iloc[0]).days)
total_profit = (final_balance - starting_balance) / starting_balance
expected_returns_mean = total_profit / days_period * 100
try:
drawdown = calculate_max_drawdown_from_balance(
wallet,
date_col=date_col,
balance_col=balance_col,
)
max_drawdown = drawdown.relative_account_drawdown
except ValueError:
return 0.0
return _calculate_annualized_ratio(expected_returns_mean, max_drawdown)
def calculate_sqn(trades: pd.DataFrame, starting_balance: float) -> float:
+5 -1
View File
@@ -46,6 +46,10 @@ class Binance(Exchange):
"l2_limit_range": [5, 10, 20, 50, 100, 500, 1000],
"ws_enabled": True,
"has_delisting": True,
# Demo trading
# https://www.binance.com/en/support/faq/detail/9be58f73e5e14338809e3b705b9687dd
# Intentionally Disabled as it's a separate market - not a simulated live market.
"supports_demo_trading": False,
}
_ft_has_futures: FtHas = {
"ohlcv_candle_limit": 499,
@@ -555,7 +559,7 @@ class Binance(Exchange):
class Binanceusdm(Binance):
"""Binacne USDM Exchange
"""Binance USDM Exchange
Same as Binance - only futures trading is supported (via ccxt).
Not actually necessary, binance should be preferred.
File diff suppressed because it is too large Load Diff
+50 -34
View File
@@ -7,6 +7,7 @@ from freqtrade.constants import BuySell
from freqtrade.enums import OPTIMIZE_MODES, CandleType, MarginMode, PriceType, TradingMode
from freqtrade.exceptions import (
DDosProtection,
InvalidOrderException,
OperationalException,
RetryableOrderError,
TemporaryError,
@@ -34,16 +35,18 @@ class Bitget(Exchange):
"stoploss_query_requires_stop_flag": True,
"ohlcv_candle_limit": 200, # 200 for historical candles, 1000 for recent ones.
"order_time_in_force": ["GTC", "FOK", "IOC", "PO"],
}
_ft_has_futures: FtHas = {
"funding_fee_candle_limit": 100,
"has_delisting": True,
"stop_price_param": "stopLossPrice",
"stop_price_prop": "stopLossPrice",
"stop_price_type_field": "triggerType",
"stop_price_type_value_mapping": {
PriceType.LAST: "fill_price",
PriceType.MARK: "mark_price",
},
}
_ft_has_futures: FtHas = {
"funding_fee_candle_limit": 100,
"has_delisting": True,
}
_supported_trading_mode_margin_pairs: list[tuple[TradingMode, MarginMode]] = [
(TradingMode.SPOT, MarginMode.NONE),
@@ -99,30 +102,36 @@ class Bitget(Exchange):
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
# old stoploss orders
paramsold = {"stop": True}
# new stoploss orders with stopLossPrice (used in futures starting 2026.4)
paramsnew = {"planType": "profit_loss"}
params_to_try = (
(paramsnew, paramsold) if self.trading_mode == TradingMode.FUTURES else (paramsold,)
)
for params2 in params_to_try:
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)
@@ -134,6 +143,19 @@ class Bitget(Exchange):
return self._fetch_stop_order_fallback(order_id, pair)
def cancel_stoploss_order(self, order_id: str, pair: str, params: dict | None = None) -> dict:
cancel_params = params.copy() if params else {}
cancel_params["stop"] = True
if self.trading_mode != TradingMode.FUTURES:
return self.cancel_order(order_id, pair, cancel_params)
try:
return self.cancel_order(order_id, pair, {**cancel_params, "planType": "pos_loss"})
except (InvalidOrderException, IndexError):
# Keep compatibility with stoploss orders created by older versions.
return self.cancel_order(order_id, pair, cancel_params)
@retrier
def additional_exchange_init(self) -> None:
"""
@@ -155,12 +177,6 @@ class Bitget(Exchange):
except ccxt.BaseError as e:
raise OperationalException(e) from e
def _lev_prep(self, pair: str, leverage: float, side: BuySell, accept_fail: bool = False):
if self.trading_mode != TradingMode.SPOT:
# Explicitly setting margin_mode is not necessary as marginMode can be set per order.
# self.set_margin_mode(pair, self.margin_mode, accept_fail)
self._set_leverage(leverage, pair, accept_fail)
def _get_params(
self,
side: BuySell,
+3
View File
@@ -35,6 +35,9 @@ class Bybit(Exchange):
# TODO: Can be removed once bybit fully forces all accounts to unified mode.
"fetchOrder": False,
},
# Demo trading
# https://learn.bybit.com/en/bybit-guide/how-to-use-bybit-demo-trading
"supports_demo_trading": True,
}
_ft_has_futures: FtHas = {
"ohlcv_has_history": True,
+2 -4
View File
@@ -51,12 +51,10 @@ def check_exchange(config: Config, check_for_bad: bool = True) -> bool:
if not valid:
if check_for_bad:
raise OperationalException(
f'Exchange "{exchange}" will not work with Freqtrade. Reason: {reason}.'
f'Exchange "{exchange}" will not work with Freqtrade. Reason: {reason}.'
)
else:
logger.warning(
f'Exchange "{exchange}" will not work with Freqtrade. Reason: {reason}.'
)
logger.warning(f'Exchange "{exchange}" will not work with Freqtrade. Reason: {reason}.')
if MAP_EXCHANGE_CHILDCLASS.get(exchange, exchange) in SUPPORTED_EXCHANGES:
logger.info(
+23 -8
View File
@@ -13,6 +13,7 @@ from datetime import UTC, datetime, timedelta
from math import floor, isnan
from threading import Lock
from typing import Any, Literal, TypeGuard, TypeVar
from uuid import uuid4
import ccxt
import ccxt.pro as ccxt_pro
@@ -249,7 +250,7 @@ class Exchange:
# Holds all open sell orders for dry_run
self._dry_run_open_orders: dict[str, Any] = {}
self._is_demo_trading = exchange_conf.get("demo_trading", False)
if self._config["dry_run"]:
logger.info("Instance is running with dry_run enabled")
logger.info(f"Using CCXT {ccxt.__version__}")
@@ -365,6 +366,7 @@ class Exchange:
self.validate_pricing(config["exit_pricing"])
self.validate_pricing(config["entry_pricing"])
self.validate_orderflow(config["exchange"])
self.validate_demo_trading(config["exchange"])
self.validate_freqai(config)
self._set_startup_candle_count(config)
@@ -418,6 +420,9 @@ class Exchange:
except ccxt.BaseError as e:
raise OperationalException(f"Initialization of ccxt failed. Reason: {e}") from e
if self.get_option("supports_demo_trading") and exchange_config.get("demo_trading", False):
api.enable_demo_trading(True)
return api
@property
@@ -433,12 +438,12 @@ class Exchange:
@property
def name(self) -> str:
"""exchange Name (from ccxt)"""
return self._api.name
return self._api.name if not self._is_demo_trading else f"{self._api.name} (Demo)"
@property
def id(self) -> str:
"""exchange ccxt id"""
return self._api.id
return self._api.id if not self._is_demo_trading else f"{self._api.id}_demo"
@property
def timeframes(self) -> list[str]:
@@ -870,6 +875,16 @@ class Exchange:
"fetching historic OHLCV data, otherwise freqAI will not work."
)
def validate_demo_trading(self, exchange_conf: dict) -> None:
"""Validate demo trading configuration
Prevents accidental configuration with wrong expectations.
"""
if exchange_conf.get("demo_trading", False):
if not self.get_option("supports_demo_trading"):
raise ConfigurationError(f"Demo trading is not supported for {self.name}.")
else:
logger.info(f"Demo trading enabled for {self.name}")
def validate_required_startup_candles(self, startup_candles: int, timeframe: str) -> int:
"""
Checks if required startup_candles is more than ohlcv_candle_limit().
@@ -1138,7 +1153,7 @@ class Exchange:
stop_price: float | None = None,
) -> CcxtOrder:
now = dt_now()
order_id = f"dry_run_{side}_{pair}_{now.timestamp()}"
order_id = f"dry_run_{side}_{pair}_{uuid4()}"
# Rounding here must respect to contract sizes
_amount = self._contracts_to_amount(
pair, self.amount_to_precision(pair, self._amount_to_contracts(pair, amount))
@@ -2655,11 +2670,11 @@ class Exchange:
if self._can_use_websocket(self._exchange_ws, pair, timeframe, candle_type):
candle_ts = dt_ts(timeframe_to_prev_date(timeframe))
prev_candle_ts = dt_ts(date_minus_candles(timeframe, 1))
candles = self._exchange_ws.ohlcvs(pair, timeframe)
half_candle = int(candle_ts - (candle_ts - prev_candle_ts) * 0.5)
last_refresh_time = int(
self._exchange_ws.klines_last_refresh.get((pair, timeframe, candle_type), 0)
candles, last_refresh_time = self._exchange_ws.get_ohlcv_with_refresh(
pair, timeframe, candle_type
)
last_refresh_time = int(last_refresh_time)
half_candle = int(candle_ts - (candle_ts - prev_candle_ts) * 0.5)
if (
candles
+2
View File
@@ -67,6 +67,8 @@ class FtHas(TypedDict, total=False):
# Delisting check
has_delisting: bool
# Demo mode - this is not sandbox but an exchange-provided demo mode.
supports_demo_trading: bool
class Ticker(TypedDict):
+147 -76
View File
@@ -1,9 +1,8 @@
import asyncio
import logging
import time
from copy import deepcopy
from functools import partial
from threading import Thread
from threading import Event, RLock, Thread
import ccxt
@@ -24,49 +23,71 @@ class ExchangeWS:
self.config = config
self._ccxt_object = ccxt_object
self._background_tasks: set[asyncio.Task] = set()
self._state_lock = RLock()
self._loop_ready = Event()
self._klines_watching: set[PairWithTimeframe] = set()
self._klines_scheduled: set[PairWithTimeframe] = set()
self.klines_last_refresh: dict[PairWithTimeframe, float] = {}
self.klines_last_request: dict[PairWithTimeframe, float] = {}
self._klines_last_refresh: dict[PairWithTimeframe, float] = {}
self._klines_last_request: dict[PairWithTimeframe, float] = {}
self._thread = Thread(name="ccxt_ws", target=self._start_forever)
self._thread.start()
self.__cleanup_called = False
def _start_forever(self) -> None:
self._loop = asyncio.new_event_loop()
self._loop_ready.set()
try:
self._loop.run_forever()
finally:
if self._loop.is_running():
self._loop.stop()
if not self._loop.is_closed():
# Cancel remaining tasks and close the loop in the owning thread.
pending = asyncio.all_tasks(self._loop)
for task in pending:
task.cancel()
if pending:
self._loop.run_until_complete(asyncio.gather(*pending, return_exceptions=True))
self._loop.run_until_complete(self._loop.shutdown_asyncgens())
self._loop.close()
self._loop_ready.clear()
def _wait_for_loop(self, timeout: float = 1.0) -> bool:
"""
Wait for the event loop to be ready
Returns True once the loop is ready.
Will probably only return false during startup/shutdown.
"""
if hasattr(self, "_loop"):
return True
return self._loop_ready.wait(timeout=timeout) and hasattr(self, "_loop")
def cleanup(self) -> None:
logger.debug("Cleanup called - stopping")
self._klines_watching.clear()
for task in self._background_tasks:
with self._state_lock:
self._klines_watching.clear()
tasks = list(self._background_tasks)
for task in tasks:
task.cancel()
if hasattr(self, "_loop") and not self._loop.is_closed():
self.reset_connections()
if self._wait_for_loop(timeout=0.2) and not self._loop.is_closed():
self.reset_connections(cleanup=True)
self._loop.call_soon_threadsafe(self._loop.stop)
time.sleep(0.1)
if not self._loop.is_closed():
self._loop.close()
self._thread.join()
self._thread.join(timeout=5)
if self._thread.is_alive():
logger.warning("Websocket loop thread did not stop within timeout.")
logger.debug("Stopped")
def reset_connections(self) -> None:
def reset_connections(self, cleanup: bool = False) -> None:
"""
Reset all connections - avoids "connection-reset" errors that happen after ~9 days
"""
if hasattr(self, "_loop") and not self._loop.is_closed():
logger.info("Resetting WS connections.")
asyncio.run_coroutine_threadsafe(self._cleanup_async(), loop=self._loop)
while not self.__cleanup_called:
time.sleep(0.1)
self.__cleanup_called = False
if self._wait_for_loop() and not self._loop.is_closed():
logger.info(f"{'Cleaning up' if cleanup else 'Resetting'} exchange WS connections.")
try:
fut = asyncio.run_coroutine_threadsafe(self._cleanup_async(), loop=self._loop)
fut.result(timeout=10)
except TimeoutError:
logger.warning("Timed out while resetting websocket connections.")
except Exception:
logger.exception("Exception while resetting websocket connections")
async def _cleanup_async(self) -> None:
try:
@@ -76,15 +97,14 @@ class ExchangeWS:
self._ccxt_object.ohlcvs.clear()
except Exception:
logger.exception("Exception in _cleanup_async")
finally:
self.__cleanup_called = True
def _pop_history(self, paircomb: PairWithTimeframe) -> None:
"""
Remove history for a pair/timeframe combination from ccxt cache
"""
self._ccxt_object.ohlcvs.get(paircomb[0], {}).pop(paircomb[1], None)
self.klines_last_refresh.pop(paircomb, None)
with self._state_lock:
self._ccxt_object.ohlcvs.get(paircomb[0], {}).pop(paircomb[1], None)
self._klines_last_refresh.pop(paircomb, None)
@retrier(retries=3)
def ohlcvs(self, pair: str, timeframe: str) -> list[list]:
@@ -100,81 +120,129 @@ class ExchangeWS:
# TemporaryError does not cause backoff - so we're essentially retrying immediately
raise TemporaryError(f"Error deepcopying: {e}") from e
def get_ohlcv_with_refresh(
self, pair: str, timeframe: str, candle_type: CandleType
) -> tuple[list[list], float]:
"""
Get deepcopied klines and update the last refresh time
"""
ohlcvs = self.ohlcvs(pair, timeframe)
with self._state_lock:
last_refresh = self._klines_last_refresh.get((pair, timeframe, candle_type), 0)
return ohlcvs, last_refresh
def cleanup_expired(self) -> None:
"""
Remove pairs from watchlist if they've not been requested within
the last timeframe (+ offset)
"""
changed = False
for p in list(self._klines_watching):
_, timeframe, _ = p
timeframe_s = timeframe_to_seconds(timeframe)
last_refresh = self.klines_last_request.get(p, 0)
if last_refresh > 0 and (dt_ts() - last_refresh) > ((timeframe_s + 20) * 1000):
logger.info(f"Removing {p} from websocket watchlist.")
self._klines_watching.discard(p)
# Pop history to avoid getting stale data
self._pop_history(p)
changed = True
with self._state_lock:
for p in list(self._klines_watching):
_, timeframe, _ = p
timeframe_s = timeframe_to_seconds(timeframe)
last_refresh = self._klines_last_request.get(p, 0)
if last_refresh > 0 and (dt_ts() - last_refresh) > ((timeframe_s + 20) * 1000):
logger.info(f"Removing {p} from websocket watchlist.")
self._klines_watching.discard(p)
# Pop history to avoid getting stale data
self._pop_history(p)
changed = True
if changed:
logger.info(f"Removal done: new watch list ({len(self._klines_watching)})")
async def _schedule_while_true(self) -> None:
# For the ones we should be watching
for p in self._klines_watching:
with self._state_lock:
pairs_to_check = list(self._klines_watching)
for p in pairs_to_check:
# Check if they're already scheduled
if p not in self._klines_scheduled:
with self._state_lock:
if p in self._klines_scheduled:
continue
self._klines_scheduled.add(p)
pair, timeframe, candle_type = p
task = asyncio.create_task(
self._continuously_async_watch_ohlcv(pair, timeframe, candle_type)
)
pair, timeframe, candle_type = p
task = asyncio.create_task(
self._continuously_async_watch_ohlcv(pair, timeframe, candle_type)
)
with self._state_lock:
self._background_tasks.add(task)
task.add_done_callback(
partial(
self._continuous_stopped,
pair=pair,
timeframe=timeframe,
candle_type=candle_type,
)
task.add_done_callback(
partial(
self._continuous_stopped,
pair=pair,
timeframe=timeframe,
candle_type=candle_type,
)
)
def exchange_has(self, endpoint: str) -> bool:
"""
Checks if exchange implements a specific API endpoint.
Wrapper around ccxt 'has' attribute
:param endpoint: Name of endpoint (e.g. 'fetchOHLCV', 'fetchTickers')
:return: bool
"""
return endpoint in self._ccxt_object.has and self._ccxt_object.has[endpoint]
async def _unwatch_ohlcv(self, pair: str, timeframe: str, candle_type: CandleType) -> None:
try:
await self._ccxt_object.un_watch_ohlcv_for_symbols([[pair, timeframe]])
if self.exchange_has("unWatchOHLCVForSymbols"):
await self._ccxt_object.un_watch_ohlcv_for_symbols([[pair, timeframe]])
elif self.exchange_has("unWatchOHLCV"):
await self._ccxt_object.un_watch_ohlcv(pair, timeframe)
else:
logger.debug("un_watch_ohlcv not supported for %s, %s", pair, timeframe)
except ccxt.NotSupported as e:
logger.debug("un_watch_ohlcv_for_symbols not supported: %s", e)
pass
except ccxt.NetworkError as e:
# Network errors are common on shutdown so we can ignore them.
# It's a network error - which most likely means that the connection is already closed.
logger.debug("Network error during unwatch for %s, %s: %s", pair, timeframe, e)
except Exception:
logger.exception("Exception in _unwatch_ohlcv")
logger.exception(f"Exception in _unwatch_ohlcv for {pair}, {timeframe},")
def _continuous_stopped(
self, task: asyncio.Task, pair: str, timeframe: str, candle_type: CandleType
):
self._background_tasks.discard(task)
) -> None:
with self._state_lock:
self._background_tasks.discard(task)
result = "done"
if task.cancelled():
result = "cancelled"
else:
if (result1 := task.result()) is not None:
result = str(result1)
try:
if task.cancelled():
result = "cancelled"
else:
if (result1 := task.result()) is not None:
result = str(result1)
except Exception:
result = "error"
logger.exception(f"Unhandled exception in watch task callback for {pair}, {timeframe}")
finally:
logger.info(f"{pair}, {timeframe}, {candle_type} - Task finished - {result}")
if hasattr(self, "_loop") and not self._loop.is_closed():
asyncio.run_coroutine_threadsafe(
self._unwatch_ohlcv(pair, timeframe, candle_type), loop=self._loop
)
logger.info(f"{pair}, {timeframe}, {candle_type} - Task finished - {result}")
asyncio.run_coroutine_threadsafe(
self._unwatch_ohlcv(pair, timeframe, candle_type), loop=self._loop
)
self._klines_scheduled.discard((pair, timeframe, candle_type))
self._pop_history((pair, timeframe, candle_type))
with self._state_lock:
self._klines_scheduled.discard((pair, timeframe, candle_type))
self._pop_history((pair, timeframe, candle_type))
async def _continuously_async_watch_ohlcv(
self, pair: str, timeframe: str, candle_type: CandleType
) -> None:
try:
while (pair, timeframe, candle_type) in self._klines_watching:
while True:
with self._state_lock:
if (pair, timeframe, candle_type) not in self._klines_watching:
break
start = dt_ts()
data = await self._ccxt_object.watch_ohlcv(pair, timeframe)
self.klines_last_refresh[(pair, timeframe, candle_type)] = dt_ts()
with self._state_lock:
self._klines_last_refresh[(pair, timeframe, candle_type)] = dt_ts()
logger.debug(
f"watch done {pair}, {timeframe}, data {len(data)} "
f"in {(dt_ts() - start) / 1000:.3f}s"
@@ -184,14 +252,19 @@ class ExchangeWS:
except ccxt.BaseError:
logger.exception(f"Exception in continuously_async_watch_ohlcv for {pair}, {timeframe}")
finally:
self._klines_watching.discard((pair, timeframe, candle_type))
with self._state_lock:
self._klines_watching.discard((pair, timeframe, candle_type))
def schedule_ohlcv(self, pair: str, timeframe: str, candle_type: CandleType) -> None:
"""
Schedule a pair/timeframe combination to be watched
"""
self._klines_watching.add((pair, timeframe, candle_type))
self.klines_last_request[(pair, timeframe, candle_type)] = dt_ts()
if not self._wait_for_loop():
logger.warning(f"Websocket loop not ready. Could not schedule {pair}, {timeframe}.")
return
with self._state_lock:
self._klines_watching.add((pair, timeframe, candle_type))
self._klines_last_request[(pair, timeframe, candle_type)] = dt_ts()
# asyncio.run_coroutine_threadsafe(self.schedule_schedule(), loop=self._loop)
asyncio.run_coroutine_threadsafe(self._schedule_while_true(), loop=self._loop)
self.cleanup_expired()
@@ -207,12 +280,10 @@ class ExchangeWS:
Returns cached klines from ccxt's "watch" cache.
:param candle_ts: timestamp of the end-time of the candle we expect.
"""
# Deepcopy the response - as it might be modified in the background as new messages arrive
candles = self.ohlcvs(pair, timeframe)
refresh_date = self.klines_last_refresh[(pair, timeframe, candle_type)]
candles, refresh_date = self.get_ohlcv_with_refresh(pair, timeframe, candle_type)
received_ts = candles[-1][0] if candles else 0
drop_hint = received_ts >= candle_ts
if received_ts > refresh_date:
if refresh_date and received_ts > refresh_date:
logger.warning(
f"{pair}, {timeframe} - Candle date > last refresh "
f"({format_ms_time(received_ts)} > {format_ms_time_det(refresh_date)}). "
+1 -1
View File
@@ -361,7 +361,7 @@ class FreqaiDataDrawer:
label_loc = df.columns.get_loc(label)
pred_label_loc = predictions.columns.get_loc(label)
df.iloc[-1, label_loc] = predictions.iloc[-1, pred_label_loc]
if df[label].dtype == object:
if pd.api.types.is_string_dtype(df[label].dtype):
continue
label_mean_loc = df.columns.get_loc(f"{label}_mean")
label_std_loc = df.columns.get_loc(f"{label}_std")
+6 -10
View File
@@ -24,8 +24,6 @@ from freqtrade.strategy import merge_informative_pair
from freqtrade.strategy.interface import IStrategy
pd.set_option("future.no_silent_downcasting", True)
SECONDS_IN_DAY = 86400
SECONDS_IN_HOUR = 3600
@@ -239,16 +237,14 @@ class FreqaiDataKitchen:
filtered_df = filtered_df.replace([np.inf, -np.inf], np.nan)
drop_index = pd.isnull(filtered_df).any(axis=1) # get the rows that have NaNs,
drop_index = drop_index.replace(True, 1).replace(False, 0).infer_objects(copy=False)
drop_index = drop_index.replace(True, 1).replace(False, 0).infer_objects()
if training_filter:
# we don't care about total row number (total no. datapoints) in training, we only care
# about removing any row with NaNs
# if labels has multiple columns (user wants to train multiple modelEs), we detect here
labels = unfiltered_df.filter(label_list or [], axis=1)
drop_index_labels = pd.isnull(labels).any(axis=1)
drop_index_labels = (
drop_index_labels.replace(True, 1).replace(False, 0).infer_objects(copy=False)
)
drop_index_labels = drop_index_labels.replace(True, 1).replace(False, 0).infer_objects()
dates = unfiltered_df["date"]
filtered_df = filtered_df[
(drop_index == 0) & (drop_index_labels == 0)
@@ -435,7 +431,7 @@ class FreqaiDataKitchen:
for label in predictions.columns:
append_dict[label] = predictions[label]
if predictions[label].dtype == object:
if pd.api.types.is_string_dtype(predictions[label].dtype):
continue
if "labels_mean" in self.data and label in self.data["labels_mean"]:
append_dict[f"{label}_mean"] = self.data["labels_mean"][label]
@@ -879,7 +875,7 @@ class FreqaiDataKitchen:
self.data["labels_mean"], self.data["labels_std"] = {}, {}
for label in self.data_dictionary["train_labels"].columns:
if self.data_dictionary["train_labels"][label].dtype == object:
if pd.api.types.is_string_dtype(self.data_dictionary["train_labels"][label].dtype):
continue
f = spy.stats.norm.fit(self.data_dictionary["train_labels"][label])
self.data["labels_mean"][label], self.data["labels_std"][label] = f[0], f[1]
@@ -905,7 +901,7 @@ class FreqaiDataKitchen:
self.find_labels(dataframe)
for key in self.label_list:
if dataframe[key].dtype == object:
if pd.api.types.is_string_dtype(dataframe[key].dtype):
self.unique_classes[key] = dataframe[key].dropna().unique()
if self.unique_classes:
@@ -990,7 +986,7 @@ class FreqaiDataKitchen:
are populated.
The main example use is when predicting maxima and minima, the argrelextrema
function cannot know the maxima/minima at the edges of the timerange. To improve
function cannot know the maxima/minima at the edges of the timerange. To improve
model accuracy, it is best to compute argrelextrema on the full timerange
and then use this function to cut off the edges (buffer) by the kernel.
+3 -3
View File
@@ -676,7 +676,7 @@ class IFreqaiModel(ABC):
self.set_start_dry_live_date(strat_df)
for label in hist_preds_df.columns:
if hist_preds_df[label].dtype == object:
if pd.api.types.is_string_dtype(hist_preds_df[label].dtype):
continue
hist_preds_df[f"{label}_mean"] = 0
hist_preds_df[f"{label}_std"] = 0
@@ -706,7 +706,7 @@ class IFreqaiModel(ABC):
num_candles = self.freqai_info.get("fit_live_predictions_candles", 100)
dk.data["labels_mean"], dk.data["labels_std"] = {}, {}
for label in full_labels:
if self.dd.historic_predictions[dk.pair][label].dtype == object:
if pd.api.types.is_string_dtype(self.dd.historic_predictions[dk.pair][label].dtype):
continue
f = spy.stats.norm.fit(self.dd.historic_predictions[dk.pair][label].tail(num_candles))
dk.data["labels_mean"][label], dk.data["labels_std"][label] = f[0], f[1]
@@ -896,7 +896,7 @@ class IFreqaiModel(ABC):
]
self.fit_live_predictions(self.dk, self.dk.pair)
for label in label_columns:
if dk.full_df[label].dtype == object:
if pd.api.types.is_string_dtype(dk.full_df[label].dtype):
continue
if "labels_mean" in self.dk.data:
dk.full_df.at[index, f"{label}_mean"] = self.dk.data["labels_mean"][
@@ -1,10 +1,12 @@
import logging
from collections.abc import Callable
from typing import Any
from lightgbm import LGBMClassifier
from freqtrade.freqai.base_models.BaseClassifierModel import BaseClassifierModel
from freqtrade.freqai.data_kitchen import FreqaiDataKitchen
from freqtrade.freqai.tensorboard import LightGBMCallback
logger = logging.getLogger(__name__)
@@ -46,6 +48,10 @@ class LightGBMClassifier(BaseClassifierModel):
init_model = self.get_init_model(dk.pair)
model = LGBMClassifier(**self.model_training_parameters)
activate_tensorboard = self.freqai_info.get("activate_tensorboard", True)
callbacks: list[Callable[..., Any]] = []
if LightGBMCallback is not None:
callbacks = [LightGBMCallback(dk.data_path, activate_tensorboard)]
model.fit(
X=X,
y=y,
@@ -53,6 +59,7 @@ class LightGBMClassifier(BaseClassifierModel):
sample_weight=train_weights,
eval_sample_weight=[test_weights],
init_model=init_model,
callbacks=callbacks,
)
return model
@@ -6,6 +6,7 @@ from lightgbm import LGBMClassifier
from freqtrade.freqai.base_models.BaseClassifierModel import BaseClassifierModel
from freqtrade.freqai.base_models.FreqaiMultiOutputClassifier import FreqaiMultiOutputClassifier
from freqtrade.freqai.data_kitchen import FreqaiDataKitchen
from freqtrade.freqai.tensorboard import LightGBMCallback
logger = logging.getLogger(__name__)
@@ -53,6 +54,11 @@ class LightGBMClassifierMultiTarget(BaseClassifierModel):
else:
init_models = [None] * y.shape[1]
activate_tensorboard = self.freqai_info.get("activate_tensorboard", True)
callbacks = []
if LightGBMCallback is not None:
callbacks = [LightGBMCallback(dk.data_path, activate_tensorboard)]
fit_params = []
for i in range(len(eval_sets)):
fit_params.append(
@@ -60,6 +66,7 @@ class LightGBMClassifierMultiTarget(BaseClassifierModel):
"eval_set": eval_sets[i],
"eval_sample_weight": eval_weights,
"init_model": init_models[i],
"callbacks": callbacks,
}
)
@@ -1,10 +1,12 @@
import logging
from collections.abc import Callable
from typing import Any
from lightgbm import LGBMRegressor
from freqtrade.freqai.base_models.BaseRegressionModel import BaseRegressionModel
from freqtrade.freqai.data_kitchen import FreqaiDataKitchen
from freqtrade.freqai.tensorboard import LightGBMCallback
logger = logging.getLogger(__name__)
@@ -42,6 +44,11 @@ class LightGBMRegressor(BaseRegressionModel):
model = LGBMRegressor(**self.model_training_parameters)
activate_tensorboard = self.freqai_info.get("activate_tensorboard", True)
callbacks: list[Callable[..., Any]] = []
if LightGBMCallback is not None:
callbacks = [LightGBMCallback(dk.data_path, activate_tensorboard)]
model.fit(
X=X,
y=y,
@@ -49,6 +56,7 @@ class LightGBMRegressor(BaseRegressionModel):
sample_weight=train_weights,
eval_sample_weight=[eval_weights],
init_model=init_model,
callbacks=callbacks,
)
return model
@@ -6,6 +6,7 @@ from lightgbm import LGBMRegressor
from freqtrade.freqai.base_models.BaseRegressionModel import BaseRegressionModel
from freqtrade.freqai.base_models.FreqaiMultiOutputRegressor import FreqaiMultiOutputRegressor
from freqtrade.freqai.data_kitchen import FreqaiDataKitchen
from freqtrade.freqai.tensorboard import LightGBMCallback
logger = logging.getLogger(__name__)
@@ -55,6 +56,11 @@ class LightGBMRegressorMultiTarget(BaseRegressionModel):
else:
init_models = [None] * y.shape[1]
activate_tensorboard = self.freqai_info.get("activate_tensorboard", True)
callbacks = []
if LightGBMCallback is not None:
callbacks = [LightGBMCallback(dk.data_path, activate_tensorboard)]
fit_params = []
for i in range(len(eval_sets)):
fit_params.append(
@@ -62,6 +68,7 @@ class LightGBMRegressorMultiTarget(BaseRegressionModel):
"eval_set": eval_sets[i],
"eval_sample_weight": eval_weights,
"init_model": init_models[i],
"callbacks": callbacks,
}
)
@@ -63,7 +63,7 @@ class SKLearnRandomForestClassifier(BaseClassifierModel):
) -> tuple[DataFrame, npt.NDArray[np.int_]]:
"""
Filter the prediction features data and predict with it.
:param unfiltered_df: Full dataframe for the current backtest period.
:param unfiltered_df: Full dataframe for the current backtest period.
:return:
:pred_df: dataframe containing the predictions
:do_predict: np.array of 1s and 0s to indicate places where freqai needed to remove
@@ -67,7 +67,7 @@ class XGBoostRFClassifier(BaseClassifierModel):
) -> tuple[DataFrame, npt.NDArray[np.int_]]:
"""
Filter the prediction features data and predict with it.
:param unfiltered_df: Full dataframe for the current backtest period.
:param unfiltered_df: Full dataframe for the current backtest period.
:return:
:pred_df: dataframe containing the predictions
:do_predict: np.array of 1s and 0s to indicate places where freqai needed to remove
+4 -1
View File
@@ -1,9 +1,11 @@
# ensure users can still use a non-torch freqai version
try:
from freqtrade.freqai.tensorboard.lightgbm_callback import LightGBMTensorboardCallback
from freqtrade.freqai.tensorboard.tensorboard import TensorBoardCallback, TensorboardLogger
TBLogger = TensorboardLogger
TBCallback = TensorBoardCallback
LightGBMCallback = LightGBMTensorboardCallback
except ModuleNotFoundError:
from freqtrade.freqai.tensorboard.base_tensorboard import (
BaseTensorBoardCallback,
@@ -12,5 +14,6 @@ except ModuleNotFoundError:
TBLogger = BaseTensorboardLogger # type: ignore
TBCallback = BaseTensorBoardCallback # type: ignore
LightGBMCallback = None # type: ignore
__all__ = ("TBLogger", "TBCallback")
__all__ = ("TBLogger", "TBCallback", "LightGBMCallback")
@@ -0,0 +1,24 @@
from __future__ import annotations
from freqtrade.freqai.tensorboard.tensorboard import TensorboardLogger
class LightGBMTensorboardCallback:
def __init__(self, logdir, activate: bool) -> None:
self.activate = activate
self.logger = TensorboardLogger(logdir, activate)
def __call__(self, env) -> None:
if not self.activate:
return
evals = getattr(env, "evaluation_result_list", None)
if not evals:
return
for data_name, metric_name, value, _ in evals:
self.logger.log_scalar(f"{data_name}-{metric_name}", value, env.iteration)
end_iteration = getattr(env, "end_iteration", None)
if end_iteration is not None and env.iteration + 1 >= end_iteration:
self.logger.close()
+108 -98
View File
@@ -92,100 +92,106 @@ class FreqtradeBot(LoggingMixin):
exchange_config: ExchangeConfig = deepcopy(config["exchange"])
# Remove credentials from original exchange config to avoid accidental credential exposure
remove_exchange_credentials(config["exchange"], True)
self.exchange = ExchangeResolver.load_exchange(
self.config, exchange_config=exchange_config, load_leverage_tiers=True
)
self.strategy: IStrategy = StrategyResolver.load_strategy(self.config)
# Check config consistency here since strategies can set certain options
validate_config_consistency(config)
# Re-validate exchange compatibility
self.exchange.validate_config(self.config)
init_db(self.config["db_url"])
self.wallets = Wallets(self.config, self.exchange)
PairLocks.timeframe = self.config["timeframe"]
self.trading_mode: TradingMode = self.config.get("trading_mode", TradingMode.SPOT)
self.margin_mode: MarginMode = self.config.get("margin_mode", MarginMode.NONE)
self.last_process: datetime | None = None
# RPC runs in separate threads, can start handling external commands just after
# initialization, even before Freqtradebot has a chance to start its throttling,
# so anything in the Freqtradebot instance should be ready (initialized), including
# the initial state of the bot.
# Keep this at the end of this initialization method.
self.rpc: RPCManager = RPCManager(self)
self.dataprovider = DataProvider(self.config, self.exchange, rpc=self.rpc)
self.pairlists = PairListManager(self.exchange, self.config, self.dataprovider)
self.dataprovider.add_pairlisthandler(self.pairlists)
# Attach Dataprovider to strategy instance
self.strategy.dp = self.dataprovider
# Attach Wallets to strategy instance
self.strategy.wallets = self.wallets
# Init ExternalMessageConsumer if enabled
self.emc = (
ExternalMessageConsumer(self.config, self.dataprovider)
if self.config.get("external_message_consumer", {}).get("enabled", False)
else None
)
logger.info("Starting initial pairlist refresh")
with MeasureTime(
lambda duration, _: logger.info(f"Initial Pairlist refresh took {duration:.2f}s"), 0
):
self.active_pair_whitelist = self._refresh_active_whitelist()
# Set initial bot state from config
initial_state = self.config.get("initial_state")
self.state = State[initial_state.upper()] if initial_state else State.STOPPED
# Protect exit-logic from forcesell and vice versa
self._exit_lock = Lock()
timeframe_secs = timeframe_to_seconds(self.strategy.timeframe)
self._exit_reason_cache = PeriodicCache(100, ttl=timeframe_secs)
LoggingMixin.__init__(self, logger, timeframe_secs)
self._schedule = Scheduler()
if self.trading_mode == TradingMode.FUTURES:
def update():
self.update_funding_fees()
self.update_all_liquidation_prices()
self.wallets.update()
# This would be more efficient if scheduled in utc time, and performed at each
# funding interval, specified by funding_fee_times on the exchange classes
# However, this reduces the precision - and might therefore lead to problems.
for time_slot in range(0, 24):
for minutes in [1, 31]:
t = str(time(time_slot, minutes, 2))
self._schedule.every().day.at(t).do(update)
self._schedule.every().day.at("00:02").do(self.exchange.ws_connection_reset)
self.strategy.ft_bot_start()
# Initialize protections AFTER bot start - otherwise parameters are not loaded.
self.protections = ProtectionManager(self.config, self.strategy.protections)
def log_took_too_long(duration: float, time_limit: float):
logger.warning(
f"Strategy analysis took {duration:.2f}s, more than 25% of the timeframe "
f"({time_limit:.2f}s). This can lead to delayed orders and missed signals."
"Consider either reducing the amount of work your strategy performs "
"or reduce the amount of pairs in the Pairlist."
try:
self.exchange = ExchangeResolver.load_exchange(
self.config, exchange_config=exchange_config, load_leverage_tiers=True
)
self._measure_execution = MeasureTime(log_took_too_long, timeframe_secs * 0.25)
self.strategy: IStrategy = StrategyResolver.load_strategy(self.config)
# Check config consistency here since strategies can set certain options
validate_config_consistency(config)
# Re-validate exchange compatibility
self.exchange.validate_config(self.config)
init_db(self.config["db_url"])
self.wallets = Wallets(self.config, self.exchange)
PairLocks.timeframe = self.config["timeframe"]
self.trading_mode: TradingMode = self.config.get("trading_mode", TradingMode.SPOT)
self.margin_mode: MarginMode = self.config.get("margin_mode", MarginMode.NONE)
self.last_process: datetime | None = None
# RPC runs in separate threads, can start handling external commands just after
# initialization, even before Freqtradebot has a chance to start its throttling,
# so anything in the Freqtradebot instance should be ready (initialized), including
# the initial state of the bot.
# Keep this at the end of this initialization method.
self.rpc: RPCManager = RPCManager(self)
self.dataprovider = DataProvider(self.config, self.exchange, rpc=self.rpc)
self.pairlists = PairListManager(self.exchange, self.config, self.dataprovider)
self.dataprovider.add_pairlisthandler(self.pairlists)
# Attach Dataprovider to strategy instance
self.strategy.dp = self.dataprovider
# Attach Wallets to strategy instance
self.strategy.wallets = self.wallets
# Init ExternalMessageConsumer if enabled
self.emc: ExternalMessageConsumer | None = (
ExternalMessageConsumer(self.config, self.dataprovider)
if self.config.get("external_message_consumer", {}).get("enabled", False)
else None
)
logger.info("Starting initial pairlist refresh")
with MeasureTime(
lambda duration, _: logger.info(f"Initial Pairlist refresh took {duration:.2f}s"), 0
):
self.active_pair_whitelist = self._refresh_active_whitelist()
# Set initial bot state from config
initial_state = self.config.get("initial_state")
self.state = State[initial_state.upper()] if initial_state else State.STOPPED
# Protect exit-logic from forcesell and vice versa
self._exit_lock = Lock()
timeframe_secs = timeframe_to_seconds(self.strategy.timeframe)
self._exit_reason_cache = PeriodicCache(100, ttl=timeframe_secs)
LoggingMixin.__init__(self, logger, timeframe_secs)
self._schedule = Scheduler()
if self.trading_mode == TradingMode.FUTURES:
def update():
self.update_funding_fees()
self.update_all_liquidation_prices()
self.wallets.update()
# This would be more efficient if scheduled in utc time, and performed at each
# funding interval, specified by funding_fee_times on the exchange classes
# However, this reduces the precision - and might therefore lead to problems.
for time_slot in range(0, 24):
for minutes in [1, 31]:
t = str(time(time_slot, minutes, 2))
self._schedule.every().day.at(t).do(update)
self._schedule.every().day.at("00:02").do(self.exchange.ws_connection_reset)
self._schedule.every().day.at("00:07").do(self.wallets.record_wallet_state)
self.strategy.ft_bot_start()
# Initialize protections AFTER bot start - otherwise parameters are not loaded.
self.protections = ProtectionManager(self.config, self.strategy.protections)
def log_took_too_long(duration: float, time_limit: float):
logger.warning(
f"Strategy analysis took {duration:.2f}s, more than 25% of the timeframe "
f"({time_limit:.2f}s). This can lead to delayed orders and missed signals."
"Consider either reducing the amount of work your strategy performs "
"or reduce the amount of pairs in the Pairlist."
)
self._measure_execution = MeasureTime(log_took_too_long, timeframe_secs * 0.25)
except Exception as e:
# Graceful shutdown in case of failed initialization.
self.cleanup()
raise e from e
def notify_status(self, msg: str, msg_type=RPCMessageType.STATUS) -> None:
"""
@@ -211,14 +217,18 @@ class FreqtradeBot(LoggingMixin):
logger.warning(f"Exception during cleanup: {e.__class__.__name__} {e}")
finally:
self.strategy.ft_bot_cleanup()
if getattr(self, "strategy", None):
self.strategy.ft_bot_cleanup()
self.rpc.cleanup()
if self.emc:
if getattr(self, "rpc", None):
self.rpc.cleanup()
if hasattr(self, "emc") and self.emc:
self.emc.shutdown()
self.exchange.close()
if getattr(self, "exchange", None):
self.exchange.close()
try:
Trade.commit()
if hasattr(Trade, "session"):
Trade.commit()
except Exception:
# Exceptions here will be happening if the db disappeared.
# At which point we can no longer commit anyway.
@@ -229,7 +239,7 @@ class FreqtradeBot(LoggingMixin):
Called on startup and after reloading the bot - triggers notifications and
performs startup tasks
"""
migrate_live_content(self.config, self.exchange)
migrate_live_content(self.config, self.exchange, self.wallets.get_starting_balance())
set_startup_time()
self.rpc.startup_messages(self.config, self.pairlists, self.protections)
@@ -55,6 +55,7 @@ class BacktestContentTypeIcomplete(TypedDict, total=False):
backtest_start_time: int
backtest_end_time: int
run_id: str
wallet_summary: DataFrame
class BacktestContentType(BacktestContentTypeIcomplete, total=True):
+6
View File
@@ -214,6 +214,12 @@ def dataframe_to_json(dataframe: pd.DataFrame) -> str:
:param dataframe: A pandas DataFrame
:returns: A JSON string of the pandas DataFrame
"""
date_columns = dataframe.select_dtypes(include=["datetime", "datetime64", "datetimetz"])
# Explicit conversion to ms
# This used to be part of to_json, but was deprecated in pandas 3
for date_column in date_columns:
dataframe[date_column] = date_columns[date_column].dt.as_unit("ms").astype("int64")
return dataframe.to_json(orient="split")
@@ -126,14 +126,14 @@ class LookaheadAnalysisSubFunctions:
csv_df = add_or_update_row(csv_df, new_row_data)
# Fill NaN values with a default value (e.g., 0)
csv_df["total_signals"] = csv_df["total_signals"].astype(int).fillna(0)
csv_df["biased_entry_signals"] = csv_df["biased_entry_signals"].astype(int).fillna(0)
csv_df["biased_exit_signals"] = csv_df["biased_exit_signals"].astype(int).fillna(0)
csv_df["total_signals"] = csv_df["total_signals"].astype("int64").fillna(0)
csv_df["biased_entry_signals"] = csv_df["biased_entry_signals"].astype("int64").fillna(0)
csv_df["biased_exit_signals"] = csv_df["biased_exit_signals"].astype("int64").fillna(0)
# Convert columns to integers
csv_df["total_signals"] = csv_df["total_signals"].astype(int)
csv_df["biased_entry_signals"] = csv_df["biased_entry_signals"].astype(int)
csv_df["biased_exit_signals"] = csv_df["biased_exit_signals"].astype(int)
csv_df["total_signals"] = csv_df["total_signals"].astype("int64")
csv_df["biased_entry_signals"] = csv_df["biased_entry_signals"].astype("int64")
csv_df["biased_exit_signals"] = csv_df["biased_exit_signals"].astype("int64")
logger.info(f"saving {config['lookahead_analysis_exportfilename']}")
csv_df.to_csv(config["lookahead_analysis_exportfilename"], index=False)
+21 -1
View File
@@ -51,6 +51,7 @@ from freqtrade.mixins import LoggingMixin
from freqtrade.optimize.backtest_caching import get_strategy_run_id
from freqtrade.optimize.bt_progress import BTProgress
from freqtrade.optimize.optimize_reports import (
convert_bt_wallet_collection,
generate_backtest_stats,
generate_rejected_signals,
generate_trade_signal_candles,
@@ -137,6 +138,7 @@ class Backtesting:
}
self.rejected_dict: dict[str, list] = {}
self.starting_balance: float = 0.0
self.wallet_captures: list = []
self._exchange_name = self.config["exchange"]["name"]
self.__initial_backtest = exchange is None
@@ -451,6 +453,7 @@ class Backtesting:
self.replaced_entry_orders = 0
self.canceled_exit_orders = 0
self.replaced_exit_orders = 0
self.wallet_captures = []
self.dataprovider.clear_cache()
if enable_protections:
self._load_protections(self.strategy)
@@ -754,7 +757,7 @@ class Backtesting:
) -> bool:
"""
Check if an order is open and if it should've filled.
:return: True if the order filled.
:return: True if the order filled.
"""
if order and self._get_order_filled(order.ft_price, row):
order.close_bt_order(current_date, trade)
@@ -1603,6 +1606,7 @@ class Backtesting:
pair_detail_cache: dict[str, list[tuple]] = {}
pair_tradedir_cache: dict[str, LongShort | None] = {}
pairs_with_open_trades = [t.pair for t in LocalTrade.bt_trades_open]
self._capture_wallet(current_time, self.strategy.config["stake_currency"], 1)
for current_time_det, is_first, has_detail, idx, pair in self._time_pair_generator_det(
current_time, pairs
@@ -1627,6 +1631,7 @@ class Backtesting:
)
trade_dir = self.check_for_trade_entry(row)
pair_tradedir_cache[pair] = trade_dir
self._capture_wallet(current_time, pair.split("/")[0], row[OPEN_IDX])
else:
# Detail candle - from cache.
@@ -1680,6 +1685,15 @@ class Backtesting:
yield current_time_det, pair, row, is_last_row, trade_dir
self.progress.increment()
def _capture_wallet(self, current_time: datetime, currency: str, price: float) -> None:
"""
Capture the current wallet state.
"""
if self.dataprovider.runmode != RunMode.BACKTEST:
return
if total := self.wallets.get_total(currency):
self.wallet_captures.append((current_time, currency, price, total))
def backtest(
self, processed: dict, start_date: datetime, end_date: datetime
) -> BacktestContentTypeIcomplete:
@@ -1739,6 +1753,7 @@ class Backtesting:
"canceled_entry_orders": self.canceled_entry_orders,
"replaced_entry_orders": self.replaced_entry_orders,
"final_balance": self.wallets.get_total(self.strategy.config["stake_currency"]),
"wallet_summary": convert_bt_wallet_collection(self.wallet_captures),
}
def backtest_one_strategy(
@@ -1867,6 +1882,11 @@ class Backtesting:
dt_appendix,
market_change_data=combined_res,
analysis_results=self.analysis_results,
wallet_summary={
s: x["wallet_summary"]
for s, x in self.all_bt_content.items()
if "wallet_summary" in x
},
strategy_files={s.get_strategy_name(): s.__file__ for s in self.strategylist},
)
@@ -12,6 +12,7 @@ from freqtrade.optimize.optimize_reports.bt_output import (
)
from freqtrade.optimize.optimize_reports.bt_storage import store_backtest_results
from freqtrade.optimize.optimize_reports.optimize_reports import (
convert_bt_wallet_collection,
generate_all_periodic_breakdown_stats,
generate_backtest_stats,
generate_daily_stats,
@@ -1,6 +1,8 @@
import logging
from typing import Any, Literal
from rich.text import Text
from freqtrade.constants import UNLIMITED_STAKE_AMOUNT, Config
from freqtrade.ft_types import BacktestResultType
from freqtrade.optimize.optimize_reports.optimize_reports import generate_periodic_breakdown_stats
@@ -9,6 +11,8 @@ from freqtrade.util import decimals_per_coin, fmt_coin, print_rich_table
logger = logging.getLogger(__name__)
__EMPTY_LINE = ("", "")
def _get_line_floatfmt(stake_currency: str) -> list[str]:
"""
@@ -201,7 +205,7 @@ def text_table_add_metrics(strat_results: dict) -> None:
short_metrics = (
[
("", ""), # Empty line to improve readability
__EMPTY_LINE, # Empty line to improve readability
(
"Long / Short trades",
f"{strat_results.get('trade_count_long', 'total_trades')} / "
@@ -222,7 +226,7 @@ def text_table_add_metrics(strat_results: dict) -> None:
else []
)
drawdown_metrics = []
drawdown_metrics: list[tuple[str | Text, str | Text]] = []
if "max_relative_drawdown" in strat_results:
# Compatibility to show old hyperopt results
drawdown_metrics.append(
@@ -287,6 +291,79 @@ def text_table_add_metrics(strat_results: dict) -> None:
if "trading_mode" in strat_results
else []
)
wallet_metrics: list[tuple[str, str]] = [
(
"Min/Max balance (closed trades)",
f"{fmt_coin(strat_results['csum_min'], stake)} / "
f"{fmt_coin(strat_results['csum_max'], stake)}",
),
]
wallet_stats = strat_results.get("wallet_stats", {})
if wallet_stats:
drawdown_metrics.extend(
[
__EMPTY_LINE, # Empty line to improve readability
(Text("Wallet based Metrics", style="bold"), ""),
(
"Min/Max balance (wallet balance)",
f"{fmt_coin(wallet_stats['low_balance'], stake)} / "
f"{fmt_coin(wallet_stats['high_balance'], stake)}",
),
(
"Min/Max balance dates (wallet balance)",
f"{wallet_stats['low_date']} / {wallet_stats['high_date']}",
),
]
)
if "max_drawdown_abs" in wallet_stats:
# Assume that if sharpe is there, all others are there as well.
drawdown_metrics.extend(
[
(
"Max % of account underwater (balance)",
f"{wallet_stats['max_relative_drawdown']:.2%}",
),
(
"Absolute drawdown (wallet balance)",
f"{fmt_coin(wallet_stats['max_drawdown_abs'], stake)} "
f"({wallet_stats['max_drawdown_account']:.2%})",
),
(
"Drawdown duration",
wallet_stats["drawdown_duration"]
if "drawdown_duration" in wallet_stats
else "N/A",
),
(
"Profit at drawdown start",
fmt_coin(wallet_stats["max_drawdown_high"], stake),
),
(
"Profit at drawdown end",
fmt_coin(wallet_stats["max_drawdown_low"], stake),
),
("Drawdown start", wallet_stats["drawdown_start"]),
("Drawdown end", wallet_stats["drawdown_end"]),
(
"Sharpe (daily wallet balance)",
f"{wallet_stats['sharpe']:.2f}"
if wallet_stats and "sharpe" in wallet_stats
else "N/A",
),
(
"Sortino (daily wallet balance)",
f"{wallet_stats['sortino']:.2f}"
if wallet_stats and "sortino" in wallet_stats
else "N/A",
),
(
"Calmar (daily wallet balance)",
f"{wallet_stats['calmar']:.2f}"
if wallet_stats and "calmar" in wallet_stats
else "N/A",
),
]
)
# Newly added fields should be ignored if they are missing in strat_results. hyperopt-show
# command stores these results and newer version of freqtrade must be able to handle old
@@ -296,7 +373,7 @@ def text_table_add_metrics(strat_results: dict) -> None:
("Backtesting to", strat_results["backtest_end"]),
*trading_mode,
("Max open trades", strat_results["max_open_trades"]),
("", ""), # Empty line to improve readability
__EMPTY_LINE, # Empty line to improve readability
(
"Total/Daily Avg Trades",
f"{strat_results['total_trades']} / {strat_results['trades_per_day']}",
@@ -315,9 +392,18 @@ def text_table_add_metrics(strat_results: dict) -> None:
),
("Total profit %", f"{strat_results['profit_total']:.2%}"),
("CAGR %", f"{strat_results['cagr']:.2%}" if "cagr" in strat_results else "N/A"),
("Sortino", f"{strat_results['sortino']:.2f}" if "sortino" in strat_results else "N/A"),
("Sharpe", f"{strat_results['sharpe']:.2f}" if "sharpe" in strat_results else "N/A"),
("Calmar", f"{strat_results['calmar']:.2f}" if "calmar" in strat_results else "N/A"),
(
"Sharpe (closed trades)",
f"{strat_results['sharpe']:.2f}" if "sharpe" in strat_results else "N/A",
),
(
"Sortino (closed trades)",
f"{strat_results['sortino']:.2f}" if "sortino" in strat_results else "N/A",
),
(
"Calmar (closed trades)",
f"{strat_results['calmar']:.2f}" if "calmar" in strat_results else "N/A",
),
("SQN", f"{strat_results['sqn']:.2f}" if "sqn" in strat_results else "N/A"),
(
"Profit factor",
@@ -346,12 +432,13 @@ def text_table_add_metrics(strat_results: dict) -> None:
"Avg. stake amount",
fmt_coin(strat_results["avg_stake_amount"], stake),
),
("Market change", f"{strat_results['market_change']:.2%}"),
(
"Total trade volume",
fmt_coin(strat_results["total_volume"], stake),
),
*short_metrics,
("", ""), # Empty line to improve readability
__EMPTY_LINE, # Empty line to improve readability
(
"Best Pair",
f"{strat_results['best_pair']['key']} "
@@ -407,11 +494,9 @@ def text_table_add_metrics(strat_results: dict) -> None:
f"{strat_results.get('timedout_exit_orders', 'N/A')}",
),
*entry_adjustment_metrics,
("", ""), # Empty line to improve readability
("Min balance", fmt_coin(strat_results["csum_min"], stake)),
("Max balance", fmt_coin(strat_results["csum_max"], stake)),
__EMPTY_LINE, # Empty line to improve readability
*wallet_metrics,
*drawdown_metrics,
("Market change", f"{strat_results['market_change']:.2%}"),
]
print_rich_table(metrics, ["Metric", "Value"], summary="SUMMARY METRICS", justify="left")
@@ -52,6 +52,7 @@ def store_backtest_results(
dtappendix: str,
*,
market_change_data: DataFrame | None = None,
wallet_summary: dict[str, DataFrame] | None = None,
analysis_results: dict[str, dict[str, DataFrame]] | None = None,
strategy_files: dict[str, str] | None = None,
) -> Path:
@@ -123,6 +124,15 @@ def store_backtest_results(
market_change_buf.seek(0)
zipf.writestr(market_change_name, market_change_buf.getvalue())
# Add wallet summary if present
if wallet_summary is not None:
for strategy, df in wallet_summary.items():
wallet_name = f"{base_filename.stem}_{strategy}_wallet.feather"
wallet_buf = BytesIO()
df.reset_index().to_feather(wallet_buf, compression_level=9, compression="lz4")
wallet_buf.seek(0)
zipf.writestr(wallet_name, wallet_buf.getvalue())
# Add analysis results if present and running in backtest mode
if (
config.get("export", "none") == "signals"
@@ -10,12 +10,16 @@ from freqtrade.constants import BACKTEST_BREAKDOWNS, DATETIME_PRINT_FORMAT
from freqtrade.data.metrics import (
calculate_cagr,
calculate_calmar,
calculate_calmar_from_balance,
calculate_csum,
calculate_expectancy,
calculate_market_change,
calculate_max_drawdown,
calculate_max_drawdown_from_balance,
calculate_sharpe,
calculate_sharpe_from_balance,
calculate_sortino,
calculate_sortino_from_balance,
calculate_sqn,
)
from freqtrade.ft_types import (
@@ -29,6 +33,94 @@ from freqtrade.util import decimals_per_coin, fmt_coin, format_duration, get_dry
logger = logging.getLogger(__name__)
def convert_bt_wallet_collection(wallet_captures: list[tuple]) -> DataFrame:
"""
Convert the wallet capture list to a DataFrame.
Assumes the wallet_captures list contains tuples with the following structure:
(date, currency, price, balance).
"""
if len(wallet_captures) == 0:
return DataFrame()
return DataFrame(
wallet_captures,
columns=["date", "currency", "rate", "balance"],
)
def generate_wallet_stats(wallet_df: DataFrame, stake_currency: str) -> dict[str, Any]:
"""Generate wallet statistics from the wallet DataFrame."""
if wallet_df is None or wallet_df.empty:
return {}
wallet_df.loc[:, "total_quote"] = wallet_df["rate"] * wallet_df["balance"]
# Group by date to get total wallet value at each timestamp
wallet = wallet_df.groupby("date")["total_quote"].sum().reset_index()
total_quote = wallet["total_quote"]
low_idx = total_quote.idxmin()
high_idx = total_quote.idxmax()
start_balance = wallet.iloc[0]["total_quote"]
end_balance = wallet.iloc[-1]["total_quote"]
high_balance = total_quote.loc[high_idx]
low_balance = total_quote.loc[low_idx]
low_date = wallet.loc[low_idx, "date"]
high_date = wallet.loc[high_idx, "date"]
sharpe = calculate_sharpe_from_balance(wallet)
sortino = calculate_sortino_from_balance(wallet)
calmar = calculate_calmar_from_balance(wallet)
try:
drawdown = calculate_max_drawdown_from_balance(wallet)
# max_relative_drawdown = Underwater
drawdown_duration = drawdown.low_date - drawdown.high_date
except ValueError:
drawdown = None
drawdown_duration = timedelta()
try:
underwater = calculate_max_drawdown_from_balance(wallet, relative=True)
except ValueError:
underwater = None
return {
"start_balance": start_balance,
"end_balance": end_balance,
"high_balance": high_balance,
"low_balance": low_balance,
"sharpe": sharpe,
"sortino": sortino,
"calmar": calmar,
"low_date": low_date.strftime(DATETIME_PRINT_FORMAT),
"low_ts": int(low_date.timestamp() * 1000),
"high_date": high_date.strftime(DATETIME_PRINT_FORMAT),
"high_ts": int(high_date.timestamp() * 1000),
# Drawdown metrics
"max_drawdown_account": drawdown.relative_account_drawdown if drawdown else 0.0,
"max_relative_drawdown": underwater.relative_account_drawdown if underwater else 0.0,
"max_drawdown_abs": drawdown.drawdown_abs if drawdown else 0.0,
"drawdown_start": (
drawdown.high_date.strftime(DATETIME_PRINT_FORMAT)
if drawdown and drawdown.high_date is not None
else None
),
"drawdown_start_ts": (
int(drawdown.high_date.timestamp() * 1000)
if drawdown and drawdown.high_date is not None
else None
),
"drawdown_end": (
drawdown.low_date.strftime(DATETIME_PRINT_FORMAT)
if drawdown and drawdown.low_date is not None
else None
),
"drawdown_end_ts": (
int(drawdown.low_date.timestamp() * 1000)
if drawdown and drawdown.low_date is not None
else None
),
"drawdown_duration": drawdown_duration,
"drawdown_duration_s": drawdown_duration.total_seconds(),
"max_drawdown_low": drawdown.low_value if drawdown else 0.0,
"max_drawdown_high": drawdown.high_value if drawdown else 0.0,
}
def generate_trade_signal_candles(
preprocessed_df: dict[str, DataFrame], bt_results: BacktestContentType, date_col: str
) -> dict[str, DataFrame]:
@@ -155,7 +247,7 @@ def generate_pair_metrics( #
skip_nan: bool = False,
) -> list[dict]:
"""
Generates and returns a list for the given backtest data and the results dataframe
Generates and returns a list for the given backtest data and the results dataframe
:param pairlist: Pairlist used
:param stake_currency: stake-currency - used to correctly name headers
:param starting_balance: Starting balance
@@ -248,7 +340,7 @@ def generate_strategy_comparison(bt_stats: dict) -> list[dict]:
def _get_resample_from_period(period: str) -> str:
if period == "day":
return "1d"
return "1D"
if period == "week":
# Weekly defaulting to Monday.
return "1W-MON"
@@ -438,8 +530,8 @@ def generate_daily_stats(results: DataFrame) -> dict[str, Any]:
"losing_days": 0,
"daily_profit_list": [],
}
daily_profit_rel = results.resample("1d", on="close_date")["profit_ratio"].sum()
daily_profit = results.resample("1d", on="close_date")["profit_abs"].sum().round(10)
daily_profit_rel = results.resample("1D", on="close_date")["profit_ratio"].sum()
daily_profit = results.resample("1D", on="close_date")["profit_abs"].sum().round(10)
worst_rel = min(daily_profit_rel)
best_rel = max(daily_profit_rel)
worst = min(daily_profit)
@@ -592,6 +684,7 @@ def generate_strategy_stats(
"sharpe": calculate_sharpe(results, min_date, max_date, start_balance),
"calmar": calculate_calmar(results, min_date, max_date, start_balance),
"sqn": calculate_sqn(results, start_balance),
"wallet_stats": generate_wallet_stats(content.get("wallet_summary"), stake_currency),
"profit_factor": profit_factor,
"backtest_start": min_date.strftime(DATETIME_PRINT_FORMAT),
"backtest_start_ts": int(min_date.timestamp() * 1000),
+2 -2
View File
@@ -9,7 +9,7 @@ class SKDecimal(FloatDistribution):
*,
step: float | None = None,
decimals: int | None = None,
name=None,
name: str | None = None,
):
"""
FloatDistribution with a fixed step size.
@@ -26,7 +26,7 @@ class SKDecimal(FloatDistribution):
raise ValueError("You must set one of decimals or step")
# Convert decimals to step
self.step = step or (1 / 10**decimals if decimals else 1)
self.name = name
self.name = name or ""
super().__init__(
low=round(low, decimals) if decimals else low,
+1
View File
@@ -10,3 +10,4 @@ from freqtrade.persistence.usedb_context import (
disable_database_use,
enable_database_use,
)
from freqtrade.persistence.wallet_history import WalletHistory
+81
View File
@@ -0,0 +1,81 @@
import logging
from sqlalchemy import func, select
from sqlalchemy.orm import make_transient
from freqtrade.persistence.base import SessionType
from freqtrade.persistence.custom_data import _CustomData
from freqtrade.persistence.key_value_store import _KeyValueStoreModel
from freqtrade.persistence.migrations import set_sequence_ids
from freqtrade.persistence.pairlock import PairLock
from freqtrade.persistence.trade_model import Order, Trade
from freqtrade.persistence.wallet_history import WalletHistory
logger = logging.getLogger(__name__)
def migrate_db(session_target: SessionType):
trade_count = 0
pairlock_count = 0
kv_count = 0
custom_data_count = 0
wallet_history_count = 0
for trade in Trade.get_trades():
trade_count += 1
make_transient(trade)
for o in trade.orders:
make_transient(o)
session_target.add(trade)
session_target.commit()
for pairlock in PairLock.get_all_locks():
pairlock_count += 1
make_transient(pairlock)
session_target.add(pairlock)
session_target.commit()
for kv in _KeyValueStoreModel.session.scalars(select(_KeyValueStoreModel)):
kv_count += 1
make_transient(kv)
session_target.add(kv)
session_target.commit()
for cd in _CustomData.session.scalars(select(_CustomData)):
custom_data_count += 1
make_transient(cd)
session_target.add(cd)
session_target.commit()
for wh in WalletHistory.session.scalars(select(WalletHistory)):
wallet_history_count += 1
make_transient(wh)
session_target.add(wh)
session_target.commit()
# Update sequences
max_trade_id = session_target.scalar(select(func.max(Trade.id)))
max_order_id = session_target.scalar(select(func.max(Order.id)))
max_pairlock_id = session_target.scalar(select(func.max(PairLock.id)))
max_kv_id = session_target.scalar(select(func.max(_KeyValueStoreModel.id)))
max_custom_data_id = session_target.scalar(select(func.max(_CustomData.id)))
max_wallet_history_id = session_target.scalar(select(func.max(WalletHistory.id)))
set_sequence_ids(
session_target.get_bind(),
trade_id=(max_trade_id or 0) + 1,
order_id=(max_order_id or 0) + 1,
pairlock_id=(max_pairlock_id or 0) + 1,
kv_id=(max_kv_id or 0) + 1,
custom_data_id=(max_custom_data_id or 0) + 1,
wallet_history_id=(max_wallet_history_id or 0) + 1,
)
logger.info(
f"Migrated {trade_count} Trades, {pairlock_count} Pairlocks, "
f"{kv_count} Key-Value pairs, {custom_data_count} Custom Data entries, "
f"and {wallet_history_count} Wallet History entries."
)
+4 -1
View File
@@ -18,10 +18,13 @@ class ValueTypesEnum(StrEnum):
INT = "int"
# must be < 50 characters to fit the database column
KeyStoreKeys = Literal[
"bot_start_time",
"startup_time",
"binance_migration",
"wallet_history_migration",
"wallet_history_migration_date",
]
@@ -35,7 +38,7 @@ class _KeyValueStoreModel(ModelBase):
id: Mapped[int] = mapped_column(primary_key=True)
key: Mapped[KeyStoreKeys] = mapped_column(String(25), nullable=False, index=True)
key: Mapped[KeyStoreKeys] = mapped_column(String(50), nullable=False, index=True)
value_type: Mapped[ValueTypesEnum] = mapped_column(String(20), nullable=False)
+50 -4
View File
@@ -35,10 +35,12 @@ def get_last_sequence_ids(engine, sequence_name: str, table_back_name: str) -> i
if engine.name == "postgresql":
with engine.begin() as connection:
last_id = connection.execute(text(f"select nextval('{sequence_name}')")).fetchone()[0]
last_id = connection.execute(
text(f"""select nextval('"{sequence_name}"')""")
).fetchone()[0]
with engine.begin() as connection:
connection.execute(
text(f"ALTER SEQUENCE {sequence_name} rename to {table_back_name}_id_seq_bak")
text(f'ALTER SEQUENCE "{sequence_name}" rename to "{table_back_name}_id_seq_bak"')
)
return last_id
@@ -51,6 +53,7 @@ def set_sequence_ids(
pairlock_id: int | None = None,
kv_id: int | None = None,
custom_data_id: int | None = None,
wallet_history_id: int | None = None,
):
"""
Set sequence ids to the given values.
@@ -62,6 +65,7 @@ def set_sequence_ids(
:param pairlock_id: value to set for pairlocks_id_seq (optional)
:param kv_id: value to set for KeyValueStore_id_seq (optional)
:param custom_data_id: value to set for trade_custom_data_id_seq (optional)
:param wallet_history_id: value to set for wallet_history_id_seq (optional)
"""
if engine.name == "postgresql":
with engine.begin() as connection:
@@ -81,6 +85,10 @@ def set_sequence_ids(
connection.execute(
text(f"ALTER SEQUENCE trade_custom_data_id_seq RESTART WITH {custom_data_id}")
)
if wallet_history_id:
connection.execute(
text(f"ALTER SEQUENCE wallet_history_id_seq RESTART WITH {wallet_history_id}")
)
def drop_index_on_table(engine, inspector, table_bak_name):
@@ -88,9 +96,9 @@ def drop_index_on_table(engine, inspector, table_bak_name):
# drop indexes on backup table in new session
for index in inspector.get_indexes(table_bak_name):
if engine.name == "mysql":
connection.execute(text(f"drop index {index['name']} on {table_bak_name}"))
connection.execute(text(f'drop index "{index["name"]}" on {table_bak_name}'))
else:
connection.execute(text(f"drop index {index['name']}"))
connection.execute(text(f'drop index "{index["name"]}"'))
def migrate_trades_and_orders_table(
@@ -315,6 +323,31 @@ def migrate_pairlocks_table(decl_base, inspector, engine, pairlock_back_name: st
set_sequence_ids(engine, pairlock_id=pairlock_id)
def migrate_kv_store_table(decl_base, inspector, engine, kv_store_back_name: str, cols: list):
# Schema migration necessary
with engine.begin() as connection:
connection.execute(text(f'alter table "KeyValueStore" rename to "{kv_store_back_name}"'))
drop_index_on_table(engine, inspector, kv_store_back_name)
kv_store_id = get_last_sequence_ids(engine, "KeyValueStore_id_seq", kv_store_back_name)
# let SQLAlchemy create the schema as required
decl_base.metadata.create_all(engine)
# Copy data back - following the correct schema
with engine.begin() as connection:
connection.execute(
text(
f"""insert into "KeyValueStore"
(id, key, value_type, string_value, datetime_value, float_value, int_value)
select id, key, value_type, string_value, datetime_value, float_value, int_value
from "{kv_store_back_name}"
"""
)
)
set_sequence_ids(engine, kv_id=kv_store_id)
def set_sqlite_to_wal(engine):
if engine.name == "sqlite" and str(engine.url) != "sqlite://":
# Set Mode to
@@ -385,12 +418,15 @@ def check_migrate(engine: Engine, decl_base, previous_tables: list[str]) -> None
cols_trades = inspector.get_columns("trades")
cols_orders = inspector.get_columns("orders")
cols_pairlocks = inspector.get_columns("pairlocks")
cols_kv_store = inspector.get_columns("KeyValueStore")
tabs = get_table_names_for_table(inspector, "trades")
table_back_name = get_backup_name(tabs, "trades_bak")
order_tabs = get_table_names_for_table(inspector, "orders")
order_table_bak_name = get_backup_name(order_tabs, "orders_bak")
pairlock_tabs = get_table_names_for_table(inspector, "pairlocks")
pairlock_table_bak_name = get_backup_name(pairlock_tabs, "pairlocks_bak")
kv_store_tabs = get_table_names_for_table(inspector, "KeyValueStore")
kv_store_back_name = get_backup_name(kv_store_tabs, "KeyValueStore_bak")
# Check if migration necessary
# Migrates both trades and orders table!
@@ -421,6 +457,16 @@ def check_migrate(engine: Engine, decl_base, previous_tables: list[str]) -> None
migrate_pairlocks_table(
decl_base, inspector, engine, pairlock_table_bak_name, cols_pairlocks
)
if "KeyValueStore" in previous_tables:
key_column = next(filter(lambda x: x["name"] == "key", cols_kv_store), None)
# length of key column < 50, recreate table with correct length and migrate data
if key_column and getattr(key_column["type"], "length", -1) < 50:
migrating = True
logger.info(
f"Running database migration for KeyValueStore - backup: {kv_store_back_name}"
)
migrate_kv_store_table(decl_base, inspector, engine, kv_store_back_name, cols_kv_store)
if "orders" not in previous_tables and "trades" in previous_tables:
raise OperationalException(
"Your database seems to be very old. "
+2
View File
@@ -20,6 +20,7 @@ from freqtrade.persistence.key_value_store import _KeyValueStoreModel
from freqtrade.persistence.migrations import check_migrate
from freqtrade.persistence.pairlock import PairLock
from freqtrade.persistence.trade_model import Order, Trade
from freqtrade.persistence.wallet_history import WalletHistory
logger = logging.getLogger(__name__)
@@ -91,6 +92,7 @@ def init_db(db_url: str) -> None:
_CustomData.session = scoped_session(
sessionmaker(bind=engine, autoflush=True), scopefunc=get_request_or_thread_id
)
WalletHistory.session = Trade.session
previous_tables = inspect(engine).get_table_names()
ModelBase.metadata.create_all(engine)
+5
View File
@@ -29,6 +29,11 @@ class PairLock(ModelBase):
active: Mapped[bool] = mapped_column(nullable=False, default=True, index=True)
@property
def lock_end_time_utc(self) -> datetime:
"""Lock end time with UTC timezoneinfo"""
return self.lock_end_time.replace(tzinfo=UTC)
def __repr__(self) -> str:
lock_time = self.lock_time.strftime(DATETIME_PRINT_FORMAT)
lock_end_time = self.lock_end_time.strftime(DATETIME_PRINT_FORMAT)
+11 -1
View File
@@ -42,6 +42,7 @@ class PairLocks:
) -> PairLock:
"""
Create PairLock from now to "until".
Doesn't create a new lock if there is already a lock with the same Reason, side and endtime.
Uses database by default, unless PairLocks.use_db is set to False,
in which case a list is maintained.
:param pair: pair to lock. use '*' to lock all pairs
@@ -50,10 +51,19 @@ class PairLocks:
:param now: Current timestamp. Used to determine lock start time.
:param side: Side to lock pair, can be 'long', 'short' or '*'
"""
lock_end_time = timeframe_to_next_date(PairLocks.timeframe, until)
existing_locks = PairLocks.get_pair_locks(pair, now, side=side)
for lock in existing_locks:
if (
lock.reason == reason
and lock.lock_end_time_utc == lock_end_time
and lock.side == side
):
return lock
lock = PairLock(
pair=pair,
lock_time=now or datetime.now(UTC),
lock_end_time=timeframe_to_next_date(PairLocks.timeframe, until),
lock_end_time=lock_end_time,
reason=reason,
side=side,
active=True,
+17 -14
View File
@@ -189,8 +189,8 @@ class Order(ModelBase):
def __repr__(self):
return (
f"Order(id={self.id}, trade={self.ft_trade_id}, order_id={self.order_id}, "
f"side={self.side}, filled={self.safe_filled}, price={self.safe_price}, "
f"amount={self.amount}, "
f"side={self.side or self.ft_order_side}, filled={self.safe_filled}, "
f"price={self.safe_price}, amount={self.amount}, "
f"status={self.status}, date={self.order_date_utc:{DATETIME_PRINT_FORMAT}})"
)
@@ -858,9 +858,9 @@ class LocalTrade:
higher_stop = stop_loss_norm > self.stop_loss
lower_stop = stop_loss_norm < self.stop_loss
# stop losses only walk up, never down!,
# ? But adding more to a leveraged trade would create a lower liquidation price,
# ? decreasing the minimum stoploss
# stop losses only walk up, never down!
# but adding more to a leveraged trade would create a lower liquidation price,
# decreasing the minimum stoploss
if (
allow_refresh
or (higher_stop and not self.is_short)
@@ -1248,12 +1248,16 @@ class LocalTrade:
close_profit_abs = 0.0
# Reset funding fees
self.funding_fees = 0.0
funding_fees = 0.0
ordercount = len(self.orders) - 1
# Total funding fees - cumulated over all orders
total_funding_fees = 0.0
# current funding fees - resetting on every exit to be aligned with profit calculation,
# as funding fees are part of the profit
current_funding_fee = 0.0
for i, o in enumerate(self.orders):
if o.ft_is_open or not o.filled:
continue
funding_fees += o.funding_fee or 0.0
current_funding_fee += o.funding_fee or 0.0
total_funding_fees += o.funding_fee or 0.0
tmp_amount = FtPrecise(o.safe_amount_after_fee)
tmp_price = FtPrecise(o.safe_price)
@@ -1268,11 +1272,8 @@ class LocalTrade:
avg_price = current_stake / current_amount
if is_exit:
# Process exits
if i == ordercount and is_closing:
# Apply funding fees only to the last closing order
self.funding_fees = funding_fees
# Intermediate funding fees for profit calculation
self.funding_fees = current_funding_fee
exit_rate = o.safe_price
exit_amount = o.safe_amount_after_fee
prof = self.calculate_profit(exit_rate, exit_amount, float(avg_price))
@@ -1281,10 +1282,12 @@ class LocalTrade:
# This needs to be calculated based on the last occurring exit to be aligned
# with realized_profit.
close_profit = (close_profit_abs / total_stake) * self.leverage
current_funding_fee = 0.0
else:
total_stake += self._calc_open_trade_value(tmp_amount, price)
max_stake_amount += tmp_amount * price
self.funding_fees = funding_fees
# Assign cumulated funding fees after all orders have been processed
self.funding_fees = total_funding_fees
self.max_stake_amount = float(max_stake_amount) / (self.leverage or 1.0)
if close_profit:
+50
View File
@@ -0,0 +1,50 @@
from datetime import datetime
from typing import ClassVar
from sqlalchemy import DateTime, Float, Integer, String, UniqueConstraint
from sqlalchemy.orm import Mapped, mapped_column
from freqtrade.persistence.base import ModelBase, SessionType
class WalletHistory(ModelBase):
"""
Daily wallet state tracking with minimal fields
"""
__tablename__ = "wallet_history"
session: ClassVar[SessionType]
id: Mapped[int] = mapped_column(Integer, primary_key=True)
timestamp: Mapped[datetime] = mapped_column(DateTime, nullable=False, index=True)
currency: Mapped[str] = mapped_column(String(25), nullable=False)
# Rate: price of 1 unit of `currency` quoted in `quote_currency`.
# e.g., USDT/ETH -> USDT per ETH
rate: Mapped[float] = mapped_column(Float, nullable=True)
# Quote currency for rate/total fields (e.g., 'USDT')
quote_currency: Mapped[str] = mapped_column(String(25), nullable=False)
# Balance in `currency` units
balance: Mapped[float] = mapped_column(Float, nullable=False)
# Canonical total wallet equity/value denominated in `quote_currency` (if available)
# For futures positions, collateral + PnL is used to compute this value.
total_quote: Mapped[float] = mapped_column(Float, nullable=True)
# Total position value in `quote_currency` - including leverage
total_position_value: Mapped[float] = mapped_column(Float, nullable=True)
collateral: Mapped[float] = mapped_column(Float, nullable=True)
leverage: Mapped[float] = mapped_column(Float, nullable=False, default=1.0)
bot_managed: Mapped[bool] = mapped_column(nullable=False, default=True)
__table_args__ = (
# Ensure one record per currency per day
UniqueConstraint("timestamp", "currency", name="unique_wallet_daily"),
)
def __repr__(self) -> str:
return (
f"WalletHistory(timestamp={self.timestamp}, currency={self.currency}, "
f"rate={self.rate}, total_quote={self.total_quote}, "
f"balance={self.balance}, leverage={self.leverage})"
)
+3 -3
View File
@@ -263,7 +263,7 @@ def plot_trades(fig, trades: pd.DataFrame) -> make_subplots:
trades["desc"] = trades.apply(
lambda row: (
f"{row['profit_ratio']:.2%}, "
+ (f"{row['enter_tag']}, " if row["enter_tag"] is not None else "")
+ (f"{row['enter_tag']}, " if pd.notna(row["enter_tag"]) else "")
+ f"{row['exit_reason']}, "
+ f"{row['trade_duration']} min"
),
@@ -356,7 +356,7 @@ def plot_area(
:param indicator_b: indicator name as populated in strategy
:param label: label for the filled area
:param fill_color: color to be used for the filled area
:return: fig with added filled_traces plot
:return: fig with added filled_traces plot
"""
if indicator_a in data and indicator_b in data:
# make lines invisible to get the area plotted, only.
@@ -383,7 +383,7 @@ def add_areas(fig, row: int, data: pd.DataFrame, indicators) -> make_subplots:
:param data: candlestick DataFrame
:param indicators: dict with indicators. ie.: plot_config['main_plot'] or
plot_config['subplots'][subplot_label]
:return: fig with added filled_traces plot
:return: fig with added filled_traces plot
"""
for indicator, ind_conf in indicators.items():
if "fill_to" in ind_conf:
+3 -2
View File
@@ -23,9 +23,10 @@ class DelistFilter(IPairList):
self._max_days_from_now = self._pairlistconfig.get("max_days_from_now", 0)
if self._max_days_from_now < 0:
raise ConfigurationError("DelistFilter requires max_days_from_now to be >= 0")
if not self._exchange._ft_has["has_delisting"]:
if not self._exchange.get_option("has_delisting"):
raise ConfigurationError(
"DelistFilter doesn't support this exchange and trading mode combination.",
f"DelistFilter doesn't support {self._exchange.name} in "
f"{self._exchange.trading_mode} mode."
)
def short_desc(self) -> str:
@@ -38,7 +38,7 @@ class MarketCapPairList(IPairList):
self._max_rank = self._pairlistconfig.get("max_rank", 30)
self._refresh_period = self._pairlistconfig.get("refresh_period", 86400)
self._categories = self._pairlistconfig.get("categories", [])
self._marketcap_cache: FtTTLCache = FtTTLCache(maxsize=1, ttl=self._refresh_period)
self._marketcap_cache: FtTTLCache = FtTTLCache(maxsize=2, ttl=self._refresh_period)
_coingecko_config = self._config.get("coingecko", {})
+1 -1
View File
@@ -51,7 +51,7 @@ class StrategyResolver(IResolver):
strategy: IStrategy = StrategyResolver._load_strategy(
strategy_name, config=config, extra_dir=config.get("strategy_path")
)
strategy.ft_load_params_from_file()
strategy.ft_set_special_params_from_file()
# Set attributes
# Check if we need to override configuration
# (Attribute name, default, subkey)
-1
View File
@@ -15,7 +15,6 @@ from freqtrade.rpc.api_server.deps import get_api_config
logger = logging.getLogger(__name__)
ALGORITHM = "HS256"
__DEFAULT_JWT = "somethingRandomSomethingRandom123"
router_login = APIRouter()
+35 -1
View File
@@ -16,10 +16,11 @@ from freqtrade.data.btanalysis import (
get_backtest_market_change,
get_backtest_result,
get_backtest_resultlist,
get_backtest_wallet_change,
load_and_merge_backtest_result,
update_backtest_metadata,
)
from freqtrade.enums import BacktestState
from freqtrade.enums import BacktestState, RunMode
from freqtrade.exceptions import ConfigurationError, DependencyException, OperationalException
from freqtrade.ft_types import get_BacktestResultType_default
from freqtrade.misc import deep_merge_dicts, is_file_in_dir
@@ -29,6 +30,7 @@ from freqtrade.rpc.api_server.api_schemas import (
BacktestMetadataUpdate,
BacktestRequest,
BacktestResponse,
WalletHistoryResponse,
)
from freqtrade.rpc.api_server.deps import get_config, verify_strategy
from freqtrade.rpc.api_server.webserver_bgwork import ApiBG
@@ -106,6 +108,11 @@ def __run_backtest_bg(btconfig: Config):
ApiBG.bt["bt"].results,
datetime.now().strftime("%Y-%m-%d_%H-%M-%S"),
market_change_data=combined_res,
wallet_summary={
s: x["wallet_summary"]
for s, x in ApiBG.bt["bt"].all_bt_content.items()
if "wallet_summary" in x
},
strategy_files={
s.get_strategy_name(): s.__file__ for s in ApiBG.bt["bt"].strategylist
},
@@ -137,6 +144,7 @@ async def api_start_backtest(
verify_strategy(bt_settings.strategy)
btconfig = deepcopy(config)
btconfig["runmode"] = RunMode.BACKTEST
remove_exchange_credentials(btconfig["exchange"], True)
settings = dict(bt_settings)
if settings.get("freqai", None) is not None:
@@ -354,3 +362,29 @@ def api_get_backtest_market_change(file: str, config=Depends(get_config)):
"data": df.values.tolist(),
"length": len(df),
}
@router.get(
"/backtest/history/{file}/{strategy}/wallet",
response_model=WalletHistoryResponse,
tags=["webserver", "backtest"],
)
def api_get_backtest_wallet(file: str, strategy: str, config=Depends(get_config)):
bt_results_base: Path = config["user_data_dir"] / "backtest_results"
file_abs = (bt_results_base / file).with_suffix(".zip")
# Ensure file is in backtest_results directory
if not is_file_in_dir(file_abs, bt_results_base):
raise HTTPException(status_code=400, detail="Unable to retrieve wallet history.")
results = get_backtest_wallet_change(file_abs, strategy)
if results is None:
raise HTTPException(status_code=404, detail="Unable to retrieve wallet history.")
# Consolidate the wallet to the base currency
results.loc[:, "total_quote"] = results["rate"] * results["balance"]
results = results.groupby(["date", "__date_ts"]).agg({"total_quote": "sum"}).reset_index()
return {
"columns": results.columns.tolist(),
"data": results.values.tolist(),
"length": len(results),
}
+10
View File
@@ -255,6 +255,7 @@ class ShowConfig(BaseModel):
timeframe_ms: int
timeframe_min: int
exchange: str
demo_trading: bool
strategy: str | None = None
force_entry_enable: bool
exit_pricing: dict[str, Any]
@@ -679,6 +680,15 @@ class BacktestMarketChange(BaseModel):
data: list[list[Any]]
class WalletHistoryResponse(BaseModel):
columns: list[str]
length: int
data: list[list[Any]]
# start date of the effectively captured data
# Before this date, it's based on a reconstructed wallet history
capture_start_ts: int | None = None
class MarketRequest(ExchangeModePayloadMixin, BaseModel):
base: str | None = None
quote: str | None = None
+17
View File
@@ -31,6 +31,7 @@ from freqtrade.rpc.api_server.api_schemas import (
ResultMsg,
Stats,
StatusMsg,
WalletHistoryResponse,
WhitelistResponse,
)
from freqtrade.rpc.api_server.deps import get_config, get_rpc
@@ -104,6 +105,22 @@ def stats(rpc: RPC = Depends(get_rpc)):
return rpc._rpc_stats()
@router.get(
"/historic_balance",
response_model=WalletHistoryResponse,
tags=["info"],
)
def api_get_wallet_history(rpc: RPC = Depends(get_rpc)):
results, capture_date_ts = rpc._rpc_get_historic_balance()
return {
"columns": results.columns.tolist(),
"data": results.values.tolist(),
"length": len(results),
"capture_start_ts": capture_date_ts,
}
@router.get("/daily", response_model=DailyWeeklyMonthly, tags=["Trading-info"])
def daily(
timescale: int = Query(7, ge=1, description="Number of days to fetch data for"),
+2 -1
View File
@@ -69,7 +69,8 @@ logger = logging.getLogger(__name__)
# 2.45: Add price to forceexit endpoint
# 2.46: Add prepend_data to download-data endpoint
# 2.47: Add Strategy parameters
API_VERSION = 2.47
# 2.48: add /backtest/history/wallets endpoint
API_VERSION = 2.48
# Public API, requires no auth.
router_public = APIRouter()
+33 -8
View File
@@ -11,8 +11,8 @@ from typing import TYPE_CHECKING, Any
import psutil
from dateutil.relativedelta import relativedelta
from dateutil.tz import tzlocal
from numpy import inf, int64, isnan, mean, nan
from pandas import DataFrame, NaT
from numpy import inf, isnan, mean, nan
from pandas import DataFrame, NaT, read_sql
from sqlalchemy import func, select
from freqtrade import __version__
@@ -176,6 +176,7 @@ class RPC:
timeframe_to_minutes(config["timeframe"]) if "timeframe" in config else 0
),
"exchange": config["exchange"]["name"],
"demo_trading": config["exchange"].get("demo_trading", False),
"strategy": config["strategy"],
"force_entry_enable": config.get("force_entry_enable", False),
"exit_pricing": config.get("exit_pricing", {}),
@@ -785,6 +786,26 @@ class RPC:
"bot_start_date": format_date(bot_start),
}
def _rpc_get_historic_balance(self) -> tuple[DataFrame, int]:
"""
Returns the historic balance of the bot
:return: DataFrame with the balance history and the timestamp of the migration
"""
results = read_sql("wallet_history", con=Trade.session.bind, parse_dates=["timestamp"])
results = results.rename({"timestamp": "date"}, axis=1)
results.loc[:, "__date_ts"] = results.loc[:, "date"].dt.as_unit("ms").astype("int64")
# Exclude non-bot managed for now
results_filtered = results.loc[results["bot_managed"].astype(bool)]
results_final = (
results_filtered.groupby(["date", "__date_ts"])
.agg({"total_quote": "sum"})
.reset_index()
)
hist = KeyValueStore.get_datetime_value("wallet_history_migration_date")
return results_final, dt_ts_def(hist, 0)
def __balance_get_est_stake(
self, coin: str, stake_currency: str, amount: float, balance: Wallet
) -> tuple[float, float]:
@@ -875,7 +896,7 @@ class RPC:
for symbol, pos in self._freqtrade.wallets.get_all_positions().items():
est_stake = pos.collateral
pos_base = self._freqtrade.exchange.get_pair_base_currency(symbol)
if pos.leverage:
if pos.leverage and pos.position:
try:
rate = self._freqtrade.exchange.get_conversion_rate(pos_base, stake_currency)
if rate:
@@ -1386,7 +1407,7 @@ class RPC:
}
def _rpc_locks(self) -> dict[str, Any]:
"""Returns the current locks"""
"""Returns the current locks"""
locks = PairLocks.get_pair_locks(None)
return {"lock_count": len(locks), "locks": [lock.to_json() for lock in locks]}
@@ -1515,7 +1536,9 @@ class RPC:
df_cols = [col for col in dataframe_columns if col in cols_set]
dataframe = dataframe.loc[:, df_cols]
dataframe.loc[:, "__date_ts"] = dataframe.loc[:, "date"].astype(int64) // 1000 // 1000
dataframe.loc[:, "__date_ts"] = (
dataframe.loc[:, "date"].dt.as_unit("ms").astype("int64")
)
# Move signal close to separate column when signal for easy plotting
for sig_type in signals.keys():
if sig_type in dataframe.columns:
@@ -1525,8 +1548,7 @@ class RPC:
# band-aid until this is fixed:
# https://github.com/pandas-dev/pandas/issues/45836
datetime_types = ["datetime", "datetime64", "datetime64[ns, UTC]"]
date_columns = dataframe.select_dtypes(include=datetime_types)
date_columns = dataframe.select_dtypes(include=["datetime", "datetime64", "datetimetz"])
for date_column in date_columns:
# replace NaT with `None`
dataframe[date_column] = dataframe[date_column].astype(object).replace({NaT: None})
@@ -1672,8 +1694,11 @@ class RPC:
else dt_ts(dt_now() - timedelta(days=30)),
is_new_pair=True, # history is never available - so always treat as new pair
candle_type=config.get("candle_type_def", CandleType.SPOT),
until_ms=timerange_parsed.stopts,
until_ms=timerange_parsed.stopts * 1000 if timerange_parsed.stopts else None,
)
if timerange_parsed.stopts and len(data) > 1:
# trim last candle if it is newer than the stop time
data = data.loc[data["date"] <= timerange_parsed.stopdt]
else:
_data = load_data(
datadir=config["datadir"],
+6 -4
View File
@@ -59,7 +59,7 @@ class RPCManager:
logger.info("Cleaning up rpc modules ...")
while self.registered_modules:
mod = self.registered_modules.pop()
logger.info("Cleaning up rpc.%s ...", mod.name)
logger.info(f"Cleaning up rpc.{mod.name} ...")
mod.cleanup()
del mod
@@ -73,7 +73,7 @@ class RPCManager:
}
"""
if msg.get("type") not in NO_ECHO_MESSAGES:
logger.info("Sending rpc message: %s", msg)
logger.info(f"Sending rpc message: {msg}")
for mod in self.registered_modules:
logger.debug("Forwarding message to rpc.%s", mod.name)
try:
@@ -81,7 +81,7 @@ class RPCManager:
except NotImplementedError:
logger.error(f"Message type '{msg['type']}' not implemented by handler {mod.name}.")
except Exception:
logger.exception("Exception occurred within RPC module %s", mod.name)
logger.exception(f"Exception occurred within RPC module {mod.name}")
def process_msg_queue(self, queue: deque) -> None:
"""
@@ -89,7 +89,7 @@ class RPCManager:
"""
while queue:
msg = queue.popleft()
logger.info("Sending rpc strategy_msg: %s", msg)
logger.info(f"Sending rpc strategy_msg: {msg}")
for mod in self.registered_modules:
if mod._config.get(mod.name, {}).get("allow_custom_messages", False):
mod.send_msg(
@@ -114,6 +114,8 @@ class RPCManager:
trailing_stop = config["trailing_stop"]
timeframe = config["timeframe"]
exchange_name = config["exchange"]["name"]
if config["exchange"].get("demo_trading"):
exchange_name += " (demo trading)"
strategy_name = config.get("strategy", "")
pos_adjust_enabled = "On" if config["position_adjustment_enable"] else "Off"
self.send_msg(
+4 -4
View File
@@ -483,7 +483,7 @@ class Telegram(RPCHandler):
profit_prefix = "Sub "
cp_extra = (
f"*Final Profit:* `{format_pct(msg['final_profit_ratio'])} "
f"({msg['cumulative_profit']:.8f} {msg['quote_currency']}{cp_fiat})`\n"
f"({fmt_coin(msg['cumulative_profit'], msg['stake_currency'])}{cp_fiat})`\n"
)
else:
exit_wording = f"Partially {exit_wording.lower()}"
@@ -832,7 +832,7 @@ class Telegram(RPCHandler):
):
# Adding initial stoploss only if it is different from stoploss
lines.append(
f"*Initial Stoploss:* `{r['initial_stop_loss_abs']:.8f}` "
f"*Initial Stoploss:* `{round_value(r['initial_stop_loss_abs'], 8)}` "
f"`({format_pct(r['initial_stop_loss_ratio'])})`"
)
@@ -2049,7 +2049,7 @@ class Telegram(RPCHandler):
await self._send_msg(
f"*Mode:* `{'Dry-run' if val['dry_run'] else 'Live'}`\n"
f"*Exchange:* `{val['exchange']}`\n"
f"*Exchange:* `{val['exchange']}{' (Demo)' if val['demo_trading'] else ''}`\n"
f"*Market: * `{val['trading_mode']}`\n"
f"*Stake per trade:* `{val['stake_amount']} {val['stake_currency']}`\n"
f"*Max open Trades:* `{val['max_open_trades']}`\n"
@@ -2243,7 +2243,7 @@ class Telegram(RPCHandler):
else:
raise RPCException(
"Invalid usage of command /marketdir. \n"
"Usage: */marketdir [short | long | even | none]*"
"Usage: */marketdir [short | long | even | none]*"
)
async def _tg_info(self, update: Update, context: CallbackContext) -> None:
+8 -4
View File
@@ -51,9 +51,10 @@ class HyperStrategyMixin:
for par in self._ft_hyper_params[space].values():
yield par.name, par
def ft_load_params_from_file(self) -> None:
def ft_set_special_params_from_file(self) -> None:
"""
Load Parameters from parameter file
Sets special parameters (stoploss, roi, trailing, max_open_trades) from the
previously loaded file.
Should/must run before config values are loaded in strategy_resolver.
"""
if self._ft_params_from_file:
@@ -96,7 +97,7 @@ class HyperStrategyMixin:
params_values = deep_merge_dicts(
self._ft_params_from_file.get(space, {}), getattr(self, f"{space}_params", {})
)
self._ft_load_params(self._ft_hyper_params[space], params_values, space, hyperopt)
self._ft_set_param(self._ft_hyper_params[space], params_values, space, hyperopt)
def load_params_from_file(self) -> dict:
filename_str = getattr(self, "__file__", "")
@@ -118,12 +119,15 @@ class HyperStrategyMixin:
return {}
def _ft_load_params(
def _ft_set_param(
self, params: SpaceParams, param_values: dict, space: str, hyperopt: bool = False
) -> None:
"""
Set optimizable parameter values.
:param params: Dictionary with new parameter values.
:param param_values: Dictionary with values to set.
:param space: The space to which the parameters belong.
:param hyperopt: Flag indicating if we are in hyperopt mode.
"""
if not param_values:
logger.info(f"No params for {space} found, using default values.")
+2 -1
View File
@@ -222,7 +222,8 @@ class IStrategy(ABC, HyperStrategyMixin):
"""
Clean up FreqAI and child threads
"""
self.freqai.shutdown()
if getattr(self, "freqai", None):
self.freqai.shutdown()
@abstractmethod
def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
+2
View File
@@ -3,6 +3,7 @@ from freqtrade.util.datetime_helpers import (
dt_from_ts,
dt_humanize_delta,
dt_now,
dt_now_no_micro,
dt_ts,
dt_ts_def,
dt_ts_none,
@@ -39,6 +40,7 @@ __all__ = [
"dt_from_ts",
"dt_humanize_delta",
"dt_now",
"dt_now_no_micro",
"dt_ts",
"dt_ts_def",
"dt_ts_none",
+7
View File
@@ -12,6 +12,13 @@ def dt_now() -> datetime:
return datetime.now(UTC)
def dt_now_no_micro() -> datetime:
"""Return the current datetime in UTC without microseconds.
Should not be used outside of tests.
"""
return dt_now().replace(microsecond=0)
def dt_utc(
year: int,
month: int,
+5 -4
View File
@@ -1,8 +1,10 @@
from freqtrade.constants import Config
from freqtrade.exchange import Exchange
from freqtrade.util.migrations.funding_rate_mig import migrate_funding_fee_timeframe
from freqtrade.util.migrations.migrate_wallet_history import migrate_wallet_history
def migrate_data(config, exchange: Exchange | None = None) -> None:
def migrate_data(config: Config, exchange: Exchange | None = None) -> None:
"""
Migrate persisted data from old formats to new formats
"""
@@ -10,10 +12,9 @@ def migrate_data(config, exchange: Exchange | None = None) -> None:
migrate_funding_fee_timeframe(config, exchange)
def migrate_live_content(config, exchange: Exchange | None = None) -> None:
def migrate_live_content(config: Config, exchange: Exchange, starting_balance: float) -> None:
"""
Migrate database content from old formats to new formats
Used for dry/live mode.
"""
# Currently not used
pass
migrate_wallet_history(config, exchange, starting_balance)
@@ -0,0 +1,214 @@
import logging
import numpy as np
import pandas as pd
from freqtrade.constants import Config
from freqtrade.data.btanalysis.bt_fileutils import trade_list_to_dataframe
from freqtrade.data.btanalysis.trade_parallelism import balance_distribution_over_time
from freqtrade.exchange import Exchange
from freqtrade.exchange.exchange_utils_timeframe import timeframe_to_prev_date
from freqtrade.persistence import KeyValueStore, Trade, WalletHistory
from freqtrade.util import dt_now, dt_ts
logger = logging.getLogger(__name__)
def migrate_wallet_history(config: Config, exchange: Exchange, starting_balance: float):
if config.get("skip_wallet_history_migration") or not exchange.get_option(
"ohlcv_has_history", True
):
# we can't fill up wallet history without ohlcv history
return
if KeyValueStore.get_int_value("wallet_history_migration"):
logger.debug("Wallet history migration already completed.")
return
logger.info("Starting wallet history migration...")
_migrate_wallet_history(config, exchange, starting_balance)
logger.info("Wallet history migration completed.")
KeyValueStore.store_value("wallet_history_migration", 1)
KeyValueStore.store_value("wallet_history_migration_date", dt_now())
def _migrate_wallet_history(config: Config, exchange: Exchange, starting_balance: float):
# Prepare balance distribution data with OHLCV rates
balance_dist, pairlist_valid = _prepare_balance_distribution(config, exchange, starting_balance)
if not balance_dist.empty and pairlist_valid:
_create_wallet_history_entries(
config, exchange, balance_dist, pairlist_valid, config["stake_currency"]
)
def _prepare_balance_distribution(
config: Config, exchange: Exchange, starting_balance: float
) -> tuple[pd.DataFrame, list[str]]:
trade_df = trade_list_to_dataframe(Trade.get_trades_proxy(), minified=False)
if trade_df.empty:
# no trades, nothing to do
return pd.DataFrame(), []
pairlist = list(trade_df["pair"].unique())
timeframe = "1d"
stake_currency = config["stake_currency"]
min_date = timeframe_to_prev_date(timeframe, KeyValueStore.get_datetime_value("bot_start_time"))
balance_dist = balance_distribution_over_time(
trade_df,
min_date=min_date,
max_date=dt_now(),
start_balance=starting_balance,
stake_currency=stake_currency,
timeframe=timeframe,
pairlist=pairlist,
)
pairlist_valid = [p for p in pairlist if p in exchange.markets]
pairlist_invalid = set(pairlist) - set(pairlist_valid)
if pairlist_invalid:
logger.warning(
f"The following trading pairs from the trade history are not available on the exchange "
f"and will be skipped during wallet history migration: {', '.join(pairlist_invalid)}"
)
logger.info("Wallet History migration: Fetching OHLCV data ...")
data = exchange.refresh_latest_ohlcv(
[(p, timeframe, config["candle_type_def"]) for p in pairlist_valid],
since_ms=dt_ts(min_date),
cache=False,
drop_incomplete=False,
)
logger.info(
"Wallet History migration: Done fetching OHLCV data for wallet history migration..."
)
dfs = []
# Combine all dataframes into one using the open rate
for p, x in data.items():
x = x.set_index("date", drop=True)
col = f"{p[0]}_open"
x[col] = x["open"]
dfs.append(x[[col]])
if not dfs:
logger.warning(
"No OHLCV data available for the trading pairs; skipping wallet history migration."
)
return pd.DataFrame(), []
merged = pd.concat(dfs, axis=1)
balance_dist = balance_dist.join(merged, how="left")
df_value = pd.DataFrame(
index=balance_dist.index, columns=[f"{p}_value" for p in pairlist_valid], dtype=float
)
for p in pairlist_valid:
# df_value[f"{p}_value"] = balance_dist[f"{p}_open"] * balance_dist[p]
# Identical calculation to rpc and wallets.py
df_value[f"{p}_value"] = np.where(
balance_dist[f"{p}_is_short"] == 0,
(balance_dist[f"{p}_open"] * balance_dist[p])
- balance_dist[f"{p}_collateral"] * (balance_dist[f"{p}_leverage"] - 1),
(
balance_dist[f"{p}_collateral"] * (1 + balance_dist[f"{p}_leverage"])
- balance_dist[f"{p}_open"] * balance_dist[p]
),
)
balance_dist = pd.concat([balance_dist, df_value], axis=1)
# Aggregate total value at each point in time
balance_dist["total_value"] = balance_dist[
[f"{p}_value" for p in pairlist_valid] + [stake_currency]
].sum(axis=1)
return balance_dist, pairlist_valid
def _create_wallet_history_entries(
config: Config,
exchange: Exchange,
balance_dist: pd.DataFrame,
pairlist_valid: list[str],
stake_currency: str,
):
is_futures = config["trading_mode"] == "futures"
# Precompute column indices for faster tuple-based iteration
# Assume the first column is the index (date)
stake_idx = balance_dist.columns.get_loc(stake_currency)
pair_balance_idx = {pair: balance_dist.columns.get_loc(pair) + 1 for pair in pairlist_valid}
pair_leverage_idx = {
pair: balance_dist.columns.get_loc(f"{pair}_leverage") + 1 for pair in pairlist_valid
}
pair_collateral_idx = {
pair: balance_dist.columns.get_loc(f"{pair}_collateral") + 1 for pair in pairlist_valid
}
pair_is_short_idx = {
pair: balance_dist.columns.get_loc(f"{pair}_is_short") + 1 for pair in pairlist_valid
}
pair_rate_idx = {
pair: balance_dist.columns.get_loc(f"{pair}_open") + 1 for pair in pairlist_valid
}
# Convert balance_dist to WalletHistory entries
wallet_entries = []
for row in balance_dist.itertuples(index=True, name=None):
date = row[0]
# Add stake currency entry
stake_balance = row[stake_idx + 1]
if not pd.isna(stake_balance):
wallet_entries.append(
WalletHistory(
timestamp=date,
currency=stake_currency,
rate=1.0, # Stake currency price is always 1.0
balance=stake_balance,
total_quote=stake_balance,
quote_currency=stake_currency,
leverage=1.0,
bot_managed=True,
)
)
# Add entries for each trading pair
for pair in pairlist_valid:
base_currency = exchange.get_pair_base_currency(pair)
balance = row[pair_balance_idx[pair]]
leverage = row[pair_leverage_idx[pair]]
# Only add entry if balance is not empty/NaN
if not pd.isna(balance) and balance > 0:
rate_value = row[pair_rate_idx[pair]]
rate = rate_value if not pd.isna(rate_value) else None
total_quote = balance * rate if rate else None
collateral: float | None = None
if is_futures:
collateral = row[pair_collateral_idx[pair]]
is_short = row[pair_is_short_idx[pair]]
if collateral is not None and not pd.isna(collateral) and rate is not None:
# Same formula than in rpc's _rpc_balance
total_quote = (
(rate * balance - collateral * (leverage - 1))
if is_short == 0
else (collateral * (1 + leverage) - rate * balance)
)
wallet_entries.append(
WalletHistory(
timestamp=date,
currency=base_currency,
quote_currency=stake_currency,
rate=rate,
balance=balance,
total_quote=total_quote,
leverage=leverage if not pd.isna(leverage) else 1.0,
bot_managed=True,
total_position_value=balance * rate if is_futures and rate else None,
# collateral=collateral,
)
)
# Save entries to database
if wallet_entries:
try:
# Use bulk_save_objects for better performance
WalletHistory.session.bulk_save_objects(wallet_entries)
WalletHistory.session.commit()
logger.info(f"Successfully created {len(wallet_entries)} wallet balance records")
except Exception as e:
WalletHistory.session.rollback()
logger.error(f"Error saving wallet balance records: {e}")
+70 -2
View File
@@ -10,8 +10,8 @@ from freqtrade.enums import RunMode, TradingMode
from freqtrade.exceptions import DependencyException
from freqtrade.exchange import Exchange
from freqtrade.misc import safe_value_fallback
from freqtrade.persistence import LocalTrade, Trade
from freqtrade.util.datetime_helpers import dt_now
from freqtrade.persistence import LocalTrade, Trade, WalletHistory
from freqtrade.util import dt_floor_day, dt_now
logger = logging.getLogger(__name__)
@@ -445,3 +445,71 @@ class Wallets:
logger.debug(msg)
else:
logger.info(msg)
def record_wallet_state(self) -> None:
"""Record daily wallet totals to database"""
if self._is_backtest:
# only record in live mode.
return
timestamp = dt_floor_day(dt_now())
# Record total balances for all currencies
wallet_records = []
position_collaterals = 0.0
open_assets: dict[str, Trade] = {t.safe_base_currency: t for t in Trade.get_open_trades()}
for pos in self.get_all_positions().values():
base = self._exchange.get_pair_base_currency(pos.symbol)
rate = self._exchange.get_conversion_rate(base, self._stake_currency)
total_quote = None
leverage = pos.leverage or 1.0
if rate:
# Same formula than in rpc's _rpc_balance
total_quote = (
rate * pos.position - pos.collateral * (leverage - 1)
if pos.side == "long"
else pos.collateral * (1 + leverage) - rate * pos.position
)
position_record = WalletHistory(
timestamp=timestamp,
currency=pos.symbol,
quote_currency=self._stake_currency,
rate=rate,
balance=pos.position,
total_quote=total_quote,
total_position_value=rate * pos.position if rate else None,
collateral=pos.collateral,
leverage=leverage,
bot_managed=base in open_assets,
)
position_collaterals += pos.collateral
wallet_records.append(position_record)
for wallet in self.get_all_balances().values():
# TODO: (needs decision) exclude minimal balances?
rate = self._exchange.get_conversion_rate(wallet.currency, self._stake_currency)
is_bot_managed = (
self._stake_currency == wallet.currency or wallet.currency in open_assets
)
balance = wallet.total - (
position_collaterals if wallet.currency == self._stake_currency else 0
)
total_quote = rate * balance if rate else None
wallet_record = WalletHistory(
timestamp=timestamp,
currency=wallet.currency,
quote_currency=self._stake_currency,
rate=rate,
balance=balance,
leverage=1.0,
total_quote=total_quote,
bot_managed=is_bot_managed,
)
wallet_records.append(wallet_record)
try:
WalletHistory.session.bulk_save_objects(wallet_records)
WalletHistory.session.commit()
except Exception as e:
WalletHistory.session.rollback()
logger.error(f"Error saving wallet balance records: {e}")
+1 -1
View File
@@ -1,7 +1,7 @@
from freqtrade_client.ft_rest_client import FtRestClient
__version__ = "2026.3-dev"
__version__ = "2026.5-dev"
if "dev" in __version__:
from pathlib import Path
+1 -1
View File
@@ -1,3 +1,3 @@
# Requirements for freqtrade client library
requests==2.33.0
requests==2.33.1
python-rapidjson==1.23
+7 -1
View File
@@ -40,7 +40,7 @@ dependencies = [
"urllib3",
"jsonschema",
"numpy>2.0,<3.0",
"pandas>=2.2.0,<3.0",
"pandas>=2.2.0,<4.0",
"TA-Lib<0.7",
"ft-pandas-ta",
"technical",
@@ -217,6 +217,12 @@ reportRedeclaration = false # 1
reportReturnType = false # 28
reportTypedDictNotRequiredAccess = false # 27
[tool.uv]
exclude-newer = "1 week"
[tool.uv.exclude-newer-package]
ccxt = false
pymdown-extensions = "6 days"
[tool.ruff]
line-length = 100
+12 -12
View File
@@ -6,12 +6,12 @@
-r requirements-freqai-rl.txt
-r docs/requirements-docs.txt
ruff==0.15.6
mypy==1.19.1
pre-commit==4.5.1
pytest==9.0.2
ruff==0.15.13
mypy==2.1.0
pre-commit==4.6.0
pytest==9.0.3
pytest-asyncio==1.3.0
pytest-cov==7.0.0
pytest-cov==7.1.0
pytest-mock==3.15.1
pytest-random-order==1.2.0
pytest-timeout==2.4.0
@@ -20,17 +20,17 @@ pytest-xdist==3.8.0
time-machine==3.2.0
# Convert jupyter notebooks to markdown documents
nbconvert==7.17.0
nbconvert==7.17.1
# mypy types
scipy-stubs==1.17.1.2 # keep in sync with `scipy` in `requirements-hyperopt.txt`
types-cachetools==6.2.0.20251022
scipy-stubs==1.17.1.4 # keep in sync with `scipy` in `requirements-hyperopt.txt`
types-cachetools==7.0.0.20260503
types-filelock==3.2.7
types-requests==2.32.4.20260107
types-tabulate==0.10.0.20260308
types-python-dateutil==2.9.0.20260305
types-requests==2.33.0.20260508
types-tabulate==0.10.0.20260508
types-python-dateutil==2.9.0.20260508
pip-audit==2.10.0
# For build step in CI
build==1.4.2
build==1.5.0
# For pre-commit-update check
pyyaml==6.0.3
+3 -3
View File
@@ -2,10 +2,10 @@
-r requirements-freqai.txt
# Required for freqai-rl
torch==2.10.0; sys_platform != 'darwin' or platform_machine != 'x86_64'
torch==2.11.0; sys_platform != 'darwin' or platform_machine != 'x86_64'
gymnasium==1.2.3
# SB3 >=2.5.0 depends on torch 2.3.0 - which implies it dropped support x86 macos
stable_baselines3==2.7.1; sys_platform != 'darwin' or platform_machine != 'x86_64'
sb3_contrib>=2.2.1; sys_platform != 'darwin' or platform_machine != 'x86_64'
stable-baselines3==2.8.0; sys_platform != 'darwin' or platform_machine != 'x86_64'
sb3-contrib==2.8.0; sys_platform != 'darwin' or platform_machine != 'x86_64'
# Progress bar for stable-baselines3 and sb3-contrib
tqdm==4.67.3

Some files were not shown because too many files have changed in this diff Show More