Class: Quant::IndicatorsProxy
- Inherits:
-
Object
- Object
- Quant::IndicatorsProxy
- Defined in:
- lib/quant/indicators_proxy.rb
Instance Attribute Summary collapse
-
#indicators ⇒ Object
readonly
Returns the value of attribute indicators.
-
#series ⇒ Object
readonly
Returns the value of attribute series.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Instance Method Summary collapse
- #<<(tick) ⇒ Object
- #indicator(indicator_class) ⇒ Object
-
#initialize(series:, source:) ⇒ IndicatorsProxy
constructor
A new instance of IndicatorsProxy.
- #ma ⇒ Object
Constructor Details
#initialize(series:, source:) ⇒ IndicatorsProxy
Returns a new instance of IndicatorsProxy.
7 8 9 10 11 |
# File 'lib/quant/indicators_proxy.rb', line 7 def initialize(series:, source:) @series = series @source = source @indicators = {} end |
Instance Attribute Details
#indicators ⇒ Object (readonly)
Returns the value of attribute indicators.
5 6 7 |
# File 'lib/quant/indicators_proxy.rb', line 5 def indicators @indicators end |
#series ⇒ Object (readonly)
Returns the value of attribute series.
5 6 7 |
# File 'lib/quant/indicators_proxy.rb', line 5 def series @series end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
5 6 7 |
# File 'lib/quant/indicators_proxy.rb', line 5 def source @source end |
Instance Method Details
#<<(tick) ⇒ Object
17 18 19 |
# File 'lib/quant/indicators_proxy.rb', line 17 def <<(tick) indicators.each_value { |indicator| indicator << tick } end |
#indicator(indicator_class) ⇒ Object
13 14 15 |
# File 'lib/quant/indicators_proxy.rb', line 13 def indicator(indicator_class) indicators[indicator_class] ||= indicator_class.new(series: series, source: source) end |
#ma ⇒ Object
21 |
# File 'lib/quant/indicators_proxy.rb', line 21 def ma; indicator(Indicators::Ma) end |