diff --git a/docs/hyperopt.md b/docs/hyperopt.md index 9542d5725..1ca371e3d 100644 --- a/docs/hyperopt.md +++ b/docs/hyperopt.md @@ -375,22 +375,27 @@ Buy hyperspace params: 'rsi-enabled': True, 'trigger': 'bb_lower'} ROI table: -{ 0: 0.10674752302642071, - 21: 0.09158372701087236, - 78: 0.03634636907306948, +{ 0: 0.10674, + 21: 0.09158, + 78: 0.03634, 118: 0} ``` -This would translate to the following ROI table: +In order to use this best ROI table found by Hyperopt in backtesting and for live trades/dry-run, copy-paste it as the value of the `minimal_roi` attribute of your custom strategy: -``` python -minimal_roi = { - "118": 0, - "78": 0.0363, - "21": 0.0915, - "0": 0.106 +``` + # Minimal ROI designed for the strategy. + # This attribute will be overridden if the config file contains "minimal_roi" + minimal_roi = { + 0: 0.10674, + 21: 0.09158, + 78: 0.03634, + 118: 0 } ``` +As stated in the comment, you can also use it as the value of the `minimal_roi` setting in the configuration file. + +#### Default ROI Search Space If you are optimizing ROI, Freqtrade creates the 'roi' optimization hyperspace for you -- it's the hyperspace of components for the ROI tables. By default, each ROI table generated by the Freqtrade consists of 4 rows (steps). Hyperopt implements adaptive ranges for ROI tables with ranges for values in the ROI steps that depend on the ticker_interval used. By default the values can vary in the following ranges (for some of the most used ticker intervals, values are rounded to 5 digits after the decimal point): @@ -422,10 +427,21 @@ Buy hyperspace params: 'adx-enabled': False, 'rsi-enabled': True, 'trigger': 'bb_lower'} -Stoploss: -0.37996664668703606 +Stoploss: -0.27996 ``` -If you are optimizing stoploss values, Freqtrade creates the 'stoploss' optimization hyperspace for you. By default, the stoploss values in that hyperspace can vary in the range -0.5...-0.02, which is sufficient in most cases. +In order to use this best stoploss value found by Hyperopt in backtesting and for live trades/dry-run, copy-paste it as the value of the `stoploss` attribute of your custom strategy: + +``` + # Optimal stoploss designed for the strategy + # This attribute will be overridden if the config file contains "stoploss" + stoploss = -0.27996 +``` +As stated in the comment, you can also use it as the value of the `stoploss` setting in the configuration file. + +#### Default Stoploss Search Space + +If you are optimizing stoploss values, Freqtrade creates the 'stoploss' optimization hyperspace for you. By default, the stoploss values in that hyperspace can vary in the range -0.35...-0.02, which is sufficient in most cases. If you have the `stoploss_space()` method in your custom hyperopt file, remove it in order to utilize Stoploss hyperoptimization space generated by Freqtrade by default. diff --git a/docs/installation.md b/docs/installation.md index 081d7e0cf..68348d4b0 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -257,14 +257,12 @@ As compiling from source on windows has heavy dependencies (requires a partial v ```cmd >cd \path\freqtrade-develop >python -m venv .env ->cd .env\Scripts ->activate.bat ->cd \path\freqtrade-develop +>.env\Scripts\activate.bat REM optionally install ta-lib from wheel REM >pip install TA_Lib‑0.4.17‑cp36‑cp36m‑win32.whl >pip install -r requirements.txt >pip install -e . ->python freqtrade\main.py +>freqtrade ``` > Thanks [Owdr](https://github.com/Owdr) for the commands. Source: [Issue #222](https://github.com/freqtrade/freqtrade/issues/222) diff --git a/freqtrade/configuration/arguments.py b/freqtrade/configuration/arguments.py index c2cde6090..b02736559 100644 --- a/freqtrade/configuration/arguments.py +++ b/freqtrade/configuration/arguments.py @@ -43,8 +43,9 @@ ARGS_PLOT_DATAFRAME = ["pairs", "indicators1", "indicators2", "plot_limit", "db_ ARGS_PLOT_PROFIT = ["pairs", "timerange", "export", "exportfilename", "db_url", "trade_source", "ticker_interval"] -NO_CONF_REQURIED = ["create-userdir", "download-data", "list-timeframes", "plot-dataframe", - "plot-profit"] +NO_CONF_REQURIED = ["download-data", "list-timeframes", "plot-dataframe", "plot-profit"] + +NO_CONF_ALLOWED = ["create-userdir", "list-exchanges"] class Arguments: @@ -78,12 +79,15 @@ class Arguments: parsed_arg = self.parser.parse_args(self.args) # When no config is provided, but a config exists, use that configuration! + subparser = parsed_arg.subparser if 'subparser' in parsed_arg else None # Workaround issue in argparse with action='append' and default value # (see https://bugs.python.org/issue16399) # Allow no-config for certain commands (like downloading / plotting) - if (parsed_arg.config is None and ((Path.cwd() / constants.DEFAULT_CONFIG).is_file() or - not ('subparser' in parsed_arg and parsed_arg.subparser in NO_CONF_REQURIED))): + if (parsed_arg.config is None + and subparser not in NO_CONF_ALLOWED + and ((Path.cwd() / constants.DEFAULT_CONFIG).is_file() + or (subparser not in NO_CONF_REQURIED))): parsed_arg.config = [constants.DEFAULT_CONFIG] return parsed_arg diff --git a/requirements-common.txt b/requirements-common.txt index f10134203..92b9c2597 100644 --- a/requirements-common.txt +++ b/requirements-common.txt @@ -1,16 +1,16 @@ # requirements without requirements installable via conda # mainly used for Raspberry pi installs -ccxt==1.18.1180 +ccxt==1.18.1208 SQLAlchemy==1.3.8 python-telegram-bot==12.1.1 arrow==0.15.2 cachetools==3.1.1 requests==2.22.0 -urllib3==1.25.5 +urllib3==1.25.6 wrapt==1.11.2 jsonschema==3.0.2 TA-Lib==0.4.17 -tabulate==0.8.3 +tabulate==0.8.5 coinmarketcap==5.0.3 # find first, C search in arrays diff --git a/requirements-dev.txt b/requirements-dev.txt index dcf2c7217..755dff4b4 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -11,5 +11,5 @@ mypy==0.720 pytest==5.1.3 pytest-asyncio==0.10.0 pytest-cov==2.7.1 -pytest-mock==1.10.4 +pytest-mock==1.11.0 pytest-random-order==1.0.4 diff --git a/tests/test_arguments.py b/tests/test_arguments.py index cf0104c01..e874e6769 100644 --- a/tests/test_arguments.py +++ b/tests/test_arguments.py @@ -1,5 +1,7 @@ # pragma pylint: disable=missing-docstring, C0103 import argparse +from pathlib import Path +from unittest.mock import MagicMock import pytest @@ -177,6 +179,44 @@ def test_plot_profit_options() -> None: assert pargs["db_url"] == "sqlite:///whatever.sqlite" +def test_config_notallowed(mocker) -> None: + mocker.patch.object(Path, "is_file", MagicMock(return_value=False)) + args = [ + 'create-userdir', + ] + pargs = Arguments(args).get_parsed_arg() + + assert pargs["config"] is None + + # When file exists: + mocker.patch.object(Path, "is_file", MagicMock(return_value=True)) + args = [ + 'create-userdir', + ] + pargs = Arguments(args).get_parsed_arg() + # config is not added even if it exists, since create-userdir is in the notallowed list + assert pargs["config"] is None + + +def test_config_notrequired(mocker) -> None: + mocker.patch.object(Path, "is_file", MagicMock(return_value=False)) + args = [ + 'download-data', + ] + pargs = Arguments(args).get_parsed_arg() + + assert pargs["config"] is None + + # When file exists: + mocker.patch.object(Path, "is_file", MagicMock(return_value=True)) + args = [ + 'download-data', + ] + pargs = Arguments(args).get_parsed_arg() + # config is added if it exists + assert pargs["config"] == ['config.json'] + + def test_check_int_positive() -> None: assert check_int_positive("3") == 3 assert check_int_positive("1") == 1