shayandavoodii / OnlinePortfolioSelection.jl

This package offers both traditional benchmark and newly developed Online Portfolio Selection (OPS) algorithms implementation.
https://shayandavoodii.github.io/OnlinePortfolioSelection.jl/dev/
MIT License
16 stars 3 forks source link

attempt to access 29-element Vector{Float64} at index [0] #81

Closed shayandavoodii closed 7 months ago

shayandavoodii commented 7 months ago

Error in running the dricorn function:

julia> res = dricornk(rand(3, 29), rand(29), 5, 10, 5, 10)
ERROR: BoundsError: attempt to access 29-element Vector{Float64} at index [0]
Stacktrace:
 [1] getindex
   @ .\essentials.jl:13 [inlined]
 [2] dricorn_expert(relative_prices::Matrix{…}, asset_ret::Matrix{…}, market_ret::Vector{…}, horizon::Int64, w::Int64, rho::Float64, t::Int64, n_assets::Int64, lambda::Float64)
   @ OnlinePortfolioSelection e:\Julia Forks\OPS.jl\src\Algos\DRICORNK.jl:180
 [3] dricornk(x::Matrix{…}, relpr_market::Vector{…}, horizon::Int64, k::Int64, w::Int64, p::Int64; lambda::Float64, init_budg::Int64, progress::Bool)
   @ OnlinePortfolioSelection e:\Julia Forks\OPS.jl\src\Algos\DRICORNK.jl:97
 [4] dricornk(x::Matrix{Float64}, relpr_market::Vector{Float64}, horizon::Int64, k::Int64, w::Int64, p::Int64)
   @ OnlinePortfolioSelection e:\Julia Forks\OPS.jl\src\Algos\DRICORNK.jl:52
 [5] top-level scope
   @ REPL[53]:1
Some type information was truncated. Use `show(err)` to see complete types.
shayandavoodii commented 7 months ago

It is related to the following line: https://github.com/shayandavoodii/OnlinePortfolioSelection.jl/blob/65f67a15977625c3c1aebe69a0a3df6b3ceebd53/src/Algos/DRICORNK.jl#L175