Sha256: 6d6f0b30fead7cff4ac457e6bdd6c84f8bc30186f33f3b5399666fbc93227c40

Contents?: true

Size: 785 Bytes

Versions: 1

Compression:

Stored size: 785 Bytes

Contents

require './test/test_helper'

class TestAverageTrueRange < Minitest::Test
  def setup
    ticker = "TESTING"
    @days = 90

    YahooFinance.stub(:get_historical_quotes, data_for_tests(@days)) do
      @stock = SignalTools::Stock.new(ticker)
    end

    @stock_data = @stock.stock_data
  end

  def test_calculate
    assert_equal "3.195750", "%.6f" % SignalTools::Technicals::AverageTrueRange.new(@stock_data, 14).calculate[-1]
    assert_equal "3.438910", "%.6f" % SignalTools::Technicals::AverageTrueRange.new(@stock_data, 14).calculate[-5]
    assert_equal "3.208282", "%.6f" % SignalTools::Technicals::AverageTrueRange.new(@stock_data, 15).calculate[-1]
    assert_equal "3.434397", "%.6f" % SignalTools::Technicals::AverageTrueRange.new(@stock_data, 15).calculate[-5]
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
signal_tools-0.3.1 test/lib/signal_tools/technicals/test_average_true_range.rb