bugfixing screener margins

This commit is contained in:
MuslemRahimi 2025-01-13 18:12:57 +01:00
parent 947d25f6c5
commit 0ab8bf252d

View File

@ -299,8 +299,8 @@ 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','longTermDebtToCapitalization','totalDebtToCapitalization']: if 'growth' in file_path or key in ['longTermDebtToCapitalization','totalDebtToCapitalization']:
value *= 100 # Multiply by 100 for percentage value = value*100 # Multiply by 100 for percentage
data[key] = round(value, 2) if value is not None else None data[key] = round(value, 2) if value is not None else None
except (ValueError, TypeError): except (ValueError, TypeError):
@ -710,6 +710,7 @@ async def get_stock_screener(con):
#Financial Statements #Financial Statements
item.update(get_financial_statements(item, symbol)) item.update(get_financial_statements(item, symbol))
try: try:
with open(f"json/financial-statements/income-statement/annual/{symbol}.json", 'r') as file: with open(f"json/financial-statements/income-statement/annual/{symbol}.json", 'r') as file:
res = orjson.loads(file.read()) res = orjson.loads(file.read())