![]() InitializationĪfter preparation step, the user must first build the model using backtest_model from the library. Of the data for the strategy to be tested on. Note 2: If the strategy requires extra data to function, make sure that the index of extra data matches that Note 1: The library provides several built-in datasets for users' reference. Other than the strategy function, the user also needs to prepare the data for the strategy toīe tested on, as well as the extra data for specific strategies to function, if applicable. In the data on which the strategy is to be tested throughout the whole process. Note 2: The sequence of assets in the return of the function should be consistent with the sequence of assets Note 1: The function must only return ONE weight allocation for each period. Return a portfolio weight allocation, denoted by w here, that sums up to 1, in the form of np.ndarray or ![]() Or need to refer to past portfolios to construct a new portfolio for the current period. Should corresponds to involved_data_type in the model initialization step later in this section.Įxtra_data and historical_portfolio are optional arguments if the strategy needs extra data Where list_df is the list of dataframes that the strategy works with in each period, the sequence of which If it is the latter, it needs to be realised in Python function with signature def strategy_name ( list_df, extra_data, historical_portfolio ): pass return w pip install portfolio_backtesterīefore calling the library, user should decide whether he/she wants to use built-in portfolio construction strategies, orĭefines one himself/herself. Use the package manager pip to install portfolio_backtester. The following libraries are required for the use of portfolio_backtester Standard, the library enforces a fair game for different strategies by competing on a same level using future informationto build portfolio in the current period. Under varoius scenarios, without worrying about the possibility of cheating,Į.g. Strategies, so that users can consistently compare the performance of different strategies ![]() To provide benchmark performance evaluation for all portfolio construction Since the library is flexible enough to be compatible with most portfolio construction strategies, it aims portfolio_backtester is setting a universal standard for portfolio performance evaluation.To meet the need of portfolio construction strategy, etc. Transaction costs to gauge the impact of trading activities on the strategy,Ībility to take in extra data and trace back prior portfolios Such as change of frequency to enable testing on different timescales, price-impact models and Various inputs can be modified to suit the needs of different strategies and backtesting scenarios, portfolio_backtester is flexible and versatile.To make the library light, fast and efficient. The library is built on numpy and pandas, and mostly utilizes matrix operations to handle heavy calculations portfolio_backtester is fast and efficient, compatible with most dataframe and numpy objects and functions.Net returns, sharpe ratio, certainty equivalent returns, turnover, etc. It pre-built-in or user-defined, and the data that the user wish the strategy to be tested on, the library can calculate several evaluation metrics of the portfolio, including Given a portfolio construction strategy (a function that takes in stock-related data and returns portfolio weights), be portfolio_backtester is a Python library for backtesting built-in or user-defined portfolio construction strategies.
0 Comments
Leave a Reply. |