gate

package
v0.0.0-...-f37401a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 25, 2018 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Balance

type Balance struct {
	Available map[string]float64
	Locked    map[string]float64
}

Balance ...

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client 提供gate API的调用客户端

func NewClient

func NewClient(config *config.Config) *Client

NewClient 创建一个新的client

func (*Client) CancelOrder

func (c *Client) CancelOrder(req global.CancelReq) error

CancelOrder 取消订单 通过测试,第一个参数对结果没有影响,只要orderno正确就能取消订单, 但是如果第一个参数填入错误的代码将返回错误,但是订单依然被取消了

func (*Client) DepositAddr

func (c *Client) DepositAddr(currency string) (string, error)

DepositAddr 获取充值地址

func (*Client) DepositsWithdrawals

func (c *Client) DepositsWithdrawals() ([]DWInfo, []DWInfo, error)

DepositsWithdrawals 获取充值提现历史 return1 充值, return2 提现

func (*Client) GetAllSymbol

func (c *Client) GetAllSymbol() ([]global.TradeSymbol, error)

GetAllSymbol 交易市场详细行情接口

func (*Client) GetDepth

func (c *Client) GetDepth(sreq global.TradeSymbol) (global.Depth, error)

GetDepth 获取深度行情

func (*Client) GetFund

func (c *Client) GetFund(global.FundReq) ([]global.Fund, error)

GetFund 获取帐号资金余额

func (*Client) GetKline

func (c *Client) GetKline(req global.KlineReq) ([]global.Kline, error)

GetKline 获取k线数据

func (*Client) HangingOrderInfo

func (c *Client) HangingOrderInfo() ([]HangingOrder, error)

HangingOrderInfo 获取我的当前挂单列表

func (*Client) InsertOrder

func (c *Client) InsertOrder(req global.InsertReq) (global.InsertRsp, error)

InsertOrder 下单交易 @parm direction 0 - buy, 1 - sell @parm price 买卖价格 ps: minimum 10 usdt. @parm num 买卖币数量

func (*Client) LateTradeInfo

func (c *Client) LateTradeInfo(base, quote string) ([]LateTrade, error)

LateTradeInfo 获取最近80条成交

func (*Client) MatchInfo

func (c *Client) MatchInfo(symbol, orderNo string) ([]Match, error)

MatchInfo 获取我的24小时内成交记录

func (*Client) OrderStatus

func (c *Client) OrderStatus(req global.StatusReq) (global.StatusRsp, error)

OrderStatus 获取订单状态

func (*Client) SetLogger

func (c *Client) SetLogger(logger core.Logger)

SetLogger 设置日志器

func (*Client) SubDepth

func (c *Client) SubDepth(sreq global.TradeSymbol) (chan global.Depth, error)

SubDepth 订阅深度行情

func (*Client) SubLateTrade

func (c *Client) SubLateTrade(sreq global.TradeSymbol) (chan global.LateTrade, error)

SubLateTrade 查询交易详细数据

func (*Client) SubTicker

func (c *Client) SubTicker(sreq global.TradeSymbol) (chan global.Ticker, error)

SubTicker ...

func (*Client) TickerInfo

func (c *Client) TickerInfo(base, quote string) (TickerResponse, error)

TickerInfo 获取行情ticker

func (*Client) Withdraws

func (c *Client) Withdraws(currency, address string, num float64) error

Withdraws 提现

type DWInfo

type DWInfo struct {
	ID        string `json:"id"`
	Currency  string `json:"currency"`
	Address   string `json:"address"`
	Amount    string `json:"amount"`
	Txid      string `json:"txid"`
	Timestamp string `json:"timestamp"`
	Status    string `json:"status"` //DONE:完成; CANCEL:取消; REQUEST:请求中
}

DWInfo ...

type Depth5

type Depth5 struct {
	Base  string   `json:"base"`
	Quote string   `json:"quote"`
	Asks  []PSpair `json:"asks"` // 卖方
	Bids  []PSpair `json:"bids"` // 买方
}

Depth5 ...

type HangingOrder

type HangingOrder struct {
	LeftNum     string `json:"amount"`        // 订单总数量 剩余未成交数量
	Symbol      string `json:"currencyPair"`  // 订单交易对
	TradeNum    string `json:"filledAmount"`  // 已成交量
	TradePrice  string `json:"filledRate"`    // 成交价格
	InsertNum   string `json:"initialAmount"` // 下单量
	InsertPrice string `json:"initialRate"`   // 下单价格
	OrderNo     string `json:"orderNumber"`   // 订单号
	Price       string `json:"rate"`          // 交易单价
	Status      string `json:"status"`        // 订单状态
	Timestamp   string `json:"timestamp"`     // 时间戳
	Total       string `json:"total"`         //总计
	Direction   string `json:"type"`          // 买卖类型 buy:买入;sell:卖出
}

HangingOrder ...

type InsertOrderRsp

type InsertOrderRsp struct {
	Result      string  `json:"result"`      // "true" 表示调用成功
	OrderNo     string  `json:"orderNumber"` // orderNumber可用于查询,取消订单。
	InsertPrice float64 `json:"rate"`
	Direction   int     `json:"_"`
	LeftNum     float64 `json:"leftAmount"`
	FilledNum   float64 `json:"filledAmount"`
	FilledPrice float64 `json:"filledRate"`
	Msg         string  `json:"message"`
}

InsertOrderRsp ...

type Kline

type Kline struct {
	Base      string
	Quote     string
	Timestamp float64 // 时间戳
	Volume    float64 // 交易量
	Close     float64 // 收盘价
	High      float64 // 最高价
	Low       float64 // 最低价
	Open      float64 // 开盘价
}

Kline k线数据

type LateTrade

type LateTrade struct {
	Base      string
	Quote     string
	DateTime  string  `json:"date"`   // 订单时间
	Num       float64 `json:"amount"` // 成交币种数量
	Price     float64 `json:"rate"`   // 币种单价
	Dircetion string  `json:"type"`   // 买卖类型, buy买 sell卖
	Total     float64 `json:"total"`  // 订单总额
}

LateTrade 最近成交记录

type MarketListResponse

type MarketListResponse struct {
	No          int     `json:"no"`
	Symbol      string  `json:"symbol"`
	Name        string  `json:"name"`
	NameEn      string  `json:"name_en"`
	NameCn      string  `json:"name_cn"`
	Pair        string  `json:"pair"`
	Rate        string  `json:"rate"`
	VolA        float64 `json:"vol_a"`
	VolB        string  `json:"vol_b"`
	CurrA       string  `json:"curr_a"`
	CurrB       string  `json:"curr_b"`
	CurrSuffix  string  `json:"curr_suffix"`
	RatePercent string  `json:"rate_percent"`
	Trend       string  `json:"trend"`
	Supply      int64   `json:"supply"`
	MarketCap   string  `json:"marketcap"`
}

MarketListResponse 是MarketList接口的返回值

type Match

type Match struct {
	OrderNo    string `json:"orderid"` // 订单id
	Symbol     string `json:"pair"`    // 交易对
	Direction  string `json:"type"`    // 买卖类型
	TradePrice string `json:"rate"`    // 买卖价格
	TradeNum   string `json:"amount"`  // 订单买卖币种数量
	//TradeTime string `json:"time"`	// 订单时间
	TradeTime string `json:"time_unix"` // 订单unix时间戳
}

Match ...

type OrderInfo

type OrderInfo struct {
	OrderNo     string  `json:"orderNumber"`   //
	Status      string  `json:"status"`        // 订单状态 cancelled已取消 done已完成
	Symbol      string  `json:"currencyPair"`  //  交易对
	Dircetion   string  `json:"type"`          //买卖类型 sell卖出, buy买入
	TradePrice  float64 `json:"rate"`          //价格
	TradeNum    string  `json:"amount"`        //买卖数量
	InsertPrice float64 `json:"initialRate"`   //下单价格
	InsertNum   string  `json:"initialAmount"` //下单量
}

OrderInfo ...

type PSpair

type PSpair struct {
	Price float64 `json:"price"`
	Size  float64 `json:"size"`
}

PSpair 深度行情的价格和手数对

type TickerResponse

type TickerResponse struct {
	Base          string  `json:"base"`
	Quote         string  `json:"quote"`
	BaseVolume    float64 `josn:"baseVolume"`    // 交易量
	High24hr      float64 `json:"high24hr"`      // 24小时最高价
	Low24hr       float64 `json:"low24hr"`       // 24小时最低价
	HighestBid    float64 `json:"highestBid"`    // 买方最高价
	LowestAsk     float64 `json:"lowestAsk"`     // 卖方最低价
	Last          float64 `json:"last"`          // 最新成交价
	PercentChange float64 `json:"percentChange"` // 涨跌百分比
	QuoteVolume   float64 `json:"quoteVolume"`   // 兑换货币交易量
}

TickerResponse ...

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL