add ai score to screener

This commit is contained in:
MuslemRahimi 2024-10-01 01:28:20 +02:00
parent 498edf7a80
commit 63cddb5caf
2 changed files with 22 additions and 1 deletions

View File

@ -288,6 +288,9 @@ data = {
'fundamentalAnalysis': {
'text': 'Accuracy of the AI models 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'

View File

@ -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())