Class: Quant::Indicators::IndicatorPoint

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

Direct Known Subclasses

MaPoint

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tick:, source:) ⇒ IndicatorPoint

Returns a new instance of IndicatorPoint.



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

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

Instance Attribute Details

#sourceObject (readonly)

Returns the value of attribute source.



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

def source
  @source
end

#tickObject (readonly)

Returns the value of attribute tick.



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

def tick
  @tick
end

Instance Method Details

#initialize_data_points(indicator:) ⇒ Object



23
24
25
# File 'lib/quant/indicators/indicator_point.rb', line 23

def initialize_data_points(indicator:)
  # NoOp
end

#timestampObject



19
20
21
# File 'lib/quant/indicators/indicator_point.rb', line 19

def timestamp
  @tick.close_timestamp
end

#to_hObject

Raises:

  • (NotImplementedError)


27
28
29
# File 'lib/quant/indicators/indicator_point.rb', line 27

def to_h
  raise NotImplementedError
end

#to_json(*args) ⇒ Object



31
32
33
# File 'lib/quant/indicators/indicator_point.rb', line 31

def to_json(*args)
  Oj.dump(to_h, *args)
end

#volumeObject



15
16
17
# File 'lib/quant/indicators/indicator_point.rb', line 15

def volume
  @tick.base_volume
end