mirror of
https://github.com/freqtrade/freqtrade.git
synced 2026-02-16 19:20:31 +00:00
@@ -1053,7 +1053,7 @@ class LocalTrade:
|
||||
price = avg_price if is_exit else tmp_price
|
||||
current_stake += price * tmp_amount * side
|
||||
|
||||
if current_amount > ZERO:
|
||||
if current_amount > ZERO and not is_exit:
|
||||
avg_price = current_stake / current_amount
|
||||
|
||||
if is_exit:
|
||||
|
||||
@@ -2392,9 +2392,8 @@ def test_recalc_trade_from_orders_kucoin():
|
||||
trade.update_trade(order3)
|
||||
# assert trade.amount == o1_amount + o2_amount
|
||||
assert trade.is_open is False
|
||||
# The below values are wrong.
|
||||
assert trade.amount == 8e-09
|
||||
assert trade.close_profit_abs == -8270.49735089
|
||||
assert trade.close_profit_abs == 3.90069871
|
||||
|
||||
|
||||
@pytest.mark.parametrize('is_short', [True, False])
|
||||
|
||||
Reference in New Issue
Block a user