Method: AEMO::Market::Interval#datetime

Defined in:
lib/aemo/market/interval.rb

#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 :( )

Parameters:

  • trailing_edge (Boolean) (defaults to: true)

    selection of either the trailing edge of the period or the rising edge of the period for the date time

Returns:

  • (Time)

    a time object of the trailing edge of the interval

Since:

  • 0.1.0



38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/aemo/market/interval.rb', line 38

def datetime(trailing_edge: true)
  t = @datetime
  # If the datetime requested is the trailing edge, offset as per interval requirement
  unless trailing_edge
    # This is for dispatch intervals of five minutes
    if dispatch?
      t -= 5 * 60
    elsif trading?
      t -= 30 * 60
    end
  end
  t
end