Class: TechnicalAnalysis::MacdValue
- Inherits:
-
Object
- Object
- TechnicalAnalysis::MacdValue
- Defined in:
- lib/technical_analysis/indicators/macd.rb
Overview
The value class to be returned by calculations
Instance Attribute Summary collapse
-
#date_time ⇒ String
The date_time of the obversation as it was provided.
-
#macd_histogram ⇒ Float
The macd_histogram calculation value.
-
#macd_line ⇒ Float
The macd_line calculation value.
-
#signal_line ⇒ Float
The signal_line calculation value.
Instance Method Summary collapse
-
#initialize(date_time: nil, macd_line: nil, macd_histogram: nil, signal_line: nil) ⇒ MacdValue
constructor
A new instance of MacdValue.
-
#to_hash ⇒ Hash
The attributes as a hash.
Constructor Details
#initialize(date_time: nil, macd_line: nil, macd_histogram: nil, signal_line: nil) ⇒ MacdValue
Returns a new instance of MacdValue.
126 127 128 129 130 131 |
# File 'lib/technical_analysis/indicators/macd.rb', line 126 def initialize(date_time: nil, macd_line: nil, macd_histogram: nil, signal_line: nil) @date_time = date_time @macd_line = macd_line @macd_histogram = macd_histogram @signal_line = signal_line end |
Instance Attribute Details
#date_time ⇒ String
Returns the date_time of the obversation as it was provided.
115 116 117 |
# File 'lib/technical_analysis/indicators/macd.rb', line 115 def date_time @date_time end |
#macd_histogram ⇒ Float
Returns the macd_histogram calculation value.
121 122 123 |
# File 'lib/technical_analysis/indicators/macd.rb', line 121 def macd_histogram @macd_histogram end |
#macd_line ⇒ Float
Returns the macd_line calculation value.
118 119 120 |
# File 'lib/technical_analysis/indicators/macd.rb', line 118 def macd_line @macd_line end |
#signal_line ⇒ Float
Returns the signal_line calculation value.
124 125 126 |
# File 'lib/technical_analysis/indicators/macd.rb', line 124 def signal_line @signal_line end |
Instance Method Details
#to_hash ⇒ Hash
Returns the attributes as a hash.
134 135 136 137 138 139 140 141 |
# File 'lib/technical_analysis/indicators/macd.rb', line 134 def to_hash { date_time: @date_time, macd_line: @macd_line, macd_histogram: @macd_histogram, signal_line: @signal_line } end |