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
base: master
Are you sure you want to change the base?
Conversation
…ition, to ensure set defaults doesn't get called twice and to reduce code
|
exchanges/exchange.go
Outdated
|
||
// UpdateTradablePairs updates the exchanges available pairs and stores them in | ||
// the exchanges config. | ||
func (b *Base) UpdateTradablePairs(ctx context.Context, instance LimitedScope) error { |
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.
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
exchanges/exchange.go
Outdated
|
||
// UpdateTradablePairs updates the exchanges available pairs and stores them in | ||
// the exchanges config. | ||
func (b *Base) UpdateTradablePairs(ctx context.Context, instance LimitedScope) error { |
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.
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 😄
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.
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.
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.
Wait I think that might defeat the purpose. Let me check.
PR Description
UpdateTradablePairs
toexchange.go
as base method. Which reduces code foot print.force bool
inUpdateTradablePairs
& its counterpartUpdatePairs
as it wasn't doing anything specific.Shifted handyUpdatePairsOnce
code to sharedtestvalues packageFixes # (issue)
Type of change
Please delete options that are not relevant and add an
x
in[]
as item is complete.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.
Checklist