@@ -552,6 +552,146 @@ def test_set_auto_earn_different_currencies(self, mock_request):
552552 self .assertEqual (call_args ['ccy' ], ccy )
553553
554554
555+ class TestAccountAPIGetMaxOrderSize (unittest .TestCase ):
556+ """Unit tests for the get_max_order_size method"""
557+
558+ def setUp (self ):
559+ """Set up test fixtures"""
560+ self .account_api = AccountAPI (
561+ api_key = 'test_key' ,
562+ api_secret_key = 'test_secret' ,
563+ passphrase = 'test_pass' ,
564+ flag = '0'
565+ )
566+
567+ @patch .object (AccountAPI , '_request_with_params' )
568+ def test_get_max_order_size_with_required_params (self , mock_request ):
569+ """Test get_max_order_size with required parameters only"""
570+ mock_response = {'code' : '0' , 'msg' : '' , 'data' : []}
571+ mock_request .return_value = mock_response
572+
573+ result = self .account_api .get_max_order_size (
574+ instId = 'BTC-USDT' ,
575+ tdMode = 'cash'
576+ )
577+
578+ expected_params = {
579+ 'instId' : 'BTC-USDT' ,
580+ 'tdMode' : 'cash' ,
581+ 'ccy' : '' ,
582+ 'px' : ''
583+ }
584+ mock_request .assert_called_once_with (c .GET , c .MAX_TRADE_SIZE , expected_params )
585+ self .assertEqual (result , mock_response )
586+
587+ @patch .object (AccountAPI , '_request_with_params' )
588+ def test_get_max_order_size_with_tradeQuoteCcy (self , mock_request ):
589+ """Test get_max_order_size with tradeQuoteCcy parameter for Unified USD Orderbook"""
590+ mock_response = {'code' : '0' , 'msg' : '' , 'data' : []}
591+ mock_request .return_value = mock_response
592+
593+ result = self .account_api .get_max_order_size (
594+ instId = 'BTC-USD' ,
595+ tdMode = 'cash' ,
596+ tradeQuoteCcy = 'USDC'
597+ )
598+
599+ expected_params = {
600+ 'instId' : 'BTC-USD' ,
601+ 'tdMode' : 'cash' ,
602+ 'ccy' : '' ,
603+ 'px' : '' ,
604+ 'tradeQuoteCcy' : 'USDC'
605+ }
606+ mock_request .assert_called_once_with (c .GET , c .MAX_TRADE_SIZE , expected_params )
607+
608+ @patch .object (AccountAPI , '_request_with_params' )
609+ def test_get_max_order_size_without_tradeQuoteCcy (self , mock_request ):
610+ """Test get_max_order_size without tradeQuoteCcy (should not include in params)"""
611+ mock_response = {'code' : '0' , 'msg' : '' , 'data' : []}
612+ mock_request .return_value = mock_response
613+
614+ result = self .account_api .get_max_order_size (
615+ instId = 'BTC-USDT' ,
616+ tdMode = 'cash'
617+ )
618+
619+ call_args = mock_request .call_args [0 ][2 ]
620+ self .assertNotIn ('tradeQuoteCcy' , call_args )
621+
622+
623+ class TestAccountAPIGetMaxAvailSize (unittest .TestCase ):
624+ """Unit tests for the get_max_avail_size method"""
625+
626+ def setUp (self ):
627+ """Set up test fixtures"""
628+ self .account_api = AccountAPI (
629+ api_key = 'test_key' ,
630+ api_secret_key = 'test_secret' ,
631+ passphrase = 'test_pass' ,
632+ flag = '0'
633+ )
634+
635+ @patch .object (AccountAPI , '_request_with_params' )
636+ def test_get_max_avail_size_with_required_params (self , mock_request ):
637+ """Test get_max_avail_size with required parameters only"""
638+ mock_response = {'code' : '0' , 'msg' : '' , 'data' : []}
639+ mock_request .return_value = mock_response
640+
641+ result = self .account_api .get_max_avail_size (
642+ instId = 'BTC-USDT' ,
643+ tdMode = 'cash'
644+ )
645+
646+ expected_params = {
647+ 'instId' : 'BTC-USDT' ,
648+ 'tdMode' : 'cash' ,
649+ 'ccy' : '' ,
650+ 'reduceOnly' : '' ,
651+ 'unSpotOffset' : '' ,
652+ 'quickMgnType' : ''
653+ }
654+ mock_request .assert_called_once_with (c .GET , c .MAX_AVAIL_SIZE , expected_params )
655+ self .assertEqual (result , mock_response )
656+
657+ @patch .object (AccountAPI , '_request_with_params' )
658+ def test_get_max_avail_size_with_tradeQuoteCcy (self , mock_request ):
659+ """Test get_max_avail_size with tradeQuoteCcy parameter for Unified USD Orderbook"""
660+ mock_response = {'code' : '0' , 'msg' : '' , 'data' : []}
661+ mock_request .return_value = mock_response
662+
663+ result = self .account_api .get_max_avail_size (
664+ instId = 'BTC-USD' ,
665+ tdMode = 'cash' ,
666+ tradeQuoteCcy = 'USDC'
667+ )
668+
669+ expected_params = {
670+ 'instId' : 'BTC-USD' ,
671+ 'tdMode' : 'cash' ,
672+ 'ccy' : '' ,
673+ 'reduceOnly' : '' ,
674+ 'unSpotOffset' : '' ,
675+ 'quickMgnType' : '' ,
676+ 'tradeQuoteCcy' : 'USDC'
677+ }
678+ mock_request .assert_called_once_with (c .GET , c .MAX_AVAIL_SIZE , expected_params )
679+
680+ @patch .object (AccountAPI , '_request_with_params' )
681+ def test_get_max_avail_size_without_tradeQuoteCcy (self , mock_request ):
682+ """Test get_max_avail_size without tradeQuoteCcy (should not include in params)"""
683+ mock_response = {'code' : '0' , 'msg' : '' , 'data' : []}
684+ mock_request .return_value = mock_response
685+
686+ result = self .account_api .get_max_avail_size (
687+ instId = 'BTC-USDT' ,
688+ tdMode = 'cash'
689+ )
690+
691+ call_args = mock_request .call_args [0 ][2 ]
692+ self .assertNotIn ('tradeQuoteCcy' , call_args )
693+
694+
555695if __name__ == '__main__' :
556696 unittest .main ()
557697
0 commit comments