Link to repo: [https://github.com/swhite24/cbpro-buy](https://github.com/swhite24/cbpro-buy)
Put this together a while back and thought it may be useful to the broader community. Basically provides a CLI (command line interface) for purchasing bitcoin from coinbase pro (can be used for any other USD pair if you so choose). The use case I had in mind at the time was a cheaper way to DCA. I’ve been running it on a scheduled interval (every night at 1:00 AM EST) in my personal AWS account using [AWS lambda](https://aws.amazon.com/lambda/) for about a month and a half at this point without issue.
A couple highlights:
– coinbase pro maker / taker fees are both 0.5% at low volume. This compares favorably to other options I considered (coinbase custodial is minimum 1.5%, swanbitcoin is minimum 0.99%, but 1.99% at my volume), not to mention the spread in the spot price you get.
– comes with example terraform for automating the scheduled execution use case
– can be used locally if you’d rather just make a one off purchase via command line instead of web UI, which came in handy during the most recent dip.
– will initiate an autodeposit for the amount to be purchased if your USD account isn’t sufficient (verified coinbase pro accounts have instant usd transfers)
– added ability to optionally “weigh” purchase amount. Basically increase the purchase amount by some factor if the current market price is less than what you’ve been paying recently to help lower cost basis. More heavily weigh your lower cost purchases.
– requires a bit of technical know how to get everything setup
– Pure DCA, no restrictions. Once setup, the purchase happens regardless of current price (I think my purchase from 4/13 or 4/14 was within 1% of current ATH).
– Comes from a random dude on the internet, but feel free to comb through the source code or fork as you please (MIT)
– add ability to auto withdraw btc balance to hardware wallet once certain threshhold is reached
– maybe look into a “max price” where the purchase won’t execute
– maybe some other stuff, not sure
More info and links are provided in the README.
As always, all of this comes with no guarantees and I am not a financial advisor and don’t invest what you wouldn’t mind losing and all that.