Skip to content

KalonGoon/energy-procurement-engine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

⚡ Energy Procurement Decision Engine

Python tool that analyzes WTI Crude Oil and Henry Hub Natural Gas prices to tell procurement teams whether to lock in prices now or wait — powered by real FRED economic data.


📌 Project Summary

Energy costs are one of the biggest variables in procurement budgets for manufacturers, airlines, logistics firms, and utilities. Buying too early locks in high prices. Waiting too long means prices spike before you act.

This engine answers one question: should you lock in today or wait?

It pulls 25 years of real oil and gas price data, computes where today's price sits historically, analyzes momentum, and outputs a BUY / WAIT / WATCH recommendation with a confidence score and plain-English reasoning.

Key outputs:

  • 🟢 BUY — price is historically low and/or rising fast. Lock in now.
  • 🔴 WAIT — price is historically high and/or trending down. Hold off.
  • 🟡 WATCH — mixed signals. Monitor closely before committing.

📊 Sample Output

============================================================
  ENERGY PROCUREMENT DECISION ENGINE
  April 28, 2026
============================================================

  WTI CRUDE OIL
  Current Price  : $72.14
  1yr Percentile : 38.2th
  30d Momentum   : +4.1%
  Decision       : BUY
  Confidence     : 70%
  Reason         : 🟢 LOCK IN — price is in the 38th percentile vs
                   last year (historically cheap); 30-day momentum
                   +4.1% (rising fast — lock in before higher);
                   also cheap vs 3-year history (29th pct).

  HENRY HUB NATURAL GAS
  Current Price  : $2.43
  1yr Percentile : 91.8th
  30d Momentum   : -0.4%
  Decision       : WAIT
  Confidence     : 85%
  Reason         : 🔴 HOLD OFF — price is in the 92nd percentile vs
                   last year (historically expensive); momentum flat.
============================================================

Dashboard


🛠️ How It Works

Step 1 — Data

Pulls daily price data from the FRED API (Federal Reserve Economic Data):

  • DCOILWTICO — WTI Crude Oil spot price ($/barrel)
  • DHHNGSP — Henry Hub Natural Gas spot price ($/MMBtu)

Step 2 — Feature Engineering

For each commodity, computes:

  • 30, 90, and 365-day moving averages
  • 30 and 90-day rolling volatility
  • 30 and 90-day price momentum
  • 1-year and 3-year historical percentile — where does today's price rank vs history?

Step 3 — Scoring Model

Each factor contributes to a score:

Signal Score
Price in bottom 25th percentile (1yr) +3
Price in bottom 25th percentile (3yr) +2
Strong upward momentum (>5%) +2
Price in top 75th percentile (1yr) -3
Price in top 75th percentile (3yr) -2
High volatility (reduces risk of waiting) +1

Score ≥ 3 → BUY | Score ≤ -2 → WAIT | Otherwise → WATCH

Step 4 — Dashboard

Generates a visual showing:

  • 5-year price history with 90-day moving average
  • 1-year percentile chart with buy/wait zones highlighted
  • Recommendation box with price, decision, confidence, and reasoning

🚀 Getting Started

1. Install dependencies

pip install -r requirements.txt

2. Get a free FRED API key

  • Go to fred.stlouisfed.org
  • Create a free account → My Account → API Keys → Request API Key

3. Add your API key

# In energy_procurement_engine.py
FRED_API_KEY = 'your_key_here'
USE_LIVE_API  = True

4. Run it

python energy_procurement_engine.py

🗂️ Repository Structure

energy-procurement-engine/
│
├── README.md
├── requirements.txt
├── energy_procurement_engine.py   # Main engine
└── energy_dashboard.png           # Sample output dashboard

🛠️ Tools & Skills Used

Tool Purpose
Python Core language
pandas + numpy Data manipulation and feature engineering
FRED API Real economic price data
matplotlib Dashboard visualization
scipy.stats Percentile calculations

Concepts demonstrated:

  • Time series feature engineering (rolling stats, momentum, percentiles)
  • Rule-based scoring model for procurement decisions
  • Real API data integration (FRED)
  • Multi-panel data visualization with custom dark theme

💼 Business Use Cases

  • Manufacturers — lock in steel, aluminum, or fuel costs at optimal times
  • Airlines — jet fuel procurement timing
  • Logistics firms — diesel cost hedging decisions
  • Energy utilities — natural gas supply contract timing

Built as part of a data science portfolio focused on finance and procurement analytics. Uses FRED public data — no proprietary data involved.

About

Python engine that analyzes 25 years of WTI oil and Henry Hub gas prices to output BUY/WAIT/WATCH procurement recommendations using FRED API data.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages