Class: TechnicalAnalysis::BbValue

Inherits:
Object
  • Object
show all
Defined in:
lib/technical_analysis/indicators/bb.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) ⇒ BbValue

Returns a new instance of BbValue.



108
109
110
111
112
113
# File 'lib/technical_analysis/indicators/bb.rb', line 108

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



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

def date_time
  @date_time
end

#lower_bandFloat

Returns the lower_band calculation value.

Returns:

  • (Float)

    the lower_band calculation value



100
101
102
# File 'lib/technical_analysis/indicators/bb.rb', line 100

def lower_band
  @lower_band
end

#middle_bandFloat

Returns the middle_band calculation value.

Returns:

  • (Float)

    the middle_band calculation value



103
104
105
# File 'lib/technical_analysis/indicators/bb.rb', line 103

def middle_band
  @middle_band
end

#upper_bandFloat

Returns the upper_band calculation value.

Returns:

  • (Float)

    the upper_band calculation value



106
107
108
# File 'lib/technical_analysis/indicators/bb.rb', line 106

def upper_band
  @upper_band
end

Instance Method Details

#to_hashHash

Returns the attributes as a hash.

Returns:

  • (Hash)

    the attributes as a hash



116
117
118
119
120
121
122
123
# File 'lib/technical_analysis/indicators/bb.rb', line 116

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