Update binance stoploss to use correct stop order for futures

This commit is contained in:
Matthias
2022-03-05 13:57:54 +01:00
parent 685820cc12
commit 2b1a8f2fbb
3 changed files with 16 additions and 9 deletions

View File

@@ -22,6 +22,7 @@ class Binance(Exchange):
_ft_has: Dict = {
"stoploss_on_exchange": True,
"stoploss_order_types": {"limit": "stop_loss_limit"},
"stoploss_order_types_futures": {"limit": "stop"},
"order_time_in_force": ['gtc', 'fok', 'ioc'],
"time_in_force_parameter": "timeInForce",
"ohlcv_candle_limit": 1000,

View File

@@ -1011,6 +1011,11 @@ class Exchange:
def _get_stop_order_type(self, user_order_type) -> Tuple[str, str]:
available_order_Types: Dict[str, str] = self._ft_has["stoploss_order_types"]
if self.trading_mode == TradingMode.FUTURES:
# Optionally use different order type for stop order
available_order_Types = self._ft_has.get('stoploss_order_types_futures',
self._ft_has["stoploss_order_types"])
if user_order_type in available_order_Types.keys():
ordertype = available_order_Types[user_order_type]
else: