Class: Quant::Indicators::IndicatorPoint

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
Attributes
Defined in:
lib/quant/indicators/indicator_point.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Attributes

deregister, included, register, registry

Constructor Details

#initialize(indicator:, tick:, source:) ⇒ IndicatorPoint

Returns a new instance of IndicatorPoint.



14
15
16
17
18
19
20
# File 'lib/quant/indicators/indicator_point.rb', line 14

def initialize(indicator:, tick:, source:)
  @indicator = indicator
  @tick = tick
  @source = source
  @input = @tick.send(source)
  initialize_data_points
end

Instance Attribute Details

#indicatorObject (readonly)

Returns the value of attribute indicator.



9
10
11
# File 'lib/quant/indicators/indicator_point.rb', line 9

def indicator
  @indicator
end

#tickObject (readonly)

Returns the value of attribute tick.



9
10
11
# File 'lib/quant/indicators/indicator_point.rb', line 9

def tick
  @tick
end

Instance Method Details

#initialize_data_pointsObject



41
42
43
# File 'lib/quant/indicators/indicator_point.rb', line 41

def initialize_data_points
  # No-Op - Override in subclass if needed.
end

#oc2Object



37
38
39
# File 'lib/quant/indicators/indicator_point.rb', line 37

def oc2
  tick.respond_to?(:oc2) ? tick.oc2 : tick.close_price
end