Documentation ¶
Index ¶
- Constants
- func NewBybitRestClient(apiKey, secretKey string, l *zap.Logger) *bybit.Client
- func NewBybitWSClient(apiKey, secretKey string, l *zap.Logger) *bybit.WebSocketClient
- func NewHTTPClient(timeout time.Duration) *http.Client
- func SubscribeToOrders(ctx context.Context, wsClient *bybit.WebSocketClient, lg *zap.Logger, ...) (<-chan exchanges.OrderEvent, error)
- func SubscribeToPositions(ctx context.Context, wsClient *bybit.WebSocketClient, lg *zap.Logger, ...) (<-chan exchanges.PositionEvent, error)
- func SubscribeToPrices(ctx context.Context, wsClient *bybit.WebSocketClient, lg *zap.Logger, ...) (<-chan exchanges.PriceEvent, error)
- func SubscribeToPricesInverse(ctx context.Context, wsClient *bybit.WebSocketClient, lg *zap.Logger, ...) (<-chan exchanges.PriceEvent, error)
- func SubscribeToPricesLinear(ctx context.Context, wsClient *bybit.WebSocketClient, lg *zap.Logger, ...) (<-chan exchanges.PriceEvent, error)
- func ToBybitFullSymbol(symbol string) string
- func ToBybitSymbol(symbol string) string
- type BybitContract
- func (b *BybitContract) CancelOrder(ctx context.Context, symbol, id string) error
- func (b *BybitContract) GenerateClientOrderID(ctx context.Context, identifierID string) (string, error)
- func (b *BybitContract) GetAccount(ctx context.Context) (res exchanges.Account, err error)
- func (b *BybitContract) GetName() string
- func (b *BybitContract) GetOpenOrders(ctx context.Context) (res []exchanges.OrderDetailInfo, err error)
- func (b *BybitContract) GetOrderInfo(ctx context.Context, symbol, id string, _ *time.Time) (exchanges.OrderInfo, error)
- func (b *BybitContract) GetOrderInfoByClientOrderID(ctx context.Context, symbol, clientOrderID string, _ *time.Time) (exchanges.OrderInfo, error)
- func (b *BybitContract) GetOrders(ctx context.Context, filter exchanges.OrderFilter) (res []exchanges.OrderDetailInfo, err error)
- func (b *BybitContract) GetPrefix() string
- func (b *BybitContract) GetPrice(ctx context.Context, symbol string) (*apd.Decimal, error)
- func (b *BybitContract) GetTradableSymbols(ctx context.Context) ([]exchanges.SymbolInfo, error)
- func (b *BybitContract) PlaceBuyOrder(ctx context.Context, _ bool, symbol string, price, quantity *apd.Decimal, ...) (id string, e error)
- func (b *BybitContract) PlaceBuyOrderV2(ctx context.Context, _ bool, symbol string, price, qty *apd.Decimal, ...) (id string, e error)
- func (b *BybitContract) PlaceSellOrder(ctx context.Context, _ bool, symbol string, price, quantity *apd.Decimal, ...) (id string, e error)
- func (b *BybitContract) PlaceSellOrderV2(ctx context.Context, _ bool, symbol string, price, qty *apd.Decimal, ...) (id string, e error)
- func (b *BybitContract) ReleaseOrder(_ context.Context, symbol, id string) error
- func (b *BybitContract) RoundPrice(_ context.Context, symbol string, price *apd.Decimal, tickSize *string) (*apd.Decimal, error)
- func (b *BybitContract) RoundQuantity(_ context.Context, symbol string, qty *apd.Decimal) (*apd.Decimal, error)
- func (b *BybitContract) WatchAccountPositions(ctx context.Context) (<-chan exchanges.PositionEvent, error)
- func (b *BybitContract) WatchOrdersStatuses(ctx context.Context) (<-chan exchanges.OrderEvent, error)
- func (b *BybitContract) WatchSymbolPrice(ctx context.Context, symbol string) (<-chan exchanges.PriceEvent, error)
- type BybitInverse
- func (b *BybitInverse) CancelOrder(ctx context.Context, symbol, id string) error
- func (b *BybitInverse) GenerateClientOrderID(ctx context.Context, identifierID string) (string, error)
- func (b *BybitInverse) GetAccount(ctx context.Context) (res exchanges.Account, err error)
- func (b *BybitInverse) GetName() string
- func (b *BybitInverse) GetOpenOrders(ctx context.Context) (res []exchanges.OrderDetailInfo, err error)
- func (b *BybitInverse) GetOrderInfo(ctx context.Context, symbol, id string, _ *time.Time) (exchanges.OrderInfo, error)
- func (b *BybitInverse) GetOrderInfoByClientOrderID(ctx context.Context, symbol, clientOrderID string, _ *time.Time) (exchanges.OrderInfo, error)
- func (b *BybitInverse) GetOrders(ctx context.Context, filter exchanges.OrderFilter) (res []exchanges.OrderDetailInfo, err error)
- func (b *BybitInverse) GetPrefix() string
- func (b *BybitInverse) GetPrice(ctx context.Context, symbol string) (*apd.Decimal, error)
- func (b *BybitInverse) GetTradableSymbols(ctx context.Context) ([]exchanges.SymbolInfo, error)
- func (b *BybitInverse) PlaceBuyOrder(ctx context.Context, _ bool, symbol string, price, quantity *apd.Decimal, ...) (id string, e error)
- func (b *BybitInverse) PlaceBuyOrderV2(ctx context.Context, _ bool, symbol string, price, qty *apd.Decimal, ...) (id string, e error)
- func (b *BybitInverse) PlaceSellOrder(ctx context.Context, _ bool, symbol string, price, quantity *apd.Decimal, ...) (id string, e error)
- func (b *BybitInverse) PlaceSellOrderV2(ctx context.Context, _ bool, symbol string, price, qty *apd.Decimal, ...) (id string, e error)
- func (b *BybitInverse) ReleaseOrder(_ context.Context, symbol, id string) error
- func (b *BybitInverse) RoundPrice(_ context.Context, symbol string, price *apd.Decimal, tickSize *string) (*apd.Decimal, error)
- func (b *BybitInverse) RoundQuantity(_ context.Context, symbol string, qty *apd.Decimal) (*apd.Decimal, error)
- func (b *BybitInverse) WatchAccountPositions(ctx context.Context) (<-chan exchanges.PositionEvent, error)
- func (b *BybitInverse) WatchOrdersStatuses(ctx context.Context) (<-chan exchanges.OrderEvent, error)
- func (b *BybitInverse) WatchSymbolPrice(ctx context.Context, symbol string) (<-chan exchanges.PriceEvent, error)
- type BybitLinear
- func (b *BybitLinear) CancelOrder(ctx context.Context, symbol, id string) error
- func (b *BybitLinear) GenerateClientOrderID(ctx context.Context, identifierID string) (string, error)
- func (b *BybitLinear) GetAccount(ctx context.Context) (res exchanges.Account, err error)
- func (b *BybitLinear) GetName() string
- func (b *BybitLinear) GetOpenOrders(ctx context.Context) (res []exchanges.OrderDetailInfo, err error)
- func (b *BybitLinear) GetOrderInfo(ctx context.Context, symbol, id string, _ *time.Time) (exchanges.OrderInfo, error)
- func (b *BybitLinear) GetOrderInfoByClientOrderID(ctx context.Context, symbol, clientOrderID string, _ *time.Time) (exchanges.OrderInfo, error)
- func (b *BybitLinear) GetOrders(ctx context.Context, filter exchanges.OrderFilter) (res []exchanges.OrderDetailInfo, err error)
- func (b *BybitLinear) GetPrefix() string
- func (b *BybitLinear) GetPrice(ctx context.Context, symbol string) (*apd.Decimal, error)
- func (b *BybitLinear) GetTradableSymbols(ctx context.Context) ([]exchanges.SymbolInfo, error)
- func (b *BybitLinear) PlaceBuyOrder(ctx context.Context, _ bool, symbol string, price, quantity *apd.Decimal, ...) (id string, e error)
- func (b *BybitLinear) PlaceBuyOrderV2(ctx context.Context, _ bool, symbol string, price, qty *apd.Decimal, ...) (id string, e error)
- func (b *BybitLinear) PlaceSellOrder(ctx context.Context, _ bool, symbol string, price, quantity *apd.Decimal, ...) (id string, e error)
- func (b *BybitLinear) PlaceSellOrderV2(ctx context.Context, _ bool, symbol string, price, qty *apd.Decimal, ...) (id string, e error)
- func (b *BybitLinear) ReleaseOrder(_ context.Context, symbol, id string) error
- func (b *BybitLinear) RoundPrice(_ context.Context, symbol string, price *apd.Decimal, tickSize *string) (*apd.Decimal, error)
- func (b *BybitLinear) RoundQuantity(_ context.Context, symbol string, qty *apd.Decimal) (*apd.Decimal, error)
- func (b *BybitLinear) WatchAccountPositions(ctx context.Context) (<-chan exchanges.PositionEvent, error)
- func (b *BybitLinear) WatchOrdersStatuses(ctx context.Context) (<-chan exchanges.OrderEvent, error)
- func (b *BybitLinear) WatchSymbolPrice(ctx context.Context, symbol string) (<-chan exchanges.PriceEvent, error)
- type BybitResponse
- type OrderHistoryResponse
- type ResultResponse
- type Server
- type SymbolFilter
- type SymbolInverseFilter
Constants ¶
View Source
const ( GetOrderHistoryPath = "/v5/order/history" BybitBaseURL = "https://api.bybit.com" )
View Source
const BYBIT_PREFIX = "BYBIT-"
Variables ¶
This section is empty.
Functions ¶
func NewBybitRestClient ¶
func NewBybitWSClient ¶
func SubscribeToOrders ¶
func SubscribeToPositions ¶
func SubscribeToPrices ¶
func SubscribeToPricesLinear ¶
func ToBybitFullSymbol ¶
func ToBybitSymbol ¶
Types ¶
type BybitContract ¶
type BybitContract struct {
// contains filtered or unexported fields
}
func NewBybitContract ¶
func NewBybitContract(apiKey, secretKey, host string, lg *zap.Logger) *BybitContract
func (*BybitContract) CancelOrder ¶
func (b *BybitContract) CancelOrder(ctx context.Context, symbol, id string) error
func (*BybitContract) GenerateClientOrderID ¶
func (*BybitContract) GetAccount ¶
func (*BybitContract) GetName ¶
func (b *BybitContract) GetName() string
func (*BybitContract) GetOpenOrders ¶
func (b *BybitContract) GetOpenOrders(ctx context.Context) (res []exchanges.OrderDetailInfo, err error)
func (*BybitContract) GetOrderInfo ¶
func (*BybitContract) GetOrderInfoByClientOrderID ¶
func (*BybitContract) GetOrders ¶
func (b *BybitContract) GetOrders(ctx context.Context, filter exchanges.OrderFilter) (res []exchanges.OrderDetailInfo, err error)
func (*BybitContract) GetPrefix ¶
func (b *BybitContract) GetPrefix() string
func (*BybitContract) GetTradableSymbols ¶
func (b *BybitContract) GetTradableSymbols(ctx context.Context) ([]exchanges.SymbolInfo, error)
func (*BybitContract) PlaceBuyOrder ¶
func (*BybitContract) PlaceBuyOrderV2 ¶
func (b *BybitContract) PlaceBuyOrderV2(ctx context.Context, _ bool, symbol string, price, qty *apd.Decimal, preferredID string, orderType string) (id string, e error)
PlaceBuyOrderV2 Place Buy Order with OrderType param
func (*BybitContract) PlaceSellOrder ¶
func (*BybitContract) PlaceSellOrderV2 ¶
func (b *BybitContract) PlaceSellOrderV2(ctx context.Context, _ bool, symbol string, price, qty *apd.Decimal, preferredID string, orderType string) (id string, e error)
PlaceSellOrderV2 Place Sell Order with OrderType param
func (*BybitContract) ReleaseOrder ¶
func (b *BybitContract) ReleaseOrder(_ context.Context, symbol, id string) error
func (*BybitContract) RoundPrice ¶
func (*BybitContract) RoundQuantity ¶
func (*BybitContract) WatchAccountPositions ¶
func (b *BybitContract) WatchAccountPositions(ctx context.Context) (<-chan exchanges.PositionEvent, error)
func (*BybitContract) WatchOrdersStatuses ¶
func (b *BybitContract) WatchOrdersStatuses(ctx context.Context) (<-chan exchanges.OrderEvent, error)
WatchOrdersStatuses Returns control immediately
func (*BybitContract) WatchSymbolPrice ¶
func (b *BybitContract) WatchSymbolPrice(ctx context.Context, symbol string) (<-chan exchanges.PriceEvent, error)
WatchSymbolPrice
type BybitInverse ¶
type BybitInverse struct {
// contains filtered or unexported fields
}
func NewBybitInverse ¶
func NewBybitInverse(apiKey, secretKey, host string, lg *zap.Logger) *BybitInverse
func (*BybitInverse) CancelOrder ¶
func (b *BybitInverse) CancelOrder(ctx context.Context, symbol, id string) error
func (*BybitInverse) GenerateClientOrderID ¶
func (*BybitInverse) GetAccount ¶
func (*BybitInverse) GetName ¶
func (b *BybitInverse) GetName() string
func (*BybitInverse) GetOpenOrders ¶
func (b *BybitInverse) GetOpenOrders(ctx context.Context) (res []exchanges.OrderDetailInfo, err error)
func (*BybitInverse) GetOrderInfo ¶
func (*BybitInverse) GetOrderInfoByClientOrderID ¶
func (*BybitInverse) GetOrders ¶
func (b *BybitInverse) GetOrders(ctx context.Context, filter exchanges.OrderFilter) (res []exchanges.OrderDetailInfo, err error)
func (*BybitInverse) GetPrefix ¶
func (b *BybitInverse) GetPrefix() string
func (*BybitInverse) GetTradableSymbols ¶
func (b *BybitInverse) GetTradableSymbols(ctx context.Context) ([]exchanges.SymbolInfo, error)
func (*BybitInverse) PlaceBuyOrder ¶
func (*BybitInverse) PlaceBuyOrderV2 ¶
func (b *BybitInverse) PlaceBuyOrderV2(ctx context.Context, _ bool, symbol string, price, qty *apd.Decimal, preferredID string, orderType string) (id string, e error)
PlaceBuyOrderV2 Place Buy Order with OrderType param
func (*BybitInverse) PlaceSellOrder ¶
func (*BybitInverse) PlaceSellOrderV2 ¶
func (b *BybitInverse) PlaceSellOrderV2(ctx context.Context, _ bool, symbol string, price, qty *apd.Decimal, preferredID string, orderType string) (id string, e error)
PlaceSellOrderV2 Place Sell Order with OrderType param
func (*BybitInverse) ReleaseOrder ¶
func (b *BybitInverse) ReleaseOrder(_ context.Context, symbol, id string) error
func (*BybitInverse) RoundPrice ¶
func (*BybitInverse) RoundQuantity ¶
func (*BybitInverse) WatchAccountPositions ¶
func (b *BybitInverse) WatchAccountPositions(ctx context.Context) (<-chan exchanges.PositionEvent, error)
func (*BybitInverse) WatchOrdersStatuses ¶
func (b *BybitInverse) WatchOrdersStatuses(ctx context.Context) (<-chan exchanges.OrderEvent, error)
WatchOrdersStatuses Returns control immediately
func (*BybitInverse) WatchSymbolPrice ¶
func (b *BybitInverse) WatchSymbolPrice(ctx context.Context, symbol string) (<-chan exchanges.PriceEvent, error)
WatchSymbolPrice
type BybitLinear ¶
type BybitLinear struct {
// contains filtered or unexported fields
}
func NewBybitLinear ¶
func NewBybitLinear(apiKey, secretKey, host string, lg *zap.Logger) *BybitLinear
func (*BybitLinear) CancelOrder ¶
func (b *BybitLinear) CancelOrder(ctx context.Context, symbol, id string) error
func (*BybitLinear) GenerateClientOrderID ¶
func (*BybitLinear) GetAccount ¶
func (*BybitLinear) GetName ¶
func (b *BybitLinear) GetName() string
func (*BybitLinear) GetOpenOrders ¶
func (b *BybitLinear) GetOpenOrders(ctx context.Context) (res []exchanges.OrderDetailInfo, err error)
func (*BybitLinear) GetOrderInfo ¶
func (*BybitLinear) GetOrderInfoByClientOrderID ¶
func (*BybitLinear) GetOrders ¶
func (b *BybitLinear) GetOrders(ctx context.Context, filter exchanges.OrderFilter) (res []exchanges.OrderDetailInfo, err error)
func (*BybitLinear) GetPrefix ¶
func (b *BybitLinear) GetPrefix() string
func (*BybitLinear) GetTradableSymbols ¶
func (b *BybitLinear) GetTradableSymbols(ctx context.Context) ([]exchanges.SymbolInfo, error)
func (*BybitLinear) PlaceBuyOrder ¶
func (*BybitLinear) PlaceBuyOrderV2 ¶
func (b *BybitLinear) PlaceBuyOrderV2(ctx context.Context, _ bool, symbol string, price, qty *apd.Decimal, preferredID string, orderType string) (id string, e error)
PlaceBuyOrderV2 Place Buy Order with OrderType param
func (*BybitLinear) PlaceSellOrder ¶
func (*BybitLinear) PlaceSellOrderV2 ¶
func (b *BybitLinear) PlaceSellOrderV2(ctx context.Context, _ bool, symbol string, price, qty *apd.Decimal, preferredID string, orderType string) (id string, e error)
PlaceSellOrderV2 Place Sell Order with OrderType param
func (*BybitLinear) ReleaseOrder ¶
func (b *BybitLinear) ReleaseOrder(_ context.Context, symbol, id string) error
func (*BybitLinear) RoundPrice ¶
func (*BybitLinear) RoundQuantity ¶
func (*BybitLinear) WatchAccountPositions ¶
func (b *BybitLinear) WatchAccountPositions(ctx context.Context) (<-chan exchanges.PositionEvent, error)
func (*BybitLinear) WatchOrdersStatuses ¶
func (b *BybitLinear) WatchOrdersStatuses(ctx context.Context) (<-chan exchanges.OrderEvent, error)
WatchOrdersStatuses Returns control immediately
func (*BybitLinear) WatchSymbolPrice ¶
func (b *BybitLinear) WatchSymbolPrice(ctx context.Context, symbol string) (<-chan exchanges.PriceEvent, error)
WatchSymbolPrice
type BybitResponse ¶
type BybitResponse struct { RetCode int `json:"retCode"` RetMsg string `json:"retMsg"` Result ResultResponse `json:"result"` }
type OrderHistoryResponse ¶
type ResultResponse ¶
type ResultResponse struct { NextPageCursor string `json:"nextPageCursor"` Category string `json:"category"` List []OrderHistoryResponse `json:"list"` }
type SymbolFilter ¶
type SymbolFilter struct { LotSizeFilter struct { BasePrecision string `json:"basePrecision"` QuotePrecision string `json:"quotePrecision"` MaxOrderQty string `json:"maxOrderQty"` MinOrderQty string `json:"minOrderQty"` MinOrderAmt string `json:"minOrderAmt"` MaxOrderAmt string `json:"maxOrderAmt"` } `json:"lotSizeFilter"` PriceFilter struct { TickSize string `json:"tickSize"` } `json:"priceFilter"` }
type SymbolInverseFilter ¶
type SymbolInverseFilter struct { LotSizeFilter struct { MaxOrderQty string `json:"maxOrderQty"` MinOrderQty string `json:"minOrderQty"` QtyStep string `json:"qtyStep"` PostOnlyMaxOrderQty string `json:"postOnlyMaxOrderQty"` } `json:"lotSizeFilter"` PriceFilter struct { MinPrice string `json:"minPrice"` MaxPrice string `json:"maxPrice"` TickSize string `json:"tickSize"` } `json:"priceFilter"` }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.