From 0586fd2501fee0e61802fe79e0d738d063b543db Mon Sep 17 00:00:00 2001 From: MuslemRahimi Date: Sat, 7 Sep 2024 11:20:18 +0200 Subject: [PATCH] add roic rule --- app/restart_json.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/restart_json.py b/app/restart_json.py index 774d794..a86d457 100755 --- a/app/restart_json.py +++ b/app/restart_json.py @@ -355,6 +355,14 @@ def get_financial_statements(item, symbol): item['profitPerEmployee'] = round((item['netIncome'] / item['employees']),2) except: item['profitPerEmployee'] = None + try: + tax_rate = item['incomeTaxExpense'] / item['incomeBeforeTax'] if item['incomeBeforeTax'] != 0 else 0 + nopat = item['operatingIncome'] * (1 - tax_rate) + invested_capital = item['totalDebt'] + item['totalEquity'] + item['returnOnInvestedCapital'] = round((nopat / invested_capital)*100,2) if invested_capital != 0 else None + except: + item['returnOnInvestedCapital'] = None + return item