Class: TechnicalAnalysis::ObvValue

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

Overview

The value class to be returned by calculations

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(date_time: nil, obv: nil) ⇒ ObvValue

Returns a new instance of ObvValue.



93
94
95
96
# File 'lib/technical_analysis/indicators/obv.rb', line 93

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



88
89
90
# File 'lib/technical_analysis/indicators/obv.rb', line 88

def date_time
  @date_time
end

#obvFloat

Returns the obv calculation value.

Returns:

  • (Float)

    the obv calculation value



91
92
93
# File 'lib/technical_analysis/indicators/obv.rb', line 91

def obv
  @obv
end

Instance Method Details

#to_hashHash

Returns the attributes as a hash.

Returns:

  • (Hash)

    the attributes as a hash



99
100
101
# File 'lib/technical_analysis/indicators/obv.rb', line 99

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