vectorbt
vectorbt copied to clipboard
is it possible to compile our "arsenal of Numba-compiled functions" ahead of time ---AOT when using portofolio class?
hi great library! when we call vbt.Portfolio
this class uses numba function at the workflow "Simulation phase"
at this stage numba cost almost 10 seconds ususally.
compile these numba functions njit is easy using numba cc.compile()
but is there a way to let the Protfolio call the compiled numba function (AOT)?
Most functions cannot be compiled ahead of time because they take other functions as arguments.
For example, Portfolio.from_signals
and Portfolio.from_order_func
both take UDFs and so they cannot be cached (you will get a warning). But can pass some dummy input and they will be cached at least for the current runtime.
Portfolio.from_orders
, on the other hand, does not rely on UDFs and it is cached automatically. Running it once will execute it without compilation overhead, even if you start a new Python session.