Stoploss orders should also be eligible to update closed fees
This commit is contained in:
parent
415780a4fe
commit
ed64e4299b
@ -1,12 +1,13 @@
|
|||||||
""" Gate.io exchange subclass """
|
""" Gate.io exchange subclass """
|
||||||
import logging
|
import logging
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import Dict, List, Optional, Tuple
|
from typing import Any, Dict, List, Optional, Tuple
|
||||||
|
|
||||||
from freqtrade.constants import BuySell
|
from freqtrade.constants import BuySell
|
||||||
from freqtrade.enums import MarginMode, TradingMode
|
from freqtrade.enums import MarginMode, TradingMode
|
||||||
from freqtrade.exceptions import OperationalException
|
from freqtrade.exceptions import OperationalException
|
||||||
from freqtrade.exchange import Exchange
|
from freqtrade.exchange import Exchange
|
||||||
|
from freqtrade.misc import safe_value_fallback2
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
@ -97,6 +98,11 @@ class Gateio(Exchange):
|
|||||||
}
|
}
|
||||||
return trades
|
return trades
|
||||||
|
|
||||||
|
def get_order_id_conditional(self, order: Dict[str, Any]) -> str:
|
||||||
|
if self.trading_mode == TradingMode.FUTURES:
|
||||||
|
return safe_value_fallback2(order, order, 'id_stop', 'id')
|
||||||
|
return order['id']
|
||||||
|
|
||||||
def fetch_stoploss_order(self, order_id: str, pair: str, params: Dict = {}) -> Dict:
|
def fetch_stoploss_order(self, order_id: str, pair: str, params: Dict = {}) -> Dict:
|
||||||
order = self.fetch_order(
|
order = self.fetch_order(
|
||||||
order_id=order_id,
|
order_id=order_id,
|
||||||
|
@ -332,6 +332,8 @@ class FreqtradeBot(LoggingMixin):
|
|||||||
if not trade.is_open and not trade.fee_updated(trade.exit_side):
|
if not trade.is_open and not trade.fee_updated(trade.exit_side):
|
||||||
# Get sell fee
|
# Get sell fee
|
||||||
order = trade.select_order(trade.exit_side, False)
|
order = trade.select_order(trade.exit_side, False)
|
||||||
|
if not order:
|
||||||
|
order = trade.select_order('stoploss', False)
|
||||||
if order:
|
if order:
|
||||||
logger.info(
|
logger.info(
|
||||||
f"Updating {trade.exit_side}-fee on trade {trade}"
|
f"Updating {trade.exit_side}-fee on trade {trade}"
|
||||||
|
Loading…
Reference in New Issue
Block a user