Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
femtotrader committed Apr 23, 2024
1 parent c0e142a commit ff6cb2f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ const weights = [0.4, 0.4, 0.2]
@testset "SimpleAssetReturn with period=1 and Rocket" begin
stat = SimpleAssetReturn{Float64}()
source = from(TSLA)

mapped_source =
source |>
map(Union{Missing,Float64}, price -> (fit!(stat, price); value(stat)))
Expand Down Expand Up @@ -110,6 +111,7 @@ const weights = [0.4, 0.4, 0.2]
@testset "several points" begin
stat = LogAssetReturn{Float64}()
source = from(TSLA)

mapped_source =
source |>
map(Union{Missing,Float64}, price -> (fit!(stat, price); value(stat)))
Expand Down Expand Up @@ -142,13 +144,14 @@ const weights = [0.4, 0.4, 0.2]
@testset "StdDev of prices" begin
_stddev = StdDev{Float64}()
fit!(_stddev, TSLA)
@test isapprox(value(_stddev), 60.5448, atol = ATOL)
@test isapprox(value(_stddev), 60.5448, atol = ATOL)
end

@testset "StdDev of returns" begin
source = from(TSLA)
_ret = SimpleAssetReturn{Float64}()
_stddev = StdDev{Float64}()

mapped_source =
source |>
map(Union{Missing,Float64}, price -> (fit!(_ret, price);
Expand All @@ -168,6 +171,7 @@ const weights = [0.4, 0.4, 0.2]
source = from(TSLA)
_ret = SimpleAssetReturn{Float64}()
_mean = Mean()

mapped_source =
source |>
map(Union{Missing,Float64}, price -> (fit!(_ret, price);
Expand All @@ -186,6 +190,7 @@ const weights = [0.4, 0.4, 0.2]
source = from(TSLA)
_ret = SimpleAssetReturn{Float64}()
_mean = GeometricMeanReturn{Float64}()

mapped_source =
source |>
map(Union{Missing,Float64}, price -> (fit!(_ret, price);
Expand Down Expand Up @@ -313,11 +318,9 @@ const weights = [0.4, 0.4, 0.2]
end

@testset "Moments" begin

source = from(TSLA)
_ret = SimpleAssetReturn{Float64}()
_moments = AssetReturnMoments{Float64}()
#_moments = Moments()

mapped_source =
source |>
Expand Down

0 comments on commit ff6cb2f

Please sign in to comment.