Skip to content

Commit

Permalink
Merge a2a5575 into cb68a69
Browse files Browse the repository at this point in the history
  • Loading branch information
iblislin authored Jun 28, 2017
2 parents cb68a69 + a2a5575 commit 865d096
Show file tree
Hide file tree
Showing 9 changed files with 552 additions and 421 deletions.
1 change: 0 additions & 1 deletion test/REQUIRE
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
FactCheck
MarketData
23 changes: 16 additions & 7 deletions test/candlesticks.jl
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
using MarketData, TimeSeries
using Base.Test

facts("Candlesticks") do
using MarketData
using TimeSeries

context("doji") do
@fact ohlc[find(doji(ohlc))].timestamp[1] --> Date(2000, 5, 30)
@fact ohlc[find(doji(ohlc))].timestamp[2] --> Date(2000, 12, 11)
@fact length(ohlc[find(doji(ohlc))]) --> 5
end
using MarketTechnicals


@testset "Candlesticks" begin


@testset "doji" begin
@test ohlc[find(doji(ohlc))].timestamp[1] == Date(2000, 5, 30)
@test ohlc[find(doji(ohlc))].timestamp[2] == Date(2000, 12, 11)
@test length(ohlc[find(doji(ohlc))]) == 5
end


end # @testset "Candlesticks"
63 changes: 38 additions & 25 deletions test/levels.jl
Original file line number Diff line number Diff line change
@@ -1,26 +1,39 @@
facts("Levels") do

context("floor pivots") do
@fact floorpivots(ohlc)["r3"].values[1] --> roughly(123.310, atol=.01) # values verified by various website calculators
@fact floorpivots(ohlc)["r2"].values[1] --> roughly(119.52, atol=.01)
@fact floorpivots(ohlc)["r1"].values[1] --> roughly(115.73, atol=.01)
@fact floorpivots(ohlc)["pivot"].values[1] --> roughly(108.71, atol=.01)
@fact floorpivots(ohlc)["s1"].values[1] --> roughly(104.92, atol=.01)
@fact floorpivots(ohlc)["s2"].values[1] --> roughly(97.900, atol=.01)
@fact floorpivots(ohlc)["s3"].values[1] --> roughly(94.110, atol=.01)
@fact floorpivots(ohlc).timestamp[end] --> Date(2001,12,31)
end

context("woodiespivots") do
# # @fact_approx_eq 97.37500000000001 value(wr4)[2] # values NEED to be verified with online calculators
# # @fact_approx_eq 88.62500000000001 value(ws4)[2]
@fact woodiespivots(ohlc)["r3"].values[1] --> roughly(124.465, atol=.01)
@fact woodiespivots(ohlc)["r2"].values[1] --> roughly(118.480, atol=.01)
@fact woodiespivots(ohlc)["r1"].values[1] --> roughly(113.655, atol=.01)
@fact woodiespivots(ohlc)["pivot"].values[1] --> roughly(107.670, atol=.01)
@fact woodiespivots(ohlc)["s1"].values[1] --> roughly(102.845, atol=.01)
@fact woodiespivots(ohlc)["s2"].values[1] --> roughly(96.8625, atol=.01)
@fact woodiespivots(ohlc)["s3"].values[1] --> roughly(92.035, atol=.01)
@fact woodiespivots(ohlc).timestamp[end] --> Date(2001,12,31)
end
using Base.Test

using MarketData
using TimeSeries

using MarketTechnicals


@testset "Levels" begin


@testset "floor pivots" begin
# values verified by various website calculators
@test isapprox(floorpivots(ohlc)["r3"].values[1] , 123.310, atol=.01)
@test isapprox(floorpivots(ohlc)["r2"].values[1] , 119.52, atol=.01)
@test isapprox(floorpivots(ohlc)["r1"].values[1] , 115.73, atol=.01)
@test isapprox(floorpivots(ohlc)["pivot"].values[1], 108.71, atol=.01)
@test isapprox(floorpivots(ohlc)["s1"].values[1] , 104.92, atol=.01)
@test isapprox(floorpivots(ohlc)["s2"].values[1] , 97.900, atol=.01)
@test isapprox(floorpivots(ohlc)["s3"].values[1] , 94.110, atol=.01)
@test floorpivots(ohlc).timestamp[end] == Date(2001,12,31)
end


@testset "woodiespivots" begin
# @test_approx_eq 97.37500000000001 value(wr4)[2] # values NEED to be verified with online calculators
# @test_approx_eq 88.62500000000001 value(ws4)[2]
@test isapprox(woodiespivots(ohlc)["r3"].values[1] , 124.465, atol=.01)
@test isapprox(woodiespivots(ohlc)["r2"].values[1] , 118.480, atol=.01)
@test isapprox(woodiespivots(ohlc)["r1"].values[1] , 113.655, atol=.01)
@test isapprox(woodiespivots(ohlc)["pivot"].values[1], 107.670, atol=.01)
@test isapprox(woodiespivots(ohlc)["s1"].values[1] , 102.845, atol=.01)
@test isapprox(woodiespivots(ohlc)["s2"].values[1] , 96.8625, atol=.01)
@test isapprox(woodiespivots(ohlc)["s3"].values[1] , 92.035, atol=.01)
@test woodiespivots(ohlc).timestamp[end] == Date(2001,12,31)
end


end # @testset "Levels"
Loading

0 comments on commit 865d096

Please sign in to comment.