Improve variable wording
This commit is contained in:
		| @@ -283,6 +283,9 @@ class OpenTradeSchema(TradeSchema): | |||||||
|     stoploss_entry_dist: Optional[float] |     stoploss_entry_dist: Optional[float] | ||||||
|     stoploss_entry_dist_ratio: Optional[float] |     stoploss_entry_dist_ratio: Optional[float] | ||||||
|     current_rate: float |     current_rate: float | ||||||
|  |     total_profit_abs: float | ||||||
|  |     total_profit_fiat: Optional[float] | ||||||
|  |  | ||||||
|     open_order: Optional[str] |     open_order: Optional[str] | ||||||
|  |  | ||||||
|  |  | ||||||
|   | |||||||
| @@ -169,7 +169,7 @@ class RPC: | |||||||
|             for trade in trades: |             for trade in trades: | ||||||
|                 order: Optional[Order] = None |                 order: Optional[Order] = None | ||||||
|                 current_profit_fiat: Optional[float] = None |                 current_profit_fiat: Optional[float] = None | ||||||
|                 combined_profit_fiat: Optional[float] = None |                 total_profit_fiat: Optional[float] = None | ||||||
|                 if trade.open_order_id: |                 if trade.open_order_id: | ||||||
|                     order = trade.select_order_by_order_id(trade.open_order_id) |                     order = trade.select_order_by_order_id(trade.open_order_id) | ||||||
|                 # calculate profit and send message to user |                 # calculate profit and send message to user | ||||||
| @@ -191,7 +191,7 @@ class RPC: | |||||||
|                     current_rate = trade.close_rate |                     current_rate = trade.close_rate | ||||||
|                     current_profit = trade.close_profit |                     current_profit = trade.close_profit | ||||||
|                     current_profit_abs = trade.close_profit_abs |                     current_profit_abs = trade.close_profit_abs | ||||||
|                 combined_profit_abs = trade.realized_profit + current_profit_abs |                 total_profit_abs = trade.realized_profit + current_profit_abs | ||||||
|  |  | ||||||
|                 # Calculate fiat profit |                 # Calculate fiat profit | ||||||
|                 if not isnan(current_profit_abs) and self._fiat_converter: |                 if not isnan(current_profit_abs) and self._fiat_converter: | ||||||
| @@ -200,8 +200,8 @@ class RPC: | |||||||
|                         self._freqtrade.config['stake_currency'], |                         self._freqtrade.config['stake_currency'], | ||||||
|                         self._freqtrade.config['fiat_display_currency'] |                         self._freqtrade.config['fiat_display_currency'] | ||||||
|                     ) |                     ) | ||||||
|                     combined_profit_fiat = self._fiat_converter.convert_amount( |                     total_profit_fiat = self._fiat_converter.convert_amount( | ||||||
|                         combined_profit_abs, |                         total_profit_abs, | ||||||
|                         self._freqtrade.config['stake_currency'], |                         self._freqtrade.config['stake_currency'], | ||||||
|                         self._freqtrade.config['fiat_display_currency'] |                         self._freqtrade.config['fiat_display_currency'] | ||||||
|                     ) |                     ) | ||||||
| @@ -222,8 +222,8 @@ class RPC: | |||||||
|                     profit_abs=current_profit_abs, |                     profit_abs=current_profit_abs, | ||||||
|                     profit_fiat=current_profit_fiat, |                     profit_fiat=current_profit_fiat, | ||||||
|  |  | ||||||
|                     combined_profit_abs=combined_profit_abs, |                     total_profit_abs=total_profit_abs, | ||||||
|                     combined_profit_fiat=combined_profit_fiat, |                     total_profit_fiat=total_profit_fiat, | ||||||
|                     stoploss_current_dist=stoploss_current_dist, |                     stoploss_current_dist=stoploss_current_dist, | ||||||
|                     stoploss_current_dist_ratio=round(stoploss_current_dist_ratio, 8), |                     stoploss_current_dist_ratio=round(stoploss_current_dist_ratio, 8), | ||||||
|                     stoploss_current_dist_pct=round(stoploss_current_dist_ratio * 100, 2), |                     stoploss_current_dist_pct=round(stoploss_current_dist_ratio * 100, 2), | ||||||
|   | |||||||
| @@ -565,8 +565,8 @@ class Telegram(RPCHandler): | |||||||
|             r['stake_amount_r'] = round_coin_value(r['stake_amount'], r['quote_currency']) |             r['stake_amount_r'] = round_coin_value(r['stake_amount'], r['quote_currency']) | ||||||
|             r['profit_abs_r'] = round_coin_value(r['profit_abs'], r['quote_currency']) |             r['profit_abs_r'] = round_coin_value(r['profit_abs'], r['quote_currency']) | ||||||
|             r['realized_profit_r'] = round_coin_value(r['realized_profit'], r['quote_currency']) |             r['realized_profit_r'] = round_coin_value(r['realized_profit'], r['quote_currency']) | ||||||
|             r['combined_profit_abs_r'] = round_coin_value( |             r['total_profit_abs_r'] = round_coin_value( | ||||||
|                 r['combined_profit_abs'], r['quote_currency']) |                 r['total_profit_abs'], r['quote_currency']) | ||||||
|             lines = [ |             lines = [ | ||||||
|                 "*Trade ID:* `{trade_id}`" + |                 "*Trade ID:* `{trade_id}`" + | ||||||
|                 (" `(since {open_date_hum})`" if r['is_open'] else ""), |                 (" `(since {open_date_hum})`" if r['is_open'] else ""), | ||||||
| @@ -595,7 +595,7 @@ class Telegram(RPCHandler): | |||||||
|             if r['is_open']: |             if r['is_open']: | ||||||
|                 if r.get('realized_profit'): |                 if r.get('realized_profit'): | ||||||
|                     lines.append("*Realized Profit:* `{realized_profit_r}`") |                     lines.append("*Realized Profit:* `{realized_profit_r}`") | ||||||
|                     lines.append("*Total Profit:* `{combined_profit_abs_r}` ") |                     lines.append("*Total Profit:* `{total_profit_abs_r}` ") | ||||||
|  |  | ||||||
|                 if (r['stop_loss_abs'] != r['initial_stop_loss_abs'] |                 if (r['stop_loss_abs'] != r['initial_stop_loss_abs'] | ||||||
|                         and r['initial_stop_loss_ratio'] is not None): |                         and r['initial_stop_loss_ratio'] is not None): | ||||||
|   | |||||||
| @@ -76,8 +76,8 @@ def test_rpc_trade_status(default_conf, ticker, fee, mocker) -> None: | |||||||
|         'stoploss_entry_dist_ratio': -0.10376381, |         'stoploss_entry_dist_ratio': -0.10376381, | ||||||
|         'open_order': None, |         'open_order': None, | ||||||
|         'realized_profit': 0.0, |         'realized_profit': 0.0, | ||||||
|         'combined_profit_abs': -4.09e-06, |         'total_profit_abs': -4.09e-06, | ||||||
|         'combined_profit_fiat': ANY, |         'total_profit_fiat': ANY, | ||||||
|         'exchange': 'binance', |         'exchange': 'binance', | ||||||
|         'leverage': 1.0, |         'leverage': 1.0, | ||||||
|         'interest_rate': 0.0, |         'interest_rate': 0.0, | ||||||
| @@ -121,7 +121,7 @@ def test_rpc_trade_status(default_conf, ticker, fee, mocker) -> None: | |||||||
|         'profit_ratio': 0.0, |         'profit_ratio': 0.0, | ||||||
|         'profit_pct': 0.0, |         'profit_pct': 0.0, | ||||||
|         'profit_abs': 0.0, |         'profit_abs': 0.0, | ||||||
|         'combined_profit_abs': 0.0, |         'total_profit_abs': 0.0, | ||||||
|         'stop_loss_abs': 0.0, |         'stop_loss_abs': 0.0, | ||||||
|         'stop_loss_pct': None, |         'stop_loss_pct': None, | ||||||
|         'stop_loss_ratio': None, |         'stop_loss_ratio': None, | ||||||
| @@ -183,7 +183,7 @@ def test_rpc_trade_status(default_conf, ticker, fee, mocker) -> None: | |||||||
|         'profit_ratio': ANY, |         'profit_ratio': ANY, | ||||||
|         'profit_pct': ANY, |         'profit_pct': ANY, | ||||||
|         'profit_abs': ANY, |         'profit_abs': ANY, | ||||||
|         'combined_profit_abs': ANY, |         'total_profit_abs': ANY, | ||||||
|         'current_rate': ANY, |         'current_rate': ANY, | ||||||
|     }) |     }) | ||||||
|     assert results[0] == response_norate |     assert results[0] == response_norate | ||||||
|   | |||||||
| @@ -1012,6 +1012,8 @@ def test_api_status(botclient, mocker, ticker, fee, markets, is_short, | |||||||
|         'profit_pct': ANY, |         'profit_pct': ANY, | ||||||
|         'profit_abs': ANY, |         'profit_abs': ANY, | ||||||
|         'profit_fiat': ANY, |         'profit_fiat': ANY, | ||||||
|  |         'total_profit_abs': ANY, | ||||||
|  |         'total_profit_fiat': ANY, | ||||||
|         'realized_profit': 0.0, |         'realized_profit': 0.0, | ||||||
|         'current_rate': current_rate, |         'current_rate': current_rate, | ||||||
|         'open_date': ANY, |         'open_date': ANY, | ||||||
|   | |||||||
| @@ -205,7 +205,7 @@ def test_telegram_status(default_conf, update, mocker) -> None: | |||||||
|             'profit_ratio': -0.0059, |             'profit_ratio': -0.0059, | ||||||
|             'profit_abs': -0.225, |             'profit_abs': -0.225, | ||||||
|             'realized_profit': 0.0, |             'realized_profit': 0.0, | ||||||
|             'combined_profit_abs': -0.225, |             'total_profit_abs': -0.225, | ||||||
|             'initial_stop_loss_abs': 1.098e-05, |             'initial_stop_loss_abs': 1.098e-05, | ||||||
|             'stop_loss_abs': 1.099e-05, |             'stop_loss_abs': 1.099e-05, | ||||||
|             'exit_order_status': None, |             'exit_order_status': None, | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user