huobi

package
v0.0.0-...-3240a16 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2017 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HUOBI_API_URL     = "https://api.huobi.com/apiv2.php"
	HUOBI_API_VERSION = "2"
)
View Source
const (
	HUOBI_SOCKETIO_ADDRESS = "https://hq.huobi.com:443"

	//Service API
	HUOBI_SOCKET_REQ_SYMBOL_LIST   = "reqSymbolList"
	HUOBI_SOCKET_REQ_SYMBOL_DETAIL = "reqSymbolDetail"
	HUOBI_SOCKET_REQ_SUBSCRIBE     = "reqMsgSubscribe"
	HUOBI_SOCKET_REQ_UNSUBSCRIBE   = "reqMsgUnsubscribe"

	// Market data API
	HUOBI_SOCKET_MARKET_DETAIL          = "marketDetail"
	HUOBI_SOCKET_TRADE_DETAIL           = "tradeDetail"
	HUOBI_SOCKET_MARKET_DEPTH_TOP       = "marketDepthTop"
	HUOBI_SOCKET_MARKET_DEPTH_TOP_SHORT = "marketDepthTopShort"
	HUOBI_SOCKET_MARKET_DEPTH           = "marketDepth"
	HUOBI_SOCKET_MARKET_DEPTH_TOP_DIFF  = "marketDepthTopDiff"
	HUOBI_SOCKET_MARKET_DEPTH_DIFF      = "marketDepthDiff"
	HUOBI_SOCKET_MARKET_LAST_KLINE      = "lastKLine"
	HUOBI_SOCKET_MARKET_LAST_TIMELINE   = "lastTimeLine"
	HUOBI_SOCKET_MARKET_OVERVIEW        = "marketOverview"
	HUOBI_SOCKET_MARKET_STATIC          = "marketStatic"

	// History data API
	HUOBI_SOCKET_REQ_TIMELINE         = "reqTimeLine"
	HUOBI_SOCKET_REQ_KLINE            = "reqKLine"
	HUOBI_SOCKET_REQ_DEPTH_TOP        = "reqMarketDepthTop"
	HUOBI_SOCKET_REQ_DEPTH            = "reqMarketDepth"
	HUOBI_SOCKET_REQ_TRADE_DETAIL_TOP = "reqTradeDetailTop"
	HUOBI_SOCKET_REQ_MARKET_DETAIL    = "reqMarketDetail"
)

Variables

View Source
var HuobiSocket *socketio.SocketIO

Functions

This section is empty.

Types

type HUOBI

type HUOBI struct {
	exchange.Base
}

func (*HUOBI) BuildHuobiWebsocketParamsList

func (h *HUOBI) BuildHuobiWebsocketParamsList(objectName, currency, pushType, period, count, from, to, percentage string) interface{}

func (*HUOBI) BuildHuobiWebsocketRequest

func (h *HUOBI) BuildHuobiWebsocketRequest(msgType string, requestIndex int64, symbolRequest []string) map[string]interface{}

func (*HUOBI) BuildHuobiWebsocketRequestExtra

func (h *HUOBI) BuildHuobiWebsocketRequestExtra(msgType string, requestIndex int64, symbolIdList interface{}) interface{}

func (*HUOBI) CancelOrder

func (h *HUOBI) CancelOrder(orderID, coinType int)

func (*HUOBI) GetAccountInfo

func (h *HUOBI) GetAccountInfo()

func (*HUOBI) GetExchangeAccountInfo

func (h *HUOBI) GetExchangeAccountInfo() (exchange.AccountInfo, error)

GetExchangeAccountInfo retrieves balances for all enabled currencies for the HUOBI exchange - to-do

func (*HUOBI) GetFee

func (h *HUOBI) GetFee() float64

func (*HUOBI) GetNewDealOrders

func (h *HUOBI) GetNewDealOrders(coinType int)

func (*HUOBI) GetOrderBook

func (h *HUOBI) GetOrderBook(symbol string) (HuobiOrderbook, error)

func (*HUOBI) GetOrderIDByTradeID

func (h *HUOBI) GetOrderIDByTradeID(coinType, orderID int)

func (*HUOBI) GetOrderInfo

func (h *HUOBI) GetOrderInfo(orderID, coinType int)

func (*HUOBI) GetOrderbookEx

func (h *HUOBI) GetOrderbookEx(p pair.CurrencyPair, assetType string) (orderbook.Base, error)

GetOrderbookEx returns orderbook base on the currency pair

func (*HUOBI) GetOrders

func (h *HUOBI) GetOrders(coinType int)

func (*HUOBI) GetTicker

func (h *HUOBI) GetTicker(symbol string) (HuobiTicker, error)

func (*HUOBI) GetTickerPrice

func (h *HUOBI) GetTickerPrice(p pair.CurrencyPair, assetType string) (ticker.Price, error)

GetTickerPrice returns the ticker for a currency pair

func (*HUOBI) MarketTrade

func (h *HUOBI) MarketTrade(orderType string, coinType int, price, amount float64)

func (*HUOBI) ModifyOrder

func (h *HUOBI) ModifyOrder(orderType string, coinType, orderID int, price, amount float64)

func (*HUOBI) OnConnect

func (h *HUOBI) OnConnect(output chan socketio.Message)

func (*HUOBI) OnDisconnect

func (h *HUOBI) OnDisconnect(output chan socketio.Message)

func (*HUOBI) OnError

func (h *HUOBI) OnError()

func (*HUOBI) OnMessage

func (h *HUOBI) OnMessage(message []byte, output chan socketio.Message)

func (*HUOBI) OnRequest

func (h *HUOBI) OnRequest(message []byte, output chan socketio.Message)

func (*HUOBI) Run

func (h *HUOBI) Run()

Run implements the HUOBI wrapper

func (*HUOBI) SendAuthenticatedRequest

func (h *HUOBI) SendAuthenticatedRequest(method string, v url.Values) error

func (*HUOBI) SetDefaults

func (h *HUOBI) SetDefaults()

func (*HUOBI) Setup

func (h *HUOBI) Setup(exch config.ExchangeConfig)

func (*HUOBI) Start

func (h *HUOBI) Start()

Start starts the HUOBI go routine

func (*HUOBI) Trade

func (h *HUOBI) Trade(orderType string, coinType int, price, amount float64)

func (*HUOBI) UpdateOrderbook

func (h *HUOBI) UpdateOrderbook(p pair.CurrencyPair, assetType string) (orderbook.Base, error)

UpdateOrderbook updates and returns the orderbook for a currency pair

func (*HUOBI) UpdateTicker

func (h *HUOBI) UpdateTicker(p pair.CurrencyPair, assetType string) (ticker.Price, error)

UpdateTicker updates and returns the ticker for a currency pair

func (*HUOBI) WebsocketClient

func (h *HUOBI) WebsocketClient()

type HuobiDepth

type HuobiDepth struct {
	SymbolID  string    `json:"symbolId"`
	Time      float64   `json:"time"`
	Version   float64   `json:"version"`
	BidName   string    `json:"bidName"`
	BidPrice  []float64 `json:"bidPrice"`
	BidTotal  []float64 `json:"bidTotal"`
	BidAmount []float64 `json:"bidAmount"`
	AskName   string    `json:"askName"`
	AskPrice  []float64 `json:"askPrice"`
	AskTotal  []float64 `json:"askTotal"`
	AskAmount []float64 `json:"askAmount"`
}

type HuobiOrderbook

type HuobiOrderbook struct {
	ID     float64
	TS     float64
	Bids   [][]float64 `json:"bids"`
	Asks   [][]float64 `json:"asks"`
	Symbol string      `json:"string"`
}

type HuobiResponse

type HuobiResponse struct {
	Version      int                    `json:"version"`
	MsgType      string                 `json:"msgType"`
	RequestIndex int64                  `json:"requestIndex"`
	RetCode      int64                  `json:"retCode"`
	RetMessage   string                 `json:"retMsg"`
	Payload      map[string]interface{} `json:"payload"`
}

type HuobiTicker

type HuobiTicker struct {
	High float64
	Low  float64
	Last float64
	Vol  float64
	Buy  float64
	Sell float64
}

type HuobiTickerResponse

type HuobiTickerResponse struct {
	Time   string
	Ticker HuobiTicker
}

type HuobiWebsocketLastTimeline

type HuobiWebsocketLastTimeline struct {
	ID        int64   `json:"_id"`
	SymbolID  string  `json:"symbolId"`
	Time      int64   `json:"time"`
	LastPrice float64 `json:"priceLast"`
	Amount    float64 `json:"amount"`
	Volume    float64 `json:"volume"`
	Count     int64   `json:"count"`
}

type HuobiWebsocketMarketOverview

type HuobiWebsocketMarketOverview struct {
	SymbolID    string  `json:"symbolId"`
	Last        float64 `json:"priceNew"`
	Open        float64 `json:"priceOpen"`
	High        float64 `json:"priceHigh"`
	Low         float64 `json:"priceLow"`
	Ask         float64 `json:"priceAsk"`
	Bid         float64 `json:"priceBid"`
	Volume      float64 `json:"totalVolume"`
	TotalAmount float64 `json:"totalAmount"`
}

type HuobiWebsocketTrade

type HuobiWebsocketTrade struct {
	Price      []float64 `json:"price"`
	Level      []float64 `json:"level"`
	Amount     []float64 `json:"amount"`
	AccuAmount []float64 `json:"accuAmount"`
}

type HuobiWebsocketTradeDetail

type HuobiWebsocketTradeDetail struct {
	SymbolID string                `json:"symbolId"`
	TradeID  []int64               `json:"tradeId"`
	Price    []float64             `json:"price"`
	Time     []int64               `json:"time"`
	Amount   []float64             `json:"amount"`
	TopBids  []HuobiWebsocketTrade `json:"topBids"`
	TopAsks  []HuobiWebsocketTrade `json:"topAsks"`
}

Jump to

Keyboard shortcuts

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