Class: TechnicalAnalysis::SrValue

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

Overview

The value class to be returned by calculations

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(date_time: nil, sr: nil, sr_signal: nil) ⇒ SrValue

Returns a new instance of SrValue.



110
111
112
113
114
# File 'lib/technical_analysis/indicators/sr.rb', line 110

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



102
103
104
# File 'lib/technical_analysis/indicators/sr.rb', line 102

def date_time
  @date_time
end

#srFloat

Returns the sr calculation value.

Returns:

  • (Float)

    the sr calculation value



105
106
107
# File 'lib/technical_analysis/indicators/sr.rb', line 105

def sr
  @sr
end

#sr_signalFloat

Returns the sr_signal calculation value.

Returns:

  • (Float)

    the sr_signal calculation value



108
109
110
# File 'lib/technical_analysis/indicators/sr.rb', line 108

def sr_signal
  @sr_signal
end

Instance Method Details

#to_hashHash

Returns the attributes as a hash.

Returns:

  • (Hash)

    the attributes as a hash



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

def to_hash
  { date_time: @date_time, sr: @sr, sr_signal: @sr_signal }
end