mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-26 16:55:15 +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,
|
IsMaker: t.Maker,
|
||||||
Fee: t.Fee,
|
Fee: t.Fee,
|
||||||
FeeCurrency: toGlobalCurrency(t.FeeCurrency),
|
FeeCurrency: toGlobalCurrency(t.FeeCurrency),
|
||||||
|
FeeDiscounted: t.FeeDiscounted,
|
||||||
QuoteQuantity: t.Price.Mul(t.Volume),
|
QuoteQuantity: t.Price.Mul(t.Volume),
|
||||||
Time: types.Time(t.Timestamp.Time()),
|
Time: types.Time(t.Timestamp.Time()),
|
||||||
}, nil
|
}, nil
|
||||||
|
|
|
@ -39,7 +39,7 @@ func Test_parseTradeSnapshotEvent(t *testing.T) {
|
||||||
assert.Equal(t, 1, len(evt.Trades))
|
assert.Equal(t, 1, len(evt.Trades))
|
||||||
assert.Equal(t, "bid", evt.Trades[0].Side)
|
assert.Equal(t, "bid", evt.Trades[0].Side)
|
||||||
assert.Equal(t, "ethtwd", evt.Trades[0].Market)
|
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, "3.2", evt.Trades[0].Fee.String())
|
||||||
assert.Equal(t, "twd", evt.Trades[0].FeeCurrency)
|
assert.Equal(t, "twd", evt.Trades[0].FeeCurrency)
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ func (g *GetWalletTradesRequest) Limit(limit uint64) *GetWalletTradesRequest {
|
||||||
return g
|
return g
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *GetWalletTradesRequest) WalletType(walletType max.WalletType) *GetWalletTradesRequest {
|
func (g *GetWalletTradesRequest) WalletType(walletType WalletType) *GetWalletTradesRequest {
|
||||||
g.walletType = walletType
|
g.walletType = walletType
|
||||||
return g
|
return g
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,6 +67,12 @@ type Trade struct {
|
||||||
Fee fixedpoint.Value `json:"fee" db:"fee"`
|
Fee fixedpoint.Value `json:"fee" db:"fee"`
|
||||||
FeeCurrency string `json:"feeCurrency" db:"fee_currency"`
|
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"`
|
IsMargin bool `json:"isMargin" db:"is_margin"`
|
||||||
IsFutures bool `json:"isFutures" db:"is_futures"`
|
IsFutures bool `json:"isFutures" db:"is_futures"`
|
||||||
IsIsolated bool `json:"isIsolated" db:"is_isolated"`
|
IsIsolated bool `json:"isIsolated" db:"is_isolated"`
|
||||||
|
|
Loading…
Reference in New Issue
Block a user