check for None to allow 0.0 profit
This commit is contained in:
parent
3e3cce4559
commit
b2125bd6ee
@ -131,11 +131,11 @@ class RPC:
|
||||
current_rate = NAN
|
||||
current_profit = trade.calc_profit_ratio(current_rate)
|
||||
fmt_close_profit = (f'{round(trade.close_profit * 100, 2):.2f}%'
|
||||
if trade.close_profit else None)
|
||||
if trade.close_profit is not None else None)
|
||||
trade_dict = trade.to_json()
|
||||
trade_dict.update(dict(
|
||||
base_currency=self._freqtrade.config['stake_currency'],
|
||||
close_profit=trade.close_profit or None,
|
||||
close_profit=trade.close_profit if trade.close_profit is not None else None,
|
||||
close_profit_pct=fmt_close_profit,
|
||||
current_rate=current_rate,
|
||||
current_profit=current_profit,
|
||||
|
@ -215,13 +215,15 @@ class Telegram(RPC):
|
||||
"*Open Rate:* `{open_rate:.8f}`",
|
||||
"*Close Rate:* `{close_rate}`" if r['close_rate'] else "",
|
||||
"*Current Rate:* `{current_rate:.8f}`",
|
||||
"*Close Profit:* `{close_profit_pct}`" if r['close_profit_pct'] else "",
|
||||
("*Close Profit:* `{close_profit_pct}`"
|
||||
if r['close_profit_pct'] is not None else ""),
|
||||
"*Current Profit:* `{current_profit_pct:.2f}%`",
|
||||
|
||||
# Adding initial stoploss only if it is different from stoploss
|
||||
"*Initial Stoploss:* `{initial_stop_loss:.8f}` " +
|
||||
("`({initial_stop_loss_pct:.2f}%)`" if r['initial_stop_loss_pct'] else "")
|
||||
if r['stop_loss'] != r['initial_stop_loss'] else "",
|
||||
("`({initial_stop_loss_pct:.2f}%)`") if (
|
||||
r['stop_loss'] != r['initial_stop_loss']
|
||||
and r['initial_stop_loss_pct'] is not None) else "",
|
||||
|
||||
# Adding stoploss and stoploss percentage only if it is not None
|
||||
"*Stoploss:* `{stop_loss:.8f}` " +
|
||||
|
Loading…
Reference in New Issue
Block a user