File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -891,14 +891,26 @@ def validate_trading_mode_and_margin_mode(
891891 self ,
892892 trading_mode : TradingMode ,
893893 margin_mode : MarginMode | None , # Only None when trading_mode = TradingMode.SPOT
894+ allow_none_margin_mode : bool = False ,
894895 ):
895896 """
896897 Checks if freqtrade can perform trades using the configured
897898 trading mode(Margin, Futures) and MarginMode(Cross, Isolated)
898899 Throws OperationalException:
899900 If the trading_mode/margin_mode type are not supported by freqtrade on this exchange
900901 """
901- if trading_mode != TradingMode .SPOT and (
902+ if trading_mode == TradingMode .SPOT :
903+ return
904+ if allow_none_margin_mode and margin_mode is None :
905+ # Verify trading mode independent of margin mode
906+ if not any (
907+ trading_mode == pair [0 ] for pair in self ._supported_trading_mode_margin_pairs
908+ ):
909+ raise ConfigurationError (
910+ f"Freqtrade does not support '{ trading_mode } ' on { self .name } ."
911+ )
912+
913+ if not allow_none_margin_mode and (
902914 (trading_mode , margin_mode ) not in self ._supported_trading_mode_margin_pairs
903915 ):
904916 mm_value = margin_mode and margin_mode .value
You can’t perform that action at this time.
0 commit comments