- Ingests EIA petroleum Excel datasets and sample wholesale/inventory/weather CSVs
- Appends live EIA API updates without duplicates
- Runs SARIMA forecasts (30/60/90 day) with MAPE, RMSE, and directional-accuracy metrics
- Computes market regime, seasonal patterns, wholesale-vs-cost-basis spread strategy, and weather correlation
- Generates active price/spread/regime alerts
- Exports an executive
.docxreport, API-style JSON payloads, and an LLM context file
data/eia/- EIA public Excel files (input)data/sample/- synthetic wholesale, inventory cost basis, and weather CSVs for demo reproducibilitydata/processed/- normalized long-format outputs (date, product, value, source)data/traffic/raw/- CDOT public corridor pullsdata/traffic/processed/- normalized corridor traffic paneloutput/forecasts/- model JSON outputsoutput/alerts/active_alerts.json- current alert stateoutput/reports/analysis_snapshot.json- analysis summary
Note on sample data. Files under
data/sample/are programmatically generated with a fixed random seed (see repo history) and do not reflect any real market or client data. They exist so the pipeline can be run end-to-end out of the box.
python -m pip install -r requirements.txtFor live EIA API updates, create .env:
EIA_API_KEY=your_eia_api_keyA free key is available at https://www.eia.gov/opendata/.
Ingest local files:
python run_ingest.py --all
python run_ingest.py --source spot_prices
python run_ingest.py --source traffic_cdotUpdate from EIA API:
python run_ingest.py --api-update
python run_ingest.py --api-update --force-apiRun forecasts:
python run_pipeline.py --all
python run_pipeline.py --product heating_oil --horizon 90Export reports / JSON / LLM context:
python export_reports.py --format docx --period monthly
python export_reports.py --skip-docxForecast JSON:
productgenerated_athorizon_daysforecast[](date,point,ci_80_low,ci_80_high,ci_95_low,ci_95_high)metrics(mae,rmse,mape,directional_accuracy,naive_mape)
Analysis snapshot:
- market regime
- seasonal outlook
- pricing strategy recommendation (
index_plusorcost_plus) - weather correlation summary
- alert counts
python -m pytest tests -qMIT - see LICENSE.
petrostack is built by Jacob Johnston / True North Data Strategies LLC as an operator-grade petroleum market intelligence reference.
