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