This is a script that fetches transactions from the Whale Alert API on a regular basis and adds any new transactions to your own database. This could be useful if you're looking to perform data analyses on large transactions, but need to gather the data first.
The following steps should cover (almost) everything you need to get it running. Get in touch if you are stuck.
Head over to Whale Alert and create a free account. The free plan is sufficient for this script. Create an API key from your account and use this as WHALEALERT_API_KEY
in the step Environment Variables below.
Set up a PostgreSQL database (following these instructions, for example). Use the credentials for this in the next step (PG_WHALEALERT_*
).
Create a database named whalealert
and a user named whalealert
.
Add the following lines (replace the xxx
s) to your ~/.bashrc
:
export PG_WHALEALERT_HOST=xxxxxxxx
export PG_WHALEALERT_PORT=xxxxxxxx
export PG_WHALEALERT_PASSWORD=xxxxxxxx
export WHALEALERT_API_KEY=xxxxxxxx
Create a virtual environment for this repo. If you use Anaconda, type the following:
conda create -y -n whalealert --file requirements.txt
Activate the environment and start the script:
conda activate whalealert
python fetch_transactions.py
If you are running this on a server, use Screen. This allows you to leave terminal screens running in the background, and return to them when necessary (e.g. if you want to kill the process with Ctrl+C
).
Create a Screen for this process before starting the script:
screen -S whalealert
conda activate whalealert
python fetch_transactions.py
Then press Ctrl+A Ctrl+D
to detach from this screen and leave it running in the background.
Should you want to return to this screen, type:
screen -r whalealert
Feel free to open a merge request if you have made improvements to the script.