mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-13 23:16:45 +00:00
CoinbasePro: Fix websocket ticker inconsistency
Addresses issue: https://github.com/thrasher-/gocryptotrader/issues/270
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package coinbasepro
|
||||
|
||||
import "time"
|
||||
|
||||
// Product holds product information
|
||||
type Product struct {
|
||||
ID string `json:"id"`
|
||||
@@ -428,17 +430,21 @@ type WebsocketHeartBeat struct {
|
||||
|
||||
// WebsocketTicker defines ticker websocket response
|
||||
type WebsocketTicker struct {
|
||||
Type string `json:"type"`
|
||||
Sequence int64 `json:"sequence"`
|
||||
ProductID string `json:"product_id"`
|
||||
Price float64 `json:"price,string"`
|
||||
Open24H float64 `json:"open_24h,string"`
|
||||
Volume24H float64 `json:"volumen_24h,string"`
|
||||
Low24H float64 `json:"low_24h,string"`
|
||||
High24H float64 `json:"high_24h,string"`
|
||||
Volume30D float64 `json:"volume_30d,string"`
|
||||
BestBid float64 `json:"best_bid,string"`
|
||||
BestAsk float64 `json:"best_ask,string"`
|
||||
Type string `json:"type"`
|
||||
Sequence int64 `json:"sequence"`
|
||||
ProductID string `json:"product_id"`
|
||||
Price float64 `json:"price,string"`
|
||||
Open24H float64 `json:"open_24h,string"`
|
||||
Volume24H float64 `json:"volumen_24h,string"`
|
||||
Low24H float64 `json:"low_24h,string"`
|
||||
High24H float64 `json:"high_24h,string"`
|
||||
Volume30D float64 `json:"volume_30d,string"`
|
||||
BestBid float64 `json:"best_bid,string"`
|
||||
BestAsk float64 `json:"best_ask,string"`
|
||||
Side string `json:"side"`
|
||||
Time time.Time `json:"time,string"`
|
||||
TradeID int64 `json:"trade_id"`
|
||||
LastSize float64 `json:"last_size,string"`
|
||||
}
|
||||
|
||||
// WebsocketOrderbookSnapshot defines a snapshot response
|
||||
|
||||
@@ -155,14 +155,15 @@ func (c *CoinbasePro) WsHandleData() {
|
||||
}
|
||||
|
||||
c.Websocket.DataHandler <- exchange.TickerData{
|
||||
Timestamp: time.Now(),
|
||||
Pair: currency.NewPairFromString(ticker.ProductID),
|
||||
AssetType: "SPOT",
|
||||
Exchange: c.GetName(),
|
||||
OpenPrice: ticker.Price,
|
||||
HighPrice: ticker.High24H,
|
||||
LowPrice: ticker.Low24H,
|
||||
Quantity: ticker.Volume24H,
|
||||
Timestamp: ticker.Time,
|
||||
Pair: currency.NewPairFromString(ticker.ProductID),
|
||||
AssetType: "SPOT",
|
||||
Exchange: c.GetName(),
|
||||
OpenPrice: ticker.Open24H,
|
||||
HighPrice: ticker.High24H,
|
||||
LowPrice: ticker.Low24H,
|
||||
ClosePrice: ticker.Price,
|
||||
Quantity: ticker.Volume24H,
|
||||
}
|
||||
|
||||
case "snapshot":
|
||||
|
||||
Reference in New Issue
Block a user