David-Woroniuk / Historic_Crypto

An open source Python library for scraping Historical Cryptocurrency data.
MIT License
90 stars 30 forks source link

Coinbase pro is depreciated. #27

Open sentientmachine opened 2 weeks ago

sentientmachine commented 2 weeks ago

Your code has been working fine since about 2 days ago since they depreciated coinbase pro authentication system and forced a v2 or greater.

Line 121 in HistoricalData.py

Produces:

Ticker 'ETH-USD' found at the CoinBase Pro API, continuing to extraction.
Provisional Start: 2021-12-25T00:00:00
Provisional End: 2022-10-21T00:00:00
<Response [503]>
b'{"message":"Coinbase Pro API is deprecated."}'
Status Code: 503, error in connecting to the CoinBase Pro API.

I checked the key and secret connectivity and it's not letting me do a pythonic requests.get()

First off, we have to change all your: https://api.pro.coinbase.com/...

to: https://api.coinbase.com/v2/...

Now the error is:

Status Code: 404, malformed request to the CoinBase Pro API.

Which means they're basically forcing JWT (json web token authentication) on your pythonic requests.get()'s

https://docs.cdp.coinbase.com/coinbase-app/docs/api-key-authentication

angry noises.

You're gonna have to nest this and do the steps on using api_key_name and secret to generate a JWT, https://github.com/coinbase/coinbase-advanced-py

And the include it as the Bearer $JWT of each of your requests. I need this working yesterday, so set hacking to true.

aus-jezza commented 1 week ago

Thanks @sentientmachine for raising, I faced the same issue and was using this regularly. Be great to still use the HistoricalData.py Library. I am exploring the CDP API to make requests but I assume the angry noises as you have explored the same.

sentientmachine commented 4 days ago

If you can get it to work with the $keyname, $keyid, and http header "bearer: $JWT" web token authentication system, or even with the oauth2 system, which is a labrynth of headache let me know I can't seem to get it to work at all. Sus timing too because I gave their api's the old college try, but was whacked in the face too many times with: "Click here to pay us $300k to become an exchange-accredited investor, and then things go back to normal for you out of network non-believers".

It was at that point I figured out that there's a tiny perverse incentive at play here in the Crypto markets. You pay me giant volumes of money and maybe we make it super easy again: like the before fore times. The Feds have put them on notice anyway lately, they all know they're doing the same stuff sbf/madoff/nyse are doing, stealing cookies from the cookie jars under the cover of darkness, but with super-good vibes because their goal is the re-centralization of all decentralized currencies and are cooperating with the $3300 blue-suit top-hats with legacy USD counterfeiting powers.

https://fred.stlouisfed.org/series/MBM0UKM