mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-26 08:45:16 +00:00
types: add fee discounted field to the global trade struct
This commit is contained in:
parent
4de82ccdff
commit
fcca3f6432
|
@ -297,6 +297,7 @@ func convertWebSocketTrade(t max.TradeUpdate) (*types.Trade, error) {
|
|||
IsMaker: t.Maker,
|
||||
Fee: t.Fee,
|
||||
FeeCurrency: toGlobalCurrency(t.FeeCurrency),
|
||||
FeeDiscounted: t.FeeDiscounted,
|
||||
QuoteQuantity: t.Price.Mul(t.Volume),
|
||||
Time: types.Time(t.Timestamp.Time()),
|
||||
}, nil
|
||||
|
|
|
@ -39,7 +39,7 @@ func Test_parseTradeSnapshotEvent(t *testing.T) {
|
|||
assert.Equal(t, 1, len(evt.Trades))
|
||||
assert.Equal(t, "bid", evt.Trades[0].Side)
|
||||
assert.Equal(t, "ethtwd", evt.Trades[0].Market)
|
||||
assert.Equal(t, int64(1521726960357), evt.Trades[0].Timestamp)
|
||||
assert.Equal(t, int64(1521726960357), evt.Trades[0].Timestamp.Time().UnixMilli())
|
||||
assert.Equal(t, "3.2", evt.Trades[0].Fee.String())
|
||||
assert.Equal(t, "twd", evt.Trades[0].FeeCurrency)
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ func (g *GetWalletTradesRequest) Limit(limit uint64) *GetWalletTradesRequest {
|
|||
return g
|
||||
}
|
||||
|
||||
func (g *GetWalletTradesRequest) WalletType(walletType max.WalletType) *GetWalletTradesRequest {
|
||||
func (g *GetWalletTradesRequest) WalletType(walletType WalletType) *GetWalletTradesRequest {
|
||||
g.walletType = walletType
|
||||
return g
|
||||
}
|
||||
|
|
|
@ -67,6 +67,12 @@ type Trade struct {
|
|||
Fee fixedpoint.Value `json:"fee" db:"fee"`
|
||||
FeeCurrency string `json:"feeCurrency" db:"fee_currency"`
|
||||
|
||||
// FeeDiscounted is an optional field which indicates whether the trade is using the platform fee token for discount.
|
||||
// When FeeDiscounted = true, means the fee is deducted outside the trade
|
||||
// By default, it's set to false.
|
||||
// This is only used by the MAX exchange
|
||||
FeeDiscounted bool `json:"feeDiscounted" db:"-"`
|
||||
|
||||
IsMargin bool `json:"isMargin" db:"is_margin"`
|
||||
IsFutures bool `json:"isFutures" db:"is_futures"`
|
||||
IsIsolated bool `json:"isIsolated" db:"is_isolated"`
|
||||
|
|
Loading…
Reference in New Issue
Block a user