Documentation ¶
Index ¶
- Constants
- type ByBitWS
- func (b *ByBitWS) Close()
- func (b *ByBitWS) CloseAndReconnect()
- func (b *ByBitWS) Emit(event interface{}, arguments ...interface{}) *emission.Emitter
- func (b *ByBitWS) HandlePong() (err error)
- func (b *ByBitWS) IsConnected() bool
- func (b *ByBitWS) Off(event interface{}, listener interface{}) *emission.Emitter
- func (b *ByBitWS) On(event interface{}, listener interface{}) *emission.Emitter
- func (b *ByBitWS) Send(msg string) error
- func (b *ByBitWS) SendCmd(cmd Cmd) error
- func (b *ByBitWS) Start() error
- func (b *ByBitWS) StartRAW(eventCH chan string) chan struct{}
- func (b *ByBitWS) Subscribe(topic, interval, coinPair string)
- func (b *ByBitWS) SubscribeToMany(streams ...string) error
- func (b *ByBitWS) Unsubscribe(topic, interval, coinPair string)
- type Cmd
- type Configuration
- type KLine
Constants ¶
View Source
const ( // HeartBeatDuration period for sending ping packet according documentation HeartBeatDuration = time.Second * 20 KeepAliveDuration = time.Second * 60 )
View Source
const ( HostPerpetualReal = "wss://stream.bybit.com/v5/public/linear" HostPerpetualtTestnet = "wss://stream-testnet.bybit.com/v5/public/linear" )
View Source
const ( WSKLine = "kline" WSKPublicTrade = "publicTrade" WSKOrderbook = "orderbook" WSDisconnected = "disconnected" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ByBitWS ¶
type ByBitWS struct { Ended bool // contains filtered or unexported fields }
func New ¶
func New(config *Configuration) *ByBitWS
func (*ByBitWS) CloseAndReconnect ¶
func (b *ByBitWS) CloseAndReconnect()
func (*ByBitWS) HandlePong ¶ added in v0.0.5
func (*ByBitWS) IsConnected ¶
IsConnected returns the WebSocket connection state
func (*ByBitWS) StartRAW ¶ added in v0.0.5
StartRAW gives you a raw ws stream, you need to handle pong events by yourself.
func (*ByBitWS) Subscribe ¶
Topic => `kline`
Interval 1 3 5 15 30 60 120 240 360 720 minute D day W week M month
CoinPair => BTCUSDT
Subscribe subscribes on ws topic to fetch data
func (*ByBitWS) SubscribeToMany ¶ added in v0.0.4
SubscribeToMany
stream examples
"orderbook.1.BTCUSDT" "publicTrade.BTCUSDT"
func (*ByBitWS) Unsubscribe ¶ added in v0.0.5
Unsubscribe subscribes on ws topic to fetch data
type Configuration ¶
type Configuration struct { Addr string `json:"addr"` Proxy string `json:"proxy"` // http://127.0.0.1:1081 ApiKey string `json:"api_key"` SecretKey string `json:"secret_key"` AutoReconnect bool `json:"auto_reconnect"` DebugMode bool `json:"debug_mode"` }
TODO make default conf
type KLine ¶
type KLine struct { Start int64 `json:"start"` // 1539918000 End int64 `json:"end"` // 1539918000 Open float64 `json:"open,string"` High float64 `json:"high,string"` Low float64 `json:"low,string"` Close float64 `json:"close,string"` Volume float64 `json:"volume,string"` Turnover float64 `json:"turnover,string"` // 0.0013844 Interval string `json:"interval"` // 1m Confirm bool `json:"confirm"` Timestamp int64 `json:"timestamp"` }
Click to show internal directories.
Click to hide internal directories.