I am trying to calculate the macd of a stock using the panada_ta library.
The function I created to do so (will post below) works perfectly fine when I run it on it's own, but I am trying to call it within a calc_technicals() functions that calls several methods to conduct technical analysis on stocks, but it says my df is of type NoneType
def calc_macd(self, stock: Stock):
macd = ta.macd(stock._df["Close"])
stock._macd = macd["MACD_12_26_9"].tail()[-1]
stock._macd_slow = macd["MACDs_12_26_9"].tail()[-1]
def calc_technicals(self):
for stock in self._watchlist:
self.calc_macd(stock)
self.calc_rsi(stock)
self.calc_vwap(stock)
self.calc_ema(stock)
This is the error I get when I call the calc_technicals() method