Skip to content

Commit

Permalink
Merge pull request #1910 from c9s/kbearXD/balance/credit
Browse files Browse the repository at this point in the history
  • Loading branch information
c9s authored Feb 25, 2025
2 parents c9c33e6 + 1b106e4 commit cbcb6fc
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions pkg/types/balance.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ type Balance struct {
Borrowed fixedpoint.Value `json:"borrowed,omitempty"`
Interest fixedpoint.Value `json:"interest,omitempty"`

// credit related fields
// long available in base currency amount for credit account
LongAvailableCredit fixedpoint.Value `json:"longAvailableCredit,omitempty"`
// short available in base currency amount for credit account
ShortAvailableCredit fixedpoint.Value `json:"shortAvailableCredit,omitempty"`

// NetAsset = (Available + Locked) - Borrowed - Interest
NetAsset fixedpoint.Value `json:"net,omitempty"`

Expand All @@ -33,13 +39,15 @@ type Balance struct {

func NewZeroBalance(currency string) Balance {
return Balance{
Currency: currency,
Available: fixedpoint.Zero,
Locked: fixedpoint.Zero,
Borrowed: fixedpoint.Zero,
Interest: fixedpoint.Zero,
NetAsset: fixedpoint.Zero,
MaxWithdrawAmount: fixedpoint.Zero,
Currency: currency,
Available: fixedpoint.Zero,
Locked: fixedpoint.Zero,
Borrowed: fixedpoint.Zero,
Interest: fixedpoint.Zero,
LongAvailableCredit: fixedpoint.Zero,
ShortAvailableCredit: fixedpoint.Zero,
NetAsset: fixedpoint.Zero,
MaxWithdrawAmount: fixedpoint.Zero,
}
}

Expand Down

0 comments on commit cbcb6fc

Please sign in to comment.