For analyzing individual assets, we will build the StockAnalyzer class, which calculates metrics for a given asset. We can use the UML diagram to see all the metrics that are available:
The StockAnalyzer will be initialized with the data for the asset we want to perform a technical analysis on. This means that our __init__() method will need to accept the data as a parameter:
class StockAnalyzer: """ Class for providing metrics for technical analysis of a stock. """ @validate_df(columns={'open', 'high', 'low', 'close'}) def __init__(self, df): self.data = df
Most of the calculations for our technical analysis will ...