when selling, show more information about the trade in the message
This commit is contained in:
parent
408f120612
commit
bd356f3eb4
@ -191,12 +191,25 @@ def execute_sell(trade: Trade, limit: float) -> None:
|
|||||||
|
|
||||||
fmt_exp_profit = round(trade.calc_profit_percent(rate=limit) * 100, 2)
|
fmt_exp_profit = round(trade.calc_profit_percent(rate=limit) * 100, 2)
|
||||||
profit_trade = trade.calc_profit(rate=limit)
|
profit_trade = trade.calc_profit(rate=limit)
|
||||||
|
current_rate = exchange.get_ticker(trade.pair, False)['bid']
|
||||||
|
current_profit = trade.calc_profit_percent(current_rate)
|
||||||
|
|
||||||
message = '*{exchange}:* Selling [{pair}]({pair_url}) with limit `{limit:.8f}`'.format(
|
message = """*{exchange}:* Selling
|
||||||
|
*Current Pair:* [{pair}]({pair_url})
|
||||||
|
*Limit:* `{limit}`
|
||||||
|
*Amount:* `{amount}`
|
||||||
|
*Open Rate:* `{open_rate:.8f}`
|
||||||
|
*Current Rate:* `{current_rate:.8f}`
|
||||||
|
*Current Profit:* `{current_profit:.2f}%`
|
||||||
|
""".format(
|
||||||
exchange=trade.exchange,
|
exchange=trade.exchange,
|
||||||
pair=trade.pair.replace('_', '/'),
|
pair=trade.pair.replace('_', '/'),
|
||||||
pair_url=exchange.get_pair_detail_url(trade.pair),
|
pair_url=exchange.get_pair_detail_url(trade.pair),
|
||||||
limit=limit
|
limit=limit,
|
||||||
|
open_rate=trade.open_rate,
|
||||||
|
current_rate=current_rate,
|
||||||
|
amount=round(trade.amount, 8),
|
||||||
|
current_profit=round(current_profit * 100, 2),
|
||||||
)
|
)
|
||||||
|
|
||||||
# For regular case, when the configuration exists
|
# For regular case, when the configuration exists
|
||||||
|
@ -147,7 +147,7 @@ def _status(bot: Bot, update: Update) -> None:
|
|||||||
) if trade.close_profit else None
|
) if trade.close_profit else None
|
||||||
message = """
|
message = """
|
||||||
*Trade ID:* `{trade_id}`
|
*Trade ID:* `{trade_id}`
|
||||||
*Current Pair:* [{pair}]({market_url})
|
*Current Pair:* [{pair}]({pair_url})
|
||||||
*Open Since:* `{date}`
|
*Open Since:* `{date}`
|
||||||
*Amount:* `{amount}`
|
*Amount:* `{amount}`
|
||||||
*Open Rate:* `{open_rate:.8f}`
|
*Open Rate:* `{open_rate:.8f}`
|
||||||
@ -158,8 +158,8 @@ def _status(bot: Bot, update: Update) -> None:
|
|||||||
*Open Order:* `{open_order}`
|
*Open Order:* `{open_order}`
|
||||||
""".format(
|
""".format(
|
||||||
trade_id=trade.id,
|
trade_id=trade.id,
|
||||||
pair=trade.pair,
|
pair=trade.pair.replace('_', '/'),
|
||||||
market_url=exchange.get_pair_detail_url(trade.pair),
|
pair_url=exchange.get_pair_detail_url(trade.pair),
|
||||||
date=arrow.get(trade.open_date).humanize(),
|
date=arrow.get(trade.open_date).humanize(),
|
||||||
open_rate=trade.open_rate,
|
open_rate=trade.open_rate,
|
||||||
close_rate=trade.close_rate,
|
close_rate=trade.close_rate,
|
||||||
|
Loading…
Reference in New Issue
Block a user