mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-11-29 00:23:07 +00:00
fix: oddly wrong fee_cost calculation
This commit is contained in:
@@ -1236,7 +1236,7 @@ class LocalTrade:
|
||||
self.open_rate = float(current_stake / current_amount)
|
||||
self.amount = current_amount_tr
|
||||
self.stake_amount = float(current_stake) / (self.leverage or 1.0)
|
||||
self.fee_open_cost = self.fee_open * float(current_stake)
|
||||
self.fee_open_cost = self.fee_open * float(self.max_stake_amount)
|
||||
self.recalc_open_trade_value()
|
||||
if self.stop_loss_pct is not None and self.open_rate is not None:
|
||||
self.adjust_stop_loss(self.open_rate, self.stop_loss_pct)
|
||||
|
||||
@@ -2571,7 +2571,7 @@ def test_recalc_trade_from_orders_ignores_bad_orders(fee, is_short):
|
||||
assert trade.amount == 2 * o1_amount
|
||||
assert trade.stake_amount == 2 * o1_amount
|
||||
assert trade.open_rate == o1_rate
|
||||
assert trade.fee_open_cost == 2 * o1_fee_cost
|
||||
assert trade.fee_open_cost == trade.nr_of_successful_entries * o1_fee_cost
|
||||
assert trade.open_trade_value == 2 * o1_trade_val
|
||||
assert trade.nr_of_successful_entries == 2
|
||||
|
||||
@@ -2598,7 +2598,7 @@ def test_recalc_trade_from_orders_ignores_bad_orders(fee, is_short):
|
||||
assert trade.amount == o1_amount
|
||||
assert trade.stake_amount == o1_amount
|
||||
assert trade.open_rate == o1_rate
|
||||
assert trade.fee_open_cost == o1_fee_cost
|
||||
assert trade.fee_open_cost == trade.nr_of_successful_entries * o1_fee_cost
|
||||
assert trade.open_trade_value == o1_trade_val
|
||||
assert trade.nr_of_successful_entries == 2
|
||||
|
||||
@@ -2626,7 +2626,7 @@ def test_recalc_trade_from_orders_ignores_bad_orders(fee, is_short):
|
||||
assert trade.amount == 2 * o1_amount
|
||||
assert trade.stake_amount == 2 * o1_amount
|
||||
assert trade.open_rate == o1_rate
|
||||
assert trade.fee_open_cost == 2 * o1_fee_cost
|
||||
assert trade.fee_open_cost == trade.nr_of_successful_entries * o1_fee_cost
|
||||
assert trade.open_trade_value == 2 * o1_trade_val
|
||||
assert trade.nr_of_successful_entries == 3
|
||||
|
||||
|
||||
Reference in New Issue
Block a user