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: 0

Documentation

Index

Constants

View Source
const (
	// https://binance-docs.github.io/apidocs/futures/en/#kline-candlestick-streams
	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 (

	// В эммитере используется только ChannelMarkPrice
	ChannelMarkPrice   = "@markPrice"
	ChannelMarkPrice1s = "@markPrice@1s"
)
View Source
const (

	// В эммитере используется только ChannelMarkPriceForAllMarket
	ChannelMarkPriceForAllMarket   = "!markPrice@arr"
	ChannelMarkPriceForAllMarket1s = "!markPrice@arr@1s"
)
View Source
const (
	// https://binance-docs.github.io/apidocs/futures/en/#websocket-market-streams
	HostBaseUrl_1 = "wss://fstream.binance.com/ws"
	HostBaseUrl_2 = "wss://fstream-auth.binance.com"
	// https://binance-docs.github.io/apidocs/futures/en/#testnet
	HostTestnet = "wss://stream.binancefuture.com"
)

Variables

This section is empty.

Functions

func New

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

Types

type BinanceWS_Futures

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

func (*BinanceWS_Futures) AddOperations added in v0.1.3

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

func (*BinanceWS_Futures) ClearOperations added in v0.1.3

func (connWs *BinanceWS_Futures) ClearOperations()

func (*BinanceWS_Futures) GetConfiguration

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

func (*BinanceWS_Futures) GetConnection

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

func (*BinanceWS_Futures) GetEmitter

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

func (*BinanceWS_Futures) GetErrorChan added in v0.1.3

func (connWs *BinanceWS_Futures) GetErrorChan() chan error

func (*BinanceWS_Futures) GetExchangeName

func (connWs *BinanceWS_Futures) GetExchangeName() string

func (*BinanceWS_Futures) GetIsConnStable added in v0.1.3

func (connWs *BinanceWS_Futures) GetIsConnStable() bool

func (*BinanceWS_Futures) GetLogger

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

func (*BinanceWS_Futures) GetOperations added in v0.1.3

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

func (*BinanceWS_Futures) GetPair

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

func (*BinanceWS_Futures) GetPingMessage added in v0.0.3

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

func (*BinanceWS_Futures) GetRequest

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

func (*BinanceWS_Futures) GetTradingType

func (connWs *BinanceWS_Futures) GetTradingType() string

func (*BinanceWS_Futures) MessageHandler

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

func (*BinanceWS_Futures) SendToErrorChan added in v0.1.3

func (connWs *BinanceWS_Futures) SendToErrorChan(err error)

func (*BinanceWS_Futures) SetConnection

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

func (*BinanceWS_Futures) SetErrorChan added in v0.1.3

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

func (*BinanceWS_Futures) SetIsConnStable added in v0.1.3

func (connWs *BinanceWS_Futures) SetIsConnStable(stable bool)

type BookTicker

type BookTicker struct {
	EventType       string `json:"e"`
	UpdateId        int    `json:"u"`
	EventTtime      int64  `json:"E"`
	TransactionTime int64  `json:"T"`
	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/futures/en/#individual-symbol-book-ticker-streams

type Filter

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

https://binance-docs.github.io/apidocs/spot/en/#live-subscribing-unsubscribing-to-streams

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 MarkPrice added in v0.1.2

type MarkPrice struct {
	EventType       string `json:"e"`
	EventTime       int64  `json:"E"`
	Symbol          string `json:"s"`
	MarkPrice       string `json:"p"`
	IndexPrice      string `json:"i"`
	SettlePrice     string `json:"P"`
	FundingRate     string `json:"r"`
	NextFundingTime int64  `json:"T"`
}

type MarkPriceForAllMarket added in v0.1.2

type MarkPriceForAllMarket []struct {
	EventType       string `json:"e"`
	EventTime       int64  `json:"E"`
	Symbol          string `json:"s"`
	MarkPrice       string `json:"p"`
	IndexPrice      string `json:"i"`
	SettlePrice     string `json:"P"`
	FundingRate     string `json:"r"`
	NextFundingTime int64  `json:"T"`
}

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