Skip to content

Backtesting multiple trading strategies against a single asset #169

Answered by polakowo
Sanjan611 asked this question in Q&A
Discussion options

You must be logged in to vote

@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 doing vbt.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…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Sanjan611
Comment options

Answer selected by Sanjan611
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants