Versions in this module Expand all Collapse all v1 v1.0.2 Jul 20, 2023 v1.0.1 Jul 20, 2023 Changes in this version + const ChanBook + const ChanCandles + const ChanStatus + const ChanTicker + const ChanTrades + const DMSCancelOnDisconnect + const ErrorCodeAlreadySubscribed + const ErrorCodeNotSubscribed + const ErrorCodeSubscriptionFailed + const ErrorCodeUnknownBookLength + const ErrorCodeUnknownBookPrecision + const ErrorCodeUnknownChannel + const ErrorCodeUnknownEvent + const ErrorCodeUnknownPair + const ErrorCodeUnsubscribeFailed + const EventPing + const EventSubscribe + const EventUnsubscribe + const KEEP_ALIVE_TIMEOUT + const MaxChannels + const WS_READ_CAPACITY + const WS_WRITE_CAPACITY + var ErrWSAlreadyConnected = fmt.Errorf("websocket connection already established") + var ErrWSNotConnected = fmt.Errorf("websocket connection not established") + func ConvertBytesToJsonNumberArray(b []byte) ([]interface{}, error) + type Asynchronous interface + Close func() + Connect func() error + Done func() <-chan error + Listen func() <-chan []byte + Send func(ctx context.Context, msg interface{}) error + type AsynchronousFactory interface + Create func() Asynchronous + func NewWebsocketAsynchronousFactory(parameters *Parameters) AsynchronousFactory + type AuthEvent struct + AuthID string + Caps Capabilities + ChanID int64 + Event string + Message string + Status string + SubID string + UserID int64 + type AuthState authState + const NoAuthentication + const PendingAuthentication + const RejectedAuthentication + const SuccessfulAuthentication + type BookFactory struct + func (f *BookFactory) Build(sub *subscription, objType string, raw []interface{}, b []byte) (interface{}, error) + func (f *BookFactory) BuildSnapshot(sub *subscription, raw [][]interface{}, b []byte) (interface{}, error) + func (s BookFactory) Close() + func (s BookFactory) ListenDisconnect() <-chan HeartbeatDisconnect + func (s BookFactory) ResetAll() + func (s BookFactory) ResetSocketSubscriptions(socketId SocketId) []*subscription + type CandlesFactory struct + func (f *CandlesFactory) Build(sub *subscription, objType string, raw []interface{}, raw_bytes []byte) (interface{}, error) + func (f *CandlesFactory) BuildSnapshot(sub *subscription, raw [][]interface{}, raw_bytes []byte) (interface{}, error) + func (s CandlesFactory) Close() + func (s CandlesFactory) ListenDisconnect() <-chan HeartbeatDisconnect + func (s CandlesFactory) ResetAll() + func (s CandlesFactory) ResetSocketSubscriptions(socketId SocketId) []*subscription + type Capabilities struct + Account Capability + Funding Capability + History Capability + Orders Capability + Positions Capability + Wallets Capability + Withdraw Capability + type Capability struct + Read int + Write int + type Client struct + Authentication AuthState + func New() *Client + func NewWithAsyncFactory(async AsynchronousFactory) *Client + func NewWithAsyncFactoryNonce(async AsynchronousFactory, nonce utils.NonceGenerator) *Client + func NewWithParams(params *Parameters) *Client + func NewWithParamsAsyncFactory(params *Parameters, async AsynchronousFactory) *Client + func NewWithParamsAsyncFactoryNonce(params *Parameters, async AsynchronousFactory, nonce utils.NonceGenerator) *Client + func NewWithParamsNonce(params *Parameters, nonce utils.NonceGenerator) *Client + func (c *Client) AvailableCapacity() int + func (c *Client) CancelOnDisconnect(cxl bool) *Client + func (c *Client) Close() + func (c *Client) CloseFundingCredit(ctx context.Context, fundingOffer *fundingcredit.CancelRequest) error + func (c *Client) CloseFundingLoan(ctx context.Context, flcr *fundingloan.CancelRequest) error + func (c *Client) Connect() error + func (c *Client) ConnectionCount() int + func (c *Client) Credentials(key string, secret string) *Client + func (c *Client) EnableFlag(ctx context.Context, flag int) (string, error) + func (c *Client) GetAuthenticatedSocket() (*Socket, error) + func (c *Client) GetOrderbook(symbol string) (*Orderbook, error) + func (c *Client) IsConnected() bool + func (c *Client) Listen() <-chan interface{} + func (c *Client) LookupSubscription(subID string) (*SubscriptionRequest, error) + func (c *Client) Send(ctx context.Context, msg interface{}) error + func (c *Client) StartNewConnection() error + func (c *Client) SubmitCancel(ctx context.Context, ocr *order.CancelRequest) error + func (c *Client) SubmitFundingCancel(ctx context.Context, fundingOffer *fundingoffer.CancelRequest) error + func (c *Client) SubmitFundingOffer(ctx context.Context, fundingOffer *fundingoffer.SubmitRequest) error + func (c *Client) SubmitOrder(ctx context.Context, onr *order.NewRequest) error + func (c *Client) SubmitUpdateOrder(ctx context.Context, our *order.UpdateRequest) error + func (c *Client) Subscribe(ctx context.Context, req *SubscriptionRequest) (string, error) + func (c *Client) SubscribeBook(ctx context.Context, symbol string, precision common.BookPrecision, ...) (string, error) + func (c *Client) SubscribeCandles(ctx context.Context, symbol string, resolution common.CandleResolution) (string, error) + func (c *Client) SubscribeStatus(ctx context.Context, symbol string, sType common.StatusType) (string, error) + func (c *Client) SubscribeTicker(ctx context.Context, symbol string) (string, error) + func (c *Client) SubscribeTrades(ctx context.Context, symbol string) (string, error) + func (c *Client) Unsubscribe(ctx context.Context, id string) error + type ConfEvent struct + Flags int + type ErrorEvent struct + ChanID int64 + Channel string + Code int + Frequency string + Key string + Len string + Message string + Pair string + Precision string + SubID string + Symbol string + type FlagRequest struct + Event string + Flags int + type Heartbeat struct + type HeartbeatDisconnect struct + Error error + Subscription *subscription + type InfoEvent struct + Code int + Msg string + Platform PlatformInfo + ServerId string + Version float64 + type Orderbook struct + func (ob *Orderbook) Asks() []book.Book + func (ob *Orderbook) Bids() []book.Book + func (ob *Orderbook) Checksum() uint32 + func (ob *Orderbook) SetWithSnapshot(bs *book.Snapshot) + func (ob *Orderbook) Symbol() string + func (ob *Orderbook) UpdateWith(b *book.Book) + type Parameters struct + AutoReconnect bool + CapacityPerConnection int + HeartbeatTimeout time.Duration + LogTransport bool + Logger *logging.Logger + ManageOrderbook bool + ReconnectAttempts int + ReconnectInterval time.Duration + ResubscribeOnReconnect bool + ShutdownTimeout time.Duration + URL string + func NewDefaultParameters() *Parameters + type PlatformInfo struct + Status int + type RawEvent struct + Data interface{} + type Socket struct + Id SocketId + IsAuthenticated bool + IsConnected bool + ResetSubscriptions []*subscription + type SocketId int + type StatsFactory struct + func (f *StatsFactory) Build(sub *subscription, objType string, raw []interface{}, raw_bytes []byte) (interface{}, error) + func (f *StatsFactory) BuildSnapshot(sub *subscription, raw [][]interface{}, raw_bytes []byte) (interface{}, error) + func (s StatsFactory) Close() + func (s StatsFactory) ListenDisconnect() <-chan HeartbeatDisconnect + func (s StatsFactory) ResetAll() + func (s StatsFactory) ResetSocketSubscriptions(socketId SocketId) []*subscription + type SubscribeEvent struct + ChanID int64 + Channel string + Frequency string + Key string + Len string + Pair string + Precision string + SubID string + Symbol string + type SubscriptionRequest struct + APIKey string + AuthNonce string + AuthPayload string + AuthSig string + Channel string + DMS int + Event string + Filter []string + Frequency string + Key string + Len string + Pair string + Precision string + SubID string + Symbol string + func (s *SubscriptionRequest) String() string + type SubscriptionSet []*subscription + func (s SubscriptionSet) Len() int + func (s SubscriptionSet) Less(i, j int) bool + func (s SubscriptionSet) RemoveByChannelId(chanId int64) SubscriptionSet + func (s SubscriptionSet) RemoveBySubscriptionId(subID string) SubscriptionSet + func (s SubscriptionSet) Swap(i, j int) + type TickerFactory struct + func (f *TickerFactory) Build(sub *subscription, objType string, raw []interface{}, raw_bytes []byte) (interface{}, error) + func (f *TickerFactory) BuildSnapshot(sub *subscription, raw [][]interface{}, raw_bytes []byte) (interface{}, error) + func (s TickerFactory) Close() + func (s TickerFactory) ListenDisconnect() <-chan HeartbeatDisconnect + func (s TickerFactory) ResetAll() + func (s TickerFactory) ResetSocketSubscriptions(socketId SocketId) []*subscription + type TradeFactory struct + func (f *TradeFactory) Build(sub *subscription, objType string, raw []interface{}, raw_bytes []byte) (interface{}, error) + func (f *TradeFactory) BuildSnapshot(sub *subscription, raw [][]interface{}, raw_bytes []byte) (interface{}, error) + func (s TradeFactory) Close() + func (s TradeFactory) ListenDisconnect() <-chan HeartbeatDisconnect + func (s TradeFactory) ResetAll() + func (s TradeFactory) ResetSocketSubscriptions(socketId SocketId) []*subscription + type UnsubscribeEvent struct + ChanID int64 + Status string + type UnsubscribeRequest struct + ChanID int64 + Event string + type WebsocketAsynchronousFactory struct + func (w *WebsocketAsynchronousFactory) Create() Asynchronous