-
Hi, I want to use it as my core component in personal TA and investing, nevertheless, I am a bit confused about the main focus. I was experimenting with Here is the link on performance comparison - https://colab.research.google.com/drive/1szojVeKW_HWHr6iXEJogD0PsPJ6Caa7s?usp=sharing Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 7 replies
-
A follow-up question could be: why should we use numba rather than numpy for vector/matrix-based operations? |
Beta Was this translation helpful? Give feedback.
-
Answering your first question: vectorbt does diverse pre- and postprocessing on your inputs, parameters, and outputs. If it simply called the particular talib function, the Remember that a major focus of vectorbt is in hyperparameter optimization through the construction of large hyperparameter grids, which involve wide 2-dimensional arrays. Talib doesn't handle 2D so you must explicitly loop through columns and call the talib function on each. This is automatically handled by vectorbt, so all you have to do is give input of any shape and a list of parameters, and the rest is done for you. The price you pay for this is a bit slower execution. If you don't want all these features, of course, you should use talib library and nothing else. The reason why Answering the question on what the use case of vectorbt is: everything you mentioned. Talib is just a library with technical indicators - many sophisticated strategies don't use those at all. Running indicators is not vectorbt's main function. The main competitive advantage of vectorbt is the backtesting speed, that is, the amount of time needed to convert an array of signals into a performance metric. Without exaggeration, there is nothing comparable in the open-source. The only backtesters that can beat vectorbt are written in pure Java and C(++), but they don't have the flexibility of Python that vectorbt enjoys. On the last question: because in Numba you can write any operation as a loop and it will have a slightly lower but still similar speed to a vectorized operation in NumPy. Except that your code is now more readable and allows a lot of use cases, such as calling functions inside functions. Plus you cannot or it's not worth the effort to express some backtesting operations in NumPy (just try implementing expanding standard deviation). |
Beta Was this translation helpful? Give feedback.
-
Some smart guy make a very fast backtest and decides to make a library. More and more features get added, other people request other features, you cannot argue against it, it is only a few ms induced delay, but they mass up, and suddenly its not very fast any more. df["GC"] = df.ta.sma(50, append=True) > df.ta.sma(200, append=True) for comparison, using pandas/numpy exclusively i can backtest 4 million candles in 100 ms(thats 25,900 times as fast), on a test using twice as many bools for entry, and i know that you can even enhance this speed by multiples(this is just on a single core, so trust me when i say multiples) PS sorry for commenting on an old thread, im not really sure whether the community think that is appropriate to do or not. |
Beta Was this translation helpful? Give feedback.
Answering your first question: vectorbt does diverse pre- and postprocessing on your inputs, parameters, and outputs. If it simply called the particular talib function, the
vbt.talib
method would yield the same performance. But what happens is this in order to broadcast inputs and parameters, convert outputs back to pandas, build multi-level columns, prepare mappers for indexing, etc. This all introduces an ms overhead. In fact, if you run the same on an input of length1e6
, talib function executes in 27.2 ms while vectorbt in 48 ms. The difference will narrow with the number of elements.Remember that a major focus of vectorbt is in hyperparameter optimization through the construction of…