AI and I: More Stock Research Stuff

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 ALPHA
Strategic Long-Term Equity Analysis Engine
====================================================================
DESCRIPTION
--------------------------------------------------------------------
Frontier Alpha is a long-term stock analysis and strategic research
program focused on:
- Computational biology
- AI medicine
- Cancer therapeutics
- Genomics
- Gene editing
- AI infrastructure
- Nuclear energy
- Scientific computing
- Frontier technologies
The engine evaluates companies using:
1. Financial durability
2. Strategic importance
3. Scientific relevance
4. Execution quality
5. Valuation quality
This program is for educational and research purposes only.
NOT FINANCIAL ADVICE.
====================================================================
"""
import yfinance as yf
import pandas as pd
import numpy as np
import textwrap
import 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 strategically
important 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 infrastructure
Company-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")

AI and I: Frontier Alpha

"""
====================================================================
FRONTIER ALPHA
Strategic Long-Term Equity Analysis Engine
====================================================================
DESCRIPTION
--------------------------------------------------------------------
Frontier Alpha is a long-term stock analysis program designed to
evaluate strategic technology, energy, mineral, and computational
biology companies using financial and market data from Yahoo Finance.
The program focuses on identifying companies with:
1. Financial durability
2. Strategic long-term relevance
3. Strong execution capability
4. Reasonable valuation
This tool is intended for educational and research purposes.
It is NOT financial advice.
====================================================================
INSTALLATION
====================================================================
Install required packages:
pip install yfinance pandas numpy
====================================================================
HOW TO USE
====================================================================
1. Modify the STOCK LIST dictionary to add/remove companies.
2. Run the script:
python frontier_alpha.py
3. The program will:
- download company financial data
- calculate factor scores
- normalize rankings
- print top companies
- print company descriptions and strengths
====================================================================
SCORING FACTORS
====================================================================
1. Financial Strength
- Revenue growth
- Debt levels
- Free cash flow
2. Strategic Position
- Market capitalization
- Gross margins
- Industry importance
3. Execution Quality
- 52-week stock performance
- Operating margins
4. Valuation Quality
- P/E ratio
- Price-to-book ratio
- Share dilution risk
====================================================================
"""
import yfinance as yf
import pandas as pd
import numpy as np
# ================================================================
# STOCK LIST
# ================================================================
stocks = {
# Uranium / Minerals
"CCO.TO": "Cameco",
"DML.TO": "Denison Mines",
"NXE.TO": "NexGen Energy",
"TECK-B.TO": "Teck Resources",
"FM.TO": "First Quantum Minerals",
"LUN.TO": "Lundin Mining",
"IVN.TO": "Ivanhoe Mines",
# Computational Biology / AI
"ABCL": "AbCellera",
"RXRX": "Recursion Pharmaceuticals",
"SDGR": "Schrodinger",
"TEM": "Tempus AI",
"NVDA": "NVIDIA",
"ILMN": "Illumina",
"BNTX": "BioNTech",
# Quantum / Cryptography
"QBTS": "D-Wave Quantum",
"IONQ": "IonQ",
"RGTI": "Rigetti Computing",
"QNC.V": "Quantum eMotion",
"BTQ.NE": "BTQ Technologies",
# Energy / Nuclear
"BEP": "Brookfield Renewable",
"CEG": "Constellation Energy",
"OKLO": "Oklo",
"SMR": "NuScale Power",
"LEU": "Centrus Energy"
}
# ================================================================
# COMPANY THEMES / STRENGTHS
# ================================================================
themes = {
"CCO.TO": "Major Canadian uranium producer supporting global nuclear energy expansion.",
"DML.TO": "Canadian uranium development company focused on long-term uranium demand.",
"NXE.TO": "Owns one of the world's highest-grade undeveloped uranium projects.",
"TECK-B.TO": "Large diversified Canadian mining company with major copper exposure.",
"FM.TO": "Global copper producer benefiting from electrification demand.",
"LUN.TO": "Copper and nickel exposure tied to EV and infrastructure growth.",
"IVN.TO": "High-growth copper mining projects with strong strategic relevance.",
"ABCL": "AI-assisted antibody discovery platform for pharmaceutical development.",
"RXRX": "Uses machine learning and automation for drug discovery.",
"SDGR": "Computational chemistry and molecular simulation leader.",
"TEM": "AI-driven healthcare and clinical data analysis platform.",
"NVDA": "Critical AI infrastructure provider powering modern AI systems.",
"ILMN": "Dominant genomics and DNA sequencing company.",
"BNTX": "Advanced oncology and mRNA research company.",
"QBTS": "Canadian quantum computing company focused on annealing systems.",
"IONQ": "Trapped-ion quantum computing company with strong partnerships.",
"RGTI": "Quantum hardware development company.",
"QNC.V": "Quantum entropy and cybersecurity technology company.",
"BTQ.NE": "Post-quantum cryptography and quantum security research company.",
"BEP": "Major renewable infrastructure operator.",
"CEG": "Large nuclear power generation company.",
"OKLO": "Small modular nuclear reactor company.",
"SMR": "Small modular reactor development company.",
"LEU": "Strategic nuclear fuel and uranium enrichment 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
# ========================================================
# CURRENT STOCK PRICE
# ========================================================
current_price = info.get("currentPrice")
if current_price is None:
current_price = info.get("regularMarketPrice", 0)
# ========================================================
# 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
# Revenue growth score
if revenue_growth:
financial_score += min(max(revenue_growth * 50, 0), 50)
# Debt score
if debt_to_equity < 50:
financial_score += 30
elif debt_to_equity < 100:
financial_score += 15
# Free cash flow score
if free_cashflow and free_cashflow > 0:
financial_score += 20
# ========================================================
# FACTOR 2: STRATEGIC POSITIONING
# ========================================================
market_cap = info.get("marketCap", 0)
gross_margins = info.get("grossMargins", 0)
strategic_score = 0
if market_cap > 1_000_000_000:
strategic_score += 50
if gross_margins:
strategic_score += min(gross_margins * 50, 50)
# ========================================================
# 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
# -----------------------------
# P/E Ratio Score
# -----------------------------
if trailing_pe:
if 5 <= trailing_pe <= 20:
valuation_score += 40
elif 20 < trailing_pe <= 35:
valuation_score += 25
elif trailing_pe < 5:
valuation_score += 10
# -----------------------------
# Price-to-Book Score
# -----------------------------
if price_to_book:
if price_to_book <= 3:
valuation_score += 30
elif price_to_book <= 6:
valuation_score += 15
# -----------------------------
# Share Dilution / Stability
# -----------------------------
if shares_outstanding:
if shares_outstanding < 500_000_000:
valuation_score += 30
elif shares_outstanding < 2_000_000_000:
valuation_score += 15
# ========================================================
# FINAL SCORE
# ========================================================
total_score = (
financial_score * 0.35 +
strategic_score * 0.25 +
execution_score * 0.20 +
valuation_score * 0.20
)
# ========================================================
# 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),
"P/E": trailing_pe,
"P/B": price_to_book,
"Debt/Equity": debt_to_equity,
"Total": round(total_score, 2),
"Description": themes.get(
ticker,
"No description available."
)
})
except Exception as e:
print(f"[ERROR] Failed to analyze {ticker}")
print(e)
# ================================================================
# CREATE DATAFRAME
# ================================================================
df = pd.DataFrame(results)
# ================================================================
# NORMALIZED SCORE
# ================================================================
max_score = df["Total"].max()
df["Normalized"] = round(
(df["Total"] / max_score) * 100,
2
)
# ================================================================
# SORT DESCENDING
# ================================================================
df = df.sort_values(
by="Normalized",
ascending=False
)
# ================================================================
# PRINT TOP RESULTS
# ================================================================
print("\n============================================================")
print(" TOP 10 LONG-TERM STRATEGIC 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" Financial Score : {row.Financial}")
print(f" Strategic Score : {row.Strategic}")
print(f" Execution Score : {row.Execution}")
print(f" Valuation Score : {row.Valuation}")
print("\n Valuation Metrics:")
print(f" P/E Ratio : {row._8}")
print(f" Price/Book : {row._9}")
print(f" Debt/Equity : {row._10}")
print(f"\n Description:")
print(f" {row.Description}")
print("\n------------------------------------------------------------\n")
# ================================================================
# COMPLETE RANKINGS
# ================================================================
print("\n============================================================")
print(" COMPLETE RANKINGS")
print("============================================================\n")
print(df[[
"Ticker",
"Company",
"Price",
"Normalized"
]].to_string(index=False))
print("\n============================================================")
print(" ANALYSIS COMPLETE")
print("============================================================\n")

AI and I

Myself and ChatCPT have developed the following stock analysis program using the Python yfinance library to identify research starting points for ten solid Canadian stocks.

"""
====================================================================
FRONTIER ALPHA
Strategic Long-Term Equity Analysis Engine
====================================================================
DESCRIPTION
--------------------------------------------------------------------
Frontier Alpha is a long-term stock analysis program designed to
evaluate strategic technology, energy, mineral, and computational
biology companies using financial and market data from Yahoo Finance.
The program focuses on identifying companies with:
1. Financial durability
2. Strategic long-term relevance
3. Strong execution capability
This tool is intended for educational and research purposes.
It is NOT financial advice.
====================================================================
INSTALLATION
====================================================================
Install required packages:
pip install yfinance pandas numpy
====================================================================
HOW TO USE
====================================================================
1. Modify the STOCK LIST dictionary to add/remove companies.
2. Run the script:
python frontier_alpha.py
3. The program will:
- download company financial data
- calculate factor scores
- normalize rankings
- print top companies
- print company descriptions and strengths
====================================================================
SCORING FACTORS
====================================================================
1. Financial Strength
- Revenue growth
- Debt levels
- Free cash flow
2. Strategic Position
- Market capitalization
- Gross margins
- Industry importance
3. Execution Quality
- 52-week stock performance
- Operating margins
====================================================================
"""
import yfinance as yf
import pandas as pd
import numpy as np
# ================================================================
# STOCK LIST
# ================================================================
stocks = {
# Uranium / Minerals
"CCO.TO": "Cameco",
"DML.TO": "Denison Mines",
"NXE.TO": "NexGen Energy",
"TECK-B.TO": "Teck Resources",
"FM.TO": "First Quantum Minerals",
"LUN.TO": "Lundin Mining",
"IVN.TO": "Ivanhoe Mines",
# Computational Biology / AI
"ABCL": "AbCellera",
"RXRX": "Recursion Pharmaceuticals",
"SDGR": "Schrodinger",
"TEM": "Tempus AI",
"NVDA": "NVIDIA",
"ILMN": "Illumina",
"BNTX": "BioNTech",
# Quantum / Cryptography
"QBTS": "D-Wave Quantum",
"IONQ": "IonQ",
"RGTI": "Rigetti Computing",
"QNC.V": "Quantum eMotion",
"BTQ.NE": "BTQ Technologies",
# Energy / Nuclear
"BEP": "Brookfield Renewable",
"CEG": "Constellation Energy",
"OKLO": "Oklo",
"SMR": "NuScale Power",
"LEU": "Centrus Energy"
}
# ================================================================
# COMPANY THEMES / STRENGTHS
# ================================================================
themes = {
"CCO.TO": "Major Canadian uranium producer supporting global nuclear energy expansion.",
"DML.TO": "Canadian uranium development company focused on long-term uranium demand.",
"NXE.TO": "Owns one of the world's highest-grade undeveloped uranium projects.",
"TECK-B.TO": "Large diversified Canadian mining company with major copper exposure.",
"FM.TO": "Global copper producer benefiting from electrification demand.",
"LUN.TO": "Copper and nickel exposure tied to EV and infrastructure growth.",
"IVN.TO": "High-growth copper mining projects with strong strategic relevance.",
"ABCL": "AI-assisted antibody discovery platform for pharmaceutical development.",
"RXRX": "Uses machine learning and automation for drug discovery.",
"SDGR": "Computational chemistry and molecular simulation leader.",
"TEM": "AI-driven healthcare and clinical data analysis platform.",
"NVDA": "Critical AI infrastructure provider powering modern AI systems.",
"ILMN": "Dominant genomics and DNA sequencing company.",
"BNTX": "Advanced oncology and mRNA research company.",
"QBTS": "Canadian quantum computing company focused on annealing systems.",
"IONQ": "Trapped-ion quantum computing company with strong partnerships.",
"RGTI": "Quantum hardware development company.",
"QNC.V": "Quantum entropy and cybersecurity technology company.",
"BTQ.NE": "Post-quantum cryptography and quantum security research company.",
"BEP": "Major renewable infrastructure operator.",
"CEG": "Large nuclear power generation company.",
"OKLO": "Small modular nuclear reactor company.",
"SMR": "Small modular reactor development company.",
"LEU": "Strategic nuclear fuel and uranium enrichment 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
# ========================================================
# 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
# Revenue growth score
if revenue_growth:
financial_score += min(max(revenue_growth * 50, 0), 50)
# Debt score
if debt_to_equity < 50:
financial_score += 30
elif debt_to_equity < 100:
financial_score += 15
# Free cash flow score
if free_cashflow and free_cashflow > 0:
financial_score += 20
# ========================================================
# FACTOR 2: STRATEGIC POSITIONING
# ========================================================
market_cap = info.get("marketCap", 0)
gross_margins = info.get("grossMargins", 0)
strategic_score = 0
if market_cap > 1_000_000_000:
strategic_score += 50
if gross_margins:
strategic_score += min(gross_margins * 50, 50)
# ========================================================
# 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)
# ========================================================
# FINAL SCORE
# ========================================================
total_score = (
financial_score * 0.40 +
strategic_score * 0.35 +
execution_score * 0.25
)
# ========================================================
# SAVE RESULTS
# ========================================================
results.append({
"Ticker": ticker,
"Company": company_name,
"Financial": round(financial_score, 2),
"Strategic": round(strategic_score, 2),
"Execution": round(execution_score, 2),
"Total": round(total_score, 2),
"Description": themes.get(
ticker,
"No description available."
)
})
except Exception as e:
print(f"[ERROR] Failed to analyze {ticker}")
print(e)
# ================================================================
# CREATE DATAFRAME
# ================================================================
df = pd.DataFrame(results)
# Normalize score to 100
max_score = df["Total"].max()
df["Normalized"] = round(
(df["Total"] / max_score) * 100,
2
)
# Sort descending
df = df.sort_values(
by="Normalized",
ascending=False
)
# ================================================================
# PRINT TOP RESULTS
# ================================================================
print("\n============================================================")
print(" TOP 10 LONG-TERM STRATEGIC COMPANIES")
print("============================================================\n")
top10 = df.head(10)
for i, row in enumerate(top10.itertuples(), 1):
print(f"{i}. {row.Ticker} - {row.Company}")
print(f" Normalized Score : {row.Normalized}/100")
print(f" Financial Score : {row.Financial}")
print(f" Strategic Score : {row.Strategic}")
print(f" Execution Score : {row.Execution}")
print(f"\n Description:")
print(f" {row.Description}")
print("\n------------------------------------------------------------\n")
# ================================================================
# COMPLETE RANKINGS
# ================================================================
print("\n============================================================")
print(" COMPLETE RANKINGS")
print("============================================================\n")
print(df[[
"Ticker",
"Company",
"Normalized"
]].to_string(index=False))
print("\n============================================================")
print(" ANALYSIS COMPLETE")
print("============================================================\n")

JavaScript Bookmark: Instant Page Overlay

This bookmark creates an instant canvas overlay with creative line arranging thing. Press j to go back, f to switch between nodes, and arrows to move nodes.

javascript:(()=>{function makeCanvas(){if(window.__fullOverlayCleanup)return;const c=document.createElement('canvas');c.id='full-overlay-canvas';Object.assign(c.style,{background:'#bfbfbf',position:'fixed',left:0,top:0,width:'100vw',height:'100vh',border:'none',zIndex:999999,cursor:'default'});document.title='Productivity';document.body.appendChild(c);const x=c.getContext('2d');function resize(){c.width=innerWidth;c.height=innerHeight}addEventListener('resize',resize);resize();const S=8,sq=Array.from({length:10},()=>({x:Math.random()*(c.width-S-10)+5,y:Math.random()*(c.height-S-10)+5,w:S,h:S}));let sel=0,keys={ArrowUp:0,ArrowDown:0,ArrowLeft:0,ArrowRight:0},spd=4;function draw(){x.clearRect(0,0,c.width,c.height);x.fillStyle='#bfbfbf';x.fillRect(0,0,c.width,c.height);x.lineWidth=.5;x.strokeStyle='#0008';for(let i=0;i<sq.length;i++)for(let j=i+1;j<sq.length;j++){let a=sq[i],b=sq[j];x.beginPath();x.moveTo(a.x+a.w/2,a.y+a.h/2);x.lineTo(b.x+b.w/2,b.y+b.h/2);x.stroke()}for(let i=0;i<sq.length;i++){x.fillStyle=i===sel?'#ff3':'#222';let s=sq[i];x.fillRect(s.x,s.y,s.w,s.h)}x.font='12px monospace';x.fillStyle='#111';x.fillText(`Selected: ${sel} (michael)`,10,c.height-10)}function clamp(s){if(s.x<0)s.x=0;if(s.y<0)s.y=0;if(s.x+s.w>c.width)s.x=c.width-s.w;if(s.y+s.h>c.height)s.y=c.height-s.h}let last=performance.now();function tick(){const now=performance.now();last=now;let h=(keys.ArrowLeft?-1:0)+(keys.ArrowRight?1:0),v=(keys.ArrowUp?-1:0)+(keys.ArrowDown?1:0);if(h||v){let s=sq[sel];s.x+=h*spd;s.y+=v*spd;clamp(s)}draw();requestAnimationFrame(tick)}function kd(e){if(e.key in keys){keys[e.key]=1;e.preventDefault()}else if(e.key=='f'||e.key=='F'){sel=(sel+1)%sq.length;e.preventDefault()}}function ku(e){if(e.key in keys){keys[e.key]=0;e.preventDefault()}}addEventListener('keydown',kd);addEventListener('keyup',ku);window.__fullOverlayCleanup=()=>{removeEventListener('keydown',kd);removeEventListener('keyup',ku);removeEventListener('resize',resize);c.remove();delete window.__fullOverlayCleanup;console.log('Overlay removed.')};draw();requestAnimationFrame(tick)}document.addEventListener('keydown',e=>{if(/^[a-z]$/i.test(e.key) && (e.key.toLowerCase() !== 'j' && e.key.toLowerCase() !== 'f')){if(!window.__fullOverlayCleanup)makeCanvas()}else if(e.key==='j'||e.key==='J'){if(window.__fullOverlayCleanup)window.__fullOverlayCleanup()}});})();

Embed Tiny Canvas in Web Page

Template to build mini-games that can be inserted into any page. Add in browser console.

(function () {
  const canvas = document.createElement('canvas');
  canvas.id = 'mini-canvas';
  canvas.width = 400;
  canvas.height = 300;
  Object.assign(canvas.style, {
    background: '#bfbfbf',
    position: 'fixed',
    left: '1%',
    bottom: '1%',
    border: '1px solid #333',
    zIndex: 999999,
    cursor: 'default',
  });
  document.body.appendChild(canvas);
  const ctx = canvas.getContext('2d');

  const S = 6;
  const padding = 4;
  const squares = Array.from({ length: 10 }, () => ({
    x: Math.random() * (canvas.width - S - 10) + 5,
    y: Math.random() * (canvas.height - S - 10) + 5,
    w: S,
    h: S,
  }));
  let selected = 0;

  const keys = {
    ArrowUp: false,
    ArrowDown: false,
    ArrowLeft: false,
    ArrowRight: false,
  };
  const speed = 3;

  function draw() {
    ctx.clearRect(0, 0, canvas.width, canvas.height);
    ctx.fillStyle = '#bfbfbf';
    ctx.fillRect(0, 0, canvas.width, canvas.height);
    ctx.lineWidth = 0.5;
    ctx.strokeStyle = '#0008';
    for (let i = 0; i < squares.length; i++) {
      for (let j = i + 1; j < squares.length; j++) {
        const a = squares[i],
          b = squares[j];
        ctx.beginPath();
        ctx.moveTo(a.x + a.w / 2, a.y + a.h / 2);
        ctx.lineTo(b.x + b.w / 2, b.y + b.h / 2);
        ctx.stroke();
      }
    }
    ctx.font = '8px sans-serif';
    ctx.fillStyle = '#111';
    ctx.fillText(`Selected: ${selected}  (mike is best)`, 6, canvas.height - 6);
  }

  function clampSquare(sq) {
    if (sq.x < 0) sq.x = 0;
    if (sq.y < 0) sq.y = 0;
    if (sq.x + sq.w > canvas.width) sq.x = canvas.width - sq.w;
    if (sq.y + sq.h > canvas.height) sq.y = canvas.height - sq.h;
  }

  let last = performance.now();
  function tick() {
    const now = performance.now();
    const dt = now - last;
    last = now;
    const move = (keys.ArrowLeft ? -1 : 0) + (keys.ArrowRight ? 1 : 0);
    const vmove = (keys.ArrowUp ? -1 : 0) + (keys.ArrowDown ? 1 : 0);
    if (move !== 0 || vmove !== 0) {
      const sq = squares[selected];
      sq.x += move * speed;
      sq.y += vmove * speed;
      clampSquare(sq);
      draw();
    }
    requestAnimationFrame(tick);
  }

  function onKeyDown(e) {
    if (e.key in keys) {
      keys[e.key] = true;
      e.preventDefault();
    } else if (e.key === 'f' || e.key === 'F') {
      selected = (selected + 1) % squares.length;
      draw();
      e.preventDefault();
    }
  }

  function onKeyUp(e) {
    if (e.key in keys) {
      keys[e.key] = false;
      e.preventDefault();
    }
  }

  window.addEventListener('keydown', onKeyDown, { capture: false });
  window.addEventListener('keyup', onKeyUp, { capture: false });
  window.__miniCanvasCleanup = function () {
    window.removeEventListener('keydown', onKeyDown);
    window.removeEventListener('keyup', onKeyUp);
    if (canvas && canvas.parentNode) canvas.parentNode.removeChild(canvas);
    delete window.__miniCanvasCleanup;
    console.log('mini-canvas removed and handlers cleaned up.');
  };
  draw();
  requestAnimationFrame(tick);
})();

Removing Banners and Pop-Ups

General

javascript:(function(){document.querySelectorAll("[id*='someIdNameOrSegment']").forEach(el=>el.remove());})();

apnews.com pop-up

javascript:[…document.querySelectorAll("[id*='primis_player']")].forEach(el => el.remove());

Run once every second

javascript:setInterval(() => {document.querySelectorAll("[id*='hu']").forEach(el => el.remove());}, 1000);

Page manipulation: Skew all images based on mouse position

Create a bookmark, right click to edit.

javascript:document.addEventListener("mousemove", e => {const xPercent = e.clientX / window.innerWidth;const yPercent = e.clientY / window.innerHeight;const skewX = (xPercent - 0.5) * 40;const skewY = (yPercent - 0.5) * 40;document.querySelectorAll("img").forEach(f => {f.style.transform = `skew(${skewX}deg, ${skewY}deg)`;});});

Danger of AES-256-GCM Key/IV Reuse

Demonstration of AES-256-GCM key and IV (nonce) reuse leading to exposure of encrypted plaintext.

Where:
p1 is known plaintext
c1 is plaintext encrypted with unknown key and IV
c1 is unknown plaintext encrypted with same key and iv

from Crypto.Util.number import *

# Key and IV provided if you would like to check
k = 0xec42948a676ae8da1b23f70e6cb0ebf49ff1cb043812f4946e06da69fce3ef90
iv = 0x34774a1b67fdc31869c7723e80abfdb1

p1 = bytes_to_long(b'THIS IS KNOWN PLAINTEXT!')
c1 = 0xac966da242b9192940371edb836afceee698eeb96b7b95ce # p1 ciphertext
c2 = 0xac9174d131b5095b4e2d71cf810bfff1ee97e9a86a02e0ce # p2 ciphertext

# Solve for p2 plaintext using XOR
p2 = c1 ^ c2 ^ p1
print(long_to_bytes(p2))

This gives us recovered unknown plaintext:
“TOP SECRET CLASSIFIED!!!”