huobi

package
v0.3.0-pre2 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2020 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Huobi = "huobi"

	StatusOK = "ok"
	CodeOK   = 200
)
View Source
const (
	MethodPing     = "ping"
	MethodPong     = "pong"
	MethodSubscibe = "sub"
)

Variables

This section is empty.

Functions

func NewError

func NewError(msg string) error

Types

type CodeC

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

func NewCodeC

func NewCodeC() *CodeC

func (*CodeC) Decompress

func (cc *CodeC) Decompress(raw []byte) ([]byte, error)

func (CodeC) Encode

func (CodeC) Encode(req rpc.Request) ([]byte, error)

type Error

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

func (*Error) Error

func (e *Error) Error() string

func (*Error) Is

func (e *Error) Is(target interface{}) bool

type NotifyTrade

type NotifyTrade struct {
	Trades []Trade
	Chan   string
}

type Response

type Response struct {
	Ping int             `json:"ping"`
	Ch   string          `json:"ch"`
	TS   int             `json:"ts"`
	Tick json.RawMessage `json:"tick"`
}

func (*Response) Parse

func (r *Response) Parse() (rpc.Response, error)

type RestClient

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

func NewRestClient

func NewRestClient(key, secret, host string) *RestClient

func (*RestClient) Request

func (rc *RestClient) Request(ctx context.Context, method string, endPoint string, param url.Values, body io.Reader, sign bool, dst interface{}) error

type Tick

type Tick struct {
	ID   int64   `json:"id"`
	TS   int64   `json:"ts"`
	Data []Trade `json:"data"`
}

type Trade

type Trade struct {
	Amount    float64 `json:"amount"`
	TS        int64   `json:"ts"`
	ID        int64   `json:"id"`
	TradeID   int64   `json:"tradeId"`
	Price     float64 `json:"price"`
	Direction string  `json:"direction"`
}

func ParseTrades

func ParseTrades(raw json.RawMessage) ([]Trade, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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