A small service that is responsible for retrieving current rates by following pairs BTC/EUR, BTC/USD, BTC/GBP, ETH/EUR, ETH/USD, ETH/GBP and saving data to an SQL database every 5 minutes.
This was built with Google Cloud services: Functions, Cloud SQL and Cloud Scheduler.
- Node: any 10.x version
- NPM
- GCP account
- Gcloud CLI - make sure this is setup with your project
npm i
to install dependenciesnpm run create-db
to create an postgres instance on Cloud SQLnpm run deploy-saveLatestRates && npm run deploy-getRates
to deploy the functions- Create a .env.yml in the root directory for env variables: SQL_USER, SQL_PASSWORD, SQL_DB, INSTANCE_CONNECTION_NAME
- You will find this info from GCP console
- Create a table in the DB with:
CREATE TABLE rates (ID UUID PRIMARY KEY, CREATED_AT TIMESTAMP, BTC_USD FLOAT, BTC_EUR FLOAT, BTC_GBP FLOAT, ETH_USD FLOAT, ETH_EUR FLOAT, ETH_GBP FLOAT);
- Setup cloud scheduler to trigger saveLatestRates via http
๐งจ