Versions in this module Expand all Collapse all v1 v1.0.3 Apr 29, 2020 Changes in this version + var ConnStateNames = map[ConnState]string + var ErrBadCredentials = errors.New("bad credentials") + var ErrBadNonce = errors.New("bad nonce") + var ErrBadProto = errors.New("request is not a valid proto type") + var ErrConnLoopActive = errors.New("connection loop is already active") + var ErrInvalidAuthn = errors.New("invalid authentication result") + var ErrInvalidOrder = errors.New("order is not valid") + var ErrNoExchangeAccess = errors.New("cryptowatch account is missing exchange api keys") + var ErrNotConnected = errors.New("not connected") + var ErrNotInitialized = errors.New("trade client not initialized") + var ErrTokenExpired = errors.New("token is expired") + var ErrUnknownAuthnError = errors.New("unknown authentication error") + type Bandwidth struct + BytesRemaining int64 + BytesUsed int64 + OK bool + func (b Bandwidth) String() string + type BandwidthUpdateCB func(b Bandwidth) + type ConnClosedCallback func(state ConnState) + type ConnState int + const ConnStateAny + const ConnStateAuthenticating + const ConnStateConnecting + const ConnStateDisconnected + const ConnStateEstablished + const ConnStateWaitBeforeReconnect + type ExchangeAuth struct + APIKey string + APISecret string + CustomerID string + KeyPassphrase string + type MarketUpdateCB func(common.MarketID, common.MarketUpdate) + type MissedMessages struct + NumMissedMessages int64 + type MissedMessagesCB func(mm MissedMessages) + type OnBalancesUpdateCB func(marketID common.MarketID, balances []common.Balance) + type OnErrorCB func(err error, disconnecting bool) + type OnMarketReadyCB func(marketID common.MarketID, ready bool) + type OnPositionsUpdateCB func(marketID common.MarketID, positions []common.PrivatePosition) + type OnTradeErrorCB func(marketID common.MarketID, err error, disconnecting bool) + type OrdersUpdateCB func(marketID common.MarketID, orders []common.PrivateOrder) + type PairUpdateCB func(common.Pair, common.PairUpdate) + type PrivateTradesUpdateCB func(marketID common.MarketID, trades []common.PrivateTrade) + type ReconnectOpts struct + Backoff bool + MaxReconnectTimeout time.Duration + Reconnect bool + ReconnectTimeout time.Duration + type StateCallback func(prevState, curState ConnState) + type StateListenerOpt struct + CallImmediately bool + OneOff bool + type StreamClient struct + func NewStreamClient(params *StreamClientParams) (*StreamClient, error) + func (sc *StreamClient) Close() (err error) + func (sc *StreamClient) Connect() (err error) + func (sc *StreamClient) GetSubscriptions() []*StreamSubscription + func (sc *StreamClient) OnBandwidthUpdate(cb BandwidthUpdateCB) + func (sc *StreamClient) OnConnClosed(cb ConnClosedCallback) + func (sc *StreamClient) OnError(cb OnErrorCB) + func (sc *StreamClient) OnMarketUpdate(cb MarketUpdateCB) + func (sc *StreamClient) OnMissedMessages(cb MissedMessagesCB) + func (sc *StreamClient) OnPairUpdate(cb PairUpdateCB) + func (sc *StreamClient) OnStateChange(state ConnState, cb StateCallback) + func (sc *StreamClient) OnStateChangeOpt(state ConnState, cb StateCallback, opt StateListenerOpt) + func (sc *StreamClient) OnSubscriptionResult(cb SubscriptionResultCB) + func (sc *StreamClient) OnUnsubscriptionResult(cb UnsubscriptionResultCB) + func (sc *StreamClient) Subscribe(subs []*StreamSubscription) error + func (sc *StreamClient) URL() string + func (sc *StreamClient) Unsubscribe(subs []*StreamSubscription) error + type StreamClientParams struct + Subscriptions []*StreamSubscription + WSParams *WSParams + type StreamSubscription struct + Resource string + func (s *StreamSubscription) GetResource() string + type SubscribeError struct + Error string + Key string + Subscription Subscription + type Subscription interface + GetResource func() string + type SubscriptionResult struct + Failed []SubscribeError + Status SubscriptionStatus + Subscriptions []Subscription + func (v SubscriptionResult) String() string + type SubscriptionResultCB func(sr SubscriptionResult) + type SubscriptionStatus struct + Subscriptions []Subscription + type TradeClient struct + func NewTradeClient(params *TradeClientParams) (*TradeClient, error) + func (tc *TradeClient) CancelOrder(params common.CancelOrderParams) error + func (tc *TradeClient) Close() (err error) + func (tc *TradeClient) Connect() (err error) + func (tc *TradeClient) GetBalances() (map[common.Exchange][]common.Balance, error) + func (tc *TradeClient) GetOrders(marketID common.MarketID) ([]common.PrivateOrder, error) + func (tc *TradeClient) GetPositions(marketID common.MarketID) ([]common.PrivatePosition, error) + func (tc *TradeClient) GetSubscriptions() []*tradeSession + func (tc *TradeClient) GetTrades(marketID common.MarketID) ([]common.PrivateTrade, error) + func (tc *TradeClient) OnBalancesUpdate(cb OnBalancesUpdateCB) + func (tc *TradeClient) OnConnClosed(cb ConnClosedCallback) + func (tc *TradeClient) OnError(cb OnTradeErrorCB) + func (tc *TradeClient) OnMarketReadyChange(cb OnMarketReadyCB) + func (tc *TradeClient) OnOrdersUpdate(cb OrdersUpdateCB) + func (tc *TradeClient) OnPositionsUpdate(cb OnPositionsUpdateCB) + func (tc *TradeClient) OnReady(cb func()) + func (tc *TradeClient) OnStateChange(state ConnState, cb StateCallback) + func (tc *TradeClient) OnStateChangeOpt(state ConnState, cb StateCallback, opt StateListenerOpt) + func (tc *TradeClient) OnSubscriptionResult(cb SubscriptionResultCB) + func (tc *TradeClient) OnTradesUpdate(cb PrivateTradesUpdateCB) + func (tc *TradeClient) PlaceOrder(params common.PlaceOrderParams) (common.PrivateOrder, error) + func (tc *TradeClient) Sync(marketID common.MarketID) error + func (tc *TradeClient) URL() string + type TradeClientParams struct + RESTURL string + TradeSessions []*TradeSessionParams + WSParams *WSParams + type TradeSessionParams struct + ExchangeAuth *ExchangeAuth + MarketParams common.MarketParams + type UnsubscribeError struct + Error string + Key string + Subscription Subscription + type UnsubscriptionResult struct + Failed []UnsubscribeError + Status SubscriptionStatus + Subscriptions []Subscription + func (v UnsubscriptionResult) String() string + type UnsubscriptionResultCB func(sr UnsubscriptionResult) + type WSParams struct + APIKey string + ReconnectOpts *ReconnectOpts + SecretKey string + URL string