From bd2cc9d7bb11a097b7af0bb16fe9dbd6fd8c463d Mon Sep 17 00:00:00 2001 From: Ryan O'Hara-Reid Date: Mon, 21 Oct 2024 17:05:26 +1100 Subject: [PATCH] gateio: Small update on fields and subscriptions (#1658) * Cherry_pickable * gateio/websocket: use millisecond time for more accurate push time --------- Co-authored-by: Ryan O'Hara-Reid --- exchanges/gateio/gateio_types.go | 5 +++-- exchanges/gateio/gateio_ws_delivery_futures.go | 1 + exchanges/gateio/gateio_ws_futures.go | 3 ++- exchanges/gateio/gateio_ws_option.go | 1 + 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/exchanges/gateio/gateio_types.go b/exchanges/gateio/gateio_types.go index 2b3e558c..58249866 100644 --- a/exchanges/gateio/gateio_types.go +++ b/exchanges/gateio/gateio_types.go @@ -708,6 +708,7 @@ type FuturesCandlestick struct { HighestPrice types.Number `json:"h"` LowestPrice types.Number `json:"l"` OpenPrice types.Number `json:"o"` + Sum types.Number `json:"sum"` // Trading volume (unit: Quote currency) // Added for websocket push data Name string `json:"n,omitempty"` @@ -1822,8 +1823,8 @@ type OrderCreateParams struct { Iceberg int64 `json:"iceberg"` Price string `json:"price"` // NOTE: Market orders require string "0" TimeInForce string `json:"tif"` - Text string `json:"text"` - ClosePosition bool `json:"close,omitempty"` + Text string `json:"text,omitempty"` // Omitempty required as payload sent as `text:""` will return error message: Text content not starting with `t-`" + ClosePosition bool `json:"close,omitempty"` // Size needs to be zero if true ReduceOnly bool `json:"reduce_only,omitempty"` AutoSize string `json:"auto_size,omitempty"` Settle string `json:"-"` // Used in URL. diff --git a/exchanges/gateio/gateio_ws_delivery_futures.go b/exchanges/gateio/gateio_ws_delivery_futures.go index 085e0c2c..d4e1c8ab 100644 --- a/exchanges/gateio/gateio_ws_delivery_futures.go +++ b/exchanges/gateio/gateio_ws_delivery_futures.go @@ -102,6 +102,7 @@ func (g *Gateio) GenerateDeliveryFuturesDefaultSubscriptions() (subscription.Lis Channel: channelsToSubscribe[i], Pairs: currency.Pairs{fPair.Upper()}, Params: params, + Asset: asset.DeliveryFutures, }) } } diff --git a/exchanges/gateio/gateio_ws_futures.go b/exchanges/gateio/gateio_ws_futures.go index 00c37ba0..6e54cbf3 100644 --- a/exchanges/gateio/gateio_ws_futures.go +++ b/exchanges/gateio/gateio_ws_futures.go @@ -145,6 +145,7 @@ func (g *Gateio) GenerateFuturesDefaultSubscriptions(settlement currency.Code) ( Channel: channelsToSubscribe[i], Pairs: currency.Pairs{fPair.Upper()}, Params: params, + Asset: asset.Futures, }) } } @@ -182,7 +183,7 @@ func (g *Gateio) WsHandleFuturesData(_ context.Context, respRaw []byte, a asset. case futuresTradesChannel: return g.processFuturesTrades(respRaw, a) case futuresOrderbookChannel: - return g.processFuturesOrderbookSnapshot(push.Event, push.Result, a, push.Time.Time()) + return g.processFuturesOrderbookSnapshot(push.Event, push.Result, a, push.TimeMs.Time()) case futuresOrderbookTickerChannel: return g.processFuturesOrderbookTicker(push.Result) case futuresOrderbookUpdateChannel: diff --git a/exchanges/gateio/gateio_ws_option.go b/exchanges/gateio/gateio_ws_option.go index b91471d8..40bc63fe 100644 --- a/exchanges/gateio/gateio_ws_option.go +++ b/exchanges/gateio/gateio_ws_option.go @@ -163,6 +163,7 @@ getEnabledPairs: Channel: channelsToSubscribe[i], Pairs: currency.Pairs{fPair.Upper()}, Params: params, + Asset: asset.Options, }) } }