Class: AEMO::Market::Interval Abstract
- Inherits:
-
Object
- Object
- AEMO::Market::Interval
- Defined in:
- lib/aemo/market/interval.rb
Overview
This class is abstract.
AEMO::Market::Interval
Constant Summary collapse
- INTERVALS =
{ trading: 'Trading', dispatch: 'Dispatch' }.freeze
Instance Attribute Summary collapse
-
#datetime(trailing_edge = true) ⇒ Time
All AEMO Data operates in Australian Eastern Standard Time All AEMO Data aggregates to the trailing edge of the period (this makes it difficult to do daily aggregations :( ).
- #period_type ⇒ Object
- #region ⇒ Object
- #rrp ⇒ Object
- #total_demand ⇒ Object
Instance Method Summary collapse
-
#dispatch? ⇒ Boolean
Returns true if the interval type is dispatch.
- #initialize(datetime, options = {}) ⇒ AEMO::Market::Interval constructor
-
#interval_length ⇒ Time
The time of the.
-
#interval_type ⇒ Symbol
:dispatch or :trading.
-
#trading? ⇒ Boolean
Returns true if the interval type is trading.
-
#value ⇒ Float
The value of the interval in Australian Dollars.
Constructor Details
#initialize(datetime, options = {}) ⇒ AEMO::Market::Interval
19 20 21 22 23 24 25 |
# File 'lib/aemo/market/interval.rb', line 19 def initialize(datetime, = {}) @datetime = Time.parse("#{datetime} +1000") @region = ['REGION'] @total_demand = ['TOTALDEMAND'] @rrp = ['RRP'] @period_type = ['PERIODTYPE'] end |
Instance Attribute Details
#datetime(trailing_edge = true) ⇒ Time
All AEMO Data operates in Australian Eastern Standard Time All AEMO Data aggregates to the trailing edge of the period (this makes it difficult to do daily aggregations :( )
33 34 35 |
# File 'lib/aemo/market/interval.rb', line 33 def datetime @datetime end |
#period_type ⇒ Object
14 15 16 |
# File 'lib/aemo/market/interval.rb', line 14 def period_type @period_type end |
#region ⇒ Object
14 15 16 |
# File 'lib/aemo/market/interval.rb', line 14 def region @region end |
#rrp ⇒ Object
14 15 16 |
# File 'lib/aemo/market/interval.rb', line 14 def rrp @rrp end |
#total_demand ⇒ Object
14 15 16 |
# File 'lib/aemo/market/interval.rb', line 14 def total_demand @total_demand end |
Instance Method Details
#dispatch? ⇒ Boolean
Returns true if the interval type is dispatch
58 59 60 |
# File 'lib/aemo/market/interval.rb', line 58 def dispatch? @period_type.nil? || @period_type.empty? end |
#interval_length ⇒ Time
Returns the time of the.
48 49 50 |
# File 'lib/aemo/market/interval.rb', line 48 def interval_length Time.at(300) end |
#interval_type ⇒ Symbol
Returns :dispatch or :trading.
53 54 55 |
# File 'lib/aemo/market/interval.rb', line 53 def interval_type dispatch? ? :dispatch : :trading end |
#trading? ⇒ Boolean
Returns true if the interval type is trading
63 64 65 |
# File 'lib/aemo/market/interval.rb', line 63 def trading? !dispatch? end |
#value ⇒ Float
Returns the value of the interval in Australian Dollars.
68 69 70 71 72 73 74 |
# File 'lib/aemo/market/interval.rb', line 68 def value @value ||= Float::NAN if @total_demand.class == Float && @rrp.class == Float @value = (@total_demand * @rrp).round(2) end @value end |