-
I'm using Would this be the suggested approach using |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
@Sanjan611 yes, this is the way. Boolean arrays don't take much memory anyway. If any of your information pieces (such as price, size, etc.) is the same for all strategies, you can pass it as a pandas series and it will broadcast to a frame in a lazy way (without materializing, just by smart indexing - effectively no further memory occupation). So, for example, doing |
Beta Was this translation helpful? Give feedback.
@Sanjan611 yes, this is the way. Boolean arrays don't take much memory anyway. If any of your information pieces (such as price, size, etc.) is the same for all strategies, you can pass it as a pandas series and it will broadcast to a frame in a lazy way (without materializing, just by smart indexing - effectively no further memory occupation). So, for example, doing
vbt.Portfolio.from_signals([1, 2, 3], True, False, size=10)
is the same as doingvbt.Portfolio.from_signals([1, 2, 3], [True, True, True], [False, False, False], size=[10, 10, 10])
, but uses much less memory. If you pass a pandas series, it's assumed to be an element per row. If you pass a 1-dim NumPy array, it's assumed to b…