This is an open-source project which you can use to spread your investment in Bitcoin over a period of time. Make automated purchases of Bitcoin daily, weekly, or monthly!
Dollar cost averaging (DCA) is an investment strategy that aims to reduce the impact of volatility on large purchases of financial assets such as equities. By dividing the total sum to be invested in the market (e.g., ₦100,000) into equal amounts put into the market at regular intervals (e.g., ₦1,000 per week over 100 weeks), DCA seeks to reduce the risk of incurring a substantial loss resulting from investing the entire lump sum just before a fall in the market.
- A BuyCoins account, with access to the API (see below)
- A Heroku account
- A Fauna DB account
- Basic knwoledge of how to use these tools
You'll need access to the BuyCoins API in order to make automatic purchases. To apply for access, send an email to support@buycoins.africa with the email address attached to your BuyCoins and a link to this project.
Once you have access, go to your API Settings page. Generate and copy your public and secret keys. These keys will be used as the BUYCOINS_API_PUBLIC
and BUYCOINS_API_SECRET
environment variables on Heroku.
Sign up for an account with Fauna DB and create a database (you can name it anything you want).
Under your database security settings, create a new Key with the admin role and copy your generated secret key. This key will be used as the FAUNA_DB_SECRET
environment variable on Heroku.
Next, you'll need to specify how often you want to buy Bitcoin, and how much you want to spend on each purchase. You do this by setting the following environment variables:
BUY_FREQUENCY
DAILY
- if you want to buy every day- WEEKLY_[1-7] - if you want to buy once a week. e.g.
WEEKLY_1
to buy every Monday - MONTHLY_[1-29] - if you want to buy once a month. e.g.
MONTHLY_5
to buy on the 5th day of each month
BUY_AMOUNT
The amount (in Naira) you want to purchase at each frequency.
When deploying, you'll need to add the environment variables from the previous steps to your new app.
Finally, go to your Heroku project "Resources" tab and click the Heroku Scheduler Add-on.
Next, create a new job using the following settings:
- Schedule:
Every day at..
(any time of your choosing) - Run Command:
recurringBuy
Note: Make sure the job is set to run every day, regardless of your BUY_FREQUENCY
.
If you want to get updates on this project as we continue to improve it, you'll need to create a fork of this repository to your Github account.
Once you've done that, setup deployments to your Heroku application from your forked project.