diff --git a/freqtrade/configuration/deprecated_settings.py b/freqtrade/configuration/deprecated_settings.py index 1b162f7c9..d2bdba3c5 100644 --- a/freqtrade/configuration/deprecated_settings.py +++ b/freqtrade/configuration/deprecated_settings.py @@ -71,6 +71,8 @@ def process_temporary_deprecated_settings(config: Dict[str, Any]) -> None: # Kept for future deprecated / moved settings # check_conflicting_settings(config, 'ask_strategy', 'use_sell_signal', # 'experimental', 'use_sell_signal') + # TODO-mg: Perhaps update this to change sell_signal to exit_signal + # TODO-mg: and buy_signal to enter signal, and maybe put it back in ask_strategy/short_strategy process_deprecated_setting(config, 'ask_strategy', 'use_sell_signal', None, 'use_sell_signal') process_deprecated_setting(config, 'ask_strategy', 'sell_profit_only', @@ -108,5 +110,5 @@ def process_temporary_deprecated_settings(config: Dict[str, Any]) -> None: raise OperationalException( "Both 'timeframe' and 'ticker_interval' detected." "Please remove 'ticker_interval' from your configuration to continue operating." - ) + ) config['timeframe'] = config['ticker_interval'] diff --git a/freqtrade/plot/plotting.py b/freqtrade/plot/plotting.py index 061460975..0925ddcd3 100644 --- a/freqtrade/plot/plotting.py +++ b/freqtrade/plot/plotting.py @@ -35,7 +35,7 @@ def init_plotscript(config, markets: List, startup_candles: int = 0): Initialize objects needed for plotting :return: Dict with candle (OHLCV) data, trades and pairs """ - + # TODO-mg: Add short whitelist if "pairs" in config: pairs = expand_pairlist(config['pairs'], markets) else: @@ -192,10 +192,12 @@ def plot_trades(fig, trades: pd.DataFrame) -> make_subplots: # Trades can be empty if trades is not None and len(trades) > 0: # Create description for sell summarizing the trade + # TODO-mg: update to exit_reason trades['desc'] = trades.apply(lambda row: f"{round(row['profit_ratio'] * 100, 1)}%, " f"{row['sell_reason']}, " f"{row['trade_duration']} min", axis=1) + # TODO-mg: Update to Trade enter trade_buys = go.Scatter( x=trades["open_date"], y=trades["open_rate"], @@ -210,7 +212,7 @@ def plot_trades(fig, trades: pd.DataFrame) -> make_subplots: ) ) - + # TODO-mg: Update to trade_exits, Exit - Profit trade_sells = go.Scatter( x=trades.loc[trades['profit_ratio'] > 0, "close_date"], y=trades.loc[trades['profit_ratio'] > 0, "close_rate"], @@ -224,6 +226,7 @@ def plot_trades(fig, trades: pd.DataFrame) -> make_subplots: color='green' ) ) + # TODO-mg: Update to trade_exits_loss, Exit - Loss trade_sells_loss = go.Scatter( x=trades.loc[trades['profit_ratio'] <= 0, "close_date"], y=trades.loc[trades['profit_ratio'] <= 0, "close_rate"], @@ -386,6 +389,7 @@ def generate_candlestick_graph(pair: str, data: pd.DataFrame, trades: pd.DataFra ) fig.add_trace(candles, 1, 1) + # TODO-mg: Update buy to enter if 'buy' in data.columns: df_buy = data[data['buy'] == 1] if len(df_buy) > 0: @@ -405,6 +409,7 @@ def generate_candlestick_graph(pair: str, data: pd.DataFrame, trades: pd.DataFra else: logger.warning("No buy-signals found.") + # TODO-mg: Update sell to exit if 'sell' in data.columns: df_sell = data[data['sell'] == 1] if len(df_sell) > 0: diff --git a/freqtrade/plugins/pairlist/IPairList.py b/freqtrade/plugins/pairlist/IPairList.py index 74348b1a7..0495ed37d 100644 --- a/freqtrade/plugins/pairlist/IPairList.py +++ b/freqtrade/plugins/pairlist/IPairList.py @@ -114,6 +114,8 @@ class IPairList(LoggingMixin, ABC): return pairlist + # TODO-mg: verify_short_whitelist, verify_short_blacklist? + def verify_blacklist(self, pairlist: List[str], logmethod) -> List[str]: """ Proxy method to verify_blacklist for easy access for child classes. diff --git a/freqtrade/plugins/pairlist/PrecisionFilter.py b/freqtrade/plugins/pairlist/PrecisionFilter.py index a3c262e8c..ff2283a62 100644 --- a/freqtrade/plugins/pairlist/PrecisionFilter.py +++ b/freqtrade/plugins/pairlist/PrecisionFilter.py @@ -18,6 +18,7 @@ class PrecisionFilter(IPairList): pairlist_pos: int) -> None: super().__init__(exchange, pairlistmanager, config, pairlistconfig, pairlist_pos) + # TODO-mg: Liquidation price? if 'stoploss' not in self._config: raise OperationalException( 'PrecisionFilter can only work with stoploss defined. Please add the ' diff --git a/freqtrade/plugins/pairlist/StaticPairList.py b/freqtrade/plugins/pairlist/StaticPairList.py index d8623e13d..297e0adfc 100644 --- a/freqtrade/plugins/pairlist/StaticPairList.py +++ b/freqtrade/plugins/pairlist/StaticPairList.py @@ -47,6 +47,7 @@ class StaticPairList(IPairList): Generate the pairlist :param tickers: Tickers (from exchange.get_tickers()). May be cached. :return: List of pairs + #TODO-mg: Add short_whitelist """ if self._allow_inactive: return self.verify_whitelist( diff --git a/freqtrade/plugins/pairlistmanager.py b/freqtrade/plugins/pairlistmanager.py index 03f4760b8..c4d3785d9 100644 --- a/freqtrade/plugins/pairlistmanager.py +++ b/freqtrade/plugins/pairlistmanager.py @@ -24,6 +24,8 @@ class PairListManager(): self._config = config self._whitelist = self._config['exchange'].get('pair_whitelist') self._blacklist = self._config['exchange'].get('pair_blacklist', []) + # TODO-mg: Add short whitelist and blacklist + # TODO-mg: Handle filtering of coins which can trade at min leverage self._pairlist_handlers: List[IPairList] = [] self._tickers_needed = False for pairlist_handler_config in self._config.get('pairlists', None): diff --git a/freqtrade/plugins/protections/max_drawdown_protection.py b/freqtrade/plugins/protections/max_drawdown_protection.py index 67e204039..2971252bc 100644 --- a/freqtrade/plugins/protections/max_drawdown_protection.py +++ b/freqtrade/plugins/protections/max_drawdown_protection.py @@ -36,6 +36,7 @@ class MaxDrawdown(IProtection): """ LockReason to use """ + # TODO-mg: < for shorts? return (f'{drawdown} > {self._max_allowed_drawdown} in {self.lookback_period_str}, ' f'locking for {self.stop_duration_str}.') @@ -59,6 +60,7 @@ class MaxDrawdown(IProtection): except ValueError: return False, None, None + # TODO-mg: < for shorts? if drawdown > self._max_allowed_drawdown: self.log_once( f"Trading stopped due to Max Drawdown {drawdown:.2f} > {self._max_allowed_drawdown}" diff --git a/freqtrade/plugins/protections/stoploss_guard.py b/freqtrade/plugins/protections/stoploss_guard.py index 45d393411..772bbf472 100644 --- a/freqtrade/plugins/protections/stoploss_guard.py +++ b/freqtrade/plugins/protections/stoploss_guard.py @@ -32,6 +32,7 @@ class StoplossGuard(IProtection): def _reason(self) -> str: """ LockReason to use + #TODO-mg: check if min is the right word for shorts """ return (f'{self._trade_limit} stoplosses in {self._lookback_period} min, ' f'locking for {self._stop_duration} min.') @@ -51,6 +52,8 @@ class StoplossGuard(IProtection): # if pair: # filters.append(Trade.pair == pair) # trades = Trade.get_trades(filters).all() + # TODO-mg: Update to ExitType + # TODO-mg: Liquidation price? trades1 = Trade.get_trades_proxy(pair=pair, is_open=False, close_date=look_back_until) trades = [trade for trade in trades1 if (str(trade.sell_reason) in ( diff --git a/freqtrade/resolvers/strategy_resolver.py b/freqtrade/resolvers/strategy_resolver.py index 1239b78b3..6b61446ab 100644 --- a/freqtrade/resolvers/strategy_resolver.py +++ b/freqtrade/resolvers/strategy_resolver.py @@ -61,6 +61,7 @@ class StrategyResolver(IResolver): strategy.stoploss = params.get('stoploss', {}).get('stoploss', strategy.stoploss) trailing = params.get('trailing', {}) strategy.trailing_stop = trailing.get('trailing_stop', strategy.trailing_stop) + # TODO-mg: Check if trailing_stop_positive will work with shorts strategy.trailing_stop_positive = trailing.get('trailing_stop_positive', strategy.trailing_stop_positive) strategy.trailing_stop_positive_offset = trailing.get( @@ -71,6 +72,7 @@ class StrategyResolver(IResolver): # Set attributes # Check if we need to override configuration # (Attribute name, default, subkey) + # TODO-mg: Add short and leverage properties attributes = [("minimal_roi", {"0": 10.0}), ("timeframe", None), ("stoploss", None), @@ -198,6 +200,7 @@ class StrategyResolver(IResolver): add_source=True, kwargs={'config': config}, ) + # TODO-mg: populate short_trend and exit_short_trend if strategy: strategy._populate_fun_len = len(getfullargspec(strategy.populate_indicators).args) strategy._buy_fun_len = len(getfullargspec(strategy.populate_buy_trend).args) diff --git a/freqtrade/rpc/rpc_manager.py b/freqtrade/rpc/rpc_manager.py index 18ed68041..4a3f22623 100644 --- a/freqtrade/rpc/rpc_manager.py +++ b/freqtrade/rpc/rpc_manager.py @@ -15,6 +15,7 @@ class RPCManager: """ Class to manage RPC objects (Telegram, Slack, ...) """ + # TODO-mg: Add new configuration options introduced with leveraged/short trading def __init__(self, freqtrade) -> None: """ Initializes all enabled rpc modules """ self.registered_modules: List[RPCHandler] = [] diff --git a/freqtrade/rpc/webhook.py b/freqtrade/rpc/webhook.py index b4c55649e..b503e7c91 100644 --- a/freqtrade/rpc/webhook.py +++ b/freqtrade/rpc/webhook.py @@ -17,6 +17,7 @@ logger.debug('Included module rpc.webhook ...') class Webhook(RPCHandler): """ This class handles all webhook communication """ + # TODO-mg: Add short webhooks def __init__(self, rpc: RPC, config: Dict[str, Any]) -> None: """