Latest tarif info added

This commit is contained in:
Aart van Halteren
2022-09-15 18:51:45 +02:00
parent a55c6ba736
commit 038b02350d
2 changed files with 62 additions and 25 deletions

View File

@@ -67,7 +67,7 @@ class Entsoe
def query_day_ahead_prices(date)
start_date = date.beginning_of_day
end_date = date.end_of_day
end_date = date.end_of_day.advance(hours: -1)
# A44 - Document type => Price Document
# NL = '10YNL----------L'
@@ -79,11 +79,12 @@ class Entsoe
base_request(date, url)
end
private
def hourly_format(prices)
# in memory hash @kwh_prices is in @zone timezone
prices.to_a.map{|p| [p[0].in_time_zone(@zone).strftime("%F %H"),p[1]]}.to_h
prices.to_a.map{|p| [p[0].in_time_zone(zone).strftime("%F %H"),p[1]]}.to_h
end
# get position and amount from XML snippet
@@ -92,10 +93,10 @@ class Entsoe
# <price.amount>196.23</price.amount>
# </Point>
#
# convert price to EUR per kwh, including VAT (21%)
# convert price to EUR per kwh, excluding VAT
#
def parse_point(xml)
return xml.xpath(".//xmlns:position").text.to_i, ((xml.xpath(".//xmlns:price.amount").text.to_f/1000)*1.21).round(5)
return xml.xpath(".//xmlns:position").text.to_i, (xml.xpath(".//xmlns:price.amount").text.to_f/1000).round(5)
end
def base_request(date, url)