Class: TechnicalAnalysis::ViValue

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

Overview

The value class to be returned by calculations

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(date_time: nil, positive_vi: nil, negative_vi: nil) ⇒ ViValue

Returns a new instance of ViValue.



105
106
107
108
109
# File 'lib/technical_analysis/indicators/vi.rb', line 105

def initialize(date_time: nil, positive_vi: nil, negative_vi: nil)
  @date_time = date_time
  @positive_vi = positive_vi
  @negative_vi = negative_vi
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/vi.rb', line 97

def date_time
  @date_time
end

#negative_viFloat

Returns the negative Vortex Indicator value.

Returns:

  • (Float)

    the negative Vortex Indicator value



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

def negative_vi
  @negative_vi
end

#positive_viFloat

Returns the positive Vortex Indicator value.

Returns:

  • (Float)

    the positive Vortex Indicator value



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

def positive_vi
  @positive_vi
end

Instance Method Details

#to_hashHash

Returns the attributes as a hash.

Returns:

  • (Hash)

    the attributes as a hash



112
113
114
# File 'lib/technical_analysis/indicators/vi.rb', line 112

def to_hash
  { date_time: @date_time, positive_vi: @positive_vi, negative_vi: @negative_vi }
end