@@ -5599,11 +5599,13 @@ def test_liquidation_price_is_none(
55995599def test_get_max_pair_stake_amount (
56005600 mocker ,
56015601 default_conf ,
5602+ leverage_tiers ,
56025603):
56035604 api_mock = MagicMock ()
56045605 default_conf ["margin_mode" ] = "isolated"
56055606 default_conf ["trading_mode" ] = "futures"
56065607 exchange = get_patched_exchange (mocker , default_conf , api_mock )
5608+ exchange ._leverage_tiers = leverage_tiers
56075609 markets = {
56085610 "XRP/USDT:USDT" : {
56095611 "limits" : {
@@ -5667,11 +5669,23 @@ def test_get_max_pair_stake_amount(
56675669 "contractSize" : 0.01 ,
56685670 "spot" : False ,
56695671 },
5672+ "ZEC/USDT:USDT" : {
5673+ "limits" : {
5674+ "amount" : {"min" : 0.001 , "max" : None },
5675+ "cost" : {"min" : 5 , "max" : None },
5676+ },
5677+ "contractSize" : 1 ,
5678+ "spot" : False ,
5679+ },
56705680 }
56715681
56725682 mocker .patch (f"{ EXMS } .markets" , markets )
56735683 assert exchange .get_max_pair_stake_amount ("XRP/USDT:USDT" , 2.0 ) == 20000
56745684 assert exchange .get_max_pair_stake_amount ("XRP/USDT:USDT" , 2.0 , 5 ) == 4000
5685+ # limit leverage tiers
5686+ assert exchange .get_max_pair_stake_amount ("ZEC/USDT:USDT" , 2.0 , 5 ) == 100_000
5687+ assert exchange .get_max_pair_stake_amount ("ZEC/USDT:USDT" , 2.0 , 50 ) == 1000
5688+
56755689 assert exchange .get_max_pair_stake_amount ("LTC/USDT:USDT" , 2.0 ) == float ("inf" )
56765690 assert exchange .get_max_pair_stake_amount ("ETH/USDT:USDT" , 2.0 ) == 200
56775691 assert exchange .get_max_pair_stake_amount ("DOGE/USDT:USDT" , 2.0 ) == 500
0 commit comments