Find your trading edge, using the fastest engine for backtesting, algorithmic trading, and research.
Here's all the good stuff included in the v0.21.0 release!
Records
(or any subclass) constructor, it's now saved in the config of the class. The config also stores information on field titles, mappings, and other meta. Inheritance is achieved by using a class decorator that overrides the config of the base class with the config of the subclass. This allows seamless extending of records.Ranges
that allows analysis of any records that have a start time and an end time. For example, it can be used to analyze the distance between signals. It's inherited by both Drawdowns
and Trades
.Ranges
.reverse
flag to stop-signal generation based on OHLC data to control the direction (long/short).call_seq
in Portfolio
and ts
/close
in Drawdowns
, Orders
, and Trades
optional to save memory.close
and segment_mask
arrays in Portfolio.from_order_func
to save memory.Portfolio.from_order_func
with flexible=True
) to lift the limit of one order per symbol and timestamp. Instead of following the call sequence provided by call_seq
, the users can now issue as many orders as they want and in an arbitrary column order within a segment, and break out of the loop whenever they want. This mode is even faster than the strict one.Portfolio.from_signals
to work internally using a custom signal function and direction-aware arrays. Direction-aware arrays are 4 arrays: long entries, long exits, short entries, and short exits. They allow more signal combinations than the entries and exits arrays combined with the direction array. Additionally, the users can provide a custom signal function to generate signals dynamically. The same signal function by default is used to translate entries
, exits
, and direction
to direction-aware arrays, for example.Portfolio
that supports passing custom functions (such as from_order_func
and from_signals
) now supports templates such that the users have more power and convenience in broadcasting custom arrays and passing them as arguments.Portfolio
.stats
method for computing common statistics, there is now also the plots
method for plotting common plots (+ it's as easily extendible as stats).qs
attribute). This allows calling any quantstats function directly from the portfolio (+ vectorbt automatically passes all relevant arguments such as benchmark returns).generate_ohlc_stop_exits
now behaves similarly to Portfolio.from_signals
.iteratively
to chain
and added more options to base generation functions.Portfolio.from_holding
from signals to orders.df.vbt(freq='d').signals
is now the same as df.vbt.signals(freq='d')
).