From 95f69b905aec70c2e13b9def10dae6c0275df8ab Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 20 Mar 2022 09:00:53 +0100 Subject: [PATCH] Remove ticker_interval support --- docs/backtesting.md | 4 ++-- docs/configuration.md | 2 +- docs/edge.md | 2 +- docs/hyperopt.md | 2 +- docs/plotting.md | 4 ++-- docs/strategy-customization.md | 2 +- freqtrade/commands/cli_options.py | 4 ++-- freqtrade/optimize/backtesting.py | 2 +- freqtrade/optimize/hyperopt_interface.py | 7 ++----- freqtrade/resolvers/hyperopt_resolver.py | 1 - freqtrade/resolvers/strategy_resolver.py | 4 ---- freqtrade/strategy/interface.py | 3 +-- 12 files changed, 14 insertions(+), 23 deletions(-) diff --git a/docs/backtesting.md b/docs/backtesting.md index e7846b1f8..11608aad9 100644 --- a/docs/backtesting.md +++ b/docs/backtesting.md @@ -26,7 +26,7 @@ usage: freqtrade backtesting [-h] [-v] [--logfile FILE] [-V] [-c PATH] optional arguments: -h, --help show this help message and exit - -i TIMEFRAME, --timeframe TIMEFRAME, --ticker-interval TIMEFRAME + -i TIMEFRAME, --timeframe TIMEFRAME Specify timeframe (`1m`, `5m`, `30m`, `1h`, `1d`). --timerange TIMERANGE Specify what timerange of data to use. @@ -63,7 +63,7 @@ optional arguments: `30m`, `1h`, `1d`). --strategy-list STRATEGY_LIST [STRATEGY_LIST ...] Provide a space-separated list of strategies to - backtest. Please note that ticker-interval needs to be + backtest. Please note that timeframe needs to be set either in config or via command line. When using this together with `--export trades`, the strategy- name is injected into the filename (so `backtest- diff --git a/docs/configuration.md b/docs/configuration.md index d702fe8f9..2cb5dfa93 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -86,7 +86,7 @@ Mandatory parameters are marked as **Required**, which means that they are requi | `amend_last_stake_amount` | Use reduced last stake amount if necessary. [More information below](#configuring-amount-per-trade).
*Defaults to `false`.*
**Datatype:** Boolean | `last_stake_amount_min_ratio` | Defines minimum stake amount that has to be left and executed. Applies only to the last stake amount when it's amended to a reduced value (i.e. if `amend_last_stake_amount` is set to `true`). [More information below](#configuring-amount-per-trade).
*Defaults to `0.5`.*
**Datatype:** Float (as ratio) | `amount_reserve_percent` | Reserve some amount in min pair stake amount. The bot will reserve `amount_reserve_percent` + stoploss value when calculating min pair stake amount in order to avoid possible trade refusals.
*Defaults to `0.05` (5%).*
**Datatype:** Positive Float as ratio. -| `timeframe` | The timeframe (former ticker interval) to use (e.g `1m`, `5m`, `15m`, `30m`, `1h` ...). [Strategy Override](#parameters-in-the-strategy).
**Datatype:** String +| `timeframe` | The timeframe to use (e.g `1m`, `5m`, `15m`, `30m`, `1h` ...). [Strategy Override](#parameters-in-the-strategy).
**Datatype:** String | `fiat_display_currency` | Fiat currency used to show your profits. [More information below](#what-values-can-be-used-for-fiat_display_currency).
**Datatype:** String | `dry_run` | **Required.** Define if the bot must be in Dry Run or production mode.
*Defaults to `true`.*
**Datatype:** Boolean | `dry_run_wallet` | Define the starting amount in stake currency for the simulated wallet used by the bot running in Dry Run mode.
*Defaults to `1000`.*
**Datatype:** Float diff --git a/docs/edge.md b/docs/edge.md index 4402d767f..e92abf40f 100644 --- a/docs/edge.md +++ b/docs/edge.md @@ -222,7 +222,7 @@ usage: freqtrade edge [-h] [-v] [--logfile FILE] [-V] [-c PATH] [-d PATH] optional arguments: -h, --help show this help message and exit - -i TIMEFRAME, --timeframe TIMEFRAME, --ticker-interval TIMEFRAME + -i TIMEFRAME, --timeframe TIMEFRAME Specify timeframe (`1m`, `5m`, `30m`, `1h`, `1d`). --timerange TIMERANGE Specify what timerange of data to use. diff --git a/docs/hyperopt.md b/docs/hyperopt.md index 19d8cd692..c8cb118f7 100644 --- a/docs/hyperopt.md +++ b/docs/hyperopt.md @@ -55,7 +55,7 @@ usage: freqtrade hyperopt [-h] [-v] [--logfile FILE] [-V] [-c PATH] [-d PATH] optional arguments: -h, --help show this help message and exit - -i TIMEFRAME, --timeframe TIMEFRAME, --ticker-interval TIMEFRAME + -i TIMEFRAME, --timeframe TIMEFRAME Specify timeframe (`1m`, `5m`, `30m`, `1h`, `1d`). --timerange TIMERANGE Specify what timerange of data to use. diff --git a/docs/plotting.md b/docs/plotting.md index ccfbb12cb..004dd7821 100644 --- a/docs/plotting.md +++ b/docs/plotting.md @@ -65,7 +65,7 @@ optional arguments: _today.json` --timerange TIMERANGE Specify what timerange of data to use. - -i TIMEFRAME, --timeframe TIMEFRAME, --ticker-interval TIMEFRAME + -i TIMEFRAME, --timeframe TIMEFRAME Specify timeframe (`1m`, `5m`, `30m`, `1h`, `1d`). --no-trades Skip using trades from backtesting file and DB. @@ -330,7 +330,7 @@ optional arguments: --trade-source {DB,file} Specify the source for trades (Can be DB or file (backtest file)) Default: file - -i TIMEFRAME, --timeframe TIMEFRAME, --ticker-interval TIMEFRAME + -i TIMEFRAME, --timeframe TIMEFRAME Specify timeframe (`1m`, `5m`, `30m`, `1h`, `1d`). --auto-open Automatically open generated plot. diff --git a/docs/strategy-customization.md b/docs/strategy-customization.md index e6eff2416..045a55c5b 100644 --- a/docs/strategy-customization.md +++ b/docs/strategy-customization.md @@ -325,7 +325,7 @@ stoploss = -0.10 For the full documentation on stoploss features, look at the dedicated [stoploss page](stoploss.md). -### Timeframe (formerly ticker interval) +### Timeframe This is the set of candles the bot should download and use for the analysis. Common values are `"1m"`, `"5m"`, `"15m"`, `"1h"`, however all values supported by your exchange should work. diff --git a/freqtrade/commands/cli_options.py b/freqtrade/commands/cli_options.py index 11fcc6b81..f30c25ba1 100644 --- a/freqtrade/commands/cli_options.py +++ b/freqtrade/commands/cli_options.py @@ -117,7 +117,7 @@ AVAILABLE_CLI_OPTIONS = { ), # Optimize common "timeframe": Arg( - '-i', '--timeframe', '--ticker-interval', + '-i', '--timeframe', help='Specify timeframe (`1m`, `5m`, `30m`, `1h`, `1d`).', ), "timerange": Arg( @@ -169,7 +169,7 @@ AVAILABLE_CLI_OPTIONS = { "strategy_list": Arg( '--strategy-list', help='Provide a space-separated list of strategies to backtest. ' - 'Please note that ticker-interval needs to be set either in config ' + 'Please note that timeframe needs to be set either in config ' 'or via command line. When using this together with `--export trades`, ' 'the strategy-name is injected into the filename ' '(so `backtest-data.json` becomes `backtest-data-SampleStrategy.json`', diff --git a/freqtrade/optimize/backtesting.py b/freqtrade/optimize/backtesting.py index eca643732..76f0e68f4 100644 --- a/freqtrade/optimize/backtesting.py +++ b/freqtrade/optimize/backtesting.py @@ -87,7 +87,7 @@ class Backtesting: validate_config_consistency(self.config) if "timeframe" not in self.config: - raise OperationalException("Timeframe (ticker interval) needs to be set in either " + raise OperationalException("Timeframe needs to be set in either " "configuration or as cli argument `--timeframe 5m`") self.timeframe = str(self.config.get('timeframe')) self.timeframe_min = timeframe_to_minutes(self.timeframe) diff --git a/freqtrade/optimize/hyperopt_interface.py b/freqtrade/optimize/hyperopt_interface.py index 01ffd7844..b1c68caca 100644 --- a/freqtrade/optimize/hyperopt_interface.py +++ b/freqtrade/optimize/hyperopt_interface.py @@ -29,15 +29,13 @@ class IHyperOpt(ABC): Class attributes you can use: timeframe -> int: value of the timeframe to use for the strategy """ - ticker_interval: str # DEPRECATED timeframe: str strategy: IStrategy def __init__(self, config: dict) -> None: self.config = config - # Assign ticker_interval to be used in hyperopt - IHyperOpt.ticker_interval = str(config['timeframe']) # DEPRECATED + # Assign timeframe to be used in hyperopt IHyperOpt.timeframe = str(config['timeframe']) def generate_estimator(self, dimensions: List[Dimension], **kwargs) -> EstimatorType: @@ -192,7 +190,7 @@ class IHyperOpt(ABC): Categorical([True, False], name='trailing_only_offset_is_reached'), ] - # This is needed for proper unpickling the class attribute ticker_interval + # This is needed for proper unpickling the class attribute timeframe # which is set to the actual value by the resolver. # Why do I still need such shamanic mantras in modern python? def __getstate__(self): @@ -202,5 +200,4 @@ class IHyperOpt(ABC): def __setstate__(self, state): self.__dict__.update(state) - IHyperOpt.ticker_interval = state['timeframe'] IHyperOpt.timeframe = state['timeframe'] diff --git a/freqtrade/resolvers/hyperopt_resolver.py b/freqtrade/resolvers/hyperopt_resolver.py index 6f0263e93..e3c234f60 100644 --- a/freqtrade/resolvers/hyperopt_resolver.py +++ b/freqtrade/resolvers/hyperopt_resolver.py @@ -44,7 +44,6 @@ class HyperOptLossResolver(IResolver): extra_dir=config.get('hyperopt_path')) # Assign timeframe to be used in hyperopt - hyperoptloss.__class__.ticker_interval = str(config['timeframe']) hyperoptloss.__class__.timeframe = str(config['timeframe']) return hyperoptloss diff --git a/freqtrade/resolvers/strategy_resolver.py b/freqtrade/resolvers/strategy_resolver.py index e9fcc3496..48cbd03cf 100644 --- a/freqtrade/resolvers/strategy_resolver.py +++ b/freqtrade/resolvers/strategy_resolver.py @@ -145,10 +145,6 @@ class StrategyResolver(IResolver): """ Normalize attributes to have the correct type. """ - # Assign deprecated variable - to not break users code relying on this. - if hasattr(strategy, 'timeframe'): - strategy.ticker_interval = strategy.timeframe - # Sort and apply type conversions if hasattr(strategy, 'minimal_roi'): strategy.minimal_roi = dict(sorted( diff --git a/freqtrade/strategy/interface.py b/freqtrade/strategy/interface.py index 2f3657059..1eea84676 100644 --- a/freqtrade/strategy/interface.py +++ b/freqtrade/strategy/interface.py @@ -55,7 +55,7 @@ class IStrategy(ABC, HyperStrategyMixin): Attributes you can use: minimal_roi -> Dict: Minimal ROI designed for the strategy stoploss -> float: optimal stoploss designed for the strategy - timeframe -> str: value of the timeframe (ticker interval) to use with the strategy + timeframe -> str: value of the timeframe to use with the strategy """ # Strategy interface version # Default to version 2 @@ -81,7 +81,6 @@ class IStrategy(ABC, HyperStrategyMixin): use_custom_stoploss: bool = False # associated timeframe - ticker_interval: str # DEPRECATED timeframe: str # Optional order types