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

exchanges: shift UpdateTradablePairs method to exchange.go base method. #1482

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

shazbert
Copy link
Collaborator

@shazbert shazbert commented Feb 16, 2024

PR Description

  • Requires dependency exchanges: shift GetDefaultConfig wrapper function to exchange.go #1472
  • Shifts wrapper method UpdateTradablePairs to exchange.go as base method. Which reduces code foot print.
  • Fixes casing bug on digits for currency.Code
  • Removed param force bool in UpdateTradablePairs & its counterpart UpdatePairs as it wasn't doing anything specific.
  • Adding logging for a format upgrade for pairs.
  • Shifted handy UpdatePairsOnce code to sharedtestvalues package

Fixes # (issue)

Type of change

Please delete options that are not relevant and add an x in [] as item is complete.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How has this been tested

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration and
also consider improving test coverage whilst working on a certain feature or package.

  • go test ./... -race
  • golangci-lint run
  • Test X

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation and regenerated documentation via the documentation tool
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally and on Github Actions with my changes
  • Any dependent changes have been merged and published in downstream modules

@shazbert shazbert added bug help wanted review me This pull request is ready for review nomerge requires dependency This pull request is dependent on another, so it can't be merged until the dependent one is merged labels Feb 16, 2024
@shazbert shazbert self-assigned this Feb 16, 2024
@shazbert shazbert added the low priority This enhancement or update will be implemented at a later date. label Feb 18, 2024
@shazbert
Copy link
Collaborator Author

  • Remove TestUpdateTradeablePairs from all exchanges
  • Add base test
  • make sure ( Fetch and Update ) are done

@gbjk gbjk mentioned this pull request Mar 13, 2024
3 tasks

// UpdateTradablePairs updates the exchanges available pairs and stores them in
// the exchanges config.
func (b *Base) UpdateTradablePairs(ctx context.Context, instance LimitedScope) error {
Copy link
Collaborator

Choose a reason for hiding this comment

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

It seems weird to be able to set the pairs of an exchange with a different one. UpdateTradablePairs can be used outside of the scope of GetDefaultConfig (I do at least), so it can't rely on the checks you've done in GetDefaultConfig and will need the same equals check from there


// UpdateTradablePairs updates the exchanges available pairs and stores them in
// the exchanges config.
func (b *Base) UpdateTradablePairs(ctx context.Context, instance LimitedScope) error {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Unlike with GetDefaultConfig in #1472 it feels a bit weird to make this an exported function rather than something an exchange can call itself - which makes me question my comments there already 😆
Since every instance of UpdateTradablePairs is exactly the same, this does feel like a good one to change. Feels weird. I guess this highlights the fun of having Base not implement all IBotExchange functions. I don't have a real suggestion here.
A minor jank is preferable to maintaining all exchanges' implementations that are the same, just hoping to get past the jank 😄

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

One suggestion in both cases in SetDefaults we set those calling functions as a base field and call them. Then I can get rid of the jank because it is quite gross.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Wait I think that might defeat the purpose. Let me check.

@shazbert shazbert added reconstructing Based on PR feedback, this is currently being reworked and is not to be merged and removed nomerge requires dependency This pull request is dependent on another, so it can't be merged until the dependent one is merged review me This pull request is ready for review labels Apr 12, 2024
@shazbert shazbert added low priority This enhancement or update will be implemented at a later date. and removed reconstructing Based on PR feedback, this is currently being reworked and is not to be merged low priority This enhancement or update will be implemented at a later date. labels Apr 30, 2024
@shazbert shazbert added the review me This pull request is ready for review label May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug low priority This enhancement or update will be implemented at a later date. review me This pull request is ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants