Skip to content

Commit fa021bb

Browse files
committed
Fix use_numba [ci deploy]
1 parent 9251fc6 commit fa021bb

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

vectorbt/portfolio/base.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2205,10 +2205,9 @@ def from_order_func(cls: tp.Type[PortfolioT],
22052205

22062206
# Perform calculation
22072207
if row_wise:
2208-
if use_numba:
2209-
simulate_func = nb.simulate_row_wise_nb
2210-
else:
2211-
simulate_func = nb.simulate_row_wise_nb.py_func
2208+
simulate_func = nb.simulate_row_wise_nb
2209+
if not use_numba and hasattr(simulate_func, 'py_func'):
2210+
simulate_func = simulate_func.py_func
22122211
order_records, log_records = simulate_func(
22132212
target_shape=target_shape_2d,
22142213
close=to_2d(close, raw=True),
@@ -2242,10 +2241,9 @@ def from_order_func(cls: tp.Type[PortfolioT],
22422241
max_logs=max_logs
22432242
)
22442243
else:
2245-
if use_numba:
2246-
simulate_func = nb.simulate_nb
2247-
else:
2248-
simulate_func = nb.simulate_nb.py_func
2244+
simulate_func = nb.simulate_nb
2245+
if not use_numba and hasattr(simulate_func, 'py_func'):
2246+
simulate_func = simulate_func.py_func
22492247
order_records, log_records = simulate_func(
22502248
target_shape=target_shape_2d,
22512249
close=to_2d(close, raw=True),

0 commit comments

Comments
 (0)