Skip to content

Commit 0f9854d

Browse files
authored
Update GetMaxBorrowableService (#669)
* Update * Update
1 parent 16134e5 commit 0f9854d

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

v2/margin_service.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -957,6 +957,7 @@ func (s *ListMarginTradesService) Do(ctx context.Context, opts ...RequestOption)
957957
}
958958

959959
// GetMaxBorrowableService get max borrowable of asset
960+
// https://developers.binance.com/docs/margin_trading/borrow-and-repay/Query-Max-Borrow
960961
type GetMaxBorrowableService struct {
961962
c *Client
962963
asset string
@@ -1000,7 +1001,8 @@ func (s *GetMaxBorrowableService) Do(ctx context.Context, opts ...RequestOption)
10001001

10011002
// MaxBorrowable define max borrowable response
10021003
type MaxBorrowable struct {
1003-
Amount string `json:"amount"`
1004+
Amount string `json:"amount"` // account's currently max borrowable amount with sufficient system availability
1005+
BorrowLimit string `json:"borrowLimit"` // max borrowable amount limited by the account level
10041006
}
10051007

10061008
// GetMaxTransferableService get max transferable of asset

v2/margin_service_test.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -893,7 +893,8 @@ func (s *marginTestSuite) TestListMarginTrades() {
893893

894894
func (s *marginTestSuite) TestGetMaxBorrowable() {
895895
data := []byte(`{
896-
"amount": "1.69248805"
896+
"amount": "1.69248805",
897+
"borrowLimit": "1000"
897898
}`)
898899
s.mockDo(data, nil)
899900
defer s.assertDo()
@@ -910,13 +911,15 @@ func (s *marginTestSuite) TestGetMaxBorrowable() {
910911
r := s.r()
911912
r.NoError(err)
912913
e := &MaxBorrowable{
913-
Amount: "1.69248805",
914+
Amount: "1.69248805",
915+
BorrowLimit: "1000",
914916
}
915917
s.assertMaxBorrowableEqual(e, borrowable)
916918
}
917919

918920
func (s *marginTestSuite) assertMaxBorrowableEqual(e, a *MaxBorrowable) {
919921
s.r().Equal(e.Amount, a.Amount, "Amount")
922+
s.r().Equal(e.BorrowLimit, a.BorrowLimit, "BorrowLimit")
920923
}
921924

922925
func (s *marginTestSuite) TestGetMaxTransferable() {

0 commit comments

Comments
 (0)