Class: TechnicalAnalysis::MfiValue

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

Overview

The value class to be returned by calculations

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(date_time: nil, mfi: nil) ⇒ MfiValue

Returns a new instance of MfiValue.



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

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



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

def date_time
  @date_time
end

#mfiFloat

Returns the mfi calculation value.

Returns:

  • (Float)

    the mfi calculation value



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

def mfi
  @mfi
end

Instance Method Details

#to_hashHash

Returns the attributes as a hash.

Returns:

  • (Hash)

    the attributes as a hash



114
115
116
# File 'lib/technical_analysis/indicators/mfi.rb', line 114

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