Documentation
¶
Index ¶
- Variables
- type BalancesResponse
- type Gateio
- func (g *Gateio) CancelAllExchangeOrders() error
- func (g *Gateio) CancelExchangeOrder(orderID int64) error
- func (g *Gateio) CancelOrder(orderID int64, symbol string) (bool, error)
- func (g *Gateio) GetBalances() (BalancesResponse, error)
- func (g *Gateio) GetExchangeAccountInfo() (exchange.AccountInfo, error)
- func (g *Gateio) GetExchangeDepositAddress(cryptocurrency pair.CurrencyItem) (string, error)
- func (g *Gateio) GetExchangeFundTransferHistory() ([]exchange.FundHistory, error)
- func (g *Gateio) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exchange.TradeHistory, error)
- func (g *Gateio) GetExchangeOrderInfo(orderID int64) (exchange.OrderDetail, error)
- func (g *Gateio) GetLatestSpotPrice(symbol string) (float64, error)
- func (g *Gateio) GetMarketInfo() (MarketInfoResponse, error)
- func (g *Gateio) GetOrderbook(symbol string) (Orderbook, error)
- func (g *Gateio) GetOrderbookEx(currency pair.CurrencyPair, assetType string) (orderbook.Base, error)
- func (g *Gateio) GetSpotKline(arg KlinesRequestParams) ([]*KLineResponse, error)
- func (g *Gateio) GetSymbols() ([]string, error)
- func (g *Gateio) GetTicker(symbol string) (TickerResponse, error)
- func (g *Gateio) GetTickerPrice(p pair.CurrencyPair, assetType string) (ticker.Price, error)
- func (g *Gateio) GetTickers() (map[string]TickerResponse, error)
- func (g *Gateio) ModifyExchangeOrder(orderID int64, action exchange.ModifyOrder) (int64, error)
- func (g *Gateio) Run()
- func (g *Gateio) SendAuthenticatedHTTPRequest(method, endpoint, param string, result interface{}) error
- func (g *Gateio) SendHTTPRequest(path string, result interface{}) error
- func (g *Gateio) SetDefaults()
- func (g *Gateio) Setup(exch config.ExchangeConfig)
- func (g *Gateio) SpotNewOrder(arg SpotNewOrderRequestParams) (SpotNewOrderResponse, error)
- func (g *Gateio) Start(wg *sync.WaitGroup)
- func (g *Gateio) SubmitExchangeOrder(p pair.CurrencyPair, side exchange.OrderSide, orderType exchange.OrderType, ...) (int64, error)
- func (g *Gateio) UpdateOrderbook(p pair.CurrencyPair, assetType string) (orderbook.Base, error)
- func (g *Gateio) UpdateTicker(p pair.CurrencyPair, assetType string) (ticker.Price, error)
- func (g *Gateio) WithdrawCryptoExchangeFunds(address string, cryptocurrency pair.CurrencyItem, amount float64) (string, error)
- func (g *Gateio) WithdrawFiatExchangeFunds(currency pair.CurrencyItem, amount float64) (string, error)
- func (g *Gateio) WithdrawFiatExchangeFundsToInternationalBank(currency pair.CurrencyItem, amount float64) (string, error)
- type KLineResponse
- type KlinesRequestParams
- type MarketInfoPairsResponse
- type MarketInfoResponse
- type Orderbook
- type OrderbookItem
- type OrderbookResponse
- type SpotNewOrderRequestParams
- type SpotNewOrderRequestParamsType
- type SpotNewOrderResponse
- type TickerResponse
- type TimeInterval
Constants ¶
This section is empty.
Variables ¶
var ( // SpotNewOrderRequestParamsTypeBuy buy order SpotNewOrderRequestParamsTypeBuy = SpotNewOrderRequestParamsType("buy") // SpotNewOrderRequestParamsTypeSell sell order SpotNewOrderRequestParamsTypeSell = SpotNewOrderRequestParamsType("sell") )
var ( TimeIntervalMinute = TimeInterval(60) TimeIntervalThreeMinutes = TimeInterval(60 * 3) TimeIntervalFiveMinutes = TimeInterval(60 * 5) TimeIntervalFifteenMinutes = TimeInterval(60 * 15) TimeIntervalThirtyMinutes = TimeInterval(60 * 30) TimeIntervalHour = TimeInterval(60 * 60) TimeIntervalTwoHours = TimeInterval(2 * 60 * 60) TimeIntervalFourHours = TimeInterval(4 * 60 * 60) TimeIntervalSixHours = TimeInterval(6 * 60 * 60) TimeIntervalDay = TimeInterval(60 * 60 * 24) )
TimeInterval vars
Functions ¶
This section is empty.
Types ¶
type BalancesResponse ¶
type BalancesResponse struct { Result string `json:"result"` Available map[string]string `json:"available"` Locked map[string]string `json:"locked"` }
BalancesResponse holds the user balances
type Gateio ¶
Gateio is the overarching type across this package
func (*Gateio) CancelAllExchangeOrders ¶
CancelAllExchangeOrders cancels all orders associated with a currency pair
func (*Gateio) CancelExchangeOrder ¶
CancelExchangeOrder cancels an order by its corresponding ID number
func (*Gateio) CancelOrder ¶
CancelOrder cancels an order given the supplied orderID and symbol orderID order ID number symbol trade pair (ltc_btc)
func (*Gateio) GetBalances ¶
func (g *Gateio) GetBalances() (BalancesResponse, error)
GetBalances obtains the users account balance
func (*Gateio) GetExchangeAccountInfo ¶
GetExchangeAccountInfo retrieves balances for all enabled currencies for the ZB exchange
func (*Gateio) GetExchangeDepositAddress ¶
func (g *Gateio) GetExchangeDepositAddress(cryptocurrency pair.CurrencyItem) (string, error)
GetExchangeDepositAddress returns a deposit address for a specified currency
func (*Gateio) GetExchangeFundTransferHistory ¶
GetExchangeFundTransferHistory returns funding history, deposits and withdrawals
func (*Gateio) GetExchangeHistory ¶
func (g *Gateio) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exchange.TradeHistory, error)
GetExchangeHistory returns historic trade data since exchange opening.
func (*Gateio) GetExchangeOrderInfo ¶
GetExchangeOrderInfo returns information on a current open order
func (*Gateio) GetLatestSpotPrice ¶
GetLatestSpotPrice returns latest spot price of symbol updated every 10 seconds
symbol: string of currency pair
func (*Gateio) GetMarketInfo ¶
func (g *Gateio) GetMarketInfo() (MarketInfoResponse, error)
GetMarketInfo returns information about all trading pairs, including transaction fee, minimum order quantity, price accuracy and so on
func (*Gateio) GetOrderbook ¶
GetOrderbook returns the orderbook data for a suppled symbol
func (*Gateio) GetOrderbookEx ¶
func (g *Gateio) GetOrderbookEx(currency pair.CurrencyPair, assetType string) (orderbook.Base, error)
GetOrderbookEx returns orderbook base on the currency pair
func (*Gateio) GetSpotKline ¶
func (g *Gateio) GetSpotKline(arg KlinesRequestParams) ([]*KLineResponse, error)
GetSpotKline returns kline data for the most recent time period
func (*Gateio) GetSymbols ¶
GetSymbols returns all supported symbols
func (*Gateio) GetTicker ¶
func (g *Gateio) GetTicker(symbol string) (TickerResponse, error)
GetTicker returns a ticker for the supplied symbol updated every 10 seconds
func (*Gateio) GetTickerPrice ¶
GetTickerPrice returns the ticker for a currency pair
func (*Gateio) GetTickers ¶
func (g *Gateio) GetTickers() (map[string]TickerResponse, error)
GetTickers returns tickers for all symbols
func (*Gateio) ModifyExchangeOrder ¶
ModifyExchangeOrder will allow of changing orderbook placement and limit to market conversion
func (*Gateio) SendAuthenticatedHTTPRequest ¶
func (g *Gateio) SendAuthenticatedHTTPRequest(method, endpoint, param string, result interface{}) error
SendAuthenticatedHTTPRequest sends authenticated requests to the Gateio API To use this you must setup an APIKey and APISecret from the exchange
func (*Gateio) SendHTTPRequest ¶
SendHTTPRequest sends an unauthenticated HTTP request
func (*Gateio) SetDefaults ¶
func (g *Gateio) SetDefaults()
SetDefaults sets default values for the exchange
func (*Gateio) Setup ¶
func (g *Gateio) Setup(exch config.ExchangeConfig)
Setup sets user configuration
func (*Gateio) SpotNewOrder ¶
func (g *Gateio) SpotNewOrder(arg SpotNewOrderRequestParams) (SpotNewOrderResponse, error)
SpotNewOrder places a new order
func (*Gateio) SubmitExchangeOrder ¶
func (g *Gateio) SubmitExchangeOrder(p pair.CurrencyPair, side exchange.OrderSide, orderType exchange.OrderType, amount, price float64, clientID string) (int64, error)
SubmitExchangeOrder submits a new order
func (*Gateio) UpdateOrderbook ¶
UpdateOrderbook updates and returns the orderbook for a currency pair
func (*Gateio) UpdateTicker ¶
UpdateTicker updates and returns the ticker for a currency pair
func (*Gateio) WithdrawCryptoExchangeFunds ¶
func (g *Gateio) WithdrawCryptoExchangeFunds(address string, cryptocurrency pair.CurrencyItem, amount float64) (string, error)
WithdrawCryptoExchangeFunds returns a withdrawal ID when a withdrawal is submitted
func (*Gateio) WithdrawFiatExchangeFunds ¶
func (g *Gateio) WithdrawFiatExchangeFunds(currency pair.CurrencyItem, amount float64) (string, error)
WithdrawFiatExchangeFunds returns a withdrawal ID when a withdrawal is submitted
func (*Gateio) WithdrawFiatExchangeFundsToInternationalBank ¶
func (g *Gateio) WithdrawFiatExchangeFundsToInternationalBank(currency pair.CurrencyItem, amount float64) (string, error)
WithdrawFiatExchangeFundsToInternationalBank returns a withdrawal ID when a withdrawal is submitted
type KLineResponse ¶
type KLineResponse struct { ID float64 KlineTime time.Time Open float64 Time float64 High float64 Low float64 Close float64 Volume float64 Amount float64 `db:"amount"` }
KLineResponse holds the kline response data
type KlinesRequestParams ¶
type KlinesRequestParams struct { Symbol string // Required field; example LTCBTC,BTCUSDT HourSize int // How many hours of data GroupSec TimeInterval }
KlinesRequestParams represents Klines request data.
type MarketInfoPairsResponse ¶
type MarketInfoPairsResponse struct { Symbol string // DecimalPlaces symbol price accuracy DecimalPlaces float64 // MinAmount minimum order amount MinAmount float64 // Fee transaction fee Fee float64 }
MarketInfoPairsResponse holds the market info response data
type MarketInfoResponse ¶
type MarketInfoResponse struct { Result string `json:"result"` Pairs []MarketInfoPairsResponse `json:"pairs"` }
MarketInfoResponse holds the market info data
type Orderbook ¶
type Orderbook struct { Result string Elapsed string Bids []OrderbookItem Asks []OrderbookItem }
Orderbook stores the orderbook data
type OrderbookItem ¶
OrderbookItem stores an orderbook item
type OrderbookResponse ¶
type OrderbookResponse struct { Result string `json:"result"` Elapsed string `json:"elapsed"` Asks [][]string Bids [][]string }
OrderbookResponse stores the orderbook data
type SpotNewOrderRequestParams ¶
type SpotNewOrderRequestParams struct { Amount float64 `json:"amount"` // Order quantity Price float64 `json:"price"` // Order price Symbol string `json:"symbol"` // Trading pair; btc_usdt, eth_btc...... Type SpotNewOrderRequestParamsType `json:"type"` // Order type (buy or sell), }
SpotNewOrderRequestParams Order params
type SpotNewOrderRequestParamsType ¶
type SpotNewOrderRequestParamsType string
SpotNewOrderRequestParamsType order type (buy or sell)
type SpotNewOrderResponse ¶
type SpotNewOrderResponse struct { OrderNumber int64 `json:"orderNumber"` // OrderID number Price float64 `json:"rate,string"` // Order price LeftAmount float64 `json:"leftAmount,string"` // The remaining amount to fill FilledAmount float64 `json:"filledAmount,string"` // The filled amount Filledrate float64 `json:"filledRate,string"` // FilledPrice }
SpotNewOrderResponse Order response
type TickerResponse ¶
type TickerResponse struct { Result string `json:"result"` Volume float64 `json:"baseVolume,string"` // Trading volume High float64 `json:"high24hr,string"` // 24 hour high price Open float64 `json:"highestBid,string"` // Openening price Last float64 `json:"last,string"` // Last price Low float64 `json:"low24hr,string"` // 24 hour low price Close float64 `json:"lowestAsk,string"` // Closing price PercentChange float64 `json:"percentChange,string"` // Percentage change QuoteVolume float64 `json:"quoteVolume,string"` // Quote currency volume }
TickerResponse holds the ticker response data