Add test for binance rounding leverage
This commit is contained in:
parent
997df2032e
commit
980ffa6bfb
@ -522,8 +522,15 @@ def test__set_leverage_binance(mocker, default_conf):
|
|||||||
api_mock.set_leverage = MagicMock()
|
api_mock.set_leverage = MagicMock()
|
||||||
type(api_mock).has = PropertyMock(return_value={'setLeverage': True})
|
type(api_mock).has = PropertyMock(return_value={'setLeverage': True})
|
||||||
default_conf['dry_run'] = False
|
default_conf['dry_run'] = False
|
||||||
exchange = get_patched_exchange(mocker, default_conf, id="binance")
|
default_conf['trading_mode'] = TradingMode.FUTURES
|
||||||
exchange._set_leverage(3.0, trading_mode=TradingMode.MARGIN)
|
default_conf['margin_mode'] = MarginMode.ISOLATED
|
||||||
|
|
||||||
|
exchange = get_patched_exchange(mocker, default_conf, api_mock, id="binance")
|
||||||
|
exchange._set_leverage(3.2, 'BTC/USDT:USDT')
|
||||||
|
assert api_mock.set_leverage.call_count == 1
|
||||||
|
# Leverage is rounded to 3.
|
||||||
|
assert api_mock.set_leverage.call_args_list[0][1]['leverage'] == 3
|
||||||
|
assert api_mock.set_leverage.call_args_list[0][1]['symbol'] == 'BTC/USDT:USDT'
|
||||||
|
|
||||||
ccxt_exceptionhandlers(
|
ccxt_exceptionhandlers(
|
||||||
mocker,
|
mocker,
|
||||||
|
Loading…
Reference in New Issue
Block a user