mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-12-18 05:41:14 +00:00
fix: don't try to place stoploss orders with blocking assets
This commit is contained in:
@@ -32,6 +32,7 @@ class Binance(Exchange):
|
||||
"stop_price_param": "stopPrice",
|
||||
"stop_price_prop": "stopPrice",
|
||||
"stoploss_order_types": {"limit": "stop_loss_limit"},
|
||||
"stoploss_blocks_assets": True, # By default stoploss orders block assets
|
||||
"order_time_in_force": ["GTC", "FOK", "IOC", "PO"],
|
||||
"trades_pagination": "id",
|
||||
"trades_pagination_arg": "fromId",
|
||||
@@ -43,6 +44,7 @@ class Binance(Exchange):
|
||||
_ft_has_futures: FtHas = {
|
||||
"funding_fee_candle_limit": 1000,
|
||||
"stoploss_order_types": {"limit": "stop", "market": "stop_market"},
|
||||
"stoploss_blocks_assets": False, # Stoploss orders do not block assets
|
||||
"order_time_in_force": ["GTC", "FOK", "IOC"],
|
||||
"tickers_have_price": False,
|
||||
"floor_leverage": True,
|
||||
|
||||
@@ -49,6 +49,7 @@ class Bybit(Exchange):
|
||||
"funding_fee_candle_limit": 200,
|
||||
"stoploss_on_exchange": True,
|
||||
"stoploss_order_types": {"limit": "limit", "market": "market"},
|
||||
"stoploss_blocks_assets": False,
|
||||
# bybit response parsing fails to populate stopLossPrice
|
||||
"stop_price_prop": "stopPrice",
|
||||
"stop_price_type_field": "triggerBy",
|
||||
|
||||
@@ -131,6 +131,7 @@ class Exchange:
|
||||
"stop_price_param": "stopLossPrice", # Used for stoploss_on_exchange request
|
||||
"stop_price_prop": "stopLossPrice", # Used for stoploss_on_exchange response parsing
|
||||
"stoploss_order_types": {},
|
||||
"stoploss_blocks_assets": True, # By default stoploss orders block assets
|
||||
"order_time_in_force": ["GTC"],
|
||||
"ohlcv_params": {},
|
||||
"ohlcv_has_history": True, # Some exchanges (Kraken) don't provide history via ohlcv
|
||||
|
||||
@@ -15,6 +15,7 @@ class FtHas(TypedDict, total=False):
|
||||
stop_price_type_field: str
|
||||
stop_price_type_value_mapping: dict
|
||||
stoploss_order_types: dict[str, str]
|
||||
stoploss_blocks_assets: bool
|
||||
# ohlcv
|
||||
ohlcv_params: dict
|
||||
ohlcv_candle_limit: int
|
||||
|
||||
@@ -46,6 +46,7 @@ class Gate(Exchange):
|
||||
"funding_fee_candle_limit": 90,
|
||||
"stop_price_type_field": "price_type",
|
||||
"l2_limit_upper": 300,
|
||||
"stoploss_blocks_assets": False,
|
||||
"stop_price_type_value_mapping": {
|
||||
PriceType.LAST: 0,
|
||||
PriceType.MARK: 1,
|
||||
|
||||
@@ -32,6 +32,7 @@ class Hyperliquid(Exchange):
|
||||
_ft_has_futures: FtHas = {
|
||||
"stoploss_on_exchange": True,
|
||||
"stoploss_order_types": {"limit": "limit"},
|
||||
"stoploss_blocks_assets": False,
|
||||
"stop_price_prop": "stopPrice",
|
||||
"funding_fee_timeframe": "1h",
|
||||
"funding_fee_candle_limit": 500,
|
||||
|
||||
@@ -44,6 +44,7 @@ class Okx(Exchange):
|
||||
PriceType.MARK: "index",
|
||||
PriceType.INDEX: "mark",
|
||||
},
|
||||
"stoploss_blocks_assets": False,
|
||||
"ws_enabled": True,
|
||||
}
|
||||
|
||||
|
||||
@@ -1476,7 +1476,11 @@ class FreqtradeBot(LoggingMixin):
|
||||
self.handle_protections(trade.pair, trade.trade_direction)
|
||||
return True
|
||||
|
||||
if not trade.has_open_position or not trade.is_open:
|
||||
if (
|
||||
not trade.has_open_position
|
||||
or not trade.is_open
|
||||
or (trade.has_open_orders and self.exchange.get_option("stoploss_blocks_assets", True))
|
||||
):
|
||||
# The trade can be closed already (sell-order fill confirmation came in this iteration)
|
||||
return False
|
||||
|
||||
|
||||
Reference in New Issue
Block a user