update stock screener
This commit is contained in:
parent
90680b687a
commit
a392a6bb3e
@ -130,7 +130,7 @@ def process_financial_data(file_path, key_list):
|
|||||||
if key in res:
|
if key in res:
|
||||||
try:
|
try:
|
||||||
value = float(res[key])
|
value = float(res[key])
|
||||||
if 'growth' in file_path or key in ['grossProfitMargin','netProfitMargin','pretaxProfitMargin','operatingProfitMargin']:
|
if 'growth' in file_path or key in ['grossProfitMargin','netProfitMargin','pretaxProfitMargin','operatingProfitMargin','longTermDebtToCapitalization','totalDebtToCapitalization']:
|
||||||
value *= 100 # Multiply by 100 for percentage
|
value *= 100 # Multiply by 100 for percentage
|
||||||
data[key] = round(value, 2)
|
data[key] = round(value, 2)
|
||||||
except (ValueError, TypeError):
|
except (ValueError, TypeError):
|
||||||
@ -363,11 +363,19 @@ def get_financial_statements(item, symbol):
|
|||||||
item['returnOnInvestedCapital'] = round((nopat / invested_capital)*100,2) if invested_capital != 0 else None
|
item['returnOnInvestedCapital'] = round((nopat / invested_capital)*100,2) if invested_capital != 0 else None
|
||||||
except:
|
except:
|
||||||
item['returnOnInvestedCapital'] = None
|
item['returnOnInvestedCapital'] = None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
item['researchDevelopmentRevenueRatio'] = round((item['researchAndDevelopmentExpenses'] / item['revenue']) * 100,2)
|
item['researchDevelopmentRevenueRatio'] = round((item['researchAndDevelopmentExpenses'] / item['revenue']) * 100,2)
|
||||||
except:
|
except:
|
||||||
item['researchDevelopmentRevenueRatio'] = None
|
item['researchDevelopmentRevenueRatio'] = None
|
||||||
|
try:
|
||||||
|
item['shortTermDebtToCapitalization'] = round((item['shortTermDebt'] / item['marketCap']) * 100,1)
|
||||||
|
except:
|
||||||
|
item['shortTermDebtToCapitalization'] = None
|
||||||
|
try:
|
||||||
|
item['interestIncomeToCapitalization'] = round((item['interestIncome'] / item['marketCap']) * 100,1)
|
||||||
|
except:
|
||||||
|
item['interestIncomeToCapitalization'] = None
|
||||||
|
|
||||||
|
|
||||||
return item
|
return item
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user