BtEngine

BtEngine is a backtesting module designed to accept close prices outputted by yfinance.Ticker or yfinance.Tickers. It employs a strategy stored in BtStrategy and iterates over the historical to test the performance of a portfolio when actively trading.

__init__ Arguments

Attributes

Methods

set_holdings

Method to set holdings using portfolio weights before the run.

Params: - weights -> dict[str, float]: dict of stock symbols and their weights - inv_percent -> float: percentage of starting cash balance to invest in the portfolio

Returns:

run

Run the engine to perform iterative backtesting with the pre-determined strategy

Params: - None

Returns:

plot_history

Display a matplotlib.pyplot figure that contains key information regarding the performance of the selected backtesting strategy and portfolio.

Params: - None

Returns: - None