Closed janckerchen closed 1 week ago
should either import all common functions such that modules prefixes are only used for the least common or just use prefixes for all the calls, do you prefer to use modules prefixes?
the call to load_ohlcv
IIRC is used to load all the pairs data from storage asynchronously (they should be cached in the zarr store). TBH the fill!
function over the strategy could be made async and then the load_ohlcv func can be removed
I prefer the approach you used without the prefix. But I don't see these symbols(load_ohlcv
or fetch_ohlcv
) exported anywhere in Engine, and searching with import .* fetch_ohlcv
nor did I search for these symbols imported anywhere. How is it possible to call it without a prefix?
The only thing I could find was two imports in the @enviroment!
macro, but they were both lower-level interfaces, not interfaces over strategy in Engine.
using .da: load_ohlcv
using .Watchers.Fetch: fetch_ohlcv
Engine
implements higher level functions for load/fetch_ohclv see:
https://github.com/panifie/PingPong.jl/blob/3326d57cc8b8fcaeb66e5fc8b2d1c6a5342837dd/Engine/src/functions.jl#L5
the functions are imported from the modules that define the lower level ones (Data
for load_ohlcv
and Fetch
for fetch_ohlcv
) both in Engine
and in the @environment!
macro
remember that in julia import
means the the methods are defined over the same function name (so using Engine: load_ohlcv, fetch_ohlcv
is same as using Data: load_ohlcv; using Fetch: fetch_ohlcv
Thanks, for giving me some more insight into julia's dispatch
mechanism. I was under the mistaken impression that dispatch
only happens within the scope of the module specified by using
or import
.
Julia's design looks a bit surprising. Maybe adding using Engine: load_ohlcv, fetch_ohlcv
to the @environment!
macro would be better understood by julia newbies reading the source code.
While studying the example code in the library documentation, I have a few questions.
fetch_ohlcv
andload_ohlcv
come from Engine, but I didn't see these methods exported. Why not use theegn.
prefix, like withst.
?load_ohlcv(s)
is puzzling. The return value ofData.load_ohlcv(...)
isn't used, and it seems to serve no useful purpose here.