Latest release notes¶
All notable changes in reverse chronological order.
Version 2024.2.22¶
- Doing the star-import
from vectorbtpro import *will return a minimal list of imports that are essential to working with VBT, such aspd,np, andvbtitself. This will not pollute the namespace with VBT-own objects as they are exclusively accessible fromvbt. In case of any static analysis issues, VBT can still be imported in a classic way -import vectorbtpro as vbt. The start import behavior can be controlled by the settingstar_importin _settings.importing, which accepts be "all", "vbt" (previous behavior), "minimal" (current behavior), and "none". This setting can be changed only via a configuration file. All notebooks and website examples have been updated accordingly. - Implemented portfolio methods (and their corresponding properties) for calculating the average entry price and exit price of each position and bar - Portfolio.get_position_entry_price and Portfolio.get_position_exit_price respectively
- Modeling of signal pairs for SignalsAccessor.between_ranges and other methods has been redesigned and is now based on
relationof type SignalRelation. For example, behavior offrom_other=Truecan now be replicated withrelation="manyone". Also, changedothertotargetacross SignalsAccessor. - Implemented the following methods for signal unraveling:
- SignalsAccessor.unravel: "unravels" each signal to a separate column
- SignalsAccessor.unravel_between: "unravels" each signal pair in one or two masks to a separate column
- SignalsAccessor.ravel: "ravels" all separate columns back into one column
- Standardized datetime and frequency functionality across the entire codebase. Added new frequency aliases, such as week days and months; for example,
every="monday"will return an index with only mondays. Frequency is now allowed to be a date offset of any complexity, and will be stored in its original format. Only when actually needed, it can be converted into a timedelta by approximation. Also, frequency can now being detected automatically from index when set to"auto"(this is the new global default, see infer_index_freq for other options). Same for year frequency (the default remains "365 days" for backward compatibility, see ReturnsAccessor.get_year_freq for other options). - Records.to_readable and MappedArray.to_readable accept
expand_columns=Trueto split column tuples into multiple columns - one per level - Fixed row stacking for one-dimensional NumPy arrays
- Fixed handling of colons in symbols such as
"BTC/USDT:USDT"in CCXTData. Previously, the first part was mistaken for an exchange even if an exchange was provided. - Added option
if_existsto IndicatorFactory.register_custom_indicator - Added option
magnet_kwargsto Data.run - Added Python 3.12 support
Version 2024.1.30¶
- Introduced a new option
cash_deposits_as_inputthat controls whether cash deposits should be added to the input value rather than subtracted from the output value when computing a return - Implemented the methods IndicatorBase.dropna and Data.dropna to drop any missing values from an indicator and a data instance respectively
- Implemented or extended the 4 most basic operations on data. Each operation comprises 5 different methods: one for columns, one for keys, one for features, one for symbols, and one that can determine the right method automatically (listed below). Also, features and symbols have become case-insensitive.
- Data.select: select one or more features or symbols
- Data.add: add (exactly) one feature or symbol
- Data.rename: rename one or more features or symbols
- Data.remove: remove one or more features or symbols
- Expanded registration of custom indicators. A custom indicator now can be registered under a custom location (which defaults to
"custom"). Custom locations are effectively indicator groups or tags, and are stored as keys in IndicatorFactory.custom_indicators; they can be listed with IndicatorFactory.list_custom_locations. Built-in indicators can be added to custom locations too. - Data.run can return a data instance
- Fixed path resolution and handling of keys with a period (
.) in HDFData - Fixed filtering by the arguments
startandendin DuckDBData - Improved resolution of datetime-like arguments (specifically
dt_stop) in BasePreparer.prepare_dt_obj. When providing a date such as"2024-01-01"or a time such as"16:00", the stop is marked at the provided datetime. When providing a frequency such as"daily", the stop is marked at the end of the last bar of the current period. This behavior can be changed by overridinglast_beforein the argument config of the particular argument. Also, when providing just a time, the marked datetime will overflow to the next day if the requested time comes before the current time. In addition, the user can dynamically pass changes to the argument config by passingarg_configas a regular argument, which will be merged over the actual argument config. - Implemented NB function init_FSInOutputs_nb to initialize in-outputs
- Implemented a function get_api_ref that for any VBT object returns the corresponding link to the private website and source code. Another function open_api_ref does the same but then automatically opens the link in a browser. If a third-party object was provided, parses the path to the object and opens the first search result on DuckDuckGo.
- Fixed an error that gets raised when providing an integer (as opposed to floating) account state field to
long_buy_nb,long_sell_nb,short_sell_nb, orshort_buy_nbin portfolio.nb.core - Most classes now have a method Chainable.pipe that enables built-in and user-defined methods in method chains. Supports deep attribute retrieval.
- Added a light and dark color palette toggle to the website
- Wrote Easily cross-validate parameters to boost your trading strategy