bugfixing

This commit is contained in:
MuslemRahimi 2024-09-10 00:03:13 +02:00
parent 30a4f1c23d
commit 2dc21e4851
2 changed files with 7 additions and 3 deletions

View File

@ -386,7 +386,7 @@ async def get_stock_screener(con):
#Stock Screener Data #Stock Screener Data
cursor.execute("SELECT symbol, name, change_1W, change_1M, change_3M, change_6M, change_1Y, change_3Y, sma_50, sma_200, ema_50, ema_200, rsi, atr, stoch_rsi, mfi, cci, pe, marketCap, beta FROM stocks WHERE symbol NOT LIKE '%.%' AND eps IS NOT NULL AND marketCap IS NOT NULL AND beta IS NOT NULL") cursor.execute("SELECT symbol, name, change_1W, change_1M, change_3M, change_6M, change_1Y, change_3Y, sma_20, sma_50, sma_100, sma_200, ema_20, ema_50, ema_100, ema_200, rsi, atr, stoch_rsi, mfi, cci, pe, marketCap, beta FROM stocks WHERE symbol NOT LIKE '%.%' AND eps IS NOT NULL AND marketCap IS NOT NULL AND beta IS NOT NULL")
raw_data = cursor.fetchall() raw_data = cursor.fetchall()
stock_screener_data = [{ stock_screener_data = [{
'symbol': symbol, 'symbol': symbol,
@ -397,9 +397,13 @@ async def get_stock_screener(con):
'change6M': change_6M, 'change6M': change_6M,
'change1Y': change_1Y, 'change1Y': change_1Y,
'change3Y': change_3Y, 'change3Y': change_3Y,
'sma20': sma_20,
'sma50': sma_50, 'sma50': sma_50,
'sma100': sma_100,
'sma200': sma_200, 'sma200': sma_200,
'ema20': ema_20,
'ema50': ema_50, 'ema50': ema_50,
'ema100': ema_100,
'ema200': ema_200, 'ema200': ema_200,
'rsi': rsi, 'rsi': rsi,
'atr': atr, 'atr': atr,
@ -409,7 +413,7 @@ async def get_stock_screener(con):
'pe': pe, 'pe': pe,
'marketCap': marketCap, 'marketCap': marketCap,
'beta': beta, 'beta': beta,
} for (symbol, name, change_1W, change_1M, change_3M, change_6M, change_1Y, change_3Y, sma_50, sma_200, ema_50, ema_200, rsi, atr, stoch_rsi, mfi, cci, pe, marketCap, beta) in raw_data] } for (symbol, name, change_1W, change_1M, change_3M, change_6M, change_1Y, change_3Y, sma_20, sma_50, sma_100, sma_200, ema_20, ema_50, ema_100, ema_200, rsi, atr, stoch_rsi, mfi, cci, pe, marketCap, beta) in raw_data]
stock_screener_data = [{k: round(v, 2) if isinstance(v, (int, float)) else v for k, v in entry.items()} for entry in stock_screener_data] stock_screener_data = [{k: round(v, 2) if isinstance(v, (int, float)) else v for k, v in entry.items()} for entry in stock_screener_data]

View File

@ -32,7 +32,7 @@ class TASignals:
ta_df['sma_200'] = sma_indicator(self.data["Close"], window=200) ta_df['sma_200'] = sma_indicator(self.data["Close"], window=200)
ta_df['ema_20'] = ema_indicator(self.data['Close'], window=20) ta_df['ema_20'] = ema_indicator(self.data['Close'], window=20)
ta_df['ema_50'] = ema_indicator(self.data['Close'], window=50) ta_df['ema_50'] = ema_indicator(self.data['Close'], window=50)
ta_df['sma_100'] = sma_indicator(self.data["Close"], window=100) ta_df['ema_100'] = sma_indicator(self.data["Close"], window=100)
ta_df['ema_200'] = sma_indicator(self.data['Close'], window=200) ta_df['ema_200'] = sma_indicator(self.data['Close'], window=200)
ta_df['rsi'] = rsi(self.data['Close'], window=14) ta_df['rsi'] = rsi(self.data['Close'], window=14)
ta_df['stoch_rsi'] = stochrsi_k(self.data['Close'], window=14, smooth1 = 3, smooth2 =3)*100 ta_df['stoch_rsi'] = stochrsi_k(self.data['Close'], window=14, smooth1 = 3, smooth2 =3)*100