revert back to old db
This commit is contained in:
parent
9d055869e5
commit
39e12a7534
@ -181,21 +181,6 @@ class StockDatabase:
|
||||
print(e)
|
||||
pass
|
||||
|
||||
# --- New Code: Check marketCap for PNK stocks ---
|
||||
# Query the exchange short name from the database for this symbol
|
||||
self.cursor.execute("SELECT exchangeShortName FROM stocks WHERE symbol = ?", (symbol,))
|
||||
row = self.cursor.fetchone()
|
||||
if row and row[0] == "PNK":
|
||||
market_cap = fundamental_data.get('marketCap')
|
||||
if market_cap is not None and market_cap < 10E9:
|
||||
# Delete the stock record as market cap is below 1 billion
|
||||
self.cursor.execute("DELETE FROM stocks WHERE symbol = ?", (symbol,))
|
||||
self.conn.commit()
|
||||
# Optionally, drop the OHLC table for that symbol if it exists
|
||||
self.cursor.execute(f"DROP TABLE IF EXISTS '{symbol}'")
|
||||
self.conn.commit()
|
||||
print(f"Deleted {symbol} from database due to marketCap ({market_cap}) below 1B.")
|
||||
return # Exit early without proceeding further
|
||||
|
||||
# Check if columns already exist in the table
|
||||
self.cursor.execute("PRAGMA table_info(stocks)")
|
||||
@ -228,22 +213,22 @@ class StockDatabase:
|
||||
for stock in stocks:
|
||||
exchange_short_name = stock.get('exchangeShortName', '')
|
||||
ticker_type = stock.get('type', '')
|
||||
if exchange_short_name in ['NYSE', 'NASDAQ','AMEX', 'PNK'] and ticker_type in ['stock']:
|
||||
if exchange_short_name in ['XETRA','NYSE', 'NASDAQ','AMEX', 'PNK','EURONEXT'] and ticker_type in ['stock']:
|
||||
symbol = stock.get('symbol', '')
|
||||
#if exchange_short_name == 'PNK' and symbol not in ['RNMBF','ODYS','FSRNQ','TSSI','DRSHF','NTDOY','OTGLF','TCEHY', 'KRKNF','BYDDY','XIACY','NSRGY','TLPFY','TLPFF']:
|
||||
# pass
|
||||
#elif exchange_short_name == 'EURONEXT' and symbol not in ['ALEUP.PA','ALNEV.PA','ALGAU.PA','ALDRV.PA','ALHYG.PA','ALVMG.PA','TEP.PA']:
|
||||
# pass
|
||||
#else:
|
||||
name = stock.get('name', '')
|
||||
exchange = stock.get('exchange', '')
|
||||
if exchange_short_name == 'PNK' and symbol not in ['ODYS','FSRNQ','TSSI','DRSHF','NTDOY','OTGLF','TCEHY', 'KRKNF','BYDDY','XIACY','NSRGY','TLPFY','TLPFF']:
|
||||
pass
|
||||
elif exchange_short_name == 'EURONEXT' and symbol not in ['ALEUP.PA','ALNEV.PA','ALGAU.PA','ALDRV.PA','ALHYG.PA','ALVMG.PA','TEP.PA']:
|
||||
pass
|
||||
else:
|
||||
name = stock.get('name', '')
|
||||
exchange = stock.get('exchange', '')
|
||||
|
||||
#if name and '-' not in symbol:
|
||||
if name:
|
||||
symbols.append(symbol)
|
||||
names.append(name)
|
||||
#if name and '-' not in symbol:
|
||||
if name:
|
||||
symbols.append(symbol)
|
||||
names.append(name)
|
||||
|
||||
ticker_data.append((symbol, name, exchange, exchange_short_name, ticker_type))
|
||||
ticker_data.append((symbol, name, exchange, exchange_short_name, ticker_type))
|
||||
|
||||
|
||||
self.cursor.execute("BEGIN TRANSACTION") # Begin a transaction
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user