Method: TechnicalAnalysis::Indicator.calculate
- Defined in:
- lib/technical_analysis/indicators/indicator.rb
.calculate(indicator_symbol, data, calculation, options = {}) ⇒ Object
Find the applicable indicator and looks up the value
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/technical_analysis/indicators/indicator.rb', line 78 def self.calculate(indicator_symbol, data, calculation, ={}) return nil unless CALCULATIONS.include? calculation indicator = find(indicator_symbol) raise "Indicator not found!" if indicator.nil? case calculation when :indicator_name; indicator.indicator_name when :indicator_symbol; indicator.indicator_symbol when :technicals; indicator.calculate(data, ) when :min_data_size; indicator.min_data_size() when :valid_options; indicator. when :validate_options; indicator.() else nil end end |