Compare commits

..

1 Commits

Author SHA1 Message Date
Matthias
4f1e249574 Merge pull request #12452 from freqtrade/new_release
New release 2025.10
2025-10-31 16:53:02 +01:00
129 changed files with 6640 additions and 8857 deletions

View File

@@ -38,7 +38,7 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install uv
uses: astral-sh/setup-uv@85856786d1ce8acfbcc2f13a5f3fbd6b938f9f41 # v7.1.2
uses: astral-sh/setup-uv@3259c6206f993105e3a61b142c2d97bf4b9ef83d # v7.1.0
with:
activate-environment: true
enable-cache: true
@@ -74,17 +74,15 @@ jobs:
run: |
pytest --random-order --cov=freqtrade --cov=freqtrade_client --cov-config=.coveragerc
- uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1
if: (runner.os == 'Linux' && matrix.python-version == '3.12' && matrix.os == 'ubuntu-24.04')
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
- name: Cleanup codecov dirty state files
- name: Coveralls
if: (runner.os == 'Linux' && matrix.python-version == '3.12' && matrix.os == 'ubuntu-24.04')
env:
# Coveralls token. Not used as secret due to github not providing secrets to forked repositories
COVERALLS_REPO_TOKEN: 6D1m0xupS3FgutfuGao8keFf9Hc0FpIXu
run: |
# See https://github.com/codecov/codecov-action/issues/1851
rm -rf codecov codecov.SHA256SUM codecov.SHA256SUM.sig
# Allow failure for coveralls
uv pip install coveralls
coveralls || true
- name: Run json schema extract
# This should be kept before the repository check to ensure that the schema is up-to-date
@@ -93,12 +91,12 @@ jobs:
- name: Run command docs partials extract
# This should be kept before the repository check to ensure that the docs are up-to-date
if: ${{ (matrix.python-version == '3.13') }}
run: |
python build_helpers/create_command_partials.py
- name: Check for repository changes - *nix
if: ${{ (runner.os != 'Windows') }}
# TODO: python 3.13 slightly changed the output of argparse.
if: ${{ (matrix.python-version != '3.13') && (runner.os != 'Windows') }}
run: |
if [ -n "$(git status --porcelain)" ]; then
echo "Repository is dirty, changes detected:"
@@ -250,7 +248,7 @@ jobs:
python-version: "3.12"
- name: Install uv
uses: astral-sh/setup-uv@85856786d1ce8acfbcc2f13a5f3fbd6b938f9f41 # v7.1.2
uses: astral-sh/setup-uv@3259c6206f993105e3a61b142c2d97bf4b9ef83d # v7.1.0
with:
activate-environment: true
enable-cache: true
@@ -275,7 +273,10 @@ jobs:
# Notify only once - when CI completes (and after deploy) in case it's successful
notify-complete:
needs: [
build,
tests,
docs-check,
mypy-version-check,
pre-commit,
build-linux-online
]
runs-on: ubuntu-22.04
@@ -303,23 +304,11 @@ jobs:
webhookUrl: ${{ secrets.DISCORD_WEBHOOK }}
build:
if: always()
name: "Build"
needs: [
tests,
docs-check,
mypy-version-check,
pre-commit,
]
needs: [ tests, docs-check, mypy-version-check, pre-commit ]
runs-on: ubuntu-22.04
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # v1.2.2
with:
jobs: ${{ toJSON(needs) }}
- uses: actions/checkout@v5
with:
persist-credentials: false
@@ -335,7 +324,7 @@ jobs:
python -m build --sdist --wheel
- name: Upload artifacts 📦
uses: actions/upload-artifact@v5
uses: actions/upload-artifact@v4
with:
name: freqtrade-build
path: |
@@ -348,7 +337,7 @@ jobs:
python -m build --sdist --wheel ft_client
- name: Upload artifacts 📦
uses: actions/upload-artifact@v5
uses: actions/upload-artifact@v4
with:
name: freqtrade-client-build
path: |
@@ -372,7 +361,7 @@ jobs:
persist-credentials: false
- name: Download artifact 📦
uses: actions/download-artifact@v6
uses: actions/download-artifact@v5
with:
pattern: freqtrade*-build
path: dist
@@ -401,7 +390,7 @@ jobs:
persist-credentials: false
- name: Download artifact 📦
uses: actions/download-artifact@v6
uses: actions/download-artifact@v5
with:
pattern: freqtrade*-build
path: dist
@@ -414,7 +403,10 @@ jobs:
docker-build:
name: "Docker Build and Deploy"
needs: [
build,
tests,
docs-check,
mypy-version-check,
pre-commit
]
if: (github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'release') && github.repository == 'freqtrade/freqtrade'
uses: ./.github/workflows/docker-build.yml

View File

@@ -48,7 +48,7 @@ jobs:
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Set up QEMU
uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
with:
cache-image: false

View File

@@ -14,7 +14,6 @@ permissions: {}
jobs:
zizmor:
name: Run zizmor 🌈
runs-on: ubuntu-latest
permissions:
security-events: write

View File

@@ -30,8 +30,8 @@ repos:
- types-filelock==3.2.7
- types-requests==2.32.4.20250913
- types-tabulate==0.9.0.20241207
- types-python-dateutil==2.9.0.20251115
- scipy-stubs==1.16.3.0
- types-python-dateutil==2.9.0.20251008
- scipy-stubs==1.16.2.4
- SQLAlchemy==2.0.44
# stages: [push]
@@ -44,7 +44,7 @@ repos:
- repo: https://github.com/charliermarsh/ruff-pre-commit
# Ruff version.
rev: 'v0.14.6'
rev: 'v0.14.2'
hooks:
- id: ruff
- id: ruff-format
@@ -83,6 +83,6 @@ repos:
# Ensure github actions remain safe
- repo: https://github.com/woodruffw/zizmor-pre-commit
rev: v1.16.3
rev: v1.16.0
hooks:
- id: zizmor

View File

@@ -1,6 +1,6 @@
# ![freqtrade](https://raw.githubusercontent.com/freqtrade/freqtrade/develop/docs/assets/freqtrade_poweredby.svg)
[![Freqtrade CI](https://github.com/freqtrade/freqtrade/actions/workflows/ci.yml/badge.svg?branch=develop)](https://github.com/freqtrade/freqtrade/actions/workflows/ci.yml)
[![Freqtrade CI](https://github.com/freqtrade/freqtrade/actions/workflows/ci.yml/badge.svg?branch=develop)](https://github.com/freqtrade/freqtrade/actions/)
[![DOI](https://joss.theoj.org/papers/10.21105/joss.04864/status.svg)](https://doi.org/10.21105/joss.04864)
[![Coverage Status](https://coveralls.io/repos/github/freqtrade/freqtrade/badge.svg?branch=develop&service=github)](https://coveralls.io/github/freqtrade/freqtrade?branch=develop)
[![Documentation](https://readthedocs.org/projects/freqtrade/badge/)](https://www.freqtrade.io)

View File

@@ -1,71 +1,53 @@
import subprocess # noqa: S404, RUF100
import sys
from pathlib import Path
def _write_partial_file(filename: str, content: str):
with Path(filename).open("w") as f:
f.write(f"``` output\n{content}\n```\n")
subcommands = [
"trade",
"create-userdir",
"new-config",
"show-config",
"new-strategy",
"download-data",
"convert-data",
"convert-trade-data",
"trades-to-ohlcv",
"list-data",
"backtesting",
"backtesting-show",
"backtesting-analysis",
"edge",
"hyperopt",
"hyperopt-list",
"hyperopt-show",
"list-exchanges",
"list-markets",
"list-pairs",
"list-strategies",
"list-hyperoptloss",
"list-freqaimodels",
"list-timeframes",
"show-trades",
"test-pairlist",
"convert-db",
"install-ui",
"plot-dataframe",
"plot-profit",
"webserver",
"strategy-updater",
"lookahead-analysis",
"recursive-analysis",
]
result = subprocess.run(["freqtrade", "--help"], capture_output=True, text=True)
with Path("docs/commands/main.md").open("w") as f:
f.write(f"```\n{result.stdout}\n```\n")
def extract_command_partials():
subcommands = [
"trade",
"create-userdir",
"new-config",
"show-config",
"new-strategy",
"download-data",
"convert-data",
"convert-trade-data",
"trades-to-ohlcv",
"list-data",
"backtesting",
"backtesting-show",
"backtesting-analysis",
"edge",
"hyperopt",
"hyperopt-list",
"hyperopt-show",
"list-exchanges",
"list-markets",
"list-pairs",
"list-strategies",
"list-hyperoptloss",
"list-freqaimodels",
"list-timeframes",
"show-trades",
"test-pairlist",
"convert-db",
"install-ui",
"plot-dataframe",
"plot-profit",
"webserver",
"strategy-updater",
"lookahead-analysis",
"recursive-analysis",
]
for command in subcommands:
print(f"Running for {command}")
result = subprocess.run(["freqtrade", command, "--help"], capture_output=True, text=True)
result = subprocess.run(["freqtrade", "--help"], capture_output=True, text=True)
_write_partial_file("docs/commands/main.md", result.stdout)
for command in subcommands:
print(f"Running for {command}")
result = subprocess.run(["freqtrade", command, "--help"], capture_output=True, text=True)
_write_partial_file(f"docs/commands/{command}.md", result.stdout)
print("Running for freqtrade-client")
result_client = subprocess.run(["freqtrade-client", "--show"], capture_output=True, text=True)
_write_partial_file("docs/commands/freqtrade-client.md", result_client.stdout)
if __name__ == "__main__":
if sys.version_info < (3, 13): # pragma: no cover
sys.exit(
"argparse output changed in Python 3.13+. "
"To keep command partials up to date, please run this script with Python 3.13+."
)
extract_command_partials()
with Path(f"docs/commands/{command}.md").open("w") as f:
f.write(f"```\n{result.stdout}\n```\n")

View File

@@ -273,68 +273,6 @@
]
}
},
"backtest_cache": {
"description": "Load a cached backtest result no older than specified age.",
"type": "string",
"enum": [
"none",
"day",
"week",
"month"
]
},
"hyperopt_path": {
"description": "Specify additional lookup path for Hyperopt Loss functions.",
"type": "string"
},
"epochs": {
"description": "Number of training epochs for Hyperopt.",
"type": "integer",
"minimum": 1
},
"early_stop": {
"description": "Early stop hyperopt if no improvement after <epochs>. Set to 0 to disable.",
"type": "integer",
"minimum": 0
},
"spaces": {
"description": "Hyperopt parameter spaces to optimize. Default is the default set andincludes all spaces except for 'trailing', 'protection', and 'trades'.",
"type": "array",
"items": {
"type": "string"
},
"default": [
"default"
]
},
"analyze_per_epoch": {
"description": "Perform analysis after each epoch in Hyperopt.",
"type": "boolean"
},
"print_all": {
"description": "Print all hyperopt trials, not just the best ones.",
"type": "boolean",
"default": false
},
"hyperopt_jobs": {
"description": "The number of concurrently running jobs for hyperoptimization (hyperopt worker processes). If -1 (default), all CPUs are used, for -2, all CPUs but one are used, etc. If 1 is given, no parallel computing is used.",
"type": "integer",
"default": -1
},
"hyperopt_random_state": {
"description": "Random state for hyperopt trials.",
"type": "integer",
"minimum": 0
},
"hyperopt_min_trades": {
"description": "Minimum number of trades per epoch for hyperopt.",
"type": "integer",
"minimum": 0
},
"hyperopt_loss": {
"description": "The class name of the hyperopt loss function class (IHyperOptLoss). Different functions can generate completely different results, since the target for optimization is different. Built-in Hyperopt-loss-functions are: ShortTradeDurHyperOptLoss, OnlyProfitHyperOptLoss, SharpeHyperOptLoss, SharpeHyperOptLossDaily, SortinoHyperOptLoss, SortinoHyperOptLossDaily, CalmarHyperOptLoss, MaxDrawDownHyperOptLoss, MaxDrawDownRelativeHyperOptLoss, MaxDrawDownPerPairHyperOptLoss, ProfitDrawDownHyperOptLoss, MultiMetricHyperOptLoss",
"type": "string"
},
"bot_name": {
"description": "Name of the trading bot. Passed via API to a client.",
"type": "string"

View File

@@ -1,4 +1,4 @@
``` output
```
usage: freqtrade backtesting-analysis [-h] [-v] [--no-color] [--logfile FILE]
[-V] [-c PATH] [-d PATH]
[--userdir PATH]
@@ -15,13 +15,13 @@ usage: freqtrade backtesting-analysis [-h] [-v] [--no-color] [--logfile FILE]
options:
-h, --help show this help message and exit
--backtest-filename, --export-filename PATH
--backtest-filename PATH, --export-filename PATH
Use this filename for backtest results.Example:
`--backtest-
filename=backtest_results_2020-09-27_16-20-48.json`.
Assumes either `user_data/backtest_results/` or
`--export-directory` as base directory.
--backtest-directory, --export-directory PATH
--backtest-directory PATH, --export-directory PATH
Directory to use for backtest results. Example:
`--export-directory=user_data/backtest_results/`.
--analysis-groups {0,1,2,3,4,5} [{0,1,2,3,4,5} ...]
@@ -54,20 +54,21 @@ Common arguments:
-v, --verbose Verbose mode (-vv for more, -vvv to get all messages).
--no-color Disable colorization of hyperopt results. May be
useful if you are redirecting output to a file.
--logfile, --log-file FILE
--logfile FILE, --log-file FILE
Log to the file specified. Special values are:
'syslog', 'journald'. See the documentation for more
details.
-V, --version show program's version number and exit
-c, --config PATH Specify configuration file (default:
-c PATH, --config PATH
Specify configuration file (default:
`userdir/config.json` or `config.json` whichever
exists). Multiple --config options may be used. Can be
set to `-` to read config from stdin.
-d, --datadir, --data-dir PATH
-d PATH, --datadir PATH, --data-dir PATH
Path to the base directory of the exchange with
historical backtesting data. To see futures data, use
trading-mode additionally.
--userdir, --user-data-dir PATH
--userdir PATH, --user-data-dir PATH
Path to userdata directory.
```

View File

@@ -1,4 +1,4 @@
``` output
```
usage: freqtrade backtesting-show [-h] [-v] [--no-color] [--logfile FILE] [-V]
[-c PATH] [-d PATH] [--userdir PATH]
[--backtest-filename PATH]
@@ -8,13 +8,13 @@ usage: freqtrade backtesting-show [-h] [-v] [--no-color] [--logfile FILE] [-V]
options:
-h, --help show this help message and exit
--backtest-filename, --export-filename PATH
--backtest-filename PATH, --export-filename PATH
Use this filename for backtest results.Example:
`--backtest-
filename=backtest_results_2020-09-27_16-20-48.json`.
Assumes either `user_data/backtest_results/` or
`--export-directory` as base directory.
--backtest-directory, --export-directory PATH
--backtest-directory PATH, --export-directory PATH
Directory to use for backtest results. Example:
`--export-directory=user_data/backtest_results/`.
--show-pair-list Show backtesting pairlist sorted by profit.
@@ -26,20 +26,21 @@ Common arguments:
-v, --verbose Verbose mode (-vv for more, -vvv to get all messages).
--no-color Disable colorization of hyperopt results. May be
useful if you are redirecting output to a file.
--logfile, --log-file FILE
--logfile FILE, --log-file FILE
Log to the file specified. Special values are:
'syslog', 'journald'. See the documentation for more
details.
-V, --version show program's version number and exit
-c, --config PATH Specify configuration file (default:
-c PATH, --config PATH
Specify configuration file (default:
`userdir/config.json` or `config.json` whichever
exists). Multiple --config options may be used. Can be
set to `-` to read config from stdin.
-d, --datadir, --data-dir PATH
-d PATH, --datadir PATH, --data-dir PATH
Path to the base directory of the exchange with
historical backtesting data. To see futures data, use
trading-mode additionally.
--userdir, --user-data-dir PATH
--userdir PATH, --user-data-dir PATH
Path to userdata directory.
```

View File

@@ -1,4 +1,4 @@
``` output
```
usage: freqtrade backtesting [-h] [-v] [--no-color] [--logfile FILE] [-V]
[-c PATH] [-d PATH] [--userdir PATH] [-s NAME]
[--strategy-path PATH]
@@ -23,7 +23,7 @@ usage: freqtrade backtesting [-h] [-v] [--no-color] [--logfile FILE] [-V]
options:
-h, --help show this help message and exit
-i, --timeframe TIMEFRAME
-i TIMEFRAME, --timeframe TIMEFRAME
Specify timeframe (`1m`, `5m`, `30m`, `1h`, `1d`).
--timerange TIMERANGE
Specify what timerange of data to use.
@@ -38,7 +38,7 @@ options:
setting.
--fee FLOAT Specify fee ratio. Will be applied twice (on trade
entry and exit).
-p, --pairs PAIRS [PAIRS ...]
-p PAIRS [PAIRS ...], --pairs PAIRS [PAIRS ...]
Limit command to these pairs. Pairs are space-
separated.
--eps, --enable-position-stacking
@@ -53,7 +53,7 @@ options:
pairlist will be generated for each new candle if
you're using a pairlist handler that supports this
feature, for example, ShuffleFilter.
--dry-run-wallet, --starting-balance DRY_RUN_WALLET
--dry-run-wallet DRY_RUN_WALLET, --starting-balance DRY_RUN_WALLET
Starting balance, used for backtesting / hyperopt and
dry-runs.
--timeframe-detail TIMEFRAME_DETAIL
@@ -68,13 +68,13 @@ options:
becomes `backtest-data-SampleStrategy.json`
--export {none,trades,signals}
Export backtest results (default: trades).
--backtest-filename, --export-filename PATH
--backtest-filename PATH, --export-filename PATH
Use this filename for backtest results.Example:
`--backtest-
filename=backtest_results_2020-09-27_16-20-48.json`.
Assumes either `user_data/backtest_results/` or
`--export-directory` as base directory.
--backtest-directory, --export-directory PATH
--backtest-directory PATH, --export-directory PATH
Directory to use for backtest results. Example:
`--export-directory=user_data/backtest_results/`.
--breakdown {day,week,month,year,weekday} [{day,week,month,year,weekday} ...]
@@ -91,24 +91,26 @@ Common arguments:
-v, --verbose Verbose mode (-vv for more, -vvv to get all messages).
--no-color Disable colorization of hyperopt results. May be
useful if you are redirecting output to a file.
--logfile, --log-file FILE
--logfile FILE, --log-file FILE
Log to the file specified. Special values are:
'syslog', 'journald'. See the documentation for more
details.
-V, --version show program's version number and exit
-c, --config PATH Specify configuration file (default:
-c PATH, --config PATH
Specify configuration file (default:
`userdir/config.json` or `config.json` whichever
exists). Multiple --config options may be used. Can be
set to `-` to read config from stdin.
-d, --datadir, --data-dir PATH
-d PATH, --datadir PATH, --data-dir PATH
Path to the base directory of the exchange with
historical backtesting data. To see futures data, use
trading-mode additionally.
--userdir, --user-data-dir PATH
--userdir PATH, --user-data-dir PATH
Path to userdata directory.
Strategy arguments:
-s, --strategy NAME Specify strategy class name which will be used by the
-s NAME, --strategy NAME
Specify strategy class name which will be used by the
bot.
--strategy-path PATH Specify additional strategy lookup path.
--recursive-strategy-search

View File

@@ -1,17 +1,17 @@
``` output
```
usage: freqtrade convert-data [-h] [-v] [--no-color] [--logfile FILE] [-V]
[-c PATH] [-d PATH] [--userdir PATH]
[-p PAIRS [PAIRS ...]]
--format-from {json,jsongz,feather,parquet}
--format-to {json,jsongz,feather,parquet}
[--erase] [--exchange EXCHANGE]
[-p PAIRS [PAIRS ...]] --format-from
{json,jsongz,feather,parquet} --format-to
{json,jsongz,feather,parquet} [--erase]
[--exchange EXCHANGE]
[-t TIMEFRAMES [TIMEFRAMES ...]]
[--trading-mode {spot,margin,futures}]
[--candle-types {spot,futures,mark,index,premiumIndex,funding_rate} [{spot,futures,mark,index,premiumIndex,funding_rate} ...]]
options:
-h, --help show this help message and exit
-p, --pairs PAIRS [PAIRS ...]
-p PAIRS [PAIRS ...], --pairs PAIRS [PAIRS ...]
Limit command to these pairs. Pairs are space-
separated.
--format-from {json,jsongz,feather,parquet}
@@ -21,10 +21,10 @@ options:
--erase Clean all existing data for the selected
exchange/pairs/timeframes.
--exchange EXCHANGE Exchange name. Only valid if no config is provided.
-t, --timeframes TIMEFRAMES [TIMEFRAMES ...]
-t TIMEFRAMES [TIMEFRAMES ...], --timeframes TIMEFRAMES [TIMEFRAMES ...]
Specify which tickers to download. Space-separated
list. Default: `1m 5m`.
--trading-mode, --tradingmode {spot,margin,futures}
--trading-mode {spot,margin,futures}, --tradingmode {spot,margin,futures}
Select Trading mode
--candle-types {spot,futures,mark,index,premiumIndex,funding_rate} [{spot,futures,mark,index,premiumIndex,funding_rate} ...]
Select candle type to convert. Defaults to all
@@ -34,20 +34,21 @@ Common arguments:
-v, --verbose Verbose mode (-vv for more, -vvv to get all messages).
--no-color Disable colorization of hyperopt results. May be
useful if you are redirecting output to a file.
--logfile, --log-file FILE
--logfile FILE, --log-file FILE
Log to the file specified. Special values are:
'syslog', 'journald'. See the documentation for more
details.
-V, --version show program's version number and exit
-c, --config PATH Specify configuration file (default:
-c PATH, --config PATH
Specify configuration file (default:
`userdir/config.json` or `config.json` whichever
exists). Multiple --config options may be used. Can be
set to `-` to read config from stdin.
-d, --datadir, --data-dir PATH
-d PATH, --datadir PATH, --data-dir PATH
Path to the base directory of the exchange with
historical backtesting data. To see futures data, use
trading-mode additionally.
--userdir, --user-data-dir PATH
--userdir PATH, --user-data-dir PATH
Path to userdata directory.
```

View File

@@ -1,4 +1,4 @@
``` output
```
usage: freqtrade convert-db [-h] [--db-url PATH] [--db-url-from PATH]
options:

View File

@@ -1,14 +1,14 @@
``` output
```
usage: freqtrade convert-trade-data [-h] [-v] [--no-color] [--logfile FILE]
[-V] [-c PATH] [-d PATH] [--userdir PATH]
[-p PAIRS [PAIRS ...]]
--format-from {json,jsongz,feather,parquet,kraken_csv}
[-p PAIRS [PAIRS ...]] --format-from
{json,jsongz,feather,parquet,kraken_csv}
--format-to {json,jsongz,feather,parquet}
[--erase] [--exchange EXCHANGE]
options:
-h, --help show this help message and exit
-p, --pairs PAIRS [PAIRS ...]
-p PAIRS [PAIRS ...], --pairs PAIRS [PAIRS ...]
Limit command to these pairs. Pairs are space-
separated.
--format-from {json,jsongz,feather,parquet,kraken_csv}
@@ -23,20 +23,21 @@ Common arguments:
-v, --verbose Verbose mode (-vv for more, -vvv to get all messages).
--no-color Disable colorization of hyperopt results. May be
useful if you are redirecting output to a file.
--logfile, --log-file FILE
--logfile FILE, --log-file FILE
Log to the file specified. Special values are:
'syslog', 'journald'. See the documentation for more
details.
-V, --version show program's version number and exit
-c, --config PATH Specify configuration file (default:
-c PATH, --config PATH
Specify configuration file (default:
`userdir/config.json` or `config.json` whichever
exists). Multiple --config options may be used. Can be
set to `-` to read config from stdin.
-d, --datadir, --data-dir PATH
-d PATH, --datadir PATH, --data-dir PATH
Path to the base directory of the exchange with
historical backtesting data. To see futures data, use
trading-mode additionally.
--userdir, --user-data-dir PATH
--userdir PATH, --user-data-dir PATH
Path to userdata directory.
```

View File

@@ -1,9 +1,9 @@
``` output
```
usage: freqtrade create-userdir [-h] [--userdir PATH] [--reset]
options:
-h, --help show this help message and exit
--userdir, --user-data-dir PATH
--userdir PATH, --user-data-dir PATH
Path to userdata directory.
--reset Reset sample files to their original state.

View File

@@ -1,4 +1,4 @@
``` output
```
usage: freqtrade download-data [-h] [-v] [--no-color] [--logfile FILE] [-V]
[-c PATH] [-d PATH] [--userdir PATH]
[-p PAIRS [PAIRS ...]] [--pairs-file FILE]
@@ -15,7 +15,7 @@ usage: freqtrade download-data [-h] [-v] [--no-color] [--logfile FILE] [-V]
options:
-h, --help show this help message and exit
-p, --pairs PAIRS [PAIRS ...]
-p PAIRS [PAIRS ...], --pairs PAIRS [PAIRS ...]
Limit command to these pairs. Pairs are space-
separated.
--pairs-file FILE File containing a list of pairs. Takes precedence over
@@ -37,7 +37,7 @@ options:
OHLCV (e.g. Kraken). If not provided, use `trades-to-
ohlcv` to convert trades data to OHLCV data.
--exchange EXCHANGE Exchange name. Only valid if no config is provided.
-t, --timeframes TIMEFRAMES [TIMEFRAMES ...]
-t TIMEFRAMES [TIMEFRAMES ...], --timeframes TIMEFRAMES [TIMEFRAMES ...]
Specify which tickers to download. Space-separated
list. Default: `1m 5m`.
--erase Clean all existing data for the selected
@@ -48,7 +48,7 @@ options:
--data-format-trades {json,jsongz,feather,parquet}
Storage format for downloaded trades data. (default:
`feather`).
--trading-mode, --tradingmode {spot,margin,futures}
--trading-mode {spot,margin,futures}, --tradingmode {spot,margin,futures}
Select Trading mode
--prepend Allow data prepending. (Data-appending is disabled)
@@ -56,20 +56,21 @@ Common arguments:
-v, --verbose Verbose mode (-vv for more, -vvv to get all messages).
--no-color Disable colorization of hyperopt results. May be
useful if you are redirecting output to a file.
--logfile, --log-file FILE
--logfile FILE, --log-file FILE
Log to the file specified. Special values are:
'syslog', 'journald'. See the documentation for more
details.
-V, --version show program's version number and exit
-c, --config PATH Specify configuration file (default:
-c PATH, --config PATH
Specify configuration file (default:
`userdir/config.json` or `config.json` whichever
exists). Multiple --config options may be used. Can be
set to `-` to read config from stdin.
-d, --datadir, --data-dir PATH
-d PATH, --datadir PATH, --data-dir PATH
Path to the base directory of the exchange with
historical backtesting data. To see futures data, use
trading-mode additionally.
--userdir, --user-data-dir PATH
--userdir PATH, --user-data-dir PATH
Path to userdata directory.
```

View File

@@ -1,4 +1,4 @@
``` output
```
usage: freqtrade edge [-h] [-v] [--no-color] [--logfile FILE] [-V] [-c PATH]
[-d PATH] [--userdir PATH] [-s NAME]
[--strategy-path PATH] [--recursive-strategy-search]
@@ -10,7 +10,7 @@ usage: freqtrade edge [-h] [-v] [--no-color] [--logfile FILE] [-V] [-c PATH]
options:
-h, --help show this help message and exit
-i, --timeframe TIMEFRAME
-i TIMEFRAME, --timeframe TIMEFRAME
Specify timeframe (`1m`, `5m`, `30m`, `1h`, `1d`).
--timerange TIMERANGE
Specify what timerange of data to use.
@@ -25,7 +25,7 @@ options:
setting.
--fee FLOAT Specify fee ratio. Will be applied twice (on trade
entry and exit).
-p, --pairs PAIRS [PAIRS ...]
-p PAIRS [PAIRS ...], --pairs PAIRS [PAIRS ...]
Limit command to these pairs. Pairs are space-
separated.
@@ -33,24 +33,26 @@ Common arguments:
-v, --verbose Verbose mode (-vv for more, -vvv to get all messages).
--no-color Disable colorization of hyperopt results. May be
useful if you are redirecting output to a file.
--logfile, --log-file FILE
--logfile FILE, --log-file FILE
Log to the file specified. Special values are:
'syslog', 'journald'. See the documentation for more
details.
-V, --version show program's version number and exit
-c, --config PATH Specify configuration file (default:
-c PATH, --config PATH
Specify configuration file (default:
`userdir/config.json` or `config.json` whichever
exists). Multiple --config options may be used. Can be
set to `-` to read config from stdin.
-d, --datadir, --data-dir PATH
-d PATH, --datadir PATH, --data-dir PATH
Path to the base directory of the exchange with
historical backtesting data. To see futures data, use
trading-mode additionally.
--userdir, --user-data-dir PATH
--userdir PATH, --user-data-dir PATH
Path to userdata directory.
Strategy arguments:
-s, --strategy NAME Specify strategy class name which will be used by the
-s NAME, --strategy NAME
Specify strategy class name which will be used by the
bot.
--strategy-path PATH Specify additional strategy lookup path.
--recursive-strategy-search

View File

@@ -1,197 +0,0 @@
``` output
Possible commands:
available_pairs
Return available pair (backtest data) based on timeframe / stake_currency selection
:param timeframe: Only pairs with this timeframe available.
:param stake_currency: Only pairs that include this stake currency.
balance
Get the account balance.
blacklist
Show the current blacklist.
:param add: List of coins to add (example: "BNB/BTC")
cancel_open_order
Cancel open order for trade.
:param trade_id: Cancels open orders for this trade.
count
Return the amount of open trades.
daily
Return the profits for each day, and amount of trades.
delete_lock
Delete (disable) lock from the database.
:param lock_id: ID for the lock to delete
delete_trade
Delete trade from the database.
Tries to close open orders. Requires manual handling of this asset on the exchange.
:param trade_id: Deletes the trade with this ID from the database.
entries
Returns List of dicts containing all Trades, based on buy tag performance
Can either be average for all pairs or a specific pair provided
exits
Returns List of dicts containing all Trades, based on exit reason performance
Can either be average for all pairs or a specific pair provided
forcebuy
Buy an asset.
:param pair: Pair to buy (ETH/BTC)
:param price: Optional - price to buy
forceenter
Force entering a trade
:param pair: Pair to buy (ETH/BTC)
:param side: 'long' or 'short'
:param price: Optional - price to buy
:param order_type: Optional keyword argument - 'limit' or 'market'
:param stake_amount: Optional keyword argument - stake amount (as float)
:param leverage: Optional keyword argument - leverage (as float)
:param enter_tag: Optional keyword argument - entry tag (as string, default: 'force_enter')
forceexit
Force-exit a trade.
:param tradeid: Id of the trade (can be received via status command)
:param ordertype: Order type to use (must be market or limit)
:param amount: Amount to sell. Full sell if not given
health
Provides a quick health check of the running bot.
list_custom_data
List custom-data of the running bot for a specific trade.
:param trade_id: ID of the trade
:param key: str, optional - Key of the custom-data
list_open_trades_custom_data
List open trades custom-data of the running bot.
:param key: str, optional - Key of the custom-data
:param limit: limit of trades
:param offset: trades offset for pagination
lock_add
Lock pair
:param pair: Pair to lock
:param until: Lock until this date (format "2024-03-30 16:00:00Z")
:param side: Side to lock (long, short, *)
:param reason: Reason for the lock
locks
Return current locks
logs
Show latest logs.
:param limit: Limits log messages to the last <limit> logs. No limit to get the entire log.
mix_tags
Returns List of dicts containing all Trades, based on entry_tag + exit_reason performance
Can either be average for all pairs or a specific pair provided
monthly
Return the profits for each month, and amount of trades.
pair_candles
Return live dataframe for <pair><timeframe>.
:param pair: Pair to get data for
:param timeframe: Only pairs with this timeframe available.
:param limit: Limit result to the last n candles.
:param columns: List of dataframe columns to return. Empty list will return OHLCV.
pair_history
Return historic, analyzed dataframe
:param pair: Pair to get data for
:param timeframe: Only pairs with this timeframe available.
:param strategy: Strategy to analyze and get values for
:param freqaimodel: FreqAI model to use for analysis
:param timerange: Timerange to get data for (same format than --timerange endpoints)
pairlists_available
Lists available pairlist providers
performance
Return the performance of the different coins.
ping
simple ping
plot_config
Return plot configuration if the strategy defines one.
profit
Return the profit summary.
reload_config
Reload configuration.
show_config
Returns part of the configuration, relevant for trading operations.
start
Start the bot if it's in the stopped state.
stats
Return the stats report (durations, sell-reasons).
status
Get the status of open trades.
stop
Stop the bot. Use `start` to restart.
stopbuy
Stop buying (but handle sells gracefully). Use `reload_config` to reset.
strategies
Lists available strategies
strategy
Get strategy details
:param strategy: Strategy class name
sysinfo
Provides system information (CPU, RAM usage)
trade
Return specific trade
:param trade_id: Specify which trade to get.
trades
Return trades history, sorted by id (or by latest timestamp if order_by_id=False)
:param limit: Limits trades to the X last trades. Max 500 trades.
:param offset: Offset by this amount of trades.
:param order_by_id: Sort trades by id (default: True). If False, sorts by latest timestamp.
version
Return the version of the bot.
weekly
Return the profits for each week, and amount of trades.
whitelist
Show the current whitelist.
```

View File

@@ -1,4 +1,4 @@
``` output
```
usage: freqtrade hyperopt-list [-h] [-v] [--no-color] [--logfile FILE] [-V]
[-c PATH] [-d PATH] [--userdir PATH] [--best]
[--profitable] [--min-trades INT]
@@ -44,20 +44,21 @@ Common arguments:
-v, --verbose Verbose mode (-vv for more, -vvv to get all messages).
--no-color Disable colorization of hyperopt results. May be
useful if you are redirecting output to a file.
--logfile, --log-file FILE
--logfile FILE, --log-file FILE
Log to the file specified. Special values are:
'syslog', 'journald'. See the documentation for more
details.
-V, --version show program's version number and exit
-c, --config PATH Specify configuration file (default:
-c PATH, --config PATH
Specify configuration file (default:
`userdir/config.json` or `config.json` whichever
exists). Multiple --config options may be used. Can be
set to `-` to read config from stdin.
-d, --datadir, --data-dir PATH
-d PATH, --datadir PATH, --data-dir PATH
Path to the base directory of the exchange with
historical backtesting data. To see futures data, use
trading-mode additionally.
--userdir, --user-data-dir PATH
--userdir PATH, --user-data-dir PATH
Path to userdata directory.
```

View File

@@ -1,4 +1,4 @@
``` output
```
usage: freqtrade hyperopt-show [-h] [-v] [--no-color] [--logfile FILE] [-V]
[-c PATH] [-d PATH] [--userdir PATH] [--best]
[--profitable] [-n INT] [--print-json]
@@ -10,7 +10,7 @@ options:
-h, --help show this help message and exit
--best Select only best epochs.
--profitable Select only profitable epochs.
-n, --index INT Specify the index of the epoch to print details for.
-n INT, --index INT Specify the index of the epoch to print details for.
--print-json Print output in JSON format.
--hyperopt-filename FILENAME
Hyperopt result filename.Example: `--hyperopt-
@@ -26,20 +26,21 @@ Common arguments:
-v, --verbose Verbose mode (-vv for more, -vvv to get all messages).
--no-color Disable colorization of hyperopt results. May be
useful if you are redirecting output to a file.
--logfile, --log-file FILE
--logfile FILE, --log-file FILE
Log to the file specified. Special values are:
'syslog', 'journald'. See the documentation for more
details.
-V, --version show program's version number and exit
-c, --config PATH Specify configuration file (default:
-c PATH, --config PATH
Specify configuration file (default:
`userdir/config.json` or `config.json` whichever
exists). Multiple --config options may be used. Can be
set to `-` to read config from stdin.
-d, --datadir, --data-dir PATH
-d PATH, --datadir PATH, --data-dir PATH
Path to the base directory of the exchange with
historical backtesting data. To see futures data, use
trading-mode additionally.
--userdir, --user-data-dir PATH
--userdir PATH, --user-data-dir PATH
Path to userdata directory.
```

View File

@@ -1,4 +1,4 @@
``` output
```
usage: freqtrade hyperopt [-h] [-v] [--no-color] [--logfile FILE] [-V]
[-c PATH] [-d PATH] [--userdir PATH] [-s NAME]
[--strategy-path PATH] [--recursive-strategy-search]
@@ -11,15 +11,16 @@ usage: freqtrade hyperopt [-h] [-v] [--no-color] [--logfile FILE] [-V]
[--eps] [--enable-protections]
[--dry-run-wallet DRY_RUN_WALLET]
[--timeframe-detail TIMEFRAME_DETAIL] [-e INT]
[--spaces SPACES [SPACES ...]] [--print-all]
[--print-json] [-j JOBS] [--random-state INT]
[--min-trades INT] [--hyperopt-loss NAME]
[--disable-param-export] [--ignore-missing-spaces]
[--analyze-per-epoch] [--early-stop INT]
[--spaces {all,buy,sell,roi,stoploss,trailing,protection,trades,default} [{all,buy,sell,roi,stoploss,trailing,protection,trades,default} ...]]
[--print-all] [--print-json] [-j JOBS]
[--random-state INT] [--min-trades INT]
[--hyperopt-loss NAME] [--disable-param-export]
[--ignore-missing-spaces] [--analyze-per-epoch]
[--early-stop INT]
options:
-h, --help show this help message and exit
-i, --timeframe TIMEFRAME
-i TIMEFRAME, --timeframe TIMEFRAME
Specify timeframe (`1m`, `5m`, `30m`, `1h`, `1d`).
--timerange TIMERANGE
Specify what timerange of data to use.
@@ -34,7 +35,7 @@ options:
setting.
--fee FLOAT Specify fee ratio. Will be applied twice (on trade
entry and exit).
-p, --pairs PAIRS [PAIRS ...]
-p PAIRS [PAIRS ...], --pairs PAIRS [PAIRS ...]
Limit command to these pairs. Pairs are space-
separated.
--hyperopt-path PATH Specify additional lookup path for Hyperopt Loss
@@ -46,23 +47,19 @@ options:
Enable protections for backtesting. Will slow
backtesting down by a considerable amount, but will
include configured protections
--dry-run-wallet, --starting-balance DRY_RUN_WALLET
--dry-run-wallet DRY_RUN_WALLET, --starting-balance DRY_RUN_WALLET
Starting balance, used for backtesting / hyperopt and
dry-runs.
--timeframe-detail TIMEFRAME_DETAIL
Specify detail timeframe for backtesting (`1m`, `5m`,
`30m`, `1h`, `1d`).
-e, --epochs INT Specify number of epochs (default: 100).
--spaces SPACES [SPACES ...]
-e INT, --epochs INT Specify number of epochs (default: 100).
--spaces {all,buy,sell,roi,stoploss,trailing,protection,trades,default} [{all,buy,sell,roi,stoploss,trailing,protection,trades,default} ...]
Specify which parameters to hyperopt. Space-separated
list. Available builtin options (custom spaces will
not be listed here): default, all, buy, sell, enter,
exit, roi, stoploss, trailing, protection, trades.
Default: `default` - which includes all spaces except
for 'trailing', 'protection', and 'trades'.
list.
--print-all Print all results, not only the best ones.
--print-json Print output in JSON format.
-j, --job-workers JOBS
-j JOBS, --job-workers JOBS
The number of concurrently running jobs for
hyperoptimization (hyperopt worker processes). If -1
(default), all CPUs are used, for -2, all CPUs but one
@@ -72,7 +69,7 @@ options:
reproducible hyperopt results.
--min-trades INT Set minimal desired number of trades for evaluations
in the hyperopt optimization path (default: 1).
--hyperopt-loss, --hyperoptloss NAME
--hyperopt-loss NAME, --hyperoptloss NAME
Specify the class name of the hyperopt loss function
class (IHyperOptLoss). Different functions can
generate completely different results, since the
@@ -98,24 +95,26 @@ Common arguments:
-v, --verbose Verbose mode (-vv for more, -vvv to get all messages).
--no-color Disable colorization of hyperopt results. May be
useful if you are redirecting output to a file.
--logfile, --log-file FILE
--logfile FILE, --log-file FILE
Log to the file specified. Special values are:
'syslog', 'journald'. See the documentation for more
details.
-V, --version show program's version number and exit
-c, --config PATH Specify configuration file (default:
-c PATH, --config PATH
Specify configuration file (default:
`userdir/config.json` or `config.json` whichever
exists). Multiple --config options may be used. Can be
set to `-` to read config from stdin.
-d, --datadir, --data-dir PATH
-d PATH, --datadir PATH, --data-dir PATH
Path to the base directory of the exchange with
historical backtesting data. To see futures data, use
trading-mode additionally.
--userdir, --user-data-dir PATH
--userdir PATH, --user-data-dir PATH
Path to userdata directory.
Strategy arguments:
-s, --strategy NAME Specify strategy class name which will be used by the
-s NAME, --strategy NAME
Specify strategy class name which will be used by the
bot.
--strategy-path PATH Specify additional strategy lookup path.
--recursive-strategy-search

View File

@@ -1,4 +1,4 @@
``` output
```
usage: freqtrade install-ui [-h] [--erase] [--prerelease]
[--ui-version UI_VERSION]

View File

@@ -1,4 +1,4 @@
``` output
```
usage: freqtrade list-data [-h] [-v] [--no-color] [--logfile FILE] [-V]
[-c PATH] [-d PATH] [--userdir PATH]
[--exchange EXCHANGE]
@@ -18,10 +18,10 @@ options:
Storage format for downloaded trades data. (default:
`feather`).
--trades Work on trades data instead of OHLCV data.
-p, --pairs PAIRS [PAIRS ...]
-p PAIRS [PAIRS ...], --pairs PAIRS [PAIRS ...]
Limit command to these pairs. Pairs are space-
separated.
--trading-mode, --tradingmode {spot,margin,futures}
--trading-mode {spot,margin,futures}, --tradingmode {spot,margin,futures}
Select Trading mode
--show-timerange Show timerange available for available data. (May take
a while to calculate).
@@ -30,20 +30,21 @@ Common arguments:
-v, --verbose Verbose mode (-vv for more, -vvv to get all messages).
--no-color Disable colorization of hyperopt results. May be
useful if you are redirecting output to a file.
--logfile, --log-file FILE
--logfile FILE, --log-file FILE
Log to the file specified. Special values are:
'syslog', 'journald'. See the documentation for more
details.
-V, --version show program's version number and exit
-c, --config PATH Specify configuration file (default:
-c PATH, --config PATH
Specify configuration file (default:
`userdir/config.json` or `config.json` whichever
exists). Multiple --config options may be used. Can be
set to `-` to read config from stdin.
-d, --datadir, --data-dir PATH
-d PATH, --datadir PATH, --data-dir PATH
Path to the base directory of the exchange with
historical backtesting data. To see futures data, use
trading-mode additionally.
--userdir, --user-data-dir PATH
--userdir PATH, --user-data-dir PATH
Path to userdata directory.
```

View File

@@ -1,4 +1,4 @@
``` output
```
usage: freqtrade list-exchanges [-h] [-v] [--no-color] [--logfile FILE] [-V]
[-c PATH] [-d PATH] [--userdir PATH] [-1] [-a]
[--trading-mode {spot,margin,futures}]
@@ -8,7 +8,7 @@ options:
-h, --help show this help message and exit
-1, --one-column Print output in one column.
-a, --all Print all exchanges known to the ccxt library.
--trading-mode, --tradingmode {spot,margin,futures}
--trading-mode {spot,margin,futures}, --tradingmode {spot,margin,futures}
Select Trading mode
--dex-exchanges Print only DEX exchanges.
@@ -16,20 +16,21 @@ Common arguments:
-v, --verbose Verbose mode (-vv for more, -vvv to get all messages).
--no-color Disable colorization of hyperopt results. May be
useful if you are redirecting output to a file.
--logfile, --log-file FILE
--logfile FILE, --log-file FILE
Log to the file specified. Special values are:
'syslog', 'journald'. See the documentation for more
details.
-V, --version show program's version number and exit
-c, --config PATH Specify configuration file (default:
-c PATH, --config PATH
Specify configuration file (default:
`userdir/config.json` or `config.json` whichever
exists). Multiple --config options may be used. Can be
set to `-` to read config from stdin.
-d, --datadir, --data-dir PATH
-d PATH, --datadir PATH, --data-dir PATH
Path to the base directory of the exchange with
historical backtesting data. To see futures data, use
trading-mode additionally.
--userdir, --user-data-dir PATH
--userdir PATH, --user-data-dir PATH
Path to userdata directory.
```

View File

@@ -1,4 +1,4 @@
``` output
```
usage: freqtrade list-freqaimodels [-h] [-v] [--no-color] [--logfile FILE]
[-V] [-c PATH] [-d PATH] [--userdir PATH]
[--freqaimodel-path PATH] [-1]
@@ -13,20 +13,21 @@ Common arguments:
-v, --verbose Verbose mode (-vv for more, -vvv to get all messages).
--no-color Disable colorization of hyperopt results. May be
useful if you are redirecting output to a file.
--logfile, --log-file FILE
--logfile FILE, --log-file FILE
Log to the file specified. Special values are:
'syslog', 'journald'. See the documentation for more
details.
-V, --version show program's version number and exit
-c, --config PATH Specify configuration file (default:
-c PATH, --config PATH
Specify configuration file (default:
`userdir/config.json` or `config.json` whichever
exists). Multiple --config options may be used. Can be
set to `-` to read config from stdin.
-d, --datadir, --data-dir PATH
-d PATH, --datadir PATH, --data-dir PATH
Path to the base directory of the exchange with
historical backtesting data. To see futures data, use
trading-mode additionally.
--userdir, --user-data-dir PATH
--userdir PATH, --user-data-dir PATH
Path to userdata directory.
```

View File

@@ -1,4 +1,4 @@
``` output
```
usage: freqtrade list-hyperoptloss [-h] [-v] [--no-color] [--logfile FILE]
[-V] [-c PATH] [-d PATH] [--userdir PATH]
[--hyperopt-path PATH] [-1]
@@ -13,20 +13,21 @@ Common arguments:
-v, --verbose Verbose mode (-vv for more, -vvv to get all messages).
--no-color Disable colorization of hyperopt results. May be
useful if you are redirecting output to a file.
--logfile, --log-file FILE
--logfile FILE, --log-file FILE
Log to the file specified. Special values are:
'syslog', 'journald'. See the documentation for more
details.
-V, --version show program's version number and exit
-c, --config PATH Specify configuration file (default:
-c PATH, --config PATH
Specify configuration file (default:
`userdir/config.json` or `config.json` whichever
exists). Multiple --config options may be used. Can be
set to `-` to read config from stdin.
-d, --datadir, --data-dir PATH
-d PATH, --datadir PATH, --data-dir PATH
Path to the base directory of the exchange with
historical backtesting data. To see futures data, use
trading-mode additionally.
--userdir, --user-data-dir PATH
--userdir PATH, --user-data-dir PATH
Path to userdata directory.
```

View File

@@ -1,4 +1,4 @@
``` output
```
usage: freqtrade list-markets [-h] [-v] [--no-color] [--logfile FILE] [-V]
[-c PATH] [-d PATH] [--userdir PATH]
[--exchange EXCHANGE] [--print-list]
@@ -21,27 +21,28 @@ options:
Specify quote currency(-ies). Space-separated list.
-a, --all Print all pairs or market symbols. By default only
active ones are shown.
--trading-mode, --tradingmode {spot,margin,futures}
--trading-mode {spot,margin,futures}, --tradingmode {spot,margin,futures}
Select Trading mode
Common arguments:
-v, --verbose Verbose mode (-vv for more, -vvv to get all messages).
--no-color Disable colorization of hyperopt results. May be
useful if you are redirecting output to a file.
--logfile, --log-file FILE
--logfile FILE, --log-file FILE
Log to the file specified. Special values are:
'syslog', 'journald'. See the documentation for more
details.
-V, --version show program's version number and exit
-c, --config PATH Specify configuration file (default:
-c PATH, --config PATH
Specify configuration file (default:
`userdir/config.json` or `config.json` whichever
exists). Multiple --config options may be used. Can be
set to `-` to read config from stdin.
-d, --datadir, --data-dir PATH
-d PATH, --datadir PATH, --data-dir PATH
Path to the base directory of the exchange with
historical backtesting data. To see futures data, use
trading-mode additionally.
--userdir, --user-data-dir PATH
--userdir PATH, --user-data-dir PATH
Path to userdata directory.
```

View File

@@ -1,4 +1,4 @@
``` output
```
usage: freqtrade list-pairs [-h] [-v] [--no-color] [--logfile FILE] [-V]
[-c PATH] [-d PATH] [--userdir PATH]
[--exchange EXCHANGE] [--print-list]
@@ -21,27 +21,28 @@ options:
Specify quote currency(-ies). Space-separated list.
-a, --all Print all pairs or market symbols. By default only
active ones are shown.
--trading-mode, --tradingmode {spot,margin,futures}
--trading-mode {spot,margin,futures}, --tradingmode {spot,margin,futures}
Select Trading mode
Common arguments:
-v, --verbose Verbose mode (-vv for more, -vvv to get all messages).
--no-color Disable colorization of hyperopt results. May be
useful if you are redirecting output to a file.
--logfile, --log-file FILE
--logfile FILE, --log-file FILE
Log to the file specified. Special values are:
'syslog', 'journald'. See the documentation for more
details.
-V, --version show program's version number and exit
-c, --config PATH Specify configuration file (default:
-c PATH, --config PATH
Specify configuration file (default:
`userdir/config.json` or `config.json` whichever
exists). Multiple --config options may be used. Can be
set to `-` to read config from stdin.
-d, --datadir, --data-dir PATH
-d PATH, --datadir PATH, --data-dir PATH
Path to the base directory of the exchange with
historical backtesting data. To see futures data, use
trading-mode additionally.
--userdir, --user-data-dir PATH
--userdir PATH, --user-data-dir PATH
Path to userdata directory.
```

View File

@@ -1,4 +1,4 @@
``` output
```
usage: freqtrade list-strategies [-h] [-v] [--no-color] [--logfile FILE] [-V]
[-c PATH] [-d PATH] [--userdir PATH]
[--strategy-path PATH] [-1]
@@ -16,20 +16,21 @@ Common arguments:
-v, --verbose Verbose mode (-vv for more, -vvv to get all messages).
--no-color Disable colorization of hyperopt results. May be
useful if you are redirecting output to a file.
--logfile, --log-file FILE
--logfile FILE, --log-file FILE
Log to the file specified. Special values are:
'syslog', 'journald'. See the documentation for more
details.
-V, --version show program's version number and exit
-c, --config PATH Specify configuration file (default:
-c PATH, --config PATH
Specify configuration file (default:
`userdir/config.json` or `config.json` whichever
exists). Multiple --config options may be used. Can be
set to `-` to read config from stdin.
-d, --datadir, --data-dir PATH
-d PATH, --datadir PATH, --data-dir PATH
Path to the base directory of the exchange with
historical backtesting data. To see futures data, use
trading-mode additionally.
--userdir, --user-data-dir PATH
--userdir PATH, --user-data-dir PATH
Path to userdata directory.
```

View File

@@ -1,34 +1,32 @@
``` output
```
usage: freqtrade list-timeframes [-h] [-v] [--no-color] [--logfile FILE] [-V]
[-c PATH] [-d PATH] [--userdir PATH]
[--exchange EXCHANGE] [-1]
[--trading-mode {spot,margin,futures}]
options:
-h, --help show this help message and exit
--exchange EXCHANGE Exchange name. Only valid if no config is provided.
-1, --one-column Print output in one column.
--trading-mode, --tradingmode {spot,margin,futures}
Select Trading mode
Common arguments:
-v, --verbose Verbose mode (-vv for more, -vvv to get all messages).
--no-color Disable colorization of hyperopt results. May be
useful if you are redirecting output to a file.
--logfile, --log-file FILE
--logfile FILE, --log-file FILE
Log to the file specified. Special values are:
'syslog', 'journald'. See the documentation for more
details.
-V, --version show program's version number and exit
-c, --config PATH Specify configuration file (default:
-c PATH, --config PATH
Specify configuration file (default:
`userdir/config.json` or `config.json` whichever
exists). Multiple --config options may be used. Can be
set to `-` to read config from stdin.
-d, --datadir, --data-dir PATH
-d PATH, --datadir PATH, --data-dir PATH
Path to the base directory of the exchange with
historical backtesting data. To see futures data, use
trading-mode additionally.
--userdir, --user-data-dir PATH
--userdir PATH, --user-data-dir PATH
Path to userdata directory.
```

View File

@@ -1,4 +1,4 @@
``` output
```
usage: freqtrade lookahead-analysis [-h] [-v] [--no-color] [--logfile FILE]
[-V] [-c PATH] [-d PATH] [--userdir PATH]
[-s NAME] [--strategy-path PATH]
@@ -26,7 +26,7 @@ usage: freqtrade lookahead-analysis [-h] [-v] [--no-color] [--logfile FILE]
options:
-h, --help show this help message and exit
-i, --timeframe TIMEFRAME
-i TIMEFRAME, --timeframe TIMEFRAME
Specify timeframe (`1m`, `5m`, `30m`, `1h`, `1d`).
--timerange TIMERANGE
Specify what timerange of data to use.
@@ -41,7 +41,7 @@ options:
setting.
--fee FLOAT Specify fee ratio. Will be applied twice (on trade
entry and exit).
-p, --pairs PAIRS [PAIRS ...]
-p PAIRS [PAIRS ...], --pairs PAIRS [PAIRS ...]
Limit command to these pairs. Pairs are space-
separated.
--enable-protections, --enableprotections
@@ -53,7 +53,7 @@ options:
pairlist will be generated for each new candle if
you're using a pairlist handler that supports this
feature, for example, ShuffleFilter.
--dry-run-wallet, --starting-balance DRY_RUN_WALLET
--dry-run-wallet DRY_RUN_WALLET, --starting-balance DRY_RUN_WALLET
Starting balance, used for backtesting / hyperopt and
dry-runs.
--timeframe-detail TIMEFRAME_DETAIL
@@ -68,13 +68,13 @@ options:
becomes `backtest-data-SampleStrategy.json`
--export {none,trades,signals}
Export backtest results (default: trades).
--backtest-filename, --export-filename PATH
--backtest-filename PATH, --export-filename PATH
Use this filename for backtest results.Example:
`--backtest-
filename=backtest_results_2020-09-27_16-20-48.json`.
Assumes either `user_data/backtest_results/` or
`--export-directory` as base directory.
--backtest-directory, --export-directory PATH
--backtest-directory PATH, --export-directory PATH
Directory to use for backtest results. Example:
`--export-directory=user_data/backtest_results/`.
--freqai-backtest-live-models
@@ -93,24 +93,26 @@ Common arguments:
-v, --verbose Verbose mode (-vv for more, -vvv to get all messages).
--no-color Disable colorization of hyperopt results. May be
useful if you are redirecting output to a file.
--logfile, --log-file FILE
--logfile FILE, --log-file FILE
Log to the file specified. Special values are:
'syslog', 'journald'. See the documentation for more
details.
-V, --version show program's version number and exit
-c, --config PATH Specify configuration file (default:
-c PATH, --config PATH
Specify configuration file (default:
`userdir/config.json` or `config.json` whichever
exists). Multiple --config options may be used. Can be
set to `-` to read config from stdin.
-d, --datadir, --data-dir PATH
-d PATH, --datadir PATH, --data-dir PATH
Path to the base directory of the exchange with
historical backtesting data. To see futures data, use
trading-mode additionally.
--userdir, --user-data-dir PATH
--userdir PATH, --user-data-dir PATH
Path to userdata directory.
Strategy arguments:
-s, --strategy NAME Specify strategy class name which will be used by the
-s NAME, --strategy NAME
Specify strategy class name which will be used by the
bot.
--strategy-path PATH Specify additional strategy lookup path.
--recursive-strategy-search

View File

@@ -1,6 +1,7 @@
``` output
```
usage: freqtrade [-h] [-V]
{trade,create-userdir,new-config,show-config,new-strategy,download-data,convert-data,convert-trade-data,trades-to-ohlcv,list-data,backtesting,backtesting-show,backtesting-analysis,edge,hyperopt,hyperopt-list,hyperopt-show,list-exchanges,list-markets,list-pairs,list-strategies,list-hyperoptloss,list-freqaimodels,list-timeframes,show-trades,test-pairlist,convert-db,install-ui,plot-dataframe,plot-profit,webserver,strategy-updater,lookahead-analysis,recursive-analysis} ...
{trade,create-userdir,new-config,show-config,new-strategy,download-data,convert-data,convert-trade-data,trades-to-ohlcv,list-data,backtesting,backtesting-show,backtesting-analysis,edge,hyperopt,hyperopt-list,hyperopt-show,list-exchanges,list-markets,list-pairs,list-strategies,list-hyperoptloss,list-freqaimodels,list-timeframes,show-trades,test-pairlist,convert-db,install-ui,plot-dataframe,plot-profit,webserver,strategy-updater,lookahead-analysis,recursive-analysis}
...
Free, open source crypto trading bot

View File

@@ -1,11 +1,12 @@
``` output
```
usage: freqtrade new-config [-h] [-c PATH]
options:
-h, --help show this help message and exit
-c, --config PATH Specify configuration file (default:
`userdir/config.json` or `config.json` whichever exists).
Multiple --config options may be used. Can be set to `-`
to read config from stdin.
-h, --help show this help message and exit
-c PATH, --config PATH
Specify configuration file (default:
`userdir/config.json` or `config.json` whichever
exists). Multiple --config options may be used. Can be
set to `-` to read config from stdin.
```

View File

@@ -1,13 +1,14 @@
``` output
```
usage: freqtrade new-strategy [-h] [--userdir PATH] [-s NAME]
[--strategy-path PATH]
[--template {full,minimal,advanced}]
options:
-h, --help show this help message and exit
--userdir, --user-data-dir PATH
--userdir PATH, --user-data-dir PATH
Path to userdata directory.
-s, --strategy NAME Specify strategy class name which will be used by the
-s NAME, --strategy NAME
Specify strategy class name which will be used by the
bot.
--strategy-path PATH Specify additional strategy lookup path.
--template {full,minimal,advanced}

View File

@@ -1,4 +1,4 @@
``` output
```
usage: freqtrade plot-dataframe [-h] [-v] [--no-color] [--logfile FILE] [-V]
[-c PATH] [-d PATH] [--userdir PATH] [-s NAME]
[--strategy-path PATH]
@@ -16,7 +16,7 @@ usage: freqtrade plot-dataframe [-h] [-v] [--no-color] [--logfile FILE] [-V]
options:
-h, --help show this help message and exit
-p, --pairs PAIRS [PAIRS ...]
-p PAIRS [PAIRS ...], --pairs PAIRS [PAIRS ...]
Limit command to these pairs. Pairs are space-
separated.
--indicators1 INDICATORS1 [INDICATORS1 ...]
@@ -38,7 +38,7 @@ options:
(backtest file)) Default: file
--export {none,trades,signals}
Export backtest results (default: trades).
--backtest-filename, --export-filename PATH
--backtest-filename PATH, --export-filename PATH
Use this filename for backtest results.Example:
`--backtest-
filename=backtest_results_2020-09-27_16-20-48.json`.
@@ -46,7 +46,7 @@ options:
`--export-directory` as base directory.
--timerange TIMERANGE
Specify what timerange of data to use.
-i, --timeframe TIMEFRAME
-i TIMEFRAME, --timeframe TIMEFRAME
Specify timeframe (`1m`, `5m`, `30m`, `1h`, `1d`).
--no-trades Skip using trades from backtesting file and DB.
@@ -54,24 +54,26 @@ Common arguments:
-v, --verbose Verbose mode (-vv for more, -vvv to get all messages).
--no-color Disable colorization of hyperopt results. May be
useful if you are redirecting output to a file.
--logfile, --log-file FILE
--logfile FILE, --log-file FILE
Log to the file specified. Special values are:
'syslog', 'journald'. See the documentation for more
details.
-V, --version show program's version number and exit
-c, --config PATH Specify configuration file (default:
-c PATH, --config PATH
Specify configuration file (default:
`userdir/config.json` or `config.json` whichever
exists). Multiple --config options may be used. Can be
set to `-` to read config from stdin.
-d, --datadir, --data-dir PATH
-d PATH, --datadir PATH, --data-dir PATH
Path to the base directory of the exchange with
historical backtesting data. To see futures data, use
trading-mode additionally.
--userdir, --user-data-dir PATH
--userdir PATH, --user-data-dir PATH
Path to userdata directory.
Strategy arguments:
-s, --strategy NAME Specify strategy class name which will be used by the
-s NAME, --strategy NAME
Specify strategy class name which will be used by the
bot.
--strategy-path PATH Specify additional strategy lookup path.
--recursive-strategy-search

View File

@@ -1,4 +1,4 @@
``` output
```
usage: freqtrade plot-profit [-h] [-v] [--no-color] [--logfile FILE] [-V]
[-c PATH] [-d PATH] [--userdir PATH] [-s NAME]
[--strategy-path PATH]
@@ -12,14 +12,14 @@ usage: freqtrade plot-profit [-h] [-v] [--no-color] [--logfile FILE] [-V]
options:
-h, --help show this help message and exit
-p, --pairs PAIRS [PAIRS ...]
-p PAIRS [PAIRS ...], --pairs PAIRS [PAIRS ...]
Limit command to these pairs. Pairs are space-
separated.
--timerange TIMERANGE
Specify what timerange of data to use.
--export {none,trades,signals}
Export backtest results (default: trades).
--backtest-filename, --export-filename PATH
--backtest-filename PATH, --export-filename PATH
Use this filename for backtest results.Example:
`--backtest-
filename=backtest_results_2020-09-27_16-20-48.json`.
@@ -32,7 +32,7 @@ options:
--trade-source {DB,file}
Specify the source for trades (Can be DB or file
(backtest file)) Default: file
-i, --timeframe TIMEFRAME
-i TIMEFRAME, --timeframe TIMEFRAME
Specify timeframe (`1m`, `5m`, `30m`, `1h`, `1d`).
--auto-open Automatically open generated plot.
@@ -40,24 +40,26 @@ Common arguments:
-v, --verbose Verbose mode (-vv for more, -vvv to get all messages).
--no-color Disable colorization of hyperopt results. May be
useful if you are redirecting output to a file.
--logfile, --log-file FILE
--logfile FILE, --log-file FILE
Log to the file specified. Special values are:
'syslog', 'journald'. See the documentation for more
details.
-V, --version show program's version number and exit
-c, --config PATH Specify configuration file (default:
-c PATH, --config PATH
Specify configuration file (default:
`userdir/config.json` or `config.json` whichever
exists). Multiple --config options may be used. Can be
set to `-` to read config from stdin.
-d, --datadir, --data-dir PATH
-d PATH, --datadir PATH, --data-dir PATH
Path to the base directory of the exchange with
historical backtesting data. To see futures data, use
trading-mode additionally.
--userdir, --user-data-dir PATH
--userdir PATH, --user-data-dir PATH
Path to userdata directory.
Strategy arguments:
-s, --strategy NAME Specify strategy class name which will be used by the
-s NAME, --strategy NAME
Specify strategy class name which will be used by the
bot.
--strategy-path PATH Specify additional strategy lookup path.
--recursive-strategy-search

View File

@@ -1,4 +1,4 @@
``` output
```
usage: freqtrade recursive-analysis [-h] [-v] [--no-color] [--logfile FILE]
[-V] [-c PATH] [-d PATH] [--userdir PATH]
[-s NAME] [--strategy-path PATH]
@@ -12,14 +12,14 @@ usage: freqtrade recursive-analysis [-h] [-v] [--no-color] [--logfile FILE]
options:
-h, --help show this help message and exit
-i, --timeframe TIMEFRAME
-i TIMEFRAME, --timeframe TIMEFRAME
Specify timeframe (`1m`, `5m`, `30m`, `1h`, `1d`).
--timerange TIMERANGE
Specify what timerange of data to use.
--data-format-ohlcv {json,jsongz,feather,parquet}
Storage format for downloaded candle (OHLCV) data.
(default: `feather`).
-p, --pairs PAIRS [PAIRS ...]
-p PAIRS [PAIRS ...], --pairs PAIRS [PAIRS ...]
Limit command to these pairs. Pairs are space-
separated.
--startup-candle STARTUP_CANDLE [STARTUP_CANDLE ...]
@@ -30,24 +30,26 @@ Common arguments:
-v, --verbose Verbose mode (-vv for more, -vvv to get all messages).
--no-color Disable colorization of hyperopt results. May be
useful if you are redirecting output to a file.
--logfile, --log-file FILE
--logfile FILE, --log-file FILE
Log to the file specified. Special values are:
'syslog', 'journald'. See the documentation for more
details.
-V, --version show program's version number and exit
-c, --config PATH Specify configuration file (default:
-c PATH, --config PATH
Specify configuration file (default:
`userdir/config.json` or `config.json` whichever
exists). Multiple --config options may be used. Can be
set to `-` to read config from stdin.
-d, --datadir, --data-dir PATH
-d PATH, --datadir PATH, --data-dir PATH
Path to the base directory of the exchange with
historical backtesting data. To see futures data, use
trading-mode additionally.
--userdir, --user-data-dir PATH
--userdir PATH, --user-data-dir PATH
Path to userdata directory.
Strategy arguments:
-s, --strategy NAME Specify strategy class name which will be used by the
-s NAME, --strategy NAME
Specify strategy class name which will be used by the
bot.
--strategy-path PATH Specify additional strategy lookup path.
--recursive-strategy-search

View File

@@ -1,12 +1,13 @@
``` output
```
usage: freqtrade show-config [-h] [--userdir PATH] [-c PATH]
[--show-sensitive]
options:
-h, --help show this help message and exit
--userdir, --user-data-dir PATH
--userdir PATH, --user-data-dir PATH
Path to userdata directory.
-c, --config PATH Specify configuration file (default:
-c PATH, --config PATH
Specify configuration file (default:
`userdir/config.json` or `config.json` whichever
exists). Multiple --config options may be used. Can be
set to `-` to read config from stdin.

View File

@@ -1,4 +1,4 @@
``` output
```
usage: freqtrade show-trades [-h] [-v] [--no-color] [--logfile FILE] [-V]
[-c PATH] [-d PATH] [--userdir PATH]
[--db-url PATH]
@@ -19,20 +19,21 @@ Common arguments:
-v, --verbose Verbose mode (-vv for more, -vvv to get all messages).
--no-color Disable colorization of hyperopt results. May be
useful if you are redirecting output to a file.
--logfile, --log-file FILE
--logfile FILE, --log-file FILE
Log to the file specified. Special values are:
'syslog', 'journald'. See the documentation for more
details.
-V, --version show program's version number and exit
-c, --config PATH Specify configuration file (default:
-c PATH, --config PATH
Specify configuration file (default:
`userdir/config.json` or `config.json` whichever
exists). Multiple --config options may be used. Can be
set to `-` to read config from stdin.
-d, --datadir, --data-dir PATH
-d PATH, --datadir PATH, --data-dir PATH
Path to the base directory of the exchange with
historical backtesting data. To see futures data, use
trading-mode additionally.
--userdir, --user-data-dir PATH
--userdir PATH, --user-data-dir PATH
Path to userdata directory.
```

View File

@@ -1,4 +1,4 @@
``` output
```
usage: freqtrade strategy-updater [-h] [-v] [--no-color] [--logfile FILE] [-V]
[-c PATH] [-d PATH] [--userdir PATH]
[--strategy-list STRATEGY_LIST [STRATEGY_LIST ...]]
@@ -23,20 +23,21 @@ Common arguments:
-v, --verbose Verbose mode (-vv for more, -vvv to get all messages).
--no-color Disable colorization of hyperopt results. May be
useful if you are redirecting output to a file.
--logfile, --log-file FILE
--logfile FILE, --log-file FILE
Log to the file specified. Special values are:
'syslog', 'journald'. See the documentation for more
details.
-V, --version show program's version number and exit
-c, --config PATH Specify configuration file (default:
-c PATH, --config PATH
Specify configuration file (default:
`userdir/config.json` or `config.json` whichever
exists). Multiple --config options may be used. Can be
set to `-` to read config from stdin.
-d, --datadir, --data-dir PATH
-d PATH, --datadir PATH, --data-dir PATH
Path to the base directory of the exchange with
historical backtesting data. To see futures data, use
trading-mode additionally.
--userdir, --user-data-dir PATH
--userdir PATH, --user-data-dir PATH
Path to userdata directory.
```

View File

@@ -1,14 +1,15 @@
``` output
```
usage: freqtrade test-pairlist [-h] [--userdir PATH] [-v] [-c PATH]
[--quote QUOTE_CURRENCY [QUOTE_CURRENCY ...]]
[-1] [--print-json] [--exchange EXCHANGE]
options:
-h, --help show this help message and exit
--userdir, --user-data-dir PATH
--userdir PATH, --user-data-dir PATH
Path to userdata directory.
-v, --verbose Verbose mode (-vv for more, -vvv to get all messages).
-c, --config PATH Specify configuration file (default:
-c PATH, --config PATH
Specify configuration file (default:
`userdir/config.json` or `config.json` whichever
exists). Multiple --config options may be used. Can be
set to `-` to read config from stdin.

View File

@@ -1,4 +1,4 @@
``` output
```
usage: freqtrade trade [-h] [-v] [--no-color] [--logfile FILE] [-V] [-c PATH]
[-d PATH] [--userdir PATH] [-s NAME]
[--strategy-path PATH] [--recursive-strategy-search]
@@ -15,7 +15,7 @@ options:
--sd-notify Notify systemd service manager.
--dry-run Enforce dry-run for trading (removes Exchange secrets
and simulates trades).
--dry-run-wallet, --starting-balance DRY_RUN_WALLET
--dry-run-wallet DRY_RUN_WALLET, --starting-balance DRY_RUN_WALLET
Starting balance, used for backtesting / hyperopt and
dry-runs.
--fee FLOAT Specify fee ratio. Will be applied twice (on trade
@@ -25,24 +25,26 @@ Common arguments:
-v, --verbose Verbose mode (-vv for more, -vvv to get all messages).
--no-color Disable colorization of hyperopt results. May be
useful if you are redirecting output to a file.
--logfile, --log-file FILE
--logfile FILE, --log-file FILE
Log to the file specified. Special values are:
'syslog', 'journald'. See the documentation for more
details.
-V, --version show program's version number and exit
-c, --config PATH Specify configuration file (default:
-c PATH, --config PATH
Specify configuration file (default:
`userdir/config.json` or `config.json` whichever
exists). Multiple --config options may be used. Can be
set to `-` to read config from stdin.
-d, --datadir, --data-dir PATH
-d PATH, --datadir PATH, --data-dir PATH
Path to the base directory of the exchange with
historical backtesting data. To see futures data, use
trading-mode additionally.
--userdir, --user-data-dir PATH
--userdir PATH, --user-data-dir PATH
Path to userdata directory.
Strategy arguments:
-s, --strategy NAME Specify strategy class name which will be used by the
-s NAME, --strategy NAME
Specify strategy class name which will be used by the
bot.
--strategy-path PATH Specify additional strategy lookup path.
--recursive-strategy-search

View File

@@ -1,4 +1,4 @@
``` output
```
usage: freqtrade trades-to-ohlcv [-h] [-v] [--no-color] [--logfile FILE] [-V]
[-c PATH] [-d PATH] [--userdir PATH]
[-p PAIRS [PAIRS ...]]
@@ -10,10 +10,10 @@ usage: freqtrade trades-to-ohlcv [-h] [-v] [--no-color] [--logfile FILE] [-V]
options:
-h, --help show this help message and exit
-p, --pairs PAIRS [PAIRS ...]
-p PAIRS [PAIRS ...], --pairs PAIRS [PAIRS ...]
Limit command to these pairs. Pairs are space-
separated.
-t, --timeframes TIMEFRAMES [TIMEFRAMES ...]
-t TIMEFRAMES [TIMEFRAMES ...], --timeframes TIMEFRAMES [TIMEFRAMES ...]
Specify which tickers to download. Space-separated
list. Default: `1m 5m`.
--exchange EXCHANGE Exchange name. Only valid if no config is provided.
@@ -23,27 +23,28 @@ options:
--data-format-trades {json,jsongz,feather,parquet}
Storage format for downloaded trades data. (default:
`feather`).
--trading-mode, --tradingmode {spot,margin,futures}
--trading-mode {spot,margin,futures}, --tradingmode {spot,margin,futures}
Select Trading mode
Common arguments:
-v, --verbose Verbose mode (-vv for more, -vvv to get all messages).
--no-color Disable colorization of hyperopt results. May be
useful if you are redirecting output to a file.
--logfile, --log-file FILE
--logfile FILE, --log-file FILE
Log to the file specified. Special values are:
'syslog', 'journald'. See the documentation for more
details.
-V, --version show program's version number and exit
-c, --config PATH Specify configuration file (default:
-c PATH, --config PATH
Specify configuration file (default:
`userdir/config.json` or `config.json` whichever
exists). Multiple --config options may be used. Can be
set to `-` to read config from stdin.
-d, --datadir, --data-dir PATH
-d PATH, --datadir PATH, --data-dir PATH
Path to the base directory of the exchange with
historical backtesting data. To see futures data, use
trading-mode additionally.
--userdir, --user-data-dir PATH
--userdir PATH, --user-data-dir PATH
Path to userdata directory.
```

View File

@@ -1,4 +1,4 @@
``` output
```
usage: freqtrade webserver [-h] [-v] [--no-color] [--logfile FILE] [-V]
[-c PATH] [-d PATH] [--userdir PATH]
@@ -9,20 +9,21 @@ Common arguments:
-v, --verbose Verbose mode (-vv for more, -vvv to get all messages).
--no-color Disable colorization of hyperopt results. May be
useful if you are redirecting output to a file.
--logfile, --log-file FILE
--logfile FILE, --log-file FILE
Log to the file specified. Special values are:
'syslog', 'journald'. See the documentation for more
details.
-V, --version show program's version number and exit
-c, --config PATH Specify configuration file (default:
-c PATH, --config PATH
Specify configuration file (default:
`userdir/config.json` or `config.json` whichever
exists). Multiple --config options may be used. Can be
set to `-` to read config from stdin.
-d, --datadir, --data-dir PATH
-d PATH, --datadir PATH, --data-dir PATH
Path to the base directory of the exchange with
historical backtesting data. To see futures data, use
trading-mode additionally.
--userdir, --user-data-dir PATH
--userdir PATH, --user-data-dir PATH
Path to userdata directory.
```

View File

@@ -675,7 +675,7 @@ Should you experience problems you suspect are caused by websockets, you can dis
Should you be required to use a proxy, please refer to the [proxy section](#using-a-proxy-with-freqtrade) for more information.
!!! Info "Rollout"
We're rolling this out slowly, ensuring stability of your bots.
We're implementing this out slowly, ensuring stability of your bots.
Currently, usage is limited to ohlcv data streams.
It's also limited to a few exchanges, with new exchanges being added on an ongoing basis.

View File

@@ -26,19 +26,10 @@ Alternatively (e.g. if your system is not supported by the setup.sh script), fol
This will install all required tools for development, including `pytest`, `ruff`, `mypy`, and `coveralls`.
Run the following command to install the git hook scripts:
Then install the git hook scripts by running `pre-commit install`, so your changes will be verified locally before committing.
This avoids a lot of waiting for CI already, as some basic formatting checks are done locally on your machine.
``` bash
pre-commit install
```
These pre-commit scripts check your changes automatically before each commit.
If any formatting issues are found, the commit will fail and will prompt for fixes.
This reduces unnecessary CI failures, reduces maintenance burden, and improves code quality.
You can run the checks manually when necessary with `pre-commit run -a`.
Before opening a pull request, please also familiarize yourself with our [Contributing Guidelines](https://github.com/freqtrade/freqtrade/blob/develop/CONTRIBUTING.md).
Before opening a pull request, please familiarize yourself with our [Contributing Guidelines](https://github.com/freqtrade/freqtrade/blob/develop/CONTRIBUTING.md).
### Devcontainer setup

View File

@@ -407,12 +407,11 @@ To use these with Freqtrade, you will need to use the following configuration pa
``` json
"exchange": {
"name": "hyperliquid",
"walletAddress": "your_master_wallet_address", // Your master wallet address (not the API wallet address and not the vault/subaccount address).
"privateKey": "your_api_private_key", // API wallet private key (see https://app.hyperliquid.xyz/API). You'll only need the private key.
"walletAddress": "your_vault_address", // Vault or subaccount address
"privateKey": "your_api_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
"vaultAddress": "your_vault_address" // Optional, only if you want to use a vault or subaccount
}
},
// ...
@@ -421,9 +420,6 @@ To use these with Freqtrade, you will need to use the following configuration pa
Your balance and trades will now be used from your vault / 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.
### Historic Hyperliquid data
The Hyperliquid API does not provide historic data beyond the single call to fetch current data, so downloading data is not possible, as the downloaded data would not constitute proper historic data.

View File

@@ -46,17 +46,10 @@ Depending on the space you want to optimize, only some of the below are required
* define parameters with `space='buy'` - for entry signal optimization
* define parameters with `space='sell'` - for exit signal optimization
* define parameters with `space='enter'` - for entry signal optimization
* define parameters with `space='exit'` - for exit signal optimization
* define parameters with `space='protection'` - for protection optimization
* define parameters with `space='random_spacename'` - for better control over which parameters are optimized together
Pick the space name that suits the parameter best. We recommend to use either `buy` / `sell` or `enter` / `exit` for clarity (however there's no technical limitation in this regard).
!!! Note
`populate_indicators` needs to create all indicators any of the spaces may use, otherwise hyperopt will not work.
Rarely you may also need to create a [nested class](advanced-hyperopt.md#overriding-pre-defined-spaces) named `HyperOpt` and implement
* `roi_space` - for custom ROI optimization (if you need the ranges for the ROI parameters in the optimization hyperspace that differ from default)
@@ -86,15 +79,15 @@ Based on the loss function result, hyperopt will determine the next set of param
### Configure your Guards and Triggers
There are two places you need to change in your strategy file to add a new hyperopt parameter for optimization:
There are two places you need to change in your strategy file to add a new buy hyperopt for testing:
* Define the parameters at the class level hyperopt shall be optimizing.
* Within `populate_entry_trend()` - use defined parameter values instead of raw constants.
There you have two different types of indicators: 1. `guards` and 2. `triggers`.
1. Guards are conditions like "never enter if ADX < 10", or never enter if current price is over EMA10.
2. Triggers are ones that actually trigger entry in specific moment, like "enter when EMA5 crosses over EMA10" or "enter when close price touches lower Bollinger band".
1. Guards are conditions like "never buy if ADX < 10", or never buy if current price is over EMA10.
2. Triggers are ones that actually trigger buy in specific moment, like "buy when EMA5 crosses over EMA10" or "buy when close price touches lower Bollinger band".
!!! Hint "Guards and Triggers"
Technically, there is no difference between Guards and Triggers.
@@ -167,11 +160,9 @@ We use these to either enable or disable the ADX and RSI guards.
The last one we call `trigger` and use it to decide which buy trigger we want to use.
!!! Note "Parameter space assignment"
- Parameters must either be assigned to a variable named `buy_*`, `sell_*`, `enter_*` or `exit_*` or `protection_*` - or contain have a space assigned explicitly via parameter (`space='buy'`, `space='sell'`, `space='protection'`).
- Parameters with conflicting assignments (e.g. `buy_adx = IntParameter(4, 24, default=14, space='sell')`) will use the explicit space assignment.
- If no parameter is available for a space, you'll receive the error that no space was found when running hyperopt.
Parameters must either be assigned to a variable named `buy_*` or `sell_*` - or contain `space='buy'` | `space='sell'` to be assigned to a space correctly.
If no parameter is available for a space, you'll receive the error that no space was found when running hyperopt.
Parameters with unclear space (e.g. `adx_period = IntParameter(4, 24, default=14)` - no explicit nor implicit space) will not be detected and will therefore be ignored.
Spaces can also be custom named (e.g. `space='my_custom_space'`), with the only limitation that the space name cannot be `all`, `default` - and must result in a valid python identifier.
So let's write the buy strategy using these values:
@@ -529,24 +520,21 @@ freqtrade hyperopt --strategy <strategyname> --timerange 20210101-20210201
### Running Hyperopt with Smaller Search Space
Use the `--spaces` option to limit the search space used by hyperopt.
Letting Hyperopt optimize everything is often a huuuuge search space.
Often it might make more sense to start by just searching for initial entry algorithm.
Or maybe you just want to optimize your stoploss or roi table for that awesome new strategy you have.
Letting Hyperopt optimize everything is a huuuuge search space.
Often it might make more sense to start by just searching for initial buy algorithm.
Or maybe you just want to optimize your stoploss or roi table for that awesome new buy strategy you have.
Legal values are:
* `all`: optimize everything (including custom spaces)
* `all`: optimize everything
* `buy`: just search for a new buy strategy
* `sell`: just search for a new sell strategy
* `enter`: just search for a new entry logic
* `exit`: just search for a new entry logic
* `roi`: just optimize the minimal profit table for your strategy
* `stoploss`: search for the best stoploss value
* `trailing`: search for the best trailing stop values
* `trades`: search for the best max open trades values
* `protection`: search for the best protection parameters (read the [protections section](#optimizing-protections) on how to properly define these)
* `default`: `all` except `trailing`, `trades` and `protection`
* `custom_space_name`: any custom space used by any parameter in your strategy
* space-separated list of any of the above values for example `--spaces roi stoploss`
The default Hyperopt Search Space, used when no `--space` command line option is specified, does not include the `trailing` hyperspace. We recommend you to run optimization for the `trailing` hyperspace separately, when the best parameters for other hyperspaces were found, validated and pasted into your custom strategy.

View File

@@ -367,7 +367,7 @@ The optional `bearer_token` will be included in the requests Authorization Heade
#### MarketCapPairList
`MarketCapPairList` employs sorting/filtering of pairs by their marketcap rank based of CoinGecko. The returned pairlist will be sorted based of their marketcap ranks if used in whitelist `mode`.
`MarketCapPairList` employs sorting/filtering of pairs by their marketcap rank based of CoinGecko. The returned pairlist will be sorted based of their marketcap ranks.
```json
"pairlists": [
@@ -376,21 +376,16 @@ The optional `bearer_token` will be included in the requests Authorization Heade
"number_assets": 20,
"max_rank": 50,
"refresh_period": 86400,
"mode": "whitelist",
"categories": ["layer-1"]
}
]
```
`number_assets` defines the maximum number of pairs returned by the pairlist if used in whitelist `mode`. In blacklist `mode`, this setting will be ignored.
`max_rank` will determine the maximum rank used in creating/filtering the pairlist. It's expected that some coins within the top `max_rank` marketcap will not be included in the resulting pairlist since not all pairs will have active trading pairs in your preferred market/stake/exchange combination.
`number_assets` defines the maximum number of pairs returned by the pairlist. `max_rank` will determine the maximum rank used in creating/filtering the pairlist. It's expected that some coins within the top `max_rank` marketcap will not be included in the resulting pairlist since not all pairs will have active trading pairs in your preferred market/stake/exchange combination.
While using a `max_rank` bigger than 250 is supported, it's not recommended, as it'll cause multiple API calls to CoinGecko, which can lead to rate limit issues.
The `refresh_period` setting defines the interval (in seconds) at which the marketcap rank data will be refreshed. The default is 86,400 seconds (1 day). The pairlist cache (`refresh_period`) applies to both generating pairlists (when in the first position in the list) and filtering instances (when not in the first position in the list).
The `mode` setting defines whether the plugin will filters in (whitelist `mode`) or filters out (blacklist `mode`) top marketcap ranked coins. By default, the plugin will be in whitelist mode.
The `categories` setting specifies the [coingecko categories](https://www.coingecko.com/en/categories) from which to select coins from. The default is an empty list `[]`, meaning no category filtering is applied.
If an incorrect category string is chosen, the plugin will print the available categories from CoinGecko and fail. The category should be the ID of the category, for example, for `https://www.coingecko.com/en/categories/layer-1`, the category ID would be `layer-1`. You can pass multiple categories such as `["layer-1", "meme-token"]` to select from several categories.
@@ -417,7 +412,7 @@ This filter allows freqtrade to ignore pairs until they have been listed for at
Removes pairs that will be delisted on the exchange maximum `max_days_from_now` days from now (defaults to `0` which remove all future delisted pairs no matter how far from now). Currently this filter only supports following exchanges:
!!! Note "Available exchanges"
Delist filter is available on Bybit Futures, Bitget Futures and Binance, where Binance Futures will work for both dry and live modes, while Binance Spot is limited to live mode (for technical reasons).
Delist filter is only available on Binance, where Binance Futures will work for both dry and live modes, while Binance Spot is limited to live mode (for technical reasons).
!!! Warning "Backtesting"
`DelistFilter` does not support backtesting mode.

View File

@@ -1,6 +1,6 @@
![freqtrade](assets/freqtrade_poweredby.svg)
[![Freqtrade CI](https://github.com/freqtrade/freqtrade/actions/workflows/ci.yml/badge.svg?branch=develop)](https://github.com/freqtrade/freqtrade/actions/workflows/ci.yml)
[![Freqtrade CI](https://github.com/freqtrade/freqtrade/actions/workflows/ci.yml/badge.svg?branch=develop)](https://github.com/freqtrade/freqtrade/actions/)
[![DOI](https://joss.theoj.org/papers/10.21105/joss.04864/status.svg)](https://doi.org/10.21105/joss.04864)
[![Coverage Status](https://coveralls.io/repos/github/freqtrade/freqtrade/badge.svg?branch=develop&service=github)](https://coveralls.io/github/freqtrade/freqtrade?branch=develop)

View File

@@ -1,7 +1,7 @@
markdown==3.10
markdown==3.9
mkdocs==1.6.1
mkdocs-material==9.7.0
mkdocs-material==9.6.22
mdx_truly_sane_lists==1.3
pymdown-extensions==10.17.1
pymdown-extensions==10.16.1
jinja2==3.1.6
mike==2.1.3

View File

@@ -150,16 +150,184 @@ This method will work for all arguments - check the "show" command for a list of
For a full list of available commands, please refer to the list below.
#### Freqtrade client- available commands
Possible commands can be listed from the rest-client script using the `help` command.
``` bash
freqtrade-client help
```
--8<-- "commands/freqtrade-client.md"
``` output
Possible commands:
available_pairs
Return available pair (backtest data) based on timeframe / stake_currency selection
:param timeframe: Only pairs with this timeframe available.
:param stake_currency: Only pairs that include this timeframe
balance
Get the account balance.
blacklist
Show the current blacklist.
:param add: List of coins to add (example: "BNB/BTC")
cancel_open_order
Cancel open order for trade.
:param trade_id: Cancels open orders for this trade.
count
Return the amount of open trades.
daily
Return the profits for each day, and amount of trades.
delete_lock
Delete (disable) lock from the database.
:param lock_id: ID for the lock to delete
delete_trade
Delete trade from the database.
Tries to close open orders. Requires manual handling of this asset on the exchange.
:param trade_id: Deletes the trade with this ID from the database.
forcebuy
Buy an asset.
:param pair: Pair to buy (ETH/BTC)
:param price: Optional - price to buy
forceenter
Force entering a trade
:param pair: Pair to buy (ETH/BTC)
:param side: 'long' or 'short'
:param price: Optional - price to buy
forceexit
Force-exit a trade.
:param tradeid: Id of the trade (can be received via status command)
:param ordertype: Order type to use (must be market or limit)
:param amount: Amount to sell. Full sell if not given
health
Provides a quick health check of the running bot.
lock_add
Manually lock a specific pair
:param pair: Pair to lock
:param until: Lock until this date (format "2024-03-30 16:00:00Z")
:param side: Side to lock (long, short, *)
:param reason: Reason for the lock
locks
Return current locks
logs
Show latest logs.
:param limit: Limits log messages to the last <limit> logs. No limit to get the entire log.
pair_candles
Return live dataframe for <pair><timeframe>.
:param pair: Pair to get data for
:param timeframe: Only pairs with this timeframe available.
:param limit: Limit result to the last n candles.
pair_history
Return historic, analyzed dataframe
:param pair: Pair to get data for
:param timeframe: Only pairs with this timeframe available.
:param strategy: Strategy to analyze and get values for
:param timerange: Timerange to get data for (same format than --timerange endpoints)
performance
Return the performance of the different coins.
ping
simple ping
plot_config
Return plot configuration if the strategy defines one.
profit
Return the profit summary.
reload_config
Reload configuration.
show_config
Returns part of the configuration, relevant for trading operations.
start
Start the bot if it's in the stopped state.
pause
Pause the bot if it's in the running state. If triggered on stopped state will handle open positions.
stats
Return the stats report (durations, sell-reasons).
status
Get the status of open trades.
stop
Stop the bot. Use `start` to restart.
stopbuy
Stop buying (but handle sells gracefully). Use `reload_config` to reset.
strategies
Lists available strategies
strategy
Get strategy details
:param strategy: Strategy class name
sysinfo
Provides system information (CPU, RAM usage)
trade
Return specific trade
:param trade_id: Specify which trade to get.
trades
Return trades history, sorted by id
:param limit: Limits trades to the X last trades. Max 500 trades.
:param offset: Offset by this amount of trades.
list_open_trades_custom_data
Return a dict containing open trades custom-datas
:param key: str, optional - Key of the custom-data
:param limit: Limits trades to X trades.
:param offset: Offset by this amount of trades.
list_custom_data
Return a dict containing custom-datas of a specified trade
:param trade_id: int - ID of the trade
:param key: str, optional - Key of the custom-data
version
Return the version of the bot.
whitelist
Show the current whitelist.
```
### Available endpoints
@@ -191,7 +359,7 @@ All endpoints in the below table need to be prefixed with the base URL of the AP
| `/locks/<lockid>` | DELETE | Deletes (disables) the lock by id.<br/>*Params:*<br/>- `lockid` (`int`)
| `/profit` | GET | Display a summary of your profit/loss from close trades and some stats about your performance.
| `/forceexit` | POST | Instantly exits the given trade (ignoring `minimum_roi`), using the given order type ("market" or "limit", uses your config setting if not specified), and the chosen amount (full sell if not specified). If `all` is supplied as the `tradeid`, then all currently open trades will be forced to exit.<br/>*Params:*<br/>- `<tradeid>` (`int` or `str`)<br/>- `<ordertype>` (`str`)<br/>- `[amount]` (`float`)
| `/forceenter` | POST | Instantly enters the given pair. Side is optional and is either `long` or `short` (default is `long`). Price, stake amount, entry tag and leverage are optional. Order type is optional and is either `market` or `long` (default using the value set in config). (`force_entry_enable` must be set to True)<br/>*Params:*<br/>- `<pair>` (`str`)<br/>- `<side>` (`str`)<br/>- `[price]` (`float`)<br/>- `[ordertype]` (`str`)<br/>- `[stakeamount]` (`float`)<br/>- `[entry_tag]` (`str`)<br/>- `[leverage]` (`float`)
| `/forceenter` | POST | Instantly enters the given pair. Side is optional and is either `long` or `short` (default is `long`). Rate is optional. (`force_entry_enable` must be set to True)<br/>*Params:*<br/>- `<pair>` (`str`)<br/>- `<side>` (`str`)<br/>- `[rate]` (`float`)
| `/performance` | GET | Show performance of each finished trade grouped by pair.
| `/balance` | GET | Show account balance per currency.
| `/daily` | GET | Shows profit or loss per day, over the last n days (n defaults to 7).<br/>*Params:*<br/>- `timescale` (`int`)

View File

@@ -1,6 +1,6 @@
"""Freqtrade bot"""
__version__ = "2025.11-dev"
__version__ = "2025.10"
if "dev" in __version__:
from pathlib import Path

View File

@@ -104,7 +104,7 @@ ARGS_BACKTEST_SHOW = [
ARGS_LIST_EXCHANGES = ["print_one_column", "list_exchanges_all", "trading_mode", "dex_exchanges"]
ARGS_LIST_TIMEFRAMES = ["exchange", "print_one_column", "trading_mode"]
ARGS_LIST_TIMEFRAMES = ["exchange", "print_one_column"]
ARGS_LIST_PAIRS = [
"exchange",

View File

@@ -5,10 +5,7 @@ Definition of cli arguments used in arguments.py
from argparse import ArgumentTypeError
from freqtrade import constants
from freqtrade.constants import (
HYPEROPT_BUILTIN_SPACE_OPTIONS,
HYPEROPT_LOSS_BUILTIN,
)
from freqtrade.constants import HYPEROPT_LOSS_BUILTIN
from freqtrade.enums import CandleType
@@ -281,18 +278,26 @@ AVAILABLE_CLI_OPTIONS = {
),
"spaces": Arg(
"--spaces",
help=(
"Specify which parameters to hyperopt. Space-separated list. "
"Available builtin options (custom spaces will not be listed here): "
f"{', '.join(HYPEROPT_BUILTIN_SPACE_OPTIONS)}. Default: `default` - "
"which includes all spaces except for 'trailing', 'protection', and 'trades'."
),
help="Specify which parameters to hyperopt. Space-separated list.",
choices=[
"all",
"buy",
"sell",
"roi",
"stoploss",
"trailing",
"protection",
"trades",
"default",
],
nargs="+",
default="default",
),
"analyze_per_epoch": Arg(
"--analyze-per-epoch",
help="Run populate_indicators once per epoch.",
action="store_true",
default=False,
),
"print_all": Arg(
"--print-all",

View File

@@ -101,7 +101,7 @@ def _print_objs_tabular(objs: list, print_colorized: bool) -> None:
names = [s["name"] for s in objs]
objs_to_print: list[dict[str, Text | str]] = [
{
"Strategy name": Text(s["name"] if s["name"] else "--"),
"name": Text(s["name"] if s["name"] else "--"),
"location": s["location_rel"],
"status": (
Text("LOAD FAILED", style="bold red")
@@ -115,19 +115,11 @@ def _print_objs_tabular(objs: list, print_colorized: bool) -> None:
]
for idx, s in enumerate(objs):
if "hyperoptable" in s:
custom_params = [
f"{space}: {len(params)}"
for space, params in s["hyperoptable"].items()
if space not in ["buy", "sell", "protection"]
]
hyp = s["hyperoptable"]
objs_to_print[idx].update(
{
"hyperoptable": "Yes" if len(hyp) > 0 else "No",
"buy-Params": str(len(hyp.get("buy", []))),
"sell-Params": str(len(hyp.get("sell", []))),
"protection-Params": str(len(hyp.get("protection", []))),
"custom-Params": ", ".join(custom_params) if custom_params else "",
"hyperoptable": "Yes" if s["hyperoptable"]["count"] > 0 else "No",
"buy-Params": str(len(s["hyperoptable"].get("buy", []))),
"sell-Params": str(len(s["hyperoptable"].get("sell", []))),
}
)
table = Table()
@@ -148,7 +140,6 @@ def start_list_strategies(args: dict[str, Any]) -> None:
"""
from freqtrade.configuration import setup_utils_configuration
from freqtrade.resolvers import StrategyResolver
from freqtrade.strategy.hyper import detect_all_parameters
config = setup_utils_configuration(args, RunMode.UTIL_NO_EXCHANGE)
@@ -162,9 +153,9 @@ def start_list_strategies(args: dict[str, Any]) -> None:
strategy_objs = sorted(strategy_objs, key=lambda x: x["name"])
for obj in strategy_objs:
if obj["class"]:
obj["hyperoptable"] = detect_all_parameters(obj["class"])
obj["hyperoptable"] = obj["class"].detect_all_parameters()
else:
obj["hyperoptable"] = {}
obj["hyperoptable"] = {"count": 0}
if args["print_one_column"]:
print("\n".join([s["name"] for s in strategy_objs]))

View File

@@ -1,14 +1,11 @@
# Required json-schema for user specified config
from freqtrade.constants import (
AVAILABLE_DATAHANDLERS,
AVAILABLE_PAIRLISTS,
BACKTEST_BREAKDOWNS,
BACKTEST_CACHE_AGE,
DRY_RUN_WALLET,
EXPORT_OPTIONS,
HYPEROPT_LOSS_BUILTIN,
MARGIN_MODES,
ORDERTIF_POSSIBILITIES,
ORDERTYPE_POSSIBILITIES,
@@ -231,76 +228,6 @@ CONF_SCHEMA = {
"type": "array",
"items": {"type": "string", "enum": BACKTEST_BREAKDOWNS},
},
"backtest_cache": {
"description": "Load a cached backtest result no older than specified age.",
"type": "string",
"enum": BACKTEST_CACHE_AGE,
},
# Hyperopt
"hyperopt_path": {
"description": "Specify additional lookup path for Hyperopt Loss functions.",
"type": "string",
},
"epochs": {
"description": "Number of training epochs for Hyperopt.",
"type": "integer",
"minimum": 1,
},
"early_stop": {
"description": (
"Early stop hyperopt if no improvement after <epochs>. Set to 0 to disable."
),
"type": "integer",
"minimum": 0,
},
"spaces": {
"description": (
"Hyperopt parameter spaces to optimize. Default is the default set and"
"includes all spaces except for 'trailing', 'protection', and 'trades'."
),
"type": "array",
"items": {"type": "string"},
"default": ["default"],
},
"analyze_per_epoch": {
"description": "Perform analysis after each epoch in Hyperopt.",
"type": "boolean",
},
"print_all": {
"description": "Print all hyperopt trials, not just the best ones.",
"type": "boolean",
"default": False,
},
"hyperopt_jobs": {
"description": (
"The number of concurrently running jobs for hyperoptimization "
"(hyperopt worker processes). "
"If -1 (default), all CPUs are used, for -2, all CPUs but one are used, etc. "
"If 1 is given, no parallel computing is used."
),
"type": "integer",
"default": -1,
},
"hyperopt_random_state": {
"description": "Random state for hyperopt trials.",
"type": "integer",
"minimum": 0,
},
"hyperopt_min_trades": {
"description": "Minimum number of trades per epoch for hyperopt.",
"type": "integer",
"minimum": 0,
},
"hyperopt_loss": {
"description": (
"The class name of the hyperopt loss function class (IHyperOptLoss). "
"Different functions can generate completely different results, "
"since the target for optimization is different. "
f"Built-in Hyperopt-loss-functions are: {', '.join(HYPEROPT_LOSS_BUILTIN)}"
),
"type": "string",
},
# end hyperopt
"bot_name": {
"description": "Name of the trading bot. Passed via API to a client.",
"type": "string",

View File

@@ -41,19 +41,6 @@ HYPEROPT_LOSS_BUILTIN = [
"ProfitDrawDownHyperOptLoss",
"MultiMetricHyperOptLoss",
]
HYPEROPT_BUILTIN_SPACES = [
"buy",
"sell",
"enter",
"exit",
"roi",
"stoploss",
"trailing",
"protection",
"trades",
]
HYPEROPT_BUILTIN_SPACE_OPTIONS = ["default", "all"] + HYPEROPT_BUILTIN_SPACES
AVAILABLE_PAIRLISTS = [
"StaticPairList",
"VolumePairList",

View File

@@ -388,10 +388,8 @@ def refresh_backtest_ohlcv_data(
for timeframe in timeframes:
# Get fast candles via parallel method on first loop through per timeframe
# and candle type. Downloads all the pairs in the list and stores them.
# Also skips if only 1 pair/timeframe combination is scheduled for download.
if (
not no_parallel_download
and (len(pairs) + len(timeframes)) > 2
and exchange.get_option("download_data_parallel_quick", True)
and (
((pair, timeframe, candle_type) not in fast_candles)
@@ -476,7 +474,7 @@ def _download_all_pairs_history_parallel(
:return: Candle pairs with timeframes
"""
candles: dict[PairWithTimeframe, DataFrame] = {}
since: int | None = None
since = 0
if timerange:
if timerange.starttype == "date":
since = timerange.startts * 1000
@@ -484,12 +482,10 @@ def _download_all_pairs_history_parallel(
candle_limit = exchange.ohlcv_candle_limit(timeframe, candle_type)
one_call_min_time_dt = dt_ts(date_minus_candles(timeframe, candle_limit))
# check if we can get all candles in one go, if so then we can download them in parallel
if since is None or since > one_call_min_time_dt:
if since > one_call_min_time_dt:
logger.info(
f"Downloading parallel candles for {timeframe} for all pairs"
f" since {format_ms_time(since)}"
if since
else "."
f"Downloading parallel candles for {timeframe} for all pairs "
f"since {format_ms_time(since)}"
)
needed_pairs: ListPairsWithTimeframes = [
(p, timeframe, candle_type) for p in [p for p in pairs]
@@ -697,9 +693,6 @@ def download_data(
"""
Download data function. Used from both cli and API.
"""
exchange.validate_trading_mode_and_margin_mode(
config.get("trading_mode", TradingMode.SPOT), None, allow_none_margin_mode=True
)
timerange = TimeRange()
if "days" in config and config["days"] is not None:
time_since = (datetime.now() - timedelta(days=config["days"])).strftime("%Y%m%d")

View File

@@ -143,20 +143,6 @@ def _calc_drawdown_series(
max_drawdown_df["drawdown_relative"] = (
max_drawdown_df["high_value"] - max_drawdown_df["cumulative"]
) / max_drawdown_df["high_value"]
# Add zero row at start to account for edge-cases with no winning / losing trades - so high/low
# will be 0.0 in such cases.
zero_row = pd.DataFrame(
{
"cumulative": [0.0],
"high_value": [0.0],
"drawdown": [0.0],
"drawdown_relative": [0.0],
"date": [profit_results.loc[0, date_col]],
}
)
max_drawdown_df = pd.concat([zero_row, max_drawdown_df], ignore_index=True)
return max_drawdown_df
@@ -229,7 +215,6 @@ def calculate_max_drawdown(
max_drawdown_df = _calc_drawdown_series(
profit_results, date_col=date_col, value_col=value_col, starting_balance=starting_balance
)
# max_drawdown_df has an extra zero row at the start
# Calculate maximum drawdown
idxmin = (
@@ -238,15 +223,15 @@ def calculate_max_drawdown(
else max_drawdown_df["drawdown"].idxmin()
)
high_idx = max_drawdown_df.iloc[: idxmin + 1]["high_value"].idxmax()
high_date = profit_results.at[max(high_idx - 1, 0), date_col]
low_date = profit_results.at[max(idxmin - 1, 0), date_col]
high_val = max_drawdown_df.at[high_idx, "cumulative"]
low_val = max_drawdown_df.at[idxmin, "cumulative"]
max_drawdown_rel = max_drawdown_df.at[idxmin, "drawdown_relative"]
high_date = profit_results.loc[high_idx, date_col]
low_date = profit_results.loc[idxmin, date_col]
high_val = max_drawdown_df.loc[high_idx, "cumulative"]
low_val = max_drawdown_df.loc[idxmin, "cumulative"]
max_drawdown_rel = max_drawdown_df.loc[idxmin, "drawdown_relative"]
# Calculate current drawdown
current_high_idx = max_drawdown_df["high_value"].iloc[:-1].idxmax()
current_high_date = profit_results.at[max(current_high_idx - 1, 0), date_col]
current_high_date = profit_results.loc[current_high_idx, date_col]
current_high_value = max_drawdown_df.iloc[-1]["high_value"]
current_cumulative = max_drawdown_df.iloc[-1]["cumulative"]
current_drawdown_abs = current_high_value - current_cumulative

View File

@@ -5,6 +5,7 @@ from datetime import UTC, datetime
from pathlib import Path
import ccxt
from cachetools import TTLCache
from pandas import DataFrame
from freqtrade.constants import DEFAULT_DATAFRAME_COLUMNS
@@ -20,7 +21,6 @@ from freqtrade.exchange.common import retrier
from freqtrade.exchange.exchange_types import FtHas, Tickers
from freqtrade.exchange.exchange_utils_timeframe import timeframe_to_msecs
from freqtrade.misc import deep_merge_dicts, json_load
from freqtrade.util import FtTTLCache
from freqtrade.util.datetime_helpers import dt_from_ts, dt_ts
@@ -76,7 +76,7 @@ class Binance(Exchange):
def __init__(self, *args, **kwargs) -> None:
super().__init__(*args, **kwargs)
self._spot_delist_schedule_cache: FtTTLCache = FtTTLCache(maxsize=100, ttl=300)
self._spot_delist_schedule_cache: TTLCache = TTLCache(maxsize=100, ttl=300)
def get_proxy_coin(self) -> str:
"""

File diff suppressed because it is too large Load Diff

View File

@@ -1,10 +1,10 @@
import logging
from datetime import datetime, timedelta
from datetime import timedelta
import ccxt
from freqtrade.constants import BuySell
from freqtrade.enums import OPTIMIZE_MODES, CandleType, MarginMode, TradingMode
from freqtrade.enums import CandleType, MarginMode, TradingMode
from freqtrade.exceptions import (
DDosProtection,
OperationalException,
@@ -14,7 +14,7 @@ from freqtrade.exceptions import (
from freqtrade.exchange import Exchange
from freqtrade.exchange.common import API_RETRY_COUNT, retrier
from freqtrade.exchange.exchange_types import CcxtOrder, FtHas
from freqtrade.util import dt_from_ts, dt_now, dt_ts
from freqtrade.util.datetime_helpers import dt_now, dt_ts
logger = logging.getLogger(__name__)
@@ -37,7 +37,6 @@ class Bitget(Exchange):
_ft_has_futures: FtHas = {
"mark_ohlcv_timeframe": "4h",
"funding_fee_candle_limit": 100,
"has_delisting": True,
}
_supported_trading_mode_margin_pairs: list[tuple[TradingMode, MarginMode]] = [
@@ -237,35 +236,3 @@ class Bitget(Exchange):
raise OperationalException(
"Freqtrade currently only supports isolated futures for bitget"
)
def check_delisting_time(self, pair: str) -> datetime | None:
"""
Check if the pair gonna be delisted.
By default, it returns None.
:param pair: Market symbol
:return: Datetime if the pair gonna be delisted, None otherwise
"""
if self._config["runmode"] in OPTIMIZE_MODES:
return None
if self.trading_mode == TradingMode.FUTURES:
return self._check_delisting_futures(pair)
return None
def _check_delisting_futures(self, pair: str) -> datetime | None:
delivery_time = self.markets.get(pair, {}).get("info", {}).get("limitOpenTime", None)
if delivery_time:
if isinstance(delivery_time, str) and (delivery_time != ""):
delivery_time = int(delivery_time)
if not isinstance(delivery_time, int) or delivery_time <= 0:
return None
max_delivery = dt_ts() + (
14 * 24 * 60 * 60 * 1000
) # Assume exchange don't announce delisting more than 14 days in advance
if delivery_time < max_delivery:
return dt_from_ts(delivery_time)
return None

View File

@@ -4,13 +4,12 @@ from datetime import datetime, timedelta
import ccxt
from freqtrade.constants import BuySell
from freqtrade.enums import OPTIMIZE_MODES, MarginMode, PriceType, TradingMode
from freqtrade.enums import MarginMode, PriceType, TradingMode
from freqtrade.exceptions import DDosProtection, ExchangeError, OperationalException, TemporaryError
from freqtrade.exchange import Exchange
from freqtrade.exchange.common import retrier
from freqtrade.exchange.exchange_types import CcxtOrder, FtHas
from freqtrade.misc import deep_merge_dicts
from freqtrade.util import dt_from_ts, dt_ts
logger = logging.getLogger(__name__)
@@ -55,7 +54,6 @@ class Bybit(Exchange):
"exchange_has_overrides": {
"fetchOrder": True,
},
"has_delisting": True,
}
_supported_trading_mode_margin_pairs: list[tuple[TradingMode, MarginMode]] = [
@@ -296,35 +294,3 @@ class Bybit(Exchange):
self.cache_leverage_tiers(tiers, self._config["stake_currency"])
return tiers
def check_delisting_time(self, pair: str) -> datetime | None:
"""
Check if the pair gonna be delisted.
By default, it returns None.
:param pair: Market symbol
:return: Datetime if the pair gonna be delisted, None otherwise
"""
if self._config["runmode"] in OPTIMIZE_MODES:
return None
if self.trading_mode == TradingMode.FUTURES:
return self._check_delisting_futures(pair)
return None
def _check_delisting_futures(self, pair: str) -> datetime | None:
delivery_time = self.markets.get(pair, {}).get("info", {}).get("deliveryTime", 0)
if delivery_time:
if isinstance(delivery_time, str) and (delivery_time != ""):
delivery_time = int(delivery_time)
if not isinstance(delivery_time, int) or delivery_time <= 0:
return None
max_delivery = dt_ts() + (
14 * 24 * 60 * 60 * 1000
) # Assume exchange don't announce delisting more than 14 days in advance
if delivery_time < max_delivery:
return dt_from_ts(delivery_time)
return None

View File

@@ -16,6 +16,7 @@ from typing import Any, Literal, TypeGuard, TypeVar
import ccxt
import ccxt.pro as ccxt_pro
from cachetools import TTLCache
from ccxt import TICK_SIZE
from dateutil import parser
from pandas import DataFrame, concat
@@ -106,8 +107,9 @@ from freqtrade.misc import (
file_load_json,
safe_value_fallback2,
)
from freqtrade.util import FtTTLCache, PeriodicCache, dt_from_ts, dt_now
from freqtrade.util import dt_from_ts, dt_now
from freqtrade.util.datetime_helpers import dt_humanize_delta, dt_ts, format_ms_time
from freqtrade.util.periodic_cache import PeriodicCache
logger = logging.getLogger(__name__)
@@ -228,13 +230,13 @@ class Exchange:
self._cache_lock = Lock()
# Cache for 10 minutes ...
self._fetch_tickers_cache: FtTTLCache = FtTTLCache(maxsize=4, ttl=60 * 10)
self._fetch_tickers_cache: TTLCache = TTLCache(maxsize=4, ttl=60 * 10)
# Cache values for 300 to avoid frequent polling of the exchange for prices
# Caching only applies to RPC methods, so prices for open trades are still
# refreshed once every iteration.
# Shouldn't be too high either, as it'll freeze UI updates in case of open orders.
self._exit_rate_cache: FtTTLCache = FtTTLCache(maxsize=100, ttl=300)
self._entry_rate_cache: FtTTLCache = FtTTLCache(maxsize=100, ttl=300)
self._exit_rate_cache: TTLCache = TTLCache(maxsize=100, ttl=300)
self._entry_rate_cache: TTLCache = TTLCache(maxsize=100, ttl=300)
# Holds candles
self._klines: dict[PairWithTimeframe, DataFrame] = {}
@@ -428,15 +430,7 @@ class Exchange:
@property
def timeframes(self) -> list[str]:
market_type = (
"spot"
if self.trading_mode != TradingMode.FUTURES
else self._ft_has["ccxt_futures_name"]
)
timeframes = self._api.options.get("timeframes", {}).get(market_type)
if timeframes is None:
timeframes = self._api.timeframes
return list((timeframes or {}).keys())
return list((self._api.timeframes or {}).keys())
@property
def markets(self) -> dict[str, Any]:
@@ -897,7 +891,6 @@ class Exchange:
self,
trading_mode: TradingMode,
margin_mode: MarginMode | None, # Only None when trading_mode = TradingMode.SPOT
allow_none_margin_mode: bool = False,
):
"""
Checks if freqtrade can perform trades using the configured
@@ -905,18 +898,7 @@ class Exchange:
Throws OperationalException:
If the trading_mode/margin_mode type are not supported by freqtrade on this exchange
"""
if trading_mode == TradingMode.SPOT:
return
if allow_none_margin_mode and margin_mode is None:
# Verify trading mode independent of margin mode
if not any(
trading_mode == pair[0] for pair in self._supported_trading_mode_margin_pairs
):
raise ConfigurationError(
f"Freqtrade does not support '{trading_mode}' on {self.name}."
)
if not allow_none_margin_mode and (
if trading_mode != TradingMode.SPOT and (
(trading_mode, margin_mode) not in self._supported_trading_mode_margin_pairs
):
mm_value = margin_mode and margin_mode.value
@@ -1301,7 +1283,7 @@ class Exchange:
return order
def fetch_dry_run_order(self, order_id: str) -> CcxtOrder:
def fetch_dry_run_order(self, order_id) -> CcxtOrder:
"""
Return dry-run order
Only call if running in dry-run mode.
@@ -1313,12 +1295,11 @@ class Exchange:
except KeyError as e:
from freqtrade.persistence import Order
order_obj = Order.order_by_id(order_id)
if order_obj:
order = order_obj.to_ccxt_object(self._ft_has["stop_price_prop"])
order = self.check_dry_limit_order_filled(order)
self._dry_run_open_orders[order_id] = order
return order
order = Order.order_by_id(order_id)
if order:
ccxt_order = order.to_ccxt_object(self._ft_has["stop_price_prop"])
self._dry_run_open_orders[order_id] = ccxt_order
return ccxt_order
# Gracefully handle errors with dry-run orders.
raise InvalidOrderException(
f"Tried to get an invalid dry-run-order (id: {order_id}). Message: {e}"
@@ -1769,7 +1750,7 @@ class Exchange:
balances.pop("total", None)
balances.pop("used", None)
self._log_exchange_response("fetch_balance", balances)
self._log_exchange_response("fetch_balances", balances)
return balances
except ccxt.DDoSProtection as e:
raise DDosProtection(e) from e
@@ -2162,9 +2143,7 @@ class Exchange:
name = side.capitalize()
strat_name = "entry_pricing" if side == "entry" else "exit_pricing"
cache_rate: FtTTLCache = (
self._entry_rate_cache if side == "entry" else self._exit_rate_cache
)
cache_rate: TTLCache = self._entry_rate_cache if side == "entry" else self._exit_rate_cache
if not refresh:
with self._cache_lock:
rate = cache_rate.get(pair)

View File

@@ -3,7 +3,6 @@
import logging
from copy import deepcopy
from datetime import datetime
from typing import Any
from freqtrade.constants import BuySell
from freqtrade.enums import MarginMode, TradingMode
@@ -57,13 +56,6 @@ class Hyperliquid(Exchange):
config.update(super()._ccxt_config)
return config
def market_is_tradable(self, market: dict[str, Any]) -> bool:
parent_check = super().market_is_tradable(market)
# Exclude hip3 markets for now - which have the format XYZ:GOOGL/USDT:USDT -
# and XYZ:GOOGL as base
return parent_check and ":" not in market["base"]
def get_max_leverage(self, pair: str, stake_amount: float | None) -> float:
# There are no leverage tiers
if self.trading_mode == TradingMode.FUTURES:

View File

@@ -82,7 +82,7 @@ class Kraken(Exchange):
balances.pop("free", None)
balances.pop("total", None)
balances.pop("used", None)
self._log_exchange_response("fetch_balance", balances)
self._log_exchange_response("fetch_balances", balances)
# Consolidate balances
balances = self.consolidate_balances(balances)
@@ -104,7 +104,7 @@ class Kraken(Exchange):
balances[bal]["used"] = sum(order[1] for order in order_list if order[0] == bal)
balances[bal]["free"] = balances[bal]["total"] - balances[bal]["used"]
self._log_exchange_response("fetch_balance2", balances)
self._log_exchange_response("fetch_balances2", balances)
return balances
except ccxt.DDoSProtection as e:
raise DDosProtection(e) from e

View File

@@ -1,5 +1,5 @@
"""
Freqtrade is the main module of this bot. It contains the FreqtradeBot class.
Freqtrade is the main module of this bot. It contains the class Freqtrade()
"""
import logging
@@ -63,7 +63,7 @@ from freqtrade.rpc.rpc_types import (
from freqtrade.strategy.interface import IStrategy
from freqtrade.strategy.strategy_wrapper import strategy_safe_wrapper
from freqtrade.util import FtPrecise, MeasureTime, PeriodicCache, dt_from_ts, dt_now
from freqtrade.util.migrations import migrate_live_content
from freqtrade.util.migrations.binance_mig import migrate_binance_futures_names
from freqtrade.wallets import Wallets
@@ -229,7 +229,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_binance_futures_names(self.config)
set_startup_time()
self.rpc.startup_messages(self.config, self.pairlists, self.protections)

View File

@@ -1,8 +1,6 @@
from collections.abc import Callable
from cachetools import cached
from freqtrade.util import FtTTLCache
from cachetools import TTLCache, cached
class LoggingMixin:
@@ -20,7 +18,7 @@ class LoggingMixin:
"""
self.logger = logger
self.refresh_period = refresh_period
self._log_cache: FtTTLCache = FtTTLCache(maxsize=1024, ttl=self.refresh_period)
self._log_cache: TTLCache = TTLCache(maxsize=1024, ttl=self.refresh_period)
def log_once(self, message: str, logmethod: Callable, force_show: bool = False) -> None:
"""

View File

@@ -39,7 +39,6 @@ class RecursiveAnalysis(BaseAnalysis):
self.dict_recursive: dict[str, Any] = dict()
self.pair_to_used: str | None = None
self._strat_scc: int | None = None
# For recursive bias check
# analyzes two data frames with processed indicators and shows differences between them.
@@ -152,8 +151,7 @@ class RecursiveAnalysis(BaseAnalysis):
backtesting._set_strategy(backtesting.strategylist[0])
strat = backtesting.strategy
if self._strat_scc is None:
self._strat_scc = strat.startup_candle_count
self._strat_scc = strat.startup_candle_count
if self._strat_scc < 1:
raise ConfigurationError(

View File

@@ -126,7 +126,6 @@ class Backtesting:
self.config["dry_run"] = True
self.price_pair_prec: dict[str, Series] = {}
self.available_pairs: list[str] = []
self.run_ids: dict[str, str] = {}
self.strategylist: list[IStrategy] = []
self.all_bt_content: dict[str, BacktestContentType] = {}
@@ -177,8 +176,7 @@ class Backtesting:
self._validate_pairlists_for_backtesting()
self.dataprovider.add_pairlisthandler(self.pairlists)
self.dynamic_pairlist: bool = self.config.get("enable_dynamic_pairlist", False)
self.pairlists.refresh_pairlist(only_first=self.dynamic_pairlist)
self.pairlists.refresh_pairlist()
if len(self.pairlists.whitelist) == 0:
raise OperationalException("No pair in whitelist.")
@@ -213,6 +211,7 @@ class Backtesting:
self._can_short = self.trading_mode != TradingMode.SPOT
self._position_stacking: bool = self.config.get("position_stacking", False)
self.enable_protections: bool = self.config.get("enable_protections", False)
self.dynamic_pairlist: bool = self.config.get("enable_dynamic_pairlist", False)
migrate_data(config, self.exchange)
self.init_backtest()
@@ -336,12 +335,10 @@ class Backtesting:
self.progress.set_new_value(1)
self._load_bt_data_detail()
self.price_pair_prec = {}
for pair in self.pairlists.whitelist:
if pair in data:
# Load price precision logic
self.price_pair_prec[pair] = get_tick_size_over_time(data[pair])
self.available_pairs.append(pair)
return data, self.timerange
def _load_bt_data_detail(self) -> None:
@@ -1590,7 +1587,7 @@ class Backtesting:
self.check_abort()
if self.dynamic_pairlist and self.pairlists:
self.pairlists.refresh_pairlist(pairs=self.available_pairs)
self.pairlists.refresh_pairlist()
pairs = self.pairlists.whitelist
# Reset open trade count for this candle

View File

@@ -7,7 +7,6 @@ This module implements a convenience auto-hyperopt class, which can be used toge
import logging
from collections.abc import Callable
from contextlib import suppress
from typing import Literal
from freqtrade.exceptions import OperationalException
@@ -38,17 +37,10 @@ def _format_exception_message(space: str, ignore_missing_space: bool) -> None:
class HyperOptAuto(IHyperOpt):
"""
This class delegates functionality to Strategy(IHyperStrategy) and Strategy.HyperOpt classes.
Most of the time Strategy.HyperOpt class would only implement indicator_space and
sell_indicator_space methods, but other hyperopt methods can be overridden as well.
Most of the time Strategy.HyperOpt class would only implement indicator_space and
sell_indicator_space methods, but other hyperopt methods can be overridden as well.
"""
def get_available_spaces(self) -> list[str]:
"""
Get list of available spaces defined in strategy.
:return: list of available spaces.
"""
return list(self.strategy._ft_hyper_params)
def _get_func(self, name) -> Callable:
"""
Return a function defined in Strategy.HyperOpt class, or one defined in super() class.
@@ -62,26 +54,31 @@ class HyperOptAuto(IHyperOpt):
else:
return default_func
def get_indicator_space(
self, space: Literal["buy", "sell", "enter", "exit", "protection"] | str
) -> list:
"""
Get indicator space for a given space.
:param space: parameter space to get.
"""
indicator_space = [
attr.get_space(attr_name)
for attr_name, attr in self.strategy.enumerate_parameters(space)
if attr.optimize
]
def _generate_indicator_space(self, category):
for attr_name, attr in self.strategy.enumerate_parameters(category):
if attr.optimize:
yield attr.get_space(attr_name)
def _get_indicator_space(self, category) -> list:
# TODO: is this necessary, or can we call "generate_space" directly?
indicator_space = list(self._generate_indicator_space(category))
if len(indicator_space) > 0:
return indicator_space
else:
_format_exception_message(
space, self.config.get("hyperopt_ignore_missing_space", False)
category, self.config.get("hyperopt_ignore_missing_space", False)
)
return []
def buy_indicator_space(self) -> list["Dimension"]:
return self._get_indicator_space("buy")
def sell_indicator_space(self) -> list["Dimension"]:
return self._get_indicator_space("sell")
def protection_space(self) -> list["Dimension"]:
return self._get_indicator_space("protection")
def generate_roi_table(self, params: dict) -> dict[int, float]:
return self._get_func("generate_roi_table")(params)

View File

@@ -70,7 +70,13 @@ class HyperOptimizer:
"""
def __init__(self, config: Config, data_pickle_file: Path) -> None:
self.spaces: dict[str, list[DimensionProtocol]] = {}
self.buy_space: list[DimensionProtocol] = []
self.sell_space: list[DimensionProtocol] = []
self.protection_space: list[DimensionProtocol] = []
self.roi_space: list[DimensionProtocol] = []
self.stoploss_space: list[DimensionProtocol] = []
self.trailing_space: list[DimensionProtocol] = []
self.max_open_trades_space: list[DimensionProtocol] = []
self.dimensions: list[DimensionProtocol] = []
self.o_dimensions: dict = {}
@@ -161,39 +167,37 @@ class HyperOptimizer:
"""
result: dict = {}
for space in self.spaces.keys():
if space == "protection":
result["protection"] = round_dict(
{p.name: params.get(p.name) for p in self.spaces[space]}, 13
)
elif space == "roi":
result["roi"] = round_dict(
{str(k): v for k, v in self.custom_hyperopt.generate_roi_table(params).items()},
13,
)
elif space == "stoploss":
result["stoploss"] = round_dict(
{p.name: params.get(p.name) for p in self.spaces[space]}, 13
)
elif space == "trailing":
result["trailing"] = round_dict(
self.custom_hyperopt.generate_trailing_params(params), 13
)
elif space == "trades":
result["max_open_trades"] = round_dict(
{
"max_open_trades": (
self.backtesting.strategy.max_open_trades
if self.backtesting.strategy.max_open_trades != float("inf")
else -1
)
},
13,
)
else:
result[space] = round_dict(
{p.name: params.get(p.name) for p in self.spaces[space]}, 13
)
if HyperoptTools.has_space(self.config, "buy"):
result["buy"] = round_dict({p.name: params.get(p.name) for p in self.buy_space}, 13)
if HyperoptTools.has_space(self.config, "sell"):
result["sell"] = round_dict({p.name: params.get(p.name) for p in self.sell_space}, 13)
if HyperoptTools.has_space(self.config, "protection"):
result["protection"] = round_dict(
{p.name: params.get(p.name) for p in self.protection_space}, 13
)
if HyperoptTools.has_space(self.config, "roi"):
result["roi"] = round_dict(
{str(k): v for k, v in self.custom_hyperopt.generate_roi_table(params).items()}, 13
)
if HyperoptTools.has_space(self.config, "stoploss"):
result["stoploss"] = round_dict(
{p.name: params.get(p.name) for p in self.stoploss_space}, 13
)
if HyperoptTools.has_space(self.config, "trailing"):
result["trailing"] = round_dict(
self.custom_hyperopt.generate_trailing_params(params), 13
)
if HyperoptTools.has_space(self.config, "trades"):
result["max_open_trades"] = round_dict(
{
"max_open_trades": (
self.backtesting.strategy.max_open_trades
if self.backtesting.strategy.max_open_trades != float("inf")
else -1
)
},
13,
)
return result
@@ -222,39 +226,56 @@ class HyperOptimizer:
"""
Assign the dimensions in the hyperoptimization space.
"""
spaces = ["buy", "sell", "protection", "roi", "stoploss", "trailing", "trades"]
spaces += [s for s in self.custom_hyperopt.get_available_spaces() if s not in spaces]
if HyperoptTools.has_space(self.config, "protection"):
# Protections can only be optimized when using the Parameter interface
logger.debug("Hyperopt has 'protection' space")
# Enable Protections if protection space is selected.
self.config["enable_protections"] = True
self.backtesting.enable_protections = True
self.protection_space = self.custom_hyperopt.protection_space()
for space in spaces:
if not HyperoptTools.has_space(self.config, space):
continue
logger.debug(f"Hyperopt has '{space}' space")
if space == "protection":
# Protections can only be optimized when using the Parameter interface
# Enable Protections if protection space is selected.
self.config["enable_protections"] = True
self.backtesting.enable_protections = True
self.spaces[space] = self.custom_hyperopt.get_indicator_space(space)
elif space == "roi":
self.spaces[space] = self.custom_hyperopt.roi_space()
elif space == "stoploss":
self.spaces[space] = self.custom_hyperopt.stoploss_space()
elif space == "trailing":
self.spaces[space] = self.custom_hyperopt.trailing_space()
elif space == "trades":
self.spaces[space] = self.custom_hyperopt.max_open_trades_space()
else:
self.spaces[space] = self.custom_hyperopt.get_indicator_space(space)
if HyperoptTools.has_space(self.config, "buy"):
logger.debug("Hyperopt has 'buy' space")
self.buy_space = self.custom_hyperopt.buy_indicator_space()
self.dimensions = [s for space in self.spaces.values() for s in space]
if len(self.dimensions) == 0:
raise OperationalException(
"No hyperopt parameters found to optimize."
f"Available spaces: {', '.join(spaces)}. "
"Check your strategy's parameter definitions or verify the configured spaces "
"in your command."
)
self.o_dimensions = self.convert_dimensions_to_optuna_space(self.dimensions)
if HyperoptTools.has_space(self.config, "sell"):
logger.debug("Hyperopt has 'sell' space")
self.sell_space = self.custom_hyperopt.sell_indicator_space()
if HyperoptTools.has_space(self.config, "roi"):
logger.debug("Hyperopt has 'roi' space")
self.roi_space = self.custom_hyperopt.roi_space()
if HyperoptTools.has_space(self.config, "stoploss"):
logger.debug("Hyperopt has 'stoploss' space")
self.stoploss_space = self.custom_hyperopt.stoploss_space()
if HyperoptTools.has_space(self.config, "trailing"):
logger.debug("Hyperopt has 'trailing' space")
self.trailing_space = self.custom_hyperopt.trailing_space()
if HyperoptTools.has_space(self.config, "trades"):
logger.debug("Hyperopt has 'trades' space")
self.max_open_trades_space = self.custom_hyperopt.max_open_trades_space()
self.dimensions = (
self.buy_space
+ self.sell_space
+ self.protection_space
+ self.roi_space
+ self.stoploss_space
+ self.trailing_space
+ self.max_open_trades_space
)
def assign_params(self, params_dict: dict[str, Any], category: str) -> None:
"""
Assign hyperoptable parameters
"""
for attr_name, attr in self.backtesting.strategy.enumerate_parameters(category):
if attr.optimize:
# noinspection PyProtectedMember
attr.value = params_dict[attr_name]
@delayed
@wrap_non_picklable_objects
@@ -271,9 +292,15 @@ class HyperOptimizer:
HyperoptStateContainer.set_state(HyperoptState.OPTIMIZE)
backtest_start_time = datetime.now(UTC)
for attr_name, attr in self.backtesting.strategy.enumerate_parameters():
if attr.in_space and attr.optimize:
attr.value = params_dict[attr_name]
# Apply parameters
if HyperoptTools.has_space(self.config, "buy"):
self.assign_params(params_dict, "buy")
if HyperoptTools.has_space(self.config, "sell"):
self.assign_params(params_dict, "sell")
if HyperoptTools.has_space(self.config, "protection"):
self.assign_params(params_dict, "protection")
if HyperoptTools.has_space(self.config, "roi"):
self.backtesting.strategy.minimal_roi = self.custom_hyperopt.generate_roi_table(
@@ -409,6 +436,7 @@ class HyperOptimizer:
o_sampler = self.custom_hyperopt.generate_estimator(
dimensions=self.dimensions, random_state=random_state
)
self.o_dimensions = self.convert_dimensions_to_optuna_space(self.dimensions)
if isinstance(o_sampler, str):
if o_sampler not in optuna_samplers_dict.keys():

View File

@@ -9,7 +9,7 @@ import numpy as np
import rapidjson
from pandas import isna, json_normalize
from freqtrade.constants import FTHYPT_FILEVERSION, HYPEROPT_BUILTIN_SPACES, Config
from freqtrade.constants import FTHYPT_FILEVERSION, Config
from freqtrade.enums import HyperoptState
from freqtrade.exceptions import OperationalException
from freqtrade.misc import deep_merge_dicts, round_dict, safe_value_fallback2
@@ -219,22 +219,21 @@ class HyperoptTools:
print(rapidjson.dumps(result_dict, default=str, number_mode=HYPER_PARAMS_FILE_FORMAT))
else:
all_spaces = list(params.keys() | non_optimized.keys())
# Explicitly listed to keep original sort order
spaces = ["buy", "sell", "protection", "roi", "stoploss", "trailing", "max_open_trades"]
spaces += [s for s in all_spaces if s not in spaces]
lookup = {
"roi": "ROI",
"trailing": "Trailing stop",
}
for space in spaces:
name = lookup.get(
space, space.capitalize() if space in HYPEROPT_BUILTIN_SPACES else space
)
HyperoptTools._params_pretty_print(
params, space, f"{name} parameters:", non_optimized
)
HyperoptTools._params_pretty_print(
params, "buy", "Buy hyperspace params:", non_optimized
)
HyperoptTools._params_pretty_print(
params, "sell", "Sell hyperspace params:", non_optimized
)
HyperoptTools._params_pretty_print(
params, "protection", "Protection hyperspace params:", non_optimized
)
HyperoptTools._params_pretty_print(params, "roi", "ROI table:", non_optimized)
HyperoptTools._params_pretty_print(params, "stoploss", "Stoploss:", non_optimized)
HyperoptTools._params_pretty_print(params, "trailing", "Trailing stop:", non_optimized)
HyperoptTools._params_pretty_print(
params, "max_open_trades", "Max Open Trades:", non_optimized
)
@staticmethod
def _params_update_for_json(result_dict, params, non_optimized, space: str) -> None:

View File

@@ -755,8 +755,6 @@ class LocalTrade:
"precision_mode": self.precision_mode,
"precision_mode_price": self.precision_mode_price,
"contract_size": self.contract_size,
"nr_of_successful_entries": self.nr_of_successful_entries,
"nr_of_successful_exits": self.nr_of_successful_exits,
"has_open_orders": self.has_open_orders,
"orders": orders_json,
}

View File

@@ -75,11 +75,11 @@ def init_plotscript(config, markets: list, startup_candles: int = 0):
)
no_trades = False
filename = config.get("exportfilename") or config.get("exportdirectory")
filename = config.get("exportfilename")
if config.get("no_trades", False):
no_trades = True
elif config["trade_source"] == "file":
if not filename or (not filename.is_dir() and not filename.is_file()):
if not filename.is_dir() and not filename.is_file():
logger.warning("Backtest file is missing skipping trades.")
no_trades = True
try:

View File

@@ -7,10 +7,11 @@ Provides dynamic pair list based on Market Cap
import logging
import math
from cachetools import TTLCache
from freqtrade.exceptions import OperationalException
from freqtrade.exchange.exchange_types import Tickers
from freqtrade.plugins.pairlist.IPairList import IPairList, PairlistParameter, SupportsBacktesting
from freqtrade.util import FtTTLCache
from freqtrade.util.coin_gecko import FtCoinGeckoApi
@@ -24,20 +25,18 @@ class MarketCapPairList(IPairList):
def __init__(self, *args, **kwargs) -> None:
super().__init__(*args, **kwargs)
self._mode = self._pairlistconfig.get("mode", "whitelist")
if (self._mode == "whitelist") and ("number_assets" not in self._pairlistconfig):
if "number_assets" not in self._pairlistconfig:
raise OperationalException(
"`number_assets` not specified. Please check your configuration "
'for "pairlist.config.number_assets"'
)
self._stake_currency = self._config["stake_currency"]
self._number_assets = self._pairlistconfig.get("number_assets", 30)
self._number_assets = self._pairlistconfig["number_assets"]
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: TTLCache = TTLCache(maxsize=1, ttl=self._refresh_period)
_coingecko_config = self._config.get("coingecko", {})
@@ -79,9 +78,7 @@ class MarketCapPairList(IPairList):
"""
num = self._number_assets
rank = self._max_rank
mode = self._mode
pair_text = num if (mode == "whitelist") else "blacklisting"
msg = f"{self.name} - {pair_text} pairs placed within top {rank} market cap."
msg = f"{self.name} - {num} pairs placed within top {rank} market cap."
return msg
@staticmethod
@@ -118,13 +115,6 @@ class MarketCapPairList(IPairList):
"description": "Refresh period",
"help": "Refresh period in seconds",
},
"mode": {
"type": "option",
"default": "whitelist",
"options": ["whitelist", "blacklist"],
"description": "Mode of operation",
"help": "Mode of operation (whitelist/blacklist)",
},
}
def get_markets_exchange(self):
@@ -196,9 +186,6 @@ class MarketCapPairList(IPairList):
:return: new whitelist
"""
marketcap_list = self._marketcap_cache.get("marketcap")
mode = self._mode
is_whitelist_mode = mode == "whitelist"
filtered_pairlist: list[str] = []
default_kwargs = {
"vs_currency": "usd",
@@ -232,10 +219,12 @@ class MarketCapPairList(IPairList):
self._marketcap_cache["marketcap"] = marketcap_list
if marketcap_list:
filtered_pairlist: list[str] = []
market = self._exchange._config["trading_mode"]
pair_format = f"{self._stake_currency.upper()}" + (
f":{self._stake_currency.upper()}" if market == "futures" else ""
)
pair_format = f"{self._stake_currency.upper()}"
if market == "futures":
pair_format += f":{self._stake_currency.upper()}"
top_marketcap = marketcap_list[: self._max_rank :]
markets = self.get_markets_exchange()
@@ -245,16 +234,13 @@ class MarketCapPairList(IPairList):
resolved = self.resolve_marketcap_pair(pair, pairlist, markets, filtered_pairlist)
if resolved:
if not is_whitelist_mode:
pairlist.remove(resolved)
continue
filtered_pairlist.append(resolved)
if len(filtered_pairlist) == self._number_assets:
break
if not is_whitelist_mode:
return pairlist
if len(filtered_pairlist) == self._number_assets:
break
if len(filtered_pairlist) > 0:
return filtered_pairlist
# If no pairs are found, return the original pairlist
return filtered_pairlist
return []

View File

@@ -10,6 +10,7 @@ import logging
from datetime import timedelta
from typing import TypedDict
from cachetools import TTLCache
from pandas import DataFrame
from freqtrade.constants import ListPairsWithTimeframes, PairWithTimeframe
@@ -17,7 +18,7 @@ from freqtrade.exceptions import OperationalException
from freqtrade.exchange import timeframe_to_minutes, timeframe_to_prev_date
from freqtrade.exchange.exchange_types import Ticker, Tickers
from freqtrade.plugins.pairlist.IPairList import IPairList, PairlistParameter, SupportsBacktesting
from freqtrade.util import FtTTLCache, dt_now, format_ms_time
from freqtrade.util import dt_now, format_ms_time
logger = logging.getLogger(__name__)
@@ -46,7 +47,7 @@ class PercentChangePairList(IPairList):
self._min_value = self._pairlistconfig.get("min_value", None)
self._max_value = self._pairlistconfig.get("max_value", None)
self._refresh_period = self._pairlistconfig.get("refresh_period", 1800)
self._pair_cache: FtTTLCache = FtTTLCache(maxsize=1, ttl=self._refresh_period)
self._pair_cache: TTLCache = TTLCache(maxsize=1, ttl=self._refresh_period)
self._lookback_days = self._pairlistconfig.get("lookback_days", 0)
self._lookback_timeframe = self._pairlistconfig.get("lookback_timeframe", "1d")
self._lookback_period = self._pairlistconfig.get("lookback_period", 0)

View File

@@ -10,6 +10,7 @@ from typing import Any
import rapidjson
import requests
from cachetools import TTLCache
from freqtrade import __version__
from freqtrade.configuration.load_config import CONFIG_PARSE_MODE
@@ -17,7 +18,6 @@ from freqtrade.exceptions import OperationalException
from freqtrade.exchange.exchange_types import Tickers
from freqtrade.plugins.pairlist.IPairList import IPairList, PairlistParameter, SupportsBacktesting
from freqtrade.plugins.pairlist.pairlist_helpers import expand_pairlist
from freqtrade.util import FtTTLCache
logger = logging.getLogger(__name__)
@@ -48,7 +48,7 @@ class RemotePairList(IPairList):
self._number_pairs = self._pairlistconfig["number_assets"]
self._refresh_period: int = self._pairlistconfig.get("refresh_period", 1800)
self._keep_pairlist_on_failure = self._pairlistconfig.get("keep_pairlist_on_failure", True)
self._pair_cache: FtTTLCache = FtTTLCache(maxsize=1, ttl=self._refresh_period)
self._pair_cache: TTLCache = TTLCache(maxsize=1, ttl=self._refresh_period)
self._pairlist_url = self._pairlistconfig.get("pairlist_url", "")
self._read_timeout = self._pairlistconfig.get("read_timeout", 60)
self._bearer_token = self._pairlistconfig.get("bearer_token", "")
@@ -159,7 +159,7 @@ class RemotePairList(IPairList):
)
self._refresh_period = remote_refresh_period
self._pair_cache = FtTTLCache(maxsize=1, ttl=remote_refresh_period)
self._pair_cache = TTLCache(maxsize=1, ttl=remote_refresh_period)
self._init_done = True

View File

@@ -7,6 +7,7 @@ import sys
from datetime import timedelta
import numpy as np
from cachetools import TTLCache
from pandas import DataFrame
from freqtrade.constants import ListPairsWithTimeframes
@@ -14,7 +15,7 @@ from freqtrade.exceptions import OperationalException
from freqtrade.exchange.exchange_types import Tickers
from freqtrade.misc import plural
from freqtrade.plugins.pairlist.IPairList import IPairList, PairlistParameter, SupportsBacktesting
from freqtrade.util import FtTTLCache, dt_floor_day, dt_now, dt_ts
from freqtrade.util import dt_floor_day, dt_now, dt_ts
logger = logging.getLogger(__name__)
@@ -37,7 +38,7 @@ class VolatilityFilter(IPairList):
self._def_candletype = self._config["candle_type_def"]
self._sort_direction: str | None = self._pairlistconfig.get("sort_direction", None)
self._pair_cache: FtTTLCache = FtTTLCache(maxsize=1000, ttl=self._refresh_period)
self._pair_cache: TTLCache = TTLCache(maxsize=1000, ttl=self._refresh_period)
candle_limit = self._exchange.ohlcv_candle_limit("1d", self._def_candletype)
if self._days < 1:

View File

@@ -8,12 +8,14 @@ import logging
from datetime import timedelta
from typing import Any, Literal
from cachetools import TTLCache
from freqtrade.constants import ListPairsWithTimeframes
from freqtrade.exceptions import OperationalException
from freqtrade.exchange import timeframe_to_minutes, timeframe_to_prev_date
from freqtrade.exchange.exchange_types import Tickers
from freqtrade.plugins.pairlist.IPairList import IPairList, PairlistParameter, SupportsBacktesting
from freqtrade.util import FtTTLCache, dt_now, format_ms_time
from freqtrade.util import dt_now, format_ms_time
logger = logging.getLogger(__name__)
@@ -41,7 +43,7 @@ class VolumePairList(IPairList):
self._min_value = self._pairlistconfig.get("min_value", 0)
self._max_value = self._pairlistconfig.get("max_value", None)
self._refresh_period = self._pairlistconfig.get("refresh_period", 1800)
self._pair_cache: FtTTLCache = FtTTLCache(maxsize=1, ttl=self._refresh_period)
self._pair_cache: TTLCache = TTLCache(maxsize=1, ttl=self._refresh_period)
self._lookback_days = self._pairlistconfig.get("lookback_days", 0)
self._lookback_timeframe = self._pairlistconfig.get("lookback_timeframe", "1d")
self._lookback_period = self._pairlistconfig.get("lookback_period", 0)

View File

@@ -5,6 +5,7 @@ Rate of change pairlist filter
import logging
from datetime import timedelta
from cachetools import TTLCache
from pandas import DataFrame
from freqtrade.constants import ListPairsWithTimeframes
@@ -12,7 +13,7 @@ from freqtrade.exceptions import OperationalException
from freqtrade.exchange.exchange_types import Tickers
from freqtrade.misc import plural
from freqtrade.plugins.pairlist.IPairList import IPairList, PairlistParameter, SupportsBacktesting
from freqtrade.util import FtTTLCache, dt_floor_day, dt_now, dt_ts
from freqtrade.util import dt_floor_day, dt_now, dt_ts
logger = logging.getLogger(__name__)
@@ -31,7 +32,7 @@ class RangeStabilityFilter(IPairList):
self._def_candletype = self._config["candle_type_def"]
self._sort_direction: str | None = self._pairlistconfig.get("sort_direction", None)
self._pair_cache: FtTTLCache = FtTTLCache(maxsize=1000, ttl=self._refresh_period)
self._pair_cache: TTLCache = TTLCache(maxsize=1000, ttl=self._refresh_period)
candle_limit = self._exchange.ohlcv_candle_limit("1d", self._def_candletype)
if self._days < 1:

View File

@@ -5,7 +5,7 @@ PairList manager class
import logging
from functools import partial
from cachetools import LRUCache, cached
from cachetools import LRUCache, TTLCache, cached
from freqtrade.constants import Config, ListPairsWithTimeframes
from freqtrade.data.dataprovider import DataProvider
@@ -17,7 +17,6 @@ from freqtrade.mixins import LoggingMixin
from freqtrade.plugins.pairlist.IPairList import IPairList, SupportsBacktesting
from freqtrade.plugins.pairlist.pairlist_helpers import expand_pairlist
from freqtrade.resolvers import PairListResolver
from freqtrade.util import FtTTLCache
logger = logging.getLogger(__name__)
@@ -130,24 +129,12 @@ class PairListManager(LoggingMixin):
"""List of short_desc for each Pairlist Handler"""
return [{p.name: p.short_desc()} for p in self._pairlist_handlers]
@cached(FtTTLCache(maxsize=1, ttl=1800))
@cached(TTLCache(maxsize=1, ttl=1800))
def _get_cached_tickers(self) -> Tickers:
return self._exchange.get_tickers()
def refresh_pairlist(self, only_first: bool = False, pairs: list[str] | None = None) -> None:
"""
Run pairlist through all configured Pairlist Handlers.
:param only_first: If True, only run the first PairList handler (the generator)
and skip all subsequent filters. Used during backtesting startup to ensure
historic data is loaded for the complete universe of pairs that the
generator can produce (even if later filters would reduce the list size).
Prevents missing data when a filter returns a variable number of pairs
across refresh cycles.
:param pairs: Optional list of pairs to intersect with the generated pairlist.
Only pairs present both in the generated list and this parameter are kept.
Used in backtesting to filter out pairs with no available data.
"""
def refresh_pairlist(self) -> None:
"""Run pairlist through all configured Pairlist Handlers."""
# Tickers should be cached to avoid calling the exchange on each call.
tickers: dict = {}
if self._tickers_needed:
@@ -156,15 +143,10 @@ class PairListManager(LoggingMixin):
# Generate the pairlist with first Pairlist Handler in the chain
pairlist = self._pairlist_handlers[0].gen_pairlist(tickers)
# Optional intersection with an explicit list of pairs (used in backtesting)
if pairs is not None:
pairlist = [p for p in pairlist if p in pairs]
if not only_first:
# Process all Pairlist Handlers in the chain
# except for the first one, which is the generator.
for pairlist_handler in self._pairlist_handlers[1:]:
pairlist = pairlist_handler.filter_pairlist(pairlist, tickers)
# Process all Pairlist Handlers in the chain
# except for the first one, which is the generator.
for pairlist_handler in self._pairlist_handlers[1:]:
pairlist = pairlist_handler.filter_pairlist(pairlist, tickers)
# Validation against blacklist happens after the chain of Pairlist Handlers
# to ensure blacklist is respected.

View File

@@ -148,9 +148,6 @@ class IResolver:
logger.debug("Ignoring broken symlink %s", entry)
continue
module_path = entry.resolve()
if entry.read_text().find(f"class {object_name}(") == -1:
logger.debug(f"Skipping {module_path} as it does not contain class {object_name}.")
continue
if obj := next(cls._get_valid_object(module_path, object_name), None):
obj[0].__file__ = str(entry)

View File

@@ -340,8 +340,6 @@ class TradeSchema(BaseModel):
min_rate: float | None = None
max_rate: float | None = None
nr_of_successful_entries: int
nr_of_successful_exits: int
has_open_orders: bool
orders: list[OrderSchema]

View File

@@ -37,7 +37,7 @@ class ApiBG:
# Generic background jobs
# TODO: Change this to FtTTLCache
# TODO: Change this to TTLCache
jobs: dict[str, JobsContainer] = {}
# Pairlist evaluate things
pairlist_running: bool = False

View File

@@ -7,11 +7,11 @@ import logging
from datetime import datetime
from typing import Any
from cachetools import TTLCache
from requests.exceptions import RequestException
from freqtrade.constants import SUPPORTED_FIAT, Config
from freqtrade.mixins.logging_mixin import LoggingMixin
from freqtrade.util import FtTTLCache
from freqtrade.util.coin_gecko import FtCoinGeckoApi
@@ -54,7 +54,7 @@ class CryptoToFiatConverter(LoggingMixin):
def __init__(self, config: Config) -> None:
# Timeout: 6h
self._pair_price: FtTTLCache = FtTTLCache(maxsize=500, ttl=6 * 60 * 60)
self._pair_price: TTLCache = TTLCache(maxsize=500, ttl=6 * 60 * 60)
_coingecko_config = config.get("coingecko", {})
self._coingecko = FtCoinGeckoApi(

View File

@@ -47,7 +47,6 @@ from freqtrade.util import (
dt_ts,
dt_ts_def,
format_date,
format_pct,
shorten_date,
)
from freqtrade.wallets import PositionWallet, Wallet
@@ -303,7 +302,7 @@ class RPC:
fiat_total_profit_sum = nan
for trade in self._rpc_trade_status():
# Format profit as a string with the right sign
profit = f"{format_pct(trade['profit_ratio'])}"
profit = f"{trade['profit_ratio']:.2%}"
fiat_profit = trade.get("profit_fiat", None)
if fiat_profit is None or isnan(fiat_profit):
fiat_profit = trade.get("profit_abs", 0.0)

View File

@@ -48,7 +48,6 @@ from freqtrade.util import (
fmt_coin,
fmt_coin2,
format_date,
format_pct,
round_value,
)
@@ -482,7 +481,7 @@ class Telegram(RPCHandler):
if is_final_exit:
profit_prefix = "Sub "
cp_extra = (
f"*Final Profit:* `{format_pct(msg['final_profit_ratio'])} "
f"*Final Profit:* `{msg['final_profit_ratio']:.2%} "
f"({msg['cumulative_profit']:.8f} {msg['quote_currency']}{cp_fiat})`\n"
)
else:
@@ -498,7 +497,7 @@ class Telegram(RPCHandler):
f"{exit_wording} {msg['pair']} (#{msg['trade_id']})\n"
f"{self._add_analyzed_candle(msg['pair'])}"
f"*{f'{profit_prefix}Profit' if is_fill else f'Unrealized {profit_prefix}Profit'}:* "
f"`{format_pct(msg['profit_ratio'])}{profit_extra}`\n"
f"`{msg['profit_ratio']:.2%}{profit_extra}`\n"
f"{cp_extra}"
f"{enter_tag}"
f"*Exit Reason:* `{msg['exit_reason']}`\n"
@@ -671,14 +670,14 @@ class Telegram(RPCHandler):
# TODO: This calculation ignores fees.
price_to_1st_entry = (cur_entry_average - first_avg) / first_avg
if is_open:
lines.append(f"({dt_humanize_delta(order['order_filled_date'])})")
lines.append("({})".format(dt_humanize_delta(order["order_filled_date"])))
lines.append(
f"*Amount:* {round_value(cur_entry_amount, 8)} "
f"({fmt_coin(order['cost'], quote_currency)})"
)
lines.append(
f"*Average {wording} Price:* {round_value(cur_entry_average, 8)} "
f"({format_pct(price_to_1st_entry)} from 1st entry rate)"
f"({price_to_1st_entry:.2%} from 1st entry rate)"
)
lines.append(f"*Order Filled:* {order['order_filled_date']}")
@@ -702,7 +701,7 @@ class Telegram(RPCHandler):
results = self._rpc._rpc_trade_status(trade_ids=trade_ids)
for r in results:
lines = [f"*Order List for Trade #*`{r['trade_id']}`"]
lines = ["*Order List for Trade #*`{trade_id}`"]
lines_detail = self._prepare_order_details(
r["orders"], r["quote_currency"], r["is_open"]
@@ -721,10 +720,10 @@ class Telegram(RPCHandler):
if (len(msg) + len(line) + 1) < MAX_MESSAGE_LENGTH:
msg += line + "\n"
else:
await self._send_msg(msg)
msg = f"*Order List for Trade #*`{r['trade_id']}` - continued\n" + line + "\n"
await self._send_msg(msg.format(**r))
msg = "*Order List for Trade #*`{trade_id}` - continued\n" + line + "\n"
await self._send_msg(msg)
await self._send_msg(msg.format(**r))
@authorized_only
async def _status(self, update: Update, context: CallbackContext) -> None:
@@ -758,7 +757,15 @@ class Telegram(RPCHandler):
max_entries = self._config.get("max_entry_position_adjustment", -1)
for r in results:
r["open_date_hum"] = dt_humanize_delta(r["open_date"])
r["num_entries"] = len([o for o in r["orders"] if o["ft_is_entry"]])
r["num_exits"] = len(
[
o
for o in r["orders"]
if not o["ft_is_entry"] and not o["ft_order_side"] == "stoploss"
]
)
r["exit_reason"] = r.get("exit_reason", "")
r["stake_amount_r"] = fmt_coin(r["stake_amount"], r["quote_currency"])
r["max_stake_amount_r"] = fmt_coin(
r["max_stake_amount"] or r["stake_amount"], r["quote_currency"]
@@ -767,25 +774,26 @@ class Telegram(RPCHandler):
r["realized_profit_r"] = fmt_coin(r["realized_profit"], r["quote_currency"])
r["total_profit_abs_r"] = fmt_coin(r["total_profit_abs"], r["quote_currency"])
lines = [
f"*Trade ID:* `{r['trade_id']}`"
+ (f" `(since {r['open_date_hum']})`" if r["is_open"] else ""),
f"*Current Pair:* {r['pair']}",
"*Trade ID:* `{trade_id}`" + (" `(since {open_date_hum})`" if r["is_open"] else ""),
"*Current Pair:* {pair}",
(
f"*Direction:* {'`Short`' if r.get('is_short') else '`Long`'}"
+ (f" ` ({r['leverage']}x)`" if r.get("leverage") else "")
+ " ` ({leverage}x)`"
if r.get("leverage")
else ""
),
f"*Amount:* `{r['amount']} ({r['stake_amount_r']})`",
f"*Total invested:* `{r['max_stake_amount_r']}`" if position_adjust else "",
f"*Enter Tag:* `{r['enter_tag']}`" if r["enter_tag"] else "",
f"*Exit Reason:* `{r['exit_reason']}`" if r.get("exit_reason") else "",
"*Amount:* `{amount} ({stake_amount_r})`",
"*Total invested:* `{max_stake_amount_r}`" if position_adjust else "",
"*Enter Tag:* `{enter_tag}`" if r["enter_tag"] else "",
"*Exit Reason:* `{exit_reason}`" if r["exit_reason"] else "",
]
if position_adjust:
max_buy_str = f"/{max_entries + 1}" if (max_entries > 0) else ""
lines.extend(
[
f"*Number of Entries:* `{r['nr_of_successful_entries']}{max_buy_str}`",
f"*Number of Exits:* `{r['nr_of_successful_exits']}`",
"*Number of Entries:* `{num_entries}" + max_buy_str + "`",
"*Number of Exits:* `{num_exits}`",
]
)
@@ -793,62 +801,53 @@ class Telegram(RPCHandler):
[
f"*Open Rate:* `{round_value(r['open_rate'], 8)}`",
f"*Close Rate:* `{round_value(r['close_rate'], 8)}`" if r["close_rate"] else "",
f"*Open Date:* `{r['open_date']}`",
f"*Close Date:* `{r['close_date']}`" if r["close_date"] else "",
"*Open Date:* `{open_date}`",
"*Close Date:* `{close_date}`" if r["close_date"] else "",
(
f" \n*Current Rate:* `{round_value(r['current_rate'], 8)}`"
if r["is_open"]
else ""
),
("*Unrealized Profit:* " if r["is_open"] else "*Close Profit: *")
+ f"`{format_pct(r['profit_ratio'])}` `({r['profit_abs_r']})`",
+ "`{profit_ratio:.2%}` `({profit_abs_r})`",
]
)
if r["is_open"]:
if (
r.get("realized_profit") is not None
and r.get("realized_profit_ratio") is not None
):
lines.append(
f"*Realized Profit:* `{format_pct(r['realized_profit_ratio'])} "
f"({r['realized_profit_r']})`"
)
if r.get("total_profit_ratio") is not None:
lines.append(
f"*Total Profit:* `{format_pct(r['total_profit_ratio'])} "
f"({r['total_profit_abs_r']})`"
if r.get("realized_profit"):
lines.extend(
[
"*Realized Profit:* `{realized_profit_ratio:.2%} "
"({realized_profit_r})`",
"*Total Profit:* `{total_profit_ratio:.2%} ({total_profit_abs_r})`",
]
)
# Append empty line to improve readability
lines.append(" ")
# Adding liquidation only if it is not None
if liquidation := r.get("liquidation_price"):
lines.append(f"*Liquidation:* `{round_value(liquidation, 8)}`")
if (
r["stop_loss_abs"] != r["initial_stop_loss_abs"]
and r["initial_stop_loss_ratio"] is not None
):
# Adding initial stoploss only if it is different from stoploss
lines.append(
f"*Initial Stoploss:* `{r['initial_stop_loss_abs']:.8f}` "
f"`({format_pct(r['initial_stop_loss_ratio'])})`"
"*Initial Stoploss:* `{initial_stop_loss_abs:.8f}` "
"`({initial_stop_loss_ratio:.2%})`"
)
# Adding stoploss and stoploss percentage only if it is not None
lines.append(
f"*Stoploss:* `{round_value(r['stop_loss_abs'], 8)}` "
+ (f"`({format_pct(r['stop_loss_ratio'])})`" if r["stop_loss_ratio"] else "")
+ ("`({stop_loss_ratio:.2%})`" if r["stop_loss_ratio"] else "")
)
lines.append(
f"*Stoploss distance:* `{round_value(r['stoploss_current_dist'], 8)}` "
f"`({format_pct(r['stoploss_current_dist_ratio'])})`"
"`({stoploss_current_dist_ratio:.2%})`"
)
if open_orders := r.get("open_orders"):
if r.get("open_orders"):
lines.append(
f"*Open Order:* `{open_orders}`"
+ (f"- `{r['exit_order_status']}`" if r["exit_order_status"] else "")
"*Open Order:* `{open_orders}`"
+ ("- `{exit_order_status}`" if r["exit_order_status"] else "")
)
await self.__send_status_msg(lines, r)
@@ -864,10 +863,10 @@ class Telegram(RPCHandler):
if (len(msg) + len(line) + 1) < MAX_MESSAGE_LENGTH:
msg += line + "\n"
else:
await self._send_msg(msg)
msg = f"*Trade ID:* `{r['trade_id']}` - continued\n" + line + "\n"
await self._send_msg(msg.format(**r))
msg = "*Trade ID:* `{trade_id}` - continued\n" + line + "\n"
await self._send_msg(msg)
await self._send_msg(msg.format(**r))
@authorized_only
async def _status_table(self, update: Update, context: CallbackContext) -> None:
@@ -954,7 +953,7 @@ class Telegram(RPCHandler):
f"{period['date']:{val.dateformat}} ({period['trade_count']})",
f"{fmt_coin(period['abs_profit'], stats['stake_currency'])}",
f"{period['fiat_value']:.2f} {stats['fiat_display_currency']}",
f"{format_pct(period['rel_profit'])}",
f"{period['rel_profit']:.2%}",
]
for period in stats["data"]
],
@@ -1070,7 +1069,7 @@ class Telegram(RPCHandler):
markdown_msg = (
f"{closed_roi_label}\n"
f"∙ `{fmt_coin(profit_closed_coin, stake_cur)} "
f"({format_pct(profit_closed_ratio_mean)}) "
f"({profit_closed_ratio_mean:.2%}) "
f"({profit_closed_percent} \N{GREEK CAPITAL LETTER SIGMA}%)`\n"
f"{fiat_closed_trades}"
)
@@ -1083,7 +1082,7 @@ class Telegram(RPCHandler):
markdown_msg += (
f"{all_roi_label}\n"
f"∙ `{fmt_coin(profit_all_coin, stake_cur)} "
f"({format_pct(profit_all_ratio_mean)}) "
f"({profit_all_ratio_mean:.2%}) "
f"({profit_all_percent} \N{GREEK CAPITAL LETTER SIGMA}%)`\n"
f"{fiat_all_trades}"
f"*Total Trade Count:* `{trade_count}`\n"
@@ -1092,7 +1091,7 @@ class Telegram(RPCHandler):
f"`{first_trade_date}`\n"
f"*Latest Trade opened:* `{latest_trade_date}`\n"
f"*Win / Loss:* `{stats['winning_trades']} / {stats['losing_trades']}`\n"
f"*Winrate:* `{format_pct(winrate)}`\n"
f"*Winrate:* `{winrate:.2%}`\n"
f"*Expectancy (Ratio):* `{expectancy:.2f} ({expectancy_ratio:.2f})`"
)
@@ -1100,16 +1099,16 @@ class Telegram(RPCHandler):
markdown_msg += (
f"\n*Avg. Duration:* `{avg_duration}`\n"
f"*Best Performing:* `{best_pair}: {best_pair_profit_abs} "
f"({format_pct(best_pair_profit_ratio)})`\n"
f"({best_pair_profit_ratio:.2%})`\n"
f"*Trading volume:* `{fmt_coin(stats['trading_volume'], stake_cur)}`\n"
f"*Profit factor:* `{stats['profit_factor']:.2f}`\n"
f"*Max Drawdown:* `{format_pct(stats['max_drawdown'])} "
f"*Max Drawdown:* `{stats['max_drawdown']:.2%} "
f"({fmt_coin(stats['max_drawdown_abs'], stake_cur)})`\n"
f" from `{stats['max_drawdown_start']} "
f"({fmt_coin(stats['drawdown_high'], stake_cur)})`\n"
f" to `{stats['max_drawdown_end']} "
f"({fmt_coin(stats['drawdown_low'], stake_cur)})`\n"
f"*Current Drawdown:* `{format_pct(stats['current_drawdown'])} "
f"*Current Drawdown:* `{stats['current_drawdown']:.2%} "
f"({fmt_coin(stats['current_drawdown_abs'], stake_cur)})`\n"
f" from `{stats['current_drawdown_start']} "
f"({fmt_coin(stats['current_drawdown_high'], stake_cur)})`\n"
@@ -1562,7 +1561,7 @@ class Telegram(RPCHandler):
dt_humanize_delta(dt_from_ts(trade["close_timestamp"])),
f"{trade['pair']} (#{trade['trade_id']}"
f"{(' ' + ('S' if trade['is_short'] else 'L')) if nonspot else ''})",
f"{format_pct(trade['close_profit'])} ({trade['close_profit_abs']})",
f"{(trade['close_profit']):.2%} ({trade['close_profit_abs']})",
]
for trade in trades["trades"]
],
@@ -1626,7 +1625,7 @@ class Telegram(RPCHandler):
stat_line = (
f"{i + 1}.\t <code>{trade['pair']}\t"
f"{fmt_coin(trade['profit_abs'], self._config['stake_currency'])} "
f"({format_pct(trade['profit_ratio'])}) "
f"({trade['profit_ratio']:.2%}) "
f"({trade['count']})</code>\n"
)
@@ -1663,7 +1662,7 @@ class Telegram(RPCHandler):
stat_line = (
f"{i + 1}.\t `{trade['enter_tag']}\t"
f"{fmt_coin(trade['profit_abs'], self._config['stake_currency'])} "
f"({format_pct(trade['profit_ratio'])}) "
f"({trade['profit_ratio']:.2%}) "
f"({trade['count']})`\n"
)
@@ -1700,7 +1699,7 @@ class Telegram(RPCHandler):
stat_line = (
f"{i + 1}.\t `{trade['exit_reason']}\t"
f"{fmt_coin(trade['profit_abs'], self._config['stake_currency'])} "
f"({format_pct(trade['profit_ratio'])}) "
f"({trade['profit_ratio']:.2%}) "
f"({trade['count']})`\n"
)
@@ -1737,7 +1736,7 @@ class Telegram(RPCHandler):
stat_line = (
f"{i + 1}.\t `{trade['mix_tag']}\t"
f"{fmt_coin(trade['profit_abs'], self._config['stake_currency'])} "
f"({format_pct(trade['profit_ratio'])}) "
f"({trade['profit_ratio']:.2%}) "
f"({trade['count']})`\n"
)

View File

@@ -4,9 +4,9 @@ This module defines a base class for auto-hyperoptable strategies.
"""
import logging
from collections import defaultdict
from collections.abc import Iterator
from pathlib import Path
from typing import Any
from freqtrade.constants import Config
from freqtrade.exceptions import OperationalException
@@ -18,11 +18,6 @@ from freqtrade.strategy.parameters import BaseParameter
logger = logging.getLogger(__name__)
# Type aliases
SpaceParams = dict[str, BaseParameter]
AllSpaceParams = dict[str, SpaceParams]
class HyperStrategyMixin:
"""
A helper base class which allows HyperOptAuto class to reuse implementations of buy/sell
@@ -34,22 +29,47 @@ class HyperStrategyMixin:
Initialize hyperoptable strategy mixin.
"""
self.config = config
self._ft_hyper_params: AllSpaceParams = {}
self.ft_buy_params: list[BaseParameter] = []
self.ft_sell_params: list[BaseParameter] = []
self.ft_protection_params: list[BaseParameter] = []
params = self.load_params_from_file()
params = params.get("params", {})
self._ft_params_from_file = params
# Init/loading of parameters is done as part of ft_bot_start().
def enumerate_parameters(self, space: str | None = None) -> Iterator[tuple[str, BaseParameter]]:
def enumerate_parameters(
self, category: str | None = None
) -> Iterator[tuple[str, BaseParameter]]:
"""
Find all optimizable parameters and return (name, attr) iterator.
:param space: parameter space to filter for, or None for all spaces.
:param category:
:return:
"""
for space in [c for c in self._ft_hyper_params if space is None or c == space]:
for par in self._ft_hyper_params[space].values():
yield par.name, par
if category not in ("buy", "sell", "protection", None):
raise OperationalException(
'Category must be one of: "buy", "sell", "protection", None.'
)
if category is None:
params = self.ft_buy_params + self.ft_sell_params + self.ft_protection_params
else:
params = getattr(self, f"ft_{category}_params")
for par in params:
yield par.name, par
@classmethod
def detect_all_parameters(cls) -> dict:
"""Detect all parameters and return them as a list"""
params: dict[str, Any] = {
"buy": list(detect_parameters(cls, "buy")),
"sell": list(detect_parameters(cls, "sell")),
"protection": list(detect_parameters(cls, "protection")),
}
params.update({"count": len(params["buy"] + params["sell"] + params["protection"])})
return params
def ft_load_params_from_file(self) -> None:
"""
@@ -90,13 +110,20 @@ class HyperStrategyMixin:
* Parameters defined in parameters objects (buy_params, sell_params, ...)
* Parameter defaults
"""
self._ft_hyper_params = detect_all_parameters(self)
for space in self._ft_hyper_params.keys():
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)
buy_params = deep_merge_dicts(
self._ft_params_from_file.get("buy", {}), getattr(self, "buy_params", {})
)
sell_params = deep_merge_dicts(
self._ft_params_from_file.get("sell", {}), getattr(self, "sell_params", {})
)
protection_params = deep_merge_dicts(
self._ft_params_from_file.get("protection", {}), getattr(self, "protection_params", {})
)
self._ft_load_params(buy_params, "buy", hyperopt)
self._ft_load_params(sell_params, "sell", hyperopt)
self._ft_load_params(protection_params, "protection", hyperopt)
def load_params_from_file(self) -> dict:
filename_str = getattr(self, "__file__", "")
@@ -118,73 +145,72 @@ class HyperStrategyMixin:
return {}
def _ft_load_params(
self, params: SpaceParams, param_values: dict, space: str, hyperopt: bool = False
) -> None:
def _ft_load_params(self, params: dict, space: str, hyperopt: bool = False) -> None:
"""
Set optimizable parameter values.
:param params: Dictionary with new parameter values.
"""
if not param_values:
if not params:
logger.info(f"No params for {space} found, using default values.")
param_container: list[BaseParameter] = getattr(self, f"ft_{space}_params")
for param_name, param in params.items():
param.in_space = hyperopt and HyperoptTools.has_space(self.config, space)
if not param.space:
param.space = space
for attr_name, attr in detect_parameters(self, space):
attr.name = attr_name
attr.in_space = hyperopt and HyperoptTools.has_space(self.config, space)
if not attr.category:
attr.category = space
if param_values and param_name in param_values:
if param.load:
param.value = param_values[param_name]
logger.info(f"Strategy Parameter: {param_name} = {param.value}")
param_container.append(attr)
if params and attr_name in params:
if attr.load:
attr.value = params[attr_name]
logger.info(f"Strategy Parameter: {attr_name} = {attr.value}")
else:
logger.warning(
f'Parameter "{param_name}" exists, but is disabled. '
f'Default value "{param.value}" used.'
f'Parameter "{attr_name}" exists, but is disabled. '
f'Default value "{attr.value}" used.'
)
else:
logger.info(f"Strategy Parameter(default): {param_name} = {param.value}")
logger.info(f"Strategy Parameter(default): {attr_name} = {attr.value}")
def get_no_optimize_params(self) -> dict[str, dict]:
"""
Returns list of Parameters that are not part of the current optimize job
"""
params: dict[str, dict] = defaultdict(dict)
params: dict[str, dict] = {
"buy": {},
"sell": {},
"protection": {},
}
for name, p in self.enumerate_parameters():
if p.space and (not p.optimize or not p.in_space):
params[p.space][name] = p.value
if p.category and (not p.optimize or not p.in_space):
params[p.category][name] = p.value
return params
def detect_all_parameters(
obj: HyperStrategyMixin | type[HyperStrategyMixin],
) -> AllSpaceParams:
def detect_parameters(
obj: HyperStrategyMixin | type[HyperStrategyMixin], category: str
) -> Iterator[tuple[str, BaseParameter]]:
"""
Detect all hyperoptable parameters for this object.
Detect all parameters for 'category' for "obj"
:param obj: Strategy object or class
:return: Dictionary of detected parameters by space
:param category: category - usually `'buy', 'sell', 'protection',...
"""
auto_categories = ["buy", "sell", "enter", "exit", "protection"]
result: AllSpaceParams = defaultdict(dict)
for attr_name in dir(obj):
if attr_name.startswith("__"): # Ignore internals
continue
attr = getattr(obj, attr_name)
if not issubclass(attr.__class__, BaseParameter):
continue
if not attr.space:
# space auto detection
for space in auto_categories:
if attr_name.startswith(space + "_"):
attr.space = space
break
if attr.space is None:
raise OperationalException(f"Cannot determine parameter space for {attr_name}.")
if not attr_name.startswith("__"): # Ignore internals, not strictly necessary.
attr = getattr(obj, attr_name)
if issubclass(attr.__class__, BaseParameter):
if (
attr_name.startswith(category + "_")
and attr.category is not None
and attr.category != category
):
raise OperationalException(
f"Inconclusive parameter name {attr_name}, category: {attr.category}."
)
if attr.space in ("all", "default") or attr.space.isidentifier() is False:
raise OperationalException(
f"'{attr.space}' is not a valid space. Parameter: {attr_name}."
)
attr.name = attr_name
result[attr.space][attr_name] = attr
return result
if category == attr.category or (
attr_name.startswith(category + "_") and attr.category is None
):
yield attr_name, attr

View File

@@ -32,7 +32,7 @@ class BaseParameter(ABC):
Defines a parameter that can be optimized by hyperopt.
"""
space: str | None
category: str | None
default: Any
value: Any
in_space: bool = False
@@ -49,9 +49,9 @@ class BaseParameter(ABC):
):
"""
Initialize hyperopt-optimizable parameter.
:param space: The parameter space. Can be 'buy', 'sell', or a string that's also a
valid python identifier.
This parameter is optional if parameter name is prefixed with 'buy_' or 'sell_'.
:param space: A parameter category. Can be 'buy' or 'sell'. This parameter is optional if
parameter field
name is prefixed with 'buy_' or 'sell_'.
:param optimize: Include parameter in hyperopt optimizations.
:param load: Load parameter value from {space}_params.
:param kwargs: Extra parameters to optuna.distributions.
@@ -61,7 +61,7 @@ class BaseParameter(ABC):
raise OperationalException(
"Name is determined by parameter field name and can not be specified manually."
)
self.space = space
self.category = space
self._space_params = kwargs
self.value = default
self.optimize = optimize
@@ -109,9 +109,8 @@ class NumericParameter(BaseParameter):
:param high: Upper end (inclusive) of optimization space.
Must be none of entire range is passed first parameter.
:param default: A default value.
:param space: The parameter space. Can be 'buy', 'sell', or a string that's also a
valid python identifier.
This parameter is optional if parameter name is prefixed with 'buy_' or 'sell_'.
:param space: A parameter category. Can be 'buy' or 'sell'. This parameter is optional if
parameter fieldname is prefixed with 'buy_' or 'sell_'.
:param optimize: Include parameter in hyperopt optimizations.
:param load: Load parameter value from {space}_params.
:param kwargs: Extra parameters to optuna.distributions.*.
@@ -152,9 +151,8 @@ class IntParameter(NumericParameter):
:param high: Upper end (inclusive) of optimization space.
Must be none of entire range is passed first parameter.
:param default: A default value.
:param space: The parameter space. Can be 'buy', 'sell', or a string that's also a
valid python identifier.
This parameter is optional if parameter name is prefixed with 'buy_' or 'sell_'.
:param space: A parameter category. Can be 'buy' or 'sell'. This parameter is optional if
parameter fieldname is prefixed with 'buy_' or 'sell_'.
:param optimize: Include parameter in hyperopt optimizations.
:param load: Load parameter value from {space}_params.
:param kwargs: Extra parameters to optuna.distributions.IntDistribution.
@@ -207,9 +205,8 @@ class RealParameter(NumericParameter):
:param high: Upper end (inclusive) of optimization space.
Must be none if entire range is passed first parameter.
:param default: A default value.
:param space: The parameter space. Can be 'buy', 'sell', or a string that's also a
valid python identifier.
This parameter is optional if parameter name is prefixed with 'buy_' or 'sell_'.
:param space: A parameter category. Can be 'buy' or 'sell'. This parameter is optional if
parameter fieldname is prefixed with 'buy_' or 'sell_'.
:param optimize: Include parameter in hyperopt optimizations.
:param load: Load parameter value from {space}_params.
:param kwargs: Extra parameters to optuna.distributions.FloatDistribution.
@@ -248,9 +245,8 @@ class DecimalParameter(NumericParameter):
Must be none if entire range is passed first parameter.
:param default: A default value.
:param decimals: A number of decimals after floating point to be included in testing.
:param space: The parameter space. Can be 'buy', 'sell', or a string that's also a
valid python identifier.
This parameter is optional if parameter name is prefixed with 'buy_' or 'sell_'.
:param space: A parameter category. Can be 'buy' or 'sell'. This parameter is optional if
parameter fieldname is prefixed with 'buy_' or 'sell_'.
:param optimize: Include parameter in hyperopt optimizations.
:param load: Load parameter value from {space}_params.
:param kwargs: Extra parameters to optuna's NumericParameter.
@@ -314,10 +310,10 @@ class CategoricalParameter(BaseParameter):
Initialize hyperopt-optimizable parameter.
:param categories: Optimization space, [a, b, ...].
:param default: A default value. If not specified, first item from specified space will be
used.
:param space: The parameter space. Can be 'buy', 'sell', or a string that's also a
valid python identifier.
This parameter is optional if parameter name is prefixed with 'buy_' or 'sell_'.
used.
:param space: A parameter category. Can be 'buy' or 'sell'. This parameter is optional if
parameter field
name is prefixed with 'buy_' or 'sell_'.
:param optimize: Include parameter in hyperopt optimizations.
:param load: Load parameter value from {space}_params.
:param kwargs: Compatibility. Optuna's CategoricalDistribution does not
@@ -365,10 +361,10 @@ class BooleanParameter(CategoricalParameter):
Initialize hyperopt-optimizable Boolean Parameter.
It's a shortcut to `CategoricalParameter([True, False])`.
:param default: A default value. If not specified, first item from specified space will be
used.
:param space: The parameter space. Can be 'buy', 'sell', or a string that's also a
valid python identifier.
This parameter is optional if parameter name is prefixed with 'buy_' or 'sell_'.
used.
:param space: A parameter category. Can be 'buy' or 'sell'. This parameter is optional if
parameter field
name is prefixed with 'buy_' or 'sell_'.
:param optimize: Include parameter in hyperopt optimizations.
:param load: Load parameter value from {space}_params.
:param kwargs: Extra parameters to optuna.distributions.CategoricalDistribution.

View File

@@ -34,7 +34,7 @@
"bids_to_ask_delta": 1
}
},
"exit_pricing": {
"exit_pricing":{
"price_side": "same",
"use_order_book": true,
"order_book_top": 1

View File

@@ -96,9 +96,7 @@ class SampleStrategy(IStrategy):
buy_rsi = IntParameter(low=1, high=50, default=30, space="buy", optimize=True, load=True)
sell_rsi = IntParameter(low=50, high=100, default=70, space="sell", optimize=True, load=True)
short_rsi = IntParameter(low=51, high=100, default=70, space="sell", optimize=True, load=True)
exit_short_rsi = IntParameter(
low=1, high=50, default=30, space="exit", optimize=True, load=True
)
exit_short_rsi = IntParameter(low=1, high=50, default=30, space="buy", optimize=True, load=True)
# Number of candles the strategy requires before producing valid signals
startup_candle_count: int = 200

View File

@@ -18,11 +18,9 @@ from freqtrade.util.formatters import (
fmt_coin,
fmt_coin2,
format_duration,
format_pct,
round_value,
)
from freqtrade.util.ft_precise import FtPrecise
from freqtrade.util.ft_ttlcache import FtTTLCache
from freqtrade.util.measure_time import MeasureTime
from freqtrade.util.periodic_cache import PeriodicCache
from freqtrade.util.progress_tracker import ( # noqa F401
@@ -46,7 +44,6 @@ __all__ = [
"format_date",
"format_ms_time",
"format_ms_time_det",
"format_pct",
"get_dry_run_wallet",
"FtPrecise",
"PeriodicCache",
@@ -60,5 +57,4 @@ __all__ = [
"print_rich_table",
"print_df_rich_table",
"CustomProgress",
"FtTTLCache",
]

View File

@@ -1,7 +1,5 @@
from datetime import timedelta
from numpy import isnan
from freqtrade.constants import DECIMAL_PER_COIN_FALLBACK, DECIMALS_PER_COIN
@@ -31,8 +29,6 @@ def round_value(value: float, decimals: int, keep_trailing_zeros=False) -> str:
:param keep_trailing_zeros: Keep trailing zeros "222.200" vs. "222.2"
:return: Rounded value as string
"""
if isnan(value):
return "N/A"
val = f"{value:.{decimals}f}"
if not keep_trailing_zeros:
val = strip_trailing_zeros(val)
@@ -84,15 +80,3 @@ def format_duration(td: timedelta) -> str:
h, r = divmod(td.seconds, 3600)
m, _ = divmod(r, 60)
return f"{d}d {h:02d}:{m:02d}"
def format_pct(value: float | None) -> str:
"""
Format a float value as percentage string with 2 decimals
None and NaN values are formatted as "N/A"
:param value: Float value to format
:return: Formatted percentage string
"""
if value is None or isnan(value):
return "N/A"
return f"{value:.2%}"

View File

@@ -1,12 +0,0 @@
import time
from cachetools import TTLCache
class FtTTLCache(TTLCache):
"""
A TTLCache with a different default timer to allow for easier mocking in tests.
"""
def __init__(self, maxsize, ttl, timer=time.time, getsizeof=None):
super().__init__(maxsize=maxsize, ttl=ttl, timer=timer, getsizeof=getsizeof)

View File

@@ -2,7 +2,7 @@ import logging
import time
from collections.abc import Callable
from freqtrade.util import FtTTLCache
from cachetools import TTLCache
logger = logging.getLogger(__name__)
@@ -27,7 +27,7 @@ class MeasureTime:
"""
self._callback = callback
self._time_limit = time_limit
self.__cache: FtTTLCache = FtTTLCache(maxsize=1, ttl=ttl)
self.__cache: TTLCache = TTLCache(maxsize=1, ttl=ttl)
def __enter__(self):
self._start = time.time()

View File

@@ -1,23 +1,12 @@
from freqtrade.exchange import Exchange
from freqtrade.util.migrations.binance_mig import (
migrate_binance_futures_data,
migrate_binance_futures_names,
)
from freqtrade.util.migrations.binance_mig import migrate_binance_futures_data
from freqtrade.util.migrations.funding_rate_mig import migrate_funding_fee_timeframe
def migrate_data(config, exchange: Exchange | None = None) -> None:
def migrate_data(config, exchange: Exchange | None = None):
"""
Migrate persisted data from old formats to new formats
"""
migrate_binance_futures_data(config)
migrate_funding_fee_timeframe(config, exchange)
def migrate_live_content(config, exchange: Exchange | None = None) -> None:
"""
Migrate database content from old formats to new formats
Used for dry/live mode.
"""
migrate_binance_futures_names(config)

View File

@@ -14,10 +14,6 @@ logger = logging.getLogger(__name__)
def migrate_binance_futures_names(config: Config):
"""
Migrate binance futures names in both database and data files.
This is needed because ccxt naming changed from "BTC/USDT" to "BTC/USDT:USDT"
"""
if not (
config.get("trading_mode", TradingMode.SPOT) == TradingMode.FUTURES
and config["exchange"]["name"] == "binance"

View File

@@ -1,7 +1,7 @@
from freqtrade_client.ft_rest_client import FtRestClient
__version__ = "2025.11-dev"
__version__ = "2025.10"
if "dev" in __version__:
from pathlib import Path

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