Sha256: 80742c5ffbe8b710d16ce7edba91a5749d15f819ddc121e75a9da4d3bd107e2d
Contents?: true
Size: 1.25 KB
Versions: 1
Compression:
Stored size: 1.25 KB
Contents
require './test/test_helper' class TestSlowStochastic < 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 "0.185714", "%.6f" % SignalTools::Technicals::SlowStochastic.new(@stock_data, 14, 5).calculate[:k][-1] assert_equal "0.271429", "%.6f" % SignalTools::Technicals::SlowStochastic.new(@stock_data, 14, 5).calculate[:k][-5] assert_equal "0.314286", "%.6f" % SignalTools::Technicals::SlowStochastic.new(@stock_data, 14, 5).calculate[:d][-1] assert_equal "0.314286", "%.6f" % SignalTools::Technicals::SlowStochastic.new(@stock_data, 14, 5).calculate[:d][-5] assert_equal "0.185714", "%.6f" % SignalTools::Technicals::SlowStochastic.new(@stock_data, 12, 3).calculate[:k][-1] assert_equal "0.271429", "%.6f" % SignalTools::Technicals::SlowStochastic.new(@stock_data, 12, 3).calculate[:k][-5] assert_equal "0.314286", "%.6f" % SignalTools::Technicals::SlowStochastic.new(@stock_data, 12, 3).calculate[:d][-1] assert_equal "0.257143", "%.6f" % SignalTools::Technicals::SlowStochastic.new(@stock_data, 12, 3).calculate[:d][-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_slow_stochastic.rb |