ws

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2023 License: GPL-3.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// https://binance-docs.github.io/apidocs/spot/en/#kline-candlestick-streams
	ChannelKline1seconds  = "@kline_1s"
	ChannelKline1minutes  = "@kline_1m"
	ChannelKline3minutes  = "@kline_3m"
	ChannelKline5minutes  = "@kline_5m"
	ChannelKline15minutes = "@kline_15m"
	ChannelKline30minutes = "@kline_30m"
	ChannelKline1hours    = "@kline_1h"
	ChannelKline2hours    = "@kline_2h"
	ChannelKline4hours    = "@kline_4h"
	ChannelKline6hours    = "@kline_6h"
	ChannelKline8hours    = "@kline_8h"
	ChannelKline12hours   = "@kline_12h"
	ChannelKline1days     = "@kline_1d"
	ChannelKline3days     = "@kline_3d"
	ChannelKline1weeks    = "@kline_1w"
	ChannelKline1months   = "@kline_1M"
)
View Source
const (
	HostBaseUrl_1 = "wss://stream.binance.com:9443/ws"
	HostBaseUrl_2 = "wss://stream.binance.com:443/ws"

	// https://testnet.binance.vision/
	HostTestnet = "wss://testnet.binance.vision/ws"
)
View Source
const (
	ChannelTicker = "@bookTicker"
)

https://binance-docs.github.io/apidocs/spot/en/#individual-symbol-book-ticker-streams

Variables

This section is empty.

Functions

func New

func New(tr TradingType, cfg config.Configuration, logFileName string) ConnectorWs

Types

type BinanceWS_SpotAndMargin

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

func (*BinanceWS_SpotAndMargin) AddOperations added in v0.1.3

func (connWs *BinanceWS_SpotAndMargin) AddOperations(op config.Operation)

func (*BinanceWS_SpotAndMargin) ClearOperations added in v0.1.3

func (connWs *BinanceWS_SpotAndMargin) ClearOperations()

func (*BinanceWS_SpotAndMargin) GetConfiguration

func (connWs *BinanceWS_SpotAndMargin) GetConfiguration() config.Configuration

func (*BinanceWS_SpotAndMargin) GetConnection

func (connWs *BinanceWS_SpotAndMargin) GetConnection() *websocket.Conn

func (*BinanceWS_SpotAndMargin) GetEmitter

func (connWs *BinanceWS_SpotAndMargin) GetEmitter() *emission.Emitter

func (*BinanceWS_SpotAndMargin) GetErrorChan added in v0.1.3

func (connWs *BinanceWS_SpotAndMargin) GetErrorChan() chan error

func (*BinanceWS_SpotAndMargin) GetExchangeName

func (connWs *BinanceWS_SpotAndMargin) GetExchangeName() string

func (*BinanceWS_SpotAndMargin) GetIsConnStable added in v0.1.3

func (connWs *BinanceWS_SpotAndMargin) GetIsConnStable() bool

func (*BinanceWS_SpotAndMargin) GetLogger

func (connWs *BinanceWS_SpotAndMargin) GetLogger() *zap.Logger

func (*BinanceWS_SpotAndMargin) GetOperations added in v0.1.3

func (connWs *BinanceWS_SpotAndMargin) GetOperations() []config.Operation

func (*BinanceWS_SpotAndMargin) GetPair

func (connWs *BinanceWS_SpotAndMargin) GetPair(args ...string) string

func (*BinanceWS_SpotAndMargin) GetPingMessage added in v0.0.3

func (connWs *BinanceWS_SpotAndMargin) GetPingMessage() (int, string)

func (*BinanceWS_SpotAndMargin) GetRequest

func (connWs *BinanceWS_SpotAndMargin) GetRequest(op string, channel string, parms interface{}) (interface{}, error)

func (*BinanceWS_SpotAndMargin) GetTradingType

func (connWs *BinanceWS_SpotAndMargin) GetTradingType() string

func (*BinanceWS_SpotAndMargin) MessageHandler

func (connWs *BinanceWS_SpotAndMargin) MessageHandler(data []byte)

func (*BinanceWS_SpotAndMargin) SendToErrorChan added in v0.1.3

func (connWs *BinanceWS_SpotAndMargin) SendToErrorChan(err error)

func (*BinanceWS_SpotAndMargin) SetConnection

func (connWs *BinanceWS_SpotAndMargin) SetConnection(c *websocket.Conn)

func (*BinanceWS_SpotAndMargin) SetErrorChan added in v0.1.3

func (connWs *BinanceWS_SpotAndMargin) SetErrorChan(ch chan error)

func (*BinanceWS_SpotAndMargin) SetIsConnStable added in v0.1.3

func (connWs *BinanceWS_SpotAndMargin) SetIsConnStable(stable bool)

type BookTicker

type BookTicker struct {
	UpdateId     int64  `json:"u"`
	Symbol       string `json:"s"`
	BestBidPrice string `json:"b"`
	BestBidQty   string `json:"B"`
	BestAskPrice string `json:"a"`
	BestAskQty   string `json:"A"`
}

https://binance-docs.github.io/apidocs/spot/en/#individual-symbol-book-ticker-streams

type Filter

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

type Kline

type Kline struct {
	EventType string `json:"e"`
	EventTime int    `json:"E"`
	Symbol    string `json:"s"`
	Kline     struct {
		KlineStartTime           int    `json:"t"`
		KlineCloseTime           int    `json:"T"`
		Symbol                   string `json:"s"`
		Interval                 string `json:"i"`
		FirstTradeID             int    `json:"f"`
		LastTradeID              int    `json:"L"`
		OpenPrice                string `json:"o"`
		ClosePrice               string `json:"c"`
		HighPrice                string `json:"h"`
		LowPrice                 string `json:"l"`
		BaseAssetVolume          string `json:"v"`
		NumberOfTrades           int    `json:"n"`
		ClosedKline              bool   `json:"x"`
		QuoteAssetVolume         string `json:"q"`
		TakerBuyBaseAssetVolume  string `json:"V"`
		TakerBuyQuoteAssetVolume string `json:"Q"`
		Ignore                   string `json:"B"`
	} `json:"k"`
}

type TradingType added in v0.0.4

type TradingType string
const (
	SpotTrading    TradingType = "SPOT"
	MarginTrading  TradingType = "MARGIN"
	FuturesTrading TradingType = "FUTURES"
)

Jump to

Keyboard shortcuts

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