Skip to content

Commit

Permalink
support subscription error events
Browse files Browse the repository at this point in the history
  • Loading branch information
brobits committed Apr 18, 2018
1 parent 9da3f44 commit 72a16fb
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
9 changes: 9 additions & 0 deletions v2/websocket/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,12 @@ func (c *Client) SubmitOrder(ctx context.Context, order *bitfinex.OrderNewReques
func (c *Client) SubmitCancel(ctx context.Context, cancel *bitfinex.OrderCancelRequest) error {
return c.asynchronous.Send(ctx, cancel)
}

// LookupSubscription looks up a subscription request by ID
func (c *Client) LookupSubscription(subID string) (*SubscriptionRequest, error) {
s, err := c.subscriptions.lookupBySubscriptionID(subID)
if err != nil {
return nil, err
}
return s.Request, nil
}
11 changes: 11 additions & 0 deletions v2/websocket/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,17 @@ const (
type ErrorEvent struct {
Code int `json:"code"`
Message string `json:"msg"`

// also contain members related to subscription reject
SubID string `json:"subId"`
Channel string `json:"channel"`
ChanID int64 `json:"chanId"`
Symbol string `json:"symbol"`
Precision string `json:"prec,omitempty"`
Frequency string `json:"freq,omitempty"`
Key string `json:"key,omitempty"`
Len string `json:"len,omitempty"`
Pair string `json:"pair"`
}

type UnsubscribeEvent struct {
Expand Down

0 comments on commit 72a16fb

Please sign in to comment.