Hi guys,
I'm using NextEnergy for a few weeks now and I was also looking for a source of the prices shown in their app. I found the website at the epexspotmarket. I didn't check every day or every hour weather the prices are identical, but it seems to be the ones. The URL is:
https://www.epexspot.com/...roduct=60&data_mode=table
Important things to know about it:
- You need to enter the delivery date and trading date
- As we are non paying webpage clients, this view only holds the data for two days in a row. So you can't scrape data from the past days.
- The day ahead spot prices are fixed at 15:00 every day, but: as non paying clients, there is a delay of 15 minutes in this information (this is not a quote! but a combination of information I found on their website which led my to this conclusion)
- So as a best practice I suggest to scrape the prices once a day after 15:15/16:00
- The resulting webpage has one table - <table data-head="20.01.23" class="table-01 table-length-1">
- You should check for the data-head Value. If your initial search parameters are wrong or out of scope, then you are forwarded to the most current dataset. This value seems to be the only good one to check on that.
- the prices are in the last/4th column, ordered in the right way (from 0-23hrs). So you can extract them easily in an array of floats
- The prices are in €/MWh, the prices in the App are €/kWh and rounded to a full Eurocent (without btw)! But as NextEnergy claims to forward the real price (+opslaag etc.), rounding up/down adds a calculation error. So it is your decision what to display and what to calculate with.
I'm a beginner programmer in Ruby on Rails. I don't have any experience with Home Assistant. But maybe my ruby scraping script helps one or the other. See an extract of my code:
[...]
# see if rake script was started with a date parameter present. If not, use tomorrows date
if args[:date].nil?
delivery_date = Date.today + 1
else
delivery_date = Date.parse(args[:date])
end
# we also need a trading date
trading_date = delivery_date - 1
#Open the webpage
url = "https://www.epexspot.com/en/market-data?market_area=NL&trading_date=#{trading_date.strftime("%Y-%m-%d")}&delivery_date=#{delivery_date.strftime("%Y-%m-%d")}&modality=Auction&sub_modality=DayAhead&product=60&data_mode=table"
html = URI.open(url)
#retreive the table
table = Nokogiri::HTML(html).at('.table-01')
#retrieve the last column, add to Array. Then recalculate prices into €/kWh. Round to 0,0000# digits
prices_hash = table.css('td:nth-child(4)').map(&:text).map(&:to_f)
prices_hash.map!{ |x| (x / 1000).round(4) }
[...]
# write result to database
[...]
# ToDo - add routine to check on date in the result table. Add routine to check on HTTP 200 status or similar mistakes and abort script. Add routine to only allow unique datasets (one per delivery date)
[...]
Considering gas prices: I didn't look for the spot prices on
https://www.eex.com. So I don't have any information about that.
enjoy, Jörg