hitbtc

package module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2018 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// CSubscribeOrderbook method name
	CSubscribeOrderbook = "subscribeOrderbook"

	// CSnapshotOrderbookMethod notification snapshot
	CSnapshotOrderbookMethod = "snapshotOrderbook"

	// CUpdateOrderbookMethod notification update
	CUpdateOrderbookMethod = "updateOrderbook"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client engine

func New

func New() *Client

New create and return Client instance

func NewWithHTTPClient

func NewWithHTTPClient(httpClient httpFetcher) *Client

NewWithHTTPClient create and return Client instance with http client

func (*Client) FetchSymbol

func (c *Client) FetchSymbol(symbol string) (*Symbol, error)

FetchSymbol return symbol

func (*Client) FetchSymbols

func (c *Client) FetchSymbols() (Symbols, error)

FetchSymbols return symbols list

func (*Client) SubscribeToOrderBookFor

func (c *Client) SubscribeToOrderBookFor(symbol string, tickHandler TickHandler, doneChan DoneChan, errHandler ErrorHandler) error

SubscribeToOrderBookFor return symbol

type DoneChan

type DoneChan chan struct{}

DoneChan break listener

type Err

type Err struct {
	Data struct {
		Code        int    `json:"code"`
		Message     string `json:"message"`
		Description string `json:"description"`
	} `json:"error"`
}

Err struct easyjson:json

func (Err) Error

func (e Err) Error() string

func (Err) MarshalEasyJSON

func (v Err) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Err) MarshalJSON

func (v Err) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Err) UnmarshalEasyJSON

func (v *Err) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Err) UnmarshalJSON

func (v *Err) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type ErrorHandler

type ErrorHandler func(err error)

ErrorHandler handles errors

type Order

type Order struct {
	Price float64 `json:"price,string"`
	Size  float64 `json:"size,string"`
}

Order ...

func (Order) MarshalEasyJSON

func (v Order) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Order) MarshalJSON

func (v Order) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Order) UnmarshalEasyJSON

func (v *Order) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Order) UnmarshalJSON

func (v *Order) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type SubscribeOrderBookResponse

type SubscribeOrderBookResponse struct {
	JSONRPC string `json:"jsonrpc"`
	Method  string `json:"method"`
	Params  struct {
		Ask       []Order `json:"ask"`
		Bid       []Order `json:"bid"`
		Symbol    string  `json:"symbol"`
		Sequence  int64   `json:"sequence"`
		Timestamp string  `json:"timestamp"`
	} `json:"params"`
}

SubscribeOrderBookResponse ws response

func (SubscribeOrderBookResponse) MarshalEasyJSON

func (v SubscribeOrderBookResponse) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (SubscribeOrderBookResponse) MarshalJSON

func (v SubscribeOrderBookResponse) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*SubscribeOrderBookResponse) UnmarshalEasyJSON

func (v *SubscribeOrderBookResponse) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*SubscribeOrderBookResponse) UnmarshalJSON

func (v *SubscribeOrderBookResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Symbol

type Symbol struct {
	ID                   string  `json:"id"`
	BaseCurrency         string  `json:"baseCurrency"`
	QuoteCurrency        string  `json:"quoteCurrency"`
	QuantityIncrement    float64 `json:"quantityIncrement,string"`
	TickSize             float64 `json:"tickSize,string"`
	TakeLiquidityRate    float64 `json:"takeLiquidityRate,string"`
	ProvideLiquidityRate float64 `json:"provideLiquidityRate,string"`
	FeeCurrency          string  `json:"feeCurrency"`
}

Symbol model easyjson:json

func (Symbol) MarshalEasyJSON

func (v Symbol) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Symbol) MarshalJSON

func (v Symbol) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Symbol) UnmarshalEasyJSON

func (v *Symbol) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Symbol) UnmarshalJSON

func (v *Symbol) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Symbols

type Symbols []Symbol

Symbols list

func (Symbols) MarshalEasyJSON

func (v Symbols) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Symbols) MarshalJSON

func (v Symbols) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Symbols) UnmarshalEasyJSON

func (v *Symbols) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Symbols) UnmarshalJSON

func (v *Symbols) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type TickHandler

type TickHandler func(tick SubscribeOrderBookResponse)

TickHandler handler for tick

Jump to

Keyboard shortcuts

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