Class: TechnicalAnalysis::EmaValue

Inherits:
Object
  • Object
show all
Defined in:
lib/technical_analysis/indicators/ema.rb

Overview

The value class to be returned by calculations

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(date_time: nil, ema: nil) ⇒ EmaValue

Returns a new instance of EmaValue.



91
92
93
94
# File 'lib/technical_analysis/indicators/ema.rb', line 91

def initialize(date_time: nil, ema: nil)
  @date_time = date_time
  @ema = ema
end

Instance Attribute Details

#date_timeString

Returns the date_time of the obversation as it was provided.

Returns:

  • (String)

    the date_time of the obversation as it was provided



86
87
88
# File 'lib/technical_analysis/indicators/ema.rb', line 86

def date_time
  @date_time
end

#emaFloat

Returns the ema calculation value.

Returns:

  • (Float)

    the ema calculation value



89
90
91
# File 'lib/technical_analysis/indicators/ema.rb', line 89

def ema
  @ema
end

Instance Method Details

#to_hashHash

Returns the attributes as a hash.

Returns:

  • (Hash)

    the attributes as a hash



97
98
99
# File 'lib/technical_analysis/indicators/ema.rb', line 97

def to_hash
  { date_time: @date_time, ema: @ema }
end