types: add TakerBuyBaseAssetVolume and TakerBuyQuoteAssetVolume fields to kline

This commit is contained in:
c9s 2021-05-30 23:29:13 +08:00
parent 2925a77815
commit e3473572e9
2 changed files with 24 additions and 20 deletions

View File

@ -470,20 +470,22 @@ type KLineEvent struct {
func (k *KLine) KLine() types.KLine { func (k *KLine) KLine() types.KLine {
return types.KLine{ return types.KLine{
Exchange: types.ExchangeBinance, Exchange: types.ExchangeBinance,
Symbol: k.Symbol, Symbol: k.Symbol,
Interval: types.Interval(k.Interval), Interval: types.Interval(k.Interval),
StartTime: time.Unix(0, k.StartTime*int64(time.Millisecond)), StartTime: time.Unix(0, k.StartTime*int64(time.Millisecond)),
EndTime: time.Unix(0, k.EndTime*int64(time.Millisecond)), EndTime: time.Unix(0, k.EndTime*int64(time.Millisecond)),
Open: k.Open.Float64(), Open: k.Open.Float64(),
Close: k.Close.Float64(), Close: k.Close.Float64(),
High: k.High.Float64(), High: k.High.Float64(),
Low: k.Low.Float64(), Low: k.Low.Float64(),
Volume: k.Volume.Float64(), Volume: k.Volume.Float64(),
QuoteVolume: k.QuoteVolume.Float64(), QuoteVolume: k.QuoteVolume.Float64(),
LastTradeID: uint64(k.LastTradeID), TakerBuyBaseAssetVolume: k.TakerBuyBaseAssetVolume.Float64(),
NumberOfTrades: uint64(k.NumberOfTrades), TakerBuyQuoteAssetVolume: k.TakerBuyQuoteAssetVolume.Float64(),
Closed: k.Closed, LastTradeID: uint64(k.LastTradeID),
NumberOfTrades: uint64(k.NumberOfTrades),
Closed: k.Closed,
} }
} }

View File

@ -55,12 +55,14 @@ type KLine struct {
Interval Interval `json:"interval" db:"interval"` Interval Interval `json:"interval" db:"interval"`
Open float64 `json:"open" db:"open"` Open float64 `json:"open" db:"open"`
Close float64 `json:"close" db:"close"` Close float64 `json:"close" db:"close"`
High float64 `json:"high" db:"high"` High float64 `json:"high" db:"high"`
Low float64 `json:"low" db:"low"` Low float64 `json:"low" db:"low"`
Volume float64 `json:"volume" db:"volume"` Volume float64 `json:"volume" db:"volume"`
QuoteVolume float64 `json:"quoteVolume" db:"quote_volume"` QuoteVolume float64 `json:"quoteVolume" db:"quote_volume"`
TakerBuyBaseAssetVolume float64 `json:"takerBuyBaseAssetVolume"`
TakerBuyQuoteAssetVolume float64 `json:"takerBuyQuoteAssetVolume"`
LastTradeID uint64 `json:"lastTradeID" db:"last_trade_id"` LastTradeID uint64 `json:"lastTradeID" db:"last_trade_id"`
NumberOfTrades uint64 `json:"numberOfTrades" db:"num_trades"` NumberOfTrades uint64 `json:"numberOfTrades" db:"num_trades"`