customized set_leverage for different exchanges
This commit is contained in:
@@ -2987,12 +2987,12 @@ def test_apply_leverage_to_stake_amount(
|
||||
assert exchange._apply_leverage_to_stake_amount(stake_amount, leverage) == min_stake_with_lev
|
||||
|
||||
|
||||
@pytest.mark.parametrize("collateral", [
|
||||
(Collateral.CROSS),
|
||||
(Collateral.ISOLATED)
|
||||
@pytest.mark.parametrize("exchange_name,trading_mode", [
|
||||
("binance", TradingMode.FUTURES),
|
||||
("ftx", TradingMode.MARGIN),
|
||||
("ftx", TradingMode.FUTURES)
|
||||
])
|
||||
@pytest.mark.parametrize("exchange_name", [("ftx"), ("binance")])
|
||||
def test__set_leverage(mocker, default_conf, exchange_name, collateral):
|
||||
def test__set_leverage(mocker, default_conf, exchange_name, trading_mode):
|
||||
|
||||
api_mock = MagicMock()
|
||||
api_mock.set_leverage = MagicMock()
|
||||
@@ -3006,7 +3006,8 @@ def test__set_leverage(mocker, default_conf, exchange_name, collateral):
|
||||
"_set_leverage",
|
||||
"set_leverage",
|
||||
pair="XRP/USDT",
|
||||
leverage=5.0
|
||||
leverage=5.0,
|
||||
trading_mode=trading_mode
|
||||
)
|
||||
|
||||
|
||||
@@ -3014,8 +3015,7 @@ def test__set_leverage(mocker, default_conf, exchange_name, collateral):
|
||||
(Collateral.CROSS),
|
||||
(Collateral.ISOLATED)
|
||||
])
|
||||
@pytest.mark.parametrize("exchange_name", [("ftx"), ("binance")])
|
||||
def test_set_margin_mode(mocker, default_conf, exchange_name, collateral):
|
||||
def test_set_margin_mode(mocker, default_conf, collateral):
|
||||
|
||||
api_mock = MagicMock()
|
||||
api_mock.set_margin_mode = MagicMock()
|
||||
@@ -3025,7 +3025,7 @@ def test_set_margin_mode(mocker, default_conf, exchange_name, collateral):
|
||||
mocker,
|
||||
default_conf,
|
||||
api_mock,
|
||||
exchange_name,
|
||||
"binance",
|
||||
"set_margin_mode",
|
||||
"set_margin_mode",
|
||||
pair="XRP/USDT",
|
||||
|
@@ -305,3 +305,9 @@ def test_fill_leverage_brackets_kraken(default_conf, mocker):
|
||||
'XLTCUSDT': [1],
|
||||
'LTC/ETH': [1]
|
||||
}
|
||||
|
||||
|
||||
def test_kraken__set_leverage(default_conf, mocker):
|
||||
exchange = get_patched_exchange(mocker, default_conf, id="kraken")
|
||||
exchange._set_leverage(3)
|
||||
assert exchange.params['leverage'] == 3
|
||||
|
Reference in New Issue
Block a user