This repository contains various standalone Python scripts used to support the Decidere project.
| Script | Description |
|---|---|
combine_ms_data.py |
Combines Morningstar data files into a single consolidated dataset. |
compute_and_load_bx_returns.py |
Computes benchmark returns and loads them into a BigQuery table. |
export_table_to_csv.py |
Exports a BigQuery table to a CSV file in Google Cloud Storage and optionally downloads a local copy. |
Some scripts require Google Cloud setup to run successfully. For export_table_to_csv.py and compute_and_load_bx_returns.py, make sure you have:
-
Installed the necessary Google Cloud libraries:
pip install google-cloud-bigquery google-cloud-storage
-
Authenticated with Application Default Credentials (ADC):
gcloud auth application-default login
If other scripts require setup, add instructions here as needed.
Run:
python scripts/export_table_to_csv.py \
--project my-gcp-project \
--dataset my_dataset \
--table my_table \
--bucket my_bucket_name \
--blob exports/my_table.csv \
--output local_copy.csvCombines Morningstar data files into a single dataset.
Run:
python scripts/combine_ms_data.py(Modify the script if needed to point to local data files.)
Computes benchmark returns and uploads them to BigQuery.
Run:
python scripts/compute_and_load_bx_returns.py(Ensure environment is authenticated with Google Cloud if writing to BigQuery.)