Hello,
I’m looking for a way to “inspect” a Julia source code from an other Julia code ie I would like to ensure that a code which is stored in a strat.jl
file contains an init
function from an Julia code named runner.jl
.
I did
runner.jl
using ArgParse
function backtest(strategy)
@info "Running '$strategy'"
include(strategy)
initialize(nothing)
end
function parse_commandline()
s = ArgParseSettings()
@add_arg_table! s begin
"--opt1"
help = "an option with an argument"
"--opt2", "-o"
help = "another option with an argument"
arg_type = Int
default = 0
"--flag1"
help = "an option without argument, i.e. a flag"
action = :store_true
"action"
help = "action (download, backtest, ...)"
required = true
"strategy"
help = "filename of a strategy"
required = true
end
return parse_args(s)
end
function main()
@info "begin of runner"
parsed_args = parse_commandline()
@info "Parsed args:"
for (arg, val) in parsed_args
@info " $arg => $val"
end
if parsed_args["action"] == "backtest"
backtest(parsed_args["strategy"])
end
@info "end of runner"
end
main()
and strat.jl
function initialize(state)
println("strat init")
end
function handler1(state, data)
println("handler1")
end
but it raises an error that I’ve never seen before…
The applicable method may be too new: running in world age 33497, while current world is 33499.
Code should be run like this
julia runner.jl backtest strat.jl
Any idea how to tackle that ? Sorry if that’s trivial I haven’t looked at Julia recently.
Thanks