Class: TechnicalAnalysis::WmaValue

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

Overview

The value class to be returned by calculations

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(date_time: nil, wma: nil) ⇒ WmaValue

Returns a new instance of WmaValue.



90
91
92
93
# File 'lib/technical_analysis/indicators/wma.rb', line 90

def initialize(date_time: nil, wma: nil)
  @date_time = date_time
  @wma = wma
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



85
86
87
# File 'lib/technical_analysis/indicators/wma.rb', line 85

def date_time
  @date_time
end

#wmaFloat

Returns the wma calculation value.

Returns:

  • (Float)

    the wma calculation value



88
89
90
# File 'lib/technical_analysis/indicators/wma.rb', line 88

def wma
  @wma
end

Instance Method Details

#to_hashHash

Returns the attributes as a hash.

Returns:

  • (Hash)

    the attributes as a hash



96
97
98
# File 'lib/technical_analysis/indicators/wma.rb', line 96

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