3 min read

🐍 Coinbase Advanced Trade API Python Wrapper

GitHub - rhettre/coinbase-advancedtrade-python
Contribute to rhettre/coinbase-advancedtrade-python development by creating an account on GitHub.

pip install coinbase-advancedtrade-python

Background

I've bought Bitcoin everyday for about 4 years now - something that wouldn't have been practical without cryptocurrency exchange APIs

Back in 2019, I started with a web based solution called CoinDCA (that has since shut down 💀) and the Coinbase Pro API (which is also now dead ðŸŠĶ)

I also messed around with the Gemini API which was one of the best APIs I've ever used from a user experience perspective

Unfortunately in 2022, Gemini raised their fees including a really hard to swallow withdrawal fee that makes weekly withdrawals pretty costly.

If you want to understand why weekly withdrawals are important, check out this case study

Moving on from Gemini I did some analysis on what the cheapest way to acquire more Bitcoin on a regular basis would be

Spoiler alert, the answers for me were Strike (duh) and Coinbase (shocking the audience)

But Rhett, Coinbase has really high fees! The impartial people who make charts told me so!

Impartial chart that is not deceptive

Coinbase does have really high fees if you buy on the mobile app, but now that Coinbase has merged Coinbase Pro into Coinbase.com as Advanced Trade, you can enjoy Coinbase Pro's old fee structure using the Coinbase UI and API.

But this transition hasn't been all sunshine and rainbows...

Problem

The problem with Coinbase Advanced Trade was that it took me forever to figure out how to use.

Back in the day if you were not great at programming (me) you could just go to GitHub and find a Python wrapper for Coinbase Pro

The one that was super popular that I used for videos was made by Dan Paquin.

Dan's Coinbase Pro wrapper helped a lot of people, and at the time of making my Coinbase Advanced Trade update video I didn't see an equivalent for new programmers

So I made one

Solution

The only problem at this point was that I'm still not great at programming.

The good news is, with ChatGPT 4 you don't really need to be anymore.

After feeding the entire Coinbase Advanced Trade API documentation into GPT 4 and making some tweaks based on the structure of Dan's Coinbase Pro wrapper, this is what I ended up with:

GitHub - rhettre/coinbase-advancedtrade-python
Contribute to rhettre/coinbase-advancedtrade-python development by creating an account on GitHub.

The Unofficial Coinbase Advanced Trade Python Wrapper

The code is still in alpha and I'm sure that things could be improved from here especially given how heavily I leaned on GPT4.

What's Next?

Now that we have a base to work off of, next I plan to build out some of the functions that we used back in the glory days of the Gemini API

Fear and greed index, MVRV DCA, CM Williams indicator, Invest Answers's DCA and more

Thanks to everyone who has helped with the scripts so far including the Coinbase engineers and product people who have helped out on Twitter.

Feel free to submit pull requests or email (rhett@rhett.blog) or dm me feedback over on Twitter and I'll try to get everything incorporated so that this repo can help people the same way Dan's did.

Companion Video: