diff --git a/isthisstockgood/DataFetcher.py b/isthisstockgood/DataFetcher.py index a546094..3b2b1ad 100644 --- a/isthisstockgood/DataFetcher.py +++ b/isthisstockgood/DataFetcher.py @@ -31,6 +31,7 @@ def fetchDataForTickerSymbol(ticker): 'debt_equity_ratio', 'margin_of_safety_price', 'current_price' + 'ten_cap_price' """ if not ticker: return None @@ -56,7 +57,9 @@ def fetchDataForTickerSymbol(ticker): margin_of_safety_price, sticker_price = \ _calculateMarginOfSafetyPrice(msn_money.equity_growth_rates[-1], msn_money.pe_low, msn_money.pe_high, msn_money.eps[-1], five_year_growth_rate) payback_time = _calculatePaybackTime(msn_money.equity_growth_rates[-1], msn_money.last_year_net_income, msn_money.market_cap, five_year_growth_rate) - computed_free_cash_flow = round(float(msn_money.free_cash_flow[-1]) * msn_money.shares_outstanding) + free_cash_flow_per_share = float(msn_money.free_cash_flow[-1]) + computed_free_cash_flow = round(free_cash_flow_per_share * msn_money.shares_outstanding) + ten_cap_price = 10 * free_cash_flow_per_share template_values = { 'ticker' : ticker, 'name' : msn_money.name if msn_money and msn_money.name else 'null', @@ -68,6 +71,7 @@ def fetchDataForTickerSymbol(ticker): 'cash': msn_money.free_cash_flow_growth_rates if msn_money and msn_money.free_cash_flow_growth_rates else [], 'total_debt' : msn_money.total_debt, 'free_cash_flow' : computed_free_cash_flow, + 'ten_cap_price' : ten_cap_price, 'debt_payoff_time' : round(float(msn_money.total_debt) / computed_free_cash_flow), 'debt_equity_ratio' : msn_money.debt_equity_ratio if msn_money and msn_money.debt_equity_ratio >= 0 else -1, 'margin_of_safety_price' : margin_of_safety_price if margin_of_safety_price else 'null', diff --git a/isthisstockgood/templates/js/search.js b/isthisstockgood/templates/js/search.js index 782d918..bc780cf 100644 --- a/isthisstockgood/templates/js/search.js +++ b/isthisstockgood/templates/js/search.js @@ -122,6 +122,22 @@ $(document).ready(function() { colorCellWithBackgroundColor('#' + key, Color.red()); } + // Update 10 Cap section + let ten_cap_key = 'ten_cap_price'; + let ten_cap_field_id = '#' + ten_cap_key; + let current_price = data['current_price']; + updateHtmlWithValueForKey(data, ten_cap_key, /*commas=*/true); + if (!data[ten_cap_key]) { + colorCellWithBackgroundColor(ten_cap_field_id, Color.red()); + } + if (current_price > data[ten_cap_key]) { + colorCellWithBackgroundColor(ten_cap_field_id, Color.red()); + } + else { + colorCellWithBackgroundColor(ten_cap_field_id, Color.green()); + } + + // Update Market Cap numbers updateHtmlWithValueForKey(data, 'average_volume', /*commas=*/true); let averageVolume = data['average_volume']; @@ -212,4 +228,4 @@ function colorCellWithIDForZeroBasedRange(id, range) { } colorCellWithBackgroundColor(id, backgroundColor); -} \ No newline at end of file +} diff --git a/isthisstockgood/templates/json/stock_data.json b/isthisstockgood/templates/json/stock_data.json index d783efa..c6192e3 100644 --- a/isthisstockgood/templates/json/stock_data.json +++ b/isthisstockgood/templates/json/stock_data.json @@ -15,6 +15,6 @@ "current_price" : {{ current_price }}, "sticker_price" : {{ sticker_price }}, "payback_time" : {{ payback_time }}, - "ten_cap" : {{ ten_cap }}, + "ten_cap_price" : {{ ten_cap_price }}, "average_volume" : {{ average_volume }} } diff --git a/isthisstockgood/templates/loading.html b/isthisstockgood/templates/loading.html index 8653943..f11b437 100644 --- a/isthisstockgood/templates/loading.html +++ b/isthisstockgood/templates/loading.html @@ -90,7 +90,7 @@ this.shadowRoot.append(style, wrapper); - this.animationTimeout = None; + this.animationTimeout = null; } static get observedAttributes() { return ['data-message']; } diff --git a/isthisstockgood/templates/searchbox.html b/isthisstockgood/templates/searchbox.html index dc0e44a..69f0f90 100644 --- a/isthisstockgood/templates/searchbox.html +++ b/isthisstockgood/templates/searchbox.html @@ -4,11 +4,11 @@