Sha256: de2051dd00d0c86f831968d27ab3377f3896946e51ae5ee8d06e8a7cb370cdb5

Contents?: true

Size: 531 Bytes

Versions: 1

Compression:

Stored size: 531 Bytes

Contents

module Util
  
  def self.compare_2_arrays_of_floats(a, b)
    delete_nans_and_truncate_floats_to_strings(a) == delete_nans_and_truncate_floats_to_strings(b)
  end

  def self.truncate_float_to_string(f)
    "%.10f" % f
  end

  def self.delete_nans_and_truncate_floats_to_strings(a)
    a.delete_if{ |e| e.nan? }.map{ |e| truncate_float_to_string(e) }
  end

  def self.ohlc(opens, highs, lows, closes)
    o = []
    opens.each_with_index do |e, i|
      o << [opens[i], highs[i], lows[i], closes[i]]
    end
    o
  end  
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
quant-0.0.3 lib/util.rb