Skip to content

Commit 1c4d33c

Browse files
committed
chore: simplify execute_entry logic
1 parent 33ec55f commit 1c4d33c

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

freqtrade/freqtradebot.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,13 +1000,15 @@ def execute_entry(
10001000
# Fee is applied twice because we make a LIMIT_BUY and LIMIT_SELL
10011001
fee = self.exchange.get_fee(symbol=pair, taker_or_maker="maker")
10021002
base_currency = self.exchange.get_pair_base_currency(pair)
1003-
open_date = datetime.now(UTC)
1004-
1005-
funding_fees = self.exchange.get_funding_fees(
1006-
pair=pair,
1007-
amount=trade.amount if trade else amount,
1008-
is_short=is_short,
1009-
open_date=trade.date_last_filled_utc if trade else open_date,
1003+
funding_fees = (
1004+
self.exchange.get_funding_fees(
1005+
pair=pair,
1006+
amount=trade.amount,
1007+
is_short=is_short,
1008+
open_date=trade.date_last_filled_utc,
1009+
)
1010+
if trade
1011+
else 0
10101012
)
10111013

10121014
# This is a new trade
@@ -1023,7 +1025,7 @@ def execute_entry(
10231025
fee_close=fee,
10241026
open_rate=enter_limit_filled_price,
10251027
open_rate_requested=enter_limit_requested,
1026-
open_date=open_date,
1028+
open_date=datetime.now(UTC),
10271029
exchange=self.exchange.id,
10281030
strategy=self.strategy.get_strategy_name(),
10291031
enter_tag=enter_tag,

0 commit comments

Comments
 (0)