As with the previous two sections in this chapter, we will be writing a module with classes that will help carry out the main tasks. With technical analysis of assets, metrics (such as cumulative returns and volatility) are calculated to compare various assets to each other. We will need the StockAnalyzer class for technical analysis of a single asset and the AssetGroupAnalyzer for technical analysis of a group of assets. These classes are in the stock_analysis/stock_analyzer.py file.
As with the other modules, we will start with our docstring and imports:
"""Classes for technical analysis of assets."""
import math
from .utils import validate_df