This following Python program is my current guide for https://www.investopedia.com/simulator/ stock investments.
My strategy is to identify solid companies who have the most to gain from what I believe are imminent breakthroughs in medicine and energy due to advances in Artificial Intelligence assisted research.
"""====================================================================FRONTIER ALPHAStrategic Long-Term Equity Analysis Engine====================================================================DESCRIPTION--------------------------------------------------------------------Frontier Alpha is a long-term stock analysis and strategic researchprogram focused on:- Computational biology- AI medicine- Cancer therapeutics- Genomics- Gene editing- AI infrastructure- Nuclear energy- Scientific computing- Frontier technologiesThe engine evaluates companies using:1. Financial durability2. Strategic importance3. Scientific relevance4. Execution quality5. Valuation qualityThis program is for educational and research purposes only.NOT FINANCIAL ADVICE.===================================================================="""import yfinance as yfimport pandas as pdimport numpy as npimport textwrapimport re# ================================================================# STOCK LIST# ================================================================stocks = { # ============================================================ # COMPUTATIONAL BIOLOGY / AI MEDICINE # ============================================================ "ABCL": "AbCellera", "RXRX": "Recursion Pharmaceuticals", "SDGR": "Schrodinger", "TEM": "Tempus AI", "DNA": "Ginkgo Bioworks", "EXAI": "Exscientia", "CRSP": "CRISPR Therapeutics", "BEAM": "Beam Therapeutics", "NTLA": "Intellia Therapeutics", "EDIT": "Editas Medicine", "VRTX": "Vertex Pharmaceuticals", "MRNA": "Moderna", "BNTX": "BioNTech", "ILMN": "Illumina", "PACB": "Pacific Biosciences", "GH": "Guardant Health", "NTRA": "Natera", "TXG": "10x Genomics", "SANA": "Sana Biotechnology", "RLAY": "Relay Therapeutics", "REGN": "Regeneron Pharmaceuticals", # ============================================================ # AI / INFRASTRUCTURE # ============================================================ "NVDA": "NVIDIA", "AMD": "AMD", "AVGO": "Broadcom", "GOOGL": "Alphabet", "MSFT": "Microsoft", "AMZN": "Amazon", "PLTR": "Palantir", # ============================================================ # QUANTUM COMPUTING # ============================================================ "IONQ": "IonQ", "QBTS": "D-Wave Quantum", "RGTI": "Rigetti Computing", # ============================================================ # NUCLEAR / ENERGY / MATERIALS # ============================================================ "CCO.TO": "Cameco", "NXE.TO": "NexGen Energy", "LEU": "Centrus Energy", "SMR": "NuScale Power", "OKLO": "Oklo", "CEG": "Constellation Energy"}# ================================================================# THEMES / STRATEGIC THESIS# ================================================================themes = { "ABCL": "AI-assisted antibody discovery and advanced biologics platform.", "RXRX": "Machine learning and automated experimental biology for drug discovery.", "SDGR": "Computational chemistry and molecular simulation company.", "TEM": "AI-driven clinical intelligence and precision medicine platform.", "DNA": "Synthetic biology and programmable cellular engineering company.", "EXAI": "AI-native pharmaceutical discovery company.", "CRSP": "Leader in CRISPR-based gene editing therapeutics.", "BEAM": "Base editing technology for advanced genetic medicine.", "NTLA": "In-vivo CRISPR therapeutics company targeting severe diseases.", "EDIT": "Gene editing platform focused on difficult diseases.", "VRTX": "Highly successful biotechnology company with gene therapy exposure.", "MRNA": "mRNA therapeutics and oncology platform company.", "BNTX": "Advanced oncology and mRNA immunotherapy research company.", "ILMN": "Global DNA sequencing and genomics leader.", "PACB": "Long-read sequencing technology company.", "GH": "Cancer detection and liquid biopsy diagnostics platform.", "NTRA": "Precision genetic diagnostics and screening company.", "TXG": "Single-cell genomics and biological analysis company.", "SANA": "Regenerative medicine and engineered cell therapeutics company.", "RLAY": "Precision oncology and computational drug design company.", "REGN": "Major biotechnology and antibody therapeutics company.", "NVDA": "Critical infrastructure provider for AI and scientific computing.", "AMD": "Advanced AI accelerator and semiconductor company.", "AVGO": "Strategic semiconductor and networking infrastructure provider.", "GOOGL": "Global AI research, cloud, and infrastructure leader.", "MSFT": "Enterprise AI infrastructure and cloud computing giant.", "AMZN": "AI infrastructure and cloud computing through AWS.", "PLTR": "AI operating systems and strategic data analysis platform.", "IONQ": "Trapped-ion quantum computing company.", "QBTS": "Quantum annealing and quantum systems developer.", "RGTI": "Quantum hardware and superconducting quantum systems company.", "CCO.TO": "Major uranium supplier supporting global nuclear expansion.", "NXE.TO": "High-grade uranium development company.", "LEU": "Strategic nuclear fuel and uranium enrichment company.", "SMR": "Small modular nuclear reactor developer.", "OKLO": "Advanced micro-reactor nuclear technology company.", "CEG": "Large-scale nuclear energy generation company."}# ================================================================# ANALYSIS ENGINE# ================================================================results = []print("\n============================================================")print(" FRONTIER ALPHA INITIALIZING")print("============================================================\n")for ticker, company_name in stocks.items(): print(f"Analyzing {ticker}...") try: stock = yf.Ticker(ticker) info = stock.info # ======================================================== # BASIC INFO # ======================================================== current_price = info.get( "currentPrice", info.get("regularMarketPrice", 0) ) market_cap = info.get("marketCap", 0) # ======================================================== # LONG DESCRIPTION # ======================================================== long_description = None description_fields = [ "longBusinessSummary", "businessSummary", "description" ] for field in description_fields: value = info.get(field) if isinstance(value, str): if ( long_description is None or len(value) > len(long_description) ): long_description = value if not long_description: long_description = ( f"{company_name} operates in advanced science, " f"medicine, energy, AI infrastructure, or frontier " f"technology sectors." ) # ======================================================== # FACTOR 1: FINANCIAL STRENGTH # ======================================================== revenue_growth = info.get("revenueGrowth", 0) debt_to_equity = info.get("debtToEquity", 1000) free_cashflow = info.get("freeCashflow", 0) financial_score = 0 if revenue_growth: financial_score += min( max(revenue_growth * 50, 0), 50 ) if debt_to_equity < 50: financial_score += 30 elif debt_to_equity < 100: financial_score += 15 if free_cashflow and free_cashflow > 0: financial_score += 20 # ======================================================== # FACTOR 2: STRATEGIC POSITIONING # ======================================================== gross_margins = info.get("grossMargins", 0) strategic_score = 0 if market_cap > 1_000_000_000: strategic_score += 40 if gross_margins: strategic_score += min( gross_margins * 60, 60 ) # ======================================================== # FACTOR 3: EXECUTION QUALITY # ======================================================== return_1y = info.get("52WeekChange", 0) operating_margins = info.get("operatingMargins", 0) execution_score = 0 if return_1y: execution_score += min( max(return_1y * 50, 0), 50 ) if operating_margins: execution_score += min( max(operating_margins * 50, 0), 50 ) # ======================================================== # FACTOR 4: VALUATION QUALITY # ======================================================== trailing_pe = info.get("trailingPE") price_to_book = info.get("priceToBook") shares_outstanding = info.get("sharesOutstanding", 0) valuation_score = 0 if trailing_pe: if 5 <= trailing_pe <= 25: valuation_score += 40 elif 25 < trailing_pe <= 50: valuation_score += 25 elif trailing_pe < 5: valuation_score += 10 if price_to_book: if price_to_book <= 3: valuation_score += 30 elif price_to_book <= 8: valuation_score += 15 if shares_outstanding: if shares_outstanding < 500_000_000: valuation_score += 30 elif shares_outstanding < 2_000_000_000: valuation_score += 15 # ======================================================== # SCIENCE / AI BONUS # ======================================================== science_bonus = 0 science_keywords = [ "ai", "artificial intelligence", "gene", "genomics", "crispr", "cancer", "oncology", "sequencing", "drug discovery", "precision medicine", "mrna", "biology", "cell therapy", "molecular" ] desc_lower = long_description.lower() for keyword in science_keywords: if keyword in desc_lower: science_bonus += 3 science_bonus = min(science_bonus, 25) # ======================================================== # FINAL SCORE # ======================================================== total_score = ( financial_score * 0.30 + strategic_score * 0.25 + execution_score * 0.20 + valuation_score * 0.15 + science_bonus * 0.10 ) # ======================================================== # SAVE RESULTS # ======================================================== results.append({ "Ticker": ticker, "Company": company_name, "Price": round(current_price, 2), "Financial": round(financial_score, 2), "Strategic": round(strategic_score, 2), "Execution": round(execution_score, 2), "Valuation": round(valuation_score, 2), "ScienceBonus": round(science_bonus, 2), "P/E": trailing_pe, "P/B": price_to_book, "Debt/Equity": debt_to_equity, "Total": round(total_score, 2), "Theme": themes.get( ticker, "No strategic thesis available." ), "LongDescription": long_description }) except Exception as e: print(f"[ERROR] Failed to analyze {ticker}") print(e)# ================================================================# DATAFRAME# ================================================================df = pd.DataFrame(results)# ================================================================# NORMALIZE SCORE# ================================================================max_score = df["Total"].max()df["Normalized"] = round( (df["Total"] / max_score) * 100, 2)# ================================================================# SORT# ================================================================df = df.sort_values( by="Normalized", ascending=False)# ================================================================# TOP 10 OUTPUT# ================================================================print("\n============================================================")print(" TOP 10 STRATEGIC LONG-TERM COMPANIES")print("============================================================\n")top10 = df.head(10)for i, row in enumerate(top10.itertuples(), 1): print(f"{i}. {row.Ticker} - {row.Company}") print(f" Current Price : ${row.Price}") print(f" Normalized Score : {row.Normalized}/100") print(f"\n Factor Scores") print(f" --------------------------------------") print(f" Financial : {row.Financial}") print(f" Strategic : {row.Strategic}") print(f" Execution : {row.Execution}") print(f" Valuation : {row.Valuation}") print(f" Science/AI Bonus : {row.ScienceBonus}") print(f"\n Valuation Metrics") print(f" --------------------------------------") print(f" P/E Ratio : {row._9}") print(f" Price/Book : {row._10}") print(f" Debt/Equity : {row._11}") print(f"\n Long-Term Strategic Thesis") print(f" --------------------------------------") thesis = f"""{row.Company} operates in a sector considered strategicallyimportant for the coming decade and potentially beyond.Primary relevance areas include:- Artificial intelligence- Computational biology- Precision medicine- Cancer therapeutics- Genomics- Scientific computing- Nuclear energy- Advanced infrastructureCompany-specific strategic role:{row.Theme}Business Overview:{row.LongDescription}""" wrapped_text = textwrap.fill( thesis, width=78, initial_indent=" ", subsequent_indent=" " ) print(wrapped_text.replace(". ", ".\n\n ")) print("\n============================================================\n")
