From 00406ea7d5af15e994b2468f73419c9d261e7975 Mon Sep 17 00:00:00 2001 From: GluTbl <30377623+GluTbl@users.noreply.github.com> Date: Tue, 19 Oct 2021 17:15:45 +0530 Subject: [PATCH 01/17] Update backtesting.py Support for custom entry-prices and exit-prices during backtesting. --- freqtrade/optimize/backtesting.py | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/freqtrade/optimize/backtesting.py b/freqtrade/optimize/backtesting.py index 8328d61d3..59bfd4dd0 100644 --- a/freqtrade/optimize/backtesting.py +++ b/freqtrade/optimize/backtesting.py @@ -360,6 +360,13 @@ class Backtesting: trade.sell_reason = sell.sell_reason trade_dur = int((trade.close_date_utc - trade.open_date_utc).total_seconds() // 60) closerate = self._get_close_rate(sell_row, trade, sell, trade_dur) + # call the custom exit price,with default value as previous closerate + current_profit = trade.calc_profit_ratio(closerate) + closerate = strategy_safe_wrapper(self.strategy.custom_exit_price, + default_retval=closerate)( + pair=trade.pair, trade=trade, + current_time=sell_row[DATE_IDX], + proposed_rate=closerate, current_profit=current_profit) # Confirm trade exit: time_in_force = self.strategy.order_time_in_force['sell'] @@ -407,13 +414,18 @@ class Backtesting: stake_amount = self.wallets.get_trade_stake_amount(pair, None) except DependencyException: return None + # let's call the custom entry price, using the open price as default price + propose_rate = strategy_safe_wrapper(self.strategy.custom_entry_price, + default_retval=row[OPEN_IDX])( + pair=pair, current_time=row[DATE_IDX].to_pydatetime(), + proposed_rate=row[OPEN_IDX]) # default value is the open rate - min_stake_amount = self.exchange.get_min_pair_stake_amount(pair, row[OPEN_IDX], -0.05) or 0 + min_stake_amount = self.exchange.get_min_pair_stake_amount(pair, propose_rate, -0.05) or 0 max_stake_amount = self.wallets.get_available_stake_amount() stake_amount = strategy_safe_wrapper(self.strategy.custom_stake_amount, default_retval=stake_amount)( - pair=pair, current_time=row[DATE_IDX].to_pydatetime(), current_rate=row[OPEN_IDX], + pair=pair, current_time=row[DATE_IDX].to_pydatetime(), current_rate=propose_rate, proposed_stake=stake_amount, min_stake=min_stake_amount, max_stake=max_stake_amount) stake_amount = self.wallets._validate_stake_amount(pair, stake_amount, min_stake_amount) @@ -424,7 +436,7 @@ class Backtesting: time_in_force = self.strategy.order_time_in_force['sell'] # Confirm trade entry: if not strategy_safe_wrapper(self.strategy.confirm_trade_entry, default_retval=True)( - pair=pair, order_type=order_type, amount=stake_amount, rate=row[OPEN_IDX], + pair=pair, order_type=order_type, amount=stake_amount, rate=propose_rate, time_in_force=time_in_force, current_time=row[DATE_IDX].to_pydatetime()): return None @@ -433,10 +445,10 @@ class Backtesting: has_buy_tag = len(row) >= BUY_TAG_IDX + 1 trade = LocalTrade( pair=pair, - open_rate=row[OPEN_IDX], + open_rate=propose_rate, open_date=row[DATE_IDX].to_pydatetime(), stake_amount=stake_amount, - amount=round(stake_amount / row[OPEN_IDX], 8), + amount=round(stake_amount / propose_rate, 8), fee_open=self.fee, fee_close=self.fee, is_open=True, From d4fd13bf501b73b6a54fe1231c9bf9fb8d801b25 Mon Sep 17 00:00:00 2001 From: Dardon Date: Sat, 20 Nov 2021 16:26:07 +0000 Subject: [PATCH 02/17] Telegram and log prints strategy version. --- freqtrade/rpc/telegram.py | 6 +++++- freqtrade/strategy/interface.py | 6 ++++++ freqtrade/worker.py | 8 ++++++-- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/freqtrade/rpc/telegram.py b/freqtrade/rpc/telegram.py index 0e1a6fe27..7fa4cf0f9 100644 --- a/freqtrade/rpc/telegram.py +++ b/freqtrade/rpc/telegram.py @@ -1304,7 +1304,11 @@ class Telegram(RPCHandler): :param update: message update :return: None """ - self._send_msg('*Version:* `{}`'.format(__version__)) + strategy_version = self._rpc._freqtrade.strategy.version() + if strategy_version is None: + self._send_msg('*Version:* `{}`'.format(__version__)) + else: + self._send_msg('*Freqtrade version:* `{}`, *Strategy version:* `{}`'.format(__version__, strategy_version)) @authorized_only def _show_config(self, update: Update, context: CallbackContext) -> None: diff --git a/freqtrade/strategy/interface.py b/freqtrade/strategy/interface.py index d4b496ed0..38be19384 100644 --- a/freqtrade/strategy/interface.py +++ b/freqtrade/strategy/interface.py @@ -393,6 +393,12 @@ class IStrategy(ABC, HyperStrategyMixin): ] """ return [] + + def version(self) -> str: + """ + Returns version of the strategy. + """ + return None ### # END - Intended to be overridden by strategy diff --git a/freqtrade/worker.py b/freqtrade/worker.py index 5c0de86ff..c3822d2fc 100755 --- a/freqtrade/worker.py +++ b/freqtrade/worker.py @@ -113,12 +113,16 @@ class Worker: if self._heartbeat_interval: now = time.time() if (now - self._heartbeat_msg) > self._heartbeat_interval: + version = __version__ + strategy_version = self.freqtrade.strategy.version() + if (strategy_version != None): + version += ', strategy_version: ' + strategy_version logger.info(f"Bot heartbeat. PID={getpid()}, " - f"version='{__version__}', state='{state.name}'") + f"version='{version}', state='{state.name}'") self._heartbeat_msg = now return state - + def _throttle(self, func: Callable[..., Any], throttle_secs: float, *args, **kwargs) -> Any: """ Throttles the given callable that it From d09a30cc671dc9b2b0f3626e8194b0b727545305 Mon Sep 17 00:00:00 2001 From: Matthias Date: Fri, 3 Dec 2021 15:33:58 +0100 Subject: [PATCH 03/17] OrderTypeValues should be in enums --- freqtrade/enums/__init__.py | 1 + freqtrade/enums/ordertypevalue.py | 6 ++++++ freqtrade/rpc/api_server/api_schemas.py | 7 +------ 3 files changed, 8 insertions(+), 6 deletions(-) create mode 100644 freqtrade/enums/ordertypevalue.py diff --git a/freqtrade/enums/__init__.py b/freqtrade/enums/__init__.py index d803baf31..eab483db3 100644 --- a/freqtrade/enums/__init__.py +++ b/freqtrade/enums/__init__.py @@ -1,5 +1,6 @@ # flake8: noqa: F401 from freqtrade.enums.backteststate import BacktestState +from freqtrade.enums.ordertypevalue import OrderTypeValues from freqtrade.enums.rpcmessagetype import RPCMessageType from freqtrade.enums.runmode import NON_UTIL_MODES, OPTIMIZE_MODES, TRADING_MODES, RunMode from freqtrade.enums.selltype import SellType diff --git a/freqtrade/enums/ordertypevalue.py b/freqtrade/enums/ordertypevalue.py new file mode 100644 index 000000000..9bb716171 --- /dev/null +++ b/freqtrade/enums/ordertypevalue.py @@ -0,0 +1,6 @@ +from enum import Enum + + +class OrderTypeValues(str, Enum): + limit = 'limit' + market = 'market' diff --git a/freqtrade/rpc/api_server/api_schemas.py b/freqtrade/rpc/api_server/api_schemas.py index c1720a836..f9389d810 100644 --- a/freqtrade/rpc/api_server/api_schemas.py +++ b/freqtrade/rpc/api_server/api_schemas.py @@ -1,10 +1,10 @@ from datetime import date, datetime -from enum import Enum from typing import Any, Dict, List, Optional, Union from pydantic import BaseModel from freqtrade.constants import DATETIME_PRINT_FORMAT +from freqtrade.enums import OrderTypeValues class Ping(BaseModel): @@ -132,11 +132,6 @@ class UnfilledTimeout(BaseModel): exit_timeout_count: Optional[int] -class OrderTypeValues(str, Enum): - limit = 'limit' - market = 'market' - - class OrderTypes(BaseModel): buy: OrderTypeValues sell: OrderTypeValues From 86910b58dcae064dfb717fa27f058d71b0f83df4 Mon Sep 17 00:00:00 2001 From: Matthias Date: Fri, 3 Dec 2021 17:44:53 +0100 Subject: [PATCH 04/17] Bracket entry/exit prices to low/high of the candle --- docs/bot-basics.md | 4 ++++ docs/strategy-callbacks.md | 5 +++-- freqtrade/optimize/backtesting.py | 11 +++++++---- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/docs/bot-basics.md b/docs/bot-basics.md index 80443a0bf..67cc5cd1b 100644 --- a/docs/bot-basics.md +++ b/docs/bot-basics.md @@ -56,7 +56,11 @@ This loop will be repeated again and again until the bot is stopped. * Calculate buy / sell signals (calls `populate_buy_trend()` and `populate_sell_trend()` once per pair). * Loops per candle simulating entry and exit points. * Confirm trade buy / sell (calls `confirm_trade_entry()` and `confirm_trade_exit()` if implemented in the strategy). + * Call `custom_entry_price()` (if implemented in the strategy) to determine entry price (Prices are moved to be within the opening candle). + * Determine stake size by calling the `custom_stake_amount()` callback. * Call `custom_stoploss()` and `custom_sell()` to find custom exit points. + * Call `custom_exit_price()` to determine exit price (Prices are moved to be within the closing candle). + * Generate backtest report output !!! Note diff --git a/docs/strategy-callbacks.md b/docs/strategy-callbacks.md index 7a7756652..869a985ae 100644 --- a/docs/strategy-callbacks.md +++ b/docs/strategy-callbacks.md @@ -387,8 +387,9 @@ class AwesomeStrategy(IStrategy): **Example**: If the new_entryprice is 97, the proposed_rate is 100 and the `custom_price_max_distance_ratio` is set to 2%, The retained valid custom entry price will be 98, which is 2% below the current (proposed) rate. -!!! Warning "No backtesting support" - Custom entry-prices are currently not supported during backtesting. +!!! Warning "Backtesting" + While Custom prices are supported in backtesting (starting with 2021.12), prices will be moved to within the candle's high/low prices. + This behavior is currently in testing, and might be changed at a later point. ## Custom order timeout rules diff --git a/freqtrade/optimize/backtesting.py b/freqtrade/optimize/backtesting.py index 1d28a91f5..a561502fa 100644 --- a/freqtrade/optimize/backtesting.py +++ b/freqtrade/optimize/backtesting.py @@ -342,10 +342,7 @@ class Backtesting: # use Open rate if open_rate > calculated sell rate return sell_row[OPEN_IDX] - # Use the maximum between close_rate and low as we - # cannot sell outside of a candle. - # Applies when a new ROI setting comes in place and the whole candle is above that. - return min(max(close_rate, sell_row[LOW_IDX]), sell_row[HIGH_IDX]) + return close_rate else: # This should not be reached... @@ -373,6 +370,9 @@ class Backtesting: pair=trade.pair, trade=trade, current_time=sell_row[DATE_IDX], proposed_rate=closerate, current_profit=current_profit) + # Use the maximum between close_rate and low as we cannot sell outside of a candle. + # Applies when a new ROI setting comes in place and the whole candle is above that. + closerate = min(max(closerate, sell_row[LOW_IDX]), sell_row[HIGH_IDX]) # Confirm trade exit: time_in_force = self.strategy.order_time_in_force['sell'] @@ -437,6 +437,9 @@ class Backtesting: pair=pair, current_time=row[DATE_IDX].to_pydatetime(), proposed_rate=row[OPEN_IDX]) # default value is the open rate + # Move rate to within the candle's low/high rate + propose_rate = min(max(propose_rate, row[LOW_IDX]), row[HIGH_IDX]) + min_stake_amount = self.exchange.get_min_pair_stake_amount(pair, propose_rate, -0.05) or 0 max_stake_amount = self.wallets.get_available_stake_amount() From 84ad17628724ea38be94705461d50f57bda85289 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 4 Dec 2021 13:33:38 +0100 Subject: [PATCH 05/17] Improve documentation wording --- docs/strategy-callbacks.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/strategy-callbacks.md b/docs/strategy-callbacks.md index 869a985ae..895e50425 100644 --- a/docs/strategy-callbacks.md +++ b/docs/strategy-callbacks.md @@ -389,7 +389,7 @@ class AwesomeStrategy(IStrategy): !!! Warning "Backtesting" While Custom prices are supported in backtesting (starting with 2021.12), prices will be moved to within the candle's high/low prices. - This behavior is currently in testing, and might be changed at a later point. + This behavior is currently being tested, and might be changed at a later point. ## Custom order timeout rules From 68ac8008ecf2eae00a01d6ee2e21f8703fb9606a Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 4 Dec 2021 14:14:22 +0100 Subject: [PATCH 06/17] Call custom_exit_price only for sell_signal and custom_sell --- docs/bot-basics.md | 2 +- docs/strategy-callbacks.md | 1 + freqtrade/optimize/backtesting.py | 12 +++++++----- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/docs/bot-basics.md b/docs/bot-basics.md index 67cc5cd1b..0b9f7b67c 100644 --- a/docs/bot-basics.md +++ b/docs/bot-basics.md @@ -59,7 +59,7 @@ This loop will be repeated again and again until the bot is stopped. * Call `custom_entry_price()` (if implemented in the strategy) to determine entry price (Prices are moved to be within the opening candle). * Determine stake size by calling the `custom_stake_amount()` callback. * Call `custom_stoploss()` and `custom_sell()` to find custom exit points. - * Call `custom_exit_price()` to determine exit price (Prices are moved to be within the closing candle). + * For sells based on sell-signal and custom-sell: Call `custom_exit_price()` to determine exit price (Prices are moved to be within the closing candle). * Generate backtest report output diff --git a/docs/strategy-callbacks.md b/docs/strategy-callbacks.md index 895e50425..11032433d 100644 --- a/docs/strategy-callbacks.md +++ b/docs/strategy-callbacks.md @@ -390,6 +390,7 @@ class AwesomeStrategy(IStrategy): !!! Warning "Backtesting" While Custom prices are supported in backtesting (starting with 2021.12), prices will be moved to within the candle's high/low prices. This behavior is currently being tested, and might be changed at a later point. + `custom_exit_price()` is only called for sells of type Sell_signal and Custom sell. All other sell-types will use regular backtesting prices. ## Custom order timeout rules diff --git a/freqtrade/optimize/backtesting.py b/freqtrade/optimize/backtesting.py index a561502fa..55461b3e1 100644 --- a/freqtrade/optimize/backtesting.py +++ b/freqtrade/optimize/backtesting.py @@ -365,11 +365,13 @@ class Backtesting: closerate = self._get_close_rate(sell_row, trade, sell, trade_dur) # call the custom exit price,with default value as previous closerate current_profit = trade.calc_profit_ratio(closerate) - closerate = strategy_safe_wrapper(self.strategy.custom_exit_price, - default_retval=closerate)( - pair=trade.pair, trade=trade, - current_time=sell_row[DATE_IDX], - proposed_rate=closerate, current_profit=current_profit) + if sell.sell_type in (SellType.SELL_SIGNAL, SellType.CUSTOM_SELL): + # Custom exit pricing only for sell-signals + closerate = strategy_safe_wrapper(self.strategy.custom_exit_price, + default_retval=closerate)( + pair=trade.pair, trade=trade, + current_time=sell_row[DATE_IDX], + proposed_rate=closerate, current_profit=current_profit) # Use the maximum between close_rate and low as we cannot sell outside of a candle. # Applies when a new ROI setting comes in place and the whole candle is above that. closerate = min(max(closerate, sell_row[LOW_IDX]), sell_row[HIGH_IDX]) From 2080bf09525847129e97d573ce4ffaa4476ea60f Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 4 Dec 2021 14:40:05 +0100 Subject: [PATCH 07/17] Fix some formatting errors, add test for strategy version --- freqtrade/rpc/telegram.py | 9 +++++---- freqtrade/strategy/interface.py | 2 +- freqtrade/worker.py | 6 +++--- tests/rpc/test_rpc_telegram.py | 10 +++++++++- 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/freqtrade/rpc/telegram.py b/freqtrade/rpc/telegram.py index 7fa4cf0f9..e6af85267 100644 --- a/freqtrade/rpc/telegram.py +++ b/freqtrade/rpc/telegram.py @@ -1305,10 +1305,11 @@ class Telegram(RPCHandler): :return: None """ strategy_version = self._rpc._freqtrade.strategy.version() - if strategy_version is None: - self._send_msg('*Version:* `{}`'.format(__version__)) - else: - self._send_msg('*Freqtrade version:* `{}`, *Strategy version:* `{}`'.format(__version__, strategy_version)) + version_string = f'*Version:* `{__version__}`' + if strategy_version is not None: + version_string += f', *Strategy version: * `{strategy_version}`' + + self._send_msg(version_string) @authorized_only def _show_config(self, update: Update, context: CallbackContext) -> None: diff --git a/freqtrade/strategy/interface.py b/freqtrade/strategy/interface.py index 38be19384..088777654 100644 --- a/freqtrade/strategy/interface.py +++ b/freqtrade/strategy/interface.py @@ -393,7 +393,7 @@ class IStrategy(ABC, HyperStrategyMixin): ] """ return [] - + def version(self) -> str: """ Returns version of the strategy. diff --git a/freqtrade/worker.py b/freqtrade/worker.py index c3822d2fc..2fe2de9e1 100755 --- a/freqtrade/worker.py +++ b/freqtrade/worker.py @@ -115,14 +115,14 @@ class Worker: if (now - self._heartbeat_msg) > self._heartbeat_interval: version = __version__ strategy_version = self.freqtrade.strategy.version() - if (strategy_version != None): - version += ', strategy_version: ' + strategy_version + if (strategy_version is not None): + version += ', strategy_version: ' + strategy_version logger.info(f"Bot heartbeat. PID={getpid()}, " f"version='{version}', state='{state.name}'") self._heartbeat_msg = now return state - + def _throttle(self, func: Callable[..., Any], throttle_secs: float, *args, **kwargs) -> Any: """ Throttles the given callable that it diff --git a/tests/rpc/test_rpc_telegram.py b/tests/rpc/test_rpc_telegram.py index 1247affae..c1677320e 100644 --- a/tests/rpc/test_rpc_telegram.py +++ b/tests/rpc/test_rpc_telegram.py @@ -1559,12 +1559,20 @@ def test_help_handle(default_conf, update, mocker) -> None: def test_version_handle(default_conf, update, mocker) -> None: - telegram, _, msg_mock = get_telegram_testobject(mocker, default_conf) + telegram, freqtradebot, msg_mock = get_telegram_testobject(mocker, default_conf) telegram._version(update=update, context=MagicMock()) assert msg_mock.call_count == 1 assert '*Version:* `{}`'.format(__version__) in msg_mock.call_args_list[0][0][0] + msg_mock.reset_mock() + freqtradebot.strategy.version = lambda: '1.1.1' + + telegram._version(update=update, context=MagicMock()) + assert msg_mock.call_count == 1 + assert '*Version:* `{}`'.format(__version__) in msg_mock.call_args_list[0][0][0] + assert '*Strategy version: * `1.1.1`' in msg_mock.call_args_list[0][0][0] + def test_show_config_handle(default_conf, update, mocker) -> None: From e3190cf8a88533baca256775621c586afb821243 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 4 Dec 2021 14:44:03 +0100 Subject: [PATCH 08/17] Update documentation --- docs/strategy-advanced.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docs/strategy-advanced.md b/docs/strategy-advanced.md index 573d184ff..4cc607883 100644 --- a/docs/strategy-advanced.md +++ b/docs/strategy-advanced.md @@ -127,6 +127,21 @@ The provided exit-tag is then used as sell-reason - and shown as such in backtes !!! Note `sell_reason` is limited to 100 characters, remaining data will be truncated. +## Strategy version + +You can implement custom strategy versioning by using the "version" method, and returning the version you would like this strategy to have. + +``` python +def version(self) -> str: + """ + Returns version of the strategy. + """ + return "1.1" +``` + +!!! Note + You should make sure to implement proper version control (like a git repository) alongside this, as freqtrade will not keep historic versions of your strategy, so it's up to the user to be able to eventually roll back to a prior version of the strategy. + ## Derived strategies The strategies can be derived from other strategies. This avoids duplication of your custom strategy code. You can use this technique to override small parts of your main strategy, leaving the rest untouched: From d0467b30ba8055ab347ab82cd899b11307e9a59f Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 4 Dec 2021 14:49:45 +0100 Subject: [PATCH 09/17] Add strategy_version to API response --- freqtrade/rpc/api_server/api_schemas.py | 1 + freqtrade/rpc/api_server/api_v1.py | 4 +++- freqtrade/rpc/rpc.py | 4 +++- freqtrade/strategy/interface.py | 2 +- tests/rpc/test_rpc_apiserver.py | 1 + 5 files changed, 9 insertions(+), 3 deletions(-) diff --git a/freqtrade/rpc/api_server/api_schemas.py b/freqtrade/rpc/api_server/api_schemas.py index f9389d810..d669600a2 100644 --- a/freqtrade/rpc/api_server/api_schemas.py +++ b/freqtrade/rpc/api_server/api_schemas.py @@ -145,6 +145,7 @@ class OrderTypes(BaseModel): class ShowConfig(BaseModel): version: str + strategy_version: Optional[str] api_version: float dry_run: bool stake_currency: str diff --git a/freqtrade/rpc/api_server/api_v1.py b/freqtrade/rpc/api_server/api_v1.py index 65b6941e2..721d5dbc0 100644 --- a/freqtrade/rpc/api_server/api_v1.py +++ b/freqtrade/rpc/api_server/api_v1.py @@ -121,9 +121,11 @@ def edge(rpc: RPC = Depends(get_rpc)): @router.get('/show_config', response_model=ShowConfig, tags=['info']) def show_config(rpc: Optional[RPC] = Depends(get_rpc_optional), config=Depends(get_config)): state = '' + strategy_version = None if rpc: state = rpc._freqtrade.state - resp = RPC._rpc_show_config(config, state) + strategy_version = rpc._freqtrade.strategy.version() + resp = RPC._rpc_show_config(config, state, strategy_version) resp['api_version'] = API_VERSION return resp diff --git a/freqtrade/rpc/rpc.py b/freqtrade/rpc/rpc.py index c21890b7d..b3728d67a 100644 --- a/freqtrade/rpc/rpc.py +++ b/freqtrade/rpc/rpc.py @@ -98,7 +98,8 @@ class RPC: self._fiat_converter = CryptoToFiatConverter() @staticmethod - def _rpc_show_config(config, botstate: Union[State, str]) -> Dict[str, Any]: + def _rpc_show_config(config, botstate: Union[State, str], + strategy_version: Optional[str] = None) -> Dict[str, Any]: """ Return a dict of config options. Explicitly does NOT return the full config to avoid leakage of sensitive @@ -106,6 +107,7 @@ class RPC: """ val = { 'version': __version__, + 'strategy_version': strategy_version, 'dry_run': config['dry_run'], 'stake_currency': config['stake_currency'], 'stake_currency_decimals': decimals_per_coin(config['stake_currency']), diff --git a/freqtrade/strategy/interface.py b/freqtrade/strategy/interface.py index 088777654..05469317b 100644 --- a/freqtrade/strategy/interface.py +++ b/freqtrade/strategy/interface.py @@ -394,7 +394,7 @@ class IStrategy(ABC, HyperStrategyMixin): """ return [] - def version(self) -> str: + def version(self) -> Optional[str]: """ Returns version of the strategy. """ diff --git a/tests/rpc/test_rpc_apiserver.py b/tests/rpc/test_rpc_apiserver.py index 76372df55..883a33e38 100644 --- a/tests/rpc/test_rpc_apiserver.py +++ b/tests/rpc/test_rpc_apiserver.py @@ -533,6 +533,7 @@ def test_api_show_config(botclient): assert rc.json()['timeframe_min'] == 5 assert rc.json()['state'] == 'running' assert rc.json()['bot_name'] == 'freqtrade' + assert rc.json()['strategy_version'] is None assert not rc.json()['trailing_stop'] assert 'bid_strategy' in rc.json() assert 'ask_strategy' in rc.json() From c981cc335d0c69a654628a490a8a02e299700b6a Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 4 Dec 2021 14:51:55 +0100 Subject: [PATCH 10/17] Remove wrong comment --- freqtrade/optimize/backtesting.py | 1 - 1 file changed, 1 deletion(-) diff --git a/freqtrade/optimize/backtesting.py b/freqtrade/optimize/backtesting.py index 55461b3e1..d4b51d04d 100644 --- a/freqtrade/optimize/backtesting.py +++ b/freqtrade/optimize/backtesting.py @@ -373,7 +373,6 @@ class Backtesting: current_time=sell_row[DATE_IDX], proposed_rate=closerate, current_profit=current_profit) # Use the maximum between close_rate and low as we cannot sell outside of a candle. - # Applies when a new ROI setting comes in place and the whole candle is above that. closerate = min(max(closerate, sell_row[LOW_IDX]), sell_row[HIGH_IDX]) # Confirm trade exit: From 4278c5a24ad80a390484c8dd451c4eb338295cc6 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 5 Dec 2021 09:24:40 +0100 Subject: [PATCH 11/17] add note about arm64 installation closes #6025 --- docs/installation.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/installation.md b/docs/installation.md index ee7ffe55d..dbd763414 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -36,6 +36,10 @@ The easiest way to install and run Freqtrade is to clone the bot Github reposito These requirements apply to both [Script Installation](#script-installation) and [Manual Installation](#manual-installation). +!!! Note + If you are running an ARM64 system (like a MacOS M1 or an Oracle VM), please use [docker](docker_quickstart.md) to run freqtrade. + While native installation is possible, this is not supported at the moment. + ### Install guide * [Python >= 3.7.x](http://docs.python-guide.org/en/latest/starting/installation/) From fbd64d757dbffb18ccb3e1b78cfefeeb6c782f07 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 5 Dec 2021 09:26:44 +0100 Subject: [PATCH 12/17] Improve doc wording --- docs/installation.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/installation.md b/docs/installation.md index dbd763414..40d171347 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -36,9 +36,9 @@ The easiest way to install and run Freqtrade is to clone the bot Github reposito These requirements apply to both [Script Installation](#script-installation) and [Manual Installation](#manual-installation). -!!! Note +!!! Note "ARM64 systems" If you are running an ARM64 system (like a MacOS M1 or an Oracle VM), please use [docker](docker_quickstart.md) to run freqtrade. - While native installation is possible, this is not supported at the moment. + While native installation is possible with some manual effort, this is not supported at the moment. ### Install guide From 50a6eaea2220fc1e3e84b6b58d7071169088ac6b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 6 Dec 2021 03:01:30 +0000 Subject: [PATCH 13/17] Bump ccxt from 1.62.42 to 1.63.1 Bumps [ccxt](https://github.com/ccxt/ccxt) from 1.62.42 to 1.63.1. - [Release notes](https://github.com/ccxt/ccxt/releases) - [Changelog](https://github.com/ccxt/ccxt/blob/master/exchanges.cfg) - [Commits](https://github.com/ccxt/ccxt/compare/1.62.42...1.63.1) --- updated-dependencies: - dependency-name: ccxt dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index ccc3f5397..1caf4e1ef 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,7 +2,7 @@ numpy==1.21.4 pandas==1.3.4 pandas-ta==0.3.14b -ccxt==1.62.42 +ccxt==1.63.1 # Pin cryptography for now due to rust build errors with piwheels cryptography==36.0.0 aiohttp==3.8.1 From 3dda0ef2efbdd790e170dbfc7580cf86392be5ad Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 6 Dec 2021 03:01:35 +0000 Subject: [PATCH 14/17] Bump mkdocs-material from 8.0.1 to 8.0.4 Bumps [mkdocs-material](https://github.com/squidfunk/mkdocs-material) from 8.0.1 to 8.0.4. - [Release notes](https://github.com/squidfunk/mkdocs-material/releases) - [Changelog](https://github.com/squidfunk/mkdocs-material/blob/master/CHANGELOG) - [Commits](https://github.com/squidfunk/mkdocs-material/compare/8.0.1...8.0.4) --- updated-dependencies: - dependency-name: mkdocs-material dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- docs/requirements-docs.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/requirements-docs.txt b/docs/requirements-docs.txt index 351f45af6..a6c3fdd05 100644 --- a/docs/requirements-docs.txt +++ b/docs/requirements-docs.txt @@ -1,4 +1,4 @@ mkdocs==1.2.3 -mkdocs-material==8.0.1 +mkdocs-material==8.0.4 mdx_truly_sane_lists==1.2 pymdown-extensions==9.1 From 7848e17a4989e4800ab75282a4f893f6e654f4b0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 9 Dec 2021 03:01:59 +0000 Subject: [PATCH 15/17] Bump python from 3.9.9-slim-bullseye to 3.10.1-slim-bullseye Bumps python from 3.9.9-slim-bullseye to 3.10.1-slim-bullseye. --- updated-dependencies: - dependency-name: python dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 8f5b85698..1a5f953a2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.9.9-slim-bullseye as base +FROM python:3.10.1-slim-bullseye as base # Setup env ENV LANG C.UTF-8 From facb5b3991b1ed6dfccaef09524df1948d3f42b0 Mon Sep 17 00:00:00 2001 From: Matthias Date: Thu, 9 Dec 2021 06:17:56 +0100 Subject: [PATCH 16/17] Revert "Bump python from 3.9.9-slim-bullseye to 3.10.1-slim-bullseye" --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 1a5f953a2..8f5b85698 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.10.1-slim-bullseye as base +FROM python:3.9.9-slim-bullseye as base # Setup env ENV LANG C.UTF-8 From be6b1f6f8399b05dcfcddcf63b573052b21beb96 Mon Sep 17 00:00:00 2001 From: Matthias Date: Wed, 8 Dec 2021 19:30:14 +0100 Subject: [PATCH 17/17] Import from enums, not submodules --- freqtrade/plugins/pairlist/ShuffleFilter.py | 2 +- tests/plugins/test_pairlist.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/freqtrade/plugins/pairlist/ShuffleFilter.py b/freqtrade/plugins/pairlist/ShuffleFilter.py index 55cf9938f..663bba49b 100644 --- a/freqtrade/plugins/pairlist/ShuffleFilter.py +++ b/freqtrade/plugins/pairlist/ShuffleFilter.py @@ -5,7 +5,7 @@ import logging import random from typing import Any, Dict, List -from freqtrade.enums.runmode import RunMode +from freqtrade.enums import RunMode from freqtrade.plugins.pairlist.IPairList import IPairList diff --git a/tests/plugins/test_pairlist.py b/tests/plugins/test_pairlist.py index ba8e6c3c3..0d0e43b0b 100644 --- a/tests/plugins/test_pairlist.py +++ b/tests/plugins/test_pairlist.py @@ -7,7 +7,7 @@ import pytest import time_machine from freqtrade.constants import AVAILABLE_PAIRLISTS -from freqtrade.enums.runmode import RunMode +from freqtrade.enums import RunMode from freqtrade.exceptions import OperationalException from freqtrade.persistence import Trade from freqtrade.plugins.pairlist.pairlist_helpers import expand_pairlist