mrhappyasthma / IsThisStockGood

A tool for evaluating companies using the Rule #1 investing principles.
http://www.isthisstockgood.com
22 stars 10 forks source link

Crash found for some tickers. #46

Closed mrhappyasthma closed 2 years ago

mrhappyasthma commented 2 years ago
Traceback (most recent call last):
  File "D:\GitHub\IsThisStockGood\flask\Lib\site-packages\flask\app.py", line 2464, in __call__
    return self.wsgi_app(environ, start_response)
  File "D:\GitHub\IsThisStockGood\flask\Lib\site-packages\flask\app.py", line 2450, in wsgi_app
    response = self.handle_exception(e)
  File "D:\GitHub\IsThisStockGood\flask\Lib\site-packages\flask\app.py", line 1867, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "D:\GitHub\IsThisStockGood\flask\Lib\site-packages\flask\_compat.py", line 39, in reraise
    raise value
  File "D:\GitHub\IsThisStockGood\flask\Lib\site-packages\flask\app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "D:\GitHub\IsThisStockGood\flask\Lib\site-packages\flask\app.py", line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "D:\GitHub\IsThisStockGood\flask\Lib\site-packages\flask\app.py", line 1821, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "D:\GitHub\IsThisStockGood\flask\Lib\site-packages\flask\_compat.py", line 39, in reraise
    raise value
  File "D:\GitHub\IsThisStockGood\flask\Lib\site-packages\flask\app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "D:\GitHub\IsThisStockGood\flask\Lib\site-packages\flask\app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "D:\GitHub\IsThisStockGood\main.py", line 28, in search
    template_values = fetchDataForTickerSymbol(ticker)
  File "D:\GitHub\IsThisStockGood\src\DataFetcher.py", line 60, in fetchDataForTickerSymbol
    margin_of_safety_price, sticker_price = _calculateMarginOfSafetyPrice(ratios, pe_ratios, yahoo_finance_analysis)
  File "D:\GitHub\IsThisStockGood\src\DataFetcher.py", line 134, in _calculateMarginOfSafetyPrice
    margin_of_safety_price, sticker_price = \
TypeError: cannot unpack non-iterable NoneType object

Line: https://github.com/mrhappyasthma/IsThisStockGood/blob/master/src/DataFetcher.py#L134

Root cause is that the function can return None: https://github.com/mrhappyasthma/IsThisStockGood/blob/97b224a11472892cc760cdd340ae93749e10c82d/src/RuleOneInvestingCalculations.py#L133

I suspect this needs to return None, None.

Example ticker AMCR.