Class: TechnicalAnalysis::SmaValue
- Inherits:
-
Object
- Object
- TechnicalAnalysis::SmaValue
- Defined in:
- lib/technical_analysis/indicators/sma.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.
-
#sma ⇒ Float
The sma calculation value.
Instance Method Summary collapse
-
#initialize(date_time: nil, sma: nil) ⇒ SmaValue
constructor
A new instance of SmaValue.
-
#to_hash ⇒ Hash
The attributes as a hash.
Constructor Details
#initialize(date_time: nil, sma: nil) ⇒ SmaValue
Returns a new instance of SmaValue.
89 90 91 92 |
# File 'lib/technical_analysis/indicators/sma.rb', line 89 def initialize(date_time: nil, sma: nil) @date_time = date_time @sma = sma end |
Instance Attribute Details
#date_time ⇒ String
Returns the date_time of the obversation as it was provided.
84 85 86 |
# File 'lib/technical_analysis/indicators/sma.rb', line 84 def date_time @date_time end |
#sma ⇒ Float
Returns the sma calculation value.
87 88 89 |
# File 'lib/technical_analysis/indicators/sma.rb', line 87 def sma @sma end |
Instance Method Details
#to_hash ⇒ Hash
Returns the attributes as a hash.
95 96 97 |
# File 'lib/technical_analysis/indicators/sma.rb', line 95 def to_hash { date_time: @date_time, sma: @sma } end |