Finished running through all of freqtrade and adding Todos
This commit is contained in:
parent
31cd136e94
commit
52f9b65d62
@ -71,6 +71,8 @@ def process_temporary_deprecated_settings(config: Dict[str, Any]) -> None:
|
|||||||
# Kept for future deprecated / moved settings
|
# Kept for future deprecated / moved settings
|
||||||
# check_conflicting_settings(config, 'ask_strategy', 'use_sell_signal',
|
# check_conflicting_settings(config, 'ask_strategy', 'use_sell_signal',
|
||||||
# 'experimental', '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',
|
process_deprecated_setting(config, 'ask_strategy', 'use_sell_signal',
|
||||||
None, 'use_sell_signal')
|
None, 'use_sell_signal')
|
||||||
process_deprecated_setting(config, 'ask_strategy', 'sell_profit_only',
|
process_deprecated_setting(config, 'ask_strategy', 'sell_profit_only',
|
||||||
|
@ -35,7 +35,7 @@ def init_plotscript(config, markets: List, startup_candles: int = 0):
|
|||||||
Initialize objects needed for plotting
|
Initialize objects needed for plotting
|
||||||
:return: Dict with candle (OHLCV) data, trades and pairs
|
:return: Dict with candle (OHLCV) data, trades and pairs
|
||||||
"""
|
"""
|
||||||
|
# TODO-mg: Add short whitelist
|
||||||
if "pairs" in config:
|
if "pairs" in config:
|
||||||
pairs = expand_pairlist(config['pairs'], markets)
|
pairs = expand_pairlist(config['pairs'], markets)
|
||||||
else:
|
else:
|
||||||
@ -192,10 +192,12 @@ def plot_trades(fig, trades: pd.DataFrame) -> make_subplots:
|
|||||||
# Trades can be empty
|
# Trades can be empty
|
||||||
if trades is not None and len(trades) > 0:
|
if trades is not None and len(trades) > 0:
|
||||||
# Create description for sell summarizing the trade
|
# 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)}%, "
|
trades['desc'] = trades.apply(lambda row: f"{round(row['profit_ratio'] * 100, 1)}%, "
|
||||||
f"{row['sell_reason']}, "
|
f"{row['sell_reason']}, "
|
||||||
f"{row['trade_duration']} min",
|
f"{row['trade_duration']} min",
|
||||||
axis=1)
|
axis=1)
|
||||||
|
# TODO-mg: Update to Trade enter
|
||||||
trade_buys = go.Scatter(
|
trade_buys = go.Scatter(
|
||||||
x=trades["open_date"],
|
x=trades["open_date"],
|
||||||
y=trades["open_rate"],
|
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(
|
trade_sells = go.Scatter(
|
||||||
x=trades.loc[trades['profit_ratio'] > 0, "close_date"],
|
x=trades.loc[trades['profit_ratio'] > 0, "close_date"],
|
||||||
y=trades.loc[trades['profit_ratio'] > 0, "close_rate"],
|
y=trades.loc[trades['profit_ratio'] > 0, "close_rate"],
|
||||||
@ -224,6 +226,7 @@ def plot_trades(fig, trades: pd.DataFrame) -> make_subplots:
|
|||||||
color='green'
|
color='green'
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
# TODO-mg: Update to trade_exits_loss, Exit - Loss
|
||||||
trade_sells_loss = go.Scatter(
|
trade_sells_loss = go.Scatter(
|
||||||
x=trades.loc[trades['profit_ratio'] <= 0, "close_date"],
|
x=trades.loc[trades['profit_ratio'] <= 0, "close_date"],
|
||||||
y=trades.loc[trades['profit_ratio'] <= 0, "close_rate"],
|
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)
|
fig.add_trace(candles, 1, 1)
|
||||||
|
|
||||||
|
# TODO-mg: Update buy to enter
|
||||||
if 'buy' in data.columns:
|
if 'buy' in data.columns:
|
||||||
df_buy = data[data['buy'] == 1]
|
df_buy = data[data['buy'] == 1]
|
||||||
if len(df_buy) > 0:
|
if len(df_buy) > 0:
|
||||||
@ -405,6 +409,7 @@ def generate_candlestick_graph(pair: str, data: pd.DataFrame, trades: pd.DataFra
|
|||||||
else:
|
else:
|
||||||
logger.warning("No buy-signals found.")
|
logger.warning("No buy-signals found.")
|
||||||
|
|
||||||
|
# TODO-mg: Update sell to exit
|
||||||
if 'sell' in data.columns:
|
if 'sell' in data.columns:
|
||||||
df_sell = data[data['sell'] == 1]
|
df_sell = data[data['sell'] == 1]
|
||||||
if len(df_sell) > 0:
|
if len(df_sell) > 0:
|
||||||
|
@ -114,6 +114,8 @@ class IPairList(LoggingMixin, ABC):
|
|||||||
|
|
||||||
return pairlist
|
return pairlist
|
||||||
|
|
||||||
|
# TODO-mg: verify_short_whitelist, verify_short_blacklist?
|
||||||
|
|
||||||
def verify_blacklist(self, pairlist: List[str], logmethod) -> List[str]:
|
def verify_blacklist(self, pairlist: List[str], logmethod) -> List[str]:
|
||||||
"""
|
"""
|
||||||
Proxy method to verify_blacklist for easy access for child classes.
|
Proxy method to verify_blacklist for easy access for child classes.
|
||||||
|
@ -18,6 +18,7 @@ class PrecisionFilter(IPairList):
|
|||||||
pairlist_pos: int) -> None:
|
pairlist_pos: int) -> None:
|
||||||
super().__init__(exchange, pairlistmanager, config, pairlistconfig, pairlist_pos)
|
super().__init__(exchange, pairlistmanager, config, pairlistconfig, pairlist_pos)
|
||||||
|
|
||||||
|
# TODO-mg: Liquidation price?
|
||||||
if 'stoploss' not in self._config:
|
if 'stoploss' not in self._config:
|
||||||
raise OperationalException(
|
raise OperationalException(
|
||||||
'PrecisionFilter can only work with stoploss defined. Please add the '
|
'PrecisionFilter can only work with stoploss defined. Please add the '
|
||||||
|
@ -47,6 +47,7 @@ class StaticPairList(IPairList):
|
|||||||
Generate the pairlist
|
Generate the pairlist
|
||||||
:param tickers: Tickers (from exchange.get_tickers()). May be cached.
|
:param tickers: Tickers (from exchange.get_tickers()). May be cached.
|
||||||
:return: List of pairs
|
:return: List of pairs
|
||||||
|
#TODO-mg: Add short_whitelist
|
||||||
"""
|
"""
|
||||||
if self._allow_inactive:
|
if self._allow_inactive:
|
||||||
return self.verify_whitelist(
|
return self.verify_whitelist(
|
||||||
|
@ -24,6 +24,8 @@ class PairListManager():
|
|||||||
self._config = config
|
self._config = config
|
||||||
self._whitelist = self._config['exchange'].get('pair_whitelist')
|
self._whitelist = self._config['exchange'].get('pair_whitelist')
|
||||||
self._blacklist = self._config['exchange'].get('pair_blacklist', [])
|
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._pairlist_handlers: List[IPairList] = []
|
||||||
self._tickers_needed = False
|
self._tickers_needed = False
|
||||||
for pairlist_handler_config in self._config.get('pairlists', None):
|
for pairlist_handler_config in self._config.get('pairlists', None):
|
||||||
|
@ -36,6 +36,7 @@ class MaxDrawdown(IProtection):
|
|||||||
"""
|
"""
|
||||||
LockReason to use
|
LockReason to use
|
||||||
"""
|
"""
|
||||||
|
# TODO-mg: < for shorts?
|
||||||
return (f'{drawdown} > {self._max_allowed_drawdown} in {self.lookback_period_str}, '
|
return (f'{drawdown} > {self._max_allowed_drawdown} in {self.lookback_period_str}, '
|
||||||
f'locking for {self.stop_duration_str}.')
|
f'locking for {self.stop_duration_str}.')
|
||||||
|
|
||||||
@ -59,6 +60,7 @@ class MaxDrawdown(IProtection):
|
|||||||
except ValueError:
|
except ValueError:
|
||||||
return False, None, None
|
return False, None, None
|
||||||
|
|
||||||
|
# TODO-mg: < for shorts?
|
||||||
if drawdown > self._max_allowed_drawdown:
|
if drawdown > self._max_allowed_drawdown:
|
||||||
self.log_once(
|
self.log_once(
|
||||||
f"Trading stopped due to Max Drawdown {drawdown:.2f} > {self._max_allowed_drawdown}"
|
f"Trading stopped due to Max Drawdown {drawdown:.2f} > {self._max_allowed_drawdown}"
|
||||||
|
@ -32,6 +32,7 @@ class StoplossGuard(IProtection):
|
|||||||
def _reason(self) -> str:
|
def _reason(self) -> str:
|
||||||
"""
|
"""
|
||||||
LockReason to use
|
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, '
|
return (f'{self._trade_limit} stoplosses in {self._lookback_period} min, '
|
||||||
f'locking for {self._stop_duration} min.')
|
f'locking for {self._stop_duration} min.')
|
||||||
@ -51,6 +52,8 @@ class StoplossGuard(IProtection):
|
|||||||
# if pair:
|
# if pair:
|
||||||
# filters.append(Trade.pair == pair)
|
# filters.append(Trade.pair == pair)
|
||||||
# trades = Trade.get_trades(filters).all()
|
# 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)
|
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 (
|
trades = [trade for trade in trades1 if (str(trade.sell_reason) in (
|
||||||
|
@ -61,6 +61,7 @@ class StrategyResolver(IResolver):
|
|||||||
strategy.stoploss = params.get('stoploss', {}).get('stoploss', strategy.stoploss)
|
strategy.stoploss = params.get('stoploss', {}).get('stoploss', strategy.stoploss)
|
||||||
trailing = params.get('trailing', {})
|
trailing = params.get('trailing', {})
|
||||||
strategy.trailing_stop = trailing.get('trailing_stop', strategy.trailing_stop)
|
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 = trailing.get('trailing_stop_positive',
|
||||||
strategy.trailing_stop_positive)
|
strategy.trailing_stop_positive)
|
||||||
strategy.trailing_stop_positive_offset = trailing.get(
|
strategy.trailing_stop_positive_offset = trailing.get(
|
||||||
@ -71,6 +72,7 @@ class StrategyResolver(IResolver):
|
|||||||
# Set attributes
|
# Set attributes
|
||||||
# Check if we need to override configuration
|
# Check if we need to override configuration
|
||||||
# (Attribute name, default, subkey)
|
# (Attribute name, default, subkey)
|
||||||
|
# TODO-mg: Add short and leverage properties
|
||||||
attributes = [("minimal_roi", {"0": 10.0}),
|
attributes = [("minimal_roi", {"0": 10.0}),
|
||||||
("timeframe", None),
|
("timeframe", None),
|
||||||
("stoploss", None),
|
("stoploss", None),
|
||||||
@ -198,6 +200,7 @@ class StrategyResolver(IResolver):
|
|||||||
add_source=True,
|
add_source=True,
|
||||||
kwargs={'config': config},
|
kwargs={'config': config},
|
||||||
)
|
)
|
||||||
|
# TODO-mg: populate short_trend and exit_short_trend
|
||||||
if strategy:
|
if strategy:
|
||||||
strategy._populate_fun_len = len(getfullargspec(strategy.populate_indicators).args)
|
strategy._populate_fun_len = len(getfullargspec(strategy.populate_indicators).args)
|
||||||
strategy._buy_fun_len = len(getfullargspec(strategy.populate_buy_trend).args)
|
strategy._buy_fun_len = len(getfullargspec(strategy.populate_buy_trend).args)
|
||||||
|
@ -15,6 +15,7 @@ class RPCManager:
|
|||||||
"""
|
"""
|
||||||
Class to manage RPC objects (Telegram, Slack, ...)
|
Class to manage RPC objects (Telegram, Slack, ...)
|
||||||
"""
|
"""
|
||||||
|
# TODO-mg: Add new configuration options introduced with leveraged/short trading
|
||||||
def __init__(self, freqtrade) -> None:
|
def __init__(self, freqtrade) -> None:
|
||||||
""" Initializes all enabled rpc modules """
|
""" Initializes all enabled rpc modules """
|
||||||
self.registered_modules: List[RPCHandler] = []
|
self.registered_modules: List[RPCHandler] = []
|
||||||
|
@ -17,6 +17,7 @@ logger.debug('Included module rpc.webhook ...')
|
|||||||
|
|
||||||
class Webhook(RPCHandler):
|
class Webhook(RPCHandler):
|
||||||
""" This class handles all webhook communication """
|
""" This class handles all webhook communication """
|
||||||
|
# TODO-mg: Add short webhooks
|
||||||
|
|
||||||
def __init__(self, rpc: RPC, config: Dict[str, Any]) -> None:
|
def __init__(self, rpc: RPC, config: Dict[str, Any]) -> None:
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user