Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example from README is not working #25

Open
leferrad opened this issue May 31, 2020 · 2 comments
Open

Example from README is not working #25

leferrad opened this issue May 31, 2020 · 2 comments

Comments

@leferrad
Copy link

I found very interesting this tool, so I started from the example posted in the README but I was not able to make it work. I'm using Julia 1.4.2. Here is the full stack trace, but the error occurs when creating the Universe instance (apparently, some bad access in an empty list):

               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.4.2 (2020-05-23)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> using Strategems, Indicators, Temporal, Dates
julia> assets = ["CHRIS/CME_CL1", "CHRIS/CME_RB1"]

2-element Array{String,1}:
 "CHRIS/CME_CL1"
 "CHRIS/CME_RB1"

julia> universe = Universe(assets)
# Universe:
    Asset 1:    CHRIS/CME_CL1

Error showing value of type Universe:
ERROR: BoundsError: attempt to access 0-element Array{Date,1} at index [1]
Stacktrace:
 [1] getindex(::Array{Date,1}, ::Int64) at ./array.jl:788
 [2] show(::IOContext{REPL.Terminals.TTYTerminal}, ::Universe) at /home/leferrad/.julia/packages/Strategems/TJzbq/src/universe.jl:63
 [3] show(::IOContext{REPL.Terminals.TTYTerminal}, ::MIME{Symbol("text/plain")}, ::Universe) at ./multimedia.jl:47
 [4] display(::REPL.REPLDisplay, ::MIME{Symbol("text/plain")}, ::Any) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:137
 [5] display(::REPL.REPLDisplay, ::Any) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:141
 [6] display(::Any) at ./multimedia.jl:323
 [7] #invokelatest#1 at ./essentials.jl:712 [inlined]
 [8] invokelatest at ./essentials.jl:711 [inlined]
 [9] print_response(::IO, ::Any, ::Bool, ::Bool, ::Any) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:161
 [10] print_response(::REPL.AbstractREPL, ::Any, ::Bool, ::Bool) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:146
 [11] (::REPL.var"#do_respond#38"{Bool,REPL.var"#48#57"{REPL.LineEditREPL,REPL.REPLHistoryProvider},REPL.LineEditREPL,REPL.LineEdit.Prompt})(::Any, ::Any, ::Any) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:729
 [12] #invokelatest#1 at ./essentials.jl:712 [inlined]
 [13] invokelatest at ./essentials.jl:711 [inlined]
 [14] run_interface(::REPL.Terminals.TextTerminal, ::REPL.LineEdit.ModalInterface, ::REPL.LineEdit.MIState) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.4/REPL/src/LineEdit.jl:2354
 [15] run_frontend(::REPL.LineEditREPL, ::REPL.REPLBackendRef) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:1055
 [16] run_repl(::REPL.AbstractREPL, ::Any) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:206
 [17] (::Base.var"#764#766"{Bool,Bool,Bool,Bool})(::Module) at ./client.jl:383
 [18] #invokelatest#1 at ./essentials.jl:712 [inlined]
 [19] invokelatest at ./essentials.jl:711 [inlined]
 [20] run_main_repl(::Bool, ::Bool, ::Bool, ::Bool, ::Bool) at ./client.jl:367
 [21] exec_options(::Base.JLOptions) at ./client.jl:305
 [22] _start() at ./client.jl:484

Let me know if you need something else to reproduce this error, in order to detect the bug and make a PR to fix it.

@dysonance
Copy link
Owner

Hey @leferrad thanks for raising this as a potential issue. I tried doing what you did above but didn't get the issue (see code block below). It's possible that the version you have checked out locally doesn't have the latest updates/fixes incorporated. I've created a request to publish the latest version of the code to the public Julia package registry. In the meantime, perhaps try pulling the master branch of this repo down to your computer and test with that?

$ julia
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.3.0 (2019-11-26)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

:> using Strategems, Indicators, Temporal, Dates

:> assets = ["CHRIS/CME_CL1", "CHRIS/CME_RB1"]
2-element Array{String,1}:
 "CHRIS/CME_CL1"
 "CHRIS/CME_RB1"

:> universe = Universe(assets)
# Universe:
    Asset 1:    CHRIS/CME_CL1
        (No Data Gathered)
    Asset 2:    CHRIS/CME_RB1
        (No Data Gathered)

@leferrad
Copy link
Author

leferrad commented Jun 2, 2020

Great! I've cloned this repository and executed the same example, and now everything works. I guess it is a problem related to the version registered in Julia registry, so feel free to close this issue or keep it until the registered package is fixed and the example in the README works with that released version. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants