-
Notifications
You must be signed in to change notification settings - Fork 317
Normalize PublicClient with AuthenticatedClient #178
Normalize PublicClient with AuthenticatedClient #178
Conversation
PublicClient should no longer keep state about a particular product ID.
- Deprecate old usage of a default productID per PublicClient - Remove redundant AuthenticatedClient#getProductOrderBook() override Closes coinbase#46 - Simplify OrderbookSync#loadOrderbook()
- Deprecate old usage of a default productID per PublicClient
- Deprecate old usage of a default productID per PublicClient
- Deprecate old usage of a default productID per PublicClient
- Deprecate old usage of a default productID per PublicClient
- Deprecate old usage of a default productID per PublicClient
Awesome PR, thanks a lot! Regarding npm releases: How do you feel about doing 1.0 beta releases? |
@fb55 For this project (and almost all open source projects), I'm always going to advocate for more frequent minor releases vs one large major release drop. Here, this means at least an official v0.5 (back) release and a v0.6 release prior to going to v1.0. Reasons:
In summary, an official Also, with all that said, even with this PR's normalization of
Another concrete example: // Existing API signature (positional arguments make things unnecessarily messy)
const ob = new OrderBookSync(['BTC-USD'], 'https://api.gdax.com', 'wss://ws-feed.gdax.com', { key, secret, passphrase })
// Future potential API signature (far superior with keyword arguments)
const productIDs = ['BTC-USD'];
const auth = { key, secret, passphrase };
const ob = new OrderBookSync({ productIDs, auth }); // order doesn't matter, no duplicate defaults Perhaps, keyword arguments need to wait until a v2.0 release, BUT these are the kinds of considerations that make more-frequent releases more important, because they allow the community to keep up with rapid development and change. Allow for change and prepare for change, but don't hold too tightly to backwards compatibility forever. Forwards compatibility is the more interesting and beneficial design paradigm. |
Thanks @rmm5t! |
It seems that #362 solves the issues that @rmm5t mentioned
|
What does it do?
productID
argument inPublicClient
constructorproductID
as first argument togetProductOrderBook()
and deprecates old usage signatureAuthenticatedClient#getProductOrderBook()
overrideOrderbookSync#loadOrderbook()
because both clients now adhere to the same method signatureproductID
as first argument togetProductTicker()
and deprecates old usage signatureproductID
as first argument togetProductTrades()
and deprecates old usage signatureproductID
as first argument togetProductTradeStream()
and deprecates old usage signatureproductID
as first argument togetProductHistoricRates()
and deprecates old usage signatureproductID
as first argument togetProduct24HrStats()
and deprecates old usage signaturePublicClient
to later simplify the eventual transition of outright removing the (now unnecessary)PublicClient#productID
property.README
documentation to matchWhat else do you need to know?
PublicClient
should no longer maintain state about a particular product ID.PublicClient
instance can now also be called on anAuthenticatedClient
instance. In other words, the classes now correctly adhere to the specification in theREADME
:Related Issues and PRs
Communication
Because this is a fairly large PR, I recommend code-reviewing the changes for each commit individually instead of reviewing the entire PR at once. It's likely easier to digest that way.
I think it would be prudent to make an interim v0.x release with these changes, thereby documenting and committing to all the deprecations. That would allow for a full cleanup during an eventual v1.0 release where the old method signatures and deprecations are removed, and the new method signature win-out.
/cc @fb55