knowm / XChange

XChange is a Java library providing a streamlined API for interacting with 60+ Bitcoin and Altcoin exchanges providing a consistent interface for trading and accessing market data.
http://knowm.org/open-source/xchange/
MIT License
3.84k stars 1.94k forks source link

Coinbase Pro api sunsetting #4514

Closed nibarulabs closed 1 year ago

nibarulabs commented 2 years ago

The Pro features will be moving to Advanced Trade.

https://blog.coinbase.com/hello-advanced-trade-goodbye-coinbase-pro-5b0715b03ef0

Our product uses Pro and we'll need to do some work to make sure that the regular Coinbase adapter works with Advanced Trade. I'm taking a quick look through their updated api docs.

One thing I don't see in the updated (current) docs - https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getaccounts - is any websocket info (I guess it says Rest Api at the top, so I'm assuming some ws section will appear later?).

There is ws info on the guides page - https://docs.cloud.coinbase.com/exchange/docs/websocket-overview - so maybe it'll all just magically work with existing Pro code.

We have a decent amount of Coinbase Pro users, so we will have to have an updated working adapter. I'll probably take this on in September'ish, which should be plenty of time before end of year. I anticipate the update shouldn't take too long - weeks? days?

I think this will probably figure itself out, but we have a few things to resolve:

If anyone starts work on this before then, can you reference this issue just to keep things in some order? I'll update comments and the PR code when it's ready.

Comments/thoughts welcomed.

Eddman commented 1 year ago

Any news on this one? Some account are already being disabled on CoinbasePro and users forces to use the new AdvanceTrading.

nibarulabs commented 1 year ago

Hello, I am starting to take a look at this today. Not sure how long it will take. I'll post updates as I have them.

nibarulabs commented 1 year ago

Update. I went through all the existing CB Pro code and the docs for the new Advanced api.

Good news is Coinbase cleaned a lot of things up; the old api was a little rickety. And I can definitely do all the work (I'm capable) and I just started a new module for Advanced.

Bad (sorta) news. I don't think any/much of the old Pro module code is reusable. I'll take what is though. Again, it's not a difficult project, just time. If I was working on this full time, I could prob knock it out in 2 weeks or less. However, since we're in free contribution and day job time :) it'll take longer.

There's an opportunity to test more and I'll have a lot more testing in than Pro had. I also have a product that will be able to test the library so once the code is in a good spot, I will start interfacing and testing in the real world.

Oh, and this is just the exchange code, I know the stream code has to be done (my product will need that as well) and I'm not sure how long that will take. I will prob do the stream code in another PR. I'll update as needed :+1: .

nibarulabs commented 1 year ago

@earce or @timmolter maybe you guys have some input here.

Looks like going forward for Coinbase Advanced, the old Coinbase Pro endpoints have been split between Advanced and Sign In With Coinbase (see here: https://docs.cloud.coinbase.com/advanced-trade-api/docs/rest-api-pro-mapping ).

At the start of this I was thinking I could just code the Pro analogs for Advanced but doesn't look that way. For my product that uses Pro, I would need to use Advanced and SIWC to get the same functionality Pro had. So I will have to split up my internals between the two (rolls eyes).

If this sounds right (I think it is), then the new Advanced code will only implement the Advanced endpoints. It will be up to downstream app owners to make the adjustments for future Pro equivalent functionality (like I mentioned above).

So to be clear, Advanced will have less endpoints than the old Pro module and app developers will need to adapt their Pro code to use Advanced and SIWC.

I haven't looked yet on what effect(s) this will have on the streaming side.

I'm just throwing this out there as a check. Thoughts? Thanks.

timmolter commented 1 year ago

I'd say leave the coinbase-pro module how it is and add a completely new one called coinbase-advanced, and implement the API there as much as you can. Then later when coinbase-pro really gets shuts off, we can delete that module.

nibarulabs commented 1 year ago

Yah, I already figured coinbase-pro would need to exist as is and have been creating a new advanced module.

Sounds good, thanks for the quick reply. That lines up with what I was thinking.

Eddman commented 1 year ago

Isn't the Advanced API just the unimplemented part of xchange-coinbase module? I thought that Advanced API just adds trading API using the new v3 endpoints to standard Coinbase v2 API....so I'd expect to just implement all unimplemented methods in this module.

nibarulabs commented 1 year ago

Advanced has a completely different set of uri endpoints. I looked for other examples in this repo to see if any other modules were using two different ssl url properties and none were - I was thinking if so, I'd just add it to the coinbase module.

nibarulabs commented 1 year ago

@Eddman Ok, you're right. The xchange-coinbase module has the ssl uri https://coinbase.com. For the Advanced functionality to be folded in, that uri would have to change to https://api.coinbase.com. The Coinbase interface paths would all need to be updated as well.

Currently the path for the Coinbase uri is set to api/v1 and it will need to be removed and each annotation would need to include api/v2 for the existing endpoints, api/v3 for advanced endpoints. I'll look through the docs to make sure that the existing endpoints are valid.

Thanks for pointing that out. This will obviously make things cleaner and less time to implement.

nibarulabs commented 1 year ago

Providing an update here.

I'm putting my effort here on pause since my work is blocked by Coinbase. I was working through fetching the candles for a pair. They have this endpoint now behind an auth wall (ok, np) and while I can make requests to other authenticated endpoints, fetching candles always responds with unauthorized 401. My api credentials are correct and I even repeated the issue with some Node code.

A co-worker got their support on the phone and we raised the issue. It got filed as we're looking into it. I went on the forums and again, no solution - I couldn't get anyone from their support to respond.

At this point my takeaway is the advanced api is not ready for prime time. Seems like there are a significant amount of others reporting basic problems in the forums. Coinbase announced this venture last year. My experience working on development teams is we wouldn't announce a major service sunset without at least being in beta.

I'm just leaving this here for someone that might pick this up later. I don't have anything worthwhile to commit and I'll just leave things as is. Cheers.