add set_funding_fees method
This commit is contained in:
+12
-11
@@ -317,13 +317,13 @@ class FreqtradeBot(LoggingMixin):
|
|||||||
trades: List[Trade] = Trade.get_open_trades()
|
trades: List[Trade] = Trade.get_open_trades()
|
||||||
try:
|
try:
|
||||||
for trade in trades:
|
for trade in trades:
|
||||||
funding_fees = self.exchange.get_funding_fees(
|
trade.set_funding_fees(
|
||||||
pair=trade.pair,
|
self.exchange.get_funding_fees(
|
||||||
amount=trade.amount,
|
pair=trade.pair,
|
||||||
is_short=trade.is_short,
|
amount=trade.amount,
|
||||||
open_date=trade.date_last_filled_utc
|
is_short=trade.is_short,
|
||||||
|
open_date=trade.date_last_filled_utc)
|
||||||
)
|
)
|
||||||
trade.funding_fees = funding_fees
|
|
||||||
except ExchangeError:
|
except ExchangeError:
|
||||||
logger.warning("Could not update funding fees for open trades.")
|
logger.warning("Could not update funding fees for open trades.")
|
||||||
|
|
||||||
@@ -1695,11 +1695,12 @@ class FreqtradeBot(LoggingMixin):
|
|||||||
:return: True if it succeeds False
|
:return: True if it succeeds False
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
trade.funding_fees = self.exchange.get_funding_fees(
|
trade.set_funding_fees(
|
||||||
pair=trade.pair,
|
self.exchange.get_funding_fees(
|
||||||
amount=trade.amount,
|
pair=trade.pair,
|
||||||
is_short=trade.is_short,
|
amount=trade.amount,
|
||||||
open_date=trade.date_last_filled_utc,
|
is_short=trade.is_short,
|
||||||
|
open_date=trade.date_last_filled_utc)
|
||||||
)
|
)
|
||||||
except ExchangeError:
|
except ExchangeError:
|
||||||
logger.warning("Could not update funding fee.")
|
logger.warning("Could not update funding fee.")
|
||||||
|
|||||||
@@ -658,6 +658,14 @@ class LocalTrade:
|
|||||||
return
|
return
|
||||||
self.liquidation_price = liquidation_price
|
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):
|
def __set_stop_loss(self, stop_loss: float, percent: float):
|
||||||
"""
|
"""
|
||||||
Method used internally to set self.stop_loss.
|
Method used internally to set self.stop_loss.
|
||||||
|
|||||||
Reference in New Issue
Block a user