From 63cddb5caf62255528c2a9853e0eff4322407f07 Mon Sep 17 00:00:00 2001 From: MuslemRahimi Date: Tue, 1 Oct 2024 01:28:20 +0200 Subject: [PATCH] add ai score to screener --- app/cron_info_text.py | 3 +++ app/restart_json.py | 20 +++++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/app/cron_info_text.py b/app/cron_info_text.py index d1dc007..0056b35 100644 --- a/app/cron_info_text.py +++ b/app/cron_info_text.py @@ -288,6 +288,9 @@ data = { 'fundamentalAnalysis': { 'text': 'Accuracy of the AI model’s predictions regarding the likelihood of a bullish trend over the next 3 months. This percentage reflects how well the model forecasts future market movements.' }, + 'score': { + 'text': 'Our AI model analyzes fundamental, technical, and statistical indicators to predict the probability of a bullish trend over the next 3 months. ' + }, 'currentRatio': { 'text': 'The current ratio is used to measure a company`s short-term liquidity. A low number can indicate that a company will have trouble paying its upcoming liabilities.', 'equation': 'Current Ratio = Current Assets / Current Liabilities' diff --git a/app/restart_json.py b/app/restart_json.py index 3e81a3d..31adb6b 100755 --- a/app/restart_json.py +++ b/app/restart_json.py @@ -15,7 +15,6 @@ import re import hashlib import glob from tqdm import tqdm -from utils.country_list import country_list from dotenv import load_dotenv import os @@ -555,6 +554,25 @@ async def get_stock_screener(con): except: item['fundamentalAnalysis'] = {"accuracy": None} + try: + with open(f"json/ai-score/companies/{symbol}.json", 'r') as file: + score = orjson.loads(file.read())['score'] + + if score == 10: + item['score'] = 'Strong Buy' + elif score in [7,8,9]: + item['score'] = 'Buy' + elif score in [4,5,6]: + item['score'] = 'Hold' + elif score in [2,3]: + item['score'] = 'Sell' + elif score == 1: + item['score'] = 'Strong Sell' + else: + item['score'] = None + except: + item['score'] = None + try: with open(f"json/forward-pe/{symbol}.json", 'r') as file: res = orjson.loads(file.read())