Finance Monitor
This is part of my suit of Financial Investments tools.
In this monorepo, everything related to ETL of the required data is handled.
- Portfolio status from a spreadsheet with my transactions.
- Stock, bonds, ETF, etc daily and backfill ingestions.
- Alpha Vantage for US market
- IOL for Argentina.
- Argentina fixed rate income from IAMC.
- ARS / USD from BCRA.
The project is run on Google Cloud Platform.
Design
financemonitor/
βββ .github/
β βββ workflows/
β βββ ci.yml
βββ data_pipelines/
β βββ stocks/
β β βββ orchestrator/
β β β βββ stocks_dag.py
β β βββ services/
β β β βββ alphavantage_extractor/ # Service 1: API -> GCS
β β β β βββ main.py
β β β β βββ Dockerfile
β β β β βββ tests/
β β β β βββ test_main.py
β β β βββ iol_extractor/ # Service 2: API -> GCS
β β β β βββ main.py
β β β β βββ Dockerfile
β β β β βββ tests/
β β β β βββ test_main.py
β β β βββ stock_loader/ # Service 3: GCS -> BQ
β β β βββ main.py
β β β βββ Dockerfile
β β β βββ tests/
β β β βββ test_main.py
β β βββ bq_schemas/
β β βββ stocks.json
β βββ bonds/
β β βββ orchestrator/
β β β βββ bonds_dag.py
β β βββ services/
β β β βββ lecaps_extractor/ # Service 1: Scrape -> GCS
β β β β βββ main.py
β β β β βββ Dockerfile
β β β β βββ tests/
β β β β βββ test_main.py
β β β βββ bond_loader/ # Service 2: GCS -> BQ
β β β βββ main.py
β β β βββ Dockerfile
β β β βββ tests/
β β β βββ test_main.py
β β βββ bq_schemas/
β β βββ lecaps.json
β βββ ... (and so on for other data domains)
βββ packages/ # Shared, reusable code
β βββ financemonitor_helpers/
β βββ __init__.py
β βββ bigquery_client.py # BQ helper functions
β βββ gcs_client.py # GCS helper functions (new!)
βββ terraform/
βββ gcp_project/
β βββ main.tf
β βββ variables.tf
βββ services/
βββ cloud_run.tf
βββ bq.tf
βββ main.tf
βββ modules/
βββ main.tf
Backlog
- Migrate the AlphaVantage client.
It should be separated in two, the client code and the runner. The runner should be on the cloud run job and call the client (a package).- ~~The runner should also write into GCS the output. ~~
Call BQ from the runner, to retrieve the list of stocks to use.Read from GCS and write into BQ.- Write tests for this job.
- Add the DAG into orchestrator/stocks_dag.py and try it on Cloud Composer.
- Add transactions into the porfolio.
- Use the new BQ schemas.
- Read the transactions log from google sheets.
- Populate assets not in dim_asset using the transactionβs data.
- Create a new LookerStudio dashboard.
- Migrate the LECAPβ scraper.
- Lecap scraper should skip corrupted rows, not fail the whole process.
- Add/migrate the IOL code.
- Expose endpoints for the Portfolio API to query on demand values. This could be a Cloud Function.
- Consider integrating yfinance to work aroung the AV daily limit.
- Configure the timezone with an ENV var.
Technologies
- Google Cloud Platform (GCP)
- Python
- Flask
- Cloud Run
- Terraform
- Cloud Workflows
- Bigquery
- Cloud Storage
- Airflow 3