What domestic assets are most useful to US individual investors to hedge against inflation?
Our analysis aims to calculate the β coefficient for various asset classes to evaluate their performance as inflation hedges. This involves regression analysis where the asset returns are regressed against inflation rates to understand the extent of their correlation and to quantify the hedging capability of each asset class.
Go to walkthrough for our results.
-
API keys: Most data sources require API keys. Store these keys securely using environment variables. We use the
dotenv
approach for this. Please go to https://data.nasdaq.com/sign-up and https://data.bls.gov/registrationEngine/ to register for access to both APIs.- Rename
.env.example
to.env
. - Fill in the required API keys or configurations.
- The application will load these keys automatically.
- Rename
-
Run the application with Docker:
- Our application is Docker enabled, run the application in the terminal:
docker-compose up
- Copy and paste one of the URLs from the terminal into your web browser.
- Our application is Docker enabled, run the application in the terminal:
-
Environment setup: Alternatively, if you do not wish to use Docker, you can follow the steps below to set up a virtual environment.
- Create a virtual environment:
python -m venv venv_name
- Activate the virtual environment:
- On Windows:
venv_name\Scripts\activate
- On Linux/Mac:
source venv_name/bin/activate
- On Windows:
- Install required libraries:
pip install -r requirements.txt
- Test the virtual environment:
python test_environment.py
- Create a virtual environment:
-
View results: Navigate to walkthrough in the main branch of the directory for our results.
Notebooks allow us to easily run the application in 4 stages:
- hsj-data: Retrieves datasets based on user inputs
- hsj-features: Merges inflation data with asset data and create separate merged datasets for each asset.
- hsj-models: Provides insights into how changes in inflation rates may influence the log returns of our four assets.
- hsj-visualize: Visualizes results of the regression conducted on all asset classes.
You can find Jupyter notebooks in notebooks.
├── LICENSE
├── README.md
├── data
│ ├── external <- Data from third party sources.
│ ├── interim <- Intermediate data that has been transformed.
│ ├── processed <- The final, canonical data sets for modeling.
│ └── raw <- The original, immutable data dump.
|
├── models <- Model summaries.
│
├── notebooks <- Jupyter notebooks (working files).
│
├── reports <- Generated analysis as LaTeX.
│
├── requirements.txt <- The requirements file for reproducing the analysis environment.
│
├── src <- Source code for use in this project.
│ ├── __init__.py <- Makes src a Python module.
│ │
│ ├── data <- Scripts to download or generate data.
│ │ └── load_data.py
│ │ └── make_dataset.py
│ │ └── process_data.py
│ │ └── user_input.py
│ │
│ ├── features <- Scripts to turn raw data into features for modeling.
│ │ └── build_features.py
│ │
│ ├── models <- Scripts to run model.
│ │ ├── regression_model.py
│ │ └── run_regression.py
│ │
│ └── visualization <- Scripts to create exploratory and results oriented visualizations.
│ └── visualize.py
│
└── tox.ini <- tox file with settings for running tox; see tox.readthedocs.io
Project based on the cookiecutter data science project template. #cookiecutterdatascience