binance

package
v0.5.10 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2023 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MethodSubscibe    = "SUBSCRIBE"
	MethodUnSubscribe = "UNSUBSCRIBE"
)
View Source
const (
	Exchange = "binance"
)

Variables

This section is empty.

Functions

func Milli2Time added in v0.5.8

func Milli2Time(ts int64) time.Time

func Time2Milli added in v0.5.8

func Time2Milli(ts time.Time) int64

func TradeParam added in v0.3.0

func TradeParam(symbol string, st int64, et int64, fid int64, limit int) url.Values

Types

type APIError

type APIError struct {
	Code    int    `json:"code"`
	Message string `json:"msg"`
}

APIError error message

func (*APIError) ECode added in v0.5.5

func (ae *APIError) ECode() int

func (*APIError) EMessage added in v0.5.5

func (ae *APIError) EMessage() string

func (*APIError) Error

func (ae *APIError) Error() string

func (*APIError) Is

func (ae *APIError) Is(target interface{}) bool

type APIIF added in v0.5.5

type APIIF interface {
	ECode() int
	EMessage() string
}

type CallResult added in v0.5.8

type CallResult struct {
	Result interface{} `json:"result"`
	ID     int64       `json:"id"`
}

type CodeC added in v0.5.8

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

CodeC common codec for spot swap notify

func NewCodeC added in v0.5.8

func NewCodeC() *CodeC

func (*CodeC) DecodeByCB added in v0.5.8

func (cc *CodeC) DecodeByCB(raw []byte, cb func(g *gjson.Result) (rpc.Response, error)) (rpc.Response, error)

func (*CodeC) Encode added in v0.5.8

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

Encode req to binance subscribe message

func (*CodeC) LastID added in v0.5.8

func (cc *CodeC) LastID() string

type GetRestReq added in v0.5.4

type GetRestReq interface {
	Values() (url.Values, error)
}

type ListenKeyClient added in v0.5.4

type ListenKeyClient interface {
	GetListenKeyAddr(ctx context.Context) (string, error)
	PersistListenKey(ctx context.Context) error
	DeleteListenKey(ctx context.Context) error
}

type NotifyClient added in v0.5.8

type NotifyClient struct {
	*exchange.WSClient
	// contains filtered or unexported fields
}

func NewNotifyClient added in v0.5.8

func NewNotifyClient(addr string, codec rpc.Codec, data chan interface{}, handler rpc.Handler) *NotifyClient

func (*NotifyClient) Handle added in v0.5.8

func (nc *NotifyClient) Handle(ctx context.Context, notify *rpc.Notify)

func (*NotifyClient) Push added in v0.5.8

func (nc *NotifyClient) Push(ch string, data interface{})

func (*NotifyClient) Subscribe added in v0.5.8

func (wcl *NotifyClient) Subscribe(ctx context.Context, channels ...exchange.Channel) error

func (*NotifyClient) UnSubscribe added in v0.5.8

func (wcl *NotifyClient) UnSubscribe(ctx context.Context, channels ...exchange.Channel) error

type RestClient

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

Binance Rest client instance

func NewRestClient

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

func (*RestClient) GetRequest added in v0.5.4

func (rc *RestClient) GetRequest(ctx context.Context, endPoint string, req GetRestReq, sign bool, dst interface{}) error

GetRequest helper method to send http GET request

func (*RestClient) Request

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

type RestReq added in v0.5.4

type RestReq struct {
	*exchange.RestReq
}

RestReq basic binance rest request instance add recvWindow param support

func NewRestReq added in v0.5.4

func NewRestReq() *RestReq

func (*RestReq) RecvWindow added in v0.5.4

func (rr *RestReq) RecvWindow(window int) *RestReq

type SubscribeRequest added in v0.5.8

type SubscribeRequest struct {
	Method string      `json:"method"`
	Params interface{} `json:"params"`
	ID     int64       `json:"id"`
}

type WSClient added in v0.5.4

type WSClient struct {
	rpc.Conn
	// contains filtered or unexported fields
}

WSClient common private wsclient for binance

func NewWSClient added in v0.5.4

func NewWSClient(codec rpc.Codec, handler rpc.Handler, client ListenKeyClient) *WSClient

func (*WSClient) Run added in v0.5.4

func (ws *WSClient) Run(ctx context.Context) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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