quantitative 0.3.0 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -1
- data/lib/quant/asset.rb +0 -2
- data/lib/quant/dominant_cycles_source.rb +1 -32
- data/lib/quant/experimental.rb +3 -1
- data/lib/quant/indicators/adx.rb +3 -10
- data/lib/quant/indicators/atr.rb +3 -4
- data/lib/quant/indicators/cci.rb +3 -1
- data/lib/quant/indicators/decycler.rb +3 -1
- data/lib/quant/indicators/dominant_cycles/acr.rb +5 -6
- data/lib/quant/indicators/dominant_cycles/band_pass.rb +4 -4
- data/lib/quant/indicators/dominant_cycles/differential.rb +4 -2
- data/lib/quant/indicators/dominant_cycles/dominant_cycle.rb +2 -4
- data/lib/quant/indicators/dominant_cycles/half_period.rb +4 -4
- data/lib/quant/indicators/dominant_cycles/homodyne.rb +4 -5
- data/lib/quant/indicators/dominant_cycles/phase_accumulator.rb +4 -4
- data/lib/quant/indicators/ema.rb +67 -0
- data/lib/quant/indicators/frama.rb +2 -1
- data/lib/quant/indicators/indicator.rb +5 -1
- data/lib/quant/indicators/indicator_point.rb +1 -1
- data/lib/quant/indicators/mama.rb +3 -1
- data/lib/quant/indicators/mesa.rb +4 -5
- data/lib/quant/indicators/ping.rb +3 -1
- data/lib/quant/indicators/pivots/atr.rb +3 -2
- data/lib/quant/indicators/pivots/bollinger.rb +4 -2
- data/lib/quant/indicators/pivots/camarilla.rb +3 -5
- data/lib/quant/indicators/pivots/classic.rb +4 -2
- data/lib/quant/indicators/pivots/demark.rb +4 -2
- data/lib/quant/indicators/pivots/donchian.rb +3 -2
- data/lib/quant/indicators/pivots/fibbonacci.rb +4 -2
- data/lib/quant/indicators/pivots/guppy.rb +5 -3
- data/lib/quant/indicators/pivots/keltner.rb +3 -2
- data/lib/quant/indicators/pivots/murrey.rb +4 -3
- data/lib/quant/indicators/pivots/pivot.rb +109 -0
- data/lib/quant/indicators/pivots/traditional.rb +4 -2
- data/lib/quant/indicators/pivots/woodie.rb +5 -3
- data/lib/quant/indicators/rocket_rsi.rb +57 -0
- data/lib/quant/indicators/roofing.rb +59 -0
- data/lib/quant/indicators/rsi.rb +67 -0
- data/lib/quant/indicators/snr.rb +64 -0
- data/lib/quant/indicators.rb +6 -0
- data/lib/quant/indicators_registry.rb +63 -0
- data/lib/quant/indicators_source.rb +14 -10
- data/lib/quant/mixins/filters.rb +0 -3
- data/lib/quant/mixins/moving_averages.rb +0 -3
- data/lib/quant/pivots_source.rb +1 -13
- data/lib/quant/ticks/ohlc.rb +0 -2
- data/lib/quant/ticks/spot.rb +0 -2
- data/lib/quant/version.rb +1 -1
- data/lib/quantitative.rb +29 -6
- metadata +25 -5
- data/lib/quant/indicators/pivot.rb +0 -107
- data/quantitative.gemspec +0 -39
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: quantitative
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.3. | 
| 4 | 
            +
              version: 0.3.2
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Michael Lang
         | 
| 8 8 | 
             
            autorequire:
         | 
| 9 9 | 
             
            bindir: exe
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2024- | 
| 11 | 
            +
            date: 2024-06-02 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: oj
         | 
| @@ -24,6 +24,20 @@ dependencies: | |
| 24 24 | 
             
                - - "~>"
         | 
| 25 25 | 
             
                  - !ruby/object:Gem::Version
         | 
| 26 26 | 
             
                    version: '3.10'
         | 
| 27 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 28 | 
            +
              name: zeitwerk
         | 
| 29 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 30 | 
            +
                requirements:
         | 
| 31 | 
            +
                - - "~>"
         | 
| 32 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 33 | 
            +
                    version: '2.6'
         | 
| 34 | 
            +
              type: :runtime
         | 
| 35 | 
            +
              prerelease: false
         | 
| 36 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 37 | 
            +
                requirements:
         | 
| 38 | 
            +
                - - "~>"
         | 
| 39 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 40 | 
            +
                    version: '2.6'
         | 
| 27 41 | 
             
            description: Quantitative and statistical tools written for Ruby 3.2+ for trading
         | 
| 28 42 | 
             
              and finance.
         | 
| 29 43 | 
             
            email:
         | 
| @@ -51,6 +65,7 @@ files: | |
| 51 65 | 
             
            - lib/quant/dominant_cycles_source.rb
         | 
| 52 66 | 
             
            - lib/quant/errors.rb
         | 
| 53 67 | 
             
            - lib/quant/experimental.rb
         | 
| 68 | 
            +
            - lib/quant/indicators.rb
         | 
| 54 69 | 
             
            - lib/quant/indicators/adx.rb
         | 
| 55 70 | 
             
            - lib/quant/indicators/atr.rb
         | 
| 56 71 | 
             
            - lib/quant/indicators/cci.rb
         | 
| @@ -62,13 +77,13 @@ files: | |
| 62 77 | 
             
            - lib/quant/indicators/dominant_cycles/half_period.rb
         | 
| 63 78 | 
             
            - lib/quant/indicators/dominant_cycles/homodyne.rb
         | 
| 64 79 | 
             
            - lib/quant/indicators/dominant_cycles/phase_accumulator.rb
         | 
| 80 | 
            +
            - lib/quant/indicators/ema.rb
         | 
| 65 81 | 
             
            - lib/quant/indicators/frama.rb
         | 
| 66 82 | 
             
            - lib/quant/indicators/indicator.rb
         | 
| 67 83 | 
             
            - lib/quant/indicators/indicator_point.rb
         | 
| 68 84 | 
             
            - lib/quant/indicators/mama.rb
         | 
| 69 85 | 
             
            - lib/quant/indicators/mesa.rb
         | 
| 70 86 | 
             
            - lib/quant/indicators/ping.rb
         | 
| 71 | 
            -
            - lib/quant/indicators/pivot.rb
         | 
| 72 87 | 
             
            - lib/quant/indicators/pivots/atr.rb
         | 
| 73 88 | 
             
            - lib/quant/indicators/pivots/bollinger.rb
         | 
| 74 89 | 
             
            - lib/quant/indicators/pivots/camarilla.rb
         | 
| @@ -79,8 +94,14 @@ files: | |
| 79 94 | 
             
            - lib/quant/indicators/pivots/guppy.rb
         | 
| 80 95 | 
             
            - lib/quant/indicators/pivots/keltner.rb
         | 
| 81 96 | 
             
            - lib/quant/indicators/pivots/murrey.rb
         | 
| 97 | 
            +
            - lib/quant/indicators/pivots/pivot.rb
         | 
| 82 98 | 
             
            - lib/quant/indicators/pivots/traditional.rb
         | 
| 83 99 | 
             
            - lib/quant/indicators/pivots/woodie.rb
         | 
| 100 | 
            +
            - lib/quant/indicators/rocket_rsi.rb
         | 
| 101 | 
            +
            - lib/quant/indicators/roofing.rb
         | 
| 102 | 
            +
            - lib/quant/indicators/rsi.rb
         | 
| 103 | 
            +
            - lib/quant/indicators/snr.rb
         | 
| 104 | 
            +
            - lib/quant/indicators_registry.rb
         | 
| 84 105 | 
             
            - lib/quant/indicators_source.rb
         | 
| 85 106 | 
             
            - lib/quant/indicators_sources.rb
         | 
| 86 107 | 
             
            - lib/quant/interval.rb
         | 
| @@ -115,7 +136,6 @@ files: | |
| 115 136 | 
             
            - lib/quant/version.rb
         | 
| 116 137 | 
             
            - lib/quantitative.rb
         | 
| 117 138 | 
             
            - possibilities.png
         | 
| 118 | 
            -
            - quantitative.gemspec
         | 
| 119 139 | 
             
            homepage: https://github.com/mwlang/quantitative
         | 
| 120 140 | 
             
            licenses:
         | 
| 121 141 | 
             
            - MIT
         | 
| @@ -139,7 +159,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 139 159 | 
             
                - !ruby/object:Gem::Version
         | 
| 140 160 | 
             
                  version: '0'
         | 
| 141 161 | 
             
            requirements: []
         | 
| 142 | 
            -
            rubygems_version: 3.5. | 
| 162 | 
            +
            rubygems_version: 3.5.11
         | 
| 143 163 | 
             
            signing_key:
         | 
| 144 164 | 
             
            specification_version: 4
         | 
| 145 165 | 
             
            summary: Quantitative and statistical tools written for Ruby 3.2+ for trading and
         | 
| @@ -1,107 +0,0 @@ | |
| 1 | 
            -
            module Quant
         | 
| 2 | 
            -
              class Indicators
         | 
| 3 | 
            -
                class PivotPoint < IndicatorPoint
         | 
| 4 | 
            -
                  attribute :high_price
         | 
| 5 | 
            -
                  attribute :avg_high, default: :high_price
         | 
| 6 | 
            -
                  attribute :highest, default: :input
         | 
| 7 | 
            -
             | 
| 8 | 
            -
                  attribute :low_price
         | 
| 9 | 
            -
                  attribute :avg_low, default: :low_price
         | 
| 10 | 
            -
                  attribute :lowest, default: :input
         | 
| 11 | 
            -
             | 
| 12 | 
            -
                  attribute :range, default: 0.0
         | 
| 13 | 
            -
                  attribute :avg_range, default: 0.0
         | 
| 14 | 
            -
                  attribute :std_dev, default: 0.0
         | 
| 15 | 
            -
             | 
| 16 | 
            -
                  def bands
         | 
| 17 | 
            -
                    @bands ||= { 0 => input }
         | 
| 18 | 
            -
                  end
         | 
| 19 | 
            -
             | 
| 20 | 
            -
                  def [](band)
         | 
| 21 | 
            -
                    bands[band]
         | 
| 22 | 
            -
                  end
         | 
| 23 | 
            -
             | 
| 24 | 
            -
                  def []=(band, value)
         | 
| 25 | 
            -
                    bands[band] = value
         | 
| 26 | 
            -
                  end
         | 
| 27 | 
            -
             | 
| 28 | 
            -
                  def key?(band)
         | 
| 29 | 
            -
                    bands.key?(band)
         | 
| 30 | 
            -
                  end
         | 
| 31 | 
            -
             | 
| 32 | 
            -
                  def midpoint
         | 
| 33 | 
            -
                    bands[0]
         | 
| 34 | 
            -
                  end
         | 
| 35 | 
            -
                  alias :h0 :midpoint
         | 
| 36 | 
            -
                  alias :l0 :midpoint
         | 
| 37 | 
            -
             | 
| 38 | 
            -
                  def midpoint=(value)
         | 
| 39 | 
            -
                    bands[0] = value
         | 
| 40 | 
            -
                  end
         | 
| 41 | 
            -
                  alias :h0= :midpoint=
         | 
| 42 | 
            -
                  alias :l0= :midpoint=
         | 
| 43 | 
            -
             | 
| 44 | 
            -
                  (1..8).each do |band|
         | 
| 45 | 
            -
                    define_method("h#{band}") { bands[band] }
         | 
| 46 | 
            -
                    define_method("h#{band}=") { |value| bands[band] = value }
         | 
| 47 | 
            -
             | 
| 48 | 
            -
                    define_method("l#{band}") { bands[-band] }
         | 
| 49 | 
            -
                    define_method("l#{band}=") { |value| bands[-band] = value }
         | 
| 50 | 
            -
                  end
         | 
| 51 | 
            -
                end
         | 
| 52 | 
            -
             | 
| 53 | 
            -
                class Pivot < Indicator
         | 
| 54 | 
            -
                  def points_class
         | 
| 55 | 
            -
                    Quant::Indicators::PivotPoint
         | 
| 56 | 
            -
                  end
         | 
| 57 | 
            -
             | 
| 58 | 
            -
                  def band?(band)
         | 
| 59 | 
            -
                    p0.key?(band)
         | 
| 60 | 
            -
                  end
         | 
| 61 | 
            -
             | 
| 62 | 
            -
                  def period
         | 
| 63 | 
            -
                    dc_period
         | 
| 64 | 
            -
                  end
         | 
| 65 | 
            -
             | 
| 66 | 
            -
                  def averaging_period
         | 
| 67 | 
            -
                    min_period
         | 
| 68 | 
            -
                  end
         | 
| 69 | 
            -
             | 
| 70 | 
            -
                  def period_midpoints
         | 
| 71 | 
            -
                    period_points(period).map(&:midpoint)
         | 
| 72 | 
            -
                  end
         | 
| 73 | 
            -
             | 
| 74 | 
            -
                  def compute
         | 
| 75 | 
            -
                    compute_extents
         | 
| 76 | 
            -
                    compute_value
         | 
| 77 | 
            -
                    compute_midpoint
         | 
| 78 | 
            -
                    compute_bands
         | 
| 79 | 
            -
                  end
         | 
| 80 | 
            -
             | 
| 81 | 
            -
                  def compute_midpoint
         | 
| 82 | 
            -
                    p0.midpoint = p0.input
         | 
| 83 | 
            -
                  end
         | 
| 84 | 
            -
             | 
| 85 | 
            -
                  def compute_value
         | 
| 86 | 
            -
                    # No-op -- override in subclasses
         | 
| 87 | 
            -
                  end
         | 
| 88 | 
            -
             | 
| 89 | 
            -
                  def compute_bands
         | 
| 90 | 
            -
                    # No-op -- override in subclasses
         | 
| 91 | 
            -
                  end
         | 
| 92 | 
            -
             | 
| 93 | 
            -
                  def compute_extents
         | 
| 94 | 
            -
                    period_midpoints.tap do |midpoints|
         | 
| 95 | 
            -
                      p0.high_price = t0.high_price
         | 
| 96 | 
            -
                      p0.low_price = t0.low_price
         | 
| 97 | 
            -
                      p0.highest = midpoints.max
         | 
| 98 | 
            -
                      p0.lowest = midpoints.min
         | 
| 99 | 
            -
                      p0.range = p0.high_price - p0.low_price
         | 
| 100 | 
            -
                      p0.avg_low = super_smoother(:low_price, previous: :avg_low, period: averaging_period)
         | 
| 101 | 
            -
                      p0.avg_high = super_smoother(:high_price, previous: :avg_high, period: averaging_period)
         | 
| 102 | 
            -
                      p0.avg_range = super_smoother(:range, previous: :avg_range, period: averaging_period)
         | 
| 103 | 
            -
                    end
         | 
| 104 | 
            -
                  end
         | 
| 105 | 
            -
                end
         | 
| 106 | 
            -
              end
         | 
| 107 | 
            -
            end
         | 
    
        data/quantitative.gemspec
    DELETED
    
    | @@ -1,39 +0,0 @@ | |
| 1 | 
            -
            # frozen_string_literal: true
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            require_relative "lib/quant/version"
         | 
| 4 | 
            -
             | 
| 5 | 
            -
            Gem::Specification.new do |spec|
         | 
| 6 | 
            -
              spec.name = "quantitative"
         | 
| 7 | 
            -
              spec.version = Quant::VERSION
         | 
| 8 | 
            -
              spec.authors = ["Michael Lang"]
         | 
| 9 | 
            -
              spec.email = ["mwlang@cybrains.net"]
         | 
| 10 | 
            -
             | 
| 11 | 
            -
              spec.summary = "Quantitative and statistical tools written for Ruby 3.2+ for trading and finance."
         | 
| 12 | 
            -
              spec.description = spec.summary
         | 
| 13 | 
            -
              spec.homepage = "https://github.com/mwlang/quantitative"
         | 
| 14 | 
            -
              spec.license = "MIT"
         | 
| 15 | 
            -
              spec.required_ruby_version = ">= 3.2"
         | 
| 16 | 
            -
             | 
| 17 | 
            -
              spec.metadata["allowed_push_host"] = "https://rubygems.org"
         | 
| 18 | 
            -
             | 
| 19 | 
            -
              spec.metadata["homepage_uri"] = spec.homepage
         | 
| 20 | 
            -
              spec.metadata["source_code_uri"] = spec.homepage
         | 
| 21 | 
            -
              spec.metadata["changelog_uri"] = spec.homepage
         | 
| 22 | 
            -
             | 
| 23 | 
            -
              # Specify which files should be added to the gem when it is released.
         | 
| 24 | 
            -
              # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
         | 
| 25 | 
            -
              spec.files = Dir.chdir(__dir__) do
         | 
| 26 | 
            -
                `git ls-files -z`.split("\x0").reject do |f|
         | 
| 27 | 
            -
                  (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
         | 
| 28 | 
            -
                end
         | 
| 29 | 
            -
              end
         | 
| 30 | 
            -
              spec.bindir = "exe"
         | 
| 31 | 
            -
              spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
         | 
| 32 | 
            -
              spec.require_paths = ["lib"]
         | 
| 33 | 
            -
             | 
| 34 | 
            -
              # Uncomment to register a new dependency of your gem
         | 
| 35 | 
            -
              spec.add_dependency "oj", "~> 3.10"
         | 
| 36 | 
            -
             | 
| 37 | 
            -
              # For more information and examples about making a new gem, check out our
         | 
| 38 | 
            -
              # guide at: https://bundler.io/guides/creating_gem.html
         | 
| 39 | 
            -
            end
         |