v3

package
v0.0.0-...-70bc60f Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2022 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ChannelTicker = "@bookTicker"
)
View Source
const (
	HostMainnetPublicTopics = "wss://stream.binance.com:9443/ws"
)

Variables

This section is empty.

Functions

func GetPair

func GetPair(coin1 string, coin2 string) string

Types

type BinanceWS

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

func New

func New(config *Configuration) *BinanceWS

func (*BinanceWS) Emit

func (b *BinanceWS) Emit(event interface{}, arguments ...interface{}) *emission.Emitter

Emit emits an event

func (*BinanceWS) GetBalance

func (ex *BinanceWS) GetBalance() WalletBalance

func (*BinanceWS) Off

func (b *BinanceWS) Off(event interface{}, listener interface{}) *emission.Emitter

Off removes a listener for an event

func (*BinanceWS) On

func (b *BinanceWS) On(event interface{}, listener interface{}) *emission.Emitter

On adds a listener to a specific event

func (*BinanceWS) Send

func (b *BinanceWS) Send(msg string) (err error)

func (*BinanceWS) SendCmd

func (b *BinanceWS) SendCmd(cmd Cmd)

отправка команды на сервер в отдельной функции для того, чтобы при переподключении быстро подписаться на все предыдущие каналы

func (*BinanceWS) Start

func (b *BinanceWS) Start() error

подключение к серверу и постоянное чтение приходящих ответов

func (*BinanceWS) Subscribe

func (b *BinanceWS) Subscribe(channel string, coin string)

type BookTicker

type BookTicker struct {
	U  int    `json:"u"`
	S  string `json:"s"`
	B  string `json:"b"`
	B0 string `json:"B"`
	A  string `json:"a"`
	A0 string `json:"A"`
}

type Cmd

type Cmd struct {
	Method string   `json:"method"`
	Params []string `json:"params"`
	ID     int      `json:"id"`
}

type Configuration

type Configuration struct {
	Addr      string `json:"addr"`
	ApiKey    string `json:"api_key"`
	SecretKey string `json:"secret_key"`
	DebugMode bool   `json:"debug_mode"`
}

type WalletBalance

type WalletBalance struct {
	MakerCommission  int       `json:"makerCommission"`
	TakerCommission  int       `json:"takerCommission"`
	BuyerCommission  int       `json:"buyerCommission"`
	SellerCommission int       `json:"sellerCommission"`
	CanTrade         bool      `json:"canTrade"`
	CanWithdraw      bool      `json:"canWithdraw"`
	CanDeposit       bool      `json:"canDeposit"`
	Brokered         bool      `json:"brokered"`
	UpdateTime       int       `json:"updateTime"`
	AccountType      string    `json:"accountType"`
	Balances         []balance `json:"balances"`
	Permissions      []string  `json:"permissions"`
}

Jump to

Keyboard shortcuts

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