Further improve behavior for telegram /status with stop on exchange

This commit is contained in:
Matthias 2023-02-27 19:40:02 +01:00
parent 87fe4108a2
commit e482feed7d

View File

@ -487,13 +487,17 @@ class Telegram(RPCHandler):
f"*Amount:* {cur_entry_amount} ({order['cost']:.8f} {quote_currency})") f"*Amount:* {cur_entry_amount} ({order['cost']:.8f} {quote_currency})")
lines.append(f"*Average Price:* {cur_entry_average}") lines.append(f"*Average Price:* {cur_entry_average}")
else: else:
sumA = 0 sum_stake = 0
sumB = 0 sum_amount = 0
for y in range(order_nr): for y in range(order_nr):
amount = filled_orders[y]["filled"] or filled_orders[y]["amount"] loc_order = filled_orders[y]
sumA += amount * filled_orders[y]["safe_price"] if loc_order['is_open'] is True:
sumB += amount # Skip open orders (e.g. stop orders)
prev_avg_price = sumA / sumB continue
amount = loc_order["filled"] or loc_order["amount"]
sum_stake += amount * loc_order["safe_price"]
sum_amount += amount
prev_avg_price = sum_stake / sum_amount
# TODO: This calculation ignores fees. # TODO: This calculation ignores fees.
price_to_1st_entry = ((cur_entry_average - first_avg) / first_avg) price_to_1st_entry = ((cur_entry_average - first_avg) / first_avg)
minus_on_entry = 0 minus_on_entry = 0