Versions in this module Expand all Collapse all v0 v0.29.6 Nov 20, 2022 v0.29.4 Nov 20, 2022 v0.29.3 Nov 20, 2022 v0.29.2 Nov 12, 2022 Changes in this version + const DefaultHost + const DefaultMaker + const DefaultTaker + const GET + const OrderStatusCancelled + const OrderStatusClosed + const OrderStatusOpen + const OrderTypeBuy + const OrderTypeGTC + const OrderTypeIOC + const OrderTypeNormal + const OrderTypePOC + const OrderTypeSell + const POST + const WsIntervalSecond + const WsPathV3 + const WsPathV4 + const WsReconnectSecond + type AuthenticationRequest struct + Apikey string + Nonce int64 + Signature string + func (ar AuthenticationRequest) ToJson() (string, error) + type Futures struct + Key string + Logger *zap.SugaredLogger + Secret string + func NewFutures(key, secret, host string, logger *zap.SugaredLogger) *Futures + func (f *Futures) AddDualMargin(ctx context.Context, settle, contract string, margin decimal.Decimal) ([]exchange.Position, error) + func (f *Futures) AddMargin(ctx context.Context, settle, contract string, margin decimal.Decimal) (exchange.Position, error) + func (f *Futures) Candle(ctx context.Context, settle string, contract string, from, to int64, limit int, ...) (hs.Candle, error) + func (f *Futures) CommonLiquidation(ctx context.Context, settle, contract string, from, to int64, limit int) ([]exchange.FuturesLiquidation, error) + func (f *Futures) GetContract(ctx context.Context, settle, contract string) (exchange.Contract, error) + func (f *Futures) GetDualPosition(ctx context.Context, settle string, contract string) ([]exchange.Position, error) + func (f *Futures) GetPosition(ctx context.Context, settle, contract string) (exchange.Position, error) + func (f *Futures) ListContracts(ctx context.Context, settle string) ([]exchange.Contract, error) + func (f *Futures) ListFuturesAccounts(ctx context.Context, settle string) (exchange.FuturesBalance, error) + func (f *Futures) ListPositions(ctx context.Context, settle string) ([]exchange.Position, error) + func (f *Futures) ListTrades(ctx context.Context, settle string, contract string, limit int, from, to int64) ([]exchange.FuturesTrade, error) + func (f *Futures) Orderbook(ctx context.Context, settle, contract string, limit int, interval float32) (exchange.FuturesOrderbook, error) + func (f *Futures) SetDualMode(ctx context.Context, settle string, newDualMode bool) (exchange.FuturesBalance, error) + func (f *Futures) UpdateDualLeverage(ctx context.Context, settle, contract string, newLeverage int) ([]exchange.Position, error) + func (f *Futures) UpdateDualRiskLimit(ctx context.Context, settle, contract string, newRiskLimit int) ([]exchange.Position, error) + func (f *Futures) UpdateLeverage(ctx context.Context, settle, contract string, newLeverage int) (exchange.Position, error) + func (f *Futures) UpdateRiskLimit(ctx context.Context, settle, contract string, newRiskLimit int) (exchange.Position, error) + type GateAuthentication struct + func (a *GateAuthentication) Build() (string, error) + func (a *GateAuthentication) Init(apiKey, secretKey string) + type GateIO struct + Key string + Logger *zap.SugaredLogger + Secret string + func New(key, secret, host string, logger *zap.SugaredLogger) *GateIO + func (g *GateIO) AllSymbols(ctx context.Context) (symbols []exchange.Symbol, err error) + func (g *GateIO) BuyFromOrderBook(symbol exchange.Symbol, clientOrderId string, total decimal.Decimal) (orderId uint64, err error) + func (g *GateIO) BuyFromTicker(symbol exchange.Symbol, clientOrderId string, total decimal.Decimal) (orderId uint64, err error) + func (g *GateIO) BuyLimit(symbol, text string, price, amount decimal.Decimal) (orderId uint64, err error) + func (g *GateIO) BuyMarket(symbol exchange.Symbol, clientOrderId string, total decimal.Decimal) (orderId uint64, err error) + func (g *GateIO) BuyOrder(symbol string, price, amount decimal.Decimal, orderType, text string) (resp ResponseOrder, err error) + func (g *GateIO) BuyStopLimit(symbol, clientOrderId string, price, amount, stopPrice decimal.Decimal) (orderId uint64, err error) + func (g *GateIO) CancelAllOrders(types string, currencyPair string) (res ResponseCancel, err error) + func (g *GateIO) CancelOrder(symbol string, orderNumber uint64) error + func (g *GateIO) CandleBySize(symbol string, period time.Duration, size int) (candle hs.Candle, err error) + func (g *GateIO) CandleFrom(symbol, clientId string, period time.Duration, from, to time.Time) (hs.Candle, error) + func (g *GateIO) GetCandle(symbol string, groupSec, rangeHour int) (candles hs.Candle, err error) + func (g *GateIO) GetFee(symbol string) (fee exchange.Fee, err error) + func (g *GateIO) GetOrder(orderId uint64, symbol string) (order exchange.Order, err error) + func (g *GateIO) GetOrderById(orderId uint64, symbol string) (order exchange.Order, err error) + func (g *GateIO) GetOrderString(orderId uint64, symbol string) (string, error) + func (g *GateIO) GetPairs() (pairs []string, err error) + func (g *GateIO) GetSymbol(ctx context.Context, symbol string) (s exchange.Symbol, err error) + func (g *GateIO) IsFullFilled(symbol string, orderId uint64) (order exchange.Order, filled bool, err error) + func (g *GateIO) Last24hVolume(symbol string) (decimal.Decimal, error) + func (g *GateIO) LastPrice(symbol string) (decimal.Decimal, error) + func (g *GateIO) MarketInfo() (res ResponseMarketInfo, err error) + func (g *GateIO) MyTradeHistory(currencyPair string) (*MyTradeHistoryResult, error) + func (g *GateIO) OpenOrders() (res ResponseOpenOrders, err error) + func (g *GateIO) OrderBook(symbol string) (ResponseOrderBook, error) + func (g *GateIO) ReqBalance(ctx context.Context, currencies []string) + func (g *GateIO) ReqCandlestick(ctx context.Context, symbol, clientId string, period time.Duration, ...) (hs.Candle, error) + func (g *GateIO) ReqOrder(ctx context.Context, symbol, clientId string) (orders []exchange.Order, err error) + func (g *GateIO) ReqPing(ctx context.Context, id int64) (string, error) + func (g *GateIO) ReqTicker(ctx context.Context, id int64, symbol string, period time.Duration) (hs.Ticker, error) + func (g *GateIO) ReqTime(ctx context.Context, id int64) (int64, error) + func (g *GateIO) SellFromOrderBook(symbol exchange.Symbol, clientOrderId string, amount decimal.Decimal) (orderId uint64, err error) + func (g *GateIO) SellFromTicker(symbol exchange.Symbol, clientOrderId string, amount decimal.Decimal) (orderId uint64, err error) + func (g *GateIO) SellLimit(symbol, text string, price, amount decimal.Decimal) (orderId uint64, err error) + func (g *GateIO) SellMarket(symbol exchange.Symbol, clientOrderId string, amount decimal.Decimal) (orderId uint64, err error) + func (g *GateIO) SellStopLimit(symbol, clientOrderId string, price, amount, stopPrice decimal.Decimal) (orderId uint64, err error) + func (g *GateIO) SpotAvailableBalance() (map[string]decimal.Decimal, error) + func (g *GateIO) SpotBalance() (map[string]decimal.Decimal, error) + func (g *GateIO) SubBalance(currencies []string) + func (g *GateIO) SubCandlestick(symbol, clientId string, period time.Duration, ...) + func (g *GateIO) SubOrder(symbol, clientId string, responseHandler exchange.ResponseHandler) + func (g *GateIO) SubTicker(id int64, symbol string, responseHandler exchange.ResponseHandler) + func (g *GateIO) SubscribeCandlestick(symbol, clientId string, period time.Duration, ...) + func (g *GateIO) SubscribeCandlestickWithReq(symbol, clientId string, period time.Duration, ...) + func (g *GateIO) SubscribeOrder(symbol, clientId string, responseHandler exchange.ResponseHandler) + func (g *GateIO) Ticker(currencyPair string) (*exchange.Ticker, error) + func (g *GateIO) TradeHistory(params string) (string, error) + func (g *GateIO) UnsubBalance(currencies []string) + func (g *GateIO) UnsubCandlestick(symbol, clientId string) + func (g *GateIO) UnsubOrder(symbol, clientId string) + func (g *GateIO) UnsubTicker(id int64, symbol string) + func (g *GateIO) UnsubscribeCandlestick(symbol, clientId string, period time.Duration) + func (g *GateIO) UnsubscribeCandlestickWithReq(symbol, clientId string, period time.Duration) + func (g *GateIO) UnsubscribeOrder(symbol, clientId string) + func (g GateIO) FormatSymbol(base, quote string) string + type MyTradeHistoryResult struct + Code int + Message string + Result string + Trades []RawTrade + type PrivateWebsocketClient struct + func (c *PrivateWebsocketClient) Init(host, path string, apiKey, secretKey string, logger *zap.SugaredLogger) *PrivateWebsocketClient + func (c *PrivateWebsocketClient) ReqBalance(id int64, assets []string) + func (c *PrivateWebsocketClient) ReqBalanceHandler(handler base.ResponseHandler) base.ResponseHandler + func (c *PrivateWebsocketClient) ReqOrder(id int64, symbol string, offset, limit uint64) + func (c *PrivateWebsocketClient) ReqOrderHandler(handler base.ResponseHandler) base.ResponseHandler + func (c *PrivateWebsocketClient) SetHandler(connectedHandler base.ConnectedHandler, responseHandler base.ResponseHandler) + func (c *PrivateWebsocketClient) SubBalance(id int64, assets []string) + func (c *PrivateWebsocketClient) SubBalanceHandler(handler exchange.ResponseHandler) base.ResponseHandler + func (c *PrivateWebsocketClient) SubOrder(id int64, symbols []string) + func (c *PrivateWebsocketClient) SubOrderHandler(handler exchange.ResponseHandler) base.ResponseHandler + func (c *PrivateWebsocketClient) UnsubBalance(id int64, assets []string) + func (c *PrivateWebsocketClient) UnsubOrder(id int64, symbols []string) + type Quote = exchange.Quote + type RawCandle [6]float64 + type RawOrderInGetOrder struct + Amount string + CurrencyPair string + Fee string + FeeCurrency string + FeePercentage float64 + FeeValue string + FilledAmount string + InitialAmount string + InitialRate string + OrderNumber string + Rate string + Status string + Text string + Timestamp int64 + Type string + type RawOrderInOpenOrders struct + Amount string + CurrencyPair string + FilledAmount string + FilledRate string + InitialAmount string + InitialRate string + OrderNumber uint64 + Rate string + Status string + Timestamp int64 + Total string + Type string + type RawSymbol struct + AmountPrecision int32 + BuyDisabled int + Fee float64 + MinAmount float64 + MinAmountA float64 + MinAmountB float64 + PricePrecision int32 + SellDisabled int + TradeDisabled int + type RawTrade struct + Amount string + Date string + Fee string + FeeCoin string + GtFee string + OrderNumber uint64 + Pair string + PointFee string + Rate string + Role string + TimeUnix int64 + Total float64 + TradeId uint64 + Type string + type ResponseBalances struct + Available map[string]string + Locked map[string]string + Result string + type ResponseBuy struct + CTime float64 + Code int + Fee string + FeeCurrency string + FeePercentage float64 + FeeValue string + FilledAmount string + FilledRate string + Iceberg string + LeftAmount string + Market string + Message string + OrderNumber uint64 + Rate string + Result string + Side int + type ResponseCancel struct + Code int + Message string + Result bool + type ResponseCandles struct + Data []RawCandle + Elapsed string + Result string + type ResponseGetOrder struct + Code int + Elapsed string + Message string + Order RawOrderInGetOrder + Result string + type ResponseMarketInfo struct + Pairs []map[string]RawSymbol + Result string + type ResponseOpenOrders struct + Code int64 + Elapsed string + Message string + Orders []RawOrderInOpenOrders + Result string + type ResponseOrder struct + FilledAmount string + FilledRate string + LeftAmount string + Message string + OrderNumber uint64 + Rate string + Result string + Text string + type ResponseOrderBook struct + Asks []Quote + Bids []Quote + Result string + type ResponseReqOrder struct + Limit int64 + Offset int64 + Records []WsOrderRecord + Total int64 + type ResponseSell ResponseOrder + type ResponseTicker struct + BaseVolume string + Elapsed string + High24hr string + HighestBid string + Last string + Low24hr string + LowestAsk string + PercentChange string + QuoteVolume string + Result string + type ResponseWsBase struct + Error interface{} + Id int64 + Result interface{} + type ResponseWsKline struct + Amount string + Close string + High string + Low string + Open string + Symbol string + Time int64 + Volume string + type ResponseWsTicker struct + BaseVolume string + Change string + Close string + High string + Last string + Low string + Open string + Period int64 + QuoteVolume string + type SpotV4 struct + Key string + Logger *zap.SugaredLogger + Secret string + func NewSpotV4(key, secret, host string, logger *zap.SugaredLogger) *SpotV4 + func (g *SpotV4) AllSymbols(ctx context.Context) (symbols []exchange.Symbol, err error) + func (g *SpotV4) AvailableBalance(ctx context.Context) (map[string]decimal.Decimal, error) + func (g *SpotV4) Balance(ctx context.Context) ([]exchange.Balance, error) + func (g *SpotV4) BuyLimit(ctx context.Context, symbol, clientOrderId string, ...) (exchange.Order, error) + func (g *SpotV4) BuyMarket(ctx context.Context, symbol exchange.Symbol, clientOrderId string, ...) (exchange.Order, error) + func (g *SpotV4) BuyStopLimit(symbol, clientOrderId string, price, amount, stopPrice decimal.Decimal) (orderId uint64, err error) + func (g *SpotV4) CancelAllOrders(ctx context.Context, symbol string) ([]exchange.Order, error) + func (g *SpotV4) CancelOrder(ctx context.Context, symbol string, orderId uint64) (exchange.Order, error) + func (g *SpotV4) CandleBySize(symbol string, period time.Duration, size int) (hs.Candle, error) + func (g *SpotV4) CandleBySizeContext(ctx context.Context, symbol string, period time.Duration, size int) (hs.Candle, error) + func (g *SpotV4) Currencies(ctx context.Context) ([]gateapi.Currency, error) + func (g *SpotV4) GetOrder(ctx context.Context, symbol string, orderId uint64) (exchange.Order, error) + func (g *SpotV4) GetSymbol(ctx context.Context, symbol string) (s exchange.Symbol, err error) + func (g *SpotV4) IsFullFilled(ctx context.Context, symbol string, orderId uint64) (order exchange.Order, filled bool, err error) + func (g *SpotV4) Last24hVolume(ctx context.Context, symbol string) (decimal.Decimal, error) + func (g *SpotV4) LastPrice(ctx context.Context, symbol string) (decimal.Decimal, error) + func (g *SpotV4) ListOpenOrders(ctx context.Context, symbol string) ([]exchange.Order, error) + func (g *SpotV4) ListOrders(ctx context.Context, symbol, status string) ([]exchange.Order, error) + func (g *SpotV4) MyTrades(ctx context.Context, symbol, orderId string) ([]exchange.Trade, error) + func (g *SpotV4) Name() string + func (g *SpotV4) ReqBalance(ctx context.Context, currencies []string) + func (g *SpotV4) ReqCandlestick(ctx context.Context, symbol, clientId string, period time.Duration, ...) (hs.Candle, error) + func (g *SpotV4) ReqOrder(ctx context.Context, symbol, clientId string) (orders []exchange.Order, err error) + func (g *SpotV4) ReqPing(ctx context.Context, id int64) (string, error) + func (g *SpotV4) ReqTicker(ctx context.Context, id int64, symbol string, period time.Duration) (hs.Ticker, error) + func (g *SpotV4) ReqTime(ctx context.Context, id int64) (int64, error) + func (g *SpotV4) SellLimit(ctx context.Context, symbol, text string, price, amount decimal.Decimal) (exchange.Order, error) + func (g *SpotV4) SellMarket(ctx context.Context, symbol exchange.Symbol, clientOrderId string, ...) (exchange.Order, error) + func (g *SpotV4) SellStopLimit(symbol, clientOrderId string, price, amount, stopPrice decimal.Decimal) (orderId uint64, err error) + func (g *SpotV4) SubBalance(currencies []string) + func (g *SpotV4) SubCandlestick(symbol, clientId string, period time.Duration, ...) + func (g *SpotV4) SubOrder(ctx context.Context, symbol, clientId string, ...) + func (g *SpotV4) SubTicker(id int64, symbol string, responseHandler exchange.ResponseHandler) + func (g *SpotV4) SubscribeCandlestick(symbol, clientId string, period time.Duration, ...) + func (g *SpotV4) SubscribeCandlestickWithReq(symbol, clientId string, period time.Duration, ...) + func (g *SpotV4) SubscribeOrder(ctx context.Context, symbol, clientId string, ...) + func (g *SpotV4) Ticker(ctx context.Context, symbol string) (exchange.Ticker, error) + func (g *SpotV4) Tickers(ctx context.Context) ([]exchange.Ticker, error) + func (g *SpotV4) UnsubBalance(currencies []string) + func (g *SpotV4) UnsubCandlestick(symbol, clientId string) + func (g *SpotV4) UnsubTicker(id int64, symbol string) + func (g *SpotV4) UnsubscribeCandlestick(symbol, clientId string, period time.Duration) + func (g *SpotV4) UnsubscribeCandlestickWithReq(symbol, clientId string, period time.Duration) + type UpdateWsBase struct + Id int64 + Method string + Params interface{} + type V2 struct + Key string + Logger *zap.SugaredLogger + Secret string + func NewV2(key, secret, host string, logger *zap.SugaredLogger) *V2 + func (g *V2) AllSymbols(ctx context.Context) (symbols []exchange.Symbol, err error) + func (g *V2) BuyLimit(symbol, text string, price, amount decimal.Decimal) (orderId uint64, err error) + func (g *V2) BuyMarket(symbol exchange.Symbol, clientOrderId string, total decimal.Decimal) (orderId uint64, err error) + func (g *V2) BuyOrder(symbol string, price, amount decimal.Decimal, orderType, text string) (resp ResponseOrder, err error) + func (g *V2) BuyStopLimit(symbol, clientOrderId string, price, amount, stopPrice decimal.Decimal) (orderId uint64, err error) + func (g *V2) CancelAllOrders(types string, currencyPair string) (res ResponseCancel, err error) + func (g *V2) CancelOrder(symbol string, orderNumber uint64) error + func (g *V2) CandleBySize(symbol string, period time.Duration, size int) (candle hs.Candle, err error) + func (g *V2) CandleFrom(symbol, clientId string, period time.Duration, from, to time.Time) (hs.Candle, error) + func (g *V2) GetCandle(symbol string, groupSec, rangeHour int) (candles hs.Candle, err error) + func (g *V2) GetFee(symbol string) (fee exchange.Fee, err error) + func (g *V2) GetOrder(orderId uint64, symbol string) (order exchange.Order, err error) + func (g *V2) GetOrderById(orderId uint64, symbol string) (order exchange.Order, err error) + func (g *V2) GetOrderString(orderId uint64, symbol string) (string, error) + func (g *V2) GetPairs() (pairs []string, err error) + func (g *V2) GetSymbol(ctx context.Context, symbol string) (s exchange.Symbol, err error) + func (g *V2) IsFullFilled(symbol string, orderId uint64) (order exchange.Order, filled bool, err error) + func (g *V2) Last24hVolume(symbol string) (decimal.Decimal, error) + func (g *V2) LastPrice(symbol string) (decimal.Decimal, error) + func (g *V2) MarketInfo() (res ResponseMarketInfo, err error) + func (g *V2) MyTradeHistory(symbol string, orderId uint64) ([]exchange.Trade, error) + func (g *V2) OpenOrders() ([]exchange.Order, error) + func (g *V2) OrderBook(symbol string) (ResponseOrderBook, error) + func (g *V2) ReqBalance(ctx context.Context, currencies []string) + func (g *V2) ReqCandlestick(ctx context.Context, symbol, clientId string, period time.Duration, ...) (hs.Candle, error) + func (g *V2) ReqOrder(ctx context.Context, symbol, clientId string) (orders []exchange.Order, err error) + func (g *V2) ReqPing(ctx context.Context, id int64) (string, error) + func (g *V2) ReqTicker(ctx context.Context, id int64, symbol string, period time.Duration) (hs.Ticker, error) + func (g *V2) ReqTime(ctx context.Context, id int64) (int64, error) + func (g *V2) SellLimit(symbol, text string, price, amount decimal.Decimal) (orderId uint64, err error) + func (g *V2) SellMarket(symbol exchange.Symbol, clientOrderId string, amount decimal.Decimal) (orderId uint64, err error) + func (g *V2) SellStopLimit(symbol, clientOrderId string, price, amount, stopPrice decimal.Decimal) (orderId uint64, err error) + func (g *V2) SpotAvailableBalance() (map[string]decimal.Decimal, error) + func (g *V2) SpotBalance() (map[string]decimal.Decimal, error) + func (g *V2) SpotBalanceDetail() (map[string]exchange.Balance, error) + func (g *V2) SubBalance(currencies []string) + func (g *V2) SubCandlestick(symbol, clientId string, period time.Duration, ...) + func (g *V2) SubOrder(symbol, clientId string, responseHandler exchange.ResponseHandler) + func (g *V2) SubTicker(id int64, symbol string, responseHandler exchange.ResponseHandler) + func (g *V2) Ticker(currencyPair string) (*exchange.Ticker, error) + func (g *V2) TradeHistory(params string) (string, error) + func (g *V2) UnsubBalance(currencies []string) + func (g *V2) UnsubCandlestick(symbol, clientId string) + func (g *V2) UnsubOrder(symbol, clientId string) + func (g *V2) UnsubTicker(id int64, symbol string) + type WebsocketClient struct + func (c *WebsocketClient) Auth(api, secret string) + func (c *WebsocketClient) AuthHandler(handler base.ResponseHandler) base.ResponseHandler + func (c *WebsocketClient) Init(host, path string, logger *zap.SugaredLogger) *WebsocketClient + func (c *WebsocketClient) Ping(id int64) + func (c *WebsocketClient) PingHandler(handler base.ResponseHandler) base.ResponseHandler + func (c *WebsocketClient) ReqCandle(id int64, symbol string, start, end, interval int64) + func (c *WebsocketClient) ReqCandleHandler(handler base.ResponseHandler) base.ResponseHandler + func (c *WebsocketClient) ReqTicker(id int64, symbol string, period int64) + func (c *WebsocketClient) ReqTickerHandler(handler base.ResponseHandler) base.ResponseHandler + func (c *WebsocketClient) SetHandler(connectedHandler base.ConnectedHandler, responseHandler base.ResponseHandler) + func (c *WebsocketClient) SubCandle(id int64, symbol string, interval int64) + func (c *WebsocketClient) SubCandleHandler(handler exchange.ResponseHandler) base.ResponseHandler + func (c *WebsocketClient) SubTicker(id int64, symbol string) + func (c *WebsocketClient) SubTickerHandler(handler exchange.ResponseHandler) base.ResponseHandler + func (c *WebsocketClient) Time(id int64) + func (c *WebsocketClient) TimeHandler(handler base.ResponseHandler) base.ResponseHandler + func (c *WebsocketClient) UnsubCandle(id int64) + func (c *WebsocketClient) UnsubTicker(id int64) + type WebsocketRequest struct + Id int64 + Method string + Params []interface{} + func (r WebsocketRequest) String() string + type WsOrderRecord struct + Amount string + CTime float64 + DealFee string + DealFeeRebate string + DealGtFee string + DealPointFee string + FTime float64 + FilledAmount string + FilledTotal string + GtDiscount string + GtMakerFee string + GtTakerFee string + Iceberg string + Id uint64 + Left string + MTime float64 + Market string + OrderType int + Price string + Text string + Tif int64 + Type int + User int64