fix percentage formating in execute_sell

This commit is contained in:
gcarq 2017-11-01 17:39:32 +01:00
parent 08a1d3ca1d
commit 460dfa1031
2 changed files with 3 additions and 3 deletions

View File

@ -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)

View File

@ -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):