fix percentage formating in execute_sell
This commit is contained in:
parent
08a1d3ca1d
commit
460dfa1031
@ -92,13 +92,13 @@ def execute_sell(trade: Trade, limit: float) -> None:
|
|||||||
trade.open_order_id = order_id
|
trade.open_order_id = order_id
|
||||||
trade.close_date = datetime.utcnow()
|
trade.close_date = datetime.utcnow()
|
||||||
|
|
||||||
exp_profit = round(trade.calc_profit(limit), 2)
|
fmt_exp_profit = round(trade.calc_profit(limit) * 100, 2)
|
||||||
message = '*{}:* Selling [{}]({}) with limit `{:f} (profit: ~{}%)`'.format(
|
message = '*{}:* Selling [{}]({}) with limit `{:f} (profit: ~{}%)`'.format(
|
||||||
trade.exchange,
|
trade.exchange,
|
||||||
trade.pair.replace('_', '/'),
|
trade.pair.replace('_', '/'),
|
||||||
exchange.get_pair_detail_url(trade.pair),
|
exchange.get_pair_detail_url(trade.pair),
|
||||||
limit,
|
limit,
|
||||||
exp_profit
|
fmt_exp_profit
|
||||||
)
|
)
|
||||||
logger.info(message)
|
logger.info(message)
|
||||||
telegram.send_msg(message)
|
telegram.send_msg(message)
|
||||||
|
@ -195,7 +195,7 @@ def test_forcesell_handle(conf, update, mocker):
|
|||||||
|
|
||||||
assert msg_mock.call_count == 2
|
assert msg_mock.call_count == 2
|
||||||
assert 'Selling [BTC/ETH]' in msg_mock.call_args_list[-1][0][0]
|
assert 'Selling [BTC/ETH]' in msg_mock.call_args_list[-1][0][0]
|
||||||
assert '0.072561' in msg_mock.call_args_list[-1][0][0]
|
assert '0.072561 (profit: ~-0.5%)' in msg_mock.call_args_list[-1][0][0]
|
||||||
|
|
||||||
|
|
||||||
def test_performance_handle(conf, update, mocker):
|
def test_performance_handle(conf, update, mocker):
|
||||||
|
Loading…
Reference in New Issue
Block a user