Binance spot also allows market orders

closes #7426
This commit is contained in:
Matthias 2022-09-17 14:55:00 +02:00
parent 8639c1f23d
commit ca6dec3d4c
2 changed files with 7 additions and 4 deletions

View File

@ -31,7 +31,7 @@ class Binance(Exchange):
"ccxt_futures_name": "future"
}
_ft_has_futures: Dict = {
"stoploss_order_types": {"limit": "stop"},
"stoploss_order_types": {"limit": "limit", "market": "market"},
"tickers_have_price": False,
}

View File

@ -23,7 +23,7 @@ from tests.exchange.test_exchange import ccxt_exceptionhandlers
def test_stoploss_order_binance(default_conf, mocker, limitratio, expected, side, trademode):
api_mock = MagicMock()
order_id = 'test_prod_buy_{}'.format(randint(0, 10 ** 6))
order_type = 'stop_loss_limit' if trademode == TradingMode.SPOT else 'stop'
order_type = 'stop_loss_limit' if trademode == TradingMode.SPOT else 'limit'
api_mock.create_order = MagicMock(return_value={
'id': order_id,
@ -45,12 +45,15 @@ def test_stoploss_order_binance(default_conf, mocker, limitratio, expected, side
amount=1,
stop_price=190,
side=side,
order_types={'stoploss_on_exchange_limit_ratio': 1.05},
order_types={'stoploss': 'limit', 'stoploss_on_exchange_limit_ratio': 1.05},
leverage=1.0
)
api_mock.create_order.reset_mock()
order_types = {} if limitratio is None else {'stoploss_on_exchange_limit_ratio': limitratio}
order_types = {'stoploss': 'limit'}
if limitratio is not None:
order_types.update({'stoploss_on_exchange_limit_ratio': limitratio})
order = exchange.stoploss(
pair='ETH/BTC',
amount=1,