show buy_tag only if not None

This commit is contained in:
Italo
2022-01-20 18:44:09 +00:00
parent 8ce5536dd8
commit a9f14ac119
2 changed files with 4 additions and 4 deletions

View File

@@ -235,9 +235,9 @@ 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
trades['desc'] = trades.apply(lambda row: f"{row['profit_ratio']:.2%}, "
f"{row['buy_tag']}, "
f"{row['sell_reason']}, "
trades['desc'] = trades.apply(lambda row: f"{row['profit_ratio']:.2%}, " + \
(f"{row['buy_tag']}, " if row['buy_tag'] is not None else "") + \
f"{row['sell_reason']}, " + \
f"{row['trade_duration']} min",
axis=1)
trade_buys = go.Scatter(