Documentation ¶
Index ¶
- Constants
- Variables
- func Buy1(bids []Quote) (price, amount float64)
- func Fee(fee, feeCoin, gtFee, pointFee string) (feeMap map[string]string)
- func Sell1(asks []Quote) (price, amount float64)
- type GateIO
- func (g *GateIO) AvailableBalance() (map[string]decimal.Decimal, error)
- func (g *GateIO) Broadcast(order exchange.Order)
- func (g *GateIO) Buy(symbol string, price, amount decimal.Decimal, orderType, text string) (orderId uint64, err error)
- func (g *GateIO) BuyOrder(symbol string, price, amount decimal.Decimal, orderType, text string) (resp ResponseOrder, err error)
- func (g *GateIO) CancelAllOrders(types string, currencyPair string) (res ResponseCancel, err error)
- func (g *GateIO) CancelOrder(currencyPair string, orderNumber uint64) (ok bool, err error)
- func (g *GateIO) Candles(currencyPair string, groupSec, rangeHour int) (candles []exchange.Candle, err error)
- func (g *GateIO) GetCandle(symbol string, groupSec, rangeHour int) (candles hs.Candle, err error)
- func (g *GateIO) GetOrder(orderNumber uint64, currencyPair string) (order exchange.Order, err error)
- func (g *GateIO) GetPairs() (string, error)
- func (g *GateIO) IsOrderClose(symbol string, orderId uint64) (order exchange.Order, closed bool)
- func (g *GateIO) LastPrice(symbol string) (decimal.Decimal, 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) Sell(symbol string, price, amount decimal.Decimal, orderType, text string) (orderId uint64, err error)
- func (g *GateIO) Ticker(currencyPair string) (*exchange.Ticker, error)
- func (g *GateIO) TradeHistory(params string) (string, error)
- type MyTradeHistoryResult
- type Quote
- type RawCandle
- type RawOrderInGetOrder
- type RawOrderInOpenOrders
- type RawTrade
- type ResponseBalances
- type ResponseBuy
- type ResponseCancel
- type ResponseCandles
- type ResponseGetOrder
- type ResponseOpenOrders
- type ResponseOrder
- type ResponseOrderBook
- type ResponseSell
- type ResponseTicker
Constants ¶
View Source
const ( BTC_USDT = "btc_usdt" BTC3L_USDT = "btc3l_usdt" BTC3S_USDT = "btc3s_usdt" SERO_USDT = "sero_usdt" BTC = "BTC" BTC3L = "BTC3L" BTC3S = "BTC3S" USDT = "USDT" SERO = "SERO" )
View Source
const ( OrderTypeNormal = "gtc" OrderTypeGTC = "gtc" OrderTypeIOC = "ioc" OrderTypePOC = "poc" )
used by buy/sell
View Source
const ( OrderStatusOpen = "open" OrderStatusCancelled = "cancelled" OrderStatusClosed = "closed" OrderTypeBuy = "buy" OrderTypeSell = "sell" )
View Source
const ( GET = "GET" POST = "POST" )
View Source
const (
DefaultHost = "gateio.life"
)
Variables ¶
View Source
var ( PricePrecision = map[string]int{ BTC_USDT: 2, BTC3L_USDT: 4, BTC3S_USDT: 4, SERO_USDT: 5, } AmountPrecision = map[string]int{ BTC_USDT: 4, BTC3L_USDT: 3, BTC3S_USDT: 3, SERO_USDT: 3, } MinAmount = map[string]float64{ BTC_USDT: 0.0001, BTC3L_USDT: 0.001, BTC3S_USDT: 0.001, SERO_USDT: 0.001, } MinTotal = map[string]int64{ BTC_USDT: 1, BTC3L_USDT: 1, BTC3S_USDT: 1, SERO_USDT: 1, } )
Functions ¶
Types ¶
type GateIO ¶
func (*GateIO) AvailableBalance ¶
Get account fund balances
func (*GateIO) Buy ¶
func (g *GateIO) Buy(symbol string, price, amount decimal.Decimal, orderType, text string) (orderId uint64, err error)
订单类型("gtc":普通订单(默认);“ioc”:立即执行否则取消订单(Immediate-Or-Cancel,IOC);"poc":被动委托(只挂单,不吃单)(Pending-Or-Cancelled,POC)) Place order buy
func (*GateIO) CancelAllOrders ¶
func (g *GateIO) CancelAllOrders(types string, currencyPair string) (res ResponseCancel, err error)
Cancel all orders
func (*GateIO) CancelOrder ¶
Cancel order
func (*GateIO) Candles ¶
func (g *GateIO) Candles(currencyPair string, groupSec, rangeHour int) (candles []exchange.Candle, err error)
获取Candle
func (*GateIO) GetOrder ¶
func (g *GateIO) GetOrder(orderNumber uint64, currencyPair string) (order exchange.Order, err error)
Get order status
func (*GateIO) IsOrderClose ¶
func (*GateIO) MyTradeHistory ¶
func (g *GateIO) MyTradeHistory(currencyPair string) (*MyTradeHistoryResult, error)
获取我的24小时内成交记录
func (*GateIO) OpenOrders ¶
func (g *GateIO) OpenOrders() (res ResponseOpenOrders, err error)
Get my open order list
func (*GateIO) OrderBook ¶ added in v0.10.13
func (g *GateIO) OrderBook(symbol string) (ResponseOrderBook, error)
Depth of pair
func (*GateIO) Sell ¶
func (g *GateIO) Sell(symbol string, price, amount decimal.Decimal, orderType, text string) (orderId uint64, err error)
Place order sell
func (*GateIO) Ticker ¶
Market Info
func (g *GateIO) marketinfo() string { var method string = "GET" url := "/marketinfo" param := "" var ret string = g.httpDo(method, url, param) return ret }
// Market Details
func (g *GateIO) marketlist() string { var method string = "GET" url := "/marketlist" param := "" var ret string = g.httpDo(method, url, param) return ret }
// tickers
func (g *GateIO) tickers() string { var method string = "GET" url := "/tickers" param := "" var ret string = g.httpDo(method, url, param) return ret }
ticker
type MyTradeHistoryResult ¶
type RawOrderInGetOrder ¶
type RawOrderInGetOrder struct { OrderNumber string Status string // 订单状态 open已挂单 cancelled已取消 closed已完成 CurrencyPair string `json:"currencyPair"` Type string // sell, buy Rate string // 价格 Amount string // 买卖数量 InitialRate string // 下单价格 InitialAmount string // 下单数量 //FilledRate interface{} // string when open, float64 when closed FilledAmount string FeePercentage float64 FeeValue string FeeCurrency string Fee string Timestamp int64 }
type RawOrderInOpenOrders ¶
type RawOrderInOpenOrders struct { OrderNumber string Status string // 记录状态 DONE:完成; CANCEL:取消; REQUEST:请求中 CurrencyPair string Type string Rate int64 // 价格 Amount string // 买卖数量 Total string InitialRate int64 // 下单价格 InitialAmount string // 下单数量 FilledRate string // 成交价格 FilledAmount string // 成交数量 Timestamp string }
type RawTrade ¶
type RawTrade struct { TradeId uint64 `json:"tradeID"` OrderNumber uint64 `json:"orderNumber"` Pair string `json:"pair"` Type string `json:"type"` Rate string `json:"rate"` Amount string `json:"amount"` Total float64 `json:"total"` Date string `json:"date"` TimeUnix int64 `json:"time_unix"` Role string `json:"role"` Fee string `json:"fee"` FeeCoin string `json:"fee_coin"` GtFee string `json:"gt_fee"` PointFee string `json:"point_fee"` }
from api result
type ResponseBalances ¶
type ResponseBuy ¶
type ResponseBuy struct { Result string Message string Code int OrderNumber uint64 Market string // 交易对 CTime float64 `json:"ctime"` // 时间戳: 1585793595.5014, 秒.毫秒 Side int Iceberg string Rate string // 下单价格 FilledRate string // 成交价格 LeftAmount string // 剩余数量 FilledAmount string // 成交数量 FeePercentage float64 FeeValue string FeeCurrency string Fee string }
type ResponseCancel ¶
type ResponseCandles ¶
type ResponseGetOrder ¶
type ResponseGetOrder struct { Result string Message string Code int Elapsed string Order RawOrderInGetOrder }
type ResponseOpenOrders ¶
type ResponseOpenOrders struct { Result string Message string Code int64 Elapsed string Orders []RawOrderInOpenOrders }
type ResponseOrder ¶
type ResponseOrderBook ¶ added in v0.10.13
type ResponseSell ¶
type ResponseSell ResponseOrder
type ResponseTicker ¶
Click to show internal directories.
Click to hide internal directories.