Welcome to the Mortgage Trading Analysis and Prediction project! This repository contains the code and resources for a comprehensive case study on mortgage trading, designed to help you understand the financial system, sharpen your data modeling, DAX, and financial analysis skills, and experience the dynamic environment of a mortgage trading desk.
As a newly hired junior trader on a trading desk for a mortgage originator, you will:
- Identify a population of mortgages to trade.
- Evaluate each mortgage and each bid received from prospective buyers.
- Execute trades based on your analysis.
This project aims to provide a unique perspective on the banking industry and improve your technical skills in data modeling, DAX, and financial analysis.
The repository is organized as follows:
data/
: Contains the dataset used for analysis and prediction.notebooks/
: Jupyter notebooks with step-by-step analysis and modeling.scripts/
: Python scripts for data preprocessing, modeling, and evaluation.reports/
: Generated reports and visualizations.README.md
: This readme file.
The dataset used in this project is a synthetic mortgage dataset. It includes information on mortgage loans and their performance, such as loan amounts, interest rates, borrower credit scores, loan-to-value ratios, remaining terms, and whether the loan has defaulted.
Dataset Information:
loan_id
: Unique identifier for each loanorigination_date
: Date when the loan was originatedloan_amount
: Amount of the loaninterest_rate
: Interest rate of the loancredit_score
: Borrower's credit score at the time of originationloan_to_value
: Loan-to-value ratio at the time of originationremaining_term
: Remaining term of the loan in monthsmonthly_payment
: Monthly payment amountdefault
: Indicator of whether the loan has defaulted (binary: 0 for no default, 1 for default)bid_price
: Price bid by prospective buyers (for simulation purposes)
To run the project locally, follow these steps:
-
Clone the repository:
git clone https://github.com/Technocolabs100/Mortgage-Prepayment-Analysis-and-Prediction.git cd Mortgage-Prepayment-Analysis-and-Prediction
-
Create and activate a virtual environment:
python3 -m venv venv source venv/bin/activate # On Windows, use `venv\Scripts\activate`
-
Install the required dependencies:
pip install -r requirements.txt
Run the preprocessing script to clean and prepare the data:
python scripts/preprocess_data.py
Open the Jupyter notebooks in the notebooks/
directory to perform exploratory data analysis:
jupyter notebook notebooks/eda.ipynb
Run the modeling script to train and evaluate the machine learning models:
python scripts/train_model.py
To explore the interactive dashboard, use a BI tool like Power BI or Tableau and connect it to the processed data. The dashboard will help you visualize the mortgage portfolio, bids, and analysis results.
Generate reports and visualizations using the notebooks and scripts provided. The reports will summarize the trading activity, including the mortgages traded, bids received, and financial outcomes.
Contributions are welcome! Please fork the repository and create a pull request with your changes.
This project is licensed under the MIT License. See the LICENSE
file for details.
For questions or feedback, please contact technocollabs@gmail.com
Enjoy the fast-paced and challenging environment of a mortgage trading desk as you delve into this comprehensive case study!