Creating my first API in FastAPI

Just thought this would be a good spot to introduce the first API i have built.
Its currently hosted at grid-data.co.uk.

It is quite a simple API with only a couple of endpoints at the moment, but it gives an almost live view of the UK power grid. Showing how our energy is being generated, be it via gas, nuclear or other.

This is heavily based on the work of Kate Morely and her very informative grid page. I am just exposing the raw data for people to do with as they please.

Current V1 endpoints:

/latest-five-minuteslast 5 mintes, around 10 min delay, no embedded_wind, embedded_solar, price or emissions datarate limited 5 requests a minute
/currentgives a 30 minute overviewrate limited 5 requests a minute
/by-date?date=2024-12-06Gives the entire output for a day in 30 min chunksrate limited 10 requests a minute

I think i need to rename the endpoints as current should really be the last-5-minutes.

About the returned data

This information is taken from Kate’s website.

embedded_wind:
Energy generated by wind farms. electricity generation or storage plants connected to a distribution network rather than the transmission network

embedded_solar:

Energy generated by Solar farms. electricity generation or storage plants connected to a distribution network rather than the transmission network

coal:

Energy generated by coal-fueled powerstations. The last was shutdown this year so should always be 0

ccgt:

Energy generated by Combined-Cycle Gas Turbine powerstations.

ocgt:

Energy generated by Open-Cycle Gas Turbine powerstations.

Nuclear:

Energy generated by Nuclear fueled power stations.

Oil:

Energy generated by Oil fueled power stations.

wind:

Energy generated by wind farms.

hydro:

Energy created by hydro-electric dams.

pumped:

Pumped storage systems use electricity when it is comparatively cheap to pump water from a lower reservoir into a higher reservoir. When electricity is comparatively expensive the water is released, driving turbines to produce power.

biomass:

Biomass power stations burn plant material to produce steam to drive a turbine. Great Britain’s largest power station, Drax, is a former coal-fired power station converted to burn wood pellets.

price:

Current price per MWh.

emissions:

Current emissions in g/KWh

Interconnect Data:

If the figure is a positive, the UK is importing energy, while if its negative the UK is exporting energy

ifa:

IFA (Interconnexion France–Angleterre) is a 2GW link between Sellindge in England and Bonningues-lès-Calais in France. It entered service in 1986.

moyle:

Moyle is a 0.5GW link between Auchencrosh in Scotland and Ballycronan More in Northern Ireland. It entered service in 2001.

britned:

BritNed is a 1GW link between the Isle of Grain in England and Maasvlakte in the Netherlands. It entered service in 2011.

ewic:

EWIC (the East–West Interconnector) is a 0.5GW link between Shotton in Wales and Rush North Beach in the Republic of Ireland. It entered service in 2012.

nemo:

Nemo Link is a 1GW link between Richborough in England and Zeebrugge in Belgium. It entered service in 2019.

ifa2:

IFA-2 (Interconnexion France–Angleterre 2) is a 1GW link between Warsash in England and Tourbe in France. It entered service in 2021.

nsl:

NSL (the North Sea Link) is a 1.4GW link between Blyth in England and Kvilldal in Norway. It entered service in 2021.

eleclink:

ElecLink is a 1GW link between Folkestone in England and Peuplingues in France, running through the Channel Tunnel. It entered service in 2022.

viking:

Viking Link is a 1.4GW link between Bicker Fen in England and Revsing in Denmark. It entered service in 2023.

greenlink:

Greenlink is a 0.5GW link between Freshwater West in Wales and Baginbun Beach in the Republic of Ireland. It entered service in 2024.