Skip to content

Repository files navigation

NZ Carbon Market Tracker

A Python tool that tracks and analyses the New Zealand carbon market, correlating NZU carbon spot prices with the Salt (CO2) listed investment trust share price.

Featured in Carbon News.

What it does

  • Polls live carbon spot prices and Salt share prices every 5 minutes via headless Selenium scraping
  • Stores prices and auction events in a MySQL database
  • Estimates Salt price movements based on carbon price changes (two models)
  • Plots historical relationships between carbon price, Salt share price, NZX50, and auction dates

Architecture

Scrapers (api/)
  ├── headless_getters.py  — Selenium: carbon spot price, Salt share price, NTA, auction dates
  └── web_requests.py      — requests/BeautifulSoup: Carbon News RSS feed

main.py          — polling loop (5 min interval)
calculations.py  — Salt price estimation models
db_connect.py    — MySQL stored procedure wrappers
data_helpers.py  — date utilities, price parsing
reporting.py     — matplotlib charts

Historical backfill
  ├── historical_carbon_prices.py  — loads CSV from theecanmole/nzu
  ├── historical_salt_prices.py    — manual data from Sharesies network tab
  ├── historical_nzx.py            — NZX50 historical prices
  └── historical_auctions.py       — scrapes ETS auction noticeboard

Setup

Prerequisites: Python 3, MySQL, geckodriver

pip install -r requirements.txt

Create a password.py in the project root:

def getPassword():
    return "your_mysql_password"

Update the geckodriver path in api/headless_getters.py:

gecko_driver = '/path/to/geckodriver'

Run the polling loop:

python main.py

Data sources

Data Source
Carbon spot price (live) commtrade.co.nz via Selenium
Carbon spot price (daily) carbonnews.co.nz RSS feed
Carbon historical theecanmole/nzu
Salt share price nzx.com/instruments/CO2 via Selenium
Salt historical Sharesies network tab (manual export)
Auction dates etsauctions.govt.nz via Selenium

Notes

The MySQL database and password.py are not included in this repo. The scrapers and historical data files are fully standalone — anyone can run the backfill scripts and wire up their own database.

About

tracking the various prices of the nz ETS - front end only

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages