Class: TechnicalAnalysis::RsiValue

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

Overview

The value class to be returned by calculations

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(date_time: nil, rsi: nil) ⇒ RsiValue

Returns a new instance of RsiValue.



122
123
124
125
# File 'lib/technical_analysis/indicators/rsi.rb', line 122

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



117
118
119
# File 'lib/technical_analysis/indicators/rsi.rb', line 117

def date_time
  @date_time
end

#rsiFloat

Returns the rsi calculation value.

Returns:

  • (Float)

    the rsi calculation value



120
121
122
# File 'lib/technical_analysis/indicators/rsi.rb', line 120

def rsi
  @rsi
end

Instance Method Details

#to_hashHash

Returns the attributes as a hash.

Returns:

  • (Hash)

    the attributes as a hash



128
129
130
# File 'lib/technical_analysis/indicators/rsi.rb', line 128

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