huobi

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2020 License: MIT Imports: 18 Imported by: 5

Documentation

Index

Constants

View Source
const (
	OrderTypeBuyMarket        = "buy-market"
	OrderTypeSellMarket       = "sell-market"
	OrderTypeBuyLimit         = "buy-limit"
	OrderTypeSellLimit        = "sell-limit"
	OrderTypeBuyIoc           = "buy-ioc"
	OrderTypeSellIoc          = "sell-ioc"
	OrderTypeBuyLimitMaker    = "buy-limit-maker"
	OrderTypeSellLimitMaker   = "sell-limit-maker"
	OrderTypeBuyStopLimit     = "buy-stop-limit"
	OrderTypeSellStopLimit    = "sell-stop-limit"
	OrderTypeBuyLimitFok      = "buy-limit-fok"
	OrderTypeSellLimitFok     = "sell-limit-fok"
	OrderTypeBuyStopLimitFok  = "buy-stop-limit-fok"
	OrderTypeSellStopLimitFok = "sell-stop-limit-fok"
)
View Source
const (
	Name        = "huobi"
	DefaultHost = "api.huobi.me"
)
View Source
const (
	BTC_USDT = "btcusdt"
)
View Source
const CandlestickReqMaxLength = 300

Variables

View Source
var (
	PricePrecision = map[string]int{
		"btcusdt": 2,
	}
	AmountPrecision = map[string]int{
		"btcusdt": 5,
	}
	MinAmount = map[string]float64{
		"btcusdt": 0.0001,
	}
	MinTotal = map[string]int64{
		"btcusdt": 5,
	}
)

Functions

This section is empty.

Types

type Client

type Client struct {
	Label     string
	AccessKey string
	SecretKey string
	Host      string

	SpotAccountId int64
}

func New

func New(label, accessKey, secretKey, host string) *Client

func (*Client) CancelOrder

func (c *Client) CancelOrder(orderId uint64) error

func (*Client) GetAccountInfo

func (c *Client) GetAccountInfo() ([]account.AccountInfo, error)

func (*Client) GetPrice

func (c *Client) GetPrice(symbol string) (decimal.Decimal, error)

func (*Client) GetSpotAccountId

func (c *Client) GetSpotAccountId() (int64, error)

func (*Client) GetSpotBalance

func (c *Client) GetSpotBalance() (map[string]decimal.Decimal, error)

func (*Client) GetTimestamp

func (c *Client) GetTimestamp() (int, error)

func (*Client) PlaceOrder

func (c *Client) PlaceOrder(orderType, symbol, clientOrderId string, price, amount decimal.Decimal) (uint64, error)

func (*Client) SubscribeAccountUpdate

func (c *Client) SubscribeAccountUpdate(ctx context.Context, symbol, clientId string,
	responseHandler websocketclientbase.ResponseHandler) error

func (*Client) SubscribeCandlestick

func (c *Client) SubscribeCandlestick(ctx context.Context, symbol, clientId string,
	responseHandler websocketclientbase.ResponseHandler)

func (*Client) SubscribeCandlestickWithReq added in v0.7.0

func (c *Client) SubscribeCandlestickWithReq(ctx context.Context, symbol, clientId string,
	responseHandler websocketclientbase.ResponseHandler)

func (*Client) SubscribeLast24hCandlestick

func (c *Client) SubscribeLast24hCandlestick(ctx context.Context, symbol, clientId string,
	responseHandler websocketclientbase.ResponseHandler) error

func (*Client) SubscribeOrder

func (c *Client) SubscribeOrder(ctx context.Context, symbol, clientId string,
	responseHandler websocketclientbase.ResponseHandler)

func (*Client) SubscribeTradeClear

func (c *Client) SubscribeTradeClear(ctx context.Context, symbol, clientId string,
	responseHandler websocketclientbase.ResponseHandler)

type Trade

type Trade struct {
	Symbol    string
	OrderId   int64
	OrderSide string
	OrderType string
	Aggressor bool

	Id     int64           // trade id
	Time   int64           // trade time
	Price  decimal.Decimal // trade price
	Volume decimal.Decimal // trade volume

	TransactFee       decimal.Decimal
	FeeDeduct         decimal.Decimal
	FeeDeductCurrency string
}

Trade is the Data object in TradeClear websocket response.

Jump to

Keyboard shortcuts

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