MarketTechnicals.jl
MarketTechnicals.jl copied to clipboard
No method matching lagfill
Hey, seems there's a bug in a call to lagfill
:
ERROR: MethodError: no method matching lagfill(::TimeArray{Float64, 2, DateTime, Matrix{Float64}}, ::Int64, ::Matrix{Float64})
Closest candidates are:
lagfill(::TimeArray, ::Integer, ::AbstractFloat) at /home/joe/.julia/packages/MarketTechnicals/5qm8H/src/utilities.jl:90
Stacktrace:
[1] dpo(ta::TimeArray{Float64, 2, DateTime, Matrix{Float64}}, n::Int64)
@ MarketTechnicals ~/.julia/packages/MarketTechnicals/5qm8H/src/momentum.jl:350
It happens when it's used on a TimeArray
with second dim > 1 as far as I can tell.
Something like this
function lagfill(ta::TimeArray, r1::Integer, fill::AbstractMatrix{T}) where T<:AbstractFloat
@assert size(fill, 2) == size(ta, 2)
_lta = lag(ta, r1, padding = true)
_lta_values = values(_lta)
for i in 1:r1
_lta_values[i, :] = fill
end
TimeArray(timestamp(ta), _lta_values, colnames(ta))
end
Should fix it.
ah, could you send a PR for it?