remove bps from the fee calc

This commit is contained in:
c9s 2021-03-20 22:53:14 +08:00
parent c678d3f13a
commit a52101b163
3 changed files with 7 additions and 7 deletions

View File

@ -377,9 +377,10 @@ func (e *Exchange) QueryAccount(ctx context.Context) (*types.Account, error) {
} }
} }
// binance use 15 -> 0.15%, so we convert it to 0.0015
a := &types.Account{ a := &types.Account{
MakerCommission: fixedpoint.NewFromInt64(account.MakerCommission), MakerCommission: fixedpoint.NewFromFloat(float64(account.MakerCommission) * 0.0001),
TakerCommission: fixedpoint.NewFromInt64(account.TakerCommission), TakerCommission: fixedpoint.NewFromFloat(float64(account.TakerCommission) * 0.0001),
} }
a.UpdateBalances(balances) a.UpdateBalances(balances)
return a, nil return a, nil

View File

@ -73,10 +73,9 @@ func (e *Exchange) QueryAccount(ctx context.Context) (*types.Account, error) {
return nil, fmt.Errorf("ftx returns querying balances failure") return nil, fmt.Errorf("ftx returns querying balances failure")
} }
bps := fixedpoint.NewFromFloat(10000)
a := &types.Account{ a := &types.Account{
MakerCommission: fixedpoint.NewFromFloat(resp.Result.MakerFee).Mul(bps), MakerCommission: fixedpoint.NewFromFloat(resp.Result.MakerFee),
TakerCommission: fixedpoint.NewFromFloat(resp.Result.TakerFee).Mul(bps), TakerCommission: fixedpoint.NewFromFloat(resp.Result.TakerFee),
} }
balances, err := e.QueryAccountBalances(ctx) balances, err := e.QueryAccountBalances(ctx)

View File

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