Module: AEMO::Market Abstract
- Includes:
- HTTParty
- Defined in:
- lib/aemo/market.rb,
lib/aemo/market/interval.rb
Overview
This module is abstract.
AEMO::Market
Defined Under Namespace
Classes: Interval
Class Method Summary collapse
-
.current_dispatch(region) ⇒ Array<AEMO::Market::Interval>
Return the current dispatch dataset for a region.
-
.current_trading(region) ⇒ Array<AEMO::Market::Interval>
Description of method.
-
.historic_trading(region, year, month) ⇒ Array<AEMO::Market::Interval>
Return an array of historic trading values for a Year, Month and Region As per the historical data at www.aemo.com.au/Electricity/Data/Price-and-Demand/Aggregated-Price-and-Demand-Data-Files/Aggregated-Price-and-Demand-2011-to-2016.
-
.historic_trading_by_range(region, start, finish) ⇒ Array<AEMO::Market::Interval>
Return an array of historic trading values based on a start and finish.
Class Method Details
.current_dispatch(region) ⇒ Array<AEMO::Market::Interval>
Return the current dispatch dataset for a region
17 18 19 20 21 22 23 |
# File 'lib/aemo/market.rb', line 17 def current_dispatch(region) region = AEMO::Region.new(region) if region.is_a?(String) response = get "/mms.GRAPHS/GRAPHS/GRAPH_5#{region}1.csv" values = parse_response(response) values end |
.current_trading(region) ⇒ Array<AEMO::Market::Interval>
Description of method
29 30 31 32 33 34 35 |
# File 'lib/aemo/market.rb', line 29 def current_trading(region) region = AEMO::Region.new(region) if region.is_a?(String) response = get "/mms.GRAPHS/GRAPHS/GRAPH_30#{region}1.csv" values = parse_response(response) values end |
.historic_trading(region, year, month) ⇒ Array<AEMO::Market::Interval>
Return an array of historic trading values for a Year, Month and Region
As per the historical data at
http://www.aemo.com.au/Electricity/Data/Price-and-Demand/Aggregated-Price-and-Demand-Data-Files/Aggregated-Price-and-Demand-2011-to-2016
62 63 64 65 66 67 68 69 70 |
# File 'lib/aemo/market.rb', line 62 def historic_trading(region, year, month) region = AEMO::Region.new(region) if region.is_a?(String) month = sprintf('%02d', month) response = get "/mms.GRAPHS/data/DATA#{year}#{month}_#{region}1.csv" values = parse_response(response) values end |
.historic_trading_by_range(region, start, finish) ⇒ Array<AEMO::Market::Interval>
Return an array of historic trading values based on a start and finish
43 44 45 46 47 48 49 50 51 52 |
# File 'lib/aemo/market.rb', line 43 def historic_trading_by_range(region, start, finish) region = AEMO::Region.new(region) if region.is_a?(String) required_data = [] (start..finish).map { |d| { year: d.year, month: d.month } }.uniq.each do |period| required_data += historic_trading(region, period[:year], period[:month]) end required_data.select { |values| values.datetime >= start && values.datetime <= finish } end |