Only show long/short signals on telegram for non-spot markets

This commit is contained in:
Matthias 2022-04-09 17:09:04 +02:00
parent 81b41183a5
commit 139b65835c
2 changed files with 9 additions and 4 deletions

View File

@ -223,6 +223,7 @@ class RPC:
def _rpc_status_table(self, stake_currency: str, def _rpc_status_table(self, stake_currency: str,
fiat_display_currency: str) -> Tuple[List, List, float]: fiat_display_currency: str) -> Tuple[List, List, float]:
trades: List[Trade] = Trade.get_open_trades() trades: List[Trade] = Trade.get_open_trades()
nonspot = self._config.get('trading_mode', TradingMode.SPOT) != TradingMode.SPOT
if not trades: if not trades:
raise RPCException('no active trade') raise RPCException('no active trade')
else: else:
@ -237,7 +238,7 @@ class RPC:
current_rate = NAN current_rate = NAN
trade_profit = trade.calc_profit(current_rate) trade_profit = trade.calc_profit(current_rate)
profit_str = f'{trade.calc_profit_ratio(current_rate):.2%}' profit_str = f'{trade.calc_profit_ratio(current_rate):.2%}'
direction_str = 'S' if trade.is_short else 'L' direction_str = ('S' if trade.is_short else 'L') if nonspot else ''
if self._fiat_converter: if self._fiat_converter:
fiat_profit = self._fiat_converter.convert_amount( fiat_profit = self._fiat_converter.convert_amount(
trade_profit, trade_profit,
@ -267,7 +268,11 @@ class RPC:
if self._fiat_converter: if self._fiat_converter:
profitcol += " (" + fiat_display_currency + ")" profitcol += " (" + fiat_display_currency + ")"
columns = ['ID L/S', 'Pair', 'Since', profitcol] columns = [
'ID L/S' if nonspot else 'ID',
'Pair',
'Since',
profitcol]
if self._config.get('position_adjustment_enable', False): if self._config.get('position_adjustment_enable', False):
columns.append('# Entries') columns.append('# Entries')
return trades_list, columns, fiat_profit_sum return trades_list, columns, fiat_profit_sum

View File

@ -398,8 +398,8 @@ def test_status_table_handle(default_conf, update, ticker, fee, mocker) -> None:
fields = re.sub('[ ]+', ' ', line[2].strip()).split(' ') fields = re.sub('[ ]+', ' ', line[2].strip()).split(' ')
assert int(fields[0]) == 1 assert int(fields[0]) == 1
assert 'L' in fields[1] # assert 'L' in fields[1]
assert 'ETH/BTC' in fields[2] assert 'ETH/BTC' in fields[1]
assert msg_mock.call_count == 1 assert msg_mock.call_count == 1