bugfixing
This commit is contained in:
parent
0ed18d3c10
commit
7d59885c36
@ -174,9 +174,9 @@ async def get_etf_provider(etf_con):
|
||||
if sorted_res:
|
||||
with open(f"json/etf/provider/{provider}.json", 'wb') as file:
|
||||
file.write(orjson.dumps(sorted_res))
|
||||
except:
|
||||
except Exception as e:
|
||||
print(e)
|
||||
pass
|
||||
|
||||
cursor.close()
|
||||
|
||||
|
||||
@ -205,8 +205,8 @@ async def get_magnificent_seven():
|
||||
'changesPercentage': changesPercentage, 'marketCap': marketCap, \
|
||||
'revenue': revenue})
|
||||
|
||||
except:
|
||||
pass
|
||||
except Exception as e:
|
||||
print(e)
|
||||
|
||||
if res_list:
|
||||
res_list = sorted(res_list, key=lambda x: x['marketCap'], reverse=True)
|
||||
@ -241,8 +241,8 @@ async def get_faang():
|
||||
'changesPercentage': changesPercentage, 'marketCap': marketCap, \
|
||||
'revenue': revenue})
|
||||
|
||||
except:
|
||||
pass
|
||||
except Exception as e:
|
||||
print(e)
|
||||
|
||||
if res_list:
|
||||
res_list = sorted(res_list, key=lambda x: x['marketCap'], reverse=True)
|
||||
@ -286,8 +286,8 @@ async def get_penny_stocks():
|
||||
'volume': volume
|
||||
})
|
||||
|
||||
except:
|
||||
pass
|
||||
except Exception as e:
|
||||
print(e)
|
||||
|
||||
if res_list:
|
||||
# Sort by market cap in descending order
|
||||
@ -336,8 +336,8 @@ async def get_oversold_stocks():
|
||||
'rsi': rsi
|
||||
})
|
||||
|
||||
except:
|
||||
pass
|
||||
except Exception as e:
|
||||
print(e)
|
||||
|
||||
if res_list:
|
||||
# Sort by market cap in descending order
|
||||
@ -386,8 +386,8 @@ async def get_overbought_stocks():
|
||||
'rsi': rsi
|
||||
})
|
||||
|
||||
except:
|
||||
pass
|
||||
except Exception as e:
|
||||
print(e)
|
||||
|
||||
if res_list:
|
||||
# Sort by market cap in descending order
|
||||
@ -417,8 +417,8 @@ async def get_top_dividend_stocks():
|
||||
analyst_counter = stock_screener_data_dict[symbol].get('analystCounter',0)
|
||||
dividend_yield = stock_screener_data_dict[symbol].get('dividendYield',0)
|
||||
payout_ratio = stock_screener_data_dict[symbol].get('payoutRatio',100)
|
||||
|
||||
if analyst_rating in ['Buy','Strong Buy'] and analyst_counter >= 10 and dividend_yield > 2 and payout_ratio < 60:
|
||||
country = stock_screener_data_dict[symbol].get('country',None)
|
||||
if country == 'United States' and analyst_rating in ['Buy','Strong Buy'] and analyst_counter >= 10 and dividend_yield >=2 and payout_ratio < 60:
|
||||
quote_data = await get_quote_data(symbol)
|
||||
|
||||
# Assign price and volume, and check if they meet the penny stock criteria
|
||||
@ -437,8 +437,7 @@ async def get_top_dividend_stocks():
|
||||
'marketCap': marketCap,
|
||||
'dividendYield': dividend_yield
|
||||
})
|
||||
except Exception as e:
|
||||
print(e)
|
||||
except:
|
||||
pass
|
||||
|
||||
if res_list:
|
||||
|
||||
@ -759,14 +759,15 @@ async def get_stock_screener(con):
|
||||
with open(f"json/dividends/companies/{symbol}.json", 'r') as file:
|
||||
res = orjson.loads(file.read())
|
||||
item['annualDividend'] = round(res['annualDividend'],2)
|
||||
item['dividendYield'] = round(res['dividendYield'],2)
|
||||
item['payoutRatio'] = round(res['payoutRatio'],2)
|
||||
item['dividendGrowth'] = round(res['dividendGrowth'],2)
|
||||
except:
|
||||
item['annualDividend'] = None
|
||||
item['dividendYield'] = None
|
||||
item['payoutRatio'] = None
|
||||
item['dividendGrowth'] = None
|
||||
|
||||
#data is from financialdata
|
||||
item['dividendYield'] = round(item['dividendYield'] * 100, 2) if item['dividendYield'] is not None else item['dividendYield']
|
||||
item['payoutRatio'] = round(item['payoutRatio'] * 100, 2) if item['payoutRatio'] is not None else item['payoutRatio']
|
||||
|
||||
|
||||
try:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user