mirror of
https://github.com/freqtrade/freqtrade.git
synced 2026-01-20 14:00:38 +00:00
add set_funding_fees method
This commit is contained in:
@@ -317,13 +317,13 @@ class FreqtradeBot(LoggingMixin):
|
||||
trades: List[Trade] = Trade.get_open_trades()
|
||||
try:
|
||||
for trade in trades:
|
||||
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
|
||||
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)
|
||||
)
|
||||
trade.funding_fees = funding_fees
|
||||
except ExchangeError:
|
||||
logger.warning("Could not update funding fees for open trades.")
|
||||
|
||||
@@ -1695,11 +1695,12 @@ class FreqtradeBot(LoggingMixin):
|
||||
:return: True if it succeeds False
|
||||
"""
|
||||
try:
|
||||
trade.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,
|
||||
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.")
|
||||
|
||||
@@ -658,6 +658,14 @@ class LocalTrade:
|
||||
return
|
||||
self.liquidation_price = liquidation_price
|
||||
|
||||
def set_funding_fees(self, funding_fee: float) -> None:
|
||||
"""
|
||||
Assign funding fees to Trade.
|
||||
"""
|
||||
if funding_fee is None:
|
||||
return
|
||||
self.funding_fees = funding_fee
|
||||
|
||||
def __set_stop_loss(self, stop_loss: float, percent: float):
|
||||
"""
|
||||
Method used internally to set self.stop_loss.
|
||||
|
||||
Reference in New Issue
Block a user