Skip to content
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: Fix ws Trades Fees on te #1310

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions exchanges/bitfinex/bitfinex_websocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,15 +188,15 @@ func (b *Bitfinex) wsHandleData(respRaw []byte) error {
}

chanID := int(chanF)
var datum string
if datum, ok = d[1].(string); ok {
var eventType string
if eventType, ok = d[1].(string); ok {
// Capturing heart beat
if datum == "hb" {
if eventType == "hb" {
return nil
}

// Capturing checksum and storing value
if datum == "cs" {
if eventType == "cs" {
var tokenF float64
tokenF, ok = d[2].(float64)
if !ok {
Expand Down Expand Up @@ -824,11 +824,13 @@ func (b *Bitfinex) wsHandleData(respRaw []byte) error {
return errors.New("unable to type assert trade maker")
}
tData.Maker = maker == 1
if tData.Fee, ok = tradeData[9].(float64); !ok {
return errors.New("unable to type assert trade fee")
}
if tData.FeeCurrency, ok = tradeData[10].(string); !ok {
return errors.New("unable to type assert trade fee currency")
if eventType == "tu" {
if tData.Fee, ok = tradeData[9].(float64); !ok {
return errors.New("unable to type assert trade fee")
}
if tData.FeeCurrency, ok = tradeData[10].(string); !ok {
return errors.New("unable to type assert trade fee currency")
}
}
b.Websocket.DataHandler <- tData
}
Expand Down