From a1c9bd7ec8aa332e9bd0dda117cf303bdb1cdd42 Mon Sep 17 00:00:00 2001 From: c9s Date: Fri, 22 Apr 2022 14:45:45 +0800 Subject: [PATCH] all: add AccountTypeIsolatedMargin --- pkg/exchange/binance/exchange.go | 2 +- pkg/types/account.go | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/pkg/exchange/binance/exchange.go b/pkg/exchange/binance/exchange.go index d8ad5829c..c4e0e237a 100644 --- a/pkg/exchange/binance/exchange.go +++ b/pkg/exchange/binance/exchange.go @@ -326,7 +326,7 @@ func (e *Exchange) queryIsolatedMarginAccount(ctx context.Context) (*types.Accou } a := &types.Account{ - AccountType: types.AccountTypeMargin, + AccountType: types.AccountTypeIsolatedMargin, IsolatedMarginInfo: toGlobalIsolatedMarginAccountInfo(marginAccount), // In binance GO api, Account define marginAccount info which mantain []*AccountAsset and []*AccountPosition. } diff --git a/pkg/types/account.go b/pkg/types/account.go index 5b9d893e6..f8680d64a 100644 --- a/pkg/types/account.go +++ b/pkg/types/account.go @@ -230,9 +230,10 @@ func (m BalanceMap) Print() { type AccountType string const ( - AccountTypeFutures = AccountType("futures") - AccountTypeMargin = AccountType("margin") - AccountTypeSpot = AccountType("spot") + AccountTypeFutures = AccountType("futures") + AccountTypeMargin = AccountType("margin") + AccountTypeIsolatedMargin = AccountType("isolated_margin") + AccountTypeSpot = AccountType("spot") ) type Account struct { @@ -251,8 +252,8 @@ type Account struct { MarginLevel fixedpoint.Value `json:"marginLevel,omitempty"` MarginTolerance fixedpoint.Value `json:"marginTolerance,omitempty"` - BorrowEnabled bool `json:"borrowEnabled,omitempty"` - TransferEnabled bool `json:"transferEnabled,omitempty"` + BorrowEnabled bool `json:"borrowEnabled,omitempty"` + TransferEnabled bool `json:"transferEnabled,omitempty"` // isolated margin related fields // LiquidationPrice is only used when account is in the isolated margin mode