-
Notifications
You must be signed in to change notification settings - Fork 902
exchanges: Update exchange templates #1777
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
Conversation
β¦ into update_tif
β¦ into update_tif
β¦ into update_tif
β¦ into update_tif
β¦ into update_tif
β¦ into update_tif
β¦ into update_tif
β¦ into update_tif
β¦ into update_tif
β¦ into update_tif
β¦ into update_tif
β¦ into update_tif
β¦ into update_tif
β¦ into update_tif
β¦ into update_tif
β¦ into update_tif
β¦ into update_tif
β¦ into template_update
gbjk
left a comment
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.
Good progress!
Sorry; I'd like to remove the inconsistency in the exchange method receiver naming.
Some exchanges are naming it ex *Exchange and others have e *Exchange.
It seems to be following that the original exchange receiver was 2 characters, so ex is as well, but that doesn't make any sense.
If I'm not missing any other reason, can we make it consistently e everywhere?
Note: Specifically choosing e, and not ex in this request, to be idiomatic
Once that's done, I'll have another pass to do.
Regarding the receivers naming, I am decision neutral(Pontius π ) on this idea of replacing two variable receivers with "ex" and with just 'e' for single variable receiver for the rest. But, regarding consistency, I think, having the consistency in the specific exchange package is enough ... may be @thrasher- could give comment on this. |
We should aim to be as consistent as possible, so in this case we can change them in the |
cranktakular
left a comment
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.
Got some changes I need.
In general, I'd also suggest making a template for rate limiting, and finishing the checklist at the start of this PR.
| fmt.Printf("Output directory: %s\n", exchangeDirectory) | ||
|
|
||
| exch.CapitalName = cases.Title(language.English).String(exch.Name) | ||
| exch.Variable = exch.Name[0: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.
With this line being removed, do we still need checkExchangeName to have that length check? Smells like it was mostly to avoid panics here.
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.
I think we should keep this check just because the naming should satisfy this check even-if it is not helpful for the receiver naming.
β¦ into template_update
β¦ into template_update
gbjk
left a comment
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.
Thanks.
Couple of new changes, and some outstanding existing changes.
β¦ into template_update
cranktakular
left a comment
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.
Got one little nit, but aside that, I can tACK.
| @@ -65,18 +72,14 @@ func TestNewExchangeAndSaveConfig(t *testing.T) { | |||
| WS: true, | |||
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.
Changing this to false adds a line of coverage for code you newly added, without losing any elsewhere.
If you want to keep this in case of issues, you can set up another exchange where this is false.
cranktakular
left a comment
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.
And that makes it a full-on tACK from me.
(At least for the exchange_template folder, I haven't reviewed the rest of the changes)
gbjk
left a comment
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.
Approved π
Minor nits only π and just a reminder in case you missed the suggestion that the newly private function doesn't need a comment π¦
cmd/exchange_template/websocket.tmpl
Outdated
|
|
||
| // Subscriber sends a websocket message to receive data from the channel | ||
| func (e *Exchange) Subscriber(_ subscription.List) error { | ||
| // Subscribe sends a websocket message to receive data from the channel |
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.
π Note: There was a change to the comment here. But in hindsight I'm not happy with that suggestion either. Just a minor update to plurarity.
| // Subscribe sends a websocket message to receive data from the channel | |
| // Subscribe sends websocket messages to receive data for a list of channels |
cmd/exchange_template/websocket.tmpl
Outdated
|
|
||
| // Unsubscriber sends a websocket message to stop receiving data from the channel | ||
| func (e *Exchange) Unsubscriber(_ subscription.List) error { | ||
| // Unsubscribe removes a channel subscriptions from the websocket |
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.
π
| // Unsubscribe removes a channel subscriptions from the websocket | |
| // Unsubscribe sends websocket messages to stop receiving data for a list of channels |
cmd/exchange_template/websocket.tmpl
Outdated
|
|
||
| // GenerateSubscriptions returns a list of subscriptions from the configured subscriptions feature | ||
| func (e *Exchange) GenerateSubscriptions() (subscription.List, error) { | ||
| // generateSubscriptions returns a list of subscriptions from the configured subscriptions feature |
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.
π¦ In case you missed it, I'm suggesting to remove this comment
| // generateSubscriptions returns a list of subscriptions from the configured subscriptions feature |
gbjk
left a comment
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.
All good, Thanks and Great work π
thrasher-
left a comment
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.
Last two changes and then this LGTG, thanks for addressing the feedback!
cmd/exchange_template/rest.tmpl
Outdated
| "github.com/thrasher-corp/gocryptotrader/exchanges/request" | ||
| ) | ||
|
|
||
| // Exchange implements exchange.IBotExchange and contains additional specific api methods for interacting with {{.CapitalName}} |
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.
| // Exchange implements exchange.IBotExchange and contains additional specific api methods for interacting with {{.CapitalName}} | |
| // Exchange implements exchange.IBotExchange and contains additional specific API methods for interacting with {{.CapitalName}} |
| Name: testExchangeName, | ||
| REST: true, | ||
| WS: true, | ||
| WS: false, |
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.
Please expand this test to also include WS enabled as well, so we test both REST only and both enabled
thrasher-
left a comment
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 tACK, thanks!
Selam(ποΈ) be with you, team!
This PR includes minor updates to the exchange templates used for instantiating new exchanges.
Fixes # (issue)
Type of change
Please delete options that are not relevant and add an
xin[]as the 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