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

CoinbasePro: Add subscription templating #3

Conversation

gbjk
Copy link

@gbjk gbjk commented Aug 22, 2024

Hello @cranktakular 👋

This PR is for merging into your existing coinbase api revamp branch.

  • Re-adds subscription configuration
  • Updates to the latest patterns using sub templating
  • Removes ticker_batch sub
  • Adds user sub

Any questions, just ask, here or on slack 🙂

@gbjk gbjk force-pushed the feature/coinbase_sub_conf_v2 branch from 0704970 to 9205394 Compare August 23, 2024 05:07
Copy link
Owner

@cranktakular cranktakular left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nits and questions.

}
time.Sleep(time.Millisecond * 10)
errs = common.AppendError(errs, err)
}
return nil
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't errs be returned around here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, We want to collect all of the errors, not just return on the very first one 😄

In reality, in situations where engine is running, we expect subs to be len(1).
However the for loop protects against a manual call to Subscribe before calling ExpandTemplates.
Also just cleaner than having to len protect subs and then use s := subs[0].

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean at the end of the function, on line 375, we should return errs instead of nil. If we haven't collected any errors, errs will just be nil anyway, and at the end it won't interrupt execution.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😳
Sorry, you're completely right and I missed your point entirely
Erm. Yeah. Shocking I even brought this up to look at it 🤦

Fixed 62c48af

exchanges/coinbasepro/coinbasepro_test.go Show resolved Hide resolved
exchanges/coinbasepro/coinbasepro_test.go Outdated Show resolved Hide resolved
Copy link
Owner

@cranktakular cranktakular left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Further discussion

}
time.Sleep(time.Millisecond * 10)
errs = common.AppendError(errs, err)
}
return nil
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean at the end of the function, on line 375, we should return errs instead of nil. If we haven't collected any errors, errs will just be nil anyway, and at the end it won't interrupt execution.

@cranktakular cranktakular merged commit 1dac1c1 into cranktakular:coinbase_api_revamp Aug 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants