Module: Quant

Defined in:
lib/quant/interval.rb,
lib/quant/asset.rb,
lib/quant/config.rb,
lib/quant/errors.rb,
lib/quant/series.rb,
lib/quant/version.rb,
lib/quant/settings.rb,
lib/quant/attributes.rb,
lib/quant/indicators.rb,
lib/quant/ticks/ohlc.rb,
lib/quant/ticks/spot.rb,
lib/quant/ticks/tick.rb,
lib/quant/asset_class.rb,
lib/quant/time_period.rb,
lib/quant/experimental.rb,
lib/quant/time_methods.rb,
lib/quant/pivots_source.rb,
lib/quant/indicators/adx.rb,
lib/quant/indicators/atr.rb,
lib/quant/indicators/cci.rb,
lib/quant/indicators/ema.rb,
lib/quant/indicators/rsi.rb,
lib/quant/indicators/snr.rb,
lib/quant/mixins/filters.rb,
lib/quant/indicators/mama.rb,
lib/quant/indicators/mesa.rb,
lib/quant/indicators/ping.rb,
lib/quant/indicators/frama.rb,
lib/quant/mixins/direction.rb,
lib/quant/mixins/functions.rb,
lib/quant/indicators_source.rb,
lib/quant/mixins/stochastic.rb,
lib/quant/refinements/array.rb,
lib/quant/indicators/roofing.rb,
lib/quant/indicators_sources.rb,
lib/quant/indicators/decycler.rb,
lib/quant/indicators_registry.rb,
lib/quant/settings/indicators.rb,
lib/quant/indicators/indicator.rb,
lib/quant/indicators/pivots/atr.rb,
lib/quant/indicators/rocket_rsi.rb,
lib/quant/mixins/super_smoother.rb,
lib/quant/dominant_cycles_source.rb,
lib/quant/mixins/moving_averages.rb,
lib/quant/statistics/correlation.rb,
lib/quant/ticks/serializers/ohlc.rb,
lib/quant/ticks/serializers/spot.rb,
lib/quant/ticks/serializers/tick.rb,
lib/quant/indicators/pivots/guppy.rb,
lib/quant/indicators/pivots/pivot.rb,
lib/quant/mixins/fisher_transform.rb,
lib/quant/indicators/pivots/demark.rb,
lib/quant/indicators/pivots/murrey.rb,
lib/quant/indicators/pivots/woodie.rb,
lib/quant/mixins/high_pass_filters.rb,
lib/quant/mixins/hilbert_transform.rb,
lib/quant/mixins/universal_filters.rb,
lib/quant/indicators/pivots/classic.rb,
lib/quant/indicators/pivots/keltner.rb,
lib/quant/indicators/indicator_point.rb,
lib/quant/indicators/pivots/donchian.rb,
lib/quant/mixins/butterworth_filters.rb,
lib/quant/indicators/pivots/bollinger.rb,
lib/quant/indicators/pivots/camarilla.rb,
lib/quant/indicators/pivots/fibbonacci.rb,
lib/quant/mixins/simple_moving_average.rb,
lib/quant/indicators/pivots/traditional.rb,
lib/quant/indicators/dominant_cycles/acr.rb,
lib/quant/mixins/weighted_moving_average.rb,
lib/quant/mixins/exponential_moving_average.rb,
lib/quant/indicators/dominant_cycles/homodyne.rb,
lib/quant/indicators/dominant_cycles/band_pass.rb,
lib/quant/indicators/dominant_cycles/half_period.rb,
lib/quant/indicators/dominant_cycles/differential.rb,
lib/quant/indicators/dominant_cycles/dominant_cycle.rb,
lib/quant/indicators/dominant_cycles/phase_accumulator.rb

Overview

Quantitative is a statistical and quantitative library for Ruby 3.x. It provides a number of classes and modules for working with time-series data, financial data, and other quantitative data. It is designed to be fast, efficient, and easy to use.

Installation

Add this line to your application’s Gemfile:

gem 'quantitative'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install quantitative

Usage

Quantitative provides a number of classes and modules for working with time-series data, financial data, and other quantitative data. It is designed to be fast, efficient, and easy to use.

Here’s a simple example of how to use Quantitative:

require "quantitative"

# Create a new series
series = Quant::Series.new

# Add some data to the series
ticks = [25.0, 26.0, 23.5, 24.5, 25.5, 26.5, 27.5, 28.5, 29.5, 30.5]
ticks.each { |tick| series << tick }

# Print the series
pp series

Defined Under Namespace

Modules: Attributes, Config, Errors, Experimental, Indicators, IndicatorsRegistry, Mixins, Refinements, Settings, Statistics, Ticks, TimeMethods Classes: Asset, AssetClass, DominantCyclesSource, IndicatorsSource, IndicatorsSources, Interval, PivotsSource, Series, TimePeriod

Constant Summary collapse

VERSION =
"0.3.3"

Class Method Summary collapse

Class Method Details

.configObject



28
29
30
# File 'lib/quant/config.rb', line 28

def config
  Config.config
end

.configure_indicators(**settings) {|config.indicators| ... } ⇒ Object

Yields:



36
37
38
39
# File 'lib/quant/config.rb', line 36

def configure_indicators(**settings)
  config.apply_indicator_settings(**settings)
  yield config.indicators if block_given?
end

.current_dateObject

This method, similar to current_time, provides a single point of access for the current date.



14
15
16
# File 'lib/quant/time_methods.rb', line 14

def current_date
  Date.today
end

.current_timeObject

The library is designed to work with UTC time. This method provides a single point of access for the current time. This is useful for testing and for retrieving the current time in one place for the entire library.



9
10
11
# File 'lib/quant/time_methods.rb', line 9

def current_time
  Time.now.utc
end

.default_configuration!Object



32
33
34
# File 'lib/quant/config.rb', line 32

def default_configuration!
  Config.default!
end

.experimental(message) ⇒ Object



19
20
21
22
23
24
25
26
27
28
# File 'lib/quant/experimental.rb', line 19

def experimental(message)
  return if Experimental.rspec_defined?
  return if Experimental.tracker[caller.first]

  Experimental.tracker[caller.first] = message

  calling_method = caller.first.scan(/`([^']*)/)[0][0]
  full_message = "EXPERIMENTAL: #{calling_method.inspect}: #{message}\nsource location: #{caller.first}"
  puts full_message
end