Skip to content

This project is a Python-based financial data analysis tool that integrates stock market data, inflation metrics, and statistical modeling to provide insights into asset returns adjusted for inflation.

Notifications You must be signed in to change notification settings

blkpvnthr/reversal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

CPI Inflation Calculation & Stock Market Analysis

This project fetches Consumer Price Index (CPI) data from the FRED API, processes it, and compares it to stock market data obtained from Yahoo Finance. The script then utilizes feature engineering to output a Statistical Summary and Perform Regression Analysis on your downloaded csv stock data. Then plots key metrics for better analysis comprehension.

📦 Dependencies

Install the required Python packages:

pip install -r requirements.txt

🔑 Configuration

Set up your API key in a config.ini file:

[API]
FRED_API_KEY = your_fred_api_key_here

Or set it as an environment variable:

export FRED_API_KEY=your_fred_api_key_here

🛠 How to Run

Run the script with:

python ok.py

📊 Visualization Output

The script generates multiple plots:

  1. CPI Data with Different Fill Methods (Original, Backward Fill, Forward Fill, Linear Interpolation)
  2. Realized Volatility of Inflation & Stock Data
  3. Stock Returns Distribution
  4. Stock vs. Market Regression Analysis

⚠️ Error Handling

If you encounter errors:

  1. Ensure your FRED_API_KEY is correct and active.
  2. Check if the FRED API is online.
  3. Verify that Yahoo Finance (yfinance) is returning data correctly.
  4. Inspect missing values and ensure correct data preprocessing.

📜 License

This project is open-source and free to use.


📩 Need Help? Feel free to reach out or open an issue!

About

This project is a Python-based financial data analysis tool that integrates stock market data, inflation metrics, and statistical modeling to provide insights into asset returns adjusted for inflation.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages