Class: TechnicalAnalysis::KcValue

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

Overview

The value class to be returned by calculations

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(date_time: nil, lower_band: nil, middle_band: nil, upper_band: nil) ⇒ KcValue

Returns a new instance of KcValue.



106
107
108
109
110
111
# File 'lib/technical_analysis/indicators/kc.rb', line 106

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



95
96
97
# File 'lib/technical_analysis/indicators/kc.rb', line 95

def date_time
  @date_time
end

#lower_bandFloat

Returns the lower_band calculation value.

Returns:

  • (Float)

    the lower_band calculation value



98
99
100
# File 'lib/technical_analysis/indicators/kc.rb', line 98

def lower_band
  @lower_band
end

#middle_bandFloat

Returns the middle_band calculation value.

Returns:

  • (Float)

    the middle_band calculation value



101
102
103
# File 'lib/technical_analysis/indicators/kc.rb', line 101

def middle_band
  @middle_band
end

#upper_bandFloat

Returns the upper_band calculation value.

Returns:

  • (Float)

    the upper_band calculation value



104
105
106
# File 'lib/technical_analysis/indicators/kc.rb', line 104

def upper_band
  @upper_band
end

Instance Method Details

#to_hashHash

Returns the attributes as a hash.

Returns:

  • (Hash)

    the attributes as a hash



114
115
116
117
118
119
120
121
# File 'lib/technical_analysis/indicators/kc.rb', line 114

def to_hash
  {
    date_time: @date_time,
    lower_band: @lower_band,
    middle_band: @middle_band,
    upper_band: @upper_band
  }
end