Add loss instead of profit

This commit is contained in:
seansan 2017-12-21 15:26:38 +01:00 committed by GitHub
parent 974815cb14
commit 381967bfb8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -119,11 +119,15 @@ def execute_sell(trade: Trade, limit: float) -> None:
trade.open_order_id = order_id
fmt_exp_profit = round(trade.calc_profit(limit) * 100, 2)
rpc.send_msg('*{}:* Selling [{}]({}) with limit `{:.8f} (profit: ~{:.2f}%)`'.format(
_txtprofit = 'profit'
if fmt_exp_profit < 0:
_txtprofit = 'loss'
rpc.send_msg('*{}:* Selling [{}]({}) with limit `{:.8f} ({}: ~{:.2f}%)`'.format(
trade.exchange,
trade.pair.replace('_', '/'),
exchange.get_pair_detail_url(trade.pair),
limit,
_txtprofit,
fmt_exp_profit
))
Trade.session.flush()