mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-11-29 00:23:07 +00:00
Remove get_funding_fee error handling - it's no longer raising this error.
This commit is contained in:
@@ -316,16 +316,13 @@ class FreqtradeBot(LoggingMixin):
|
||||
if self.trading_mode == TradingMode.FUTURES:
|
||||
trades: List[Trade] = Trade.get_open_trades()
|
||||
for trade in trades:
|
||||
try:
|
||||
trade.set_funding_fees(
|
||||
self.exchange.get_funding_fees(
|
||||
pair=trade.pair,
|
||||
amount=trade.amount,
|
||||
is_short=trade.is_short,
|
||||
open_date=trade.date_last_filled_utc)
|
||||
)
|
||||
except ExchangeError:
|
||||
logger.warning(f"Could not update funding fees for open trade {trade}.")
|
||||
trade.set_funding_fees(
|
||||
self.exchange.get_funding_fees(
|
||||
pair=trade.pair,
|
||||
amount=trade.amount,
|
||||
is_short=trade.is_short,
|
||||
open_date=trade.date_last_filled_utc)
|
||||
)
|
||||
|
||||
def startup_backpopulate_precision(self) -> None:
|
||||
|
||||
@@ -835,16 +832,12 @@ class FreqtradeBot(LoggingMixin):
|
||||
base_currency = self.exchange.get_pair_base_currency(pair)
|
||||
open_date = datetime.now(timezone.utc)
|
||||
|
||||
funding_fees = 0.0
|
||||
try:
|
||||
funding_fees = self.exchange.get_funding_fees(
|
||||
pair=pair,
|
||||
amount=amount + trade.amount if trade else amount,
|
||||
is_short=is_short,
|
||||
open_date=trade.date_last_filled_utc if trade else open_date
|
||||
)
|
||||
except ExchangeError:
|
||||
logger.warning("Could not find funding fee.")
|
||||
funding_fees = self.exchange.get_funding_fees(
|
||||
pair=pair,
|
||||
amount=amount + trade.amount if trade else amount,
|
||||
is_short=is_short,
|
||||
open_date=trade.date_last_filled_utc if trade else open_date
|
||||
)
|
||||
|
||||
# This is a new trade
|
||||
if trade is None:
|
||||
@@ -1700,16 +1693,13 @@ class FreqtradeBot(LoggingMixin):
|
||||
:param exit_check: CheckTuple with signal and reason
|
||||
:return: True if it succeeds False
|
||||
"""
|
||||
try:
|
||||
trade.set_funding_fees(
|
||||
self.exchange.get_funding_fees(
|
||||
pair=trade.pair,
|
||||
amount=trade.amount,
|
||||
is_short=trade.is_short,
|
||||
open_date=trade.date_last_filled_utc)
|
||||
)
|
||||
except ExchangeError:
|
||||
logger.warning("Could not update funding fee.")
|
||||
trade.set_funding_fees(
|
||||
self.exchange.get_funding_fees(
|
||||
pair=trade.pair,
|
||||
amount=trade.amount,
|
||||
is_short=trade.is_short,
|
||||
open_date=trade.date_last_filled_utc)
|
||||
)
|
||||
|
||||
exit_type = 'exit'
|
||||
exit_reason = exit_tag or exit_check.exit_reason
|
||||
|
||||
@@ -559,7 +559,6 @@ def test_create_trades_preopen(default_conf_usdt, ticker_usdt, fee, mocker,
|
||||
fetch_ticker=ticker_usdt,
|
||||
create_order=MagicMock(return_value=limit_buy_order_usdt_open),
|
||||
get_fee=fee,
|
||||
get_funding_fees=MagicMock(side_effect=ExchangeError()),
|
||||
)
|
||||
freqtrade = FreqtradeBot(default_conf_usdt)
|
||||
patch_get_signal(freqtrade)
|
||||
@@ -567,7 +566,6 @@ def test_create_trades_preopen(default_conf_usdt, ticker_usdt, fee, mocker,
|
||||
# Create 2 existing trades
|
||||
freqtrade.execute_entry('ETH/USDT', default_conf_usdt['stake_amount'])
|
||||
freqtrade.execute_entry('NEO/BTC', default_conf_usdt['stake_amount'])
|
||||
assert log_has("Could not find funding fee.", caplog)
|
||||
|
||||
assert len(Trade.get_open_trades()) == 2
|
||||
# Change order_id for new orders
|
||||
@@ -4208,7 +4206,6 @@ def test_execute_trade_exit_market_order(
|
||||
fetch_ticker=ticker_usdt,
|
||||
get_fee=fee,
|
||||
_dry_is_price_crossed=MagicMock(return_value=True),
|
||||
get_funding_fees=MagicMock(side_effect=ExchangeError()),
|
||||
)
|
||||
patch_whitelist(mocker, default_conf_usdt)
|
||||
freqtrade = FreqtradeBot(default_conf_usdt)
|
||||
@@ -4234,7 +4231,6 @@ def test_execute_trade_exit_market_order(
|
||||
limit=ticker_usdt_sell_up()['ask' if is_short else 'bid'],
|
||||
exit_check=ExitCheckTuple(exit_type=ExitType.ROI)
|
||||
)
|
||||
assert log_has("Could not update funding fee.", caplog)
|
||||
|
||||
assert not trade.is_open
|
||||
assert pytest.approx(trade.close_profit) == profit_ratio
|
||||
|
||||
Reference in New Issue
Block a user