types: add maker/taker fee rate fields to the account struct

This commit is contained in:
c9s 2021-06-09 02:39:23 +08:00
parent 657e1dc9bf
commit fd2928fc82
2 changed files with 12 additions and 5 deletions

View File

@ -536,8 +536,8 @@ func (e *Exchange) QueryAccount(ctx context.Context) (*types.Account, error) {
// "maker_fee": 0.0005 -> 0.05%
// "taker_fee": 0.0015 -> 0.15%
a := &types.Account{
MakerCommission: fixedpoint.NewFromFloat(vipLevel.Current.MakerFee), // 0.15% = 0.0015
TakerCommission: fixedpoint.NewFromFloat(vipLevel.Current.TakerFee), // 0.15% = 0.0015
MakerFeeRate: fixedpoint.NewFromFloat(vipLevel.Current.MakerFee), // 0.15% = 0.0015
TakerFeeRate: fixedpoint.NewFromFloat(vipLevel.Current.TakerFee), // 0.15% = 0.0015
}
a.UpdateBalances(balances)

View File

@ -112,7 +112,10 @@ type Account struct {
// bps. 0.15% fee will be 15.
MakerCommission fixedpoint.Value `json:"makerCommission,omitempty"`
TakerCommission fixedpoint.Value `json:"takerCommission,omitempty"`
AccountType string `json:"accountType,omitempty"`
MakerFeeRate fixedpoint.Value `json:"makerFeeRate,omitempty"`
TakerFeeRate fixedpoint.Value `json:"takerFeeRate,omitempty"`
AccountType string `json:"accountType,omitempty"`
balances BalanceMap
}
@ -243,8 +246,12 @@ func (a *Account) Print() {
logrus.Infof("account type: %s", a.AccountType)
}
logrus.Infof("maker commission: %f", a.MakerCommission.Float64())
logrus.Infof("taker commission: %f", a.TakerCommission.Float64())
if a.MakerFeeRate > 0 {
logrus.Infof("maker fee rate: %f", a.MakerFeeRate.Float64())
}
if a.TakerFeeRate > 0 {
logrus.Infof("taker fee rate: %f", a.TakerFeeRate.Float64())
}
a.balances.Print()
}