-
Notifications
You must be signed in to change notification settings - Fork 820
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bitfinex: Improve websocket type assertion checks for order processing #1292
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done this works. Just one nit.
5c1398e
to
a03e482
Compare
Strange as this might seem, this branch had 1 nit from @shazbert which didn't make it into the main refactor. Rebased on master already |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changes ACK!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Upon second thought, would be better to annotate what stream event triggered the type assert failure so it's more helpful for the user
@@ -916,7 +916,9 @@ func (b *Bitfinex) handleWSNotification(d []interface{}, respRaw []byte) error { | |||
} | |||
case strings.Contains(channelName, wsOrderNewRequest): | |||
if data[2] != nil { | |||
if cid, ok := data[2].(float64); ok && cid > 0 { | |||
if cid, ok := data[2].(float64); !ok { | |||
return common.GetTypeAssertError("float64", data[2]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return common.GetTypeAssertError("float64", data[2]) | |
return common.GetTypeAssertError("float64", data[2], "wsOrderNewRequest cid") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes ACK, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tACK!
// my forced error
type assert failure from string to float64 for: on-req cid
thrasher-corp#1292) * Bitfinex: Error if ws data id/cid is not a float64 * Bitfinex: Add annotation to WS id/cid assest errs
Fixes #1288
Type of change
Please delete options that are not relevant and add an
x
in[]
as item is complete.How has this been tested