Documentation ¶
Index ¶
- Constants
- func New(tr TradingType, cfg config.Configuration, logFileName string) ConnectorWs
- type ByBitWS
- func (connWs *ByBitWS) AddOperations(op config.Operation)
- func (connWs *ByBitWS) ClearOperations()
- func (connWs *ByBitWS) GetConfiguration() config.Configuration
- func (connWs *ByBitWS) GetConnection() *websocket.Conn
- func (connWs *ByBitWS) GetEmitter() *emission.Emitter
- func (connWs *ByBitWS) GetErrorChan() chan error
- func (connWs *ByBitWS) GetExchangeName() string
- func (connWs *ByBitWS) GetIsConnStable() bool
- func (connWs *ByBitWS) GetLogger() *zap.Logger
- func (connWs *ByBitWS) GetOperations() []config.Operation
- func (connWs *ByBitWS) GetPair(args ...string) string
- func (connWs *ByBitWS) GetPingMessage() (int, string)
- func (connWs *ByBitWS) GetRequest(op string, channel string, parms interface{}) (interface{}, error)
- func (connWs *ByBitWS) GetSign(parms ...string) string
- func (connWs *ByBitWS) GetTradingType() string
- func (connWs *ByBitWS) MessageHandler(data []byte)
- func (connWs *ByBitWS) SendToErrorChan(err error)
- func (connWs *ByBitWS) SetConnection(c *websocket.Conn)
- func (connWs *ByBitWS) SetErrorChan(ch chan error)
- func (connWs *ByBitWS) SetIsConnStable(stable bool)
- type Filter
- type Orderbook
- type TickerLinear
- type TickerOption
- type TickerSpot
- type TradingType
- type Wallet
Constants ¶
View Source
const ( ChannelOrderbook1 = "orderbook.1" ChannelOrderbook25 = "orderbook.25" ChannelOrderbook50 = "orderbook.50" ChannelOrderbook100 = "orderbook.100" ChannelOrderbook200 = "orderbook.200" ChannelOrderbook500 = "orderbook.500" )
View Source
const ( HostPublicMainnetSpot = "wss://stream.bybit.com/v5/public/spot" HostPublicMainnetLinear = "wss://stream.bybit.com/v5/public/linear" HostPublicMainnetInverse = "wss://stream.bybit.com/v5/public/inverse" HostPublicMainnetOption = "wss://stream.bybit.com/v5/public/option" HostPublicTestnetSpot = "wss://stream-testnet.bybit.com/v5/public/spot" HostPublicTestnetLinear = "wss://stream-testnet.bybit.com/v5/public/linear" HostPublicTestnetInverse = "wss://stream-testnet.bybit.com/v5/public/inverse" HostPublicTestnetOption = "wss://stream-testnet.bybit.com/v5/public/option" HostPrivateMainnet = "wss://stream.bybit.com/v5/private" HostPrivateTestnet = "wss://stream-testnet.bybit.com/v5/private" )
https://bybit-exchange.github.io/docs/v5/ws/connect
View Source
const (
ChannelTicker = "tickers"
)
https://bybit-exchange.github.io/docs/v5/websocket/public/ticker
View Source
const (
ChannelWallet = "wallet"
)
https://bybit-exchange.github.io/docs/v5/websocket/private/wallet
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New(tr TradingType, cfg config.Configuration, logFileName string) ConnectorWs
Types ¶
type ByBitWS ¶
type ByBitWS struct {
// contains filtered or unexported fields
}
func (*ByBitWS) AddOperations ¶ added in v0.1.2
func (*ByBitWS) ClearOperations ¶ added in v0.1.2
func (connWs *ByBitWS) ClearOperations()
func (*ByBitWS) GetConfiguration ¶
func (connWs *ByBitWS) GetConfiguration() config.Configuration
func (*ByBitWS) GetConnection ¶
func (*ByBitWS) GetEmitter ¶
func (*ByBitWS) GetErrorChan ¶ added in v0.1.2
func (*ByBitWS) GetExchangeName ¶
func (*ByBitWS) GetIsConnStable ¶ added in v0.1.2
func (*ByBitWS) GetOperations ¶ added in v0.1.2
func (*ByBitWS) GetPingMessage ¶
func (*ByBitWS) GetRequest ¶
func (*ByBitWS) GetTradingType ¶
func (*ByBitWS) MessageHandler ¶
func (*ByBitWS) SendToErrorChan ¶ added in v0.1.2
func (*ByBitWS) SetConnection ¶
func (*ByBitWS) SetErrorChan ¶ added in v0.1.2
func (*ByBitWS) SetIsConnStable ¶ added in v0.1.2
type Orderbook ¶
type Orderbook struct { Topic string `json:"topic"` // Topic name Timestamp int64 `json:"ts"` // The timestamp (ms) that the system generates the data Type string `json:"type"` // Data type. snapshot,delta Data struct { Symbol string `json:"s"` // Symbol name Bid [][]string `json:"b"` // Bids. For snapshot stream, the element is sorted by price in descending order | Bid[0] - Bid price | Bid[1] - Bid size Ask [][]string `json:"a"` // Asks. For snapshot stream, the element is sorted by price in ascending order | Bid[0] - Bid price | Bid[1] - Bid size UpdateID int `json:"u"` // Update ID. Is a sequence. Occasionally, you'll receive "u"=1, which is a snapshot data due to the restart of the service. So please overwrite your local orderbook Sequence int64 `json:"seq"` // Cross sequence } `json:"data"` // Object }
type TickerLinear ¶
type TickerLinear struct { Topic string `json:"topic"` // Topic name Timestamp int64 `json:"ts"` // The timestamp (ms) that the system generates the data DataType string `json:"type"` // Data type. snapshot Sequence int64 `json:"cs"` // Cross sequence Data struct { Symbol string `json:"symbol"` // Symbol name TickDirection string `json:"tickDirection"` // Tick direction Price24hPcnt string `json:"price24hPcnt"` // Percentage change of market price in the last 24 hours LastPrice string `json:"lastPrice"` // Last price PrevPrice24h string `json:"prevPrice24h"` // Market price 24 hours ago HighPrice24h string `json:"highPrice24h"` // The highest price in the last 24 hours LowPrice24h string `json:"lowPrice24h"` // The lowest price in the last 24 hours PrevPrice1h string `json:"prevPrice1h"` // Market price an hour ago MarkPrice string `json:"markPrice"` // Mark price IndexPrice string `json:"indexPrice"` // Index price OpenInterest string `json:"openInterest"` // Open interest size OpenInterestValue string `json:"openInterestValue"` // Open interest value Turnover24h string `json:"turnover24h"` // Turnover for 24h Volume24h string `json:"volume24h"` // Volume for 24h NextFundingTime string `json:"nextFundingTime"` // Next funding timestamp (ms) FundingRate string `json:"fundingRate"` // Funding rate Bid1Price string `json:"bid1Price"` // Best bid price Bid1Size string `json:"bid1Size"` // Best bid size Ask1Price string `json:"ask1Price"` // Best ask price Ask1Size string `json:"ask1Size"` // Best ask size DeliveryTime string `json:"deliveryTime"` // Delivery date time (UTC+0). Unique field for inverse futures BasisRate string `json:"basisRate"` // Basis rate. Unique field for inverse futures DeliveryFeeRate string `json:"deliveryFeeRate"` // Delivery fee rate. Unique field for inverse futures OredictedDeliveryPrice string `json:"predictedDeliveryPrice"` // Predicated delivery price. Unique field for inverse futures } `json:"data"` // Object }
type TickerOption ¶
type TickerOption struct { MessageID string `json:"id"` // message ID Topic string `json:"topic"` // Topic name Timestamp int64 `json:"ts"` // The timestamp (ms) that the system generates the data Type string `json:"type"` // Data type. snapshot Data struct { Symbol string `json:"symbol"` // Symbol name BidPrice string `json:"bidPrice"` // Best bid price BidSize string `json:"bidSize"` // Best bid size BidIv string `json:"bidIv"` // Best bid iv AskPrice string `json:"askPrice"` // Best ask price AskSize string `json:"askSize"` // Best ask size AskIv string `json:"askIv"` // Best ask iv LastPrice string `json:"lastPrice"` // Last price HighPrice24h string `json:"highPrice24h"` // The highest price in the last 24 hours LowPrice24h string `json:"lowPrice24h"` // The lowest price in the last 24 hours MarkPrice string `json:"markPrice"` // Mark price IndexPrice string `json:"indexPrice"` // Index price MarkPriceIv string `json:"markPriceIv"` // Mark price iv UnderlyingPrice string `json:"underlyingPrice"` // Underlying price OpenInterest string `json:"openInterest"` // Open interest size Turnover24h string `json:"turnover24h"` // Turnover for 24h Volume24h string `json:"volume24h"` // Volume for 24h TotalVolume string `json:"totalVolume"` // Total volume TotalTurnover string `json:"totalTurnover"` // Total turnover Delta string `json:"delta"` // Delta Gamma string `json:"gamma"` // Gamma Vega string `json:"vega"` // Vega Theta string `json:"theta"` // Theta PredictedDeliveryPrice string `json:"predictedDeliveryPrice"` // Predicated delivery price. It has value when 30 min before delivery Change24h string `json:"change24h"` // The change in the last 24 hous } `json:"data"` // Object }
type TickerSpot ¶
type TickerSpot struct { Topic string `json:"topic"` // Topic name Timestamp int64 `json:"ts"` // The timestamp (ms) that the system generates the data DataType string `json:"type"` // Data type. snapshot Sequence int64 `json:"cs"` // Cross sequence Data struct { Symbol string `json:"symbol"` // Symbol name LastPrice string `json:"lastPrice"` // Last price HighPrice24H string `json:"highPrice24h"` // The highest price in the last 24 hours LowPrice24H string `json:"lowPrice24h"` // The lowest price in the last 24 hours PrevPrice24H string `json:"prevPrice24h"` // Percentage change of market price relative to 24h Volume24H string `json:"volume24h"` // Volume for 24h Turnover24H string `json:"turnover24h"` // Turnover for 24h Price24HPcnt string `json:"price24hPcnt"` // Percentage change of market price relative to 24h UsdIndexPrice string `json:"usdIndexPrice"` // USD index price. It can be empty } `json:"data"` // Object }
type TradingType ¶
type TradingType string
const ( SpotTrading TradingType = "Spot" LinearTrading TradingType = "Linear" InverseTrading TradingType = "Inverse" OptionTrading TradingType = "Option" )
type Wallet ¶
type Wallet struct { ID string `json:"id"` // Message ID Topic string `json:"topic"` // Topic name CreationTime int64 `json:"creationTime"` // Data created timestamp (ms) Data []struct { AccountType string `json:"accountType"` // Account type. AccountIMRate string `json:"accountIMRate"` // Initial Margin Rate AccountMMRate string `json:"accountMMRate"` // Maintenance Margin Rate TotalEquity string `json:"totalEquity"` // Equity of account converted to usd:Account TotalWalletBalance string `json:"totalWalletBalance"` // Wallet Balance of account converted to usd TotalMarginBalance string `json:"totalMarginBalance"` // Margin Balance of account converted to usd TotalAvailableBalance string `json:"totalAvailableBalance"` // Available Balance of account converted to usd TotalPerpUPL string `json:"totalPerpUPL"` // Unrealised P&L of perpetuals of account converted to usd TotalInitialMargin string `json:"totalInitialMargin"` // Initial Margin of account converted to usd TotalMaintenanceMargin string `json:"totalMaintenanceMargin"` // Maintenance Margin of account converted to usd Coin []struct { Coin string `json:"coin"` // Coin name, such as BTC, ETH, USDT, USDC Equity string `json:"equity"` // Equity of current coin UsdValue string `json:"usdValue"` // USD value of current coin. If this coin cannot be collateral, then it is 0 WalletBalance string `json:"walletBalance"` // Wallet balance of current coin Free string `json:"free"` // Available balance for Spot wallet. This is a unique field for Normal SPOT Locked string `json:"locked"` // Locked balance for Spot wallet. This is a unique field for Normal SPOT BorrowAmount string `json:"borrowAmount"` // Borrow amount of current coin AvailableToBorrow string `json:"availableToBorrow"` // Available amount to borrow of current coin AvailableToWithdraw string `json:"availableToWithdraw"` // Available amount to withdraw of current coin AccruedInterest string `json:"accruedInterest"` // Accrued interest TotalOrderIM string `json:"totalOrderIM"` // Pre-occupied margin for order. For portfolio margin mode, it returns "" TotalPositionIM string `json:"totalPositionIM"` // Sum of initial margin of all positions + Pre-occupied liquidation fee. For portfolio margin mode, it returns "" TotalPositionMM string `json:"totalPositionMM"` // Sum of maintenance margin for all positions. For portfolio margin mode, it returns "" UnrealisedPnl string `json:"unrealisedPnl"` // Unrealised P&L CumRealisedPnl string `json:"cumRealisedPnl"` // Cumulative Realised P&L Bonus string `json:"bonus"` //Bonus. This is a unique field for UNIFIED account } `json:"coin"` // Object } `json:"data"` // Object }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.