Module: Quant::IndicatorsRegistry::ClassMethods
- Defined in:
- lib/quant/indicators_registry.rb
Defined Under Namespace
Classes: RegistryEntry
Instance Method Summary collapse
- #define_indicator_accessors(indicator_source:) ⇒ Object
- #register(name:, indicator_class:) ⇒ Object
- #registry ⇒ Object
- #registry_entries_for(indicator_source:) ⇒ Object
Instance Method Details
#define_indicator_accessors(indicator_source:) ⇒ Object
56 57 58 59 60 |
# File 'lib/quant/indicators_registry.rb', line 56 def define_indicator_accessors(indicator_source:) registry_entries_for(indicator_source:).each do |entry| indicator_source.define_singleton_method(entry.name) { indicator(entry.indicator_class) } end end |
#register(name:, indicator_class:) ⇒ Object
43 44 45 46 47 |
# File 'lib/quant/indicators_registry.rb', line 43 def register(name:, indicator_class:) entry = RegistryEntry.new(name:, indicator_class:) registry[entry.key] = entry # registry[name] = indicator_class end |
#registry ⇒ Object
14 15 16 |
# File 'lib/quant/indicators_registry.rb', line 14 def registry @registry ||= {} end |
#registry_entries_for(indicator_source:) ⇒ Object
49 50 51 52 53 54 |
# File 'lib/quant/indicators_registry.rb', line 49 def registry_entries_for(indicator_source:) return registry.values.select(&:pivot?) if indicator_source.is_a?(PivotsSource) return registry.values.select(&:dominant_cycle?) if indicator_source.is_a?(DominantCyclesSource) registry.values.select(&:standard?) end |