# README
GoCryptoTrader package Gateio

This gateio package is part of the GoCryptoTrader codebase.
This is still in active development
You can track ideas, planned features and what's in progress on our GoCryptoTrader Kanban board.
Join our slack to discuss all things related to GoCryptoTrader! GoCryptoTrader Slack
GateIO Exchange
Current Features
- REST functions
How to enable
-
Individual package example below:
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
How to do REST public/private calls
- If enabled via "configuration".json file the exchange will be added to the
IBotExchange array in the
go var bot Bot
and you will only be able to use the wrapper interface functions for accessing exchange data. View routines.go for an example of integration usage with GoCryptoTrader. Rudimentary example below:
main.go
var g exchange.IBotExchange
for i := range bot.Exchanges {
if bot.Exchanges[i].GetName() == "GateIO" {
g = bot.Exchanges[i]
}
}
// Public calls - wrapper functions
// Fetches current ticker information
tick, err := g.UpdateTicker(...)
if err != nil {
// Handle error
}
// Fetches current orderbook information
ob, err := g.UpdateOrderbook(...)
if err != nil {
// Handle error
}
// Private calls - wrapper functions - make sure your APIKEY and APISECRET are
// set and AuthenticatedAPISupport is set to true
// Fetches current account information
accountInfo, err := g.GetAccountInfo()
if err != nil {
// Handle error
}
- If enabled via individually importing package, rudimentary example below:
// Public calls
// Fetches current ticker information
ticker, err := g.GetTicker()
if err != nil {
// Handle error
}
// Fetches current orderbook information
ob, err := g.GetOrderBook()
if err != nil {
// Handle error
}
// Private calls - make sure your APIKEY and APISECRET are set and
// AuthenticatedAPISupport is set to true
// GetUserInfo returns account info
accountInfo, err := g.GetUserInfo(...)
if err != nil {
// Handle error
}
// Submits an order and the exchange and returns its tradeID
tradeID, err := g.Trade(...)
if err != nil {
// Handle error
}
How to do LongPolling public/private calls
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
Please click GoDocs chevron above to view current GoDoc information for this package
Contribution
Please feel free to submit any pull requests or suggest any desired features to be added.
When submitting a PR, please abide by our coding guidelines:
- Code must adhere to the official Go formatting guidelines (i.e. uses gofmt).
- Code must be documented adhering to the official Go commentary guidelines.
- Code must adhere to our coding style.
- Pull requests need to be based on and opened against the
master
branch.
Donations

If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:
bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc
# Variables
WithdrawalFees the large list of predefined withdrawal fees Prone to change.
# Structs
AccountBalanceInformation represents currency account balance information.
AccountBook represents account changing history item.
AccountBookItem represents account book item.
AmendFuturesOrderParam represents amend futures order parameter.
APIV4KeyPerm represents an API Version 4 Key permission information.
BalanceDetails represents a user's balance details.
CancelOrderByIDParam represents cancel order by id request param.
CancelOrderByIDResponse represents calcel order response when deleted by id.
Candlestick represents candlestick data point detail.
ClosePositionRequestParam represents close position when cross currency is disable.
ContractClosePosition represents user's liquidation history.
ContractStat represents futures stats.
CountdownCancelOrderParam represents countdown cancel order params.
CountdownParams represents query parameters for countdown cancel order.
CreateAPIKeyResponse represents an API key response object.
CreateAPIKeySubAccountParams represents subaccount new API key creation parameters.
CreateOrderRequestData represents a single order creation param.
CrossMarginAccount represents the account detail for cross margin account balance.
CrossMarginAccountHistoryItem represents a cross margin account change history item.
CrossMarginBalance represents cross-margin currency balance detail.
CrossMarginBorrowLoanParams represents a cross margin borrow loan parameters.
CrossMarginCurrencies represents a currency supported by cross margin.
CrossMarginCurrencyBalance represents the currency detailed balance information for cross margin.
CrossMarginLoanResponse represents a cross margin borrow loan response.
CurrencyAndAmount represents request parameters for repayment.
CurrencyBalanceAmount represents currency and its amount.
CurrencyChain currency chain detail.
CurrencyDepositAddressInfo represents a crypto deposit address.
CurrencyInfo represents currency details with permission.
CurrencyPairDetail represents a single currency pair detail.
DeliveryContract represents a delivery contract instance detail.
DepositRecord represents deposit record item.
DualModeResponse represents dual mode enable or disable.
FlashSwapOrderParams represents create flash swap order request parameters.
FlashSwapOrderResponse represents create flash swap order response.
FuturesAccount represents futures account detail.
FuturesCandlestick represents futures candlestick data.
FuturesContract represents futures contract detailed data.
FuturesFundingRate represents futures funding rate response.
FuturesInitial represents a price triggered order initial parameters.
FuturesPremiumIndexKLineResponse represents premium index K-Line information.
FuturesPriceTriggeredOrderParam represents a creates a price triggered order.
FuturesSubAccountBalance represents sub account balance for specific sub account and several currencies.
FuturesTicker represents futures ticker data.
FuturesTrigger represents a price triggered order trigger parameter.
Gateio is the overarching type across this package.
Header defines a websocket header.
IndexConstituent represents index constituents.
InitFlashSwapOrderPreviewResponse represents the order preview for flash order.
InsuranceBalance represents futures insurance balance item.
InterSubAccountTransferParams represents parameters to transfer funds between sub-accounts.
LiquidationHistory represents liquidation history for a specifies settle.
LiquidationHistoryItem liquidation history item.
LoanRecord represents loan repayment specific record.
LoanRepaymentRecord represents loan repayment history record item.
MarginAccountBalanceChangeInfo represents margin account balance.
MarginAccountItem margin account item.
MarginCurrencyBalance represents a currency balance detail information.
MarginCurrencyPairInfo represents margin currency pair detailed info.
MarginFundingAccountItem represents funding account list item.
MarginLoanRequestParam represents margin lend or borrow request param.
MarginLoanResponse represents lending or borrow response.
MaxTransferAndLoanAmount represents the maximum amount to transfer, borrow, or lend for specific currency and currency pair.
ModifyLoanRequestParam represents request parameters for modify loan request.
MultiChainAddressItem represents a multi-chain address item.
MyOptionSettlement represents option private settlement.
OnOffStatus represents on or off status response status.
OptionAccount represents option account.
OptionContract represents an option contract detail.
OptionOrderParam represents option order request body.
OptionOrderResponse represents option order response detail.
OptionSettlement list settlement history.
OptionsTicker represents tickers of options contracts.
OptionsUnderlyingTicker represents underlying ticker.
OptionTradingHistory list personal trading history.
OptionUnderlying represents option underlying and it's index price.
Order represents future order response.
Orderbook stores the orderbook data.
OrderbookData holds orderbook ask and bid datas.
OrderbookItem stores an orderbook item.
OrderbookOfLendingLoan represents order book of lending loans.
OrderCreateParams represents future order creation parameters.
OrderID represents order creation ID response.
PersonalTradingFee represents personal trading fee for specific currency pair.
Position represents futures position.
PositionCloseHistoryResponse represents a close position history detail.
PriceAndAmount used in updating an order.
PriceTriggeredOrder represents a future triggered price order response.
PriceTriggeredOrderParam represents price triggered order request.
PutOrderData represents order detail for price triggered order request.
RepayLoanRequestParam represents loan repay request parameters.
RepaymentHistoryItem represents an item in a repayment history.
SettlementHistoryItem represents a settlement history item.
SpotAccount represents spot account.
SpotOrder represents create order response.
SpotOrdersDetail represents list of orders for specific currency pair.
SpotPersonalTradeHistory represents personal trading history.
SpotPriceTriggeredOrder represents spot price triggered order response data.
SpotTradingFeeRate user trading fee rates.
SubAccount represents a subaccount response.
SubAccountCrossMarginInfo represents subaccount's cross_margin account info.
SubAccountKey represents sub-account key detail information this is a struct to be used for outbound requests.
SubAccountMarginBalance represents sub account margin balance for specific sub account and several currencies.
SubAccountParams represents subaccount creation parameters.
SubAccountTransferParam represents currency subaccount transfer request param.
SubAccountTransferResponse represents transfer records between main and sub accounts.
SwapCurrencies represents Flash Swap supported currencies.
Ticker holds detail ticker information for a currency pair.
Trade represents market trade.
TradingHistoryItem represents futures trading history item.
TransactionIDResponse represents transaction ID.
TransferCurrencyParam represents currency transfer.
TriggerPriceInfo represents a trigger price and related information for Price triggered order.
TriggerTimeResponse represents trigger types.Timeas a response for countdown candle order response.
UnifiedUserAccount represents a unified user account.
UsersAllAccountBalance represents user all account balances.
UsersPositionForUnderlying represents user's position for specified underlying.
WalletSavedAddress represents currency saved address.
WebsocketAmendOrder defines a websocket amend order.
WebsocketAPIResponse defines a general websocket response for api calls.
WebsocketCancellAllResponse defines a websocket order cancel response.
WebsocketCancelParam is a struct to hold the parameters for cancelling orders.
WebsocketErrors defines a websocket error.
WebsocketOrder defines a websocket order.
WebsocketOrderBatchRequest defines a websocket order batch request.
WebsocketOrderRequest defines a websocket order request.
WebsocketOrderResponse defines a websocket order response.
WebsocketPayload defines an individualised websocket payload.
WebsocketRequest defines a websocket request.
WithdrawalRequestParam represents currency withdrawal request param.
WithdrawalResponse represents withdrawal response.
WithdrawalStatus represents currency withdrawal status.
WsAuthInput represents the authentication information.
WsBalance represents a options and futures balance push data.
WsCandlesticks represents the candlestick data for spot, margin and cross margin trades pushed through the websocket channel.
WsCrossMarginBalance represents a cross margin balance detail.
WsCrossMarginLoan represents a cross margin loan push data.
WsEventResponse represents websocket incoming subscription, unsubscription, and update response.
WsFundingBalance represents funding balance push data.
WsFuturesAndOptionsOrderbookUpdate represents futures and options account orderbook update push data.
WsFuturesAutoDeleveragesNotification represents futures auto deleverages push data.
WsFuturesAutoOrder represents an auto order push data.
WsFuturesLiquidationNotification represents a liquidation notification push data.
WsFuturesOrder represents futures order.
WsFuturesOrderbookSnapshot represents a futures orderbook snapshot push data.
WsFuturesOrderbookTicker represents the orderbook ticker push data.
WsFuturesOrderbookUpdateEvent represents futures orderbook push data with the event 'update'.
WsFuturesPosition represents futures notify positions update.
WsFuturesReduceRiskLimitNotification represents a futures reduced risk limit push data.
WsFuturesTrades represents a list of trades push data.
WsFuturesUserTrade represents a futures account user trade push data.
WsFutureTicker represents a futures push data.
WsInput represents general structure for websocket requests.
WsMarginBalance represents margin account balance push data.
WsOptionsContract represents an option contract push data.
WsOptionsContractCandlestick represents an options contract candlestick push data.
WsOptionsLiquidates represents the liquidates push data of option account.
WsOptionsMarkPrice represents options mark price push data.
WsOptionsOrder represents options order push data.
WsOptionsOrderbookSnapshot represents the options orderbook snapshot push data.
WsOptionsOrderbookTicker represents options orderbook ticker push data.
WsOptionsPosition represents positions push data for options account.
WsOptionsSettlement represents a options settlement push data.
WsOptionsTrades represents options trades for websocket push data.
WsOptionsUnderlyingPrice represents the underlying price.
WsOptionsUserSettlement represents user's personal settlements push data of options account.
WsOptionsUserTrade represents user's personal trades of option account.
WsOptionUnderlyingTicker represents options underlying ticker push data.
WsOrderbookSnapshot represents a websocket orderbook snapshot push data.
WsOrderbookTickerData represents the websocket orderbook best bid or best ask push data.
WsOrderbookUpdate represents websocket orderbook update push data.
WsPositionClose represents a close position futures push data.
WSResponse represents generalized websocket push data from the server.
WsSpotBalance represents a spot balance.
WsSpotOrder represents an order push data through the websocket channel.
WsTicker websocket ticker information.
WsTrade represents a websocket push data response for a trade.
WsUserPersonalTrade represents a user's personal trade pushed through the websocket connection.
# Type aliases
GeneratePayload returns the payload for a websocket message.